Merge "Clear identity when killing media provider." into mnc-dev

This commit is contained in:
Jeff Sharkey
2015-07-17 23:29:51 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}