Skip to content
Commit 6607196a authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Prevent sleep tokens from being created recursively.

Sometimes a keyguard sleep token can be created with recursively call
because we use the local object existing as a condition to create it.
The code flow looks like:

KeyguardController#updateSleepToken
if (mSleepToken == null) then a = acquireSleepToken();
acquireSleepToken
  updateSleepIfNeededLocked
    ensureActivitiesVisible
      keyguardController#visibilitiesUpdated
        updateSleepToken
Then since the local mSleepToken haven't been assigned,
acquireSleepToken would be called again. Which would create another
sleep token and leave the previous one in RootWindowContainer.

To prevent this from happening again, separate updateSleepIfNeeded
from acquireSleepToken, and store sleep token as a map, so no more
sleep token can be created with same key.

Bug: 162441580
Test: atest MultiDisplayKeyguardTests MultiDisplayLockedKeyguardTests/
KeyguardTests KeyguardInputTests KeyguardLockedTests

Change-Id: I168dfe0fa101cb65eb676ca256c03439c8e4193d
Merged-In: I168dfe0fa101cb65eb676ca256c03439c8e4193d
(cherry picked from commit 3f51a967)
parent b8c40cde
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