From 5f9f1ca560d8b9e0dd8811f80f991f126ea80518 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Mon, 7 Mar 2022 10:47:47 -0800 Subject: [PATCH] Introduce InputMethodNavButtonFlags This CL reworks my previous CL [1], which let InputMethodManagerService report whether the IME switcher icon needs to be shown or not to the IME process by using IInputMethod IPCs. It turns out that we need to propagate one more boolean value in order to address Bug 219820813. It'd be much clearer if we use bit flags rather than adding a new boolean parameter to each IPC method. Thus this CL rewrites my previous CL by using a bit flag defined in a newly introduced InputMethodNavButtonFlags. This is a purely mechanical refactroing. There should be no behavior change. [1]: I5de9ac0dc8670842edf66306bb4c281c77cea376 75b935a12b37ffa97447b9acd80f94a4172bf3e6 Bug: 215551357 Bug: 219820813 Test: Manually verified with for the following scenarios: * Enabling/disabling multiple IMEs * Attaching/detaching a hardware keyboard * Showing/hinding the IME switcher * Showing an IME on the lock screen Change-Id: I81cb062a08d484ec8ce5d7b2fea64ce19028f82e --- .../IInputMethodWrapper.java | 36 +++++++--------- .../InputMethodService.java | 17 +++----- .../NavigationBarController.java | 16 ++++--- .../android/view/inputmethod/InputMethod.java | 19 ++++---- .../InputMethodNavButtonFlags.java | 43 +++++++++++++++++++ .../android/internal/view/IInputMethod.aidl | 8 ++-- .../inputmethod/IInputMethodInvoker.java | 14 +++--- .../InputMethodManagerService.java | 27 ++++++------ .../InputMethodMenuController.java | 4 +- 9 files changed, 111 insertions(+), 73 deletions(-) create mode 100644 core/java/com/android/internal/inputmethod/InputMethodNavButtonFlags.java diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java index af57f793bf73a..02302a20fe38c 100644 --- a/core/java/android/inputmethodservice/IInputMethodWrapper.java +++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java @@ -40,6 +40,7 @@ import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.CancellationGroup; import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.os.HandlerCaller; import com.android.internal.os.SomeArgs; import com.android.internal.view.IInlineSuggestionsRequestCallback; @@ -70,7 +71,7 @@ class IInputMethodWrapper extends IInputMethod.Stub private static final int DO_SET_INPUT_CONTEXT = 20; private static final int DO_UNSET_INPUT_CONTEXT = 30; private static final int DO_START_INPUT = 32; - private static final int DO_ON_SHOULD_SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN_CHANGED = 35; + private static final int DO_ON_NAV_BUTTON_FLAGS_CHANGED = 35; private static final int DO_CREATE_SESSION = 40; private static final int DO_SET_SESSION_ENABLED = 45; private static final int DO_SHOW_SOFT_INPUT = 60; @@ -176,7 +177,7 @@ class IInputMethodWrapper extends IInputMethod.Stub try { inputMethod.initializeInternal((IBinder) args.arg1, (IInputMethodPrivilegedOperations) args.arg2, msg.arg1, - (boolean) args.arg3, msg.arg2 != 0); + (boolean) args.arg3, msg.arg2); } finally { args.recycle(); } @@ -196,22 +197,20 @@ class IInputMethodWrapper extends IInputMethod.Stub final EditorInfo info = (EditorInfo) args.arg3; final CancellationGroup cancellationGroup = (CancellationGroup) args.arg4; final boolean restarting = args.argi5 == 1; - final boolean shouldShowImeSwitcherWhenImeIsShown = args.argi6 != 0; + @InputMethodNavButtonFlags + final int navButtonFlags = args.argi6; final InputConnection ic = inputContext != null ? new RemoteInputConnection(mTarget, inputContext, cancellationGroup) : null; info.makeCompatible(mTargetSdkVersion); inputMethod.dispatchStartInputWithToken(ic, info, restarting, startInputToken, - shouldShowImeSwitcherWhenImeIsShown); + navButtonFlags); args.recycle(); return; } - case DO_ON_SHOULD_SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN_CHANGED: { - final boolean shouldShowImeSwitcherWhenImeIsShown = msg.arg1 != 0; - inputMethod.onShouldShowImeSwitcherWhenImeIsShownChanged( - shouldShowImeSwitcherWhenImeIsShown); + case DO_ON_NAV_BUTTON_FLAGS_CHANGED: + inputMethod.onNavButtonFlagsChanged(msg.arg1); return; - } case DO_CREATE_SESSION: { SomeArgs args = (SomeArgs)msg.obj; inputMethod.createSession(new InputMethodSessionCallbackWrapper( @@ -301,10 +300,9 @@ class IInputMethodWrapper extends IInputMethod.Stub @Override public void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps, int configChanges, boolean stylusHwSupported, - boolean shouldShowImeSwitcherWhenImeIsShown) { + @InputMethodNavButtonFlags int navButtonFlags) { mCaller.executeOrSendMessage(mCaller.obtainMessageIIOOO(DO_INITIALIZE_INTERNAL, - configChanges, shouldShowImeSwitcherWhenImeIsShown ? 1 : 0, token, privOps, - stylusHwSupported)); + configChanges, navButtonFlags, token, privOps, stylusHwSupported)); } @BinderThread @@ -344,23 +342,21 @@ class IInputMethodWrapper extends IInputMethod.Stub @BinderThread @Override public void startInput(IBinder startInputToken, IInputContext inputContext, - EditorInfo attribute, boolean restarting, boolean shouldShowImeSwitcherWhenImeIsShown) { + EditorInfo attribute, boolean restarting, + @InputMethodNavButtonFlags int navButtonFlags) { if (mCancellationGroup == null) { Log.e(TAG, "startInput must be called after bindInput."); mCancellationGroup = new CancellationGroup(); } mCaller.executeOrSendMessage(mCaller.obtainMessageOOOOII(DO_START_INPUT, startInputToken, - inputContext, attribute, mCancellationGroup, restarting ? 1 : 0, - shouldShowImeSwitcherWhenImeIsShown ? 1 : 0)); + inputContext, attribute, mCancellationGroup, restarting ? 1 : 0, navButtonFlags)); } @BinderThread @Override - public void onShouldShowImeSwitcherWhenImeIsShownChanged( - boolean shouldShowImeSwitcherWhenImeIsShown) { - mCaller.executeOrSendMessage(mCaller.obtainMessageI( - DO_ON_SHOULD_SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN_CHANGED, - shouldShowImeSwitcherWhenImeIsShown ? 1 : 0)); + public void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { + mCaller.executeOrSendMessage( + mCaller.obtainMessageI(DO_ON_NAV_BUTTON_FLAGS_CHANGED, navButtonFlags)); } @BinderThread diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index fbc0732affe1c..60cd4181e9338 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -140,6 +140,7 @@ import com.android.internal.annotations.GuardedBy; import com.android.internal.inputmethod.IInputContentUriToken; import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; import com.android.internal.inputmethod.ImeTracing; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.InputMethodPrivilegedOperations; import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry; import com.android.internal.view.IInlineSuggestionsRequestCallback; @@ -660,7 +661,7 @@ public class InputMethodService extends AbstractInputMethodService { @Override public final void initializeInternal(@NonNull IBinder token, IInputMethodPrivilegedOperations privilegedOperations, int configChanges, - boolean stylusHwSupported, boolean shouldShowImeSwitcherWhenImeIsShown) { + boolean stylusHwSupported, @InputMethodNavButtonFlags int navButtonFlags) { if (mDestroyed) { Log.i(TAG, "The InputMethodService has already onDestroyed()." + "Ignore the initialization."); @@ -673,8 +674,7 @@ public class InputMethodService extends AbstractInputMethodService { if (stylusHwSupported) { mInkWindow = new InkWindow(mWindow.getContext()); } - mNavigationBarController.setShouldShowImeSwitcherWhenImeIsShown( - shouldShowImeSwitcherWhenImeIsShown); + mNavigationBarController.onNavButtonFlagsChanged(navButtonFlags); attachToken(token); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } @@ -784,10 +784,9 @@ public class InputMethodService extends AbstractInputMethodService { @Override public final void dispatchStartInputWithToken(@Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo, boolean restarting, - @NonNull IBinder startInputToken, boolean shouldShowImeSwitcherWhenImeIsShown) { + @NonNull IBinder startInputToken, @InputMethodNavButtonFlags int navButtonFlags) { mPrivOps.reportStartInputAsync(startInputToken); - mNavigationBarController.setShouldShowImeSwitcherWhenImeIsShown( - shouldShowImeSwitcherWhenImeIsShown); + mNavigationBarController.onNavButtonFlagsChanged(navButtonFlags); if (restarting) { restartInput(inputConnection, editorInfo); } else { @@ -801,10 +800,8 @@ public class InputMethodService extends AbstractInputMethodService { */ @MainThread @Override - public void onShouldShowImeSwitcherWhenImeIsShownChanged( - boolean shouldShowImeSwitcherWhenImeIsShown) { - mNavigationBarController.setShouldShowImeSwitcherWhenImeIsShown( - shouldShowImeSwitcherWhenImeIsShown); + public void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { + mNavigationBarController.onNavButtonFlagsChanged(navButtonFlags); } /** diff --git a/core/java/android/inputmethodservice/NavigationBarController.java b/core/java/android/inputmethodservice/NavigationBarController.java index 19fa01de4a5f5..a247db2f3310b 100644 --- a/core/java/android/inputmethodservice/NavigationBarController.java +++ b/core/java/android/inputmethodservice/NavigationBarController.java @@ -49,6 +49,8 @@ import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; import android.widget.FrameLayout; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; + import java.util.Objects; /** @@ -77,8 +79,7 @@ final class NavigationBarController { default void onDestroy() { } - default void setShouldShowImeSwitcherWhenImeIsShown( - boolean shouldShowImeSwitcherWhenImeIsShown) { + default void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { } default String toDebugString() { @@ -117,8 +118,8 @@ final class NavigationBarController { mImpl.onDestroy(); } - void setShouldShowImeSwitcherWhenImeIsShown(boolean shouldShowImeSwitcherWhenImeIsShown) { - mImpl.setShouldShowImeSwitcherWhenImeIsShown(shouldShowImeSwitcherWhenImeIsShown); + void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { + mImpl.onNavButtonFlagsChanged(navButtonFlags); } String toDebugString() { @@ -448,11 +449,14 @@ final class NavigationBarController { } @Override - public void setShouldShowImeSwitcherWhenImeIsShown( - boolean shouldShowImeSwitcherWhenImeIsShown) { + public void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { if (mDestroyed) { return; } + + final boolean shouldShowImeSwitcherWhenImeIsShown = + (navButtonFlags & InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN) + != 0; if (mShouldShowImeSwitcherWhenImeIsShown == shouldShowImeSwitcherWhenImeIsShown) { return; } diff --git a/core/java/android/view/inputmethod/InputMethod.java b/core/java/android/view/inputmethod/InputMethod.java index 69ad739608b25..fd336a27bb675 100644 --- a/core/java/android/view/inputmethod/InputMethod.java +++ b/core/java/android/view/inputmethod/InputMethod.java @@ -31,6 +31,7 @@ import android.view.MotionEvent; import android.view.View; import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.view.IInlineSuggestionsRequestCallback; import com.android.internal.view.InlineSuggestionsRequestInfo; @@ -105,14 +106,13 @@ public interface InputMethod { * current IME. * @param configChanges {@link InputMethodInfo#getConfigChanges()} declared by IME. * @param stylusHwSupported {@link InputMethodInfo#supportsStylusHandwriting()} declared by IME. - * @param shouldShowImeSwitcherWhenImeIsShown {@code true} If the IME switcher is expected to be - * shown while the IME is shown. + * @param navButtonFlags The initial state of {@link InputMethodNavButtonFlags}. * @hide */ @MainThread default void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privilegedOperations, int configChanges, - boolean stylusHwSupported, boolean shouldShowImeSwitcherWhenImeIsShown) { + boolean stylusHwSupported, @InputMethodNavButtonFlags int navButtonFlags) { attachToken(token); } @@ -231,8 +231,7 @@ public interface InputMethod { * the next {@link #startInput(InputConnection, EditorInfo, IBinder)} as * long as your implementation of {@link InputMethod} relies on such * IPCs - * @param shouldShowImeSwitcherWhenImeIsShown {@code true} If the IME switcher is expected to be - * shown while the IME is shown. + * @param navButtonFlags {@link InputMethodNavButtonFlags} in the initial state of this session. * @see #startInput(InputConnection, EditorInfo) * @see #restartInput(InputConnection, EditorInfo) * @see EditorInfo @@ -241,7 +240,7 @@ public interface InputMethod { @MainThread default void dispatchStartInputWithToken(@Nullable InputConnection inputConnection, @NonNull EditorInfo editorInfo, boolean restarting, - @NonNull IBinder startInputToken, boolean shouldShowImeSwitcherWhenImeIsShown) { + @NonNull IBinder startInputToken, @InputMethodNavButtonFlags int navButtonFlags) { if (restarting) { restartInput(inputConnection, editorInfo); } else { @@ -250,15 +249,13 @@ public interface InputMethod { } /** - * Notifies that whether the IME should show the IME switcher or not is being changed. + * Notifies that {@link InputMethodNavButtonFlags} have been updated. * - * @param shouldShowImeSwitcherWhenImeIsShown {@code true} If the IME switcher is expected to be - * shown while the IME is shown. + * @param navButtonFlags The new {@link InputMethodNavButtonFlags}. * @hide */ @MainThread - default void onShouldShowImeSwitcherWhenImeIsShownChanged( - boolean shouldShowImeSwitcherWhenImeIsShown) { + default void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { } /** diff --git a/core/java/com/android/internal/inputmethod/InputMethodNavButtonFlags.java b/core/java/com/android/internal/inputmethod/InputMethodNavButtonFlags.java new file mode 100644 index 0000000000000..1b37c6cbe5ae6 --- /dev/null +++ b/core/java/com/android/internal/inputmethod/InputMethodNavButtonFlags.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.inputmethod; + +import static java.lang.annotation.RetentionPolicy.SOURCE; + +import android.annotation.IntDef; + +import java.lang.annotation.Retention; + +/** + * A set of flags notified from {@link com.android.server.inputmethod.InputMethodManagerService} to + * {@link android.inputmethodservice.InputMethodService} regarding how + * {@link android.inputmethodservice.NavigationBarController} should behave. + * + *

