Merge "Propagate last-ime-shown in the same task explicitly" into udc-dev

This commit is contained in:
Riddle Hsu
2023-05-19 18:48:58 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 4 deletions

View File

@@ -3570,6 +3570,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// Tell window manager to prepare for this one to be removed.
setVisibility(false);
// Propagate the last IME visibility in the same task, so the IME can show
// automatically if the next activity has a focused editable view.
if (mLastImeShown && mTransitionController.isShellTransitionsEnabled()) {
final ActivityRecord nextRunning = task.topRunningActivity();
if (nextRunning != null) {
nextRunning.mLastImeShown = true;
}
}
if (getTaskFragment().getPausingActivity() == null) {
ProtoLog.v(WM_DEBUG_STATES, "Finish needs to pause: %s", this);

View File

@@ -9254,7 +9254,6 @@ public class WindowManagerService extends IWindowManager.Stub
boolean shouldRestoreImeVisibility(IBinder imeTargetWindowToken) {
final Task imeTargetWindowTask;
boolean hadRequestedShowIme = false;
synchronized (mGlobalLock) {
final WindowState imeTargetWindow = mWindowMap.get(imeTargetWindowToken);
if (imeTargetWindow == null) {
@@ -9264,14 +9263,15 @@ public class WindowManagerService extends IWindowManager.Stub
if (imeTargetWindowTask == null) {
return false;
}
if (imeTargetWindow.mActivityRecord != null) {
hadRequestedShowIme = imeTargetWindow.mActivityRecord.mLastImeShown;
if (imeTargetWindow.mActivityRecord != null
&& imeTargetWindow.mActivityRecord.mLastImeShown) {
return true;
}
}
final TaskSnapshot snapshot = getTaskSnapshot(imeTargetWindowTask.mTaskId,
imeTargetWindowTask.mUserId, false /* isLowResolution */,
false /* restoreFromDisk */);
return snapshot != null && snapshot.hasImeSurface() || hadRequestedShowIme;
return snapshot != null && snapshot.hasImeSurface();
}
@Override