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

Commit ef655019 authored by Craig Mautner's avatar Craig Mautner
Browse files

Release Session earlier, release Session later.

For finishDrawingWindow queue the performLayoutAndPlaceSurfaces call
and return immediately.

For setTransparentRegionHint call the WindowStateAnimator method
immediately, removing the previous queueing of it.

Fixes bug 7174665.

Change-Id: Ia52f9a6685842220e4ffca6e214ee366470ff666
parent 73164dc7
Loading
Loading
Loading
Loading
+13 −28
Original line number Diff line number Diff line
@@ -2468,16 +2468,13 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }


    void setTransparentRegionWindow(Session session, IWindow client, Region region) {
        long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mWindowMap) {
                WindowState w = windowForClientLocked(session, client, false);
                if ((w != null) && w.mHasSurface) {
                    final Pair<WindowStateAnimator, Region> pair =
                            new Pair<WindowStateAnimator, Region>(w.mWinAnimator, region);
                    mH.sendMessage(mH.obtainMessage(H.SET_TRANSPARENT_REGION, pair));
                    w.mWinAnimator.setTransparentRegionHintLocked(region);
                }
            }
        } finally {
@@ -2959,6 +2956,7 @@ public class WindowManagerService extends IWindowManager.Stub

    public void finishDrawingWindow(Session session, IWindow client) {
        final long origId = Binder.clearCallingIdentity();
        try {
            synchronized (mWindowMap) {
                WindowState win = windowForClientLocked(session, client, false);
                if (win != null && win.mWinAnimator.finishDrawingLocked()) {
@@ -2967,11 +2965,13 @@ public class WindowManagerService extends IWindowManager.Stub
                                WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                    }
                    win.mDisplayContent.layoutNeeded = true;
                performLayoutAndPlaceSurfacesLocked();
                    requestTraversalLocked();
                }
            }
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }

    @Override
    public void getWindowFrame(IBinder token, Rect outBounds) {
@@ -6610,12 +6610,6 @@ public class WindowManagerService extends IWindowManager.Stub

        public static final int CLIENT_FREEZE_TIMEOUT = 30;

        public static final int ANIMATOR_WHAT_OFFSET = 100000;
        public static final int SET_TRANSPARENT_REGION = ANIMATOR_WHAT_OFFSET + 1;

        public H() {
        }

        @Override
        public void handleMessage(Message msg) {
            if (DEBUG_WINDOW_TRACE) {
@@ -7017,15 +7011,6 @@ public class WindowManagerService extends IWindowManager.Stub
                    break;
                }

                case SET_TRANSPARENT_REGION: {
                    @SuppressWarnings("unchecked")
                    Pair<WindowStateAnimator, Region> pair =
                                (Pair<WindowStateAnimator, Region>) msg.obj;
                    final WindowStateAnimator winAnimator = pair.first;
                    winAnimator.setTransparentRegionHint(pair.second);
                    break;
                }

                case DO_ANIMATION_CALLBACK: {
                    try {
                        ((IRemoteCallback)msg.obj).sendResult(null);
+1 −1
Original line number Diff line number Diff line
@@ -1317,7 +1317,7 @@ class WindowStateAnimator {
        }
    }

    void setTransparentRegionHint(final Region region) {
    void setTransparentRegionHintLocked(final Region region) {
        if (mSurface == null) {
            Slog.w(TAG, "setTransparentRegionHint: null mSurface after mHasSurface true");
            return;