Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 2af6e521 authored by Songchun Fan's avatar Songchun Fan
Browse files

[SettingsProvider] @Readable annotation to restrict access to hidden keys

Adding a new annotation that can be fetched at runtime.

The settings keys annotated with the new annotation can be accessed via
the get* methods, even if they are marked as @hide. Access to a value
that is not annotated with @Readable will end up with an
IllegalArgumentException.

Notice that if a caller tries to call get* method with a value that is
not defined in the Settings.Secure, Settings.System or Settings.Global
classes, this access is still regarded as valid. We only reject accesses
where the value is defined in one of the three classes, but is marked as
@hide and does not have @Readable annotation.

This CL adds @Readable to all existing hidden keys and public keys.

A follow up CL will remove the @Readable annotation for the hidden keys
added in S. The end result would be that all the keys (hidden or public)
can be accessed if they were added before S. From S and beyond, only
public keys can be accessed.

+ also fixed some formatting issues

BUG: 175024829
Test: atest android.appsecurity.cts.ReadableSettingsFieldsTest
Change-Id: I8a2733580ff9c9d01cbdb0f14ad56c2062a2f956
parent 3b2c510a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment