Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleStackViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -475,6 +475,6 @@ class BubbleStackViewTest { override fun hideCurrentInputMethod() {} override fun updateBubbleBarLocation(location: BubbleBarLocation) {} override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) {} } } libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ class BubbleBarExpandedViewTest { override fun hideCurrentInputMethod() { } override fun updateBubbleBarLocation(location: BubbleBarLocation) { override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) { } } } Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -351,7 +351,7 @@ class BubbleBarLayerViewTest { override fun hideCurrentInputMethod() {} override fun updateBubbleBarLocation(location: BubbleBarLocation) {} override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) {} } } Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +33 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.wm.shell.shared.bubbles import android.annotation.IntDef import android.os.Parcel import android.os.Parcelable Loading Loading @@ -60,4 +61,36 @@ enum class BubbleBarLocation : Parcelable { override fun newArray(size: Int) = arrayOfNulls<BubbleBarLocation>(size) } } /** Define set of constants that allow to determine why location changed. */ @IntDef( UpdateSource.DRAG_BAR, UpdateSource.DRAG_BUBBLE, UpdateSource.DRAG_EXP_VIEW, UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_EXP_VIEW, ) @Retention(AnnotationRetention.SOURCE) annotation class UpdateSource { companion object { /** Location changed from dragging the bar */ const val DRAG_BAR = 1 /** Location changed from dragging the bubble */ const val DRAG_BUBBLE = 2 /** Location changed from dragging the expanded view */ const val DRAG_EXP_VIEW = 3 /** Location changed via a11y action on the bar */ const val A11Y_ACTION_BAR = 4 /** Location changed via a11y action on the bubble */ const val A11Y_ACTION_BUBBLE = 5 /** Location changed via a11y action on the expanded view */ const val A11Y_ACTION_EXP_VIEW = 6 } } } libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +41 −4 Original line number Diff line number Diff line Loading @@ -740,8 +740,10 @@ public class BubbleController implements ConfigurationChangeListener, /** * Update bubble bar location and trigger and update to listeners */ public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation, @BubbleBarLocation.UpdateSource int source) { if (canShowAsBubbleBar()) { BubbleBarLocation previousLocation = mBubblePositioner.getBubbleBarLocation(); mBubblePositioner.setBubbleBarLocation(bubbleBarLocation); if (mLayerView != null && !mLayerView.isExpandedViewDragged()) { mLayerView.updateExpandedView(); Loading @@ -749,13 +751,47 @@ public class BubbleController implements ConfigurationChangeListener, BubbleBarUpdate bubbleBarUpdate = new BubbleBarUpdate(); bubbleBarUpdate.bubbleBarLocation = bubbleBarLocation; mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); logBubbleBarLocationIfChanged(bubbleBarLocation, previousLocation, source); } } private void logBubbleBarLocationIfChanged(BubbleBarLocation location, BubbleBarLocation previous, @BubbleBarLocation.UpdateSource int source) { if (mLayerView == null) { return; } boolean isRtl = mLayerView.isLayoutRtl(); boolean wasLeft = previous.isOnLeft(isRtl); boolean onLeft = location.isOnLeft(isRtl); if (wasLeft == onLeft) { // No changes, skip logging return; } switch (source) { case BubbleBarLocation.UpdateSource.DRAG_BAR: case BubbleBarLocation.UpdateSource.A11Y_ACTION_BAR: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_BAR : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_BAR); break; case BubbleBarLocation.UpdateSource.DRAG_BUBBLE: case BubbleBarLocation.UpdateSource.A11Y_ACTION_BUBBLE: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_BUBBLE : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_BUBBLE); break; case BubbleBarLocation.UpdateSource.DRAG_EXP_VIEW: case BubbleBarLocation.UpdateSource.A11Y_ACTION_EXP_VIEW: // TODO(b/349845968): move logging from BubbleBarLayerView to here break; } } /** * Animate bubble bar to the given location. The location change is transient. It does not * update the state of the bubble bar. * To update bubble bar pinned location, use {@link #setBubbleBarLocation(BubbleBarLocation)}. * To update bubble bar pinned location, use * {@link #setBubbleBarLocation(BubbleBarLocation, int)}. */ public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { if (canShowAsBubbleBar()) { Loading Loading @@ -2568,9 +2604,10 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void setBubbleBarLocation(BubbleBarLocation location) { public void setBubbleBarLocation(BubbleBarLocation location, @BubbleBarLocation.UpdateSource int source) { mMainExecutor.execute(() -> mController.setBubbleBarLocation(location)); mController.setBubbleBarLocation(location, source)); } @Override Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleStackViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -475,6 +475,6 @@ class BubbleStackViewTest { override fun hideCurrentInputMethod() {} override fun updateBubbleBarLocation(location: BubbleBarLocation) {} override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) {} } }
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarExpandedViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ class BubbleBarExpandedViewTest { override fun hideCurrentInputMethod() { } override fun updateBubbleBarLocation(location: BubbleBarLocation) { override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) { } } } Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -351,7 +351,7 @@ class BubbleBarLayerViewTest { override fun hideCurrentInputMethod() {} override fun updateBubbleBarLocation(location: BubbleBarLocation) {} override fun updateBubbleBarLocation(location: BubbleBarLocation, source: Int) {} } } Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +33 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.wm.shell.shared.bubbles import android.annotation.IntDef import android.os.Parcel import android.os.Parcelable Loading Loading @@ -60,4 +61,36 @@ enum class BubbleBarLocation : Parcelable { override fun newArray(size: Int) = arrayOfNulls<BubbleBarLocation>(size) } } /** Define set of constants that allow to determine why location changed. */ @IntDef( UpdateSource.DRAG_BAR, UpdateSource.DRAG_BUBBLE, UpdateSource.DRAG_EXP_VIEW, UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_EXP_VIEW, ) @Retention(AnnotationRetention.SOURCE) annotation class UpdateSource { companion object { /** Location changed from dragging the bar */ const val DRAG_BAR = 1 /** Location changed from dragging the bubble */ const val DRAG_BUBBLE = 2 /** Location changed from dragging the expanded view */ const val DRAG_EXP_VIEW = 3 /** Location changed via a11y action on the bar */ const val A11Y_ACTION_BAR = 4 /** Location changed via a11y action on the bubble */ const val A11Y_ACTION_BUBBLE = 5 /** Location changed via a11y action on the expanded view */ const val A11Y_ACTION_EXP_VIEW = 6 } } }
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +41 −4 Original line number Diff line number Diff line Loading @@ -740,8 +740,10 @@ public class BubbleController implements ConfigurationChangeListener, /** * Update bubble bar location and trigger and update to listeners */ public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation, @BubbleBarLocation.UpdateSource int source) { if (canShowAsBubbleBar()) { BubbleBarLocation previousLocation = mBubblePositioner.getBubbleBarLocation(); mBubblePositioner.setBubbleBarLocation(bubbleBarLocation); if (mLayerView != null && !mLayerView.isExpandedViewDragged()) { mLayerView.updateExpandedView(); Loading @@ -749,13 +751,47 @@ public class BubbleController implements ConfigurationChangeListener, BubbleBarUpdate bubbleBarUpdate = new BubbleBarUpdate(); bubbleBarUpdate.bubbleBarLocation = bubbleBarLocation; mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); logBubbleBarLocationIfChanged(bubbleBarLocation, previousLocation, source); } } private void logBubbleBarLocationIfChanged(BubbleBarLocation location, BubbleBarLocation previous, @BubbleBarLocation.UpdateSource int source) { if (mLayerView == null) { return; } boolean isRtl = mLayerView.isLayoutRtl(); boolean wasLeft = previous.isOnLeft(isRtl); boolean onLeft = location.isOnLeft(isRtl); if (wasLeft == onLeft) { // No changes, skip logging return; } switch (source) { case BubbleBarLocation.UpdateSource.DRAG_BAR: case BubbleBarLocation.UpdateSource.A11Y_ACTION_BAR: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_BAR : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_BAR); break; case BubbleBarLocation.UpdateSource.DRAG_BUBBLE: case BubbleBarLocation.UpdateSource.A11Y_ACTION_BUBBLE: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_BUBBLE : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_BUBBLE); break; case BubbleBarLocation.UpdateSource.DRAG_EXP_VIEW: case BubbleBarLocation.UpdateSource.A11Y_ACTION_EXP_VIEW: // TODO(b/349845968): move logging from BubbleBarLayerView to here break; } } /** * Animate bubble bar to the given location. The location change is transient. It does not * update the state of the bubble bar. * To update bubble bar pinned location, use {@link #setBubbleBarLocation(BubbleBarLocation)}. * To update bubble bar pinned location, use * {@link #setBubbleBarLocation(BubbleBarLocation, int)}. */ public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { if (canShowAsBubbleBar()) { Loading Loading @@ -2568,9 +2604,10 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void setBubbleBarLocation(BubbleBarLocation location) { public void setBubbleBarLocation(BubbleBarLocation location, @BubbleBarLocation.UpdateSource int source) { mMainExecutor.execute(() -> mController.setBubbleBarLocation(location)); mController.setBubbleBarLocation(location, source)); } @Override Loading