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

Commit 49d7e22a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Enable HFP Hf for all targets and fix HeadsetClientStateMachineTest"...

Merge "Enable HFP Hf for all targets and fix HeadsetClientStateMachineTest" am: e873b8b9 am: 8e5dcfe9 am: e1961f61

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2296620



Change-Id: I88c32984c0773788a27f407a2419137291c4e855
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a6047d88 e1961f61
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -26,8 +26,10 @@
    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <option name="run-command" value="settings put global ble_scan_always_enabled 0" />
        <option name="run-command" value="su u$(am get-current-user)_system svc bluetooth disable" />
        <option name="run-command" value="setprop bluetooth.profile.hfp.hf.enabled true" />
        <option name="teardown-command" value="su u$(am get-current-user)_system svc bluetooth enable" />
        <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" />
        <option name="teardown-command" value="setprop bluetooth.profile.hfp.hf.enabled false" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.FolderSaver">
        <option name="device-path" value="/data/vendor/ssrdump" />
+8 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.bluetooth.R;
import com.android.bluetooth.TestUtils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;

import org.hamcrest.core.AllOf;
import org.hamcrest.core.IsInstanceOf;
@@ -54,6 +55,8 @@ public class HeadsetClientStateMachineTest {
    private BluetoothDevice mTestDevice;
    private Context mTargetContext;

    @Mock
    private AdapterService mAdapterService;
    @Mock
    private Resources mMockHfpResources;
    @Mock
@@ -69,7 +72,7 @@ public class HeadsetClientStateMachineTest {
            * 3 / 2;

    @Before
    public void setUp() {
    public void setUp() throws Exception {
        mTargetContext = InstrumentationRegistry.getTargetContext();
        Assume.assumeTrue("Ignore test when HeadsetClientService is not enabled",
                HeadsetClientService.isEnabled());
@@ -85,6 +88,8 @@ public class HeadsetClientStateMachineTest {
        when(mMockHfpResources.getBoolean(R.bool.hfp_clcc_poll_during_call)).thenReturn(true);
        when(mMockHfpResources.getInteger(R.integer.hfp_clcc_poll_interval_during_call))
                .thenReturn(2000);

        TestUtils.setAdapterService(mAdapterService);
        mNativeInterface = spy(NativeInterface.getInstance());

        // This line must be called to make sure relevant objects are initialized properly
@@ -104,11 +109,12 @@ public class HeadsetClientStateMachineTest {
    }

    @After
    public void tearDown() {
    public void tearDown() throws Exception {
        if (!HeadsetClientService.isEnabled()) {
            return;
        }
        TestUtils.waitForLooperToFinishScheduledTask(mHandlerThread.getLooper());
        TestUtils.clearAdapterService(mAdapterService);
        mHeadsetClientStateMachine.doQuit();
        mHandlerThread.quit();
    }