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

Commit 7d8d1319 authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

executing onOverviewXXX actions in UI thread

Bug: 73090995
Test: Manually verify that the actions still work
Change-Id: I3488cdb70fe8fe5b7574800894ee1077ceada2c4
parent 1c75a77d
Loading
Loading
Loading
Loading
+33 −23
Original line number Diff line number Diff line
@@ -73,9 +73,11 @@ public class OverviewCommandHelper extends InternalStateHandler {
    }

    public void onOverviewToggle() {
        getLauncher().runOnUiThread(() -> {
                    if (DEBUG_START_FALLBACK_ACTIVITY) {
                        mContext.startActivity(new Intent(mContext, RecentsActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK));
                                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent
                                        .FLAG_ACTIVITY_CLEAR_TASK));
                        return;
                    }

@@ -89,8 +91,11 @@ public class OverviewCommandHelper extends InternalStateHandler {
                        openRecents();
                    }
                }
        );
    }

    public void onOverviewShown() {
        getLauncher().runOnUiThread(() -> {
                    if (isOverviewAlmostVisible()) {
                        final RecentsView rv = getLauncher().getOverviewPanel();
                        rv.snapToTaskAfterNext();
@@ -98,11 +103,16 @@ public class OverviewCommandHelper extends InternalStateHandler {
                        openRecents();
                    }
                }
        );
    }

    public void onOverviewHidden() {
        getLauncher().runOnUiThread(() -> {
                    final RecentsView rv = getLauncher().getOverviewPanel();
                    rv.launchNextTask();
                }
        );
    }

    private void startNonLauncherTask(int backStackCount) {
        for (RecentTaskInfo rti : mAM.getRecentTasks(backStackCount, UserHandle.myUserId())) {