summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java32
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);
}