Fix appId to killApplication when hiding packages
This function takes either an appId (for all users) or appId + userId (for force stopping an app in a single user). Passing a secondary UID in the appId slot has some really bad consequences: - Framework will decide to try and force stop all packages matching this UID including killing all of the services - ActivityManagerService will successfully turn up a ServiceRecord for each instance that needs to be killed, and mark it for removal. - However the ServiceRecord will not match to a process and will not be killed. Next time we try to start a service, the process will still be running and will be reused as one would expect. This leads to zombie instances of all the Service objects in a class that continue to run, alongside any new instances that get created right after as a result of the framework thinking it killed these services and needs to restart them. Test: Manual: create a managed profile containing AtvRemoteService (app with foreground service), confirm framework hid it in user10, check logs and heap dump to confirm it's no longer running twice. Bug: 160932561 Change-Id: I5d5b2360ea0d72ca9a5c39eb6e8c0ca6a7f33540
Loading
Please register or sign in to comment