OSDN Git Service

Fix permission check imposed by broadcast sender.
authorSvet Ganov <svetoslavganov@google.com>
Wed, 22 Apr 2015 09:14:47 +0000 (02:14 -0700)
committerSvet Ganov <svetoslavganov@google.com>
Wed, 22 Apr 2015 09:14:47 +0000 (02:14 -0700)
Change-Id: Id105b00aad7b369fa0337fa63753ce7ea71b3383

services/core/java/com/android/server/am/BroadcastQueue.java
services/core/java/com/android/server/pm/PermissionsState.java

index 5b5ebef..f62f08d 100644 (file)
@@ -765,7 +765,8 @@ public final class BroadcastQueue {
                 try {
                     perm = AppGlobals.getPackageManager().
                             checkPermission(r.requiredPermission,
-                                    info.activityInfo.applicationInfo.packageName, r.userId);
+                                    info.activityInfo.applicationInfo.packageName,
+                                    UserHandle.getUserId(info.activityInfo.applicationInfo.uid));
                 } catch (RemoteException e) {
                     perm = PackageManager.PERMISSION_DENIED;
                 }
index 688c035..3749957 100644 (file)
@@ -93,6 +93,9 @@ public final class PermissionsState {
      * @param other The other instance.
      */
     public void copyFrom(PermissionsState other) {
+        if (other == this) {
+            return;
+        }
         if (mPermissions != null) {
             if (other.mPermissions == null) {
                 mPermissions = null;