Merge "Add role-only GET_HISTORICAL_APP_OPS_STATS permission"
This commit is contained in:
@@ -107,6 +107,7 @@ package android {
|
||||
field public static final String FORCE_BACK = "android.permission.FORCE_BACK";
|
||||
field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
|
||||
field public static final String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
|
||||
field public static final String GET_HISTORICAL_APP_OPS_STATS = "android.permission.GET_HISTORICAL_APP_OPS_STATS";
|
||||
field public static final String GET_PROCESS_STATE_AND_OOM_SCORE = "android.permission.GET_PROCESS_STATE_AND_OOM_SCORE";
|
||||
field public static final String GET_RUNTIME_PERMISSIONS = "android.permission.GET_RUNTIME_PERMISSIONS";
|
||||
field public static final String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO";
|
||||
|
||||
@@ -3578,6 +3578,13 @@
|
||||
<permission android:name="android.permission.GET_APP_OPS_STATS"
|
||||
android:protectionLevel="signature|privileged|development" />
|
||||
|
||||
<!-- @SystemApi @hide Allows an application to collect historical application operation
|
||||
statistics.
|
||||
<p>Not for use by third party applications.
|
||||
-->
|
||||
<permission android:name="android.permission.GET_HISTORICAL_APP_OPS_STATS"
|
||||
android:protectionLevel="internal|role" />
|
||||
|
||||
<!-- @SystemApi Allows an application to update application operation statistics. Not for
|
||||
use by third party apps.
|
||||
@hide -->
|
||||
|
||||
@@ -2375,7 +2375,13 @@ public class AppOpsService extends IAppOpsService.Stub {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isCallerSystem && !isCallerInstrumented && !isCallerPermissionController) {
|
||||
boolean doesCallerHavePermission = mContext.checkPermission(
|
||||
android.Manifest.permission.GET_HISTORICAL_APP_OPS_STATS,
|
||||
Binder.getCallingPid(), Binder.getCallingUid())
|
||||
== PackageManager.PERMISSION_GRANTED;
|
||||
|
||||
if (!isCallerSystem && !isCallerInstrumented && !isCallerPermissionController
|
||||
&& !doesCallerHavePermission) {
|
||||
mHandler.post(() -> callback.sendResult(new Bundle()));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user