Merge branch 'android15-release' into merge-aosp15
This commit is contained in:
commit
eeb7416bfe
1401 files changed
+86072
-39248
No files matched your search
@@ -23,13 +23,14 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
|
||||
import static com.android.launcher3.LauncherAnimUtils.ROTATION_DRAWABLE_PERCENT;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
|
||||
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.SYSUI_SURFACE_PROGRESS_INDEX;
|
||||
import static com.android.launcher3.taskbar.TaskbarManager.isPhoneButtonNavMode;
|
||||
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_A11Y;
|
||||
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;
|
||||
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_RECENTS;
|
||||
import static com.android.launcher3.taskbar.TaskbarNavButtonController.BUTTON_SPACE;
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_KEYGUARD;
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_SMALL_SCREEN;
|
||||
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
|
||||
@@ -44,6 +45,7 @@ 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_QUICK_SETTINGS_EXPANDED;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SHORTCUT_HELPER_SHOWING;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
|
||||
import android.animation.ArgbEvaluator;
|
||||
@@ -51,6 +53,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.annotation.DrawableRes;
|
||||
import android.annotation.IdRes;
|
||||
import android.annotation.LayoutRes;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo.Config;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
@@ -60,6 +63,7 @@ import android.graphics.Rect;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.Region.Op;
|
||||
import android.graphics.drawable.AnimatedVectorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.PaintDrawable;
|
||||
import android.graphics.drawable.RotateDrawable;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
@@ -77,6 +81,9 @@ import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Space;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherAnimUtils;
|
||||
@@ -87,16 +94,19 @@ import com.android.launcher3.anim.AnimatedFloat;
|
||||
import com.android.launcher3.taskbar.TaskbarNavButtonController.TaskbarButton;
|
||||
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory;
|
||||
import com.android.launcher3.taskbar.navbutton.NavButtonLayoutFactory.NavButtonLayoutter;
|
||||
import com.android.launcher3.taskbar.navbutton.NearestTouchFrame;
|
||||
import com.android.launcher3.util.DimensionUtils;
|
||||
import com.android.launcher3.util.DisplayController;
|
||||
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.launcher3.util.window.WindowManagerProxy;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.systemui.shared.navigationbar.KeyButtonRipple;
|
||||
import com.android.systemui.shared.rotation.FloatingRotationButton;
|
||||
import com.android.systemui.shared.rotation.RotationButton;
|
||||
import com.android.systemui.shared.rotation.RotationButtonController;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -125,6 +135,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
private static final int FLAG_VOICE_INTERACTION_WINDOW_SHOWING = 1 << 12;
|
||||
private static final int FLAG_SMALL_SCREEN = 1 << 13;
|
||||
private static final int FLAG_SLIDE_IN_VIEW_VISIBLE = 1 << 14;
|
||||
private static final int FLAG_KEYBOARD_SHORTCUT_HELPER_SHOWING = 1 << 15;
|
||||
|
||||
/**
|
||||
* Flags where a UI could be over Taskbar surfaces, so the color override should
|
||||
@@ -135,6 +146,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
private static final String NAV_BUTTONS_SEPARATE_WINDOW_TITLE = "Taskbar Nav Buttons";
|
||||
|
||||
private static final double SQUARE_ASPECT_RATIO_BOTTOM_BOUND = 0.95;
|
||||
private static final double SQUARE_ASPECT_RATIO_UPPER_BOUND = 1.05;
|
||||
|
||||
public static final int ALPHA_INDEX_IMMERSIVE_MODE = 0;
|
||||
public static final int ALPHA_INDEX_KEYGUARD_OR_DISABLE = 1;
|
||||
public static final int ALPHA_INDEX_SUW = 2;
|
||||
@@ -145,7 +159,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
private int mState;
|
||||
|
||||
private final TaskbarActivityContext mContext;
|
||||
private final FrameLayout mNavButtonsView;
|
||||
private final @Nullable Context mNavigationBarPanelContext;
|
||||
private final WindowManagerProxy mWindowManagerProxy;
|
||||
private final NearestTouchFrame mNavButtonsView;
|
||||
private final LinearLayout mNavButtonContainer;
|
||||
// Used for IME+A11Y buttons
|
||||
private final ViewGroup mEndContextualContainer;
|
||||
@@ -189,12 +205,14 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
private TaskbarControllers mControllers;
|
||||
private boolean mIsImeRenderingNavButtons;
|
||||
private ImageView mA11yButton;
|
||||
private int mSysuiStateFlags;
|
||||
@SystemUiStateFlags
|
||||
private long mSysuiStateFlags;
|
||||
private ImageView mBackButton;
|
||||
private ImageView mHomeButton;
|
||||
private MultiValueAlpha mBackButtonAlpha;
|
||||
private MultiValueAlpha mHomeButtonAlpha;
|
||||
private FloatingRotationButton mFloatingRotationButton;
|
||||
private ImageView mImeSwitcherButton;
|
||||
|
||||
// Variables for moving nav buttons to a separate window above IME
|
||||
private boolean mAreNavButtonsInSeparateWindow = false;
|
||||
@@ -202,10 +220,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
private final ViewTreeObserver.OnComputeInternalInsetsListener mSeparateWindowInsetsComputer = this::onComputeInsetsForSeparateWindow;
|
||||
private final RecentsHitboxExtender mHitboxExtender = new RecentsHitboxExtender();
|
||||
private ImageView mRecentsButton;
|
||||
private DisplayController mDisplayController;
|
||||
private Space mSpace;
|
||||
|
||||
public NavbarButtonsViewController(TaskbarActivityContext context, FrameLayout navButtonsView) {
|
||||
public NavbarButtonsViewController(TaskbarActivityContext context,
|
||||
@Nullable Context navigationBarPanelContext, NearestTouchFrame navButtonsView) {
|
||||
mContext = context;
|
||||
mNavigationBarPanelContext = navigationBarPanelContext;
|
||||
mWindowManagerProxy = WindowManagerProxy.INSTANCE.get(mContext);
|
||||
mNavButtonsView = navButtonsView;
|
||||
mNavButtonContainer = mNavButtonsView.findViewById(R.id.end_nav_buttons);
|
||||
mEndContextualContainer = mNavButtonsView.findViewById(R.id.end_contextual_buttons);
|
||||
@@ -223,13 +244,17 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
*/
|
||||
public void init(TaskbarControllers controllers) {
|
||||
mControllers = controllers;
|
||||
setupController();
|
||||
}
|
||||
|
||||
protected void setupController() {
|
||||
boolean isThreeButtonNav = mContext.isThreeButtonNav();
|
||||
DeviceProfile deviceProfile = mContext.getDeviceProfile();
|
||||
Resources resources = mContext.getResources();
|
||||
Point p = !mContext.isUserSetupComplete()
|
||||
? new Point(0, controllers.taskbarActivityContext.getSetupWindowHeight())
|
||||
? new Point(0, mControllers.taskbarActivityContext.getSetupWindowSize())
|
||||
: DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources,
|
||||
TaskbarManager.isPhoneMode(deviceProfile));
|
||||
mContext.isPhoneMode());
|
||||
mNavButtonsView.getLayoutParams().height = p.y;
|
||||
|
||||
mIsImeRenderingNavButtons = app.lawnchair.LawnchairApp.isAtleastT()
|
||||
@@ -239,10 +264,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
if (!mIsImeRenderingNavButtons) {
|
||||
// IME switcher
|
||||
View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
|
||||
mImeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
|
||||
isThreeButtonNav ? mStartContextualContainer : mEndContextualContainer,
|
||||
mControllers.navButtonController, R.id.ime_switcher);
|
||||
mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
|
||||
mPropertyHolders.add(new StatePropertyHolder(mImeSwitcherButton,
|
||||
flags -> ((flags & FLAG_SWITCHER_SHOWING) != 0)
|
||||
&& ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)));
|
||||
}
|
||||
@@ -272,8 +297,9 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// - Notification shade is expanded
|
||||
// - IME is showing (add separate translation for IME)
|
||||
// - VoiceInteractionWindow (assistant) is showing
|
||||
// - Keyboard shortcuts helper is showing
|
||||
int flagsToRemoveTranslation = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_IME_VISIBLE
|
||||
| FLAG_VOICE_INTERACTION_WINDOW_SHOWING;
|
||||
| FLAG_VOICE_INTERACTION_WINDOW_SHOWING | FLAG_KEYBOARD_SHORTCUT_HELPER_SHOWING;
|
||||
mPropertyHolders.add(new StatePropertyHolder(mNavButtonInAppDisplayProgressForSysui,
|
||||
flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE,
|
||||
1, 0));
|
||||
@@ -301,42 +327,33 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
initButtons(mNavButtonContainer, mEndContextualContainer,
|
||||
mControllers.navButtonController);
|
||||
updateButtonLayoutSpacing();
|
||||
updateStateForFlag(FLAG_SMALL_SCREEN, isPhoneButtonNavMode(mContext));
|
||||
updateStateForFlag(FLAG_SMALL_SCREEN, mContext.isPhoneButtonNavMode());
|
||||
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mControllers.taskbarDragLayerController.getNavbarBackgroundAlpha(),
|
||||
flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0));
|
||||
|
||||
// Rotation button
|
||||
RotationButton rotationButton = new RotationButtonImpl(
|
||||
addButton(mEndContextualContainer, R.id.rotate_suggestion,
|
||||
R.layout.taskbar_contextual_button));
|
||||
rotationButton.hide();
|
||||
mControllers.rotationButtonController.setRotationButton(rotationButton, null);
|
||||
} else {
|
||||
mFloatingRotationButton = new FloatingRotationButton(mContext,
|
||||
R.string.accessibility_rotate_button,
|
||||
R.layout.rotate_suggestion,
|
||||
R.id.rotate_suggestion,
|
||||
R.dimen.floating_rotation_button_min_margin,
|
||||
R.dimen.rounded_corner_content_padding,
|
||||
R.dimen.floating_rotation_button_taskbar_left_margin,
|
||||
R.dimen.floating_rotation_button_taskbar_bottom_margin,
|
||||
R.dimen.floating_rotation_button_diameter,
|
||||
R.dimen.key_button_ripple_max_width,
|
||||
R.bool.floating_rotation_button_position_left);
|
||||
mControllers.rotationButtonController.setRotationButton(mFloatingRotationButton,
|
||||
mRotationButtonListener);
|
||||
|
||||
if (!mIsImeRenderingNavButtons) {
|
||||
View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
||||
mStartContextualContainer, mControllers.navButtonController, R.id.back);
|
||||
imeDownButton.setRotation(Utilities.isRtl(resources) ? 90 : -90);
|
||||
// Only show when IME is visible.
|
||||
mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
|
||||
flags -> (flags & FLAG_IME_VISIBLE) != 0));
|
||||
}
|
||||
} else if (!mIsImeRenderingNavButtons) {
|
||||
View imeDownButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
|
||||
mStartContextualContainer, mControllers.navButtonController, R.id.back);
|
||||
imeDownButton.setRotation(Utilities.isRtl(resources) ? 90 : -90);
|
||||
// Only show when IME is visible.
|
||||
mPropertyHolders.add(new StatePropertyHolder(imeDownButton,
|
||||
flags -> (flags & FLAG_IME_VISIBLE) != 0));
|
||||
}
|
||||
mFloatingRotationButton = new FloatingRotationButton(
|
||||
ENABLE_TASKBAR_NAVBAR_UNIFICATION ? mNavigationBarPanelContext : mContext,
|
||||
R.string.accessibility_rotate_button,
|
||||
R.layout.rotate_suggestion,
|
||||
R.id.rotate_suggestion,
|
||||
R.dimen.floating_rotation_button_min_margin,
|
||||
R.dimen.rounded_corner_content_padding,
|
||||
R.dimen.floating_rotation_button_taskbar_left_margin,
|
||||
R.dimen.floating_rotation_button_taskbar_bottom_margin,
|
||||
R.dimen.floating_rotation_button_diameter,
|
||||
R.dimen.key_button_ripple_max_width,
|
||||
R.bool.floating_rotation_button_position_left);
|
||||
mControllers.rotationButtonController.setRotationButton(mFloatingRotationButton,
|
||||
mRotationButtonListener);
|
||||
|
||||
applyState();
|
||||
mPropertyHolders.forEach(StatePropertyHolder::endAnimation);
|
||||
@@ -374,8 +391,15 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
(flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0 ||
|
||||
(flags & FLAG_KEYGUARD_OCCLUDED) != 0;
|
||||
return (flags & FLAG_DISABLE_BACK) == 0
|
||||
&& (!mContext.isGestureNav() || !mContext.isUserSetupComplete())
|
||||
&& ((flags & FLAG_KEYGUARD_VISIBLE) == 0 || showingOnKeyguard);
|
||||
}));
|
||||
// Hide back button in SUW if keyboard is showing (IME draws its own back).
|
||||
if (mIsImeRenderingNavButtons) {
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mBackButtonAlpha.get(ALPHA_INDEX_SUW),
|
||||
flags -> (flags & FLAG_IME_VISIBLE) == 0));
|
||||
}
|
||||
mPropertyHolders.add(new StatePropertyHolder(mBackButton,
|
||||
flags -> (flags & FLAG_IME_VISIBLE) != 0,
|
||||
ROTATION_DRAWABLE_PERCENT, 1f, 0f));
|
||||
@@ -383,10 +407,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
int navButtonSize = mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.taskbar_nav_buttons_size);
|
||||
boolean isRtl = Utilities.isRtl(mContext.getResources());
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
|
||||
|| (flags & FLAG_KEYGUARD_VISIBLE) != 0,
|
||||
VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0));
|
||||
if (!mContext.isPhoneMode()) {
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mBackButton, flags -> (flags & FLAG_ONLY_BACK_FOR_BOUNCER_VISIBLE) != 0
|
||||
|| (flags & FLAG_KEYGUARD_VISIBLE) != 0,
|
||||
VIEW_TRANSLATE_X, navButtonSize * (isRtl ? -2 : 2), 0));
|
||||
}
|
||||
|
||||
// home button
|
||||
mHomeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, navContainer,
|
||||
@@ -396,8 +422,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mPropertyHolders.add(
|
||||
new StatePropertyHolder(mHomeButtonAlpha.get(
|
||||
ALPHA_INDEX_KEYGUARD_OR_DISABLE),
|
||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 &&
|
||||
(flags & FLAG_DISABLE_HOME) == 0));
|
||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0
|
||||
&& (flags & FLAG_DISABLE_HOME) == 0 && !mContext.isGestureNav()));
|
||||
|
||||
// Recents button
|
||||
mRecentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS,
|
||||
@@ -415,7 +441,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
});
|
||||
mPropertyHolders.add(new StatePropertyHolder(mRecentsButton,
|
||||
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0 && (flags & FLAG_DISABLE_RECENTS) == 0
|
||||
&& !mContext.isNavBarKidsModeActive()));
|
||||
&& !mContext.isNavBarKidsModeActive() && !mContext.isGestureNav()));
|
||||
|
||||
// A11y button
|
||||
mA11yButton = addButton(R.drawable.ic_sysbar_accessibility_button, BUTTON_A11Y,
|
||||
@@ -424,9 +450,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
|
||||
flags -> (flags & FLAG_A11Y_VISIBLE) != 0
|
||||
&& (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
|
||||
|
||||
mSpace = new Space(mNavButtonsView.getContext());
|
||||
mSpace.setOnClickListener(view -> navButtonController.onButtonClick(BUTTON_SPACE, view));
|
||||
mSpace.setOnLongClickListener(view -> navButtonController.onButtonLongClick(BUTTON_SPACE, view));
|
||||
}
|
||||
|
||||
private void parseSystemUiFlags(int sysUiStateFlags) {
|
||||
private void parseSystemUiFlags(@SystemUiStateFlags long sysUiStateFlags) {
|
||||
mSysuiStateFlags = sysUiStateFlags;
|
||||
boolean isImeVisible = (sysUiStateFlags & SYSUI_STATE_IME_SHOWING) != 0;
|
||||
boolean isImeSwitcherShowing = (sysUiStateFlags & SYSUI_STATE_IME_SWITCHER_SHOWING) != 0;
|
||||
@@ -434,11 +464,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
boolean isHomeDisabled = (sysUiStateFlags & SYSUI_STATE_HOME_DISABLED) != 0;
|
||||
boolean isRecentsDisabled = (sysUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) != 0;
|
||||
boolean isBackDisabled = (sysUiStateFlags & SYSUI_STATE_BACK_DISABLED) != 0;
|
||||
int shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
long shadeExpandedFlags = SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||
boolean isNotificationShadeExpanded = (sysUiStateFlags & shadeExpandedFlags) != 0;
|
||||
boolean isScreenPinningActive = (sysUiStateFlags & SYSUI_STATE_SCREEN_PINNING) != 0;
|
||||
boolean isVoiceInteractionWindowShowing = (sysUiStateFlags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0;
|
||||
boolean isKeyboardShortcutHelperShowing = (sysUiStateFlags & SYSUI_STATE_SHORTCUT_HELPER_SHOWING) != 0;
|
||||
|
||||
// TODO(b/202218289) we're getting IME as not visible on lockscreen from system
|
||||
updateStateForFlag(FLAG_IME_VISIBLE, isImeVisible);
|
||||
@@ -450,6 +481,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
updateStateForFlag(FLAG_NOTIFICATION_SHADE_EXPANDED, isNotificationShadeExpanded);
|
||||
updateStateForFlag(FLAG_SCREEN_PINNING_ACTIVE, isScreenPinningActive);
|
||||
updateStateForFlag(FLAG_VOICE_INTERACTION_WINDOW_SHOWING, isVoiceInteractionWindowShowing);
|
||||
updateStateForFlag(FLAG_KEYBOARD_SHORTCUT_HELPER_SHOWING, isKeyboardShortcutHelperShowing);
|
||||
|
||||
if (mA11yButton != null) {
|
||||
// Only used in 3 button
|
||||
@@ -459,7 +491,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
}
|
||||
|
||||
public void updateStateForSysuiFlags(int systemUiStateFlags, boolean skipAnim) {
|
||||
public void updateStateForSysuiFlags(@SystemUiStateFlags long systemUiStateFlags,
|
||||
boolean skipAnim) {
|
||||
if (systemUiStateFlags == mSysuiStateFlags) {
|
||||
return;
|
||||
}
|
||||
@@ -473,7 +506,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
/**
|
||||
* @return {@code true} if A11y is showing in 3 button nav taskbar
|
||||
*/
|
||||
private boolean isContextualButtonShowing() {
|
||||
private boolean isA11yButtonPersistent() {
|
||||
return mContext.isThreeButtonNav() && (mState & FLAG_A11Y_VISIBLE) != 0;
|
||||
}
|
||||
|
||||
@@ -509,6 +542,10 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
return (mState & FLAG_IME_VISIBLE) != 0;
|
||||
}
|
||||
|
||||
public boolean isImeRenderingNavButtons() {
|
||||
return mIsImeRenderingNavButtons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the home button is disabled
|
||||
*/
|
||||
@@ -629,7 +666,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
* Sets the translationY of the nav buttons based on the current device state.
|
||||
*/
|
||||
public void updateNavButtonTranslationY() {
|
||||
if (isPhoneButtonNavMode(mContext)) {
|
||||
if (mContext.isPhoneButtonNavMode()) {
|
||||
return;
|
||||
}
|
||||
final float normalTranslationY = mTaskbarNavButtonTranslationY.value;
|
||||
@@ -665,6 +702,11 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
|
||||
for (ImageView button : mAllButtons) {
|
||||
button.setImageTintList(ColorStateList.valueOf(iconColor));
|
||||
Drawable background = button.getBackground();
|
||||
if (background instanceof KeyButtonRipple) {
|
||||
((KeyButtonRipple) background).setDarkIntensity(
|
||||
mTaskbarNavButtonDarkIntensity.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,17 +756,39 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// end-aligned, so start-align instead.
|
||||
FrameLayout.LayoutParams navButtonsLayoutParams = (FrameLayout.LayoutParams) mNavButtonContainer
|
||||
.getLayoutParams();
|
||||
FrameLayout.LayoutParams navButtonsViewLayoutParams = (FrameLayout.LayoutParams) mNavButtonsView
|
||||
.getLayoutParams();
|
||||
Resources resources = mContext.getResources();
|
||||
DeviceProfile deviceProfile = mContext.getDeviceProfile();
|
||||
int setupMargin = resources.getDimensionPixelSize(R.dimen.taskbar_contextual_button_margin);
|
||||
navButtonsLayoutParams.setMarginStart(setupMargin);
|
||||
navButtonsLayoutParams.bottomMargin = !deviceProfile.isLandscape
|
||||
? 0
|
||||
: setupMargin -
|
||||
(resources.getDimensionPixelSize(R.dimen.taskbar_nav_buttons_size) / 2);
|
||||
|
||||
navButtonsLayoutParams.setMarginEnd(0);
|
||||
navButtonsLayoutParams.gravity = Gravity.START;
|
||||
mNavButtonsView.getLayoutParams().height = mControllers.taskbarActivityContext.getSetupWindowHeight();
|
||||
mControllers.taskbarActivityContext.setTaskbarWindowSize(
|
||||
mControllers.taskbarActivityContext.getSetupWindowSize());
|
||||
|
||||
// If SUW is on a large screen device that is landscape (or has a square aspect
|
||||
// ratio) the back button has to be placed accordingly
|
||||
if ((deviceProfile.isTablet && deviceProfile.isLandscape)
|
||||
|| (deviceProfile.aspectRatio > SQUARE_ASPECT_RATIO_BOTTOM_BOUND
|
||||
&& deviceProfile.aspectRatio < SQUARE_ASPECT_RATIO_UPPER_BOUND)) {
|
||||
navButtonsLayoutParams.setMarginStart(
|
||||
resources.getDimensionPixelSize(R.dimen.taskbar_back_button_suw_start_margin));
|
||||
navButtonsViewLayoutParams.bottomMargin = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_back_button_suw_bottom_margin);
|
||||
navButtonsLayoutParams.height = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_back_button_suw_height);
|
||||
} else {
|
||||
int phoneOrPortraitSetupMargin = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_contextual_button_suw_margin);
|
||||
navButtonsLayoutParams.setMarginStart(phoneOrPortraitSetupMargin);
|
||||
navButtonsLayoutParams.bottomMargin = !deviceProfile.isLandscape
|
||||
? 0
|
||||
: phoneOrPortraitSetupMargin - (resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_nav_buttons_size) / 2);
|
||||
navButtonsViewLayoutParams.height = resources.getDimensionPixelSize(
|
||||
R.dimen.taskbar_contextual_button_suw_height);
|
||||
}
|
||||
mNavButtonsView.setLayoutParams(navButtonsViewLayoutParams);
|
||||
mNavButtonContainer.setLayoutParams(navButtonsLayoutParams);
|
||||
}
|
||||
|
||||
@@ -742,22 +806,19 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// TODO(b/244231596) we're getting the incorrect kidsMode value in small-screen
|
||||
boolean isInKidsMode = mContext.isNavBarKidsModeActive();
|
||||
|
||||
if (TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW) {
|
||||
if (ENABLE_TASKBAR_NAVBAR_UNIFICATION) {
|
||||
NavButtonLayoutter navButtonLayoutter = NavButtonLayoutFactory.Companion.getUiLayoutter(
|
||||
dp, mNavButtonsView, res, isInKidsMode, isInSetup, isThreeButtonNav,
|
||||
TaskbarManager.isPhoneMode(dp), mDisplayController.getInfo().rotation);
|
||||
navButtonLayoutter.layoutButtons(dp, isContextualButtonShowing());
|
||||
dp, mNavButtonsView, mImeSwitcherButton,
|
||||
mA11yButton, mSpace, res, isInKidsMode, isInSetup, isThreeButtonNav,
|
||||
mContext.isPhoneMode(), mWindowManagerProxy.getRotation(mContext));
|
||||
navButtonLayoutter.layoutButtons(mContext, isA11yButtonPersistent());
|
||||
updateButtonsBackground();
|
||||
updateNavButtonColor();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInSetup) {
|
||||
handleSetupUi();
|
||||
|
||||
// Hide back button in SUW if keyboard is showing (IME draws its own back).
|
||||
mPropertyHolders.add(new StatePropertyHolder(
|
||||
mBackButtonAlpha.get(ALPHA_INDEX_SUW),
|
||||
flags -> (flags & FLAG_IME_VISIBLE) == 0));
|
||||
} else if (isInKidsMode) {
|
||||
int iconSize = res.getDimensionPixelSize(
|
||||
R.dimen.taskbar_icon_size_kids);
|
||||
@@ -840,7 +901,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
// If contextual buttons are showing, we check if the end margin is enough for
|
||||
// the
|
||||
// contextual button to be showing - if not, move the nav buttons over a smidge
|
||||
if (isContextualButtonShowing() && navMarginEnd < contextualWidth) {
|
||||
if (isA11yButtonPersistent() && navMarginEnd < contextualWidth) {
|
||||
// Additional spacing, eat up half of space between last icon and nav button
|
||||
navMarginEnd += res.getDimensionPixelSize(R.dimen.taskbar_hotseat_nav_spacing) / 2;
|
||||
}
|
||||
@@ -863,7 +924,27 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateButtonsBackground() {
|
||||
boolean clipped = !mContext.isPhoneButtonNavMode();
|
||||
mNavButtonContainer.setClipToPadding(clipped);
|
||||
mNavButtonContainer.setClipChildren(clipped);
|
||||
mNavButtonsView.setClipToPadding(clipped);
|
||||
mNavButtonsView.setClipChildren(clipped);
|
||||
|
||||
for (ImageView button : mAllButtons) {
|
||||
updateButtonBackground(button, mContext.isPhoneButtonNavMode());
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateButtonBackground(View view, boolean isPhoneButtonNavMode) {
|
||||
if (isPhoneButtonNavMode) {
|
||||
view.setBackground(new KeyButtonRipple(view.getContext(), view,
|
||||
R.dimen.key_button_ripple_max_width));
|
||||
} else {
|
||||
view.setBackgroundResource(R.drawable.taskbar_icon_click_feedback_roundrect);
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
@@ -940,7 +1021,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever a new ui controller is set, and should update anything that depends on the
|
||||
* Called whenever a new ui controller is set, and should update anything that
|
||||
* depends on the
|
||||
* ui controller.
|
||||
*/
|
||||
public void onUiControllerChanged() {
|
||||
@@ -971,6 +1053,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
+ mOnTaskbarBackgroundNavButtonColorOverride.value);
|
||||
pw.println(prefix + "\t\tmOnBackgroundNavButtonColorOverrideMultiplier="
|
||||
+ mOnBackgroundNavButtonColorOverrideMultiplier.value);
|
||||
|
||||
mNavButtonsView.dumpLogs(prefix + "\t", pw);
|
||||
}
|
||||
|
||||
private static String getStateString(int flags) {
|
||||
@@ -991,6 +1075,8 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
appendFlag(str, flags, FLAG_SCREEN_PINNING_ACTIVE, "FLAG_SCREEN_PINNING_ACTIVE");
|
||||
appendFlag(str, flags, FLAG_VOICE_INTERACTION_WINDOW_SHOWING,
|
||||
"FLAG_VOICE_INTERACTION_WINDOW_SHOWING");
|
||||
appendFlag(str, flags, FLAG_KEYBOARD_SHORTCUT_HELPER_SHOWING,
|
||||
"FLAG_KEYBOARD_SHORTCUT_HELPER_SHOWING");
|
||||
return str.toString();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user