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

Commit 632e2caf authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Fix ConnectedBluetoothDevice strings for TV.

Bug: 326597753
Test: atest CachedBluetoothDeviceTest

Change-Id: Ia3d417197a9eb5b3a5c07254399363d162f1864a
parent 24d0f2f7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -214,6 +214,10 @@
    <string name="bluetooth_battery_level_untethered_left">Left: <xliff:g id="battery_level_as_percentage" example="25%">%1$s</xliff:g> battery</string>
    <!-- Connected devices settings. Message when Bluetooth is connected but not in use, showing remote device battery level for the right part of the untethered headset. [CHAR LIMIT=NONE] -->
    <string name="bluetooth_battery_level_untethered_right">Right: <xliff:g id="battery_level_as_percentage" example="25%">%1$s</xliff:g> battery</string>
    <!-- Connected devices settings. Message when Bluetooth is connected, showing remote device battery level for the left part of the untethered headset. [CHAR LIMIT=NONE] -->
    <string name="tv_bluetooth_battery_level_untethered_left">Left <xliff:g id="battery_level_as_percentage" example="25%">%1$s</xliff:g></string>
    <!-- Connected devices settings. Message when Bluetooth is connected, showing remote device battery level for the right part of the untethered headset. [CHAR LIMIT=NONE] -->
    <string name="tv_bluetooth_battery_level_untethered_right">Right <xliff:g id="battery_level_as_percentage" example="25%">%1$s</xliff:g></string>
    <!-- Connected devices settings. Message when Bluetooth is connected and active but no battery information, showing remote device status. [CHAR LIMIT=NONE] -->
    <string name="bluetooth_active_no_battery_level">Active</string>
    <!-- Connected devices settings. Message shown when bluetooth device is disconnected but is a known, previously connected device [CHAR LIMIT=NONE] -->
+2 −2
Original line number Diff line number Diff line
@@ -1532,7 +1532,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
            // the left.
            if (leftBattery >= 0) {
                String left = res.getString(
                        R.string.bluetooth_battery_level_untethered_left,
                        R.string.tv_bluetooth_battery_level_untethered_left,
                        Utils.formatPercentage(leftBattery));
                addBatterySpan(spannableBuilder, left, isBatteryLow(leftBattery,
                                BluetoothDevice.METADATA_UNTETHERED_LEFT_LOW_BATTERY_THRESHOLD),
@@ -1543,7 +1543,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
                    spannableBuilder.append(" ");
                }
                String right = res.getString(
                        R.string.bluetooth_battery_level_untethered_right,
                        R.string.tv_bluetooth_battery_level_untethered_right,
                        Utils.formatPercentage(rightBattery));
                addBatterySpan(spannableBuilder, right, isBatteryLow(rightBattery,
                                BluetoothDevice.METADATA_UNTETHERED_RIGHT_LOW_BATTERY_THRESHOLD),
+10 −17
Original line number Diff line number Diff line
@@ -780,9 +780,8 @@ public class CachedBluetoothDeviceTest {
        mBatteryLevel = 10;

        // Act & Assert:
        //   Get "Left: 10% battery" result with Battery Level 10.
        assertThat(mCachedDevice.getTvConnectionSummary().toString()).isEqualTo(
                "Left: 10% battery");
        //   Get "Left 10%" result with Battery Level 10.
        assertThat(mCachedDevice.getTvConnectionSummary().toString()).isEqualTo("Left 10%");
    }

    @Test
@@ -815,9 +814,9 @@ public class CachedBluetoothDeviceTest {
        mBatteryLevel = 10;

        // Act & Assert:
        //   Get "Left: 10% battery" result with Battery Level 10.
        //   Get "Left 10%" result with Battery Level 10.
        assertThat(mCachedDevice.getTvConnectionSummary().toString()).isEqualTo(
                "Left: 10% battery");
                "Left 10%");
    }

    @Test
@@ -925,9 +924,9 @@ public class CachedBluetoothDeviceTest {
        mBatteryLevel = 10;

        // Act & Assert:
        //   Get "Left: 10% battery Right: 10% battery" result with Battery Level 10.
        //   Get "Left 10% Right 10%" result with Battery Level 10.
        assertThat(mCachedDevice.getTvConnectionSummary().toString())
                .isEqualTo("Left: 10% battery Right: 10% battery");
                .isEqualTo("Left 10% Right 10%");
    }

    @Test
@@ -1226,7 +1225,7 @@ public class CachedBluetoothDeviceTest {
                TWS_BATTERY_RIGHT.getBytes());

        assertThat(mCachedDevice.getTvConnectionSummary().toString()).isEqualTo(
                "Left: 15% battery Right: 25% battery");
                "Left 15% Right 25%");
    }

    @Test
@@ -1262,11 +1261,7 @@ public class CachedBluetoothDeviceTest {
                TWS_BATTERY_RIGHT.getBytes());

        assertThat(mCachedDevice.getTvConnectionSummary().toString())
                .isEqualTo(
                        mContext.getString(R.string.bluetooth_battery_level_untethered_left, "15%")
                                + " "
                                + mContext.getString(
                                        R.string.bluetooth_battery_level_untethered_right, "25%"));
                .isEqualTo("Left 15% Right 25%");
    }

    @Test
@@ -1283,10 +1278,8 @@ public class CachedBluetoothDeviceTest {
                .thenReturn(TWS_BATTERY_RIGHT.getBytes());

        int lowBatteryColor = mContext.getColor(LOW_BATTERY_COLOR);
        String leftBattery =
                mContext.getString(R.string.bluetooth_battery_level_untethered_left, "15%");
        String rightBattery =
                mContext.getString(R.string.bluetooth_battery_level_untethered_right, "25%");
        String leftBattery = "Left 15%";
        String rightBattery = "Right 25%";

        // Default low battery threshold, only left battery is low
        CharSequence summary = mCachedDevice.getTvConnectionSummary(LOW_BATTERY_COLOR);