Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 056e1d77 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android Git Automerger
Browse files

am 81c73e12: Merge "Clear caller identity before setting all the user restrictions." into mnc-dev

* commit '81c73e12':
  Clear caller identity before setting all the user restrictions.
parents 83d9c9fd 81c73e12
Loading
Loading
Loading
Loading
+12 −20
Original line number Diff line number Diff line
@@ -5381,20 +5381,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                        ServiceManager.getService(Context.AUDIO_SERVICE));
            }

            if (enabled && !alreadyRestricted) {
            long id = Binder.clearCallingIdentity();
            try {
                if (enabled && !alreadyRestricted) {
                    if (UserManager.DISALLOW_UNMUTE_MICROPHONE.equals(key)) {
                        iAudioService.setMicrophoneMute(true, who.getPackageName());
                        iAudioService.setMicrophoneMute(true, mContext.getPackageName());
                    } else if (UserManager.DISALLOW_ADJUST_VOLUME.equals(key)) {
                        iAudioService.setMasterMute(true, 0, who.getPackageName());
                        iAudioService.setMasterMute(true, 0, mContext.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_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 (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);
                }
            } finally {
                restoreCallingIdentity(id);
            }
            sendChangedNotification(userHandle);
        }