Merge "Replaced QS Bluetooth icons with animations" into tm-qpr-dev

This commit is contained in:
Rasheed Lewis
2022-04-13 17:17:40 +00:00
committed by Android (Google) Code Review
4 changed files with 226 additions and 174 deletions

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?><!--
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,31 +15,84 @@
~ limitations under the License.
-->
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<group android:name="_R_G">
<group android:name="_R_G_L_2_G"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_2_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M-1 6.17 C-1,6.17 0.88,4.29 0.88,4.29 C0.88,4.29 -1,2.41 -1,2.41 C-1,2.41 -1,6.17 -1,6.17c M0.88 -4.29 C0.88,-4.29 -1,-6.17 -1,-6.17 C-1,-6.17 -1,-2.41 -1,-2.41 C-1,-2.41 0.88,-4.29 0.88,-4.29c M-2 -10 C-2,-10 3.71,-4.29 3.71,-4.29 C3.71,-4.29 -0.59,0 -0.59,0 C-0.59,0 3.71,4.29 3.71,4.29 C3.71,4.29 -2,10 -2,10 C-2,10 -3,10 -3,10 C-3,10 -3,2.41 -3,2.41 C-3,2.41 -7.59,7 -7.59,7 C-7.59,7 -9.01,5.59 -9.01,5.59 C-9.01,5.59 -3.41,0 -3.41,0 C-3.41,0 -9.01,-5.59 -9.01,-5.59 C-9.01,-5.59 -7.59,-7 -7.59,-7 C-7.59,-7 -3,-2.41 -3,-2.41 C-3,-2.41 -3,-10 -3,-10 C-3,-10 -2,-10 -2,-10c "/>
</group>
<group
android:name="_R_G_L_1_G"
android:translateX="14.125"
android:translateY="12"
android:pivotX="-9.109"
android:scaleX="1"
android:scaleY="1">
<path
android:name="_R_G_L_1_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M-9.09 -1.5 C-8.26,-1.5 -7.59,-0.83 -7.59,0 C-7.59,0.83 -8.26,1.5 -9.09,1.5 C-9.91,1.5 -10.59,0.83 -10.59,0 C-10.59,-0.83 -9.91,-1.5 -9.09,-1.5c "/>
</group>
<group
android:name="_R_G_L_0_G"
android:translateX="14.125"
android:translateY="12"
android:pivotX="4.875"
android:scaleX="1"
android:scaleY="1">
<path
android:name="_R_G_L_0_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M4.92 -1.5 C5.75,-1.5 6.42,-0.83 6.42,0 C6.42,0.83 5.75,1.5 4.92,1.5 C4.09,1.5 3.42,0.83 3.42,0 C3.42,-0.83 4.09,-1.5 4.92,-1.5c "/>
</group>
</group>
<group android:name="time_group"/>
</vector>
</aapt:attr>
<target android:name="_R_G_L_1_G">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="250"
android:propertyName="scaleX"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
</aapt:attr>
</objectAnimator>
<objectAnimator
android:duration="250"
android:propertyName="scaleY"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
<aapt:attr
name="android:interpolator">
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
</aapt:attr>
</objectAnimator>
</set>
@@ -48,25 +102,27 @@
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="250"
android:propertyName="scaleX"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
</aapt:attr>
</objectAnimator>
<objectAnimator
android:duration="250"
android:propertyName="scaleY"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueFrom="1"
android:valueTo="0"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
</aapt:attr>
</objectAnimator>
</set>
@@ -76,63 +132,13 @@
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="267"
android:propertyName="translateX"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType" />
android:valueType="floatType"/>
</set>
</aapt:attr>
</target>
<aapt:attr name="android:drawable">
<vector
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<group android:name="_R_G">
<group
android:name="_R_G_L_2_G"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_2_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M-1 6.17 C-1,6.17 0.88,4.29 0.88,4.29 C0.88,4.29 -1,2.41 -1,2.41 C-1,2.41 -1,6.17 -1,6.17c M0.88 -4.29 C0.88,-4.29 -1,-6.17 -1,-6.17 C-1,-6.17 -1,-2.41 -1,-2.41 C-1,-2.41 0.88,-4.29 0.88,-4.29c M-2 -10 C-2,-10 3.71,-4.29 3.71,-4.29 C3.71,-4.29 -0.59,0 -0.59,0 C-0.59,0 3.71,4.29 3.71,4.29 C3.71,4.29 -2,10 -2,10 C-2,10 -3,10 -3,10 C-3,10 -3,2.41 -3,2.41 C-3,2.41 -7.59,7 -7.59,7 C-7.59,7 -9.01,5.59 -9.01,5.59 C-9.01,5.59 -3.41,0 -3.41,0 C-3.41,0 -9.01,-5.59 -9.01,-5.59 C-9.01,-5.59 -7.59,-7 -7.59,-7 C-7.59,-7 -3,-2.41 -3,-2.41 C-3,-2.41 -3,-10 -3,-10 C-3,-10 -2,-10 -2,-10c " />
</group>
<group
android:name="_R_G_L_1_G"
android:pivotX="-9.109"
android:scaleX="0"
android:scaleY="0"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_1_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M-9.09 -1.5 C-8.26,-1.5 -7.59,-0.83 -7.59,0 C-7.59,0.83 -8.26,1.5 -9.09,1.5 C-9.91,1.5 -10.59,0.83 -10.59,0 C-10.59,-0.83 -9.91,-1.5 -9.09,-1.5c " />
</group>
<group
android:name="_R_G_L_0_G"
android:pivotX="4.875"
android:scaleX="0"
android:scaleY="0"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_0_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M4.92 -1.5 C5.75,-1.5 6.42,-0.83 6.42,0 C6.42,0.83 5.75,1.5 4.92,1.5 C4.09,1.5 3.42,0.83 3.42,0 C3.42,-0.83 4.09,-1.5 4.92,-1.5c " />
</group>
</group>
<group android:name="time_group" />
</vector>
</aapt:attr>
</animated-vector>

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2020 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,84 +14,31 @@
~ limitations under the License.
-->
<animated-vector
xmlns:android="http://schemas.android.com/apk/res/android"
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<aapt:attr name="android:drawable">
<vector
android:height="24dp"
android:width="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<group android:name="_R_G">
<group android:name="_R_G_L_2_G"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_2_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M-1 6.17 C-1,6.17 0.88,4.29 0.88,4.29 C0.88,4.29 -1,2.41 -1,2.41 C-1,2.41 -1,6.17 -1,6.17c M0.88 -4.29 C0.88,-4.29 -1,-6.17 -1,-6.17 C-1,-6.17 -1,-2.41 -1,-2.41 C-1,-2.41 0.88,-4.29 0.88,-4.29c M-2 -10 C-2,-10 3.71,-4.29 3.71,-4.29 C3.71,-4.29 -0.59,0 -0.59,0 C-0.59,0 3.71,4.29 3.71,4.29 C3.71,4.29 -2,10 -2,10 C-2,10 -3,10 -3,10 C-3,10 -3,2.41 -3,2.41 C-3,2.41 -7.59,7 -7.59,7 C-7.59,7 -9.01,5.59 -9.01,5.59 C-9.01,5.59 -3.41,0 -3.41,0 C-3.41,0 -9.01,-5.59 -9.01,-5.59 C-9.01,-5.59 -7.59,-7 -7.59,-7 C-7.59,-7 -3,-2.41 -3,-2.41 C-3,-2.41 -3,-10 -3,-10 C-3,-10 -2,-10 -2,-10c "/>
</group>
<group
android:name="_R_G_L_1_G"
android:translateX="14.125"
android:translateY="12"
android:pivotX="-9.109"
android:scaleX="1"
android:scaleY="1">
<path
android:name="_R_G_L_1_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M-9.09 -1.5 C-8.26,-1.5 -7.59,-0.83 -7.59,0 C-7.59,0.83 -8.26,1.5 -9.09,1.5 C-9.91,1.5 -10.59,0.83 -10.59,0 C-10.59,-0.83 -9.91,-1.5 -9.09,-1.5c "/>
</group>
<group
android:name="_R_G_L_0_G"
android:translateX="14.125"
android:translateY="12"
android:pivotX="4.875"
android:scaleX="1"
android:scaleY="1">
<path
android:name="_R_G_L_0_G_D_0_P_0"
android:fillColor="#ffffff"
android:fillAlpha="1"
android:fillType="nonZero"
android:pathData=" M4.92 -1.5 C5.75,-1.5 6.42,-0.83 6.42,0 C6.42,0.83 5.75,1.5 4.92,1.5 C4.09,1.5 3.42,0.83 3.42,0 C3.42,-0.83 4.09,-1.5 4.92,-1.5c "/>
</group>
</group>
<group android:name="time_group"/>
</vector>
</aapt:attr>
<target android:name="_R_G_L_1_G">
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="250"
android:propertyName="scaleX"
android:duration="150"
android:startOffset="0"
android:valueFrom="1"
android:valueTo="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
</aapt:attr>
</objectAnimator>
<objectAnimator
android:duration="250"
android:propertyName="scaleY"
android:duration="150"
android:startOffset="0"
android:valueFrom="1"
android:valueTo="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType">
<aapt:attr
name="android:interpolator">
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
<aapt:attr name="android:interpolator">
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
</aapt:attr>
</objectAnimator>
</set>
@@ -102,27 +48,25 @@
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="250"
android:propertyName="scaleX"
android:duration="150"
android:startOffset="0"
android:valueFrom="1"
android:valueTo="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
</aapt:attr>
</objectAnimator>
<objectAnimator
android:duration="250"
android:propertyName="scaleY"
android:duration="150"
android:startOffset="0"
android:valueFrom="1"
android:valueTo="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType">
<aapt:attr name="android:interpolator">
<pathInterpolator
android:pathData="M 0.0,0.0 c0.5,0 0.833,0.833 1.0,1.0"/>
<pathInterpolator android:pathData="M 0.0,0.0 c0.167,0.167 0.35,1 1.0,1.0" />
</aapt:attr>
</objectAnimator>
</set>
@@ -132,13 +76,63 @@
<aapt:attr name="android:animation">
<set android:ordering="together">
<objectAnimator
android:duration="267"
android:propertyName="translateX"
android:duration="150"
android:startOffset="0"
android:valueFrom="0"
android:valueTo="1"
android:valueType="floatType"/>
android:valueType="floatType" />
</set>
</aapt:attr>
</target>
<aapt:attr name="android:drawable">
<vector
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<group android:name="_R_G">
<group
android:name="_R_G_L_2_G"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_2_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M-1 6.17 C-1,6.17 0.88,4.29 0.88,4.29 C0.88,4.29 -1,2.41 -1,2.41 C-1,2.41 -1,6.17 -1,6.17c M0.88 -4.29 C0.88,-4.29 -1,-6.17 -1,-6.17 C-1,-6.17 -1,-2.41 -1,-2.41 C-1,-2.41 0.88,-4.29 0.88,-4.29c M-2 -10 C-2,-10 3.71,-4.29 3.71,-4.29 C3.71,-4.29 -0.59,0 -0.59,0 C-0.59,0 3.71,4.29 3.71,4.29 C3.71,4.29 -2,10 -2,10 C-2,10 -3,10 -3,10 C-3,10 -3,2.41 -3,2.41 C-3,2.41 -7.59,7 -7.59,7 C-7.59,7 -9.01,5.59 -9.01,5.59 C-9.01,5.59 -3.41,0 -3.41,0 C-3.41,0 -9.01,-5.59 -9.01,-5.59 C-9.01,-5.59 -7.59,-7 -7.59,-7 C-7.59,-7 -3,-2.41 -3,-2.41 C-3,-2.41 -3,-10 -3,-10 C-3,-10 -2,-10 -2,-10c " />
</group>
<group
android:name="_R_G_L_1_G"
android:pivotX="-9.109"
android:scaleX="0"
android:scaleY="0"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_1_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M-9.09 -1.5 C-8.26,-1.5 -7.59,-0.83 -7.59,0 C-7.59,0.83 -8.26,1.5 -9.09,1.5 C-9.91,1.5 -10.59,0.83 -10.59,0 C-10.59,-0.83 -9.91,-1.5 -9.09,-1.5c " />
</group>
<group
android:name="_R_G_L_0_G"
android:pivotX="4.875"
android:scaleX="0"
android:scaleY="0"
android:translateX="14.125"
android:translateY="12">
<path
android:name="_R_G_L_0_G_D_0_P_0"
android:fillAlpha="1"
android:fillColor="#ffffff"
android:fillType="nonZero"
android:pathData=" M4.92 -1.5 C5.75,-1.5 6.42,-0.83 6.42,0 C6.42,0.83 5.75,1.5 4.92,1.5 C4.09,1.5 3.42,0.83 3.42,0 C3.42,-0.83 4.09,-1.5 4.92,-1.5c " />
</group>
</group>
<group android:name="time_group" />
</vector>
</aapt:attr>
</animated-vector>

