Fix inconsistent behavior of killPackageDependents.
ActivityManagerService.killPackageDependents behaved inconsistently when
used with USER_ALL vs a specific user id. In both cases, processes that
have added a dependency on the specified package via
addPackageDependency were killed as expected, but processes owned by the
specified package were only being killed when a specific user id was
used, and were left alone when USER_ALL was specified.
Fix this by looping over all the users as other similar process-killing
methods do, instead of relying on a single call to
killPackageProcessesLSP.
This also adds proper usage of UserController.handleIncomingUser, making
it possible to use the API with USER_CURRENT. Killing dependents for all
users now requires INTERACT_ACROSS_USERS_FULL to be consistent with
other similar APIs - previously no permission other than KILL_UID was
required.
Bug: 310653407
Test: atest CtsAppTestCases:PackageDependencyTest
Flag: EXEMPT bugfix
Change-Id: I7a95758bab4fa2c8b33d5c6748a614848c9d8d9a
1 file changed