Bug 1346413 - Part 2 - Remove GeckoActivityMonitor onNewIntent handling. r?jchen
We no longer use the activity monitor for tab type activity switching (which could happen in response to onNewIntent, so in the original implementation the GAM's current activity had to be up-to-date at that point as well) and only track the current activity via onStop/onStart, so there's no longer any need to manually monitor onNewIntent.
MozReview-Commit-ID: AawXbII29qE
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoActivity.java
@@ -1,15 +1,14 @@
/* 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.content.Intent;
import android.support.v7.app.AppCompatActivity;
import org.mozilla.gecko.util.IntentUtils;
public abstract class GeckoActivity extends AppCompatActivity implements GeckoActivityStatus {
// Has this activity recently started another Gecko activity?
private boolean mGeckoActivityOpened;
@@ -37,21 +36,16 @@ public abstract class GeckoActivity exte
if (getApplication() instanceof GeckoApplication) {
((GeckoApplication) getApplication()).onActivityResume(this);
mGeckoActivityOpened = false;
}
}
@Override
- protected void onNewIntent(Intent externalIntent) {
- GeckoActivityMonitor.getInstance().onActivityNewIntent(this);
- }
-
- @Override
public void onCreate(android.os.Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (AppConstants.MOZ_ANDROID_ANR_REPORTER) {
ANRReporter.register(getApplicationContext());
}
}
@Override
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoActivityMonitor.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoActivityMonitor.java
@@ -40,22 +40,16 @@ public class GeckoActivityMonitor implem
appContext.registerActivityLifecycleCallbacks(this);
mInitialized = true;
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) { }
- // onNewIntent happens in-between a pause/resume cycle, which means that we wouldn't have
- // a current activity to report if we were using only the official ActivityLifecycleCallbacks.
- // For code that wants to know the current activity even at this point we therefore have to
- // handle this ourselves.
- public void onActivityNewIntent(Activity activity) { }
-
@Override
public void onActivityStarted(Activity activity) {
if (currentActivity.get() == null) {
appContext.onApplicationForeground();
}
currentActivity = new WeakReference<>(activity);
}
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -2145,18 +2145,16 @@ public abstract class GeckoApp extends G
if (mCameraOrientationEventListener != null) {
mCameraOrientationEventListener.disable();
mCameraOrientationEventListener = null;
}
}
@Override
protected void onNewIntent(Intent externalIntent) {
- super.onNewIntent(externalIntent);
-
final SafeIntent intent = new SafeIntent(externalIntent);
final String action = intent.getAction();
final boolean isFirstTab = !mWasFirstTabShownAfterActivityUnhidden;
mWasFirstTabShownAfterActivityUnhidden = true; // Reset since we'll be loading a tab.
if (!Intent.ACTION_MAIN.equals(action)) {
mIgnoreLastSelectedTab = true;
}
--- a/mobile/android/base/java/org/mozilla/gecko/SingleTabActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/SingleTabActivity.java
@@ -32,19 +32,16 @@ public abstract class SingleTabActivity
@Override
protected void onNewIntent(Intent externalIntent) {
final SafeIntent intent = new SafeIntent(externalIntent);
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);
loadTabFromIntent(intent);
}
// Again, unlike GeckoApp's default behaviour we want to keep the intent around
// because we might still require its data (e.g. to get custom tab customisations).
setIntent(intent.getUnsafe());
}
@Override