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

Commit a97c5bd0 authored by Rob Carr's avatar Rob Carr Committed by Automerger Merge Worker
Browse files

Merge "WindowManager Overlays: Avoid occluding for input" into rvc-dev am:...

Merge "WindowManager Overlays: Avoid occluding for input" into rvc-dev am: 966ee252 am: d782ed42

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11412326

Change-Id: Iac3d1a6ec8c20fd487a9843dbc5a738bb90c71fb
parents 4205a1e8 d782ed42
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -898,11 +898,16 @@ final class AccessibilityController {
                        /* ignore */
                    }
                    mSurfaceControl = surfaceControl;
                    mService.mTransactionFactory.get().setLayer(mSurfaceControl,
                            mService.mPolicy.getWindowLayerFromTypeLw(TYPE_MAGNIFICATION_OVERLAY)
                                    * WindowManagerService.TYPE_LAYER_MULTIPLIER)
                            .setPosition(mSurfaceControl, 0, 0)
                            .apply();

                    final SurfaceControl.Transaction t = mService.mTransactionFactory.get();
                    final int layer =
                            mService.mPolicy.getWindowLayerFromTypeLw(TYPE_MAGNIFICATION_OVERLAY) *
                                    WindowManagerService.TYPE_LAYER_MULTIPLIER;
                    t.setLayer(mSurfaceControl, layer).setPosition(mSurfaceControl, 0, 0);
                    InputMonitor.setTrustedOverlayInputInfo(mSurfaceControl, t,
                            mDisplayContent.getDisplayId(), "Magnification Overlay");
                    t.apply();

                    mSurface.copyFrom(mSurfaceControl);

                    mAnimationController = new AnimationController(context,
+3 −0
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@ class EmulatorDisplayOverlay {
            t.setLayer(ctrl, zOrder);
            t.setPosition(ctrl, 0, 0);
            t.show(ctrl);
            // Ensure we aren't considered as obscuring for Input purposes.
            InputMonitor.setTrustedOverlayInputInfo(ctrl, t,
                    dc.getDisplayId(), "EmulatorDisplayOverlay");
            mSurface.copyFrom(ctrl);
        } catch (OutOfResourcesException e) {
        }
+26 −0
Original line number Diff line number Diff line
@@ -16,13 +16,17 @@

package com.android.server.wm;

import static android.os.Process.myPid;
import static android.os.Process.myUid;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.WindowManager.INPUT_CONSUMER_NAVIGATION;
import static android.view.WindowManager.INPUT_CONSUMER_PIP;
import static android.view.WindowManager.INPUT_CONSUMER_RECENTS_ANIMATION;
import static android.view.WindowManager.INPUT_CONSUMER_WALLPAPER;
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_SECURE_SYSTEM_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;

import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
@@ -550,4 +554,26 @@ final class InputMonitor {
            }
        }
    }

    /**
     * Helper function to generate an InputInfo with type SECURE_SYSTEM_OVERLAY. This input
     * info will not have an input channel or be touchable, but is used to omit Surfaces
     * from occlusion detection, so that System global overlays like the Watermark aren't
     * counted by the InputDispatcher as occluding applications below.
     */
    static void setTrustedOverlayInputInfo(SurfaceControl sc, SurfaceControl.Transaction t,
            int displayId, String name) {
        InputWindowHandle inputWindowHandle = new InputWindowHandle(null, displayId);
        inputWindowHandle.name = name;
        inputWindowHandle.layoutParamsType = TYPE_SECURE_SYSTEM_OVERLAY;
        inputWindowHandle.dispatchingTimeoutNanos = -1;
        inputWindowHandle.visible = true;
        inputWindowHandle.canReceiveKeys = false;
        inputWindowHandle.hasFocus = false;
        inputWindowHandle.ownerPid = myPid();
        inputWindowHandle.ownerUid = myUid();
        inputWindowHandle.inputFeatures = INPUT_FEATURE_NO_INPUT_CHANNEL;
        inputWindowHandle.scaleFactor = 1;
        t.setInputWindowInfo(sc, inputWindowHandle);
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ class StrictModeFlash {
            t.setLayer(ctrl, WindowManagerService.TYPE_LAYER_MULTIPLIER * 101);
            t.setPosition(ctrl, 0, 0);
            t.show(ctrl);
            // Ensure we aren't considered as obscuring for Input purposes.
            InputMonitor.setTrustedOverlayInputInfo(ctrl, t, dc.getDisplayId(),
                    "StrictModeFlash");

            mSurface.copyFrom(ctrl);
        } catch (OutOfResourcesException e) {
        }
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Display;
import android.view.InputWindowHandle;
import android.view.Surface;
import android.view.Surface.OutOfResourcesException;
import android.view.SurfaceControl;
@@ -124,6 +125,8 @@ class Watermark {
            t.setLayer(ctrl, WindowManagerService.TYPE_LAYER_MULTIPLIER * 100)
                    .setPosition(ctrl, 0, 0)
                    .show(ctrl);
            // Ensure we aren't considered as obscuring for Input purposes.
            InputMonitor.setTrustedOverlayInputInfo(ctrl, t, dc.getDisplayId(), "Watermark");
            mSurface.copyFrom(ctrl);
        } catch (OutOfResourcesException e) {
        }