Warn the user about impending personal app suspension.
* updatePersonalAppsSuspension is invoked for all events relevant
to profile maximum time off: user stopped, user unlocked,
system boot, deadline alarm goes off,
setManagedProfileMaximumTimeOff called.
* It takes all relecant bits of state into account: policy,
current deadline, user state. It calculates the new state
of the deadline, notification and alarm and makes appropriate
changes (e.g. schedules the alarm, posts notification, suspens
apps).
* Updated package manager query flags so that even when personal
apps are being suspended while the user is locked, it includes
non direct boot aware apps as well.
Test: manual, with TestDPC
Test: atest OrgOwnedProfileOwnerTest#testWorkProfileMaximumTimeOff
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
Test: atest OrgOwnedProfileOwnerTest#testPersonalAppsSuspensionNormalApp
Bug: 149075510
Change-Id: I94d2582c7af91a5d97e67d2baf2e15f0a6d5ffa9
4 files changed