diff options
author | 2023-11-13 14:30:04 -0800 | |
---|---|---|
committer | 2023-11-17 15:46:21 -0800 | |
commit | 83c155a41932d3d81c4a5039dc6bb34c044647e5 (patch) | |
tree | 833ddb792a146c87214ad99f9f3415dfce74e2bf /framework-s/java | |
parent | c8d02cd69e3a20fca4c3180f1fd7f5f501a25f6c (diff) |
[Role Logic Move] Access Resources portably
In many places throughout role-controller, we call
context.getResources(). Many of these calls rely on the assumption that
this Context is for the PermissionController app.
But, when we move role-controller to SystemServer, this assumption can
no longer be made; the Context will be a system context. Still, in some
scenarios we'll want to reference framework resources, and in some cases
we'll want to reference PermissionController resources.
To solve this, create utils methods to return 'Resources' objects, for
both scenarios, and don't assume anything about which app is the
current app.
Also, change how we access the roles.xml file. Rather than using a
static initializer, access resourceIds using string-based rather than
android.R.value-based resource names. This simplifies the code somewhat,
and removes the need to ensure we always invoke the static initializer
on startup.
Fix: 308198705
Test: atest CtsRoleTestCases
Change-Id: Ic6812e8ae6c611efd9b4152894a73361cc19ecf1
Diffstat (limited to 'framework-s/java')
0 files changed, 0 insertions, 0 deletions