Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ca97127b authored by Jigar Thakkar's avatar Jigar Thakkar
Browse files

Use AlarmManager to schedule private space lock requests

We currently use Handler.postDelayed() to schedule the private space
auto-lock message if the auto-lock setting to lock after 5 mins of
screen timeout have been turned on. However, this timer does not take
into the account the time spent by the device in "sleep" state. To fix
this, we are moving to use AlarmManager timers with this change. Here we
use AlarmManager.setWindow with ELAPSED_REALTIME_WAKEUP to ensure the
alarm gets reeven when the device is asleep.

We will be using setWindow with a windowLength of 1 min, ensuring the
alarm gets delivered between 5 mins and 6 minutes of scheduling time to
offset the system health cost of the alarm, while honoring the auto-lock
promise.

Test: atest
UserManagerServiceTest#testAutoLockAfterInactityForPrivateProfile.
Test: Also tested manually by flashing changes on a test device,
keeping the device with PS installed idle for 6 mins and checking the
logs.
Bug: 342660878
Flag: android.multiuser.support_autolock_for_private_space

Change-Id: I6d7feb23076b0b8dcd0aceffa6a8fdd2ffa2be26
parent f983dd27
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment