Adds icon support to fake quick affordance client.

This is needed for tests in ag/20601630

Bug: 254858701
Test: N/A - this is testing
Change-Id: Ibe86233511078f7c2d32cd8abb8ba97afedbcb79
This commit is contained in:
Alejandro Nijamkin
2022-12-02 07:04:57 -08:00
parent b877a2de53
commit 5587e154c9

View File

@@ -42,17 +42,17 @@ class FakeKeyguardQuickAffordanceProviderClient(
KeyguardQuickAffordanceProviderClient.Affordance(
id = AFFORDANCE_1,
name = AFFORDANCE_1,
iconResourceId = 0,
iconResourceId = 1,
),
KeyguardQuickAffordanceProviderClient.Affordance(
id = AFFORDANCE_2,
name = AFFORDANCE_2,
iconResourceId = 0,
iconResourceId = 2,
),
KeyguardQuickAffordanceProviderClient.Affordance(
id = AFFORDANCE_3,
name = AFFORDANCE_3,
iconResourceId = 0,
iconResourceId = 3,
),
),
flags: List<KeyguardQuickAffordanceProviderClient.Flag> =
@@ -131,7 +131,12 @@ class FakeKeyguardQuickAffordanceProviderClient(
}
override suspend fun getAffordanceIcon(iconResourceId: Int, tintColor: Int): Drawable {
return BitmapDrawable()
return when (iconResourceId) {
1 -> ICON_1
2 -> ICON_2
3 -> ICON_3
else -> BitmapDrawable()
}
}
fun setFlag(
@@ -186,5 +191,8 @@ class FakeKeyguardQuickAffordanceProviderClient(
const val AFFORDANCE_1 = "affordance_1"
const val AFFORDANCE_2 = "affordance_2"
const val AFFORDANCE_3 = "affordance_3"
val ICON_1 = BitmapDrawable()
val ICON_2 = BitmapDrawable()
val ICON_3 = BitmapDrawable()
}
}