Merge "Introduce InputMethodNavButtonFlags" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fca00d3193
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
* <p>These flags will take effect when and only when
|
||||
* {@link android.inputmethodservice.InputMethodService#canImeRenderGesturalNavButtons} returns
|
||||
* {@code true}.</p>
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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<InputMethodInfo> 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")
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user