Perform merging for A11Y_SHORTCUT B&R.
The restored value merges with the previous (pre-restore) value.
Also fixes some bugs:
- Prevents writing `null` to the setting during early SUW (by skipping
writing when old==new). This was causing the value to be written as
not-overwritable, which would cause B&R to fail for this setting
altogether.
- Writes the value of the default service to the setting if the user
manually triggers the shortcut and enables the default service during
SUW. This gets the device to a healthy state where the setting value
matches the observed behavior, rather than permanently relying on the
confusing "null means default" behavior for this user.
Bug: 341374402
Flag: android.view.accessibility.restore_a11y_shortcut_target_service
Test: atest SettingsHelperRestoreTest
Test: atest AccessibilityManagerServiceTest
Test: atest AccessibilityShortcutControllerTest
Test: Trigger volume keys shortcut twice during SUW.
Observe the setting contains the default service.
Test: Create a backup with Setting = A, then factory reset.
- Keep S empty, then restore. Observe S = A.
- Set S = A, then restore. Observe S = A.
- Set S = B, then restore. Observe S = A:B.
Change-Id: I73a5fcf36cdb45dd9a66b5823c1cc8fd4c0cc446
7 files changed