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

Commit c386c87b authored by timhypeng's avatar timhypeng
Browse files

remove getName() from CachedBluetoothDeviceManager

- call getName() from CachedBluetoothDevice

Bug: 112735753
Test: make -j42 RunSettingsLibRoboTests
Change-Id: I7922b118cf8cce1b8d5a1db5bd53af64860e626b
parent 40236796
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);
    }

    /**