Loading services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +27 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.inputmethod; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; Loading @@ -30,6 +32,9 @@ import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.server.LocalServices; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.Collections; import java.util.List; Loading @@ -37,6 +42,16 @@ import java.util.List; * Input method manager local system service interface. */ public abstract class InputMethodManagerInternal { /** * Indicates that the method is guaranteed to not require {@link ImfLock}. * * <p>You can call this method without worrying about system_server lock layering.</p> */ @Retention(SOURCE) @Target({ElementType.METHOD}) public @interface ImfLockFree { } /** * Listener for input method list changed events. */ Loading @@ -53,6 +68,7 @@ public abstract class InputMethodManagerInternal { * * @param interactive the interactive mode parameter */ @ImfLockFree public abstract void setInteractive(boolean interactive); /** Loading @@ -61,6 +77,7 @@ public abstract class InputMethodManagerInternal { * @param reason the reason for hiding the current input method * @param originatingDisplayId the display ID the request is originated */ @ImfLockFree public abstract void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId); Loading Loading @@ -143,6 +160,7 @@ public abstract class InputMethodManagerInternal { * * @param listener the listener to add */ @ImfLockFree public abstract void registerInputMethodListListener(InputMethodListListener listener); /** Loading Loading @@ -178,6 +196,7 @@ public abstract class InputMethodManagerInternal { * * @param displayId the display hosting the IME window */ @ImfLockFree public abstract void removeImeSurface(int displayId); /** Loading @@ -188,12 +207,14 @@ public abstract class InputMethodManagerInternal { * @param disableImeIcon indicates whether IME icon should be enabled or not * @param displayId the display for which to update the IME window status */ @ImfLockFree public abstract void updateImeWindowStatus(boolean disableImeIcon, int displayId); /** * Finish stylus handwriting by calling {@link InputMethodService#finishStylusHandwriting()} if * there is an ongoing handwriting session. */ @ImfLockFree public abstract void maybeFinishStylusHandwriting(); /** Loading Loading @@ -240,10 +261,12 @@ public abstract class InputMethodManagerInternal { */ private static final InputMethodManagerInternal NOP = new InputMethodManagerInternal() { @ImfLockFree @Override public void setInteractive(boolean interactive) { } @ImfLockFree @Override public void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId) { Loading Loading @@ -282,6 +305,7 @@ public abstract class InputMethodManagerInternal { int deviceId, @Nullable String imeId) { } @ImfLockFree @Override public void registerInputMethodListListener(InputMethodListListener listener) { } Loading @@ -300,10 +324,12 @@ public abstract class InputMethodManagerInternal { public void onImeParentChanged(int displayId) { } @ImfLockFree @Override public void removeImeSurface(int displayId) { } @ImfLockFree @Override public void updateImeWindowStatus(boolean disableImeIcon, int displayId) { } Loading @@ -318,6 +344,7 @@ public abstract class InputMethodManagerInternal { @UserIdInt int userId) { } @ImfLockFree @Override public void maybeFinishStylusHandwriting() { } Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -5500,12 +5500,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. private final class LocalServiceImpl extends InputMethodManagerInternal { @ImfLockFree @Override public void setInteractive(boolean interactive) { // Do everything in handler so as not to block the caller. mHandler.obtainMessage(MSG_SET_INTERACTIVE, interactive ? 1 : 0, 0).sendToTarget(); } @ImfLockFree @Override public void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId) { Loading Loading @@ -5591,6 +5593,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void registerInputMethodListListener(InputMethodListListener listener) { mInputMethodListListeners.addIfAbsent(listener); Loading Loading @@ -5638,11 +5641,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void removeImeSurface(int displayId) { mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE).sendToTarget(); } @ImfLockFree @Override public void updateImeWindowStatus(boolean disableImeIcon, int displayId) { mHandler.obtainMessage(MSG_UPDATE_IME_WINDOW_STATUS, disableImeIcon ? 1 : 0, 0) Loading Loading @@ -5720,6 +5725,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void maybeFinishStylusHandwriting() { mHandler.removeMessages(MSG_FINISH_HANDWRITING); Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +27 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.server.inputmethod; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; Loading @@ -30,6 +32,9 @@ import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.server.LocalServices; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.Collections; import java.util.List; Loading @@ -37,6 +42,16 @@ import java.util.List; * Input method manager local system service interface. */ public abstract class InputMethodManagerInternal { /** * Indicates that the method is guaranteed to not require {@link ImfLock}. * * <p>You can call this method without worrying about system_server lock layering.</p> */ @Retention(SOURCE) @Target({ElementType.METHOD}) public @interface ImfLockFree { } /** * Listener for input method list changed events. */ Loading @@ -53,6 +68,7 @@ public abstract class InputMethodManagerInternal { * * @param interactive the interactive mode parameter */ @ImfLockFree public abstract void setInteractive(boolean interactive); /** Loading @@ -61,6 +77,7 @@ public abstract class InputMethodManagerInternal { * @param reason the reason for hiding the current input method * @param originatingDisplayId the display ID the request is originated */ @ImfLockFree public abstract void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId); Loading Loading @@ -143,6 +160,7 @@ public abstract class InputMethodManagerInternal { * * @param listener the listener to add */ @ImfLockFree public abstract void registerInputMethodListListener(InputMethodListListener listener); /** Loading Loading @@ -178,6 +196,7 @@ public abstract class InputMethodManagerInternal { * * @param displayId the display hosting the IME window */ @ImfLockFree public abstract void removeImeSurface(int displayId); /** Loading @@ -188,12 +207,14 @@ public abstract class InputMethodManagerInternal { * @param disableImeIcon indicates whether IME icon should be enabled or not * @param displayId the display for which to update the IME window status */ @ImfLockFree public abstract void updateImeWindowStatus(boolean disableImeIcon, int displayId); /** * Finish stylus handwriting by calling {@link InputMethodService#finishStylusHandwriting()} if * there is an ongoing handwriting session. */ @ImfLockFree public abstract void maybeFinishStylusHandwriting(); /** Loading Loading @@ -240,10 +261,12 @@ public abstract class InputMethodManagerInternal { */ private static final InputMethodManagerInternal NOP = new InputMethodManagerInternal() { @ImfLockFree @Override public void setInteractive(boolean interactive) { } @ImfLockFree @Override public void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId) { Loading Loading @@ -282,6 +305,7 @@ public abstract class InputMethodManagerInternal { int deviceId, @Nullable String imeId) { } @ImfLockFree @Override public void registerInputMethodListListener(InputMethodListListener listener) { } Loading @@ -300,10 +324,12 @@ public abstract class InputMethodManagerInternal { public void onImeParentChanged(int displayId) { } @ImfLockFree @Override public void removeImeSurface(int displayId) { } @ImfLockFree @Override public void updateImeWindowStatus(boolean disableImeIcon, int displayId) { } Loading @@ -318,6 +344,7 @@ public abstract class InputMethodManagerInternal { @UserIdInt int userId) { } @ImfLockFree @Override public void maybeFinishStylusHandwriting() { } Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -5500,12 +5500,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. private final class LocalServiceImpl extends InputMethodManagerInternal { @ImfLockFree @Override public void setInteractive(boolean interactive) { // Do everything in handler so as not to block the caller. mHandler.obtainMessage(MSG_SET_INTERACTIVE, interactive ? 1 : 0, 0).sendToTarget(); } @ImfLockFree @Override public void hideAllInputMethods(@SoftInputShowHideReason int reason, int originatingDisplayId) { Loading Loading @@ -5591,6 +5593,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void registerInputMethodListListener(InputMethodListListener listener) { mInputMethodListListeners.addIfAbsent(listener); Loading Loading @@ -5638,11 +5641,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void removeImeSurface(int displayId) { mHandler.obtainMessage(MSG_REMOVE_IME_SURFACE).sendToTarget(); } @ImfLockFree @Override public void updateImeWindowStatus(boolean disableImeIcon, int displayId) { mHandler.obtainMessage(MSG_UPDATE_IME_WINDOW_STATUS, disableImeIcon ? 1 : 0, 0) Loading Loading @@ -5720,6 +5725,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @ImfLockFree @Override public void maybeFinishStylusHandwriting() { mHandler.removeMessages(MSG_FINISH_HANDWRITING); Loading