Loading quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +2 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y_LONG_CLICK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH; Loading Loading @@ -90,7 +89,6 @@ public class NavbarButtonsViewController { private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE; private View.OnLongClickListener mA11yLongClickListener; private final ArrayList<StatePropertyHolder> mPropertyHolders = new ArrayList<>(); private final ArrayList<ImageView> mAllButtons = new ArrayList<>(); private int mState; Loading Loading @@ -142,11 +140,6 @@ public class NavbarButtonsViewController { mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize; mNavButtonTranslationYMultiplier.value = 1; mA11yLongClickListener = view -> { mControllers.navButtonController.onButtonClick(BUTTON_A11Y_LONG_CLICK); return true; }; mPropertyHolders.add(new StatePropertyHolder( mControllers.taskbarViewController.getTaskbarIconAlpha() .getProperty(ALPHA_INDEX_IME), Loading Loading @@ -285,7 +278,6 @@ public class NavbarButtonsViewController { mPropertyHolders.add(new StatePropertyHolder(mA11yButton, flags -> (flags & FLAG_A11Y_VISIBLE) != 0 && (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)); mA11yButton.setOnLongClickListener(mA11yLongClickListener); } private void parseSystemUiFlags(int sysUiStateFlags) { Loading Loading @@ -441,6 +433,8 @@ public class NavbarButtonsViewController { ImageView buttonView = addButton(parent, id, layoutId); buttonView.setImageResource(drawableId); buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType)); buttonView.setOnLongClickListener(view -> navButtonController.onButtonLongClick(buttonType)); return buttonView; } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +27 −9 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.launcher3.taskbar; import static android.view.Display.DEFAULT_DISPLAY; import android.view.inputmethod.InputMethodManager; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_KEY; import android.os.Bundle; import androidx.annotation.IntDef; Loading @@ -35,11 +37,9 @@ import java.lang.annotation.RetentionPolicy; * Controller for 3 button mode in the taskbar. * Handles all the functionality of the various buttons, making/routing the right calls into * launcher or sysui/system. * * TODO: Create callbacks to hook into UI layer since state will change for more context buttons/ * assistant invocation. */ public class TaskbarNavButtonController { @Retention(RetentionPolicy.SOURCE) @IntDef(value = { BUTTON_BACK, Loading @@ -47,7 +47,6 @@ public class TaskbarNavButtonController { BUTTON_RECENTS, BUTTON_IME_SWITCH, BUTTON_A11Y, BUTTON_A11Y_LONG_CLICK }) public @interface TaskbarButton {} Loading @@ -57,7 +56,6 @@ public class TaskbarNavButtonController { static final int BUTTON_RECENTS = BUTTON_HOME << 1; static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1; static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1; static final int BUTTON_A11Y_LONG_CLICK = BUTTON_A11Y << 1; private final TouchInteractionService mService; Loading @@ -82,9 +80,22 @@ public class TaskbarNavButtonController { case BUTTON_A11Y: notifyImeClick(false /* longClick */); break; case BUTTON_A11Y_LONG_CLICK: } } public boolean onButtonLongClick(@TaskbarButton int buttonType) { switch (buttonType) { case BUTTON_HOME: startAssistant(); return true; case BUTTON_A11Y: notifyImeClick(true /* longClick */); break; return true; case BUTTON_BACK: case BUTTON_IME_SWITCH: case BUTTON_RECENTS: default: return false; } } Loading Loading @@ -113,4 +124,11 @@ public class TaskbarNavButtonController { systemUiProxy.notifyAccessibilityButtonClicked(mService.getDisplayId()); } } private void startAssistant() { Bundle args = new Bundle(); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate(); systemUiProxy.startAssistant(args); } } quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_GESTURE; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_KEY; import static com.android.launcher3.Utilities.squaredHypot; import android.animation.Animator; Loading Loading @@ -64,8 +66,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer { private static final String OPA_BUNDLE_TRIGGER = "triggered_by"; // From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto. private static final int OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE = 83; private static final String INVOCATION_TYPE_KEY = "invocation_type"; private static final int INVOCATION_TYPE_GESTURE = 1; private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); Loading Loading
quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +2 −8 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y_LONG_CLICK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_BACK; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME; import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH; Loading Loading @@ -90,7 +89,6 @@ public class NavbarButtonsViewController { private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE; private View.OnLongClickListener mA11yLongClickListener; private final ArrayList<StatePropertyHolder> mPropertyHolders = new ArrayList<>(); private final ArrayList<ImageView> mAllButtons = new ArrayList<>(); private int mState; Loading Loading @@ -142,11 +140,6 @@ public class NavbarButtonsViewController { mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize; mNavButtonTranslationYMultiplier.value = 1; mA11yLongClickListener = view -> { mControllers.navButtonController.onButtonClick(BUTTON_A11Y_LONG_CLICK); return true; }; mPropertyHolders.add(new StatePropertyHolder( mControllers.taskbarViewController.getTaskbarIconAlpha() .getProperty(ALPHA_INDEX_IME), Loading Loading @@ -285,7 +278,6 @@ public class NavbarButtonsViewController { mPropertyHolders.add(new StatePropertyHolder(mA11yButton, flags -> (flags & FLAG_A11Y_VISIBLE) != 0 && (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)); mA11yButton.setOnLongClickListener(mA11yLongClickListener); } private void parseSystemUiFlags(int sysUiStateFlags) { Loading Loading @@ -441,6 +433,8 @@ public class NavbarButtonsViewController { ImageView buttonView = addButton(parent, id, layoutId); buttonView.setImageResource(drawableId); buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType)); buttonView.setOnLongClickListener(view -> navButtonController.onButtonLongClick(buttonType)); return buttonView; } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarNavButtonController.java +27 −9 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.launcher3.taskbar; import static android.view.Display.DEFAULT_DISPLAY; import android.view.inputmethod.InputMethodManager; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_KEY; import android.os.Bundle; import androidx.annotation.IntDef; Loading @@ -35,11 +37,9 @@ import java.lang.annotation.RetentionPolicy; * Controller for 3 button mode in the taskbar. * Handles all the functionality of the various buttons, making/routing the right calls into * launcher or sysui/system. * * TODO: Create callbacks to hook into UI layer since state will change for more context buttons/ * assistant invocation. */ public class TaskbarNavButtonController { @Retention(RetentionPolicy.SOURCE) @IntDef(value = { BUTTON_BACK, Loading @@ -47,7 +47,6 @@ public class TaskbarNavButtonController { BUTTON_RECENTS, BUTTON_IME_SWITCH, BUTTON_A11Y, BUTTON_A11Y_LONG_CLICK }) public @interface TaskbarButton {} Loading @@ -57,7 +56,6 @@ public class TaskbarNavButtonController { static final int BUTTON_RECENTS = BUTTON_HOME << 1; static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1; static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1; static final int BUTTON_A11Y_LONG_CLICK = BUTTON_A11Y << 1; private final TouchInteractionService mService; Loading @@ -82,9 +80,22 @@ public class TaskbarNavButtonController { case BUTTON_A11Y: notifyImeClick(false /* longClick */); break; case BUTTON_A11Y_LONG_CLICK: } } public boolean onButtonLongClick(@TaskbarButton int buttonType) { switch (buttonType) { case BUTTON_HOME: startAssistant(); return true; case BUTTON_A11Y: notifyImeClick(true /* longClick */); break; return true; case BUTTON_BACK: case BUTTON_IME_SWITCH: case BUTTON_RECENTS: default: return false; } } Loading Loading @@ -113,4 +124,11 @@ public class TaskbarNavButtonController { systemUiProxy.notifyAccessibilityButtonClicked(mService.getDisplayId()); } } private void startAssistant() { Bundle args = new Bundle(); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS); SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate(); systemUiProxy.startAssistant(args); } }
quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java +2 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_GESTURE; import static com.android.internal.app.AssistUtils.INVOCATION_TYPE_KEY; import static com.android.launcher3.Utilities.squaredHypot; import android.animation.Animator; Loading Loading @@ -64,8 +66,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer { private static final String OPA_BUNDLE_TRIGGER = "triggered_by"; // From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto. private static final int OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE = 83; private static final String INVOCATION_TYPE_KEY = "invocation_type"; private static final int INVOCATION_TYPE_GESTURE = 1; private final PointF mDownPos = new PointF(); private final PointF mLastPos = new PointF(); Loading