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

Skip to content
Commit 483a0e95 authored by Jigar Thakkar's avatar Jigar Thakkar Committed by Android Build Coastguard Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ca97127b14461c0635723eb38b991cec8bccee54)
Merged-In: I6d7feb23076b0b8dcd0aceffa6a8fdd2ffa2be26
Change-Id: I6d7feb23076b0b8dcd0aceffa6a8fdd2ffa2be26
parent 3c75c64b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment