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

Commit 23ed8fd8 authored by Charles Chen's avatar Charles Chen Committed by Automerger Merge Worker
Browse files

Merge "Revert "Fix false positive of activity leak in NexusLauncherTests""...

Merge "Revert "Fix false positive of activity leak in NexusLauncherTests"" into rvc-dev am: 56dfd7c6 am: b921ded2 am: 622ab5c6

Change-Id: Ib9b3ab2c7036eab9a0c7dad9f5b0e33358378d98
parents 3b91765c 622ab5c6
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -4977,8 +4977,10 @@ public final class ActivityThread extends ClientTransactionHandler {
    ActivityClientRecord performDestroyActivity(IBinder token, boolean finishing,
            int configChanges, boolean getNonConfigInstance, String reason) {
        ActivityClientRecord r = mActivities.get(token);
        Class<? extends Activity> activityClass = null;
        if (localLOGV) Slog.v(TAG, "Performing finish of " + r);
        if (r != null) {
            activityClass = r.activity.getClass();
            r.activity.mConfigChangeFlags |= configChanges;
            if (finishing) {
                r.activity.mFinished = true;
@@ -5031,6 +5033,7 @@ public final class ActivityThread extends ClientTransactionHandler {
        synchronized (mResourcesManager) {
            mActivities.remove(token);
        }
        StrictMode.decrementExpectedActivityCount(activityClass);
        return r;
    }

@@ -5050,7 +5053,6 @@ public final class ActivityThread extends ClientTransactionHandler {
        ActivityClientRecord r = performDestroyActivity(token, finishing,
                configChanges, getNonConfigInstance, reason);
        if (r != null) {
            Class<? extends Activity> activityClass = r.activity.getClass();
            cleanUpPendingRemoveWindows(r, finishing);
            WindowManager wm = r.activity.getWindowManager();
            View v = r.activity.mDecor;
@@ -5075,14 +5077,14 @@ public final class ActivityThread extends ClientTransactionHandler {
                }
                if (wtoken != null && r.mPendingRemoveWindow == null) {
                    WindowManagerGlobal.getInstance().closeAll(wtoken,
                            activityClass.getName(), "Activity");
                            r.activity.getClass().getName(), "Activity");
                } else if (r.mPendingRemoveWindow != null) {
                    // We're preserving only one window, others should be closed so app views
                    // will be detached before the final tear down. It should be done now because
                    // some components (e.g. WebView) rely on detach callbacks to perform receiver
                    // unregister and other cleanup.
                    WindowManagerGlobal.getInstance().closeAllExceptView(token, v,
                            activityClass.getName(), "Activity");
                            r.activity.getClass().getName(), "Activity");
                }
                r.activity.mDecor = null;
            }
@@ -5094,23 +5096,18 @@ public final class ActivityThread extends ClientTransactionHandler {
                // about leaking windows, because that is a bug, so if they are
                // using this recreate facility then they get to live with leaks.
                WindowManagerGlobal.getInstance().closeAll(token,
                        activityClass.getName(), "Activity");
                        r.activity.getClass().getName(), "Activity");
            }

            // Mocked out contexts won't be participating in the normal
            // process lifecycle, but if we're running with a proper
            // ApplicationContext we need to have it tear down things
            // cleanly.
            final ContextImpl impl = ContextImpl.getImpl(r.activity);
            if (impl != null) {
                impl.scheduleFinalCleanup(activityClass.getName(), "Activity");
            Context c = r.activity.getBaseContext();
            if (c instanceof ContextImpl) {
                ((ContextImpl) c).scheduleFinalCleanup(
                        r.activity.getClass().getName(), "Activity");
            }

            r.activity = null;
            r.window = null;
            r.hideForNow = false;
            r.nextIdle = null;
            StrictMode.decrementExpectedActivityCount(activityClass);
        }
        if (finishing) {
            try {
@@ -5340,6 +5337,10 @@ public final class ActivityThread extends ClientTransactionHandler {

        handleDestroyActivity(r.token, false, configChanges, true, reason);

        r.activity = null;
        r.window = null;
        r.hideForNow = false;
        r.nextIdle = null;
        // Merge any pending results and pending intents; don't just replace them
        if (pendingResults != null) {
            if (r.pendingResults == null) {