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

Commit 0447a81e authored by Craig Mautner's avatar Craig Mautner
Browse files

Pull showStrictModeViolation off of local threads.

By moving the StrictModeViolation display onto the WindowManager
Handler we avoid potential deadlocks as found in the bug below.

Fixes bug 6537798.

Change-Id: Ia46a43d1f7f6e55256f770b9e196602092669b49
parent ae147152
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -5256,9 +5256,14 @@ public class WindowManagerService extends IWindowManager.Stub

    // TODO: more accounting of which pid(s) turned it on, keep count,
    // only allow disables from pids which have count on, etc.
    @Override
    public void showStrictModeViolation(boolean on) {
        if (mHeadless) return;
        mH.sendMessage(mH.obtainMessage(H.SHOW_STRICT_MODE_VIOLATION, on ? 1 : 0, 0));
    }

    private void showStrictModeViolation(int arg) {
        final boolean on = arg != 0;
        int pid = Binder.getCallingPid();
        synchronized(mWindowMap) {
            // Ignoring requests to enable the red border from clients
@@ -6706,6 +6711,7 @@ public class WindowManagerService extends IWindowManager.Stub
        public static final int BOOT_TIMEOUT = 23;
        public static final int WAITING_FOR_DRAWN_TIMEOUT = 24;
        public static final int BULK_UPDATE_PARAMETERS = 25;
        public static final int SHOW_STRICT_MODE_VIOLATION = 26;

        public static final int ANIMATOR_WHAT_OFFSET = 100000;
        public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1;
@@ -7171,6 +7177,11 @@ public class WindowManagerService extends IWindowManager.Stub
                    break;
                }

                case SHOW_STRICT_MODE_VIOLATION: {
                    showStrictModeViolation(msg.arg1);
                    break;
                }

                // Animation messages. Move to Window{State}Animator
                case SET_TRANSPARENT_REGION: {
                    Pair<WindowStateAnimator, Region> pair =