Skip to content
Commit a5d44e88 authored by Hai Zhang's avatar Hai Zhang
Browse files

Refactor RoleManagerService to use system API when possible.

Changes include but not limited to:

- Use DataOutputStream for computePackageStateHash(), as
OutputStream.write(int) only writes one byte, so it's better to use a
proper built-in mechanism and drop dependency on another util class in
the meantime.

- Use a simplified enforceCrossUserPermission() similar to other
system services, instead of the non-API
ActivityManager.handleIncomingUser().

- Use the module library BasicShellCommandHandler to implement
RoleManagerShellCommand.

- Dump the existing user states, instead of for all users which
potentially creates empty states. This makes the dump more truthful
and saves an API.

- Use a local copy of checkDumpPermission() instead of depending on
the entire DumpUtils class.

- Use the XmlPullParser API instead of the new non-API
TypedXmlPullParser, because the legacy file can only be written before
R, and thus can't be the new binary XML format.

- Other small changes to use system APIs.

Bug: 158736025
Test: CtsRoleTestCases
Change-Id: I97d74aadfa2ccd264929c45226367b65a47f6435
parent 80401a0a
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