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

Commit d334a051 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Prevent premature display of starting window.

- When starting an activity, don't tell window manager to make the
windows visible is the keygaurd visibility for the activity is false.
Instead let the activity windows be made visible once the keygaurd
visibility transitions to true.
- Don't send duplicate visibility change request to window manger if we
are not changing state.

Fixes: 34545029
Test: Open a hangouts notification message on the lock-screen
and make sure the starting window doesn't flash.

Change-Id: I745e985766a1af97203e1d22b6443dabdd0c0363
parent 34bc4af8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -283,6 +283,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
    boolean visible;        // does this activity's window need to be shown?
    boolean visibleIgnoringKeyguard; // is this activity visible, ignoring the fact that Keyguard
                                     // might hide this activity?
    private boolean mLastSetWindowVisibility; // The last window visibility state that was set.
    private boolean mDeferHidingClient; // If true we told WM to defer reporting to the client
                                        // process that it is hidden.
    boolean sleeping;       // have we told the activity to sleep?
@@ -1581,6 +1582,10 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
    }

    void setVisibility(boolean visible) {
        if (mLastSetWindowVisibility == visible) {
            return;
        }
        mLastSetWindowVisibility = visible;
        mWindowContainerController.setVisibility(visible, mDeferHidingClient);
        mStackSupervisor.mActivityMetricsLogger.notifyVisibilityChanged(this, visible);
    }
+1 −1
Original line number Diff line number Diff line
@@ -1933,7 +1933,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
     *
     * @return true if {@param r} is visible taken Keyguard state into account, false otherwise
     */
    private boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible,
    boolean checkKeyguardVisibility(ActivityRecord r, boolean shouldBeVisible,
            boolean isTop) {
        final boolean isInPinnedStack = r.getStack().getStackId() == PINNED_STACK_ID;
        final boolean keyguardShowing = mStackSupervisor.mKeyguardController.isKeyguardShowing();
+7 −1
Original line number Diff line number Diff line
@@ -1333,7 +1333,13 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        }

        r.startFreezingScreenLocked(app, 0);
        if (r.getStack().checkKeyguardVisibility(r, true /* shouldBeVisible */, true /* isTop */)) {
            // We only set the visibility to true if the activity is allowed to be visible based on
            // keyguard state. This avoids setting this into motion in window manager that is later
            // cancelled due to later calls to ensure visible activities that set visibility back to
            // false.
            r.setVisibility(true);
        }

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