Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +10 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,8 @@ public class BubbleController implements ConfigurationChangeListener, private final DragAndDropController mDragAndDropController; /** Used to send bubble events to launcher. */ private Bubbles.BubbleStateListener mBubbleStateListener; /** Used to track previous navigation mode to detect switch to buttons navigation. */ private boolean mIsPrevNavModeGestures; /** Used to send updates to the views from {@link #mBubbleDataListener}. */ private BubbleViewCallback mBubbleViewCallback; Loading Loading @@ -356,6 +357,7 @@ public class BubbleController implements ConfigurationChangeListener, } }; mExpandedViewManager = BubbleExpandedViewManager.fromBubbleController(this); mIsPrevNavModeGestures = ContextUtils.isGestureNavigationMode(mContext); } private void registerOneHandedState(OneHandedController oneHanded) { Loading Loading @@ -589,6 +591,13 @@ public class BubbleController implements ConfigurationChangeListener, */ private void sendInitialListenerUpdate() { if (mBubbleStateListener != null) { boolean isCurrentNavModeGestures = ContextUtils.isGestureNavigationMode(mContext); if (mIsPrevNavModeGestures && !isCurrentNavModeGestures) { BubbleBarLocation navButtonsLocation = ContextUtils.isRtl(mContext) ? BubbleBarLocation.RIGHT : BubbleBarLocation.LEFT; mBubblePositioner.setBubbleBarLocation(navButtonsLocation); } mIsPrevNavModeGestures = isCurrentNavModeGestures; BubbleBarUpdate update = mBubbleData.getInitialStateForBubbleBar(); mBubbleStateListener.onBubbleStateChange(update); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +3 −10 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import android.view.ViewOutlineProvider; import android.view.ViewPropertyAnimator; import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.WindowManagerPolicyConstants; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.FrameLayout; Loading Loading @@ -91,10 +90,10 @@ import com.android.wm.shell.bubbles.animation.PhysicsAnimationLayout; import com.android.wm.shell.bubbles.animation.StackAnimationController; import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.shared.bubbles.DismissView; import com.android.wm.shell.shared.bubbles.RelativeTouchListener; import com.android.wm.shell.shared.animation.Interpolators; import com.android.wm.shell.shared.animation.PhysicsAnimator; import com.android.wm.shell.shared.bubbles.DismissView; import com.android.wm.shell.shared.bubbles.RelativeTouchListener; import com.android.wm.shell.shared.magnetictarget.MagnetizedObject; import java.io.PrintWriter; Loading Loading @@ -2276,7 +2275,7 @@ public class BubbleStackView extends FrameLayout void startMonitoringSwipeUpGesture() { stopMonitoringSwipeUpGestureInternal(); if (isGestureNavEnabled()) { if (ContextUtils.isGestureNavigationMode(mContext)) { mBubblesNavBarGestureTracker = new BubblesNavBarGestureTracker(mContext, mPositioner); mBubblesNavBarGestureTracker.start(mSwipeUpListener); setOnTouchListener(mContainerSwipeListener); Loading Loading @@ -2311,12 +2310,6 @@ public class BubbleStackView extends FrameLayout } } private boolean isGestureNavEnabled() { return mContext.getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode) == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; } /** * Stop monitoring for swipe up gesture */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ContextUtils.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.bubbles import android.content.Context import android.view.View import android.view.WindowManagerPolicyConstants import com.android.internal.R /** Simplifies accessing context fields. */ object ContextUtils { /** Gets navigation mode. */ @JvmStatic val Context.navigationMode: Int get() = resources.getInteger(R.integer.config_navBarInteractionMode) /** Returns whether the navigation mode is gestures. */ @JvmStatic val Context.isGestureNavigationMode: Boolean get() = navigationMode == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL /** Returns whether layout direction is rtl. */ @JvmStatic val Context.isRtl: Boolean get() = resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +10 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,8 @@ public class BubbleController implements ConfigurationChangeListener, private final DragAndDropController mDragAndDropController; /** Used to send bubble events to launcher. */ private Bubbles.BubbleStateListener mBubbleStateListener; /** Used to track previous navigation mode to detect switch to buttons navigation. */ private boolean mIsPrevNavModeGestures; /** Used to send updates to the views from {@link #mBubbleDataListener}. */ private BubbleViewCallback mBubbleViewCallback; Loading Loading @@ -356,6 +357,7 @@ public class BubbleController implements ConfigurationChangeListener, } }; mExpandedViewManager = BubbleExpandedViewManager.fromBubbleController(this); mIsPrevNavModeGestures = ContextUtils.isGestureNavigationMode(mContext); } private void registerOneHandedState(OneHandedController oneHanded) { Loading Loading @@ -589,6 +591,13 @@ public class BubbleController implements ConfigurationChangeListener, */ private void sendInitialListenerUpdate() { if (mBubbleStateListener != null) { boolean isCurrentNavModeGestures = ContextUtils.isGestureNavigationMode(mContext); if (mIsPrevNavModeGestures && !isCurrentNavModeGestures) { BubbleBarLocation navButtonsLocation = ContextUtils.isRtl(mContext) ? BubbleBarLocation.RIGHT : BubbleBarLocation.LEFT; mBubblePositioner.setBubbleBarLocation(navButtonsLocation); } mIsPrevNavModeGestures = isCurrentNavModeGestures; BubbleBarUpdate update = mBubbleData.getInitialStateForBubbleBar(); mBubbleStateListener.onBubbleStateChange(update); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +3 −10 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import android.view.ViewOutlineProvider; import android.view.ViewPropertyAnimator; import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.WindowManagerPolicyConstants; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import android.widget.FrameLayout; Loading Loading @@ -91,10 +90,10 @@ import com.android.wm.shell.bubbles.animation.PhysicsAnimationLayout; import com.android.wm.shell.bubbles.animation.StackAnimationController; import com.android.wm.shell.common.FloatingContentCoordinator; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.shared.bubbles.DismissView; import com.android.wm.shell.shared.bubbles.RelativeTouchListener; import com.android.wm.shell.shared.animation.Interpolators; import com.android.wm.shell.shared.animation.PhysicsAnimator; import com.android.wm.shell.shared.bubbles.DismissView; import com.android.wm.shell.shared.bubbles.RelativeTouchListener; import com.android.wm.shell.shared.magnetictarget.MagnetizedObject; import java.io.PrintWriter; Loading Loading @@ -2276,7 +2275,7 @@ public class BubbleStackView extends FrameLayout void startMonitoringSwipeUpGesture() { stopMonitoringSwipeUpGestureInternal(); if (isGestureNavEnabled()) { if (ContextUtils.isGestureNavigationMode(mContext)) { mBubblesNavBarGestureTracker = new BubblesNavBarGestureTracker(mContext, mPositioner); mBubblesNavBarGestureTracker.start(mSwipeUpListener); setOnTouchListener(mContainerSwipeListener); Loading Loading @@ -2311,12 +2310,6 @@ public class BubbleStackView extends FrameLayout } } private boolean isGestureNavEnabled() { return mContext.getResources().getInteger( com.android.internal.R.integer.config_navBarInteractionMode) == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL; } /** * Stop monitoring for swipe up gesture */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/ContextUtils.kt 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.wm.shell.bubbles import android.content.Context import android.view.View import android.view.WindowManagerPolicyConstants import com.android.internal.R /** Simplifies accessing context fields. */ object ContextUtils { /** Gets navigation mode. */ @JvmStatic val Context.navigationMode: Int get() = resources.getInteger(R.integer.config_navBarInteractionMode) /** Returns whether the navigation mode is gestures. */ @JvmStatic val Context.isGestureNavigationMode: Boolean get() = navigationMode == WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL /** Returns whether layout direction is rtl. */ @JvmStatic val Context.isRtl: Boolean get() = resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL }