Partial revert "Wait for unlock to start jobs."

This reverts commit e61cf5125e
but changes onUserUnlocking to onUserUnlocked.

Reason for revert: Direct-boot-aware jobs should be allowed to run when the user is locked

Bug: 200174299
Bug: 201307089
Test: N/A
Change-Id: Ic5a67a42590e171f0bfed8da0c138096031469d5
(cherry picked from commit 171bf04113)
This commit is contained in:
Kweku Adams
2021-09-27 18:53:23 +00:00
parent b46475496f
commit 14841f18ff

View File

@@ -1008,13 +1008,21 @@ public class JobSchedulerService extends com.android.server.SystemService
}
@Override
public void onUserUnlocked(@NonNull TargetUser user) {
public void onUserStarting(@NonNull TargetUser user) {
synchronized (mLock) {
// Note that the user has started after its unlocked instead of when the user
// actually starts because the storage won't be decrypted until unlock.
mStartedUsers = ArrayUtils.appendInt(mStartedUsers, user.getUserIdentifier());
}
// Let's kick any outstanding jobs for this user.
// The user is starting but credential encrypted storage is still locked.
// Only direct-boot-aware jobs can safely run.
// Let's kick off any eligible jobs for this user.
mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget();
}
@Override
public void onUserUnlocked(@NonNull TargetUser user) {
// The user is fully unlocked and credential encrypted storage is now decrypted.
// Direct-boot-UNaware jobs can now safely run.
// Let's kick off any outstanding jobs for this user.
mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget();
}