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

Commit 01a8d9d8 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

setWiredDeviceConnectionState requires MODIFY_AUDIO_ROUTING

AudioService: make setWiredDeviceConnectionState enforce the
privileged MODIFY_AUDIO_ROUTING permission

Bug: 151240738
Test: verify plug/unplug headset is WAI
Change-Id: Icde5c2fdfa970baf596d00f808dca8300be8743f
parent e8640349
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4213,6 +4213,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 {
+1 −0
Original line number Diff line number Diff line
@@ -4318,6 +4318,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);