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

Commit 5fa3eb91 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Android (Google) Code Review
Browse files

Merge "Added some optimizations to Bluetooth APK" into tm-dev

parents eb08226e d8841535
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -142,7 +142,10 @@ android_app {
    javacflags: ["-Aroom.schemaLocation=packages/modules/Bluetooth/android/app/tests/unit/src/com/android/bluetooth/btservice/storage/schemas"],

    optimize: {
        enabled: false,
        enabled: true,
        shrink: true,
        optimize: false,
        proguard_flags_files: ["proguard.flags"],
    },
    required: [
        "android.hardware.bluetooth@1.0",
+7 −0
Original line number Diff line number Diff line
-allowaccessmodification
-keep,allowoptimization,allowaccessmodification class com.android.bluetooth.** { *; }

# Required to support APIs only referenced indirectly via tests.
-keep class android.support.v4.media.MediaMetadataCompat { *; }
-keep class android.support.v4.media.MediaBrowserCompat$MediaItem { *; }
-keep class android.support.v4.media.MediaDescriptionCompat { *; }
+21 −0
Original line number Diff line number Diff line
@@ -657,6 +657,9 @@ public class HapClientTest {
        doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));

        doCallRealMethod()
                .when(mNativeInterface)
                .onDeviceAvailable(any(byte[].class), anyInt());
        mNativeInterface.onDeviceAvailable(getByteAddress(mDevice), 0x03);

        Intent intent = TestUtils.waitForIntent(TIMEOUT_MS, mIntentQueue.get(mDevice));
@@ -675,6 +678,9 @@ public class HapClientTest {
        doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));

        doCallRealMethod()
                .when(mNativeInterface)
                .onActivePresetSelected(any(byte[].class), anyInt());
        mNativeInterface.onActivePresetSelected(getByteAddress(mDevice), 0x01);

        try {
@@ -696,6 +702,10 @@ public class HapClientTest {
        doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));


        doCallRealMethod()
                .when(mNativeInterface)
                .onActivePresetSelectError(any(byte[].class), anyInt());
        /* Send INVALID_PRESET_INDEX error */
        mNativeInterface.onActivePresetSelectError(getByteAddress(mDevice), 0x05);

@@ -724,6 +734,10 @@ public class HapClientTest {
                        .setWritable(true)
                        .setAvailable(false)
                        .build()};

        doCallRealMethod()
                .when(mNativeInterface)
                .onPresetInfo(any(byte[].class), anyInt(), any());
        mNativeInterface.onPresetInfo(getByteAddress(mDevice), info_reason, info);

        ArgumentCaptor<List<BluetoothHapPresetInfo>> presetsCaptor =
@@ -755,6 +769,9 @@ public class HapClientTest {
        doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));

        doCallRealMethod()
                .when(mNativeInterface)
                .onPresetNameSetError(any(byte[].class), anyInt(), anyInt());
        /* Not a valid name length */
        mNativeInterface.onPresetNameSetError(getByteAddress(mDevice), 0x01,
                HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH);
@@ -814,6 +831,10 @@ public class HapClientTest {
        doReturn(new ParcelUuid[]{BluetoothUuid.HAS}).when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));

        doCallRealMethod()
                .when(mNativeInterface)
                .onGroupPresetNameSetError(anyInt(), anyInt(), anyInt());

        /* Not a valid name length */
        mNativeInterface.onGroupPresetNameSetError(0x01, 0x01,
                HapClientStackEvent.STATUS_INVALID_PRESET_NAME_LENGTH);
+4 −2
Original line number Diff line number Diff line
@@ -18,8 +18,7 @@ package com.android.bluetooth.hfpclient;

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

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

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -147,6 +146,9 @@ public class HfpClientDeviceBlockTest {

    private HfpClientConnection createOutgoingConnectionWithScoState(int scoState) {
        when(mHeadsetClientService.getAudioState(mBluetoothDevice)).thenReturn(scoState);
        doCallRealMethod()
                .when(mConnServ)
                .createAccount(any());
        mHfpClientDeviceBlock =
                new HfpClientDeviceBlock(mBluetoothDevice, mConnServ, mMockServiceInterface);
        return mHfpClientDeviceBlock.onCreateOutgoingConnection(