Merge "Fix DPM check logic for AppUsageLimitObserver (un)registering" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0a78a5ad9d
@@ -1847,7 +1847,7 @@ public class UsageStatsService extends SystemService implements
|
|||||||
final DevicePolicyManagerInternal dpmInternal = getDpmInternal();
|
final DevicePolicyManagerInternal dpmInternal = getDpmInternal();
|
||||||
if (!hasPermissions(callingPackage,
|
if (!hasPermissions(callingPackage,
|
||||||
Manifest.permission.SUSPEND_APPS, Manifest.permission.OBSERVE_APP_USAGE)
|
Manifest.permission.SUSPEND_APPS, Manifest.permission.OBSERVE_APP_USAGE)
|
||||||
&& (dpmInternal != null && !dpmInternal.isActiveSupervisionApp(callingUid))) {
|
&& (dpmInternal == null || !dpmInternal.isActiveSupervisionApp(callingUid))) {
|
||||||
throw new SecurityException("Caller must be the active supervision app or "
|
throw new SecurityException("Caller must be the active supervision app or "
|
||||||
+ "it must have both SUSPEND_APPS and OBSERVE_APP_USAGE permissions");
|
+ "it must have both SUSPEND_APPS and OBSERVE_APP_USAGE permissions");
|
||||||
}
|
}
|
||||||
@@ -1874,7 +1874,7 @@ public class UsageStatsService extends SystemService implements
|
|||||||
final DevicePolicyManagerInternal dpmInternal = getDpmInternal();
|
final DevicePolicyManagerInternal dpmInternal = getDpmInternal();
|
||||||
if (!hasPermissions(callingPackage,
|
if (!hasPermissions(callingPackage,
|
||||||
Manifest.permission.SUSPEND_APPS, Manifest.permission.OBSERVE_APP_USAGE)
|
Manifest.permission.SUSPEND_APPS, Manifest.permission.OBSERVE_APP_USAGE)
|
||||||
&& (dpmInternal != null && !dpmInternal.isActiveSupervisionApp(callingUid))) {
|
&& (dpmInternal == null || !dpmInternal.isActiveSupervisionApp(callingUid))) {
|
||||||
throw new SecurityException("Caller must be the active supervision app or "
|
throw new SecurityException("Caller must be the active supervision app or "
|
||||||
+ "it must have both SUSPEND_APPS and OBSERVE_APP_USAGE permissions");
|
+ "it must have both SUSPEND_APPS and OBSERVE_APP_USAGE permissions");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user