Merge "New API for getting uids have specific permissions from SystemConfig"

This commit is contained in:
Lorenzo Colitti
2021-02-16 08:24:21 +00:00
committed by Gerrit Code Review
4 changed files with 44 additions and 0 deletions

View File

@@ -35,4 +35,9 @@ interface ISystemConfig {
* @see SystemConfigManager#getDisabledUntilUsedPreinstalledCarrierAssociatedAppEntries
*/
Map getDisabledUntilUsedPreinstalledCarrierAssociatedAppEntries();
/**
* @see SystemConfigManager#getSystemPermissionUids
*/
int[] getSystemPermissionUids(String permissionName);
}

View File

@@ -111,4 +111,22 @@ public class SystemConfigManager {
return Collections.emptyMap();
}
}
/**
* Get uids which have been granted given permission in system configuration.
*
* The uids and assigning permissions are defined on data/etc/platform.xml
*
* @param permissionName The target permission.
* @return The uids have been granted given permission in system configuration.
*/
@RequiresPermission(Manifest.permission.GET_RUNTIME_PERMISSIONS)
@NonNull
public int[] getSystemPermissionUids(@NonNull String permissionName) {
try {
return mInterface.getSystemPermissionUids(permissionName);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
}