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

Commit 9d6fb64f authored by Fedor Kudasov's avatar Fedor Kudasov
Browse files

Simplify getTaskViewAt call

RecentsView getTaskViewAt method is nullable and is safe
to call for an out of bound index.

Bug: 205828770
Test: m LauncherGoResLib
Change-Id: I7709d63ad4490fd756a50caaf42ba70c4fad4d06
(cherry picked from commit 41edede1)
parent ba47b591
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -117,11 +117,12 @@ public class OverviewCommandHelper {
        mPendingCommands.clear();
    }

    @Nullable
    private TaskView getNextTask(RecentsView view) {
        final TaskView runningTaskView = view.getRunningTaskView();

        if (runningTaskView == null) {
            return view.getTaskViewCount() > 0 ? view.getTaskViewAt(0) : null;
            return view.getTaskViewAt(0);
        } else {
            final TaskView nextTask = view.getNextTaskView();
            return nextTask != null ? nextTask : runningTaskView;
@@ -256,8 +257,8 @@ public class OverviewCommandHelper {
                // Ensure that recents view has focus so that it receives the followup key inputs
                TaskView taskView = rv.getNextTaskView();
                if (taskView == null) {
                    if (rv.getTaskViewCount() > 0) {
                    taskView = rv.getTaskViewAt(0);
                    if (taskView != null) {
                        taskView.requestFocus();
                    } else {
                        rv.requestFocus();