am 52077b7a: Merge "Don\'t let old Launcher activity interfere with new one" into ub-now-porkchop
* commit '52077b7a951153ce77e7354c6096b3bcfbec8c3e': Don't let old Launcher activity interfere with new one
This commit is contained in:
@@ -1134,7 +1134,9 @@ public class Launcher extends Activity
|
|||||||
@Override
|
@Override
|
||||||
public Object onRetainNonConfigurationInstance() {
|
public Object onRetainNonConfigurationInstance() {
|
||||||
// Flag the loader to stop early before switching
|
// Flag the loader to stop early before switching
|
||||||
mModel.stopLoader();
|
if (mModel.isCurrentCallbacks(this)) {
|
||||||
|
mModel.stopLoader();
|
||||||
|
}
|
||||||
if (mAppsCustomizeContent != null) {
|
if (mAppsCustomizeContent != null) {
|
||||||
mAppsCustomizeContent.surrender();
|
mAppsCustomizeContent.surrender();
|
||||||
}
|
}
|
||||||
@@ -1997,8 +1999,13 @@ public class Launcher extends Activity
|
|||||||
|
|
||||||
// Stop callbacks from LauncherModel
|
// Stop callbacks from LauncherModel
|
||||||
LauncherAppState app = (LauncherAppState.getInstance());
|
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 {
|
try {
|
||||||
mAppWidgetHost.stopListening();
|
mAppWidgetHost.stopListening();
|
||||||
|
|||||||
@@ -1385,6 +1385,10 @@ public class LauncherModel extends BroadcastReceiver
|
|||||||
return isLaunching;
|
return isLaunching;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCurrentCallbacks(Callbacks callbacks) {
|
||||||
|
return (mCallbacks != null && mCallbacks.get() == callbacks);
|
||||||
|
}
|
||||||
|
|
||||||
public void startLoader(boolean isLaunching, int synchronousBindPage) {
|
public void startLoader(boolean isLaunching, int synchronousBindPage) {
|
||||||
startLoader(isLaunching, synchronousBindPage, LOADER_FLAG_NONE);
|
startLoader(isLaunching, synchronousBindPage, LOADER_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user