@Override
        public void onIMServiceConnected() {
          logger.d("login#onIMServiceConnected");
          imService = imServiceConnector.getIMService();
          try {
            do {
              if (imService == null) {
                // 后台服务启动链接失败
                break;
              }
              IMLoginManager loginManager = imService.getLoginManager();
              LoginSp loginSp = imService.getLoginSp();
              if (loginManager == null || loginSp == null) {
                // 无法获取登陆控制器
                break;
              }

              LoginSp.SpLoginIdentity loginIdentity = loginSp.getLoginIdentity();
              if (loginIdentity == null) {
                // 之前没有保存任何登陆相关的,跳转到登陆页面
                break;
              }

              mNameView.setText(loginIdentity.getLoginName());
              if (TextUtils.isEmpty(loginIdentity.getPwd())) {
                // 密码为空,可能是loginOut
                break;
              }
              mPasswordView.setText(loginIdentity.getPwd());

              if (autoLogin == false) {
                break;
              }

              handleGotLoginIdentity(loginIdentity);
              return;
            } while (false);

            // 异常分支都会执行这个
            handleNoLoginIdentity();
          } catch (Exception e) {
            // 任何未知的异常
            logger.w("loadIdentity failed");
            handleNoLoginIdentity();
          }
        }