Merge "Fix NPE in isTrimmable" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a759c596fa
@@ -1387,9 +1387,7 @@ class RecentTasks {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @return whether the given task can be trimmed even if it is outside the visible range. */
|
||||||
* @return whether the given task can be trimmed even if it is outside the visible range.
|
|
||||||
*/
|
|
||||||
protected boolean isTrimmable(Task task) {
|
protected boolean isTrimmable(Task task) {
|
||||||
final ActivityStack stack = task.getStack();
|
final ActivityStack stack = task.getStack();
|
||||||
|
|
||||||
@@ -1404,9 +1402,13 @@ class RecentTasks {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final ActivityStack rootHomeTask = stack.getDisplayArea().getRootHomeTask();
|
||||||
|
// Home stack does not exist. Don't trim the task.
|
||||||
|
if (rootHomeTask == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Trim tasks that are behind the home task.
|
// Trim tasks that are behind the home task.
|
||||||
final TaskDisplayArea taskDisplayArea = stack.getDisplayArea();
|
return task.compareTo(rootHomeTask) < 0;
|
||||||
return task.compareTo(taskDisplayArea.getRootHomeTask()) < 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Remove the tasks that user may not be able to return. */
|
/** Remove the tasks that user may not be able to return. */
|
||||||
|
|||||||
@@ -406,8 +406,9 @@ public class RecentsAnimationController implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save the minimized home height
|
// Save the minimized home height
|
||||||
mMinimizedHomeBounds = mDisplayContent.getDefaultTaskDisplayArea().getRootHomeTask()
|
final ActivityStack rootHomeTask =
|
||||||
.getBounds();
|
mDisplayContent.getDefaultTaskDisplayArea().getRootHomeTask();
|
||||||
|
mMinimizedHomeBounds = rootHomeTask != null ? rootHomeTask.getBounds() : null;
|
||||||
|
|
||||||
mService.mWindowPlacerLocked.performSurfacePlacement();
|
mService.mWindowPlacerLocked.performSurfacePlacement();
|
||||||
|
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
|||||||
return mChildren.indexOf(stack);
|
return mChildren.indexOf(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityStack getRootHomeTask() {
|
@Nullable ActivityStack getRootHomeTask() {
|
||||||
return mRootHomeTask;
|
return mRootHomeTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1509,7 +1509,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return mActivityRecord != null ? mActivityRecord.getTask() : null;
|
return mActivityRecord != null ? mActivityRecord.getTask() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityStack getRootTask() {
|
@Nullable ActivityStack getRootTask() {
|
||||||
final Task task = getTask();
|
final Task task = getTask();
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
return (ActivityStack) task.getRootTask();
|
return (ActivityStack) task.getRootTask();
|
||||||
@@ -2527,7 +2527,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
final Task task = getTask();
|
final Task task = getTask();
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
task.getDimBounds(mTmpRect);
|
task.getDimBounds(mTmpRect);
|
||||||
} else {
|
} else if (getRootTask() != null) {
|
||||||
getRootTask().getDimBounds(mTmpRect);
|
getRootTask().getDimBounds(mTmpRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user