问题
Android 4.2 has introduced a new class, Settings.Global, which now holds some of the settings that used to be in Settings.Secure or Settings.System.
Writing to System Settings and Secure Settings was (and is) possible because or the WRITE_SETTINGS and WRITE_SECURE_SETTINGS permissions (see Manifest.permissions).
The thing is... is there any way to modify Global Settings? For example, Airplane mode could before be toggled from an app and now, since it's in Settings.Global, it does not seem possible :(
Thanks!
回答1:
AFAIK, you can modify Settings.Global
the same way you modify Settings.Secure
: by creating an app that is signed by the firmware's signing key or is installed on the system partition, so it can hold WRITE_SECURE_SETTINGS
. The difference between Settings.Global
and Settings.Secure
, as I understand it, is that the latter is now on a per-user basis, while the global ones are device-wide.
来源:https://stackoverflow.com/questions/13416695/write-to-global-settings-in-android-4-2