diff options
| author | 2015-08-28 10:22:36 -0700 | |
|---|---|---|
| committer | 2015-08-28 10:29:07 -0700 | |
| commit | 5aaa0b3880403dce0fd221a6f85bc62fd33c4e90 (patch) | |
| tree | 7924355984d59eef119c5541ee362c1f5bdccdb8 | |
| parent | 26b555d42ce2cf78d42ebcc9806447bf83df9318 (diff) | |
Fix deadlock when updating rotation
Post a runnable in MyOrientationListener.onProposedRotationChanged for
the updateRotation() so that it doesn't acquire WM lock while holding
WindowOrientationListener lock. It could cause deadlock if WM is
is performing a relayout and try to access WindowOrientationListener.
bug: 23507268
Change-Id: I5775f5a13cae0283fef64877801bf8a39dfc90a4
| -rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 5b0c06b0298a..688bac26b253 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -762,6 +762,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { } class MyOrientationListener extends WindowOrientationListener { + private final Runnable mUpdateRotationRunnable = new Runnable() { + @Override + public void run() { + updateRotation(false); + } + }; + MyOrientationListener(Context context, Handler handler) { super(context, handler); } @@ -769,7 +776,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { @Override public void onProposedRotationChanged(int rotation) { if (localLOGV) Slog.v(TAG, "onProposedRotationChanged, rotation=" + rotation); - updateRotation(false); + mHandler.post(mUpdateRotationRunnable); } } MyOrientationListener mOrientationListener; |