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

Commit 90fa6840 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix crash in setAudioRouteAllowed"

parents 655d637c a3d36596
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -275,6 +275,10 @@ public class NativeInterface {
     */
    @VisibleForTesting
    public boolean sendAndroidAt(BluetoothDevice device, String cmd) {
        if (device == null) {
            Log.w(TAG, "Don't need to send " + cmd + " because no remote device");
            return false;
        }
        return sendAndroidAtNative(getByteAddress(device), cmd);
    }

+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.bluetooth.hfpclient;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.Mockito.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -308,4 +309,10 @@ public class HfpNativeInterfaceTest {
        assertThat(event.getValue().type).isEqualTo(StackEvent.EVENT_TYPE_UNKNOWN_EVENT);
        assertThat(event.getValue().valueString).isEqualTo(eventString);
    }

    @Test
    public void testSendAndroidAt() {
        // If the device is null, should return False
        assertThat(mNativeInterface.sendAndroidAt(null, anyString())).isEqualTo(false);
    }
}