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

Commit 7ee4459b authored by Chris Li's avatar Chris Li
Browse files

Guard onPictureInPictureUiStateChanged with WM lock

The AIDL override needs to be guarded with WM lock before calling into
WMS.

Fix: 326578999
Test: pass existing
Change-Id: I8354d6ef6568e366e8a739401d0cc9acdca35699
parent 71175c17
Loading
Loading
Loading
Loading
+15 −13
Original line number Original line Diff line number Diff line
@@ -4163,6 +4163,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    @Override
    @Override
    public void onPictureInPictureUiStateChanged(PictureInPictureUiState pipState) {
    public void onPictureInPictureUiStateChanged(PictureInPictureUiState pipState) {
        enforceTaskPermission("onPictureInPictureUiStateChanged");
        enforceTaskPermission("onPictureInPictureUiStateChanged");
        synchronized (mGlobalLock) {
            // The PictureInPictureUiState is sent to current pip task if there is any
            // The PictureInPictureUiState is sent to current pip task if there is any
            // -or- the top standard task (state like entering PiP does not require a pinned task).
            // -or- the top standard task (state like entering PiP does not require a pinned task).
            final Task task;
            final Task task;
@@ -4174,8 +4175,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            }
            }
            if (task != null && task.getTopMostActivity() != null
            if (task != null && task.getTopMostActivity() != null
                    && !task.getTopMostActivity().isState(FINISHING, DESTROYING, DESTROYED)) {
                    && !task.getTopMostActivity().isState(FINISHING, DESTROYING, DESTROYED)) {
            mWindowManager.mAtmService.mActivityClientController.onPictureInPictureUiStateChanged(
                mWindowManager.mAtmService.mActivityClientController
                    task.getTopMostActivity(), pipState);
                        .onPictureInPictureUiStateChanged(task.getTopMostActivity(), pipState);
            }
        }
        }
    }
    }