Loading services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +10 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried * @return a list of {@link InputMethodInfo}. VR-only IMEs are already excluded */ @ImfLockFree @NonNull public abstract List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId); /** Loading @@ -98,6 +100,8 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried * @return a list of {@link InputMethodInfo} that are enabled for {@code userId} */ @ImfLockFree @NonNull public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId); /** Loading @@ -108,6 +112,7 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried about * @return a list of {@link InputMethodSubtype} that are enabled for {@code userId} */ @ImfLockFree @NonNull public abstract List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId); Loading Loading @@ -314,17 +319,22 @@ public abstract class InputMethodManagerInternal { int originatingDisplayId) { } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) { return Collections.emptyList(); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getEnabledInputMethodListAsUser( @UserIdInt int userId) { return Collections.emptyList(); } @ImfLockFree @NonNull @Override public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(String imiId, Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +68 −95 Original line number Diff line number Diff line Loading @@ -1469,9 +1469,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mContext.enforceCallingOrSelfPermission( Manifest.permission.INTERACT_ACROSS_USERS_FULL, null); } synchronized (ImfLock.class) { return queryDefaultInputMethodForUserIdLocked(userId); } final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); return settings.getMethodMap().get(settings.getSelectedInputMethod()); } @BinderThread Loading @@ -1486,17 +1485,15 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return InputMethodInfoSafeList.empty(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return InputMethodInfoSafeList.create(getInputMethodListLocked( return InputMethodInfoSafeList.create(getInputMethodListInternal( userId, directBootAwareness, callingUid)); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1509,17 +1506,15 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return InputMethodInfoSafeList.empty(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return InputMethodInfoSafeList.create( getEnabledInputMethodListLocked(userId, callingUid)); getEnabledInputMethodListInternal(userId, callingUid)); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1533,16 +1528,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return Collections.emptyList(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getInputMethodListLocked(userId, directBootAwareness, callingUid); return getInputMethodListInternal(userId, directBootAwareness, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1555,16 +1548,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return Collections.emptyList(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodListLocked(userId, callingUid); return getEnabledInputMethodListInternal(userId, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @Override public boolean isStylusHandwritingAvailableAsUser( Loading Loading @@ -1606,8 +1597,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return true; } @GuardedBy("ImfLock.class") private List<InputMethodInfo> getInputMethodListLocked(@UserIdInt int userId, private List<InputMethodInfo> getInputMethodListInternal(@UserIdInt int userId, @DirectBootAwareness int directBootAwareness, int callingUid) { final InputMethodSettings settings; if (directBootAwareness == DirectBootAwareness.AUTO) { Loading @@ -1626,8 +1616,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return methodList; } @GuardedBy("ImfLock.class") private List<InputMethodInfo> getEnabledInputMethodListLocked(@UserIdInt int userId, private List<InputMethodInfo> getEnabledInputMethodListInternal(@UserIdInt int userId, int callingUid) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); final ArrayList<InputMethodInfo> methodList = settings.getEnabledInputMethodList(); Loading @@ -1654,20 +1643,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. Manifest.permission.INTERACT_ACROSS_USERS_FULL, null); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodSubtypeListLocked(imiId, return getEnabledInputMethodSubtypeListInternal(imiId, allowsImplicitlyEnabledSubtypes, userId, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @GuardedBy("ImfLock.class") private List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(String imiId, private List<InputMethodSubtype> getEnabledInputMethodSubtypeListInternal(String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId, int callingUid) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); final InputMethodInfo imi = settings.getMethodMap().get(imiId); Loading Loading @@ -5703,17 +5689,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } /** * Returns the default {@link InputMethodInfo} for the specific userId. * * @param userId user ID to query */ @GuardedBy("ImfLock.class") private InputMethodInfo queryDefaultInputMethodForUserIdLocked(@UserIdInt int userId) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); return settings.getMethodMap().get(settings.getSelectedInputMethod()); } @GuardedBy("ImfLock.class") private boolean switchToInputMethodLocked(@NonNull String imeId, int subtypeId, @UserIdInt int userId) { Loading Loading @@ -5850,31 +5825,28 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mHandler.obtainMessage(MSG_HIDE_ALL_INPUT_METHODS, reason).sendToTarget(); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) { synchronized (ImfLock.class) { return getInputMethodListLocked(userId, DirectBootAwareness.AUTO, Process.SYSTEM_UID); } return getInputMethodListInternal(userId, DirectBootAwareness.AUTO, Process.SYSTEM_UID); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId) { synchronized (ImfLock.class) { return getEnabledInputMethodListLocked(userId, Process.SYSTEM_UID); } return getEnabledInputMethodListInternal(userId, Process.SYSTEM_UID); } @ImfLockFree @NonNull @Override public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { synchronized (ImfLock.class) { return getEnabledInputMethodSubtypeListLocked(imiId, allowsImplicitlyEnabledSubtypes, return getEnabledInputMethodSubtypeListInternal(imiId, allowsImplicitlyEnabledSubtypes, userId, Process.SYSTEM_UID); } } @Override public void onCreateInlineSuggestionsRequest(@UserIdInt int userId, Loading Loading @@ -6619,15 +6591,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. break; } } final int[] userIds; synchronized (ImfLock.class) { final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved, mCurrentUserId, shellCommand.getErrPrintWriter()); userIds = InputMethodUtils.resolveUserId(userIdToBeResolved, mCurrentUserId, shellCommand.getErrPrintWriter()); } try (PrintWriter pr = shellCommand.getOutPrintWriter()) { for (int userId : userIds) { final List<InputMethodInfo> methods = all ? getInputMethodListLocked( ? getInputMethodListInternal( userId, DirectBootAwareness.AUTO, Process.SHELL_UID) : getEnabledInputMethodListLocked(userId, Process.SHELL_UID); : getEnabledInputMethodListInternal(userId, Process.SHELL_UID); if (userIds.length > 1) { pr.print("User #"); pr.print(userId); Loading @@ -6644,7 +6618,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } } } return ShellCommandResult.SUCCESS; } Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerInternal.java +10 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,8 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried * @return a list of {@link InputMethodInfo}. VR-only IMEs are already excluded */ @ImfLockFree @NonNull public abstract List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId); /** Loading @@ -98,6 +100,8 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried * @return a list of {@link InputMethodInfo} that are enabled for {@code userId} */ @ImfLockFree @NonNull public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId); /** Loading @@ -108,6 +112,7 @@ public abstract class InputMethodManagerInternal { * @param userId the user ID to be queried about * @return a list of {@link InputMethodSubtype} that are enabled for {@code userId} */ @ImfLockFree @NonNull public abstract List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId); Loading Loading @@ -314,17 +319,22 @@ public abstract class InputMethodManagerInternal { int originatingDisplayId) { } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) { return Collections.emptyList(); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getEnabledInputMethodListAsUser( @UserIdInt int userId) { return Collections.emptyList(); } @ImfLockFree @NonNull @Override public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(String imiId, Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +68 −95 Original line number Diff line number Diff line Loading @@ -1469,9 +1469,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mContext.enforceCallingOrSelfPermission( Manifest.permission.INTERACT_ACROSS_USERS_FULL, null); } synchronized (ImfLock.class) { return queryDefaultInputMethodForUserIdLocked(userId); } final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); return settings.getMethodMap().get(settings.getSelectedInputMethod()); } @BinderThread Loading @@ -1486,17 +1485,15 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return InputMethodInfoSafeList.empty(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return InputMethodInfoSafeList.create(getInputMethodListLocked( return InputMethodInfoSafeList.create(getInputMethodListInternal( userId, directBootAwareness, callingUid)); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1509,17 +1506,15 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return InputMethodInfoSafeList.empty(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return InputMethodInfoSafeList.create( getEnabledInputMethodListLocked(userId, callingUid)); getEnabledInputMethodListInternal(userId, callingUid)); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1533,16 +1528,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return Collections.emptyList(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getInputMethodListLocked(userId, directBootAwareness, callingUid); return getInputMethodListInternal(userId, directBootAwareness, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @BinderThread @NonNull Loading @@ -1555,16 +1548,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. if (!mUserManagerInternal.exists(userId)) { return Collections.emptyList(); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodListLocked(userId, callingUid); return getEnabledInputMethodListInternal(userId, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @Override public boolean isStylusHandwritingAvailableAsUser( Loading Loading @@ -1606,8 +1597,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return true; } @GuardedBy("ImfLock.class") private List<InputMethodInfo> getInputMethodListLocked(@UserIdInt int userId, private List<InputMethodInfo> getInputMethodListInternal(@UserIdInt int userId, @DirectBootAwareness int directBootAwareness, int callingUid) { final InputMethodSettings settings; if (directBootAwareness == DirectBootAwareness.AUTO) { Loading @@ -1626,8 +1616,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return methodList; } @GuardedBy("ImfLock.class") private List<InputMethodInfo> getEnabledInputMethodListLocked(@UserIdInt int userId, private List<InputMethodInfo> getEnabledInputMethodListInternal(@UserIdInt int userId, int callingUid) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); final ArrayList<InputMethodInfo> methodList = settings.getEnabledInputMethodList(); Loading @@ -1654,20 +1643,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. Manifest.permission.INTERACT_ACROSS_USERS_FULL, null); } synchronized (ImfLock.class) { final int callingUid = Binder.getCallingUid(); final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodSubtypeListLocked(imiId, return getEnabledInputMethodSubtypeListInternal(imiId, allowsImplicitlyEnabledSubtypes, userId, callingUid); } finally { Binder.restoreCallingIdentity(ident); } } } @GuardedBy("ImfLock.class") private List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(String imiId, private List<InputMethodSubtype> getEnabledInputMethodSubtypeListInternal(String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId, int callingUid) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); final InputMethodInfo imi = settings.getMethodMap().get(imiId); Loading Loading @@ -5703,17 +5689,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } /** * Returns the default {@link InputMethodInfo} for the specific userId. * * @param userId user ID to query */ @GuardedBy("ImfLock.class") private InputMethodInfo queryDefaultInputMethodForUserIdLocked(@UserIdInt int userId) { final InputMethodSettings settings = InputMethodSettingsRepository.get(userId); return settings.getMethodMap().get(settings.getSelectedInputMethod()); } @GuardedBy("ImfLock.class") private boolean switchToInputMethodLocked(@NonNull String imeId, int subtypeId, @UserIdInt int userId) { Loading Loading @@ -5850,31 +5825,28 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mHandler.obtainMessage(MSG_HIDE_ALL_INPUT_METHODS, reason).sendToTarget(); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getInputMethodListAsUser(@UserIdInt int userId) { synchronized (ImfLock.class) { return getInputMethodListLocked(userId, DirectBootAwareness.AUTO, Process.SYSTEM_UID); } return getInputMethodListInternal(userId, DirectBootAwareness.AUTO, Process.SYSTEM_UID); } @ImfLockFree @NonNull @Override public List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId) { synchronized (ImfLock.class) { return getEnabledInputMethodListLocked(userId, Process.SYSTEM_UID); } return getEnabledInputMethodListInternal(userId, Process.SYSTEM_UID); } @ImfLockFree @NonNull @Override public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser( String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { synchronized (ImfLock.class) { return getEnabledInputMethodSubtypeListLocked(imiId, allowsImplicitlyEnabledSubtypes, return getEnabledInputMethodSubtypeListInternal(imiId, allowsImplicitlyEnabledSubtypes, userId, Process.SYSTEM_UID); } } @Override public void onCreateInlineSuggestionsRequest(@UserIdInt int userId, Loading Loading @@ -6619,15 +6591,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. break; } } final int[] userIds; synchronized (ImfLock.class) { final int[] userIds = InputMethodUtils.resolveUserId(userIdToBeResolved, mCurrentUserId, shellCommand.getErrPrintWriter()); userIds = InputMethodUtils.resolveUserId(userIdToBeResolved, mCurrentUserId, shellCommand.getErrPrintWriter()); } try (PrintWriter pr = shellCommand.getOutPrintWriter()) { for (int userId : userIds) { final List<InputMethodInfo> methods = all ? getInputMethodListLocked( ? getInputMethodListInternal( userId, DirectBootAwareness.AUTO, Process.SHELL_UID) : getEnabledInputMethodListLocked(userId, Process.SHELL_UID); : getEnabledInputMethodListInternal(userId, Process.SHELL_UID); if (userIds.length > 1) { pr.print("User #"); pr.print(userId); Loading @@ -6644,7 +6618,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } } } return ShellCommandResult.SUCCESS; } Loading