From b792ba0e7075ec57794d8c406433746637e616b0 Mon Sep 17 00:00:00 2001 From: Alejandro Nijamkin Date: Mon, 5 Jun 2023 21:19:44 -0700 Subject: [PATCH] Improved re-enablement dialog text. Instead of a list of instructions, use a single explanation text. Bug: 282079529 Test: Manually verified. See comment#3 for screenshots. Change-Id: Ib8ac23783dbe3713fce7c6925a7101fc99f6a259 --- .../content/CustomizationProviderClient.kt | 23 ++++---- .../content/CustomizationProviderContract.kt | 8 ++- packages/SystemUI/res/values/strings.xml | 54 ++++++++++--------- .../keyguard/CustomizationProvider.kt | 7 +-- ...meControlsKeyguardQuickAffordanceConfig.kt | 26 +++++---- .../KeyguardQuickAffordanceConfig.kt | 6 +-- ...odeScannerKeyguardQuickAffordanceConfig.kt | 12 ++--- ...cessWalletKeyguardQuickAffordanceConfig.kt | 25 +++++---- .../KeyguardQuickAffordanceRepository.kt | 3 +- ...uardQuickAffordancePickerRepresentation.kt | 4 +- .../NoteTaskQuickAffordanceConfig.kt | 21 ++++---- ...cannerKeyguardQuickAffordanceConfigTest.kt | 27 +++++----- .../NoteTaskQuickAffordanceConfigTest.kt | 4 +- 13 files changed, 108 insertions(+), 112 deletions(-) diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderClient.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderClient.kt index 519ae0a597028..e0506046ee54b 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderClient.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderClient.kt @@ -148,11 +148,11 @@ interface CustomizationProviderClient { */ val isEnabled: Boolean = true, /** - * If the affordance is disabled, this is a set of instruction messages to be shown to the - * user when the disabled affordance is selected. The instructions should help the user - * figure out what to do in order to re-neable this affordance. + * If the affordance is disabled, this is the explanation to be shown to the user when the + * disabled affordance is selected. The instructions should help the user figure out what to + * do in order to re-neable this affordance. */ - val enablementInstructions: List? = null, + val enablementExplanation: String? = null, /** * If the affordance is disabled, this is a label for a button shown together with the set * of instruction messages when the disabled affordance is selected. The button should help @@ -326,10 +326,10 @@ class CustomizationProviderClientImpl( Contract.LockScreenQuickAffordances.AffordanceTable.Columns .IS_ENABLED ) - val enablementInstructionsColumnIndex = + val enablementExplanationColumnIndex = cursor.getColumnIndex( Contract.LockScreenQuickAffordances.AffordanceTable.Columns - .ENABLEMENT_INSTRUCTIONS + .ENABLEMENT_EXPLANATION ) val enablementActionTextColumnIndex = cursor.getColumnIndex( @@ -351,7 +351,7 @@ class CustomizationProviderClientImpl( nameColumnIndex == -1 || iconColumnIndex == -1 || isEnabledColumnIndex == -1 || - enablementInstructionsColumnIndex == -1 || + enablementExplanationColumnIndex == -1 || enablementActionTextColumnIndex == -1 || enablementActionIntentColumnIndex == -1 || configureIntentColumnIndex == -1 @@ -367,13 +367,8 @@ class CustomizationProviderClientImpl( name = cursor.getString(nameColumnIndex), iconResourceId = cursor.getInt(iconColumnIndex), isEnabled = cursor.getInt(isEnabledColumnIndex) == 1, - enablementInstructions = - cursor - .getString(enablementInstructionsColumnIndex) - ?.split( - Contract.LockScreenQuickAffordances.AffordanceTable - .ENABLEMENT_INSTRUCTIONS_DELIMITER - ), + enablementExplanation = + cursor.getString(enablementExplanationColumnIndex), enablementActionText = cursor.getString(enablementActionTextColumnIndex), enablementActionIntent = diff --git a/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderContract.kt b/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderContract.kt index 7f5fb2580a5b7..b6d5ef3720f54 100644 --- a/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderContract.kt +++ b/packages/SystemUI/customization/src/com/android/systemui/shared/customization/data/content/CustomizationProviderContract.kt @@ -81,7 +81,6 @@ object CustomizationProviderContract { const val TABLE_NAME = "affordances" val URI: Uri = LOCK_SCREEN_QUICK_AFFORDANCE_BASE_URI.buildUpon().appendPath(TABLE_NAME).build() - const val ENABLEMENT_INSTRUCTIONS_DELIMITER = "][" object Columns { /** String. Unique ID for this affordance. */ @@ -96,11 +95,10 @@ object CustomizationProviderContract { /** Integer. `1` if the affordance is enabled or `0` if it disabled. */ const val IS_ENABLED = "is_enabled" /** - * String. List of strings, delimited by [ENABLEMENT_INSTRUCTIONS_DELIMITER] to be - * shown to the user if the affordance is disabled and the user selects the - * affordance. + * String. Text to be shown to the user if the affordance is disabled and the user + * selects the affordance. */ - const val ENABLEMENT_INSTRUCTIONS = "enablement_instructions" + const val ENABLEMENT_EXPLANATION = "enablement_explanation" /** * String. Optional label for a button that, when clicked, opens a destination * activity where the user can re-enable the disabled affordance. diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 0eea5cccae82d..8246e0ad1a737 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -3016,52 +3016,54 @@ --> Open %1$s - - • The app is set up + To add the Wallet app as a shortcut, make sure the app is installed - - • At least one card has been added to Wallet + To add the Wallet app as a shortcut, make sure at least one card has been added - • Install a camera app + To add the QR code scanner as a shortcut, make sure a camera app is installed - • The app is set up + To add the Home app as a shortcut, make sure the app is installed - • At least one device is available + • At least one device is available - Select a default notes app to use the notetaking shortcut + Explains that the notes app is not available. This is shown as part of a dialog that explains to + the user why they cannot select this shortcut for their lock screen right now. + [CHAR LIMIT=NONE]. + --> + Select a default notes app to use the notetaking shortcut + use. This is shown as the action button in the dialog explaining why the shortcut isn't + available. [CHAR LIMIT=NONE] --> Select app