diff options
| author | Xin Li <delphij@google.com> | 2022-02-11 07:25:43 +0000 |
|---|---|---|
| committer | Xin Li <delphij@google.com> | 2022-02-11 07:25:43 +0000 |
| commit | 5ad6db77423479d027abb791ad3c02da39513a2c (patch) | |
| tree | dc6795e28a87f950bed7f5ce2bc483eb693c0907 /core/java/android/inputmethodservice/InputMethodService.java | |
| parent | 2fc6632ea61d3186dfd66dc3303ad2258c37c572 (diff) | |
| parent | 9efe853815ac78d1c4b5639686b8e41778b8d9ae (diff) | |
Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
Change-Id: Ib93992d88fd1704179009a3872798b9e7b83a6d1
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 74cb42db7858..9f798869e54a 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -395,7 +395,7 @@ public class InputMethodService extends AbstractInputMethodService { /** * @hide - * The IME is visible. + * The IME is perceptibly visible to the user. */ public static final int IME_VISIBLE = 0x2; @@ -406,6 +406,15 @@ public class InputMethodService extends AbstractInputMethodService { */ public static final int IME_INVISIBLE = 0x4; + /** + * @hide + * The IME is visible, but not yet perceptible to the user (e.g. fading in) + * by {@link android.view.WindowInsetsController}. + * + * @see InputMethodManager#reportPerceptible + */ + public static final int IME_VISIBLE_IMPERCEPTIBLE = 0x8; + // Min and max values for back disposition. private static final int BACK_DISPOSITION_MIN = BACK_DISPOSITION_DEFAULT; private static final int BACK_DISPOSITION_MAX = BACK_DISPOSITION_ADJUST_NOTHING; @@ -515,6 +524,7 @@ public class InputMethodService extends AbstractInputMethodService { private Handler mHandler; private boolean mImeSurfaceScheduledForRemoval; private ImsConfigurationTracker mConfigTracker = new ImsConfigurationTracker(); + private boolean mDestroyed; /** * An opaque {@link Binder} token of window requesting {@link InputMethodImpl#showSoftInput} @@ -589,17 +599,21 @@ public class InputMethodService extends AbstractInputMethodService { */ @MainThread @Override - public final void initializeInternal(@NonNull IBinder token, int displayId, + public final void initializeInternal(@NonNull IBinder token, IInputMethodPrivilegedOperations privilegedOperations, int configChanges) { if (InputMethodPrivilegedOperationsRegistry.isRegistered(token)) { Log.w(TAG, "The token has already registered, ignore this initialization."); return; } + if (mDestroyed) { + Log.i(TAG, "The InputMethodService has already onDestroyed()." + + "Ignore the initialization."); + return; + } Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initializeInternal"); mConfigTracker.onInitialize(configChanges); mPrivOps.set(privilegedOperations); InputMethodPrivilegedOperationsRegistry.put(token, mPrivOps); - updateInputMethodDisplay(displayId); attachToken(token); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } @@ -629,29 +643,13 @@ public class InputMethodService extends AbstractInputMethodService { throw new IllegalStateException( "attachToken() must be called at most once. token=" + token); } + attachToWindowToken(token); mToken = token; mWindow.setToken(token); } /** * {@inheritDoc} - * @hide - */ - @MainThread - @Override - public void updateInputMethodDisplay(int displayId) { - if (getDisplayId() == displayId) { - return; - } - // Update display for adding IME window to the right display. - // TODO(b/111364446) Need to address context lifecycle issue if need to re-create - // for update resources & configuration correctly when show soft input - // in non-default display. - updateDisplay(displayId); - } - - /** - * {@inheritDoc} * * <p>Calls {@link InputMethodService#onBindInput()} when done.</p> */ @@ -807,11 +805,6 @@ public class InputMethodService extends AbstractInputMethodService { return; } - if (Trace.isEnabled()) { - Binder.enableTracing(); - } else { - Binder.disableTracing(); - } Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.showSoftInput"); ImeTracing.getInstance().triggerServiceDump( "InputMethodService.InputMethodImpl#showSoftInput", InputMethodService.this, @@ -1416,6 +1409,7 @@ public class InputMethodService extends AbstractInputMethodService { } @Override public void onDestroy() { + mDestroyed = true; super.onDestroy(); mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener( mInsetsComputer); |
