Merge "Fix IME icon flicker when switching apps" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-06-04 03:44:13 +00:00
committed by Android (Google) Code Review
6 changed files with 33 additions and 15 deletions

View File

@@ -126,8 +126,10 @@ public abstract class InputMethodManagerInternal {
/** /**
* Updates the IME visibility, back disposition and show IME picker status for SystemUI. * Updates the IME visibility, back disposition and show IME picker status for SystemUI.
* TODO(b/189923292): Making SystemUI to be true IME icon controller vs. presenter that
* controlled by IMMS.
*/ */
public abstract void updateImeWindowStatus(); public abstract void updateImeWindowStatus(boolean disableImeIcon);
/** /**
* Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing. * Fake implementation of {@link InputMethodManagerInternal}. All the methods do nothing.
@@ -182,7 +184,7 @@ public abstract class InputMethodManagerInternal {
} }
@Override @Override
public void updateImeWindowStatus() { public void updateImeWindowStatus(boolean disableImeIcon) {
} }
}; };

View File

@@ -2862,9 +2862,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} }
} }
private void updateImeWindowStatus() { private void updateImeWindowStatus(boolean disableImeIcon) {
synchronized (mMethodMap) { synchronized (mMethodMap) {
updateSystemUiLocked(); if (disableImeIcon) {
updateSystemUiLocked(0, mBackDisposition);
} else {
updateSystemUiLocked();
}
} }
} }
@@ -4413,9 +4417,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
return true; return true;
} }
case MSG_UPDATE_IME_WINDOW_STATUS: { case MSG_UPDATE_IME_WINDOW_STATUS: {
synchronized (mMethodMap) { updateImeWindowStatus(msg.arg1 == 1);
updateSystemUiLocked();
}
return true; return true;
} }
// --------------------------------------------------------- // ---------------------------------------------------------
@@ -5085,9 +5087,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
} }
@Override @Override
public void updateImeWindowStatus() { public void updateImeWindowStatus(boolean disableImeIcon) {
mService.mHandler.sendMessage( mService.mHandler.sendMessage(
mService.mHandler.obtainMessage(MSG_UPDATE_IME_WINDOW_STATUS)); mService.mHandler.obtainMessage(MSG_UPDATE_IME_WINDOW_STATUS,
disableImeIcon ? 1 : 0, 0));
} }
} }

View File

@@ -261,11 +261,11 @@ public class InputMethodMenuController {
mSwitchingDialog.dismiss(); mSwitchingDialog.dismiss();
mSwitchingDialog = null; mSwitchingDialog = null;
mSwitchingDialogTitleView = null; mSwitchingDialogTitleView = null;
}
mService.updateSystemUiLocked(); mService.updateSystemUiLocked();
mDialogBuilder = null; mDialogBuilder = null;
mIms = null; mIms = null;
}
} }
HardKeyboardListener getHardKeyboardListener() { HardKeyboardListener getHardKeyboardListener() {

View File

@@ -243,7 +243,7 @@ public final class MultiClientInputMethodManagerService {
} }
@Override @Override
public void updateImeWindowStatus() { public void updateImeWindowStatus(boolean disableImeIcon) {
} }
}); });
} }

View File

@@ -192,7 +192,7 @@ class KeyguardController {
// state when evaluating visibilities. // state when evaluating visibilities.
updateKeyguardSleepToken(); updateKeyguardSleepToken();
mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
InputMethodManagerInternal.get().updateImeWindowStatus(); InputMethodManagerInternal.get().updateImeWindowStatus(false /* disableImeIcon */);
} }
/** /**

View File

@@ -303,6 +303,13 @@ public class RecentsAnimationController implements DeathRecipient {
inputMethodManagerInternal.hideCurrentInputMethod( inputMethodManagerInternal.hideCurrentInputMethod(
SoftInputShowHideReason.HIDE_RECENTS_ANIMATION); SoftInputShowHideReason.HIDE_RECENTS_ANIMATION);
} }
} else {
// Disable IME icon explicitly when IME attached to the app in case
// IME icon might flickering while swiping to the next app task still
// in animating before the next app window focused, or IME icon
// persists on the bottom when swiping the task to recents.
InputMethodManagerInternal.get().updateImeWindowStatus(
true /* disableImeIcon */);
} }
} }
mService.mWindowPlacerLocked.requestTraversal(); mService.mWindowPlacerLocked.requestTraversal();
@@ -925,6 +932,12 @@ public class RecentsAnimationController implements DeathRecipient {
mRecentScreenshotAnimator = null; mRecentScreenshotAnimator = null;
} }
// Restore IME icon only when moving the original app task to front from recents, in case
// IME icon may missing if the moving task has already been the current focused task.
if (reorderMode == REORDER_MOVE_TO_ORIGINAL_POSITION && !mIsAddingTaskToTargets) {
InputMethodManagerInternal.get().updateImeWindowStatus(false /* disableImeIcon */);
}
// Update the input windows after the animation is complete // Update the input windows after the animation is complete
final InputMonitor inputMonitor = mDisplayContent.getInputMonitor(); final InputMonitor inputMonitor = mDisplayContent.getInputMonitor();
inputMonitor.updateInputWindowsLw(true /*force*/); inputMonitor.updateInputWindowsLw(true /*force*/);