Loading packages/SystemUI/aconfig/accessibility.aconfig +10 −3 Original line number Diff line number Diff line Loading @@ -3,10 +3,10 @@ package: "com.android.systemui" # NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors. flag { name: "floating_menu_overlaps_nav_bars_flag" name: "floating_menu_animated_tuck" namespace: "accessibility" description: "Adjusts bounds to allow the floating menu to render on top of navigation bars." bug: "283768342" description: "Sets up animations for tucking/untucking and adjusts clipbounds." bug: "24592044" } flag { Loading @@ -15,3 +15,10 @@ flag { description: "Adds an animation for when the FAB is displaced by an IME becoming visible." bug: "281150010" } flag { name: "floating_menu_overlaps_nav_bars_flag" namespace: "accessibility" description: "Adjusts bounds to allow the floating menu to render on top of navigation bars." bug: "283768342" } No newline at end of file packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuAnimationController.java +34 −2 Original line number Diff line number Diff line Loading @@ -341,7 +341,16 @@ class MenuAnimationController { void moveToEdgeAndHide() { mMenuView.updateMenuMoveToTucked(/* isMoveToTucked= */ true); final PointF position = mMenuView.getMenuPosition(); moveToPosition(getTuckedMenuPosition()); final PointF tuckedPosition = getTuckedMenuPosition(); if (Flags.floatingMenuAnimatedTuck()) { flingThenSpringMenuWith(DynamicAnimation.TRANSLATION_X, Math.signum(tuckedPosition.x - position.x) * ESCAPE_VELOCITY, FLING_FRICTION_SCALAR, createDefaultSpringForce(), tuckedPosition.x); } else { moveToPosition(tuckedPosition); } // Keep the touch region let users could click extra space to pop up the menu view // from the screen edge Loading @@ -353,7 +362,24 @@ class MenuAnimationController { void moveOutEdgeAndShow() { mMenuView.updateMenuMoveToTucked(/* isMoveToTucked= */ false); if (Flags.floatingMenuAnimatedTuck()) { PointF position = mMenuView.getMenuPosition(); springMenuWith(DynamicAnimation.TRANSLATION_X, createDefaultSpringForce(), 0, position.x, true ); springMenuWith(DynamicAnimation.TRANSLATION_Y, createDefaultSpringForce(), 0, position.y, true ); } else { mMenuView.onPositionChanged(); } mMenuView.onEdgeChangedIfNeeded(); } Loading Loading @@ -489,6 +515,12 @@ class MenuAnimationController { return new Handler(requireNonNull(Looper.myLooper(), "looper must not be null")); } private static SpringForce createDefaultSpringForce() { return new SpringForce() .setStiffness(SPRING_STIFFNESS) .setDampingRatio(SPRING_AFTER_FLING_DAMPING_RATIO); } static class MenuPositionProperty extends FloatPropertyCompat<MenuView> { private final DynamicAnimation.ViewProperty mProperty; Loading packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java +16 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class MenuView extends FrameLayout implements private final MenuAnimationController mMenuAnimationController; private OnTargetFeaturesChangeListener mFeaturesChangeListener; private OnMoveToTuckedListener mMoveToTuckedListener; MenuView(Context context, MenuViewModel menuViewModel, MenuViewAppearance menuViewAppearance) { super(context); Loading Loading @@ -138,6 +139,10 @@ class MenuView extends FrameLayout implements mFeaturesChangeListener = listener; } void setMoveToTuckedListener(OnMoveToTuckedListener listener) { mMoveToTuckedListener = listener; } void addOnItemTouchListenerToList(RecyclerView.OnItemTouchListener listener) { mTargetFeaturesView.addOnItemTouchListener(listener); } Loading Loading @@ -307,8 +312,11 @@ class MenuView extends FrameLayout implements void updateMenuMoveToTucked(boolean isMoveToTucked) { mIsMoveToTucked = isMoveToTucked; mMenuViewModel.updateMenuMoveToTucked(isMoveToTucked); if (mMoveToTuckedListener != null) { mMoveToTuckedListener.onMoveToTuckedChanged(isMoveToTucked); } if (Flags.floatingMenuOverlapsNavBarsFlag()) { if (Flags.floatingMenuOverlapsNavBarsFlag() && !Flags.floatingMenuAnimatedTuck()) { if (isMoveToTucked) { final float halfWidth = getMenuWidth() / 2.0f; final boolean isOnLeftSide = mMenuAnimationController.isOnLeftSide(); Loading Loading @@ -428,4 +436,11 @@ class MenuView extends FrameLayout implements */ void onChange(List<AccessibilityTarget> newTargetFeatures); } /** * Interface containing a callback for when MoveToTucked changes. */ interface OnMoveToTuckedListener { void onMoveToTuckedChanged(boolean moveToTucked); } } packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewAppearance.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ class MenuViewAppearance { : new float[]{radius, radius, 0.0f, 0.0f, 0.0f, 0.0f, radius, radius}; } private Rect getWindowAvailableBounds() { public Rect getWindowAvailableBounds() { final WindowMetrics windowMetrics = mWindowManager.getCurrentWindowMetrics(); final WindowInsets windowInsets = windowMetrics.getWindowInsets(); final Insets insets = windowInsets.getInsetsIgnoringVisibility( Loading packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java +30 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ import java.util.Optional; */ @SuppressLint("ViewConstructor") class MenuViewLayer extends FrameLayout implements ViewTreeObserver.OnComputeInternalInsetsListener, View.OnClickListener, ComponentCallbacks { ViewTreeObserver.OnComputeInternalInsetsListener, View.OnClickListener, ComponentCallbacks, MenuView.OnMoveToTuckedListener { private static final int SHOW_MESSAGE_DELAY_MS = 3000; private final WindowManager mWindowManager; Loading Loading @@ -211,6 +212,7 @@ class MenuViewLayer extends FrameLayout implements mMenuListViewTouchHandler = new MenuListViewTouchHandler(mMenuAnimationController, mDismissAnimationController); mMenuView.addOnItemTouchListenerToList(mMenuListViewTouchHandler); mMenuView.setMoveToTuckedListener(this); mMessageView = new MenuMessageView(context); Loading @@ -232,6 +234,10 @@ class MenuViewLayer extends FrameLayout implements addView(mMenuView, LayerIndex.MENU_VIEW); addView(mDismissView, LayerIndex.DISMISS_VIEW); addView(mMessageView, LayerIndex.MESSAGE_VIEW); if (Flags.floatingMenuAnimatedTuck()) { setClipChildren(true); } } @Override Loading Loading @@ -354,6 +360,24 @@ class MenuViewLayer extends FrameLayout implements mShouldShowDockTooltip = !hasSeenTooltip; } public void onMoveToTuckedChanged(boolean moveToTuck) { if (Flags.floatingMenuOverlapsNavBarsFlag()) { if (moveToTuck) { final Rect bounds = mMenuViewAppearance.getWindowAvailableBounds(); final int[] location = getLocationOnScreen(); bounds.offset( location[0], location[1] ); setClipBounds(bounds); } // Instead of clearing clip bounds when moveToTuck is false, // wait until the spring animation finishes. } // Function is a no-operation if flag is disabled. } private void onSpringAnimationsEndAction() { if (mShouldShowDockTooltip) { mEduTooltipView = Optional.of(new MenuEduTooltipView(mContext, mMenuViewAppearance)); Loading @@ -364,6 +388,11 @@ class MenuViewLayer extends FrameLayout implements mMenuAnimationController.startTuckedAnimationPreview(); } if (Flags.floatingMenuAnimatedTuck()) { if (!mMenuView.isMoveToTucked()) { setClipBounds(null); } } if (Flags.floatingMenuImeDisplacementAnimation()) { mMenuView.onArrivalAtPosition(); } Loading Loading
packages/SystemUI/aconfig/accessibility.aconfig +10 −3 Original line number Diff line number Diff line Loading @@ -3,10 +3,10 @@ package: "com.android.systemui" # NOTE: Keep alphabetized to help limit merge conflicts from multiple simultaneous editors. flag { name: "floating_menu_overlaps_nav_bars_flag" name: "floating_menu_animated_tuck" namespace: "accessibility" description: "Adjusts bounds to allow the floating menu to render on top of navigation bars." bug: "283768342" description: "Sets up animations for tucking/untucking and adjusts clipbounds." bug: "24592044" } flag { Loading @@ -15,3 +15,10 @@ flag { description: "Adds an animation for when the FAB is displaced by an IME becoming visible." bug: "281150010" } flag { name: "floating_menu_overlaps_nav_bars_flag" namespace: "accessibility" description: "Adjusts bounds to allow the floating menu to render on top of navigation bars." bug: "283768342" } No newline at end of file
packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuAnimationController.java +34 −2 Original line number Diff line number Diff line Loading @@ -341,7 +341,16 @@ class MenuAnimationController { void moveToEdgeAndHide() { mMenuView.updateMenuMoveToTucked(/* isMoveToTucked= */ true); final PointF position = mMenuView.getMenuPosition(); moveToPosition(getTuckedMenuPosition()); final PointF tuckedPosition = getTuckedMenuPosition(); if (Flags.floatingMenuAnimatedTuck()) { flingThenSpringMenuWith(DynamicAnimation.TRANSLATION_X, Math.signum(tuckedPosition.x - position.x) * ESCAPE_VELOCITY, FLING_FRICTION_SCALAR, createDefaultSpringForce(), tuckedPosition.x); } else { moveToPosition(tuckedPosition); } // Keep the touch region let users could click extra space to pop up the menu view // from the screen edge Loading @@ -353,7 +362,24 @@ class MenuAnimationController { void moveOutEdgeAndShow() { mMenuView.updateMenuMoveToTucked(/* isMoveToTucked= */ false); if (Flags.floatingMenuAnimatedTuck()) { PointF position = mMenuView.getMenuPosition(); springMenuWith(DynamicAnimation.TRANSLATION_X, createDefaultSpringForce(), 0, position.x, true ); springMenuWith(DynamicAnimation.TRANSLATION_Y, createDefaultSpringForce(), 0, position.y, true ); } else { mMenuView.onPositionChanged(); } mMenuView.onEdgeChangedIfNeeded(); } Loading Loading @@ -489,6 +515,12 @@ class MenuAnimationController { return new Handler(requireNonNull(Looper.myLooper(), "looper must not be null")); } private static SpringForce createDefaultSpringForce() { return new SpringForce() .setStiffness(SPRING_STIFFNESS) .setDampingRatio(SPRING_AFTER_FLING_DAMPING_RATIO); } static class MenuPositionProperty extends FloatPropertyCompat<MenuView> { private final DynamicAnimation.ViewProperty mProperty; Loading
packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuView.java +16 −1 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ class MenuView extends FrameLayout implements private final MenuAnimationController mMenuAnimationController; private OnTargetFeaturesChangeListener mFeaturesChangeListener; private OnMoveToTuckedListener mMoveToTuckedListener; MenuView(Context context, MenuViewModel menuViewModel, MenuViewAppearance menuViewAppearance) { super(context); Loading Loading @@ -138,6 +139,10 @@ class MenuView extends FrameLayout implements mFeaturesChangeListener = listener; } void setMoveToTuckedListener(OnMoveToTuckedListener listener) { mMoveToTuckedListener = listener; } void addOnItemTouchListenerToList(RecyclerView.OnItemTouchListener listener) { mTargetFeaturesView.addOnItemTouchListener(listener); } Loading Loading @@ -307,8 +312,11 @@ class MenuView extends FrameLayout implements void updateMenuMoveToTucked(boolean isMoveToTucked) { mIsMoveToTucked = isMoveToTucked; mMenuViewModel.updateMenuMoveToTucked(isMoveToTucked); if (mMoveToTuckedListener != null) { mMoveToTuckedListener.onMoveToTuckedChanged(isMoveToTucked); } if (Flags.floatingMenuOverlapsNavBarsFlag()) { if (Flags.floatingMenuOverlapsNavBarsFlag() && !Flags.floatingMenuAnimatedTuck()) { if (isMoveToTucked) { final float halfWidth = getMenuWidth() / 2.0f; final boolean isOnLeftSide = mMenuAnimationController.isOnLeftSide(); Loading Loading @@ -428,4 +436,11 @@ class MenuView extends FrameLayout implements */ void onChange(List<AccessibilityTarget> newTargetFeatures); } /** * Interface containing a callback for when MoveToTucked changes. */ interface OnMoveToTuckedListener { void onMoveToTuckedChanged(boolean moveToTucked); } }
packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewAppearance.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ class MenuViewAppearance { : new float[]{radius, radius, 0.0f, 0.0f, 0.0f, 0.0f, radius, radius}; } private Rect getWindowAvailableBounds() { public Rect getWindowAvailableBounds() { final WindowMetrics windowMetrics = mWindowManager.getCurrentWindowMetrics(); final WindowInsets windowInsets = windowMetrics.getWindowInsets(); final Insets insets = windowInsets.getInsetsIgnoringVisibility( Loading
packages/SystemUI/src/com/android/systemui/accessibility/floatingmenu/MenuViewLayer.java +30 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ import java.util.Optional; */ @SuppressLint("ViewConstructor") class MenuViewLayer extends FrameLayout implements ViewTreeObserver.OnComputeInternalInsetsListener, View.OnClickListener, ComponentCallbacks { ViewTreeObserver.OnComputeInternalInsetsListener, View.OnClickListener, ComponentCallbacks, MenuView.OnMoveToTuckedListener { private static final int SHOW_MESSAGE_DELAY_MS = 3000; private final WindowManager mWindowManager; Loading Loading @@ -211,6 +212,7 @@ class MenuViewLayer extends FrameLayout implements mMenuListViewTouchHandler = new MenuListViewTouchHandler(mMenuAnimationController, mDismissAnimationController); mMenuView.addOnItemTouchListenerToList(mMenuListViewTouchHandler); mMenuView.setMoveToTuckedListener(this); mMessageView = new MenuMessageView(context); Loading @@ -232,6 +234,10 @@ class MenuViewLayer extends FrameLayout implements addView(mMenuView, LayerIndex.MENU_VIEW); addView(mDismissView, LayerIndex.DISMISS_VIEW); addView(mMessageView, LayerIndex.MESSAGE_VIEW); if (Flags.floatingMenuAnimatedTuck()) { setClipChildren(true); } } @Override Loading Loading @@ -354,6 +360,24 @@ class MenuViewLayer extends FrameLayout implements mShouldShowDockTooltip = !hasSeenTooltip; } public void onMoveToTuckedChanged(boolean moveToTuck) { if (Flags.floatingMenuOverlapsNavBarsFlag()) { if (moveToTuck) { final Rect bounds = mMenuViewAppearance.getWindowAvailableBounds(); final int[] location = getLocationOnScreen(); bounds.offset( location[0], location[1] ); setClipBounds(bounds); } // Instead of clearing clip bounds when moveToTuck is false, // wait until the spring animation finishes. } // Function is a no-operation if flag is disabled. } private void onSpringAnimationsEndAction() { if (mShouldShowDockTooltip) { mEduTooltipView = Optional.of(new MenuEduTooltipView(mContext, mMenuViewAppearance)); Loading @@ -364,6 +388,11 @@ class MenuViewLayer extends FrameLayout implements mMenuAnimationController.startTuckedAnimationPreview(); } if (Flags.floatingMenuAnimatedTuck()) { if (!mMenuView.isMoveToTucked()) { setClipBounds(null); } } if (Flags.floatingMenuImeDisplacementAnimation()) { mMenuView.onArrivalAtPosition(); } Loading