diff options
| author | 2012-08-29 22:29:43 -0700 | |
|---|---|---|
| committer | 2012-08-29 22:29:43 -0700 | |
| commit | a99e4caa94ed3261d11c650e778c7c9b26b3e590 (patch) | |
| tree | 41c124086db076ee20e7aa468d7e2d3e6424d3ff /services/java | |
| parent | 7808581ca3b462fb187aed6b0d1b86fb83a8a215 (diff) | |
| parent | 35744c19f6b4e2fc8bbd6fe2c82cea7a76818dfd (diff) | |
Merge "Bind to screenshot service for current user." into jb-mr1-dev
Diffstat (limited to 'services/java')
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index d8c8dfa61a36..20be15ea775d 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -10742,7 +10742,25 @@ public final class ActivityManagerService extends ActivityManagerNative throw new IllegalArgumentException("File descriptors passed in Intent"); } - checkValidCaller(Binder.getCallingUid(), userId); + if (userId != UserHandle.getCallingUserId()) { + // Requesting a different user, make sure that they have permission + if (checkComponentPermission( + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, + Binder.getCallingPid(), Binder.getCallingUid(), -1, true) + == PackageManager.PERMISSION_GRANTED) { + // Translate to the current user id, if caller wasn't aware + if (userId == UserHandle.USER_CURRENT) { + userId = mCurrentUserId; + } + } else { + String msg = "Permission Denial: Request to bindService as user " + userId + + " but is calling from user " + UserHandle.getCallingUserId() + + "; this requires " + + android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; + Slog.w(TAG, msg); + throw new SecurityException(msg); + } + } synchronized(this) { return mServices.bindServiceLocked(caller, token, service, resolvedType, |