Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5aaa0b38 authored by Chong Zhang's avatar Chong Zhang
Browse files

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
parent 26b555d4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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;