diff options
author | Sudheer Shanka <sudheersai@google.com> | 2015-05-20 17:11:24 +0100 |
---|---|---|
committer | Sudheer Shanka <sudheersai@google.com> | 2015-05-20 17:29:59 +0100 |
commit | 21d9ef6dc71886209965f70728b563fd7d78d6c8 (patch) | |
tree | c1203b7e111431b960387143d5a02faf7b11ee08 /services/devicepolicy/java/com/android/server | |
parent | 0bb478b7ff32ac3cd8f583f3852742e18a9c4bd6 (diff) | |
download | frameworks_base-21d9ef6dc71886209965f70728b563fd7d78d6c8.zip frameworks_base-21d9ef6dc71886209965f70728b563fd7d78d6c8.tar.gz frameworks_base-21d9ef6dc71886209965f70728b563fd7d78d6c8.tar.bz2 |
Clear caller identity before setting all the user restrictions.
Bug: 19687895
Change-Id: Ieaa1f4e5a39395f11bf4cf797332a2d9d495bc0a
Diffstat (limited to 'services/devicepolicy/java/com/android/server')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 9ad7e11..b057dd1 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -5381,20 +5381,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { ServiceManager.getService(Context.AUDIO_SERVICE)); } - if (enabled && !alreadyRestricted) { - try { - if (UserManager.DISALLOW_UNMUTE_MICROPHONE.equals(key)) { - iAudioService.setMicrophoneMute(true, who.getPackageName()); - } else if (UserManager.DISALLOW_ADJUST_VOLUME.equals(key)) { - iAudioService.setMasterMute(true, 0, who.getPackageName()); - } - } catch (RemoteException re) { - Slog.e(LOG_TAG, "Failed to talk to AudioService.", re); - } - } long id = Binder.clearCallingIdentity(); try { if (enabled && !alreadyRestricted) { + if (UserManager.DISALLOW_UNMUTE_MICROPHONE.equals(key)) { + iAudioService.setMicrophoneMute(true, mContext.getPackageName()); + } else if (UserManager.DISALLOW_ADJUST_VOLUME.equals(key)) { + iAudioService.setMasterMute(true, 0, mContext.getPackageName()); + } if (UserManager.DISALLOW_CONFIG_WIFI.equals(key)) { Settings.Secure.putIntForUser(mContext.getContentResolver(), Settings.Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0, @@ -5443,19 +5437,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { mContext.getContentResolver().notifyChange(url, null, true, userHandle); } } - } finally { - restoreCallingIdentity(id); - } - if (!enabled && alreadyRestricted) { - try { + if (!enabled && alreadyRestricted) { if (UserManager.DISALLOW_UNMUTE_MICROPHONE.equals(key)) { - iAudioService.setMicrophoneMute(false, who.getPackageName()); + iAudioService.setMicrophoneMute(false, mContext.getPackageName()); } else if (UserManager.DISALLOW_ADJUST_VOLUME.equals(key)) { - iAudioService.setMasterMute(false, 0, who.getPackageName()); + iAudioService.setMasterMute(false, 0, mContext.getPackageName()); } - } catch (RemoteException re) { - Slog.e(LOG_TAG, "Failed to talk to AudioService.", re); } + } catch (RemoteException re) { + Slog.e(LOG_TAG, "Failed to talk to AudioService.", re); + } finally { + restoreCallingIdentity(id); } sendChangedNotification(userHandle); } |