Don't let old Launcher activity interfere with new one
-> Launcher uses a static instance of it's loader (across
multiple activities) since activities can come and go
(configuration change, eg.) but the data model and loading
is static.
-> Currently, this is not robust to a sequence of events that
looks like onCreate(instance A), onCreate(instance B),
onDestroy(instance B) -- depending on the timing of those
calls.
-> This CL addresses a symptom of the above scenario by not
allowing an older Launcher Activity cancel the loader /
clear the callbacks for a newer Activity.
Bug 17679693
Change-Id: I8ece93e288464b0d578b9669c165b67132d997ed
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 @@
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);
}