InputDispatcher: Don't occlude windows with the same PID.

First a review of history. In previous releases there was no PID
consideration in occlusion detection. In a recent patch set we
introduced sending InputChannel-less surfaces from SurfaceFlinger
to InputDispatcher for more complete occlusion detection. As part
of this process we introduced the ownerPid check that is modified
in this CL. We added this because otherwise SurfaceView would begin
occluding their parents, and this would be a compatibility break (and
also not very useful). When adding this line we also added the
token == null check. This was to preserve a previous semantic
where windows from the same ownerPid would occlude eachother in
previous releases. There was no known dependence on this semantic,
it was just easier to add the line to preserve the old behavior than
think about changing it. In light of the linked bug, we see a use case
for changing it. On further consideration, it seems not a useful thing
to preserve, as there are no security boundaries within a process
and the ability for an app to truly depend on this behavior is
very small.

Bug: 157772682
Test: Existing tests pass
Change-Id: Ife2a5a9fce35e04bb794d79b3a1b875859deb8dd
This commit is contained in:
Robert Carr 2020-06-09 15:36:34 -07:00 committed by Rob Carr
parent 0cc0df1e13
commit 98c34a8cee

View file

@ -1991,14 +1991,9 @@ static bool canBeObscuredBy(const sp<InputWindowHandle>& windowHandle,
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;