These flags will take effect when and only when + * {@link android.inputmethodservice.InputMethodService#canImeRenderGesturalNavButtons} returns + * {@code true}.

+ */ +@Retention(SOURCE) +@IntDef(flag = true, value = { + InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN, +}) +public @interface InputMethodNavButtonFlags { + /** + * When set, the IME switcher icon needs to be shown on the navigation bar. + */ + int SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN = 1; +} diff --git a/core/java/com/android/internal/view/IInputMethod.aidl b/core/java/com/android/internal/view/IInputMethod.aidl index d2bc3442ed369..273c5f1708123 100644 --- a/core/java/com/android/internal/view/IInputMethod.aidl +++ b/core/java/com/android/internal/view/IInputMethod.aidl @@ -37,8 +37,7 @@ import com.android.internal.view.InlineSuggestionsRequestInfo; */ oneway interface IInputMethod { void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps, - int configChanges, boolean stylusHwSupported, - boolean shouldShowImeSwitcherWhenImeIsShown); + int configChanges, boolean stylusHwSupported, int navigationBarFlags); void onCreateInlineSuggestionsRequest(in InlineSuggestionsRequestInfo requestInfo, in IInlineSuggestionsRequestCallback cb); @@ -48,10 +47,9 @@ oneway interface IInputMethod { void unbindInput(); void startInput(in IBinder startInputToken, in IInputContext inputContext, - in EditorInfo attribute, boolean restarting, - boolean shouldShowImeSwitcherWhenImeIsShown); + in EditorInfo attribute, boolean restarting, int navigationBarFlags); - void onShouldShowImeSwitcherWhenImeIsShownChanged(boolean shouldShowImeSwitcherWhenImeIsShown); + void onNavButtonFlagsChanged(int navButtonFlags); void createSession(in InputChannel channel, IInputSessionCallback callback); diff --git a/services/core/java/com/android/server/inputmethod/IInputMethodInvoker.java b/services/core/java/com/android/server/inputmethod/IInputMethodInvoker.java index 6cb3b3b6740da..e6fd409023864 100644 --- a/services/core/java/com/android/server/inputmethod/IInputMethodInvoker.java +++ b/services/core/java/com/android/server/inputmethod/IInputMethodInvoker.java @@ -32,6 +32,7 @@ import android.view.inputmethod.InputBinding; import android.view.inputmethod.InputMethodSubtype; import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.view.IInlineSuggestionsRequestCallback; import com.android.internal.view.IInputContext; import com.android.internal.view.IInputMethod; @@ -108,10 +109,10 @@ final class IInputMethodInvoker { @AnyThread void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps, int configChanges, boolean stylusHwSupported, - boolean shouldShowImeSwitcherWhenImeIsShown) { + @InputMethodNavButtonFlags int navButtonFlags) { try { mTarget.initializeInternal(token, privOps, configChanges, stylusHwSupported, - shouldShowImeSwitcherWhenImeIsShown); + navButtonFlags); } catch (RemoteException e) { logRemoteException(e); } @@ -147,20 +148,19 @@ final class IInputMethodInvoker { @AnyThread void startInput(IBinder startInputToken, IInputContext inputContext, EditorInfo attribute, - boolean restarting, boolean shouldShowImeSwitcherWhenImeIsShown) { + boolean restarting, @InputMethodNavButtonFlags int navButtonFlags) { try { mTarget.startInput(startInputToken, inputContext, attribute, restarting, - shouldShowImeSwitcherWhenImeIsShown); + navButtonFlags); } catch (RemoteException e) { logRemoteException(e); } } @AnyThread - void onShouldShowImeSwitcherWhenImeIsShownChanged(boolean shouldShowImeSwitcherWhenImeIsShown) { + void onNavButtonFlagsChanged(@InputMethodNavButtonFlags int navButtonFlags) { try { - mTarget.onShouldShowImeSwitcherWhenImeIsShownChanged( - shouldShowImeSwitcherWhenImeIsShown); + mTarget.onNavButtonFlagsChanged(navButtonFlags); } catch (RemoteException e) { logRemoteException(e); } diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 882e2e397d2c8..584193654bfa9 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -156,6 +156,7 @@ import com.android.internal.inputmethod.IInputMethodPrivilegedOperations; import com.android.internal.inputmethod.ImeTracing; import com.android.internal.inputmethod.InputBindResult; import com.android.internal.inputmethod.InputMethodDebug; +import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; @@ -2412,12 +2413,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub true /* direct */); } - final boolean shouldShowImeSwitcherWhenImeIsShown = - shouldShowImeSwitcherWhenImeIsShownLocked(); + @InputMethodNavButtonFlags + final int navButtonFlags = getInputMethodNavButtonFlagsLocked(); final SessionState session = mCurClient.curSession; setEnabledSessionLocked(session); session.method.startInput(startInputToken, mCurInputContext, mCurAttribute, restarting, - shouldShowImeSwitcherWhenImeIsShown); + navButtonFlags); if (mShowRequested) { if (DEBUG) Slog.v(TAG, "Attach new input asks to show input"); showCurrentInputLocked(mCurFocusedWindow, getAppShowFlagsLocked(), null, @@ -2681,7 +2682,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub + mCurTokenDisplayId); } inputMethod.initializeInternal(token, new InputMethodPrivilegedOperationsImpl(this, token), - configChanges, supportStylusHw, shouldShowImeSwitcherWhenImeIsShownLocked()); + configChanges, supportStylusHw, getInputMethodNavButtonFlagsLocked()); } @AnyThread @@ -2938,9 +2939,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } @GuardedBy("ImfLock.class") - boolean shouldShowImeSwitcherWhenImeIsShownLocked() { - return shouldShowImeSwitcherLocked( + @InputMethodNavButtonFlags + private int getInputMethodNavButtonFlagsLocked() { + final boolean shouldShowImeSwitcherWhenImeIsShown = shouldShowImeSwitcherLocked( InputMethodService.IME_ACTIVE | InputMethodService.IME_VISIBLE); + return shouldShowImeSwitcherWhenImeIsShown + ? InputMethodNavButtonFlags.SHOW_IME_SWITCHER_WHEN_IME_IS_SHOWN : 0; } @GuardedBy("ImfLock.class") @@ -3203,7 +3207,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // the same enabled IMEs list. mSwitchingController.resetCircularListLocked(mContext); - sendShouldShowImeSwitcherWhenImeIsShownLocked(); + sendOnNavButtonFlagsChangedLocked(); } @GuardedBy("ImfLock.class") @@ -4680,7 +4684,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub case MSG_HARD_KEYBOARD_SWITCH_CHANGED: mMenuController.handleHardKeyboardStatusChange(msg.arg1 == 1); synchronized (ImfLock.class) { - sendShouldShowImeSwitcherWhenImeIsShownLocked(); + sendOnNavButtonFlagsChangedLocked(); } return true; case MSG_SYSTEM_UNLOCK_USER: { @@ -4950,7 +4954,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // the same enabled IMEs list. mSwitchingController.resetCircularListLocked(mContext); - sendShouldShowImeSwitcherWhenImeIsShownLocked(); + sendOnNavButtonFlagsChangedLocked(); // Notify InputMethodListListeners of the new installed InputMethods. final List inputMethodList = new ArrayList<>(mMethodList); @@ -4959,14 +4963,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } @GuardedBy("ImfLock.class") - void sendShouldShowImeSwitcherWhenImeIsShownLocked() { + void sendOnNavButtonFlagsChangedLocked() { final IInputMethodInvoker curMethod = mBindingController.getCurMethod(); if (curMethod == null) { // No need to send the data if the IME is not yet bound. return; } - curMethod.onShouldShowImeSwitcherWhenImeIsShownChanged( - shouldShowImeSwitcherWhenImeIsShownLocked()); + curMethod.onNavButtonFlagsChanged(getInputMethodNavButtonFlagsLocked()); } @GuardedBy("ImfLock.class") diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java index 98bde11ad5176..c255fe14c03e8 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java @@ -203,7 +203,7 @@ final class InputMethodMenuController { attrs.setTitle("Select input method"); w.setAttributes(attrs); mService.updateSystemUiLocked(); - mService.sendShouldShowImeSwitcherWhenImeIsShownLocked(); + mService.sendOnNavButtonFlagsChangedLocked(); mSwitchingDialog.show(); } } @@ -239,7 +239,7 @@ final class InputMethodMenuController { mSwitchingDialogTitleView = null; mService.updateSystemUiLocked(); - mService.sendShouldShowImeSwitcherWhenImeIsShownLocked(); + mService.sendOnNavButtonFlagsChangedLocked(); mDialogBuilder = null; mIms = null; }