Merge "Add null checks for mRecentsView" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
db07d2223e
@@ -177,7 +177,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController;
|
protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController;
|
||||||
protected RecentsAnimationTargets mRecentsAnimationTargets;
|
protected RecentsAnimationTargets mRecentsAnimationTargets;
|
||||||
protected T mActivity;
|
protected T mActivity;
|
||||||
protected Q mRecentsView;
|
protected @Nullable Q mRecentsView;
|
||||||
protected Runnable mGestureEndCallback;
|
protected Runnable mGestureEndCallback;
|
||||||
protected MultiStateCallback mStateCallback;
|
protected MultiStateCallback mStateCallback;
|
||||||
protected boolean mCanceled;
|
protected boolean mCanceled;
|
||||||
@@ -1895,7 +1895,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private void invalidateHandlerWithLauncher() {
|
private void invalidateHandlerWithLauncher() {
|
||||||
endLauncherTransitionController();
|
endLauncherTransitionController();
|
||||||
|
|
||||||
mRecentsView.onGestureAnimationEnd();
|
if (mRecentsView != null) {
|
||||||
|
mRecentsView.onGestureAnimationEnd();
|
||||||
|
}
|
||||||
resetLauncherListeners();
|
resetLauncherListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1922,7 +1924,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private void resetLauncherListeners() {
|
private void resetLauncherListeners() {
|
||||||
mActivity.getRootView().setOnApplyWindowInsetsListener(null);
|
mActivity.getRootView().setOnApplyWindowInsetsListener(null);
|
||||||
|
|
||||||
mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener);
|
if (mRecentsView != null) {
|
||||||
|
mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetStateForAnimationCancel() {
|
private void resetStateForAnimationCancel() {
|
||||||
@@ -1981,8 +1985,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private boolean updateThumbnail(int runningTaskId, boolean refreshView) {
|
private boolean updateThumbnail(int runningTaskId, boolean refreshView) {
|
||||||
boolean finishTransitionPosted = false;
|
boolean finishTransitionPosted = false;
|
||||||
final TaskView taskView;
|
final TaskView taskView;
|
||||||
if (mGestureState.getEndTarget() == HOME || mGestureState.getEndTarget() == NEW_TASK
|
if (mGestureState.getEndTarget() == HOME
|
||||||
|| mGestureState.getEndTarget() == ALL_APPS) {
|
|| mGestureState.getEndTarget() == NEW_TASK
|
||||||
|
|| mGestureState.getEndTarget() == ALL_APPS
|
||||||
|
|| mRecentsView == null) {
|
||||||
// Capture the screenshot before finishing the transition to home or quickswitching to
|
// Capture the screenshot before finishing the transition to home or quickswitching to
|
||||||
// ensure it's taken in the correct orientation, but no need to update the thumbnail.
|
// ensure it's taken in the correct orientation, but no need to update the thumbnail.
|
||||||
taskView = null;
|
taskView = null;
|
||||||
@@ -2135,7 +2141,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
protected void startNewTask(Consumer<Boolean> resultCallback) {
|
protected void startNewTask(Consumer<Boolean> resultCallback) {
|
||||||
// Launch the task user scrolled to (mRecentsView.getNextPage()).
|
// Launch the task user scrolled to (mRecentsView.getNextPage()).
|
||||||
if (!mCanceled) {
|
if (!mCanceled) {
|
||||||
TaskView nextTask = mRecentsView.getNextPageTaskView();
|
TaskView nextTask = mRecentsView == null ? null : mRecentsView.getNextPageTaskView();
|
||||||
if (nextTask != null) {
|
if (nextTask != null) {
|
||||||
Task.TaskKey nextTaskKey = nextTask.getTask().key;
|
Task.TaskKey nextTaskKey = nextTask.getTask().key;
|
||||||
int taskId = nextTaskKey.id;
|
int taskId = nextTaskKey.id;
|
||||||
@@ -2237,7 +2243,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RemoteAnimationTarget taskTarget = taskTargetOptional.get();
|
RemoteAnimationTarget taskTarget = taskTargetOptional.get();
|
||||||
TaskView taskView = mRecentsView.getTaskViewByTaskId(taskTarget.taskId);
|
TaskView taskView = mRecentsView == null
|
||||||
|
? null : mRecentsView.getTaskViewByTaskId(taskTarget.taskId);
|
||||||
if (taskView == null || !taskView.getThumbnail().shouldShowSplashView()) {
|
if (taskView == null || !taskView.getThumbnail().shouldShowSplashView()) {
|
||||||
finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
|
finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */);
|
||||||
return;
|
return;
|
||||||
@@ -2296,9 +2303,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
* resume if we finish the controller.
|
* resume if we finish the controller.
|
||||||
*/
|
*/
|
||||||
protected int getLastAppearedTaskIndex() {
|
protected int getLastAppearedTaskIndex() {
|
||||||
return mGestureState.getLastAppearedTaskId() != -1
|
return mRecentsView == null
|
||||||
? mRecentsView.getTaskIndexForId(mGestureState.getLastAppearedTaskId())
|
? -1
|
||||||
: mRecentsView.getRunningTaskIndex();
|
: mGestureState.getLastAppearedTaskId() != -1
|
||||||
|
? mRecentsView.getTaskIndexForId(mGestureState.getLastAppearedTaskId())
|
||||||
|
: mRecentsView.getRunningTaskIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user