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

Commit 8c4a97a2 authored by Adrian Roos's avatar Adrian Roos Committed by android-build-merger
Browse files

Merge "WM: Prevent secondary display focus while keyguard is up" into pi-dev

am: c8494ab0

Change-Id: I44561cff9d3f66373c35d8e1c675229ca38eb1fa
parents eebf7652 c8494ab0
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -234,7 +234,6 @@ import android.util.SparseArray;
import android.util.proto.ProtoOutputStream;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.DisplayInfo;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.IApplicationToken;
@@ -2292,6 +2291,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    public void onTrustedChanged() {
                        mWindowManagerFuncs.notifyKeyguardTrustedChanged();
                    }

                    @Override
                    public void onShowingChanged() {
                        mWindowManagerFuncs.onKeyguardShowingAndNotOccludedChanged();
                    }
                });
        mScreenshotHelper = new ScreenshotHelper(mContext);
    }
+5 −0
Original line number Diff line number Diff line
@@ -660,6 +660,11 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
         * abort animations that have no timeout, in case they got stuck.
         */
        void triggerAnimationFailsafe();

        /**
         * The keyguard showing state has changed
         */
        void onKeyguardShowingAndNotOccludedChanged();
    }

    /** Window has been added to the screen. */
+2 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {
    public void onShowingStateChanged(boolean showing) {
        mIsShowing = showing;

        mCallback.onShowingChanged();
        try {
            mKeystoreService.onKeyguardVisibilityChanged(showing, mCurrentUserId);
        } catch (RemoteException e) {
@@ -132,6 +133,7 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {

    public interface StateCallback {
        void onTrustedChanged();
        void onShowingChanged();
    }

    public void dump(String prefix, PrintWriter pw) {
+8 −0
Original line number Diff line number Diff line
@@ -157,10 +157,18 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
    }

    WindowState computeFocusedWindow() {
        // While the keyguard is showing, we must focus anything besides the main display.
        // Otherwise we risk input not going to the keyguard when the user expects it to.
        final boolean forceDefaultDisplay = mService.isKeyguardShowingAndNotOccluded();

        for (int i = mChildren.size() - 1; i >= 0; i--) {
            final DisplayContent dc = mChildren.get(i);
            final WindowState win = dc.findFocusedWindow();
            if (win != null) {
                if (forceDefaultDisplay && !dc.isDefaultDisplay) {
                    EventLog.writeEvent(0x534e4554, "71786287", win.mOwnerUid, "");
                    continue;
                }
                return win;
            }
        }
+13 −0
Original line number Diff line number Diff line
@@ -2846,6 +2846,11 @@ public class WindowManagerService extends IWindowManager.Stub
        mH.sendEmptyMessage(H.ANIMATION_FAILSAFE);
    }

    @Override
    public void onKeyguardShowingAndNotOccludedChanged() {
        mH.sendEmptyMessage(H.RECOMPUTE_FOCUS);
    }

    /**
     * Starts deferring layout passes. Useful when doing multiple changes but to optimize
     * performance, only one layout pass should be done. This can be called multiple times, and
@@ -4626,6 +4631,7 @@ public class WindowManagerService extends IWindowManager.Stub
        public static final int SET_HAS_OVERLAY_UI = 58;
        public static final int SET_RUNNING_REMOTE_ANIMATION = 59;
        public static final int ANIMATION_FAILSAFE = 60;
        public static final int RECOMPUTE_FOCUS = 61;

        /**
         * Used to denote that an integer field in a message will not be used.
@@ -5052,6 +5058,13 @@ public class WindowManagerService extends IWindowManager.Stub
                    }
                }
                break;
                case RECOMPUTE_FOCUS: {
                    synchronized (mWindowMap) {
                        updateFocusedWindowLocked(UPDATE_FOCUS_NORMAL,
                                true /* updateInputWindows */);
                    }
                }
                break;
            }
            if (DEBUG_WINDOW_TRACE) {
                Slog.v(TAG_WM, "handleMessage: exit");
Loading