OSDN Git Service

[DO NOT MERGE] Modify system settings: incorrect UI state
authorSvetoslav <svetoslavganov@google.com>
Thu, 3 Dec 2015 22:36:30 +0000 (14:36 -0800)
committerSvetoslav <svetoslavganov@google.com>
Thu, 3 Dec 2015 22:36:36 +0000 (14:36 -0800)
commit28daa67fcbdfcf9dd8b8649805226245fa56c08f
tree6ddb36ae418c644773adea3ea0bcf5e6ec4044dc
parentee4808d37b955299501e9b753cc7bb19877d4f83
[DO NOT MERGE] Modify system settings: incorrect UI state

The privilege for an app to write to the system settings is protected
by an app-op signature permission. App-op permissions are special: if
the app-op is deny/allow we deny/allow write access; if the app-op is
default holding the permission determies write access. The settings
code assumes that CHANGE_NETWORK_STATE is an app op permission
(system|appop) while it is a normal permission which any app gets by
declaring it used in the manifest.

The side effect is that the state of the toggle in the UI for write
system settings will initially be in the wrong state if the app uses
both WRITE_SETTINGS and CHANGE_NETWORK_STATE. However, the code in
the public API an app uses to check write settings access would return
the opposite since it checks the WRITE_SETTINGS permission and its
app op. Hence, if an app requires write settings to start the user
will see in the settings UI it has access but the app will not have
access, so the app would prompt the user to allow write settings.
The non-obvious fix is for the user to toggle the setting off and on
to get the app op in the right state and be able to launch the app.

bug:25843134

Change-Id: I2da4eec1c3574bd6aef9ab968c9deb148536cb0a
src/com/android/settings/applications/AppStateWriteSettingsBridge.java