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

Commit 9d0c0849 authored by Stanley Tng's avatar Stanley Tng
Browse files

Change the configuration enable for Hearing Aids Profile

As part of adding isHearingAidsProfileSupported method to
BluetoothAdapter, the configuration for Hearing Aids
Profile is moved from the packages/apps/Bluetooth to the frameworks/base
repo so that it is not dependent on the BT enable state.

Test: Manual testing with configuration enabled and disabled.
Bug: 119617521
Change-Id: I13e30dab9df249d335fa15afae6f87bde3ecc1e4
parent 55083170
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
    <bool name="profile_supported_pbapclient">false</bool>
    <bool name="profile_supported_mapmce">false</bool>
    <bool name="profile_supported_hid_device">true</bool>
    <bool name="profile_supported_hearing_aid">true</bool>

    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
+2 −1
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ public class Config {
                    (1 << BluetoothProfile.OPP)),
            new ProfileConfig(BluetoothPbapService.class, R.bool.profile_supported_pbap,
                    (1 << BluetoothProfile.PBAP)),
            new ProfileConfig(HearingAidService.class, R.bool.profile_supported_hearing_aid,
            new ProfileConfig(HearingAidService.class,
                    com.android.internal.R.bool.config_hearing_aid_profile_supported,
                    (1 << BluetoothProfile.HEARING_AID))
    };

+8 −4
Original line number Diff line number Diff line
@@ -216,7 +216,8 @@ public class ActiveDeviceManagerTest {
    @Test
    public void hearingAidActive_clearA2dpAndHeadsetActive() {
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_hearing_aid_profile_supported));

        a2dpConnected(mA2dpHeadsetDevice);
        headsetConnected(mA2dpHeadsetDevice);
@@ -234,7 +235,8 @@ public class ActiveDeviceManagerTest {
    @Test
    public void hearingAidActive_dontSetA2dpAndHeadsetActive() {
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_hearing_aid_profile_supported));

        hearingAidActiveDeviceChanged(mHearingAidDevice);
        a2dpConnected(mA2dpHeadsetDevice);
@@ -251,7 +253,8 @@ public class ActiveDeviceManagerTest {
    @Test
    public void hearingAidActive_setA2dpActiveExplicitly() {
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_hearing_aid_profile_supported));

        hearingAidActiveDeviceChanged(mHearingAidDevice);
        a2dpConnected(mA2dpHeadsetDevice);
@@ -271,7 +274,8 @@ public class ActiveDeviceManagerTest {
    @Test
    public void hearingAidActive_setHeadsetActiveExplicitly() {
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_hearing_aid_profile_supported));

        hearingAidActiveDeviceChanged(mHearingAidDevice);
        headsetConnected(mA2dpHeadsetDevice);
+5 −3
Original line number Diff line number Diff line
@@ -35,10 +35,10 @@ import android.support.test.filters.MediumTest;
import android.support.test.rule.ServiceTestRule;
import android.support.test.runner.AndroidJUnit4;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.DatabaseManager;
import com.android.internal.R;

import org.junit.After;
import org.junit.Assert;
@@ -80,7 +80,8 @@ public class HearingAidServiceTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mTargetContext.getResources().getBoolean(
                    R.bool.config_hearing_aid_profile_supported));
        // Set up mocks and test assets
        MockitoAnnotations.initMocks(this);

@@ -121,7 +122,8 @@ public class HearingAidServiceTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid)) {
        if (!mTargetContext.getResources().getBoolean(
                            R.bool.config_hearing_aid_profile_supported)) {
            return;
        }
        stopService();
+5 −3
Original line number Diff line number Diff line
@@ -28,9 +28,9 @@ import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4;

import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.internal.R;

import org.hamcrest.core.IsInstanceOf;
import org.junit.After;
@@ -61,7 +61,8 @@ public class HearingAidStateMachineTest {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when HearingAidService is not enabled",
                mTargetContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid));
                mTargetContext.getResources().getBoolean(
                    R.bool.config_hearing_aid_profile_supported));
        // Set up mocks and test assets
        MockitoAnnotations.initMocks(this);
        TestUtils.setAdapterService(mAdapterService);
@@ -83,7 +84,8 @@ public class HearingAidStateMachineTest {

    @After
    public void tearDown() throws Exception {
        if (!mTargetContext.getResources().getBoolean(R.bool.profile_supported_hearing_aid)) {
        if (!mTargetContext.getResources().getBoolean(
                            R.bool.config_hearing_aid_profile_supported)) {
            return;
        }
        mHearingAidStateMachine.doQuit();