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

Commit fc5fbdd2 authored by Deqiang Chen's avatar Deqiang Chen
Browse files

Add the capability to list bluetooth HFP as emergency capable phone account

Bug: 120810747
Test: when hfp_client_connection_service_support_emergency_call is set
as true, HFP account is listed as Emergency capable in telecom.

Change-Id: If3856b97b02206311d8984eabc85bc5ba66193e1
(cherry picked from commit 5e75bb4d0378d2f7c44c5aa4283bfaeb032048a0)
parent 87d2fb7a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@
    <!-- For enabling the hfp client connection service -->
    <bool name="hfp_client_connection_service_enabled">false</bool>

    <!-- For supporting emergency call through the hfp client connection service  -->
    <bool name="hfp_client_connection_service_support_emergency_call">false</bool>

    <!-- Enabling autoconnect over pan -->
    <bool name="config_bluetooth_pan_enable_autoconnect">true</bool>

+10 −1
Original line number Diff line number Diff line
@@ -328,10 +328,19 @@ public class HfpClientConnectionService extends ConnectionService {
        PhoneAccountHandle handle =
                new PhoneAccountHandle(new ComponentName(context, HfpClientConnectionService.class),
                        device.getAddress());

        int capabilities = PhoneAccount.CAPABILITY_CALL_PROVIDER;
        if (context.getApplicationContext().getResources().getBoolean(
                com.android.bluetooth.R.bool
                .hfp_client_connection_service_support_emergency_call)) {
            // Need to have an emergency call capability to place emergency call
            capabilities |= PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
        }

        PhoneAccount account =
                new PhoneAccount.Builder(handle, "HFP " + device.toString()).setAddress(addr)
                        .setSupportedUriSchemes(Arrays.asList(PhoneAccount.SCHEME_TEL))
                        .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
                        .setCapabilities(capabilities)
                        .build();
        if (DBG) {
            Log.d(TAG, "phoneaccount: " + account);