[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
Loading
Please register or sign in to comment