Switch to proxy variants of app-ops calls.
Jeff Sharkey [Fri, 24 Jul 2015 22:22:54 +0000 (15:22 -0700)]
Bug: 22718722
Change-Id: I9c054956c3b3655332475607d6919dc34515e550

src/com/android/providers/downloads/DownloadProvider.java

index b080d70..94e5a99 100644 (file)
@@ -563,7 +563,7 @@ public final class DownloadProvider extends ContentProvider {
                         "No permission to write");
 
                 final AppOpsManager appOps = getContext().getSystemService(AppOpsManager.class);
-                if (appOps.noteOp(AppOpsManager.OP_WRITE_EXTERNAL_STORAGE, Binder.getCallingUid(),
+                if (appOps.noteProxyOp(AppOpsManager.OP_WRITE_EXTERNAL_STORAGE,
                         getCallingPackage()) != AppOpsManager.MODE_ALLOWED) {
                     throw new SecurityException("No permission to write");
                 }
@@ -726,7 +726,7 @@ public final class DownloadProvider extends ContentProvider {
                     "No permission to write to " + file);
 
             final AppOpsManager appOps = getContext().getSystemService(AppOpsManager.class);
-            if (appOps.noteOp(AppOpsManager.OP_WRITE_EXTERNAL_STORAGE, Binder.getCallingUid(),
+            if (appOps.noteProxyOp(AppOpsManager.OP_WRITE_EXTERNAL_STORAGE,
                     getCallingPackage()) != AppOpsManager.MODE_ALLOWED) {
                 throw new SecurityException("No permission to write to " + file);
             }