Adding additional null checks to prevent crash after task stack view callback is reset. (Bug 18376798)
Change-Id: I46a324b3b6acba6b6519506ff2431d285e3b57f9
This commit is contained in:
@@ -554,7 +554,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
/** Resets the focused task. */
|
||||
void resetFocusedTask() {
|
||||
if (mFocusedTaskIndex > -1) {
|
||||
if ((mStack != null) && (0 <= mFocusedTaskIndex) &&
|
||||
(mFocusedTaskIndex < mStack.getTaskCount())) {
|
||||
Task t = mStack.getTasks().get(mFocusedTaskIndex);
|
||||
TaskView tv = getChildViewForTask(t);
|
||||
tv.unsetFocusedTask();
|
||||
|
||||
@@ -469,7 +469,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
startDeleteTaskAnimation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCb.onTaskViewDismissed(tv);
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewDismissed(tv);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -486,7 +488,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
void setClipViewInStack(boolean clip) {
|
||||
if (clip != mClipViewInStack) {
|
||||
mClipViewInStack = clip;
|
||||
mCb.onTaskViewClipStateChanged(this);
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewClipStateChanged(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +574,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
// Update the thumbnail alpha with the focus
|
||||
mThumbnailView.onFocusChanged(true);
|
||||
// Call the callback
|
||||
mCb.onTaskViewFocusChanged(this, true);
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewFocusChanged(this, true);
|
||||
}
|
||||
// Workaround, we don't always want it focusable in touch mode, but we want the first task
|
||||
// to be focused after the enter-recents animation, which can be triggered from either touch
|
||||
// or keyboard
|
||||
@@ -593,7 +599,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
// Update the thumbnail alpha with the focus
|
||||
mThumbnailView.onFocusChanged(false);
|
||||
// Call the callback
|
||||
mCb.onTaskViewFocusChanged(this, false);
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewFocusChanged(this, false);
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@@ -694,7 +702,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
@Override
|
||||
public void run() {
|
||||
if (Constants.DebugFlags.App.EnableTaskFiltering && v == mHeaderView.mApplicationIcon) {
|
||||
mCb.onTaskViewAppIconClicked(tv);
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewAppIconClicked(tv);
|
||||
}
|
||||
} else if (v == mHeaderView.mDismissButton) {
|
||||
dismissTask();
|
||||
}
|
||||
@@ -705,7 +715,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
// Reset the translation of the action button before we animate it out
|
||||
mActionButtonView.setTranslationZ(0f);
|
||||
}
|
||||
mCb.onTaskViewClicked(tv, tv.getTask(), (v == mActionButtonView));
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewClicked(tv, tv.getTask(), (v == mActionButtonView));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,8 +726,10 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (v == mHeaderView.mApplicationIcon) {
|
||||
mCb.onTaskViewAppInfoClicked(this);
|
||||
return true;
|
||||
if (mCb != null) {
|
||||
mCb.onTaskViewAppInfoClicked(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user