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

Commit 22563282 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "remove getName() from CachedBluetoothDeviceManager"

parents a6a5972d c386c87b
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -211,26 +211,6 @@ public class CachedBluetoothDeviceManager {
        }
    }

    /**
     * Attempts to get the name of a remote device, otherwise returns the address.
     *
     * @param device The remote device.
     * @return The name, or if unavailable, the address.
     */
    public String getName(BluetoothDevice device) {
        CachedBluetoothDevice cachedDevice = findDevice(device);
        if (cachedDevice != null && cachedDevice.getName() != null) {
            return cachedDevice.getName();
        }

        String name = device.getAliasName();
        if (name != null) {
            return name;
        }

        return device.getAddress();
    }

    public synchronized void clearNonBondedDevices() {

        mCachedDevicesMapForHearingAids.entrySet().removeIf(entries
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ public class CachedBluetoothDeviceManagerTest {
    public void testGetName_validCachedDevice_nameFound() {
        CachedBluetoothDevice cachedDevice1 = mCachedDeviceManager.addDevice(mDevice1);
        assertThat(cachedDevice1).isNotNull();
        assertThat(mCachedDeviceManager.getName(mDevice1)).isEqualTo(DEVICE_ALIAS_1);
        assertThat(mCachedDeviceManager.findDevice(mDevice1).getName()).isEqualTo(DEVICE_ALIAS_1);
    }

    /**