Consolidate ActivityStack#finishCurrentActivityLocked checking
This CL is to fix a bug that found in TransitionSelectionTests#testCloseTask_BothWallpaper_SlowStop may flaky because when TopActivity launched & call finish(), the activity will destroy too soon before BottomActivity resume & idle. When TopActivity launched, suppose BottomActivity's nowVisible state should be false because both activities are fullscreen activity & TopActivity should cover BottomActivity. After TopActivity called finish(), normally the activity should wait for BottomActivity visible and then destroy, and this test is to verify if TRANSIT_WALLPAPER_INTRA_CLOSE state will coming when opening & closing animation target with wallpaper theme are animating case. But the flakiness may happen if device is in low-performance stage, when TopActivity launched, system calls setClientHidden for BottomActivity's all windows to update its viewVisibility but can't update in time, and then the next relayoutWindow comes, mis-detected BottomActivity's Floating child window as drawn state, so that can't update BottomActivity's nowVisible state as invisible with onWindowsGone(). So when TopActivity called finish(), TopActivity will soon going to destroy state since BottomActivity is still in nowVisible state. The fix is to add isNextNotYetVisible, if the next activity the nowVisible or visible is not yet true, which means we need to add the current finishing activity into stopping list and destory until the next activity idle. Bug: 140088359 Test: atest TransitionSelectionTests Change-Id: If1907d71135158bafea69881205f351ab666025e Merged-In: If1907d71135158bafea69881205f351ab666025e
Loading
Please register or sign in to comment