Merge "Prevent NPE when checking focused stage before root task is ready" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f64f48c526
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user