Merge "Throw when taking non-existant Uri permission." into klp-dev
This commit is contained in:
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user