Bug 1359531 - Part 6 - Remove manual setting of current activity. r?sebastian, walkingice
Switching between different GeckoApp instances in response to tab selection no longer requires the GeckoActivityMonitor for getting the current activity, so we no longer need to manually set the current activity for the benefit of code that executes early during onCreate/onNewIntent.
MozReview-Commit-ID: E9BQhRclDfS
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoActivityMonitor.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoActivityMonitor.java
@@ -48,24 +48,16 @@ public class GeckoActivityMonitor implem
currentActivity = activity;
}
@Override
public void onActivityResumed(Activity activity) {
currentActivity = activity;
}
- /**
- * Intended to be used if the current activity is required to be up-to-date for code that
- * executes in onCreate/onStart/... before calling the corresponding superclass method.
- */
- public void setCurrentActivity(Activity activity) {
- currentActivity = activity;
- }
-
@Override
public void onActivityPaused(Activity activity) {
releaseIfCurrentActivity(activity);
}
@Override
public void onActivityStopped(Activity activity) {
releaseIfCurrentActivity(activity);
--- a/mobile/android/base/java/org/mozilla/gecko/SingleTabActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/SingleTabActivity.java
@@ -15,34 +15,28 @@ import org.mozilla.gecko.mozglue.SafeInt
import static org.mozilla.gecko.Tabs.INTENT_EXTRA_SESSION_UUID;
import static org.mozilla.gecko.Tabs.INTENT_EXTRA_TAB_ID;
import static org.mozilla.gecko.Tabs.INVALID_TAB_ID;
public abstract class SingleTabActivity extends GeckoApp {
@Override
public void onCreate(Bundle savedInstanceState) {
final Intent externalIntent = getIntent();
- // We need the current activity to already be up-to-date before
- // calling into the superclass.
- GeckoActivityMonitor.getInstance().setCurrentActivity(this);
decideTabAction(new SafeIntent(externalIntent), savedInstanceState);
super.onCreate(savedInstanceState);
// GeckoApp's default behaviour is to reset the intent if we've got any
// savedInstanceState, which we don't want here.
setIntent(externalIntent);
}
@Override
protected void onNewIntent(Intent externalIntent) {
final SafeIntent intent = new SafeIntent(externalIntent);
- // We need the current activity to already be up-to-date before
- // calling into the superclass.
- GeckoActivityMonitor.getInstance().setCurrentActivity(this);
if (decideTabAction(intent, null)) {
// GeckoApp will handle tab selection.
super.onNewIntent(intent.getUnsafe());
} else {
// We're not calling the superclass in this code path, so we'll
// have to notify the activity monitor ourselves.
GeckoActivityMonitor.getInstance().onActivityNewIntent(this);