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

Commit f512ed51 authored by Ugo Yu's avatar Ugo Yu Committed by Cherrypicker Worker
Browse files

Disable in-band ringtone if HFP and HFPC are both connected

If both HFP and HFPC are connected, the in-band ringtone would occupy
the SCO connection when ringing, and make it problematic for the
remote AG device to route audio to us.

Cherry picked from wear to reduce code divergence

Bug: 263323082
Bug: 219801406
Tag: #stability
Test: manual
Change-Id: I2ccebeae70edf8e32f50a4caca30c066139f9a6b
(cherry picked from commit 56e615ae)
Merged-In: I2ccebeae70edf8e32f50a4caca30c066139f9a6b
parent d7ffa0a3
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import com.android.bluetooth.btservice.MetricsLogger;
import com.android.bluetooth.btservice.ProfileService;
import com.android.bluetooth.btservice.ServiceFactory;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.hfpclient.HeadsetClientService;
import com.android.bluetooth.le_audio.LeAudioService;
import com.android.bluetooth.telephony.BluetoothInCallService;
import com.android.internal.annotations.VisibleForTesting;
@@ -1992,7 +1993,16 @@ public class HeadsetService extends ProfileService {
        return isInbandRingingSupported && !SystemProperties.getBoolean(
                DISABLE_INBAND_RINGING_PROPERTY, false)
                && !mInbandRingingRuntimeDisable
                && inbandRingtoneAllowedByPolicy;
                && inbandRingtoneAllowedByPolicy
                && !isHeadsetClientConnected();
    }

    private boolean isHeadsetClientConnected() {
        HeadsetClientService headsetClientService = HeadsetClientService.getHeadsetClientService();
        if (headsetClientService == null) {
            return false;
        }
        return !(headsetClientService.getConnectedDevices().isEmpty());
    }

    /**