Account for stopping activities when determining whether to restart

- We were seeing a flakey issue with gesture nav, when swiping
  immediately after launching an app, the system would stop
  launcher, but shortly after, we would start the recents animation
  for the next gesture. The recents animation calls:

  [RWC->DC->AS].ensureActivitiesVisible()
  -> EnsureActivitiesVisibleHelper.setActivityVisibilityState()
  -> AR.makeActiveIfNeeded()
  -> AR.shouldStartActivity()

  and the visible is requested, but we are currently still stopping
  because the client hasn't called back. This results in the
  animation continuing, but the system silently not scheduling
  launcher to be started, which prevents a draw-callback to finish
  on the client side, which then prevents us from finishing the
  recents animation (we are waiting for the draw to update the task
  view with the snapshot).

Bug: 151788100
Test: Manual, it's hard to repro but you just have to swipe up after
      launching apps really quickly to get stuck in a state where you
      can't swipe up at all

Change-Id: I32628f1e532764fc1ef962c6d4602214ca7c36c4
This commit is contained in:
Winson Chung
2020-03-20 11:07:17 -07:00
parent 09b9570862
commit b478e576ad

View File

@@ -4618,6 +4618,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
} catch (Exception e) {
Slog.w(TAG, "Exception thrown sending start: " + intent.getComponent(), e);
}
// The activity may be waiting for stop, but that is no longer appropriate if we are
// starting the activity again
mStackSupervisor.mStoppingActivities.remove(this);
}
return false;
}
@@ -4667,7 +4670,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
* and {@link #shouldPauseActivity(ActivityRecord)}.
*/
private boolean shouldStartActivity() {
return mVisibleRequested && isState(STOPPED);
return mVisibleRequested && (isState(STOPPED) || isState(STOPPING));
}
/**