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

Commit 26146d50 authored by Chelsea Hao's avatar Chelsea Hao Committed by Android (Google) Code Review
Browse files

Merge "Use fast pair rainbow icon for devices." into main

parents e749aa2e 64d737ca
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.os.Handler;
import android.platform.test.annotations.EnableFlags;
import android.provider.Settings;
import android.testing.TestableLooper;
import android.util.Pair;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Space;
@@ -165,6 +166,7 @@ public class HearingDevicesDialogDelegateTest extends SysuiTestCase {
        when(mCachedDevice.isActiveDevice(BluetoothProfile.HEARING_AID)).thenReturn(true);
        when(mCachedDevice.isConnectedHearingAidDevice()).thenReturn(true);
        when(mCachedDevice.isConnectedHapClientDevice()).thenReturn(true);
        when(mCachedDevice.getDrawableWithDescription()).thenReturn(new Pair<>(mDrawable, ""));
        when(mHearingDeviceItem.getCachedBluetoothDevice()).thenReturn(mCachedDevice);

        mContext.setMockPackageManager(mPackageManager);
+9 −4
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ package com.android.systemui.bluetooth.qsdialog

import android.bluetooth.BluetoothAdapter
import android.bluetooth.BluetoothDevice
import android.graphics.drawable.Drawable
import android.testing.TestableLooper
import android.util.Pair
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.settingslib.bluetooth.CachedBluetoothDevice
@@ -64,6 +66,7 @@ class BluetoothDeviceMetadataInteractorTest : SysuiTestCase() {
    @Mock private lateinit var bluetoothDevice1: BluetoothDevice
    @Mock private lateinit var cachedDevice2: CachedBluetoothDevice
    @Mock private lateinit var bluetoothDevice2: BluetoothDevice
    @Mock private lateinit var drawable: Drawable
    @Captor
    private lateinit var argumentCaptor: ArgumentCaptor<BluetoothAdapter.OnMetadataChangedListener>
    private lateinit var interactor: BluetoothDeviceMetadataInteractor
@@ -77,12 +80,14 @@ class BluetoothDeviceMetadataInteractorTest : SysuiTestCase() {
            whenever(cachedDevice1.name).thenReturn(DEVICE_NAME)
            whenever(cachedDevice1.address).thenReturn(DEVICE_ADDRESS)
            whenever(cachedDevice1.connectionSummary).thenReturn(CONNECTION_SUMMARY)
            whenever(cachedDevice1.drawableWithDescription).thenReturn(Pair.create(drawable, ""))
            whenever(bluetoothDevice1.address).thenReturn(DEVICE_ADDRESS)

            whenever(cachedDevice2.device).thenReturn(bluetoothDevice2)
            whenever(cachedDevice2.name).thenReturn(DEVICE_NAME)
            whenever(cachedDevice2.address).thenReturn(DEVICE_ADDRESS)
            whenever(cachedDevice2.connectionSummary).thenReturn(CONNECTION_SUMMARY)
            whenever(cachedDevice2.drawableWithDescription).thenReturn(Pair.create(drawable, ""))
            whenever(bluetoothDevice2.address).thenReturn(DEVICE_ADDRESS)

            interactor = bluetoothDeviceMetadataInteractor
@@ -175,14 +180,14 @@ class BluetoothDeviceMetadataInteractorTest : SysuiTestCase() {
                    .addOnMetadataChangedListener(
                        eq(bluetoothDevice1),
                        any(),
                        argumentCaptor.capture()
                        argumentCaptor.capture(),
                    )

                val listener = argumentCaptor.value
                listener.onMetadataChanged(
                    bluetoothDevice1,
                    BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY,
                    ByteArray(0)
                    ByteArray(0),
                )
                assertThat(update).isEqualTo(Unit)
            }
@@ -203,14 +208,14 @@ class BluetoothDeviceMetadataInteractorTest : SysuiTestCase() {
                    .addOnMetadataChangedListener(
                        eq(bluetoothDevice1),
                        any(),
                        argumentCaptor.capture()
                        argumentCaptor.capture(),
                    )

                val listener = argumentCaptor.value
                listener.onMetadataChanged(
                    bluetoothDevice1,
                    BluetoothDevice.METADATA_MODEL_NAME,
                    ByteArray(0)
                    ByteArray(0),
                )

                assertThat(update).isNull()
+6 −5
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@

    <ImageView
        android:id="@+id/bluetooth_device_icon"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_width="36dp"
        android:layout_height="36dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
@@ -36,8 +36,8 @@

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:id="@+id/bluetooth_device_name"
        style="@style/BluetoothTileDialog.DeviceName"
        android:textDirection="locale"
        android:textAlignment="gravity"
        android:paddingStart="20dp"
@@ -54,8 +54,8 @@

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:id="@+id/bluetooth_device_summary"
        style="@style/BluetoothTileDialog.DeviceSummary"
        android:paddingStart="20dp"
        android:paddingEnd="10dp"
        android:paddingBottom="15dp"
@@ -65,7 +65,8 @@
        app:layout_constraintStart_toEndOf="@+id/bluetooth_device_icon"
        app:layout_constraintEnd_toStartOf="@+id/guideline"
        app:layout_constraintBottom_toBottomOf="parent"
        android:gravity="center_vertical" />
        android:gravity="center_vertical"
        android:textSize="14sp" />

    <androidx.constraintlayout.widget.Guideline
        android:layout_width="wrap_content"
+15 −11
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@
        android:ellipsize="end"
        android:gravity="center_vertical|center_horizontal"
        android:text="@string/quick_settings_bluetooth_label"
        android:textAppearance="@style/TextAppearance.Dialog.Title"
        android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
        android:textSize="24sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
@@ -49,7 +49,8 @@
        android:gravity="center_vertical|center_horizontal"
        android:maxLines="2"
        android:text="@string/quick_settings_bluetooth_tile_subtitle"
        android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
        android:textSize="14sp"
        android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/bluetooth_tile_dialog_title" />
@@ -105,7 +106,7 @@
                android:paddingStart="36dp"
                android:text="@string/turn_on_bluetooth"
                android:clickable="false"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:textSize="16sp"
                app:layout_constraintEnd_toStartOf="@+id/bluetooth_toggle"
                app:layout_constraintStart_toStartOf="parent"
@@ -146,7 +147,7 @@
                android:paddingEnd="15dp"
                android:paddingStart="36dp"
                android:clickable="false"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:textSize="16sp"
                app:layout_constraintEnd_toStartOf="@+id/bluetooth_auto_on_toggle"
                app:layout_constraintStart_toStartOf="parent"
@@ -187,7 +188,8 @@
                android:layout_marginTop="20dp"
                android:paddingStart="36dp"
                android:paddingEnd="40dp"
                android:textAppearance="@style/TextAppearance.Dialog.Body.Message"
                android:textSize="14sp"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/bluetooth_auto_on_toggle_info_icon" />
@@ -204,7 +206,7 @@
                android:id="@+id/see_all_button"
                style="@style/BluetoothTileDialog.Device"
                android:paddingEnd="0dp"
                android:paddingStart="20dp"
                android:paddingStart="26dp"
                android:background="@drawable/bluetooth_tile_dialog_bg_off"
                android:layout_width="0dp"
                android:layout_height="64dp"
@@ -214,11 +216,11 @@
                app:layout_constraintTop_toBottomOf="@+id/device_list"
                app:layout_constraintBottom_toTopOf="@+id/pair_new_device_button"
                android:drawableStart="@drawable/ic_arrow_forward"
                android:drawablePadding="20dp"
                android:drawablePadding="26dp"
                android:drawableTint="?android:attr/textColorPrimary"
                android:text="@string/see_all_bluetooth_devices"
                android:textSize="14sp"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:textDirection="locale"
                android:textAlignment="viewStart"
                android:maxLines="1"
@@ -229,7 +231,7 @@
                android:id="@+id/pair_new_device_button"
                style="@style/BluetoothTileDialog.Device"
                android:paddingEnd="0dp"
                android:paddingStart="20dp"
                android:paddingStart="26dp"
                android:background="@drawable/bluetooth_tile_dialog_bg_off"
                android:layout_width="0dp"
                android:layout_height="64dp"
@@ -238,11 +240,11 @@
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/see_all_button"
                android:drawableStart="@drawable/ic_add"
                android:drawablePadding="20dp"
                android:drawablePadding="26dp"
                android:drawableTint="?android:attr/textColorPrimary"
                android:text="@string/pair_new_bluetooth_devices"
                android:textSize="14sp"
                android:textAppearance="@style/TextAppearance.Dialog.Title"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:textDirection="locale"
                android:textAlignment="viewStart"
                android:maxLines="1"
@@ -259,6 +261,7 @@
            <Button
                android:id="@+id/audio_sharing_button"
                style="@style/BluetoothTileDialog.AudioSharingButton"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="9dp"
@@ -282,6 +285,7 @@
            <Button
                android:id="@+id/done_button"
                style="@style/Widget.Dialog.Button"
                android:textAppearance="@style/TextAppearance.BluetoothTileDialog"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="9dp"
+5 −19
Original line number Diff line number Diff line
@@ -1481,28 +1481,14 @@
        <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
    </style>

    <style name="BluetoothTileDialog.Device.Active">
        <item name="android:textColor">?androidprv:attr/materialColorOnPrimaryContainer</item>
    </style>

    <style name="BluetoothTileDialog.DeviceName">
        <item name="android:textSize">14sp</item>
        <item name="android:textAppearance">@style/TextAppearance.Dialog.Title</item>
    <style name="TextAppearance.BluetoothTileDialog">
        <item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
        <item name="android:textDirection">locale</item>
        <item name="android:textAlignment">gravity</item>
        <item name="android:textColor">?androidprv:attr/materialColorOnSurface</item>
    </style>

    <style name="BluetoothTileDialog.DeviceSummary">
        <item name="android:ellipsize">end</item>
        <item name="android:maxLines">2</item>
        <item name="android:textAppearance">@style/TextAppearance.Dialog.Body.Message</item>
        <item name="android:textColor">?androidprv:attr/materialColorOnSurfaceVariant</item>
    </style>

    <style name="BluetoothTileDialog.DeviceName.Active">
        <item name="android:textColor">?androidprv:attr/materialColorOnPrimaryContainer</item>
    </style>

    <style name="BluetoothTileDialog.DeviceSummary.Active">
    <style name="TextAppearance.BluetoothTileDialog.Active">
        <item name="android:textColor">?androidprv:attr/materialColorOnPrimaryContainer</item>
    </style>

Loading