Make PiP overlay trusted to let touches pass-through

This seems to be the overlay with the settings/close/maximize buttons
(please correct me if I'm wrong). With go/untrusted-touches the overlay
is blocking touches, since that's generated and owned by SystemUI with
original intention of letting touches pass-through to the
"pip_input_consumer" below (owned by the system), the fix is to make it
trusted.

Bug: 172629907
Bug: 158002302
Test: Put app in PiP state (eg. Maps), click on it and verify no
      toast/logcat is shown regarding untrusted touch.
Change-Id: I4227d129b1d43ebc46cd169be7cae7f4e7ed9b9a
This commit is contained in:
Bernardo Rufino
2020-11-06 10:38:59 +00:00
parent f7019ee01b
commit 992ad4953c

View File

@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.view.WindowManager.LayoutParams.FLAG_SLIPPERY;
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import static android.view.WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManager.SHELL_ROOT_LAYER_PIP;
@@ -419,7 +420,7 @@ public class PipMenuActivityController {
TYPE_APPLICATION_OVERLAY,
FLAG_WATCH_OUTSIDE_TOUCH | FLAG_SPLIT_TOUCH | FLAG_SLIPPERY | FLAG_NOT_TOUCHABLE,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= PRIVATE_FLAG_TRUSTED_OVERLAY;
lp.setTitle(MENU_WINDOW_TITLE);
return lp;
}