View File

@@ -19,9 +19,7 @@ package com.android.systemui.qs.tiles;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.os.UserManager;
@@ -134,9 +132,10 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_bluetooth);
state.stateDescription = "";
if (enabled) {
if (connected) {
state.icon = new BluetoothConnectedTileIcon();
state.icon = ResourceIcon.get(R.drawable.qs_bluetooth_icon_on);
if (!TextUtils.isEmpty(mController.getConnectedDeviceName())) {
state.label = mController.getConnectedDeviceName();
}
@@ -145,21 +144,19 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
+ ", " + state.secondaryLabel;
} else if (state.isTransient) {
state.icon = ResourceIcon.get(
com.android.internal.R.drawable.ic_bluetooth_transient_animation);
R.drawable.qs_bluetooth_icon_search);
state.stateDescription = state.secondaryLabel;
} else {
state.icon =
ResourceIcon.get(com.android.internal.R.drawable.ic_qs_bluetooth);
ResourceIcon.get(R.drawable.qs_bluetooth_icon_off);
state.stateDescription = mContext.getString(R.string.accessibility_not_connected);
}
state.state = Tile.STATE_ACTIVE;
} else {
state.icon = ResourceIcon.get(com.android.internal.R.drawable.ic_qs_bluetooth);
state.icon = ResourceIcon.get(R.drawable.qs_bluetooth_icon_off);
state.state = Tile.STATE_INACTIVE;
}
state.dualLabelContentDescription = mContext.getResources().getString(
R.string.accessibility_quick_settings_open_settings, getTileLabel());
state.expandedAccessibilityClassName = Switch.class.getName();
}
@@ -244,22 +241,4 @@ public class BluetoothTile extends QSTileImpl<BooleanState> {
refreshState();
}
};
/**
* Bluetooth icon wrapper (when connected with no battery indicator) for Quick Settings. This is
* used instead of {@link com.android.systemui.qs.tileimpl.QSTileImpl.DrawableIcon} in order to
* use a context that reflects dark/light theme attributes.
*/
private class BluetoothConnectedTileIcon extends Icon {
BluetoothConnectedTileIcon() {
// Do nothing. Default constructor to limit visibility.
}
@Override
public Drawable getDrawable(Context context) {
// This method returns Pair<Drawable, String> - the first value is the drawable.
return context.getDrawable(R.drawable.ic_bluetooth_connected);
}
}
}

