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

Commit 2568c3ab authored by Craig Mautner's avatar Craig Mautner
Browse files

Do not set visibility of unstarted activities.

If an activity is started in the stopped state then it shouldn't have
its window manager visibility set to visible. It also should not have
its screen frozen.

Fixes bug 19823482.

Change-Id: I74637a8eefcc97d1ef4d8ea3c661dc7c0c322f59
parent 1cef4196
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1112,7 +1112,7 @@ final class ActivityStack {
        }
    }

    private void setVisibile(ActivityRecord r, boolean visible) {
    private void setVisible(ActivityRecord r, boolean visible) {
        r.visible = visible;
        mWindowManager.setAppVisibility(r.appToken, visible);
        final ArrayList<ActivityContainer> containers = r.mChildContainers;
@@ -1297,7 +1297,7 @@ final class ActivityStack {
                        if (!r.visible || r.mLaunchTaskBehind) {
                            if (DEBUG_VISBILITY) Slog.v(
                                    TAG, "Starting and making visible: " + r);
                            setVisibile(r, true);
                            setVisible(r, true);
                        }
                        if (r != starting) {
                            mStackSupervisor.startSpecificActivityLocked(r, false, false);
@@ -1329,7 +1329,7 @@ final class ActivityStack {
                                    r.updateOptionsLocked(r.returningOptions);
                                    mUndrawnActivitiesBelowTopTranslucent.add(r);
                                }
                                setVisibile(r, true);
                                setVisible(r, true);
                                r.sleeping = false;
                                r.app.pendingUiClean = true;
                                r.app.thread.scheduleWindowVisibility(r.appToken, true);
@@ -1364,7 +1364,7 @@ final class ActivityStack {
                    if (r.visible) {
                        if (DEBUG_VISBILITY) Slog.v(TAG, "Making invisible: " + r);
                        try {
                            setVisibile(r, false);
                            setVisible(r, false);
                            switch (r.state) {
                                case STOPPING:
                                case STOPPED:
@@ -3896,8 +3896,7 @@ final class ActivityStack {
        return true;
    }

    private boolean relaunchActivityLocked(ActivityRecord r,
            int changes, boolean andResume) {
    private boolean relaunchActivityLocked(ActivityRecord r, int changes, boolean andResume) {
        List<ResultInfo> results = null;
        List<ReferrerIntent> newIntents = null;
        if (andResume) {
+32 −28
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
    static final boolean DEBUG_RELEASE = DEBUG || false;
    static final boolean DEBUG_SAVED_STATE = DEBUG || false;
    static final boolean DEBUG_SCREENSHOTS = DEBUG || false;
    static final boolean DEBUG_STATES = DEBUG || false;
    static final boolean DEBUG_STATES = DEBUG || true;
    static final boolean DEBUG_VISIBLE_BEHIND = DEBUG || false;

    public static final int HOME_STACK_ID = 0;
@@ -273,8 +273,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
     * until the task exits or #stopLockTaskMode() is called. */
    TaskRecord mLockTaskModeTask;
    /** Store the current lock task mode. Possible values:
     * {@link ActivityManager#LOCK_TASK_MODE_NONE}, {@link ActicityManager#LOCK_TASK_MODE_LOCKED},
     * {@link ActicityManager#LOCK_TASK_MODE_PINNED}
     * {@link ActivityManager#LOCK_TASK_MODE_NONE}, {@link ActivityManager#LOCK_TASK_MODE_LOCKED},
     * {@link ActivityManager#LOCK_TASK_MODE_PINNED}
     */
    private int mLockTaskModeState;
    /**
@@ -1132,12 +1132,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
            ProcessRecord app, boolean andResume, boolean checkConfig)
            throws RemoteException {

        if (andResume) {
            r.startFreezingScreenLocked(app, 0);
        if (false) Slog.d(TAG, "realStartActivity: setting app visibility true");
            mWindowManager.setAppVisibility(r.appToken, true);

            // schedule launch ticks to collect information about slow apps.
            r.startLaunchTickingLocked();
        }

        // Have the window manager re-evaluate the orientation of
        // the screen based on the new activity order.  Note that
@@ -1195,17 +1196,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
            r.forceNewConfig = false;
            mService.showAskCompatModeDialogLocked(r);
            r.compat = mService.compatibilityInfoForPackageLocked(r.info.applicationInfo);
            String profileFile = null;
            ParcelFileDescriptor profileFd = null;
            ProfilerInfo profilerInfo = null;
            if (mService.mProfileApp != null && mService.mProfileApp.equals(app.processName)) {
                if (mService.mProfileProc == null || mService.mProfileProc == app) {
                    mService.mProfileProc = app;
                    profileFile = mService.mProfileFile;
                    profileFd = mService.mProfileFd;
                }
            }
            app.hasShownUi = true;
            app.pendingUiClean = true;
                    final String profileFile = mService.mProfileFile;
                    if (profileFile != null) {
                        ParcelFileDescriptor profileFd = mService.mProfileFd;
                        if (profileFd != null) {
                            try {
                                profileFd = profileFd.dup();
@@ -1220,9 +1217,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
                            }
                        }

            ProfilerInfo profilerInfo = profileFile != null
                    ? new ProfilerInfo(profileFile, profileFd, mService.mSamplingInterval,
                    mService.mAutoStopProfiler) : null;
                        profilerInfo = new ProfilerInfo(profileFile, profileFd,
                                mService.mSamplingInterval, mService.mAutoStopProfiler);
                    }
                }
            }

            if (andResume) {
                app.hasShownUi = true;
                app.pendingUiClean = true;
            }
            app.forceProcessStateUpTo(ActivityManager.PROCESS_STATE_TOP);
            app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
                    System.identityHashCode(r), r.info, new Configuration(mService.mConfiguration),
+6 −8
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ public class WindowManagerService extends IWindowManager.Stub
    static final boolean DEBUG_ORIENTATION = false;
    static final boolean DEBUG_APP_ORIENTATION = false;
    static final boolean DEBUG_CONFIGURATION = false;
    static final boolean DEBUG_APP_TRANSITIONS = false;
    static final boolean DEBUG_APP_TRANSITIONS = true;
    static final boolean DEBUG_STARTING_WINDOW = false;
    static final boolean DEBUG_WALLPAPER = false;
    static final boolean DEBUG_WALLPAPER_LIGHT = false || DEBUG_WALLPAPER;
@@ -189,7 +189,7 @@ public class WindowManagerService extends IWindowManager.Stub
    static final boolean DEBUG_LAYOUT_REPEATS = true;
    static final boolean DEBUG_SURFACE_TRACE = false;
    static final boolean DEBUG_WINDOW_TRACE = false;
    static final boolean DEBUG_TASK_MOVEMENT = false;
    static final boolean DEBUG_TASK_MOVEMENT = true;
    static final boolean DEBUG_STACK = false;
    static final boolean DEBUG_DISPLAY = false;
    static final boolean DEBUG_POWER = false;
@@ -3056,7 +3056,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }

            if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
            if (true || DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
                    + " req=" + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);

            win.mEnforceSizeCompat =
@@ -3716,10 +3716,8 @@ public class WindowManagerService extends IWindowManager.Stub
        } else {
            // TODO(multidisplay): Change to the correct display.
            final WindowList windows = getDefaultWindowListLocked();
            int pos = windows.size() - 1;
            while (pos >= 0) {
            for (int pos = windows.size() - 1; pos >= 0; --pos) {
                WindowState win = windows.get(pos);
                pos--;
                if (win.mAppToken != null) {
                    // We hit an application window. so the orientation will be determined by the
                    // app window. No point in continuing further.
@@ -4169,8 +4167,8 @@ public class WindowManagerService extends IWindowManager.Stub
        }

        synchronized(mWindowMap) {
            if (DEBUG_APP_TRANSITIONS) Slog.w(TAG, "Execute app transition: " + mAppTransition,
                    new RuntimeException("here").fillInStackTrace());
            if (DEBUG_APP_TRANSITIONS) Slog.w(TAG, "Execute app transition: " + mAppTransition
                    + " Callers=" + Debug.getCallers(5));
            if (mAppTransition.isTransitionSet()) {
                mAppTransition.setReady();
                final long origId = Binder.clearCallingIdentity();