Update surface visibility state when forcing visible
Since surface visibility recovery always applies for visible request even for sleeping case, when finishing an activity while sleeping, the next activity will enter onVisibleWithoutCollectingTransition because there won't be a transition for invisible finishing activity. And then because the device is sleeping, the next activity will be stopped and invisible directly right after resuming. But its surface visibility is only forced to be visible. Then after the device is awake and the "invisible-visible" activity doesn't have visibility change, home will be untouchable because the surface layer of home task is always at bottom, which is under the ActivityRecordInputSink of the problematic activity. The surface hierarchy and visibility will be: [Top]Task T (visible) > Activity X (visible) > Window (invisible) > ActivityRecordInputSink (follow parent, so visible) [Bottom]Task Home (visible) > Activity (visible) > Window (visible) Even if X is stopped and mVisible/mVisibleRequested are false. So this change updates mLastSurfaceShowing when forcing visible. Then when executing ActivityRecord/Task#prepareSurface, it can follow the current state of hierarchy to refresh the visibility. Also narrow down the scope of surface visibility recovery while display is sleeping, which is for show-when-locked case. Fix: 311221846 Fix: 311379188 Fix: 309908645 Test: atest ActivityRecordTests# \ testFinishActivityIfPossible_nonVisibleNoAppTransition Test: Launch app A. Launch app B. Turn off screen. B calls finish. Launch app C (so A doesn't have visibility change later). Unlock device. Press home key. Home can still scroll. (App A,B,C have different uids so InputSink will block touch) Change-Id: I1d6c2e5a0dad831a9a7043d390037ca15a8b14bd
Loading
Please register or sign in to comment