Fix potential NPE when callback remote animator

This potential NPE can cause Launcher crash. In applyAnimationUnchecked(), sources is annotated with @Nullable so we need a null check before dispatching callbacks.

Bug: 248274834
Test: atest
Change-Id: I98b9b6cc9832745ed0ce6a85915dcedc63a5b9c8
This commit is contained in:
Shen Lin
2022-09-23 00:44:44 +08:00
parent 96c760a013
commit f3df5354a5

View File

@@ -3339,8 +3339,9 @@ class Task extends TaskFragment {
ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS,
"applyAnimationUnchecked, control: %s, task: %s, transit: %s",
control, asTask(), AppTransition.appTransitionOldToString(transit));
final int size = sources != null ? sources.size() : 0;
control.addTaskToTargets(this, (type, anim) -> {
for (int i = 0; i < sources.size(); ++i) {
for (int i = 0; i < size; ++i) {
sources.get(i).onAnimationFinished(type, anim);
}
});