Do not hold PM or AM locks when calling hibernation API
App hibernation calls into activity manager and package manager API. If
package manager calls into AppHibernationService while holding either
the activity manager lock or package manager locks, it can cause a
deadlock. To fix this, we ensure that app hibernation API is never
called with either lock, either by separating out the logic or putting
the app hibernation state mutation on a background thread.
Bug: 184661338
Bug: 182811830
Test: manual, hibernation app, open, see hibernation state is left
Test: atest PackageManagerServiceHibernationTests
Change-Id: I1d7dfb2232a49a63958628dd94f6b6445ece4d55
2 files changed