fune/mobile/android/base/java/org/mozilla/gecko/GeckoActivity.java
Jan Henning 881ed98e8d Bug 1367851 - Use ComponentCallbacks to listen for low memory notifications. r=ahunt
At the moment, we forward these from GeckoActivity, which means that they won't work if no GeckoActivity-based activity is active (can happen within our settings for example).

As of API14, we can now register an app-wide ComponentCallbacks(2) class, allowing us to easily receive low memory notifications no matter which activity is currently alive.

MozReview-Commit-ID: 5GjSjsTKxAD

--HG--
extra : rebase_source : a598b55d01ab2c8cf3ae8a7d1f7392fab926faa5
2017-05-25 21:22:24 +02:00

38 lines
1.1 KiB
Java

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import android.support.v7.app.AppCompatActivity;
public abstract class GeckoActivity extends AppCompatActivity {
/**
* Display any resources that show strings or encompass locale-specific
* representations.
*
* onLocaleReady must always be called on the UI thread.
*/
public void onLocaleReady(final String locale) {
}
@Override
public void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
ANRReporter.register(getApplicationContext());
}
}
@Override
public void onDestroy() {
if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
ANRReporter.unregister();
}
super.onDestroy();
}
public boolean isApplicationInBackground() {
return ((GeckoApplication) getApplication()).isApplicationInBackground();
}
}