diff options
| author | 2021-09-29 19:05:14 +0800 | |
|---|---|---|
| committer | 2021-09-29 19:20:36 +0800 | |
| commit | a4f760bee7d86d8d68d155dc256f984f1b3d7478 (patch) | |
| tree | 64ce36ce17da04ecc7eadc34b4835f499a4614aa | |
| parent | 6e3c154990daad8c2aeda6cb429e138705a00f69 (diff) | |
RESTRICT AUTOMERGE: Fix snapshot starting window stuck if the task never gain focus
The tasksnapshot starting window could stuck on task if the task never
gain focus, this could happen when launch multiple tasks to front, e.g.
split screen, or add snapshot starting window to a pip task.
As using task focus to judge the task snapshot removal may error-prone.
(i.e. unexpected window focus in/lost, non-focusable task window..)
To ensure the tasksnapshot removal works stable in this stage, extanding
MAX_DELAY_REMOVAL_TIME_IME_VISIBLE timeout from 450ms to 600ms
(Includes the worst time perviod from tasksnapshot drawn to the task window
focused around 150ms) would be safer and keeps the behavior of original
fixed Bug 192065018.
Bug: 201264769
Test: atest ActivityRecordTests
Test: manual launch apps from Recents.
Test: enter pip, power on/off, verify starting window is removed.
Test: manual enter split screen, verify starting window is removed.
Merged-In: Ieb5a5e781f5da4228cfc493031b4ad17f2d31a77
Change-Id: Ieb5a5e781f5da4228cfc493031b4ad17f2d31a77
3 files changed, 2 insertions, 17 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java index 2dce20371993..dfb1ae3ef2a0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java @@ -123,7 +123,7 @@ public class TaskSnapshotWindow { * Ideally the delay time will be shorter when receiving * {@link StartingSurfaceDrawer#onImeDrawnOnTask(int)}. */ - private static final long MAX_DELAY_REMOVAL_TIME_IME_VISIBLE = 450; + private static final long MAX_DELAY_REMOVAL_TIME_IME_VISIBLE = 600; //tmp vars for unused relayout params private static final Point TMP_SURFACE_SIZE = new Point(); diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 6e6cdf24bb1b..c2cfe0b7bd92 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -2253,17 +2253,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } - void removeStartingWindowIfNeeded() { - // Removing the task snapshot after the task is actually focused (see - // Task#onWindowFocusChanged). Since some of the app contents may draw in this time and - // requires more times to draw finish, in case flicking may happen when removing the task - // snapshot too early. (i.e. Showing IME.) - if ((mStartingData instanceof SnapshotStartingData) && !getTask().isFocused()) { - return; - } - removeStartingWindow(); - } - void removeStartingWindow() { removeStartingWindowAnimation(true /* prepareAnimation */); } @@ -5835,7 +5824,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // own stuff. win.cancelAnimation(); } - removeStartingWindowIfNeeded(); + removeStartingWindow(); updateReportedVisibilityLocked(); } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 364594e4286a..c3074fab0a1a 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -5206,10 +5206,6 @@ class Task extends WindowContainer<WindowContainer> { * @param hasFocus */ void onWindowFocusChanged(boolean hasFocus) { - final ActivityRecord topAct = getTopVisibleActivity(); - if (topAct != null && (topAct.mStartingData instanceof SnapshotStartingData)) { - topAct.removeStartingWindowIfNeeded(); - } updateShadowsRadius(hasFocus, getSyncTransaction()); // TODO(b/180525887): Un-comment once there is resolution on the bug. // dispatchTaskInfoChangedIfNeeded(false /* force */); |