Merge "Prevent NPE when checking focused stage before root task is ready" into sc-v2-dev am: f64f48c526 am: 8b3210fae8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15771370 Change-Id: I765d8bb5695b685c2ca164fe757c376be9ed1a93
This commit is contained in:
@@ -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