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

Commit 08426453 authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am 79b468dc: Merge "Fix potential deadlock between LockScreen and...

am 79b468dc: Merge "Fix potential deadlock between LockScreen and WindowManagerService" into jb-mr2-dev-plus-aosp

* commit '79b468dc':
  Fix potential deadlock between LockScreen and WindowManagerService
parents 6e5980f1 79b468dc
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -8942,10 +8942,31 @@ public class WindowManagerService extends IWindowManager.Stub
                if (DEBUG_ORIENTATION &&
                        winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
                        TAG, "Resizing " + win + " WITH DRAW PENDING");
                win.mClient.resized(win.mFrame, win.mLastOverscanInsets, win.mLastContentInsets,
                        win.mLastVisibleInsets,
                        winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING,
                        configChanged ? win.mConfiguration : null);
                final IWindow client = win.mClient;
                final Rect frame = win.mFrame;
                final Rect overscanInsets = win.mLastOverscanInsets;
                final Rect contentInsets = win.mLastContentInsets;
                final Rect visibleInsets = win.mLastVisibleInsets;
                final boolean reportDraw
                        = winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
                final Configuration newConfig = configChanged ? win.mConfiguration : null;
                if (win.mClient instanceof IWindow.Stub) {
                    // To prevent deadlock simulate one-way call if win.mClient is a local object.
                    mH.post(new Runnable() {
                        @Override
                        public void run() {
                            try {
                                client.resized(frame, overscanInsets, contentInsets,
                                        visibleInsets, reportDraw, newConfig);
                            } catch (RemoteException e) {
                                // Not a remote call, RemoteException won't be raised.
                            }
                        }
                    });
                } else {
                   client.resized(frame, overscanInsets, contentInsets, visibleInsets, reportDraw,
                           newConfig);
                }
                win.mOverscanInsetsChanged = false;
                win.mContentInsetsChanged = false;
                win.mVisibleInsetsChanged = false;