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

Commit 9e163431 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "HAP: offer a way to disable leaudio on some device" into main

parents 891fea72 62c77931
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -281,16 +281,23 @@ public class PhonePolicy implements AdapterService.BluetoothStateCallback {
        return isLeAudioOnlyGroup(device);
    }

    private static final String SYSPROP_HAP_ENABLED = "bluetooth.profile.hap.enabled_by_default";

    // return true if device support Hearing Access Service and it has not been manually disabled
    private boolean shouldEnableHapByDefault(BluetoothDevice device, ParcelUuid[] uuids) {
        if (!Flags.enableHapByDefault()) {
            Log.i(TAG, "shouldDefaultToHap: Flag enableHapByDefault is disabled");
            Log.i(TAG, "shouldEnableHapByDefault: Flag is disabled");
            return false;
        }

        HapClientService hap = mFactory.getHapClientService();
        if (hap == null) {
            Log.e(TAG, "shouldDefaultToHap: HapClient is null");
            Log.e(TAG, "shouldEnableHapByDefault: No HapClientService");
            return false;
        }

        if (!SystemProperties.getBoolean(SYSPROP_HAP_ENABLED, true)) {
            Log.i(TAG, "shouldEnableHapByDefault: SystemProperty is overridden to false");
            return false;
        }