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

Commit 80bec753 authored by Jack He's avatar Jack He
Browse files

ASHA: Enable ASHA by default if sysprop is not set

* Also disables ASHA if BLE is not supported

Bug: 276387432
Test: atest CtsBluetoothTestCases:android.bluetooth.cts.BluetoothCddTest#test_C_3_BleRequirements
Change-Id: If9b9b9026b4285b12633113d69da3fd20b43a326
parent 52e7d78e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.bluetooth.btservice;

import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.SystemProperties;
import android.util.Log;
@@ -193,6 +194,11 @@ public class Config {
            }
        }

        // Disable ASHA if BLE is not supported on this platform
        if (!ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
            setProfileEnabled(HearingAidService.class, false);
        }

        ArrayList<Class> profiles = new ArrayList<>(PROFILE_SERVICES_AND_FLAGS.length);
        for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
            Log.i(TAG, "init: profile=" + config.mClass.getSimpleName() + ", enabled="
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ public class HearingAidService extends ProfileService {
    private final ServiceFactory mFactory = new ServiceFactory();

    public static boolean isEnabled() {
        return BluetoothProperties.isProfileAshaCentralEnabled().orElse(false);
        return BluetoothProperties.isProfileAshaCentralEnabled().orElse(true);
    }

    @Override
+5 −1
Original line number Diff line number Diff line
@@ -601,8 +601,12 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {

        mBluetoothNotificationManager = new BluetoothNotificationManager(mContext);

        // Disable ASHA if BLE is not supported on this platform
        mIsHearingAidProfileSupported =
                BluetoothProperties.isProfileAshaCentralEnabled().orElse(false);
                BluetoothProperties.isProfileAshaCentralEnabled().orElse(true);
        if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
            mIsHearingAidProfileSupported = false;
        }

        String value = SystemProperties.get(
                "persist.sys.fflag.override.settings_bluetooth_hearing_aid");