Permission Check For DPM Get IME API

Require the caller of DPM.getPermittedInputMethodsForCurrentUser() to
hold the MANAGE_USERS permission.  The only callers should be settings
apps which already hold this permission.

Bug: 62343414
Test: Manage IME list in the Settings app
Test: com.google.android.gts.devicepolicy.DeviceOwnerTest#testPermitInputMethods
Change-Id: I0d162f8f51d16e403a950ee5d942502c2cf20181
This commit is contained in:
Eric Sandness
2018-03-27 13:22:52 +01:00
parent 678c0286be
commit 57378939c5
2 changed files with 2 additions and 0 deletions

View File

@@ -6340,6 +6340,7 @@ public class DevicePolicyManager {
* @hide
*/
@SystemApi
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public @Nullable List<String> getPermittedInputMethodsForCurrentUser() {
throwIfParentInstance("getPermittedInputMethodsForCurrentUser");
if (mService != null) {

View File

@@ -8738,6 +8738,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
@Override
public List getPermittedInputMethodsForCurrentUser() {
enforceManageUsers();
UserInfo currentUser;
try {
currentUser = mInjector.getIActivityManager().getCurrentUser();