Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe79d62d authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Adding additional null checks to prevent crash after task stack view...

Merge "Adding additional null checks to prevent crash after task stack view callback is reset. (Bug 18376798)" into lmp-mr1-dev
parents 6e523a07 fe03b40d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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();
+22 −8
Original line number Diff line number Diff line
@@ -477,8 +477,10 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
        startDeleteTaskAnimation(new Runnable() {
            @Override
            public void run() {
                if (mCb != null) {
                    mCb.onTaskViewDismissed(tv);
                }
            }
        });
    }

@@ -494,9 +496,11 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
    void setClipViewInStack(boolean clip) {
        if (clip != mClipViewInStack) {
            mClipViewInStack = clip;
            if (mCb != null) {
                mCb.onTaskViewClipStateChanged(this);
            }
        }
    }

    /** Sets the current task progress. */
    public void setTaskProgress(float p) {
@@ -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
        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
        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) {
                        if (mCb != null) {
                            mCb.onTaskViewAppIconClicked(tv);
                        }
                    } else if (v == mHeaderView.mDismissButton) {
                        dismissTask();
                    }
@@ -713,18 +723,22 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
                // Reset the translation of the action button before we animate it out
                mActionButtonView.setTranslationZ(0f);
            }
            if (mCb != null) {
                mCb.onTaskViewClicked(tv, tv.getTask(), (v == mActionButtonView));
            }
        }
    }

    /**** View.OnLongClickListener Implementation ****/

    @Override
    public boolean onLongClick(View v) {
        if (v == mHeaderView.mApplicationIcon) {
            if (mCb != null) {
                mCb.onTaskViewAppInfoClicked(this);
                return true;
            }
        }
        return false;
    }
}