Fix locked profile activity hiding logic
The aim of this code is to avoid asking the user to solve two
lock screens in a row (the keyguard and a work challenge) in case
when the profile has a separate PIN/pattern/password and a
profile activity is on the screen when the phone gets locked.
This CL solves two issues with existing code:
* currently it doesn't consider whether the acivity is a profile
activity - will go to home screen even if the activity is personal.
This is solved by checking mLastResumedActivity.mUserId
* doesn't work when the profile locked status is updated before keyguard
status, which happens on power button press.
This is solved by invoing the code on keyguard state update.
The code could have been more optimal by not checking user locked or
keyguard state twice, but at the cost of duplication.
Bug: 219752817
Bug: 143759666
Test: manual with TestDPC
Test: atest ActivityTaskManagerServiceTests
Change-Id: I15a9786c63653cacfe2f3042a164f1a1c9ea34c8
3 files changed