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
This commit is contained in:
Ming-Shin Lu
2021-08-06 22:43:00 +08:00
parent e421c1c291
commit 5167131c79

View File

@@ -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();
}
}