summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2020-05-20 11:34:52 -0700
committer chaviw <chaviw@google.com> 2020-05-21 12:06:05 -0700
commitf87ea83f41c40fbbc67d3c715b13cd311ad65417 (patch)
tree35ee70736866584a8c2a1c332fe08d23eae18c6a
parent1def7eb623fcdf9d66d9c920c7ad8589880cebf0 (diff)
Clear calling identity when requesting syncInputTransaction
The syncInputTransaction can trigger a performSurfacePlacement which could result in a callback to the client. In that case, the calling PID will be incorrect since we didn't clear the calling identity before requesting the performSurfacePlacement. Bug: 154665556 Test: Hard to reproduce. Existing tests pass Change-Id: Id7c35d356cfc435e2de225e4e0d3979751c5c7d4 Merged-In: Id7c35d356cfc435e2de225e4e0d3979751c5c7d4
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index e1f85446de7b..404863af800f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7717,14 +7717,19 @@ public class WindowManagerService extends IWindowManager.Stub
@Override
public void syncInputTransactions() {
- waitForAnimationsToComplete();
+ long token = Binder.clearCallingIdentity();
+ try {
+ waitForAnimationsToComplete();
- synchronized (mGlobalLock) {
- mWindowPlacerLocked.performSurfacePlacementIfScheduled();
- mRoot.forAllDisplays(displayContent ->
+ synchronized (mGlobalLock) {
+ mWindowPlacerLocked.performSurfacePlacementIfScheduled();
+ mRoot.forAllDisplays(displayContent ->
displayContent.getInputMonitor().updateInputWindowsImmediately());
+ }
+ new SurfaceControl.Transaction().syncInputWindows().apply(true);
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
- new SurfaceControl.Transaction().syncInputWindows().apply(true);
}
private void waitForAnimationsToComplete() {