diff options
author | Shriya Gupta <shrigupt@google.com> | 2023-03-09 11:50:30 +0000 |
---|---|---|
committer | Shriya Gupta <shrigupt@google.com> | 2023-03-14 11:00:43 +0000 |
commit | 3e6f27c32150bd090ab7e2c2e3834b2d5fc5136c (patch) | |
tree | 76566485996a26ba4ed4576d2ee0f4b220605c4a /PermissionController/src/com/android/permissioncontroller/safetycenter | |
parent | f8079db147c926a3fdbd631867c7d56da6dad490 (diff) | |
download | Permission-3e6f27c32150bd090ab7e2c2e3834b2d5fc5136c.tar.gz |
Fix opacity for disabled entries with null-intent
Bug: 271263327
Test: atest SafetyCenterFunctionalTestCases
Change-Id: Iad623fee4a435b486a08ad5d8d3cd98e4cdbaef2
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/safetycenter')
3 files changed, 15 insertions, 6 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt index 7ff31d009..b8c9e035e 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/SafetySubpageEntryPreference.kt @@ -121,7 +121,7 @@ class SafetySubpageEntryPreference( val titleView = holder.findViewById(android.R.id.title) as? TextView? val summaryView = holder.findViewById(android.R.id.summary) as? TextView? - changeEnabledState(entry.isEnabled, titleView, summaryView) + changeEnabledState(entry.isEnabled, isEnabled(), titleView, summaryView) } override fun shouldHideSecondTarget(): Boolean = entry.iconAction == null diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt index 36377ebf5..c985ba006 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryCommonViewsManager.kt @@ -67,17 +67,25 @@ internal class SafetyEntryCommonViewsManager(rootEntryView: ViewGroup?) { companion object { /** - * Change opacity to make some entries to look disabled but still be clickable + * Change opacity to make some entries look disabled but still be clickable * - * @param isEnabled whether the [android.safetycenter.SafetyCenterEntry] is enabled + * @param isEntryEnabled whether the [android.safetycenter.SafetyCenterEntry] is enabled + * @param isPreferenceEnabled whether the corresponding preference is enabled * @param titleView view displaying the title text of the entry * @param summaryView view displaying the summary text of the entry */ - fun changeEnabledState(isEnabled: Boolean, titleView: TextView?, summaryView: TextView?) { - if (isEnabled) { + fun changeEnabledState( + isEntryEnabled: Boolean, + isPreferenceEnabled: Boolean, + titleView: TextView?, + summaryView: TextView? + ) { + if (isEntryEnabled) { titleView?.alpha = 1f summaryView?.alpha = 1f - } else { + } else if (isPreferenceEnabled) { + /* Check that preference is enabled before lowering because disabled preferences + * already have a low visibility */ titleView?.alpha = 0.4f summaryView?.alpha = 0.4f } diff --git a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt index e28f782ab..1c29b92f9 100644 --- a/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt +++ b/PermissionController/src/com/android/permissioncontroller/safetycenter/ui/view/SafetyEntryView.kt @@ -176,6 +176,7 @@ constructor( isEnabled = entry.pendingIntent != null changeEnabledState( entry.isEnabled, + isEnabled, commonEntryView?.titleView, commonEntryView?.summaryView ) |