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.
* 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.
@@ -182,7 +184,7 @@ public abstract class InputMethodManagerInternal {
}
@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) {
updateSystemUiLocked();
if (disableImeIcon) {
updateSystemUiLocked(0, mBackDisposition);
} else {
updateSystemUiLocked();
}
}
}
@@ -4413,9 +4417,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
return true;
}
case MSG_UPDATE_IME_WINDOW_STATUS: {
synchronized (mMethodMap) {
updateSystemUiLocked();
}
updateImeWindowStatus(msg.arg1 == 1);
return true;
}
// ---------------------------------------------------------
@@ -5085,9 +5087,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
@Override
public void updateImeWindowStatus() {
public void updateImeWindowStatus(boolean disableImeIcon) {
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 = null;
mSwitchingDialogTitleView = null;
}
mService.updateSystemUiLocked();
mDialogBuilder = null;
mIms = null;
mService.updateSystemUiLocked();
mDialogBuilder = null;
mIms = null;
}
}
HardKeyboardListener getHardKeyboardListener() {

View File

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

View File

@@ -192,7 +192,7 @@ class KeyguardController {
// state when evaluating visibilities.
updateKeyguardSleepToken();
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(
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();
@@ -925,6 +932,12 @@ public class RecentsAnimationController implements DeathRecipient {
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
final InputMonitor inputMonitor = mDisplayContent.getInputMonitor();
inputMonitor.updateInputWindowsLw(true /*force*/);