New API for getting uids have specific permissions from SystemConfig
SysetmConfig is internal service for frameworks only which cannot use by Connectivity mainline module, but PermissionMonitor which is part of the module needs to get uids that have been granted INTERNET/UPDATE_DEVICE_STATS permission from SystemConfig. Therefore, add a new API to SystemConfigManager that can get these uids from SysetmConfig. Bug: 177188455 Test: atest SystemConfigTest Change-Id: I62bdd969b1b813631ed6223df97bda21a39aec2c
This commit is contained in:
@@ -35,4 +35,9 @@ interface ISystemConfig {
|
||||
* @see SystemConfigManager#getDisabledUntilUsedPreinstalledCarrierAssociatedAppEntries
|
||||
*/
|
||||
Map getDisabledUntilUsedPreinstalledCarrierAssociatedAppEntries();
|
||||
|
||||
/**
|
||||
* @see SystemConfigManager#getSystemPermissionUids
|
||||
*/
|
||||
int[] getSystemPermissionUids(String permissionName);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user