コード例 #1
0
  protected void onActivityPause(GeckoActivityStatus activity) {
    mInBackground = true;

    if ((activity.isFinishing() == false) && (activity.isGeckoActivityOpened() == false)) {
      // Notify Gecko that we are pausing; the cache service will be
      // shutdown, closing the disk cache cleanly. If the android
      // low memory killer subsequently kills us, the disk cache will
      // be left in a consistent state, avoiding costly cleanup and
      // re-creation.
      GeckoAppShell.sendEventToGecko(GeckoEvent.createAppBackgroundingEvent());
      mPausedGecko = true;

      ThreadUtils.postToBackgroundThread(
          new Runnable() {
            @Override
            public void run() {
              BrowserDB.expireHistory(getContentResolver(), BrowserContract.ExpirePriority.NORMAL);
            }
          });
    }
    GeckoConnectivityReceiver.getInstance().stop();
    GeckoNetworkManager.getInstance().stop();
  }