Link PACKAGE_USAGE_STATS with LOADER_USAGE_STATS
Bug: 148374455 Test: Manual Test: Create three packages; 1) only request PACKAGE_USAGE_STATS, 2) only request LOADER_USAGE_STATS, 3) request both Test: Go to Settings -> Apps & Notifications -> Special app access Test: See that there is only a single entry for "Usage access" Test: Under "Usage access", see all three test apps appear Test: Disable access for each application and verify that only the appop for the declared permisson is flipped using Test: adb shell cmd appops get <<PACKAGE_NAME>> Change-Id: I7741a703fd4494832347e51e113adf974cc31d2b
This commit is contained in:
@@ -33,13 +33,20 @@ public class AppStateUsageBridge extends AppStateAppOpsBridge {
|
||||
private static final String TAG = "AppStateUsageBridge";
|
||||
|
||||
private static final String PM_USAGE_STATS = Manifest.permission.PACKAGE_USAGE_STATS;
|
||||
private static final int APP_OPS_OP_CODE = AppOpsManager.OP_GET_USAGE_STATS;
|
||||
private static final String[] PM_PERMISSION = {
|
||||
PM_USAGE_STATS
|
||||
private static final String PM_LOADER_STATS = Manifest.permission.LOADER_USAGE_STATS;
|
||||
private static final int APP_OPS_USAGE_STATS = AppOpsManager.OP_GET_USAGE_STATS;
|
||||
private static final int APP_OPS_LOADER_STATS = AppOpsManager.OP_LOADER_USAGE_STATS;
|
||||
private static final int[] APP_OPS_OP_CODES = {
|
||||
APP_OPS_USAGE_STATS,
|
||||
APP_OPS_LOADER_STATS,
|
||||
};
|
||||
private static final String[] PM_PERMISSIONS = {
|
||||
PM_USAGE_STATS,
|
||||
PM_LOADER_STATS,
|
||||
};
|
||||
|
||||
public AppStateUsageBridge(Context context, ApplicationsState appState, Callback callback) {
|
||||
super(context, appState, callback, APP_OPS_OP_CODE, PM_PERMISSION);
|
||||
super(context, appState, callback, APP_OPS_OP_CODES, PM_PERMISSIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user