Add a WindowInsetsAnimationCallback to listen to IME changes.

This handles cases that were previously ignored, such as dismissing
the IME with the back key/gesture.

Removed extraneous manual state updates that were used for specific
cases previously. The only remaining state updates are from our
controlled IME animation in KeyboardInsetsHandler, as that correctly
handles the case where you start closing the IME but end up keeping
it open (or vice versa).

Bug: 277738379
Fix: 320659754
Test: Manually go through various IME transitions on Launcher,
open and close apps, lock/unlock, etc to verify keyboard state
is correctly updated. And verify b/320659754 steps do not repro.
Flag: NA

Change-Id: I4787afbb37eed815b909a0215d8afeb3894ab985
This commit is contained in:
Andy Wickham
2024-01-18 18:45:52 -08:00
parent b442235208
commit a601341ff5
3 changed files with 25 additions and 13 deletions

View File

@@ -15,8 +15,6 @@
*/
package com.android.launcher3;
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.SHOW;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
@@ -93,7 +91,6 @@ public class ExtendedEditText extends EditText {
* @return true if the keyboard is shown correctly and focus is given to this view.
*/
public boolean showKeyboard() {
onKeyboardShown();
return requestFocus() && showSoftInputInternal();
}
@@ -120,11 +117,6 @@ public class ExtendedEditText extends EditText {
}
}
protected void onKeyboardShown() {
ActivityContext.lookupContext(getContext()).getStatsLogManager()
.keyboardStateManager().setKeyboardState(SHOW);
}
private boolean showSoftInputInternal() {
boolean result = false;
InputMethodManager imm = getContext().getSystemService(InputMethodManager.class);