summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2014-09-30 23:03:40 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-30 23:03:40 (GMT)
commit52077b7a951153ce77e7354c6096b3bcfbec8c3e (patch)
tree787b954cbde66ca2e32b8858498a16e75039e359
parent2ed99e861b4be73620fd6fdc24a13230e096921c (diff)
parent1a85c5839c91942b3c7dd0da5992db4d98defdc3 (diff)
downloadandroid_packages_apps_Trebuchet-52077b7a951153ce77e7354c6096b3bcfbec8c3e.zip
android_packages_apps_Trebuchet-52077b7a951153ce77e7354c6096b3bcfbec8c3e.tar.gz
android_packages_apps_Trebuchet-52077b7a951153ce77e7354c6096b3bcfbec8c3e.tar.bz2
Merge "Don't let old Launcher activity interfere with new one" into ub-now-porkchop
-rw-r--r--src/com/android/launcher3/Launcher.java13
-rw-r--r--src/com/android/launcher3/LauncherModel.java4
2 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 37a7f5c..6780812 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1134,7 +1134,9 @@ public class Launcher extends Activity
@Override
public Object onRetainNonConfigurationInstance() {
// Flag the loader to stop early before switching
- mModel.stopLoader();
+ if (mModel.isCurrentCallbacks(this)) {
+ mModel.stopLoader();
+ }
if (mAppsCustomizeContent != null) {
mAppsCustomizeContent.surrender();
}
@@ -1997,8 +1999,13 @@ public class Launcher extends Activity
// Stop callbacks from LauncherModel
LauncherAppState app = (LauncherAppState.getInstance());
- mModel.stopLoader();
- app.setLauncher(null);
+
+ // It's possible to receive onDestroy after a new Launcher activity has
+ // been created. In this case, don't interfere with the new Launcher.
+ if (mModel.isCurrentCallbacks(this)) {
+ mModel.stopLoader();
+ app.setLauncher(null);
+ }
try {
mAppWidgetHost.stopListening();
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index dd94891..60eb15f 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -1385,6 +1385,10 @@ public class LauncherModel extends BroadcastReceiver
return isLaunching;
}
+ public boolean isCurrentCallbacks(Callbacks callbacks) {
+ return (mCallbacks != null && mCallbacks.get() == callbacks);
+ }
+
public void startLoader(boolean isLaunching, int synchronousBindPage) {
startLoader(isLaunching, synchronousBindPage, LOADER_FLAG_NONE);
}