Merge "Adding additional null checks to prevent crash after task stack view callback is reset. (Bug 18376798)" into lmp-mr1-dev
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();
|
||||
|
||||
@@ -477,7 +477,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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -494,7 +496,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,7 +582,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
|
||||
@@ -601,7 +607,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();
|
||||
}
|
||||
|
||||
@@ -702,7 +710,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();
|
||||
}
|
||||
@@ -713,7 +723,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,8 +734,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