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

Commit 657c2a41 authored by arthurhung's avatar arthurhung Committed by Winson Chung
Browse files

Fix WindowInputTests#testOverlapWindow failing (1/2)

The 'InputWindowInfo.isTrustedOverlay' function had been removed, we
have to indicate the trustedOverlay flag when fill input info to overlay
window.

Bug: 161789401
Bug: 158717144
Test: atest WindowInputTests
Change-Id: Idf17fd64c6a1399d04c51e3f0bd600dc4a84239a
Merged-In: Idf17fd64c6a1399d04c51e3f0bd600dc4a84239a
parent 81224e6f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
        mWindowHandle.ownerUid = Process.myUid();
        mWindowHandle.inputFeatures = 0;
        mWindowHandle.scaleFactor = 1.0f;
        mWindowHandle.trustedOverlay = true;

        mInputSurface = mService.makeSurfaceBuilder(mService.mRoot.getDisplayContent(displayId).getSession())
                .setContainerLayer()
+25 −7
Original line number Diff line number Diff line
@@ -27,7 +27,18 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
import static android.view.WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_CONSUMER;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;

import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
@@ -66,9 +77,6 @@ final class InputMonitor {
    private boolean mUpdateInputWindowsPending;
    private boolean mUpdateInputWindowsImmediately;

    // Currently focused input window handle.
    private InputWindowHandle mFocusedInputWindowHandle;

    private boolean mDisableWallpaperTouchEvents;
    private final Rect mTmpRect = new Rect();
    private final UpdateInputForAllWindowsConsumer mUpdateInputForAllWindowsConsumer;
@@ -310,10 +318,6 @@ final class InputMonitor {
            Slog.d(TAG_WM, "addInputWindowHandle: "
                    + child + ", " + inputWindowHandle);
        }

        if (hasFocus) {
            mFocusedInputWindowHandle = inputWindowHandle;
        }
    }

    void setUpdateInputWindowsNeededLw() {
@@ -572,6 +576,7 @@ final class InputMonitor {
        inputWindowHandle.portalToDisplayId = INVALID_DISPLAY;
        inputWindowHandle.touchableRegion.setEmpty();
        inputWindowHandle.setTouchableRegionCrop(null);
        inputWindowHandle.trustedOverlay = isTrustedOverlay(type);
    }

    /**
@@ -586,4 +591,17 @@ final class InputMonitor {
        populateOverlayInputInfo(inputWindowHandle, name, TYPE_SECURE_SYSTEM_OVERLAY, true);
        t.setInputWindowInfo(sc, inputWindowHandle);
    }

    static boolean isTrustedOverlay(int type) {
        return type == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY
                || type == TYPE_INPUT_METHOD || type == TYPE_INPUT_METHOD_DIALOG
                || type == TYPE_MAGNIFICATION_OVERLAY || type == TYPE_STATUS_BAR
                || type == TYPE_NOTIFICATION_SHADE
                || type == TYPE_NAVIGATION_BAR
                || type == TYPE_NAVIGATION_BAR_PANEL
                || type == TYPE_SECURE_SYSTEM_OVERLAY
                || type == TYPE_DOCK_DIVIDER
                || type == TYPE_ACCESSIBILITY_OVERLAY
                || type == TYPE_INPUT_CONSUMER;
    }
}
+1 −13
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY;
@@ -87,7 +86,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT;
import static android.view.WindowManager.LayoutParams.TYPE_SEARCH_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;
@@ -955,17 +953,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mInputWindowHandle.trustedOverlay =
                (mAttrs.privateFlags & PRIVATE_FLAG_TRUSTED_OVERLAY) != 0
                && mOwnerCanAddInternalSystemWindow;
        mInputWindowHandle.trustedOverlay |=
                mAttrs.type == TYPE_ACCESSIBILITY_MAGNIFICATION_OVERLAY
                || mAttrs.type == TYPE_INPUT_METHOD || mAttrs.type == TYPE_INPUT_METHOD_DIALOG
                || mAttrs.type == TYPE_MAGNIFICATION_OVERLAY || mAttrs.type == TYPE_STATUS_BAR
                || mAttrs.type == TYPE_NOTIFICATION_SHADE
                || mAttrs.type == TYPE_NAVIGATION_BAR
                || mAttrs.type == TYPE_NAVIGATION_BAR_PANEL
                || mAttrs.type == TYPE_SECURE_SYSTEM_OVERLAY
                || mAttrs.type == TYPE_DOCK_DIVIDER
                || mAttrs.type == TYPE_ACCESSIBILITY_OVERLAY
                || mAttrs.type == TYPE_INPUT_CONSUMER;
        mInputWindowHandle.trustedOverlay |= InputMonitor.isTrustedOverlay(mAttrs.type);

        // Make sure we initial all fields before adding to parentWindow, to prevent exception
        // during onDisplayChanged.