Don't crash if there's no running task view when going home

Change-Id: Ib5e9ce961aa4dc6b15da34713967f6ad9dde2054
This commit is contained in:
Tony Wickham 2019-03-01 10:41:09 -08:00 committed by Tony
parent 9db9d62b27
commit 37d3a1ff41
2 changed files with 9 additions and 5 deletions

View File

@ -100,10 +100,14 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
public HomeAnimationFactory prepareHomeUI(Launcher activity) {
final DeviceProfile dp = activity.getDeviceProfile();
final RecentsView recentsView = activity.getOverviewPanel();
final ComponentName component = recentsView.getRunningTaskView().getTask().key
.sourceComponent;
final View workspaceView = activity.getWorkspace().getFirstMatchForAppClose(component);
final TaskView runningTaskView = recentsView.getRunningTaskView();
final View workspaceView;
if (runningTaskView != null) {
ComponentName component = runningTaskView.getTask().key.sourceComponent;
workspaceView = activity.getWorkspace().getFirstMatchForAppClose(component);
} else {
workspaceView = null;
}
final Rect iconLocation = new Rect();
final FloatingIconView floatingView = workspaceView == null ? null
: FloatingIconView.getFloatingIconView(activity, workspaceView,

View File

@ -773,7 +773,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
setCurrentTask(runningTaskId);
}
public TaskView getRunningTaskView() {
public @Nullable TaskView getRunningTaskView() {
return getTaskView(mRunningTaskId);
}