summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-07-17 15:12:39 -0700
committerJeff Sharkey <jsharkey@android.com>2015-07-17 16:21:43 -0700
commitb3cf95334551e55e068bf6f9d7640681cdc05e07 (patch)
tree93288d44940b946cea893f0d4d0acb3f7a2e8f7a /services
parentf80b52b08aff0fe4c5a5fdc710aa5976c7b25699 (diff)
downloadframeworks_base-b3cf95334551e55e068bf6f9d7640681cdc05e07.zip
frameworks_base-b3cf95334551e55e068bf6f9d7640681cdc05e07.tar.gz
frameworks_base-b3cf95334551e55e068bf6f9d7640681cdc05e07.tar.bz2
Clear identity when killing media provider.
Otherwise various shell "sm" commands fail because they don't hold the right permissions. Bug: 22564405 Change-Id: I88081e8a9b27ee43904d3ea6f745aba3af4e2150
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/MountService.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index 0e158a2..92b98a7 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -740,15 +740,20 @@ class MountService extends IMountService.Stub
*/
@Deprecated
private void killMediaProvider() {
- final ProviderInfo provider = mPms.resolveContentProvider(MediaStore.AUTHORITY, 0,
- UserHandle.USER_OWNER);
- if (provider != null) {
- final IActivityManager am = ActivityManagerNative.getDefault();
- try {
- am.killApplicationWithAppId(provider.applicationInfo.packageName,
- UserHandle.getAppId(provider.applicationInfo.uid), "vold reset");
- } catch (RemoteException e) {
+ final long token = Binder.clearCallingIdentity();
+ try {
+ final ProviderInfo provider = mPms.resolveContentProvider(MediaStore.AUTHORITY, 0,
+ UserHandle.USER_OWNER);
+ if (provider != null) {
+ final IActivityManager am = ActivityManagerNative.getDefault();
+ try {
+ am.killApplicationWithAppId(provider.applicationInfo.packageName,
+ UserHandle.getAppId(provider.applicationInfo.uid), "vold reset");
+ } catch (RemoteException e) {
+ }
}
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
}