diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 11a5062296543..5bb18015c8798 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -4647,6 +4647,13 @@ android:protectionLevel="normal" /> + + + + diff --git a/services/core/java/com/android/server/DropBoxManagerService.java b/services/core/java/com/android/server/DropBoxManagerService.java index aeb3e7fd94de5..7365e78c707fb 100644 --- a/services/core/java/com/android/server/DropBoxManagerService.java +++ b/services/core/java/com/android/server/DropBoxManagerService.java @@ -23,6 +23,7 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.ContentObserver; import android.net.Uri; @@ -464,6 +465,14 @@ public final class DropBoxManagerService extends SystemService { } private boolean checkPermission(int callingUid, String callingPackage) { + // If callers have this permission, then we don't need to check + // USAGE_STATS, because they are part of the system and have agreed to + // check USAGE_STATS before passing the data along. + if (getContext().checkCallingPermission(android.Manifest.permission.PEEK_DROPBOX_DATA) + == PackageManager.PERMISSION_GRANTED) { + return true; + } + // Callers always need this permission getContext().enforceCallingOrSelfPermission( android.Manifest.permission.READ_LOGS, TAG);