Merge "setWiredDeviceConnectionState requires MODIFY_AUDIO_ROUTING" into rvc-dev

This commit is contained in:
Jean-Michel Trivi
2020-03-24 23:44:43 +00:00
committed by Android (Google) Code Review
2 changed files with 2 additions and 0 deletions

View File

@@ -4579,6 +4579,7 @@ public class AudioManager {
* {@hide}
*/
@UnsupportedAppUsage
@RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
public void setWiredDeviceConnectionState(int type, int state, String address, String name) {
final IAudioService service = getService();
try {

View File

@@ -4570,6 +4570,7 @@ public class AudioService extends IAudioService.Stub
public void setWiredDeviceConnectionState(int type,
@ConnectionState int state, String address, String name,
String caller) {
enforceModifyAudioRoutingPermission();
if (state != CONNECTION_STATE_CONNECTED
&& state != CONNECTION_STATE_DISCONNECTED) {
throw new IllegalArgumentException("Invalid state " + state);