From 3de830b82b74f3df86ede47c8b1a0b8dcac113d6 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Wed, 20 Feb 2013 15:23:52 -0500 Subject: [PATCH] Switch to system process before modifying rotation. Bug: 8218133 Change-Id: Ib44d64d48dbdf3095182c409dd2211f6a3b726ad --- .../server/wm/WindowManagerService.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index b7637b9b99fb6..e6d6436bfe2d9 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -5317,8 +5317,14 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG, "freezeRotation: mRotation=" + mRotation); - mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_LOCKED, - rotation == -1 ? mRotation : rotation); + long origId = Binder.clearCallingIdentity(); + try { + mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_LOCKED, + rotation == -1 ? mRotation : rotation); + } finally { + Binder.restoreCallingIdentity(origId); + } + updateRotationUnchecked(false, false); } @@ -5335,7 +5341,14 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG, "thawRotation: mRotation=" + mRotation); - mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_FREE, 777); // rot not used + long origId = Binder.clearCallingIdentity(); + try { + mPolicy.setUserRotationMode(WindowManagerPolicy.USER_ROTATION_FREE, + 777); // rot not used + } finally { + Binder.restoreCallingIdentity(origId); + } + updateRotationUnchecked(false, false); }