diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-10-14 17:24:14 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-14 17:24:14 +0000 |
commit | b5da7b23df5278a5e722b601eb8ef7e98537a51e (patch) | |
tree | 803850124d61c4b532fb61ed763bfee003743711 /services/java/com/android/server/am | |
parent | 774e8ad88331f82994e38d721418da556ce9edea (diff) | |
parent | 582f7124061f455ca521987e566fdd651a5bb9e3 (diff) | |
download | frameworks_base-b5da7b23df5278a5e722b601eb8ef7e98537a51e.zip frameworks_base-b5da7b23df5278a5e722b601eb8ef7e98537a51e.tar.gz frameworks_base-b5da7b23df5278a5e722b601eb8ef7e98537a51e.tar.bz2 |
Merge "Throw when taking non-existant Uri permission." into klp-dev
Diffstat (limited to 'services/java/com/android/server/am')
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 5 | ||||
-rw-r--r-- | services/java/com/android/server/am/UriPermission.java | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index a510c64..f1c2025 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -6413,9 +6413,8 @@ public final class ActivityManagerService extends ActivityManagerNative final int callingUid = Binder.getCallingUid(); final UriPermission perm = findUriPermissionLocked(callingUid, uri); if (perm == null) { - Slog.w(TAG, "No permission grant found for UID " + callingUid + " and Uri " - + uri.toSafeString()); - return; + throw new SecurityException("No permission grant found for UID " + callingUid + + " and Uri " + uri.toSafeString()); } boolean persistChanged = perm.takePersistableModes(modeFlags); diff --git a/services/java/com/android/server/am/UriPermission.java b/services/java/com/android/server/am/UriPermission.java index 684f247..1f12b74 100644 --- a/services/java/com/android/server/am/UriPermission.java +++ b/services/java/com/android/server/am/UriPermission.java @@ -21,7 +21,6 @@ import android.net.Uri; import android.os.UserHandle; import android.util.Log; -import com.android.internal.util.Preconditions; import com.google.android.collect.Sets; import java.io.PrintWriter; @@ -131,7 +130,11 @@ final class UriPermission { * @return if mode changes should trigger persisting. */ boolean takePersistableModes(int modeFlags) { - Preconditions.checkFlagsArgument(modeFlags, persistableModeFlags); + if ((modeFlags & persistableModeFlags) != modeFlags) { + throw new SecurityException("Requested flags 0x" + + Integer.toHexString(modeFlags) + ", but only 0x" + + Integer.toHexString(persistableModeFlags) + " are allowed"); + } final int before = persistedModeFlags; persistedModeFlags |= (persistableModeFlags & modeFlags); |