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

Commit bdc84644 authored by Schneider Victor-tulias's avatar Schneider Victor-tulias Committed by Android (Google) Code Review
Browse files

Merge "Update KQS launch task callbacks" into main

parents 45181a66 56aa9ed6
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -16,7 +16,10 @@


package com.android.launcher3.taskbar;
package com.android.launcher3.taskbar;


import androidx.annotation.Nullable;

import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.util.TISBindHelper;


/**
/**
 * A data source which integrates with a Launcher instance, used specifically for a
 * A data source which integrates with a Launcher instance, used specifically for a
@@ -50,4 +53,10 @@ public class DesktopTaskbarUIController extends TaskbarUIController {
    public boolean supportsVisualStashing() {
    public boolean supportsVisualStashing() {
        return false;
        return false;
    }
    }

    @Nullable
    @Override
    protected TISBindHelper getTISBindHelper() {
        return mLauncher.getTISBindHelper();
    }
}
}
+9 −0
Original line number Original line Diff line number Diff line
@@ -21,11 +21,14 @@ import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASH


import android.animation.Animator;
import android.animation.Animator;


import androidx.annotation.Nullable;

import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.statemanager.StateManager;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;


import java.util.stream.Stream;
import java.util.stream.Stream;
@@ -124,4 +127,10 @@ public class FallbackTaskbarUIController extends TaskbarUIController {
                .get(mControllers.taskbarActivityContext).getCachedTopTask(true);
                .get(mControllers.taskbarActivityContext).getCachedTopTask(true);
        return topTask.isHomeTask() || topTask.isRecentsTask();
        return topTask.isHomeTask() || topTask.isRecentsTask();
    }
    }

    @Nullable
    @Override
    protected TISBindHelper getTISBindHelper() {
        return mRecentsActivity.getTISBindHelper();
    }
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -147,7 +147,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
        KeyboardQuickSwitchTaskView taskView = (KeyboardQuickSwitchTaskView) layoutInflater.inflate(
        KeyboardQuickSwitchTaskView taskView = (KeyboardQuickSwitchTaskView) layoutInflater.inflate(
                R.layout.keyboard_quick_switch_taskview, mContent, false);
                R.layout.keyboard_quick_switch_taskview, mContent, false);
        taskView.setId(View.generateViewId());
        taskView.setId(View.generateViewId());
        taskView.setOnClickListener(v -> mViewCallbacks.launchTappedTask(index));
        taskView.setOnClickListener(v -> mViewCallbacks.launchTaskAt(index));


        LayoutParams lp = new LayoutParams(width, mTaskViewHeight);
        LayoutParams lp = new LayoutParams(width, mTaskViewHeight);
        // Create a left-to-right ordering of views (or right-to-left in RTL locales)
        // Create a left-to-right ordering of views (or right-to-left in RTL locales)
@@ -186,7 +186,7 @@ public class KeyboardQuickSwitchView extends ConstraintLayout {
        KeyboardQuickSwitchTaskView overviewButton =
        KeyboardQuickSwitchTaskView overviewButton =
                (KeyboardQuickSwitchTaskView) layoutInflater.inflate(
                (KeyboardQuickSwitchTaskView) layoutInflater.inflate(
                        R.layout.keyboard_quick_switch_overview, this, false);
                        R.layout.keyboard_quick_switch_overview, this, false);
        overviewButton.setOnClickListener(v -> mViewCallbacks.launchTappedTask(MAX_TASKS));
        overviewButton.setOnClickListener(v -> mViewCallbacks.launchTaskAt(MAX_TASKS));


        overviewButton.<TextView>findViewById(R.id.text).setText(overflowString);
        overviewButton.<TextView>findViewById(R.id.text).setText(overflowString);


+10 −6
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.animation.Animator;
import android.animation.Animator;
import android.app.ActivityOptions;
import android.app.ActivityOptions;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.AnimationUtils;
import android.window.RemoteTransition;
import android.window.RemoteTransition;


@@ -137,7 +136,6 @@ public class KeyboardQuickSwitchViewController {
        }
        }
        // Even with a valid index, this can be null if the user tries to quick switch before the
        // Even with a valid index, this can be null if the user tries to quick switch before the
        // views have been added in the KeyboardQuickSwitchView.
        // views have been added in the KeyboardQuickSwitchView.
        View taskView = mKeyboardQuickSwitchView.getTaskAt(index);
        GroupTask task = mControllerCallbacks.getTaskAt(index);
        GroupTask task = mControllerCallbacks.getTaskAt(index);
        if (task == null) {
        if (task == null) {
            return Math.max(0, index);
            return Math.max(0, index);
@@ -198,13 +196,18 @@ public class KeyboardQuickSwitchViewController {
                    && keyCode != KeyEvent.KEYCODE_DPAD_RIGHT
                    && keyCode != KeyEvent.KEYCODE_DPAD_RIGHT
                    && keyCode != KeyEvent.KEYCODE_DPAD_LEFT
                    && keyCode != KeyEvent.KEYCODE_DPAD_LEFT
                    && keyCode != KeyEvent.KEYCODE_GRAVE
                    && keyCode != KeyEvent.KEYCODE_GRAVE
                    && keyCode != KeyEvent.KEYCODE_ESCAPE) {
                    && keyCode != KeyEvent.KEYCODE_ESCAPE
                    && keyCode != KeyEvent.KEYCODE_ENTER) {
                return false;
                return false;
            }
            }
            if (keyCode == KeyEvent.KEYCODE_GRAVE || keyCode == KeyEvent.KEYCODE_ESCAPE) {
            if (keyCode == KeyEvent.KEYCODE_GRAVE || keyCode == KeyEvent.KEYCODE_ESCAPE) {
                closeQuickSwitchView(true);
                closeQuickSwitchView(true);
                return true;
                return true;
            }
            }
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                launchTaskAt(mCurrentFocusIndex);
                return true;
            }
            if (!allowTraversal) {
            if (!allowTraversal) {
                return false;
                return false;
            }
            }
@@ -234,9 +237,10 @@ public class KeyboardQuickSwitchViewController {
            mCurrentFocusIndex = index;
            mCurrentFocusIndex = index;
        }
        }


        void launchTappedTask(int index) {
        void launchTaskAt(int index) {
            KeyboardQuickSwitchViewController.this.launchTaskAt(index);
            mCurrentFocusIndex = Utilities.boundToRange(
            closeQuickSwitchView(true);
                    index, 0, mKeyboardQuickSwitchView.getChildCount() - 1);
            mControllers.taskbarActivityContext.launchKeyboardFocusedTask();
        }
        }


        void updateThumbnailInBackground(Task task, Consumer<ThumbnailData> callback) {
        void updateThumbnailInBackground(Task task, Consumer<ThumbnailData> callback) {
+7 −0
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.launcher3.util.OnboardingPrefs;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.TISBindHelper;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsView;


import java.io.PrintWriter;
import java.io.PrintWriter;
@@ -428,6 +429,12 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
        mTaskbarLauncherStateController.resetIconAlignment();
        mTaskbarLauncherStateController.resetIconAlignment();
    }
    }


    @Nullable
    @Override
    protected TISBindHelper getTISBindHelper() {
        return mLauncher.getTISBindHelper();
    }

    @Override
    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
    public void dumpLogs(String prefix, PrintWriter pw) {
        super.dumpLogs(prefix, pw);
        super.dumpLogs(prefix, pw);
Loading