Make phone call row in Privacy Dialog not clickable

Test: manual
Test: atest PrivacyDialogTest
Fixes: 184891193
Change-Id: If2421a4d8a45309fc30c2d92f7150378dc94958d
This commit is contained in:
Fabian Kozynski
2021-04-09 12:59:54 -04:00
parent d63332e6a8
commit 70d3892c75
3 changed files with 28 additions and 1 deletions

View File

@@ -51,6 +51,7 @@
/>
<ImageView
android:id="@+id/chevron"
android:layout_height="24dp"
android:layout_width="24dp"
android:layout_gravity="center_vertical"

View File

@@ -128,9 +128,14 @@ class PrivacyDialog(
)
} ?: firstLine
newView.requireViewById<TextView>(R.id.text).text = finalText
if (element.phoneCall) {
newView.requireViewById<View>(R.id.chevron).visibility = View.GONE
}
newView.apply {
setTag(element)
setOnClickListener(clickListener)
if (!element.phoneCall) {
setOnClickListener(clickListener)
}
}
return newView
}

View File

@@ -233,6 +233,27 @@ class PrivacyDialogTest : SysuiTestCase() {
)
}
@Test
fun testPhoneCallNotClickable() {
val element = PrivacyDialog.PrivacyElement(
PrivacyType.TYPE_MICROPHONE,
TEST_PACKAGE_NAME,
TEST_USER_ID,
"App",
null,
0L,
false,
false,
true
)
val list = listOf(element)
dialog = PrivacyDialog(context, list, starter)
dialog.show()
assertThat(dialog.requireViewById<View>(R.id.privacy_item).isClickable).isFalse()
assertThat(dialog.requireViewById<View>(R.id.chevron).visibility).isEqualTo(View.GONE)
}
@Test
fun testAttribution() {
val element = PrivacyDialog.PrivacyElement(