@Override
 protected void onDestroy() {
   if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) Log.d(Logging.LOG_TAG, this + " onDestroy");
   mController.removeResultCallback(mControllerResult);
   mTaskTracker.cancellAllInterrupt();
   mUIController.onActivityDestroy();
   super.onDestroy();
 }
Example #2
0
  private static Serializer appendSearchQuery(
      Context var0, EmailContent.Account var1, SearchRequest var2, Serializer var3)
      throws IOException {
    String var4 = var2.getQueryClass();
    String var5 = var2.getQueryText();
    String var6 = var2.getQueryFreeText();
    long[] var7 = var2.getQueryCollectionIds();
    String var8 = var2.getQueryGreaterThan();
    String var9 = var2.getQueryLessThan();
    String var10 = var2.getQueryConvIdText();
    Serializer var11;
    if (Double.parseDouble(var1.mProtocolVersion) == 2.5D) {
      if (TextUtils.isEmpty(var5)) {
        var11 = var3;
      } else {
        var11 = appendData(969, var5, var3);
      }
    } else if (TextUtils.isEmpty(var4)
        && TextUtils.isEmpty(var6)
        && (var7 == null || var7.length <= 0)
        && TextUtils.isEmpty(var8)
        && TextUtils.isEmpty(var9)) {
      var11 = var3;
    } else {
      var3 = var3.start(969).start(979);
      if (!TextUtils.isEmpty(var4)) {
        appendData(16, var4, var3);
      }

      if (var7 != null) {
        long[] var13 = var7;
        int var28 = var7.length;

        for (int var14 = 0; var14 < var28; ++var14) {
          long var15 = var13[var14];
          String var17 = "fzhang request QueryCollectionId" + var15;
          int var18 = Log.e("EasSyncService", var17);
          EmailContent.Mailbox var27 = EmailContent.Mailbox.restoreMailboxWithId(var0, var15);
          if (var27 != null && !TextUtils.isEmpty(var27.mServerId) && var10 == null) {
            String var19 = var27.mServerId;
            appendData(18, var19, var3);
          }
        }
      }

      if (!TextUtils.isEmpty(var6)) {
        appendData(981, var6, var3);
      }

      if (!TextUtils.isEmpty(var8)) {
        appendDate(987, var8, var3);
      }

      if (!TextUtils.isEmpty(var9)) {
        appendDate(986, var9, var3);
      }

      if (var10 != null) {
        byte[] var24 = Controller.getInstance(var0).getConversationID(var10);
        appendOpaqueData(992, var24, var3);
      }

      Serializer var26 = var3.end().end();
      var11 = var3;
    }

    return var11;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) Log.d(Logging.LOG_TAG, this + " onCreate");

    float fontScale = getResources().getConfiguration().fontScale;
    if (sLastFontScale != -1 && sLastFontScale != fontScale) {
      // If the font scale has been initialized, and has been detected to be different than
      // the last time the Activity ran, it means the user changed the font while no
      // Email Activity was running - we still need to purge static information though.
      onFontScaleChangeDetected();
    }
    sLastFontScale = fontScale;

    // UIController is used in onPrepareOptionsMenu(), which can be called from within
    // super.onCreate(), so we need to initialize it here.
    initUIController();

    super.onCreate(savedInstanceState);
    ActivityHelper.debugSetWindowFlags(this);

    final Intent intent = getIntent();
    boolean fromKeyguard = intent.getBooleanExtra(EXTRA_FROM_KEYGUARD, false);
    if (Logging.DEBUG_LIFECYCLE && Email.DEBUG) {
      Log.d(Logging.LOG_TAG, "FLAG_DISMISS_KEYGUARD " + fromKeyguard);
    }
    if (fromKeyguard) {
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    }

    setContentView(mUIController.getLayoutId());

    mUIController.onActivityViewReady();

    mController = Controller.getInstance(this);
    mControllerResult =
        new ControllerResultUiThreadWrapper<ControllerResult>(
            new Handler(), new ControllerResult());
    mController.addResultCallback(mControllerResult);

    // Set up views
    // TODO Probably better to extract mErrorMessageView related code into a separate class,
    // so that it'll be easy to reuse for the phone activities.
    TextView errorMessage = (TextView) findViewById(R.id.error_message);
    errorMessage.setOnClickListener(this);
    int errorBannerHeight = getResources().getDimensionPixelSize(R.dimen.error_message_height);
    mErrorBanner = new BannerController(this, errorMessage, errorBannerHeight);

    if (savedInstanceState != null) {
      mUIController.onRestoreInstanceState(savedInstanceState);
    } else {
      final MessageListContext viewContext = MessageListContext.forIntent(this, intent);
      if (viewContext == null) {
        // This might happen if accounts were deleted on another thread, and there aren't
        // any remaining
        Welcome.actionStart(this);
        finish();
        return;
      } else {
        final long messageId = intent.getLongExtra(EXTRA_MESSAGE_ID, Message.NO_MESSAGE);
        mUIController.open(viewContext, messageId);
      }
    }
    mUIController.onActivityCreated();
  }