Fix InputConsumer for RecentsAnimationController may access null pointer

Once recents died, it would post a cancel animation
and remove its InputConsumer. So it would be a race condition
when updateInputWindows and remove the InputConsumer.
We need to add a protect for this.

Bug: 120439400
Test: go/wm-smoke
Test: swiping up on the Home button
Change-Id: I5c4323d90ee5a54a2fe655d803be7a3f1561fe2d
This commit is contained in:
Arthur Hung
2018-12-04 15:53:49 +08:00
parent d830ca25a1
commit 1b636fa64c

View File

@@ -504,10 +504,12 @@ public class RecentsAnimationController implements DeathRecipient {
public void binderDied() {
cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "binderDied");
// Clear associated input consumers on runner death
final InputMonitor inputMonitor =
mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor();
inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
synchronized (mService.getWindowManagerLock()) {
// Clear associated input consumers on runner death
final InputMonitor inputMonitor =
mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor();
inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
}
}
void checkAnimationReady(WallpaperController wallpaperController) {