diff options
| author | 2025-02-18 09:27:51 -0800 | |
|---|---|---|
| committer | 2025-02-18 17:13:12 -0800 | |
| commit | 50ebccb273ed15e19b9f980964f1ff1ec9ae0488 (patch) | |
| tree | c7d66554b43093dfecf172bbb3b77256b9d73f81 /ravenwood/scripts/extract-last-soong-commands.py | |
| parent | 583b8f2557a7a41fcf8502d6088acb1d00fdf966 (diff) | |
Added overrideableByRestore option to `settings put`.
Here's how to test it...
First create some aliases...
$ alias get_sec='adb shell settings get secure --user cur'
$ alias put_sec='adb shell settings pu secure --user cur'
$ alias del_sec='adb shell settings delete secure --user cur'
$ alias bmgr='adb shell bmgr --user cur'
...prepare the backup manager...
$ bmgr transport com.android.localtransport/.LocalTransport
$ bmgr init com.android.localtransport/.LocalTransport
$ bmgr activate true
$ bmgr enable true
...and remove a setting, as the new option only works if it's not
already saved with isValuePreservedInRestore:
$ del_sec lock_screen_show_notifications
Deleted 1 rows
$ get_sec lock_screen_show_notifications
null
Now set it:
$ set_sec lock_screen_show_notifications 1
$ get_sec lock_screen_show_notifications
1
Since the setting didn't exist yet (it was deleted), it will be
stored with isValuePreservedInRestore = false (which shows as
notPreservedInRestore on dumpsys):
$ adb shell dumpsys settings | grep name:lock_screen_show_notifications
_id:157 name:lock_screen_show_notifications pkg:root value:1
Use the command below to create backup (with value 1)
$ bmgr backupnow com.android.providers.settings --monitor-verbose > /dev/null
Now set it again, with a different value:
$ set_sec lock_screen_show_notifications 0
$ get_sec lock_screen_show_notifications
0
Notice the the notPreservedInRestore is gone, as the value existed before:
$ adb shell dumpsys settings | grep name:lock_screen_show_notifications
_id:158 name:lock_screen_show_notifications pkg:root value:0
So if you try to restore it, it doesn't work:
$ bmgr restore 1 com.android.providers.settings --monitor-verbose > /dev/null
$ get_sec lock_screen_show_notifications
0
Now let's repeat the previous steps, but using overrideableByRestore
$ del_sec lock_screen_show_notifications
$ get_sec lock_screen_show_notifications
null
$ set_sec lock_screen_show_notifications 1
$ get_sec lock_screen_show_notifications
1
$ set_sec lock_screen_show_notifications 0 overrideableByRestore
$ get_sec lock_screen_show_notifications
0
Notice the notPreservedInRestore is set this time:
$ adb shell dumpsys settings | grep name:lock_screen_show_notifications
_id:159 name:lock_screen_show_notifications pkg:root value:0 notPreservedInRestore
So now restore works:
$ bmgr restore 1 com.android.providers.settings --monitor-verbose > /dev/null
$ get_sec lock_screen_show_notifications
1
Test: manual verification using steps above
Fixes: 396734809
Flag: EXEMPT changes on debugging components only
Change-Id: I11d239f9b2a70de8f94ff7f9f6df0be79fc69142
Diffstat (limited to 'ravenwood/scripts/extract-last-soong-commands.py')
0 files changed, 0 insertions, 0 deletions