From 5167131c79dfec789d652c556703022c4010b92b Mon Sep 17 00:00:00 2001 From: Ming-Shin Lu Date: Fri, 6 Aug 2021 22:43:00 +0800 Subject: Improve shouldRestoreImeVisibility perf shouldRestoreImeVisibility(token) used to check if the task window token should restore IME visibliity by checking the tasksnapshot. Previously by default it calls mAtmService.getTaskSnapshot() to load tasksnapshot from the disk if the does not exist, which caused additional bitmap allocation to see if the tasksnapshot is not active. Since we only check the IME surface from the tasksnapshot when the task is still running. Also, after the next booted, tapping the tasksnapshot from the overview will be refreshed with splashscreen that we don't trying to restore IME visiblity for that case. Use WMS#getTaskSnapshot with specifying restoreFromDisk parameter as false to get the active tasksnapshot from memory. Fix: 195347355 Test: Enable systrace on device from developer option, launch an App with showing IME, swiping up to the overview and then tapping the original task again, expect no additional EGLContext created in the systrace. Change-Id: I0abb5d6d77fdb200c737e7582923ced9ee98ad05 --- services/core/java/com/android/server/wm/WindowManagerService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 1ec9187d7a76..b42ba702916d 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -8606,8 +8606,9 @@ public class WindowManagerService extends IWindowManager.Stub if (imeTargetWindowTask == null) { return false; } - final TaskSnapshot snapshot = mAtmService.getTaskSnapshot(imeTargetWindowTask.mTaskId, - false /* isLowResolution */); + final TaskSnapshot snapshot = getTaskSnapshot(imeTargetWindowTask.mTaskId, + imeTargetWindowTask.mUserId, false /* isLowResolution */, + false /* restoreFromDisk */); return snapshot != null && snapshot.hasImeSurface(); } } -- cgit v1.2.3-59-g8ed1b