feat(HCT): Perform custom migration logic for existing HCT users

This logic is triggered by two scenarios:
(A) During first bootup after OTA update to Android 16, if the
    user had HCT enabled.
  - Trigger: ACTION_PRE_BOOT_COMPLETED.
  - Migration: HCT is disabled and notification is shown.
(B) Restore backup from Android 15 (or earlier), if the backup
    had HCT enabled and new device does not.
  - Trigger: SettingsProvider's restore process.
  - Migration: HCT is not restored and notification is shown.

We store whether the user has seen this notification in a new secure
setting ACCESSIBILITY_HCT_SHOW_PROMPT. This setting is also backed up.

Bug: 369906140
Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect
Test: atest SettingsRoboTests:com.android.settings.accessibility.HighContrastTextMigrationReceiverTest
Test: flash an incremental update on a build with HCT enabled;
      observe HCT is disabled and a notification is sent.
Test: flash an incremental update on a build with HCT disabled;
      observe no change to HCT and no notification.

Change-Id: I4d294ffc0b2eabc59ee7988a579d678975a16380
This commit is contained in:
chenjean
2024-11-27 23:28:26 +08:00
committed by Chun-Ku Lin
parent 97072e434d
commit fe361a526e
5 changed files with 428 additions and 0 deletions

View File

@@ -5439,6 +5439,16 @@
</intent-filter>
</receiver>
<receiver
android:name=".accessibility.HighContrastTextMigrationReceiver"
android:permission="android.permission.MANAGE_ACCESSIBILITY"
android:exported="true"> <!-- Exported for SettingsProvider restore from backup. -->
<intent-filter>
<action android:name="android.intent.action.PRE_BOOT_COMPLETED"/>
<action android:name="com.android.settings.accessibility.ACTION_HIGH_CONTRAST_TEXT_RESTORED"/>
</intent-filter>
</receiver>
<activity
android:name="Settings$ChangeNfcTagAppsActivity"
android:exported="true"