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

Commit dc1d17a1 authored by Eric Laurent's avatar Eric Laurent
Browse files

Fix issue android.permission.cts.NoAudioPermissionTest:testRouting is failing.

Add audio permission checks in setSpeakerphoneOn() and setBluetoothScoOn() methods.
parent 6ba23c59
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -758,6 +758,9 @@ public class AudioService extends IAudioService.Stub {

    /** @see AudioManager#setSpeakerphoneOn() */
    public void setSpeakerphoneOn(boolean on){
        if (!checkAudioSettingsPermission("setSpeakerphoneOn()")) {
            return;
        }
        if (on) {
            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_SPEAKER);
            mForcedUseForComm = AudioSystem.FORCE_SPEAKER;
@@ -778,6 +781,9 @@ public class AudioService extends IAudioService.Stub {

    /** @see AudioManager#setBluetoothScoOn() */
    public void setBluetoothScoOn(boolean on){
        if (!checkAudioSettingsPermission("setBluetoothScoOn()")) {
            return;
        }
        if (on) {
            AudioSystem.setForceUse(AudioSystem.FOR_COMMUNICATION, AudioSystem.FORCE_BT_SCO);
            AudioSystem.setForceUse(AudioSystem.FOR_RECORD, AudioSystem.FORCE_BT_SCO);