Fix KeyguardController::mDisplayStates leak

ActivityDisplay#remove doesn't ensure this display be remove directly,
should move KeyguardController::onDisplayRemoved into releaseSelfIfNeeded.

Bug: 118238630
Test: atest ActivityManagerMultiDisplayTests#testNoLeakOnExternalDisplay.

Change-Id: Ia9619c59da8be736f71af1b8fddc14b4798c966e
This commit is contained in:
wilsonshih
2018-10-23 17:21:02 +08:00
parent e4ae7ea03e
commit bcfd5347a1

View File

@@ -1035,8 +1035,6 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
releaseSelfIfNeeded();
mSupervisor.getKeyguardController().onDisplayRemoved(mDisplayId);
if (!mAllSleepTokens.isEmpty()) {
mSupervisor.mSleepTokens.removeAll(mAllSleepTokens);
mAllSleepTokens.clear();
@@ -1049,6 +1047,7 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>
mWindowContainerController.removeContainer();
mWindowContainerController = null;
mSupervisor.removeChild(this);
mSupervisor.getKeyguardController().onDisplayRemoved(mDisplayId);
}
}