Loading core/java/android/app/admin/DevicePolicyManager.java +29 −1 Original line number Diff line number Diff line Loading @@ -9279,7 +9279,7 @@ public class DevicePolicyManager { throwIfParentInstance("getPermittedInputMethodsForCurrentUser"); if (mService != null) { try { return mService.getPermittedInputMethodsForCurrentUser(); return mService.getPermittedInputMethodsAsUser(UserHandle.myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -9287,6 +9287,34 @@ public class DevicePolicyManager { return null; } /** * Returns the list of input methods permitted. * * <p>When this method returns empty list means all input methods are allowed, if a non-empty * list is returned it will contain the intersection of the permitted lists for any device or * profile owners that apply to this user. It will also include any system input methods. * * @return List of input method package names. * @hide */ @UserHandleAware @RequiresPermission(allOf = { android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, android.Manifest.permission.MANAGE_USERS }, conditional = true) public @NonNull List<String> getPermittedInputMethods() { throwIfParentInstance("getPermittedInputMethods"); List<String> result = null; if (mService != null) { try { result = mService.getPermittedInputMethodsAsUser(myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return result != null ? result : Collections.emptyList(); } /** * Called by a profile owner of a managed profile to set the packages that are allowed to use * a {@link android.service.notification.NotificationListenerService} in the primary user to Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ interface IDevicePolicyManager { boolean setPermittedInputMethods(in ComponentName admin,in List<String> packageList, boolean parent); List<String> getPermittedInputMethods(in ComponentName admin, boolean parent); List<String> getPermittedInputMethodsForCurrentUser(); List<String> getPermittedInputMethodsAsUser(int userId); boolean isInputMethodPermittedByAdmin(in ComponentName admin, String packageName, int userId, boolean parent); boolean setPermittedCrossProfileNotificationListeners(in ComponentName admin, in List<String> packageList); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +12 −3 Original line number Diff line number Diff line Loading @@ -10399,14 +10399,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override public List<String> getPermittedInputMethodsForCurrentUser() { public @Nullable List<String> getPermittedInputMethodsAsUser(@UserIdInt int userId) { final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userId)); Preconditions.checkCallAuthorization(canManageUsers(caller)); final long callingIdentity = Binder.clearCallingIdentity(); try { return getPermittedInputMethodsUnchecked(userId); } finally { Binder.restoreCallingIdentity(callingIdentity); } } private @Nullable List<String> getPermittedInputMethodsUnchecked(@UserIdInt int userId) { synchronized (getLockObject()) { List<String> result = null; // Only device or profile owners can have permitted lists set. List<ActiveAdmin> admins = getActiveAdminsForAffectedUserLocked(caller.getUserId()); List<ActiveAdmin> admins = getActiveAdminsForAffectedUserLocked(userId); for (ActiveAdmin admin: admins) { List<String> fromAdmin = admin.permittedInputMethods; if (fromAdmin != null) { Loading @@ -10421,7 +10430,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // If we have a permitted list add all system input methods. if (result != null) { List<InputMethodInfo> imes = InputMethodManagerInternal .get().getInputMethodListAsUser(caller.getUserId()); .get().getInputMethodListAsUser(userId); if (imes != null) { for (InputMethodInfo ime : imes) { ServiceInfo serviceInfo = ime.getServiceInfo(); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +29 −1 Original line number Diff line number Diff line Loading @@ -9279,7 +9279,7 @@ public class DevicePolicyManager { throwIfParentInstance("getPermittedInputMethodsForCurrentUser"); if (mService != null) { try { return mService.getPermittedInputMethodsForCurrentUser(); return mService.getPermittedInputMethodsAsUser(UserHandle.myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -9287,6 +9287,34 @@ public class DevicePolicyManager { return null; } /** * Returns the list of input methods permitted. * * <p>When this method returns empty list means all input methods are allowed, if a non-empty * list is returned it will contain the intersection of the permitted lists for any device or * profile owners that apply to this user. It will also include any system input methods. * * @return List of input method package names. * @hide */ @UserHandleAware @RequiresPermission(allOf = { android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, android.Manifest.permission.MANAGE_USERS }, conditional = true) public @NonNull List<String> getPermittedInputMethods() { throwIfParentInstance("getPermittedInputMethods"); List<String> result = null; if (mService != null) { try { result = mService.getPermittedInputMethodsAsUser(myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return result != null ? result : Collections.emptyList(); } /** * Called by a profile owner of a managed profile to set the packages that are allowed to use * a {@link android.service.notification.NotificationListenerService} in the primary user to Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ interface IDevicePolicyManager { boolean setPermittedInputMethods(in ComponentName admin,in List<String> packageList, boolean parent); List<String> getPermittedInputMethods(in ComponentName admin, boolean parent); List<String> getPermittedInputMethodsForCurrentUser(); List<String> getPermittedInputMethodsAsUser(int userId); boolean isInputMethodPermittedByAdmin(in ComponentName admin, String packageName, int userId, boolean parent); boolean setPermittedCrossProfileNotificationListeners(in ComponentName admin, in List<String> packageList); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +12 −3 Original line number Diff line number Diff line Loading @@ -10399,14 +10399,23 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override public List<String> getPermittedInputMethodsForCurrentUser() { public @Nullable List<String> getPermittedInputMethodsAsUser(@UserIdInt int userId) { final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userId)); Preconditions.checkCallAuthorization(canManageUsers(caller)); final long callingIdentity = Binder.clearCallingIdentity(); try { return getPermittedInputMethodsUnchecked(userId); } finally { Binder.restoreCallingIdentity(callingIdentity); } } private @Nullable List<String> getPermittedInputMethodsUnchecked(@UserIdInt int userId) { synchronized (getLockObject()) { List<String> result = null; // Only device or profile owners can have permitted lists set. List<ActiveAdmin> admins = getActiveAdminsForAffectedUserLocked(caller.getUserId()); List<ActiveAdmin> admins = getActiveAdminsForAffectedUserLocked(userId); for (ActiveAdmin admin: admins) { List<String> fromAdmin = admin.permittedInputMethods; if (fromAdmin != null) { Loading @@ -10421,7 +10430,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { // If we have a permitted list add all system input methods. if (result != null) { List<InputMethodInfo> imes = InputMethodManagerInternal .get().getInputMethodListAsUser(caller.getUserId()); .get().getInputMethodListAsUser(userId); if (imes != null) { for (InputMethodInfo ime : imes) { ServiceInfo serviceInfo = ime.getServiceInfo(); Loading