Snap for 7940976 from 0b7ed895e7
to sc-d2-release
Change-Id: I218e24a45ffb468b4a85942cc790335de8e0d59d
This commit is contained in:
commit
947154cba2
|
@ -16,7 +16,7 @@
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:color="@color/taskbar_icon_selection_ripple">
|
android:color="@color/taskbar_nav_icon_selection_ripple">
|
||||||
<item android:id="@android:id/mask">
|
<item android:id="@android:id/mask">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@android:color/white" />
|
<solid android:color="@android:color/white" />
|
||||||
|
|
|
@ -15,7 +15,10 @@
|
||||||
-->
|
-->
|
||||||
<ImageView
|
<ImageView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="@dimen/taskbar_nav_buttons_size"
|
android:layout_width="@dimen/taskbar_nav_buttons_size"
|
||||||
android:layout_height="@dimen/taskbar_nav_buttons_size"
|
android:layout_height="@dimen/taskbar_nav_buttons_size"
|
||||||
android:background="@drawable/taskbar_icon_click_feedback_roundrect"
|
android:background="@drawable/taskbar_icon_click_feedback_roundrect"
|
||||||
android:scaleType="center"/>
|
android:scaleType="center"
|
||||||
|
android:tint="@color/taskbar_nav_icon_light_color"
|
||||||
|
tools:ignore="UseAppTint" />
|
|
@ -25,14 +25,14 @@
|
||||||
|
|
||||||
<!-- Taskbar -->
|
<!-- Taskbar -->
|
||||||
<color name="taskbar_background">@color/overview_scrim_dark</color>
|
<color name="taskbar_background">@color/overview_scrim_dark</color>
|
||||||
<color name="taskbar_icon_selection_ripple">#E0E0E0</color>
|
<color name="taskbar_nav_icon_selection_ripple">#E0E0E0</color>
|
||||||
|
<color name="taskbar_nav_icon_light_color">#ffffff</color>
|
||||||
|
<!-- The dark navigation button color is only used in the rare cases that taskbar isn't drawing
|
||||||
|
its background and the underlying app has requested dark buttons. -->
|
||||||
|
<color name="taskbar_nav_icon_dark_color">#99000000</color>
|
||||||
<color name="taskbar_stashed_handle_light_color">#EBffffff</color>
|
<color name="taskbar_stashed_handle_light_color">#EBffffff</color>
|
||||||
<color name="taskbar_stashed_handle_dark_color">#99000000</color>
|
<color name="taskbar_stashed_handle_dark_color">#99000000</color>
|
||||||
|
|
||||||
<color name="rotation_button_light_color">#FFF</color>
|
|
||||||
<color name="rotation_button_dark_color">#99000000</color>
|
|
||||||
|
|
||||||
<!-- Gesture navigation tutorial -->
|
<!-- Gesture navigation tutorial -->
|
||||||
<color name="gesture_tutorial_back_arrow_color">#FFFFFFFF</color>
|
<color name="gesture_tutorial_back_arrow_color">#FFFFFFFF</color>
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package com.android.launcher3.taskbar;
|
package com.android.launcher3.taskbar;
|
||||||
|
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
|
|
||||||
|
|
||||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
|
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;
|
||||||
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_BACK;
|
||||||
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
|
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_HOME;
|
||||||
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH;
|
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_IME_SWITCH;
|
||||||
|
@ -36,11 +33,11 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_N
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||||
|
|
||||||
|
import android.animation.ArgbEvaluator;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.annotation.DrawableRes;
|
import android.annotation.DrawableRes;
|
||||||
import android.annotation.IdRes;
|
import android.annotation.IdRes;
|
||||||
import android.annotation.LayoutRes;
|
import android.annotation.LayoutRes;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
|
@ -92,9 +89,8 @@ public class NavbarButtonsViewController {
|
||||||
|
|
||||||
private static final int MASK_IME_SWITCHER_VISIBLE = FLAG_SWITCHER_SUPPORTED | FLAG_IME_VISIBLE;
|
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<StatePropertyHolder> mPropertyHolders = new ArrayList<>();
|
||||||
private final ArrayList<View> mAllButtons = new ArrayList<>();
|
private final ArrayList<ImageView> mAllButtons = new ArrayList<>();
|
||||||
private int mState;
|
private int mState;
|
||||||
|
|
||||||
private final TaskbarActivityContext mContext;
|
private final TaskbarActivityContext mContext;
|
||||||
|
@ -103,11 +99,17 @@ public class NavbarButtonsViewController {
|
||||||
// Used for IME+A11Y buttons
|
// Used for IME+A11Y buttons
|
||||||
private final ViewGroup mEndContextualContainer;
|
private final ViewGroup mEndContextualContainer;
|
||||||
private final ViewGroup mStartContextualContainer;
|
private final ViewGroup mStartContextualContainer;
|
||||||
|
private final int mLightIconColor;
|
||||||
|
private final int mDarkIconColor;
|
||||||
|
|
||||||
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
|
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
|
||||||
this::updateNavButtonTranslationY);
|
this::updateNavButtonTranslationY);
|
||||||
private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat(
|
private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat(
|
||||||
this::updateNavButtonTranslationY);
|
this::updateNavButtonTranslationY);
|
||||||
|
private final AnimatedFloat mTaskbarNavButtonDarkIntensity = new AnimatedFloat(
|
||||||
|
this::updateNavButtonDarkIntensity);
|
||||||
|
private final AnimatedFloat mNavButtonDarkIntensityMultiplier = new AnimatedFloat(
|
||||||
|
this::updateNavButtonDarkIntensity);
|
||||||
private final RotationButtonListener mRotationButtonListener = new RotationButtonListener();
|
private final RotationButtonListener mRotationButtonListener = new RotationButtonListener();
|
||||||
|
|
||||||
private final Rect mFloatingRotationButtonBounds = new Rect();
|
private final Rect mFloatingRotationButtonBounds = new Rect();
|
||||||
|
@ -125,6 +127,9 @@ public class NavbarButtonsViewController {
|
||||||
mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons);
|
mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons);
|
||||||
mEndContextualContainer = mNavButtonsView.findViewById(R.id.end_contextual_buttons);
|
mEndContextualContainer = mNavButtonsView.findViewById(R.id.end_contextual_buttons);
|
||||||
mStartContextualContainer = mNavButtonsView.findViewById(R.id.start_contextual_buttons);
|
mStartContextualContainer = mNavButtonsView.findViewById(R.id.start_contextual_buttons);
|
||||||
|
|
||||||
|
mLightIconColor = context.getColor(R.color.taskbar_nav_icon_light_color);
|
||||||
|
mDarkIconColor = context.getColor(R.color.taskbar_nav_icon_dark_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,11 +140,6 @@ public class NavbarButtonsViewController {
|
||||||
mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
|
mNavButtonsView.getLayoutParams().height = mContext.getDeviceProfile().taskbarSize;
|
||||||
mNavButtonTranslationYMultiplier.value = 1;
|
mNavButtonTranslationYMultiplier.value = 1;
|
||||||
|
|
||||||
mA11yLongClickListener = view -> {
|
|
||||||
mControllers.navButtonController.onButtonClick(BUTTON_A11Y_LONG_CLICK);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
mPropertyHolders.add(new StatePropertyHolder(
|
mPropertyHolders.add(new StatePropertyHolder(
|
||||||
mControllers.taskbarViewController.getTaskbarIconAlpha()
|
mControllers.taskbarViewController.getTaskbarIconAlpha()
|
||||||
.getProperty(ALPHA_INDEX_IME),
|
.getProperty(ALPHA_INDEX_IME),
|
||||||
|
@ -278,7 +278,6 @@ public class NavbarButtonsViewController {
|
||||||
mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
|
mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
|
||||||
flags -> (flags & FLAG_A11Y_VISIBLE) != 0
|
flags -> (flags & FLAG_A11Y_VISIBLE) != 0
|
||||||
&& (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
|
&& (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
|
||||||
mA11yButton.setOnLongClickListener(mA11yLongClickListener);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseSystemUiFlags(int sysUiStateFlags) {
|
private void parseSystemUiFlags(int sysUiStateFlags) {
|
||||||
|
@ -379,6 +378,16 @@ public class NavbarButtonsViewController {
|
||||||
return mTaskbarNavButtonTranslationY;
|
return mTaskbarNavButtonTranslationY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Use to set the dark intensity for the all nav+contextual buttons */
|
||||||
|
public AnimatedFloat getTaskbarNavButtonDarkIntensity() {
|
||||||
|
return mTaskbarNavButtonDarkIntensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Use to determine whether to use the dark intensity requested by the underlying app */
|
||||||
|
public AnimatedFloat getNavButtonDarkIntensityMultiplier() {
|
||||||
|
return mNavButtonDarkIntensityMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does not call {@link #applyState()}. Don't forget to!
|
* Does not call {@link #applyState()}. Don't forget to!
|
||||||
*/
|
*/
|
||||||
|
@ -402,6 +411,16 @@ public class NavbarButtonsViewController {
|
||||||
* mNavButtonTranslationYMultiplier.value);
|
* mNavButtonTranslationYMultiplier.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateNavButtonDarkIntensity() {
|
||||||
|
float darkIntensity = mTaskbarNavButtonDarkIntensity.value
|
||||||
|
* mNavButtonDarkIntensityMultiplier.value;
|
||||||
|
int iconColor = (int) ArgbEvaluator.getInstance().evaluate(darkIntensity, mLightIconColor,
|
||||||
|
mDarkIconColor);
|
||||||
|
for (ImageView button : mAllButtons) {
|
||||||
|
button.setImageTintList(ColorStateList.valueOf(iconColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
|
||||||
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
|
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
|
||||||
return addButton(drawableId, buttonType, parent, navButtonController, id,
|
return addButton(drawableId, buttonType, parent, navButtonController, id,
|
||||||
|
@ -414,6 +433,8 @@ public class NavbarButtonsViewController {
|
||||||
ImageView buttonView = addButton(parent, id, layoutId);
|
ImageView buttonView = addButton(parent, id, layoutId);
|
||||||
buttonView.setImageResource(drawableId);
|
buttonView.setImageResource(drawableId);
|
||||||
buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType));
|
buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType));
|
||||||
|
buttonView.setOnLongClickListener(view ->
|
||||||
|
navButtonController.onButtonLongClick(buttonType));
|
||||||
return buttonView;
|
return buttonView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||||
buttonController,
|
buttonController,
|
||||||
new NavbarButtonsViewController(this, navButtonsView),
|
new NavbarButtonsViewController(this, navButtonsView),
|
||||||
new RotationButtonController(this,
|
new RotationButtonController(this,
|
||||||
c.getColor(R.color.rotation_button_light_color),
|
c.getColor(R.color.taskbar_nav_icon_light_color),
|
||||||
c.getColor(R.color.rotation_button_dark_color),
|
c.getColor(R.color.taskbar_nav_icon_dark_color),
|
||||||
R.drawable.ic_sysbar_rotate_button_ccw_start_0,
|
R.drawable.ic_sysbar_rotate_button_ccw_start_0,
|
||||||
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
|
R.drawable.ic_sysbar_rotate_button_ccw_start_90,
|
||||||
R.drawable.ic_sysbar_rotate_button_cw_start_0,
|
R.drawable.ic_sysbar_rotate_button_cw_start_0,
|
||||||
|
@ -394,6 +394,11 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||||
mControllers.rotationButtonController.onBehaviorChanged(displayId, behavior);
|
mControllers.rotationButtonController.onBehaviorChanged(displayId, behavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onNavButtonsDarkIntensityChanged(float darkIntensity) {
|
||||||
|
mControllers.navbarButtonsViewController.getTaskbarNavButtonDarkIntensity()
|
||||||
|
.updateValue(darkIntensity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the TaskbarContainer to MATCH_PARENT vs original Taskbar size.
|
* Updates the TaskbarContainer to MATCH_PARENT vs original Taskbar size.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,6 +52,9 @@ public class TaskbarDragLayerController {
|
||||||
|
|
||||||
// Initialized in init.
|
// Initialized in init.
|
||||||
private TaskbarControllers mControllers;
|
private TaskbarControllers mControllers;
|
||||||
|
private AnimatedFloat mNavButtonDarkIntensityMultiplier;
|
||||||
|
|
||||||
|
private float mLastSetBackgroundAlpha;
|
||||||
|
|
||||||
public TaskbarDragLayerController(TaskbarActivityContext activity,
|
public TaskbarDragLayerController(TaskbarActivityContext activity,
|
||||||
TaskbarDragLayer taskbarDragLayer) {
|
TaskbarDragLayer taskbarDragLayer) {
|
||||||
|
@ -65,6 +68,9 @@ public class TaskbarDragLayerController {
|
||||||
mControllers = controllers;
|
mControllers = controllers;
|
||||||
mTaskbarDragLayer.init(new TaskbarDragLayerCallbacks());
|
mTaskbarDragLayer.init(new TaskbarDragLayerCallbacks());
|
||||||
|
|
||||||
|
mNavButtonDarkIntensityMultiplier = mControllers.navbarButtonsViewController
|
||||||
|
.getNavButtonDarkIntensityMultiplier();
|
||||||
|
|
||||||
mBgTaskbar.value = 1;
|
mBgTaskbar.value = 1;
|
||||||
mKeyguardBgTaskbar.value = 1;
|
mKeyguardBgTaskbar.value = 1;
|
||||||
mNotificationShadeBgTaskbar.value = 1;
|
mNotificationShadeBgTaskbar.value = 1;
|
||||||
|
@ -114,13 +120,22 @@ public class TaskbarDragLayerController {
|
||||||
final float bgNavbar = mBgNavbar.value;
|
final float bgNavbar = mBgNavbar.value;
|
||||||
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
|
final float bgTaskbar = mBgTaskbar.value * mKeyguardBgTaskbar.value
|
||||||
* mNotificationShadeBgTaskbar.value;
|
* mNotificationShadeBgTaskbar.value;
|
||||||
mTaskbarDragLayer.setTaskbarBackgroundAlpha(
|
mLastSetBackgroundAlpha = mBgOverride.value * Math.max(bgNavbar, bgTaskbar);
|
||||||
mBgOverride.value * Math.max(bgNavbar, bgTaskbar)
|
mTaskbarDragLayer.setTaskbarBackgroundAlpha(mLastSetBackgroundAlpha);
|
||||||
);
|
|
||||||
|
updateNavBarDarkIntensityMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBackgroundOffset() {
|
private void updateBackgroundOffset() {
|
||||||
mTaskbarDragLayer.setTaskbarBackgroundOffset(mBgOffset.value);
|
mTaskbarDragLayer.setTaskbarBackgroundOffset(mBgOffset.value);
|
||||||
|
|
||||||
|
updateNavBarDarkIntensityMultiplier();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateNavBarDarkIntensityMultiplier() {
|
||||||
|
// Zero out the app-requested dark intensity when we're drawing our own background.
|
||||||
|
float effectiveBgAlpha = mLastSetBackgroundAlpha * (1 - mBgOffset.value);
|
||||||
|
mNavButtonDarkIntensityMultiplier.updateValue(1 - effectiveBgAlpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,6 @@ import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.LauncherAppState;
|
import com.android.launcher3.LauncherAppState;
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
import com.android.launcher3.statemanager.StatefulActivity;
|
import com.android.launcher3.statemanager.StatefulActivity;
|
||||||
import com.android.launcher3.testing.TestProtocol;
|
|
||||||
import com.android.launcher3.util.DisplayController;
|
import com.android.launcher3.util.DisplayController;
|
||||||
import com.android.launcher3.util.DisplayController.Info;
|
import com.android.launcher3.util.DisplayController.Info;
|
||||||
import com.android.launcher3.util.SettingsCache;
|
import com.android.launcher3.util.SettingsCache;
|
||||||
|
@ -269,6 +268,12 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onNavButtonsDarkIntensityChanged(float darkIntensity) {
|
||||||
|
if (mTaskbarActivityContext != null) {
|
||||||
|
mTaskbarActivityContext.onNavButtonsDarkIntensityChanged(darkIntensity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the manager is no longer needed
|
* Called when the manager is no longer needed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,9 +16,11 @@
|
||||||
|
|
||||||
package com.android.launcher3.taskbar;
|
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;
|
import androidx.annotation.IntDef;
|
||||||
|
|
||||||
|
@ -35,11 +37,9 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
* Controller for 3 button mode in the taskbar.
|
* Controller for 3 button mode in the taskbar.
|
||||||
* Handles all the functionality of the various buttons, making/routing the right calls into
|
* Handles all the functionality of the various buttons, making/routing the right calls into
|
||||||
* launcher or sysui/system.
|
* 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 {
|
public class TaskbarNavButtonController {
|
||||||
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef(value = {
|
@IntDef(value = {
|
||||||
BUTTON_BACK,
|
BUTTON_BACK,
|
||||||
|
@ -47,7 +47,6 @@ public class TaskbarNavButtonController {
|
||||||
BUTTON_RECENTS,
|
BUTTON_RECENTS,
|
||||||
BUTTON_IME_SWITCH,
|
BUTTON_IME_SWITCH,
|
||||||
BUTTON_A11Y,
|
BUTTON_A11Y,
|
||||||
BUTTON_A11Y_LONG_CLICK
|
|
||||||
})
|
})
|
||||||
|
|
||||||
public @interface TaskbarButton {}
|
public @interface TaskbarButton {}
|
||||||
|
@ -57,7 +56,6 @@ public class TaskbarNavButtonController {
|
||||||
static final int BUTTON_RECENTS = BUTTON_HOME << 1;
|
static final int BUTTON_RECENTS = BUTTON_HOME << 1;
|
||||||
static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1;
|
static final int BUTTON_IME_SWITCH = BUTTON_RECENTS << 1;
|
||||||
static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1;
|
static final int BUTTON_A11Y = BUTTON_IME_SWITCH << 1;
|
||||||
static final int BUTTON_A11Y_LONG_CLICK = BUTTON_A11Y << 1;
|
|
||||||
|
|
||||||
private final TouchInteractionService mService;
|
private final TouchInteractionService mService;
|
||||||
|
|
||||||
|
@ -82,9 +80,22 @@ public class TaskbarNavButtonController {
|
||||||
case BUTTON_A11Y:
|
case BUTTON_A11Y:
|
||||||
notifyImeClick(false /* longClick */);
|
notifyImeClick(false /* longClick */);
|
||||||
break;
|
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 */);
|
notifyImeClick(true /* longClick */);
|
||||||
break;
|
return true;
|
||||||
|
case BUTTON_BACK:
|
||||||
|
case BUTTON_IME_SWITCH:
|
||||||
|
case BUTTON_RECENTS:
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,4 +124,11 @@ public class TaskbarNavButtonController {
|
||||||
systemUiProxy.notifyAccessibilityButtonClicked(mService.getDisplayId());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,6 +289,12 @@ public class TouchInteractionService extends Service
|
||||||
.onSystemBarAttributesChanged(displayId, behavior));
|
.onSystemBarAttributesChanged(displayId, behavior));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNavButtonsDarkIntensityChanged(float darkIntensity) {
|
||||||
|
executeForTaskbarManager(() -> mTaskbarManager
|
||||||
|
.onNavButtonsDarkIntensityChanged(darkIntensity));
|
||||||
|
}
|
||||||
|
|
||||||
private void executeForTaskbarManager(final Runnable r) {
|
private void executeForTaskbarManager(final Runnable r) {
|
||||||
MAIN_EXECUTOR.execute(() -> {
|
MAIN_EXECUTOR.execute(() -> {
|
||||||
if (mTaskbarManager == null) {
|
if (mTaskbarManager == null) {
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
*/
|
*/
|
||||||
package com.android.quickstep;
|
package com.android.quickstep;
|
||||||
|
|
||||||
|
import android.graphics.HardwareRenderer;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewRootImpl;
|
||||||
|
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.systemui.shared.system.ViewRootImplCompat;
|
import com.android.systemui.shared.system.ViewRootImplCompat;
|
||||||
|
@ -45,9 +47,9 @@ public class ViewUtils {
|
||||||
return new FrameHandler(view, onFinishRunnable, canceled).schedule();
|
return new FrameHandler(view, onFinishRunnable, canceled).schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class FrameHandler implements LongConsumer {
|
private static class FrameHandler implements HardwareRenderer.FrameDrawingCallback {
|
||||||
|
|
||||||
final ViewRootImplCompat mViewRoot;
|
final ViewRootImpl mViewRoot;
|
||||||
final Runnable mFinishCallback;
|
final Runnable mFinishCallback;
|
||||||
final BooleanSupplier mCancelled;
|
final BooleanSupplier mCancelled;
|
||||||
final Handler mHandler;
|
final Handler mHandler;
|
||||||
|
@ -55,14 +57,14 @@ public class ViewUtils {
|
||||||
int mDeferFrameCount = 1;
|
int mDeferFrameCount = 1;
|
||||||
|
|
||||||
FrameHandler(View view, Runnable finishCallback, BooleanSupplier cancelled) {
|
FrameHandler(View view, Runnable finishCallback, BooleanSupplier cancelled) {
|
||||||
mViewRoot = new ViewRootImplCompat(view);
|
mViewRoot = view.getViewRootImpl();
|
||||||
mFinishCallback = finishCallback;
|
mFinishCallback = finishCallback;
|
||||||
mCancelled = cancelled;
|
mCancelled = cancelled;
|
||||||
mHandler = new Handler();
|
mHandler = new Handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void accept(long l) {
|
public void onFrameDraw(long frame) {
|
||||||
Utilities.postAsyncCallback(mHandler, this::onFrame);
|
Utilities.postAsyncCallback(mHandler, this::onFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +85,7 @@ public class ViewUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean schedule() {
|
private boolean schedule() {
|
||||||
if (mViewRoot.isValid()) {
|
if (mViewRoot.getView() != null) {
|
||||||
mViewRoot.registerRtFrameCallback(this);
|
mViewRoot.registerRtFrameCallback(this);
|
||||||
mViewRoot.getView().invalidate();
|
mViewRoot.getView().invalidate();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -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_POINTER_UP;
|
||||||
import static android.view.MotionEvent.ACTION_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 static com.android.launcher3.Utilities.squaredHypot;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
|
@ -64,8 +66,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
|
||||||
private static final String OPA_BUNDLE_TRIGGER = "triggered_by";
|
private static final String OPA_BUNDLE_TRIGGER = "triggered_by";
|
||||||
// From //java/com/google/android/apps/gsa/assistant/shared/proto/opa_trigger.proto.
|
// 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 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 mDownPos = new PointF();
|
||||||
private final PointF mLastPos = new PointF();
|
private final PointF mLastPos = new PointF();
|
||||||
|
|
|
@ -22,10 +22,10 @@ import android.os.Message;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.SurfaceControl.Transaction;
|
import android.view.SurfaceControl.Transaction;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewRootImpl;
|
||||||
|
|
||||||
import com.android.quickstep.RemoteAnimationTargets.ReleaseCheck;
|
import com.android.quickstep.RemoteAnimationTargets.ReleaseCheck;
|
||||||
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat.SurfaceParams;
|
||||||
import com.android.systemui.shared.system.ViewRootImplCompat;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||||
private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
|
private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
|
||||||
|
|
||||||
private final SurfaceControl mBarrierSurfaceControl;
|
private final SurfaceControl mBarrierSurfaceControl;
|
||||||
private final ViewRootImplCompat mTargetViewRootImpl;
|
private final ViewRootImpl mTargetViewRootImpl;
|
||||||
private final Handler mApplyHandler;
|
private final Handler mApplyHandler;
|
||||||
|
|
||||||
private int mLastSequenceNumber = 0;
|
private int mLastSequenceNumber = 0;
|
||||||
|
@ -50,8 +50,8 @@ public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||||
* @param targetView The view in the surface that acts as synchronization anchor.
|
* @param targetView The view in the surface that acts as synchronization anchor.
|
||||||
*/
|
*/
|
||||||
public SurfaceTransactionApplier(View targetView) {
|
public SurfaceTransactionApplier(View targetView) {
|
||||||
mTargetViewRootImpl = new ViewRootImplCompat(targetView);
|
mTargetViewRootImpl = targetView.getViewRootImpl();
|
||||||
mBarrierSurfaceControl = mTargetViewRootImpl.getRenderSurfaceControl();
|
mBarrierSurfaceControl = mTargetViewRootImpl.getSurfaceControl();
|
||||||
mApplyHandler = new Handler(this::onApplyMessage);
|
mApplyHandler = new Handler(this::onApplyMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ public class SurfaceTransactionApplier extends ReleaseCheck {
|
||||||
if (targetView == null) {
|
if (targetView == null) {
|
||||||
// No target view, no applier
|
// No target view, no applier
|
||||||
callback.accept(null);
|
callback.accept(null);
|
||||||
} else if (new ViewRootImplCompat(targetView).isValid()) {
|
} else if (targetView.isAttachedToWindow()) {
|
||||||
// Already attached, we're good to go
|
// Already attached, we're good to go
|
||||||
callback.accept(new SurfaceTransactionApplier(targetView));
|
callback.accept(new SurfaceTransactionApplier(targetView));
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue