From 04efcbae292f59ab6f66f5126d2e3416486d5161 Mon Sep 17 00:00:00 2001 From: chaviw Date: Tue, 17 May 2022 17:39:25 -0500 Subject: Don't inflate mSplitDecorManager in sync transaction callback The current code inflates the UI in the sync transaction callback. This can result in a deadlock since inflate could block waiting on RT. The RT could be blocked waiting for the sync transaction to get applied to free up a buffer. But since the sync transaction won't get applied until after the inflate, it would deadlock. Test: Not stuck in split Fixes: 231929473 Change-Id: I751aa2d68ec96f7f77ba4145d810cccf764075ea --- .../android/wm/shell/splitscreen/StageTaskListener.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libs/WindowManager/Shell') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java index 9fd5d2003873..7571e29a86a3 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java @@ -224,14 +224,12 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { if (mRootTaskInfo.taskId == taskInfo.taskId) { // Inflates split decor view only when the root task is visible. if (mRootTaskInfo.isVisible != taskInfo.isVisible) { - mSyncQueue.runInSync(t -> { - if (taskInfo.isVisible) { - mSplitDecorManager.inflate(mContext, mRootLeash, - taskInfo.configuration.windowConfiguration.getBounds()); - } else { - mSplitDecorManager.release(t); - } - }); + if (taskInfo.isVisible) { + mSplitDecorManager.inflate(mContext, mRootLeash, + taskInfo.configuration.windowConfiguration.getBounds()); + } else { + mSyncQueue.runInSync(t -> mSplitDecorManager.release(t)); + } } mRootTaskInfo = taskInfo; } else if (taskInfo.parentTaskId == mRootTaskInfo.taskId) { -- cgit v1.2.3-59-g8ed1b