OSDN Git Service

Allow prefix-based Uri permission grants.
authorJeff Sharkey <jsharkey@android.com>
Fri, 4 Apr 2014 19:12:41 +0000 (12:12 -0700)
committerJeff Sharkey <jsharkey@android.com>
Wed, 23 Apr 2014 04:06:49 +0000 (21:06 -0700)
commit846318a3250fa95f47a9decfbffb05a31dbd0006
treec5d28f5d77e1fd625117e65bc9d24acfdfb6b94e
parentfb5d9f338153f569775bbc76177cab05441999c1
Allow prefix-based Uri permission grants.

Define new FLAG_GRANT_PREFIX_URI_PERMISSION which indicates that a
Uri permission grant should also apply to any other Uris that have
matching scheme, authority, and path segments.  For example, a prefix
grant for /foo/ would allow /foo/bar/ but not /foo2/.

Allow persistable and prefix grants to be issued directly through
grantUriPermission().  Relaxing persistable is fine, since it still
requires the receiver to actively take the permission.

Since exact- and prefix-match grants for the same Uri can coexist,
we track them separately using a new UriGrant key.  (Consider the
case where an app separately extends READ|PREFIX and WRITE for
the same Uri: we can't let that become READ|WRITE|PREFIX.)

Fix revoke to always take away persisted permissions.  Move prefix
matching logic to Uri and add tests.  Add new flags to "am" tool, and
various internal uses around Intent and Context.  Switch some lagging
users to ArraySet.

Bug: 10607375
Change-Id: Ia8ce2b88421ff9f2fe5a979a27a026fc445d46f1
13 files changed:
api/current.txt
cmds/am/src/com/android/commands/am/Am.java
core/java/android/app/ContextImpl.java
core/java/android/content/ContentResolver.java
core/java/android/content/Context.java
core/java/android/content/Intent.java
core/java/android/net/Uri.java
core/tests/coretests/src/android/net/UriTest.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/ActivityRecord.java
services/core/java/com/android/server/am/ServiceRecord.java
services/core/java/com/android/server/am/UriPermission.java
services/core/java/com/android/server/am/UriPermissionOwner.java