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

Commit c08eab81 authored by Craig Mautner's avatar Craig Mautner
Browse files

Show error dialogs over apps that dismiss keyguard

Error dialogs absorb all input to ensure that they are not missed.
This can cause the screen to lock up if they are not displayed but
are still absorbing touches. This was what was happening when there
was an error dialog up at the same time as a phone call came in as
in b/17648830.

This fix recognizes when an app is dismissing the keyguard and
forces any error dialogs to be shown over such an app.

This also removes the private flags from the input system as they
are no longer needed.

Fixes bug 17648830.

Change-Id: I5c98b8265a1448b445fdb2f745fc78892f8656a4
parent 147de3a9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ public final class InputWindowHandle {

    // Window layout params attributes.  (WindowManager.LayoutParams)
    public int layoutParamsFlags;
    public int layoutParamsPrivateFlags;
    public int layoutParamsType;

    // Dispatching timeout.
+0 −1
Original line number Diff line number Diff line
@@ -114,7 +114,6 @@ class DragState {
            mDragWindowHandle.inputChannel = mServerChannel;
            mDragWindowHandle.layer = getDragLayerLw();
            mDragWindowHandle.layoutParamsFlags = 0;
            mDragWindowHandle.layoutParamsPrivateFlags = 0;
            mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
            mDragWindowHandle.dispatchingTimeoutNanos =
                    WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
+1 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public final class FakeWindowImpl implements WindowManagerPolicy.FakeWindow {

    public FakeWindowImpl(WindowManagerService service,
            Looper looper, InputEventReceiver.Factory inputEventReceiverFactory,
            String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
            String name, int windowType, int layoutParamsFlags,
            boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen) {
        mService = service;

@@ -61,7 +61,6 @@ public final class FakeWindowImpl implements WindowManagerPolicy.FakeWindow {
        mWindowLayer = getLayerLw(windowType);
        mWindowHandle.layer = mWindowLayer;
        mWindowHandle.layoutParamsFlags = layoutParamsFlags;
        mWindowHandle.layoutParamsPrivateFlags = layoutParamsPrivateFlags;
        mWindowHandle.layoutParamsType = windowType;
        mWindowHandle.dispatchingTimeoutNanos =
                WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
+5 −7
Original line number Diff line number Diff line
@@ -168,8 +168,8 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
    }

    private void addInputWindowHandleLw(final InputWindowHandle inputWindowHandle,
            final WindowState child, int flags, int privateFlags, final int type,
            final boolean isVisible, final boolean hasFocus, final boolean hasWallpaper) {
            final WindowState child, int flags, final int type, final boolean isVisible,
            final boolean hasFocus, final boolean hasWallpaper) {
        // Add a window to our list of input windows.
        inputWindowHandle.name = child.toString();
        final boolean modal = (flags & (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
@@ -184,7 +184,6 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
            child.getTouchableRegion(inputWindowHandle.touchableRegion);
        }
        inputWindowHandle.layoutParamsFlags = flags;
        inputWindowHandle.layoutParamsPrivateFlags = privateFlags;
        inputWindowHandle.layoutParamsType = type;
        inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos();
        inputWindowHandle.visible = isVisible;
@@ -298,15 +297,14 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
                    final WindowState u = universeBackground.mWin;
                    if (u.mInputChannel != null && u.mInputWindowHandle != null) {
                        addInputWindowHandleLw(u.mInputWindowHandle, u, u.mAttrs.flags,
                                u.mAttrs.privateFlags, u.mAttrs.type,
                                true, u == mInputFocus, false);
                                u.mAttrs.type, true, u == mInputFocus, false);
                    }
                    addedUniverse = true;
                }

                if (child.mWinAnimator != universeBackground) {
                    addInputWindowHandleLw(inputWindowHandle, child, flags, privateFlags, type,
                            isVisible, hasFocus, hasWallpaper);
                    addInputWindowHandleLw(inputWindowHandle, child, flags, type, isVisible,
                            hasFocus, hasWallpaper);
                }
            }
        }
+4 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;

import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_ERROR;
import static com.android.server.wm.WindowManagerService.DEBUG_KEYGUARD;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE;
@@ -330,7 +331,9 @@ public class WindowAnimator {
                            + " anim=" + win.mWinAnimator.mAnimation);
                } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) {
                    final boolean hideWhenLocked = !((win.mIsImWindow && showImeOverKeyguard) ||
                            (appShowWhenLocked != null && appShowWhenLocked == win.mAppToken));
                            (appShowWhenLocked != null && (appShowWhenLocked == win.mAppToken ||
                                    // Show error dialogs over apps that dismiss keyguard.
                                    (win.mAttrs.privateFlags & PRIVATE_FLAG_SYSTEM_ERROR) != 0)));
                    if (((mForceHiding == KEYGUARD_ANIMATING_IN)
                                && (!winAnimator.isAnimating() || hideWhenLocked))
                            || ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) {
Loading