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

Commit 77e10432 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

The big keyguard transition refactor (3/n)

Notify activity manager when dreaming showing state changed so
KeyguardController can update the occluded state when the device
is dreaming.

Test: Set dreaming while charging, wait until screen times out,
make sure that dream is occluding Keyguard.
Bug: 32057734
Change-Id: Ied6f485d9b4a1526cb4cd5f0701f86b1ea05830a
parent 5a108c22
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -511,6 +511,11 @@ public interface WindowManagerPolicy {
         * Retrieves the {@param outBounds} from the stack with id {@param stackId}.
         */
        void getStackBounds(int stackId, Rect outBounds);

        /**
         * Notifies window manager that {@link #isShowingDreamLw} has changed.
         */
        void notifyShowingDreamChanged();
    }

    public interface PointerEventListener {
@@ -1170,6 +1175,8 @@ public interface WindowManagerPolicy {
     */
    public boolean isKeyguardDrawnLw();

    public boolean isShowingDreamLw();

    /**
     * Given an orientation constant, returns the appropriate surface rotation,
     * taking into account sensors, docking mode, rotation lock, and other factors.
+1 −0
Original line number Diff line number Diff line
@@ -167,6 +167,7 @@ class KeyguardController {
                mDismissingKeyguardActivity = stack.getTopDismissingKeyguardActivity();
            }
        }
        mOccluded |= mWindowManager.isShowingDream();
        if (mOccluded != lastOccluded) {
            handleOccludedChanged();
        }
+11 −0
Original line number Diff line number Diff line
@@ -597,6 +597,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    boolean mShowingLockscreen;
    boolean mShowingDream;
    private boolean mLastShowingDream;
    boolean mDreamingLockscreen;
    boolean mDreamingSleepTokenNeeded;
    SleepToken mDreamingSleepToken;
@@ -5343,6 +5344,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            changes |= FINISH_LAYOUT_REDO_LAYOUT;
        }

        if (mShowingDream != mLastShowingDream) {
            mLastShowingDream = mShowingDream;
            mWindowManagerFuncs.notifyShowingDreamChanged();
        }

        // update since mAllowLockscreenWhenOn might have changed
        updateLockScreenTimeout();
        return changes;
@@ -6593,6 +6599,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    }

    @Override
    public boolean isShowingDreamLw() {
        return mShowingDream;
    }

    @Override
    public void startKeyguardExitAnimation(long startTime, long fadeoutDuration) {
        if (mKeyguardDelegate != null) {
+11 −0
Original line number Diff line number Diff line
@@ -3504,6 +3504,11 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    @Override
    public void notifyShowingDreamChanged() {
        notifyKeyguardFlagsChanged(null /* callback */);
    }

    /**
     * Re-sizes a stack and its containing tasks.
     * @param stackId Id of stack to resize.
@@ -3817,6 +3822,12 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    public boolean isShowingDream() {
        synchronized (mWindowMap) {
            return mPolicy.isShowingDreamLw();
        }
    }

    @Override
    public void dismissKeyguard() {
        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DISABLE_KEYGUARD)
+5 −0
Original line number Diff line number Diff line
@@ -535,6 +535,11 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
        return false;
    }

    @Override
    public boolean isShowingDreamLw() {
        return false;
    }

    @Override
    public void onKeyguardOccludedChangedLw(boolean occluded) {
    }