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

Commit 9c8ec3b3 authored by Sal Savage's avatar Sal Savage Committed by Gerrit Code Review
Browse files

Merge changes I5b562230,Ic88e60b8 into main

* changes:
  Remove flag "randomize_device_level_media_ids"
  Flags: Add PBAP Client storage and caching flags
parents 05e84282 06c98fdc
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -77,15 +77,6 @@ public class BrowseTree {
                                    .setBrowsable(true)
                                    .build());
            mRootNode.setCached(true);
        } else if (!Flags.randomizeDeviceLevelMediaIds()) {
            mRootNode =
                    new BrowseNode(
                            new AvrcpItem.Builder()
                                    .setDevice(device)
                                    .setUuid(ROOT + device.getAddress().toString())
                                    .setTitle(Utils.getName(device))
                                    .setBrowsable(true)
                                    .build());
        } else {
            mRootNode =
                    new BrowseNode(
@@ -184,11 +175,7 @@ public class BrowseTree {
        BrowseNode(BluetoothDevice device) {
            AvrcpItem.Builder aid = new AvrcpItem.Builder();
            aid.setDevice(device);
            if (Flags.randomizeDeviceLevelMediaIds()) {
            aid.setUuid(ROOT + device.getAddress().toString() + UUID.randomUUID().toString());
            } else {
                aid.setUuid(PLAYER_PREFIX + device.getAddress().toString());
            }
            aid.setDisplayableName(Utils.getName(device));
            aid.setTitle(Utils.getName(device));
            aid.setBrowsable(true);
+0 −6
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.support.v4.media.session.PlaybackStateCompat;

import androidx.test.InstrumentationRegistry;
@@ -44,7 +42,6 @@ import com.android.bluetooth.TestUtils;
import com.android.bluetooth.a2dpsink.A2dpSinkService;
import com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService.BrowseResult;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.flags.Flags;

import org.junit.After;
import org.junit.Before;
@@ -69,8 +66,6 @@ public class AvrcpControllerServiceTest {
    private AvrcpControllerService mService = null;
    private BluetoothAdapter mAdapter = null;

    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    @Rule
    public final ServiceTestRule mBluetoothBrowserMediaServiceTestRule = new ServiceTestRule();

@@ -516,7 +511,6 @@ public class AvrcpControllerServiceTest {
     * first device by checking that it has remained as the active device.
     */
    @Test
    @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void testActiveDeviceMaintainsAudioFocusWhenOtherDeviceConnects_audioFocusMaintained() {
        mService.onConnectionStateChanged(true, true, mRemoteDevice);
        // check set active device is called
+1 −16
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.content.res.Resources;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Looper;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.support.v4.media.MediaMetadataCompat;
@@ -467,21 +466,7 @@ public class AvrcpControllerStateMachineTest {

    /** Get the root of the device */
    @Test
    @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void testGetDeviceRootNode_flagRandomDeviceIdDisabled_rootNodeMatchesUuidFormat() {
        // create new state machine to follow current flags rule
        mAvrcpStateMachine = makeStateMachine(mTestDevice);
        setUpConnectedState(true, true);
        final String rootName = "__ROOT__" + mTestDevice.getAddress().toString();
        // Get the root of the device
        BrowseTree.BrowseNode results = mAvrcpStateMachine.findNode(rootName);
        Assert.assertEquals(rootName, results.getID());
    }

    /** Get the root of the device */
    @Test
    @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void testGetDeviceRootNode_flagRandomDeviceIdEnabled_rootNodeMatchesUuidFormat() {
    public void testGetDeviceRootNode_rootNodeMatchesUuidFormat() {
        // create new state machine to follow current flags rule
        mAvrcpStateMachine = makeStateMachine(mTestDevice);
        setUpConnectedState(true, true);
+1 −14
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.google.common.truth.Truth.assertThat;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;

@@ -80,19 +79,7 @@ public class BrowseNodeTest {
    }

    @Test
    @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void constructor_withBluetoothDevice() {
        BrowseNode browseNode = mBrowseTree.new BrowseNode(mTestDevice);

        assertThat(browseNode.getID()).isNotNull();
        assertThat(browseNode.getDevice()).isEqualTo(mTestDevice);
        assertThat(browseNode.isPlayer()).isFalse();
        assertThat(browseNode.isBrowsable()).isTrue();
    }

    @Test
    @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void constructor_withBluetoothDevice_withRandomUuid() {
    public void constructor_withBluetoothDevice_createsRandomUuid() {
        BrowseNode browseNode1 = mBrowseTree.new BrowseNode(mTestDevice);

        assertThat(browseNode1.getID()).isNotNull();
+1 −18
Original line number Diff line number Diff line
@@ -20,15 +20,10 @@ import static com.google.common.truth.Truth.assertThat;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;

import com.android.bluetooth.avrcpcontroller.BrowseTree.BrowseNode;
import com.android.bluetooth.flags.Flags;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import java.util.Set;
@@ -38,8 +33,6 @@ public class BrowseTreeTest {
    private static final String TEST_HANDLE = "test_handle";
    private static final String TEST_NODE_ID = "test_node_id";

    @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();

    private final byte[] mTestAddress = new byte[] {01, 01, 01, 01, 01, 01};
    private BluetoothAdapter mAdapter;
    private BluetoothDevice mTestDevice = null;
@@ -102,7 +95,6 @@ public class BrowseTreeTest {
    }

    @Test
    @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void sameDeviceDifferentBrowseTrees_uniqueMediaIds() {
        BrowseTree browseTree1 = new BrowseTree(mTestDevice);
        BrowseTree browseTree2 = new BrowseTree(mTestDevice);
@@ -119,14 +111,6 @@ public class BrowseTreeTest {
        assertThat(browseTree.findBrowseNodeByID(BrowseTree.ROOT)).isEqualTo(browseTree.mRootNode);
    }

    @Test
    @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void findBrowseNodeByIDForDevice() {
        BrowseTree browseTree = new BrowseTree(mTestDevice);
        final String deviceId = BrowseTree.ROOT + mTestDevice.getAddress().toString();
        assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode);
    }

    @Test
    public void findBrowseNodeByIDForIllegalId() {
        BrowseTree browseTree = new BrowseTree(mTestDevice);
@@ -143,8 +127,7 @@ public class BrowseTreeTest {
    }

    @Test
    @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS)
    public void findBrowseNodeByIDForDevice_withRandomDeviceID_nodeIsFound() {
    public void findBrowseNodeByIDForDevice_nodeIsFound() {
        BrowseTree browseTree = new BrowseTree(mTestDevice);
        final String deviceId = browseTree.mRootNode.getID();
        assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode);
Loading