Clear calling identify when persisting volume behavior

External callers won't have required permissions to persist the
Settings.

Bug: 159994127
Test: manaul
Change-Id: I7d5b01467052ad06e2204b96430def9fc9f939c6
This commit is contained in:
Marvin Ramin
2020-06-26 18:22:35 +02:00
parent 939ec99700
commit 8accebf973

View File

@@ -9002,10 +9002,15 @@ public class AudioService extends IAudioService.Stub
if (DEBUG_VOL) {
Log.d(TAG, "Persisting Volume Behavior for DeviceType: " + deviceType);
}
System.putIntForUser(mContentResolver,
getSettingsNameForDeviceVolumeBehavior(deviceType),
deviceVolumeBehavior,
UserHandle.USER_CURRENT);
long callingIdentity = Binder.clearCallingIdentity();
try {
System.putIntForUser(mContentResolver,
getSettingsNameForDeviceVolumeBehavior(deviceType),
deviceVolumeBehavior,
UserHandle.USER_CURRENT);
} finally {
Binder.restoreCallingIdentity(callingIdentity);
}
}
@AudioManager.DeviceVolumeBehaviorState