Merge "Prevent NPE when checking focused stage before root task is ready" into sc-v2-dev am: f64f48c526

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15771370

Change-Id: I90c861bbea04691943d314ce8149537502370d0d
This commit is contained in:
TreeHugger Robot
2021-09-07 03:53:52 +00:00
committed by Automerger Merge Worker

View File

@@ -113,10 +113,20 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
/** @return {@code true} if this listener contains the currently focused task. */
boolean isFocused() {
if (mRootTaskInfo.isFocused) return true;
for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
if (mChildrenTaskInfo.valueAt(i).isFocused) return true;
if (mRootTaskInfo == null) {
return false;
}
if (mRootTaskInfo.isFocused) {
return true;
}
for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
if (mChildrenTaskInfo.valueAt(i).isFocused) {
return true;
}
}
return false;
}