Merge changes Iadcd5d8f,Ife2a5a9f into rvc-dev
* changes:
SurfaceFlinger-Input: Ignore invisible layers for occlusion detection
InputDispatcher: Don't occlude windows with the same PID.
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 677bf7e..323e538 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -2097,14 +2097,9 @@
auto otherInfo = otherHandle->getInfo();
if (!otherInfo->visible) {
return false;
- } else if (info->ownerPid == otherInfo->ownerPid && otherHandle->getToken() == nullptr) {
- // In general, if ownerPid is the same we don't want to generate occlusion
- // events. This line is now necessary since we are including all Surfaces
- // in occlusion calculation, so if we didn't check PID like this SurfaceView
- // would occlude their parents. On the other hand before we started including
- // all surfaces in occlusion calculation and had this line, we would count
- // windows with an input channel from the same PID as occluding, and so we
- // preserve this behavior with the getToken() == null check.
+ } else if (info->ownerPid == otherInfo->ownerPid) {
+ // If ownerPid is the same we don't generate occlusion events as there
+ // is no in-process security boundary.
return false;
} else if (otherInfo->isTrustedOverlay()) {
return false;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3255aac..c146315 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2408,7 +2408,15 @@
// Position the touchable region relative to frame screen location and restrict it to frame
// bounds.
info.touchableRegion = info.touchableRegion.translate(info.frameLeft, info.frameTop);
- info.visible = canReceiveInput();
+ // For compatibility reasons we let layers which can receive input
+ // receive input before they have actually submitted a buffer. Because
+ // of this we use canReceiveInput instead of isVisible to check the
+ // policy-visibility, ignoring the buffer state. However for layers with
+ // hasInputInfo()==false we can use the real visibility state.
+ // We are just using these layers for occlusion detection in
+ // InputDispatcher, and obviously if they aren't visible they can't occlude
+ // anything.
+ info.visible = hasInputInfo() ? canReceiveInput() : isVisible();
auto cropLayer = mDrawingState.touchableRegionCrop.promote();
if (info.replaceTouchableRegionWithCrop) {