View File

@@ -10,6 +10,7 @@ import android.testing.TestableLooper.RunWithLooper
import androidx.test.filters.SmallTest
import com.android.internal.logging.MetricsLogger
import com.android.internal.logging.testing.UiEventLoggerFake
import com.android.systemui.R
import com.android.systemui.SysuiTestCase
import com.android.systemui.classifier.FalsingManagerFake
import com.android.systemui.plugins.ActivityStarter
@@ -18,6 +19,7 @@ import com.android.systemui.plugins.qs.QSTile
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.qs.QSTileHost
import com.android.systemui.qs.logging.QSLogger
import com.android.systemui.qs.tileimpl.QSTileImpl
import com.android.systemui.statusbar.policy.BluetoothController
import com.google.common.truth.Truth.assertThat
import org.junit.Before
@@ -25,6 +27,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.Mockito.`when`
import org.mockito.MockitoAnnotations
@RunWith(AndroidTestingRunner::class)
@@ -84,6 +87,53 @@ class BluetoothTileTest : SysuiTestCase() {
assertThat(tile.restrictionChecked).isEqualTo(UserManager.DISALLOW_BLUETOOTH)
}
@Test
fun testIcon_whenDisabled_isOffState() {
val state = QSTile.BooleanState()
disableBluetooth()
tile.handleUpdateState(state, /* arg= */ null)
assertThat(state.icon)
.isEqualTo(QSTileImpl.ResourceIcon.get(R.drawable.qs_bluetooth_icon_off))
}
@Test
fun testIcon_whenDisconnected_isOffState() {
val state = QSTile.BooleanState()
enableBluetooth()
setBluetoothDisconnected()
tile.handleUpdateState(state, /* arg= */ null)
assertThat(state.icon)
.isEqualTo(QSTileImpl.ResourceIcon.get(R.drawable.qs_bluetooth_icon_off))
}
@Test
fun testIcon_whenConnected_isOnState() {
val state = QSTile.BooleanState()
enableBluetooth()
setBluetoothConnected()
tile.handleUpdateState(state, /* arg= */ null)
assertThat(state.icon)
.isEqualTo(QSTileImpl.ResourceIcon.get(R.drawable.qs_bluetooth_icon_on))
}
@Test
fun testIcon_whenConnecting_isSearchState() {
val state = QSTile.BooleanState()
enableBluetooth()
setBluetoothConnecting()
tile.handleUpdateState(state, /* arg= */ null)
assertThat(state.icon)
.isEqualTo(QSTileImpl.ResourceIcon.get(R.drawable.qs_bluetooth_icon_search))
}
private class FakeBluetoothTile(
qsTileHost: QSTileHost,
backgroundLooper: Looper,
@@ -114,4 +164,27 @@ class BluetoothTileTest : SysuiTestCase() {
restrictionChecked = userRestriction
}
}
fun enableBluetooth() {
`when`(bluetoothController.isBluetoothEnabled).thenReturn(true)
}
fun disableBluetooth() {
`when`(bluetoothController.isBluetoothEnabled).thenReturn(false)
}
fun setBluetoothDisconnected() {
`when`(bluetoothController.isBluetoothConnecting).thenReturn(false)
`when`(bluetoothController.isBluetoothConnected).thenReturn(false)
}
fun setBluetoothConnected() {
`when`(bluetoothController.isBluetoothConnecting).thenReturn(false)
`when`(bluetoothController.isBluetoothConnected).thenReturn(true)
}
fun setBluetoothConnecting() {
`when`(bluetoothController.isBluetoothConnected).thenReturn(false)
`when`(bluetoothController.isBluetoothConnecting).thenReturn(true)
}
}