Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52077b7a authored by Adam Cohen's avatar Adam Cohen Committed by Android (Google) Code Review
Browse files

Merge "Don't let old Launcher activity interfere with new one" into ub-now-porkchop

parents 2ed99e86 1a85c583
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1134,7 +1134,9 @@ public class Launcher extends Activity
    @Override
    public Object onRetainNonConfigurationInstance() {
        // Flag the loader to stop early before switching
        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());

        // 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();
+4 −0
Original line number Diff line number Diff line
@@ -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);
    }