Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +2 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,8 @@ class Bubble implements BubbleViewProvider { /** * @return the display id of the virtual display on which bubble contents is drawn. */ int getDisplayId() { @Override public int getDisplayId() { return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −12 Original line number Diff line number Diff line Loading @@ -1175,23 +1175,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi * status bar, otherwise returns {@link Display#INVALID_DISPLAY}. */ public int getExpandedDisplayId(Context context) { final Bubble bubble = getExpandedBubble(context); return bubble != null ? bubble.getDisplayId() : INVALID_DISPLAY; } @Nullable private Bubble getExpandedBubble(Context context) { if (mStackView == null) { return null; return INVALID_DISPLAY; } final boolean defaultDisplay = context.getDisplay() != null && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY; final Bubble expandedBubble = mStackView.getExpandedBubble(); if (defaultDisplay && expandedBubble != null && isStackExpanded() final BubbleViewProvider expandedViewProvider = mStackView.getExpandedBubble(); if (defaultDisplay && expandedViewProvider != null && isStackExpanded() && !mNotificationShadeWindowController.getPanelExpanded()) { return expandedBubble; return expandedViewProvider.getDisplayId(); } return null; return INVALID_DISPLAY; } @VisibleForTesting Loading Loading @@ -1256,7 +1250,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onSingleTaskDisplayEmpty(int displayId) { final Bubble expandedBubble = mStackView != null final BubbleViewProvider expandedBubble = mStackView != null ? mStackView.getExpandedBubble() : null; int expandedId = expandedBubble != null ? expandedBubble.getDisplayId() : -1; Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java +4 −2 Original line number Diff line number Diff line Loading @@ -59,13 +59,15 @@ public class BubbleDebugConfig { return FORCE_SHOW_USER_EDUCATION || forceShow; } static String formatBubblesString(List<Bubble> bubbles, Bubble selected) { static String formatBubblesString(List<Bubble> bubbles, BubbleViewProvider selected) { StringBuilder sb = new StringBuilder(); for (Bubble bubble : bubbles) { if (bubble == null) { sb.append(" <null> !!!!!\n"); } else { boolean isSelected = (selected != null && bubble == selected); boolean isSelected = (selected != null && selected.getKey() != BubbleOverflow.KEY && bubble == selected); String arrow = isSelected ? "=>" : " "; sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n", arrow, Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java +12 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bubbles; import static android.view.Display.INVALID_DISPLAY; import static android.view.View.GONE; import static com.android.systemui.bubbles.BadgedImageView.DEFAULT_PATH_SIZE; Loading Loading @@ -45,7 +46,7 @@ public class BubbleOverflow implements BubbleViewProvider { public static final String KEY = "Overflow"; private BadgedImageView mOverflowBtn; private BubbleExpandedView mOverflowExpandedView; private BubbleExpandedView mExpandedView; private LayoutInflater mInflater; private Context mContext; private Bitmap mIcon; Loading @@ -63,11 +64,11 @@ public class BubbleOverflow implements BubbleViewProvider { } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mOverflowExpandedView = (BubbleExpandedView) mInflater.inflate( mExpandedView = (BubbleExpandedView) mInflater.inflate( R.layout.bubble_expanded_view, parentViewGroup /* root */, false /* attachToRoot */); mOverflowExpandedView.setOverflow(true); mOverflowExpandedView.setStackView(stackView); mExpandedView.setOverflow(true); mExpandedView.setStackView(stackView); updateIcon(mContext, parentViewGroup); } Loading Loading @@ -124,7 +125,7 @@ public class BubbleOverflow implements BubbleViewProvider { @Override public BubbleExpandedView getExpandedView() { return mOverflowExpandedView; return mExpandedView; } @Override Loading @@ -149,7 +150,7 @@ public class BubbleOverflow implements BubbleViewProvider { @Override public void setContentVisibility(boolean visible) { mOverflowExpandedView.setContentVisibility(visible); mExpandedView.setContentVisibility(visible); } @Override Loading @@ -167,4 +168,9 @@ public class BubbleOverflow implements BubbleViewProvider { public String getKey() { return BubbleOverflow.KEY; } @Override public int getDisplayId() { return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } } packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +8 −16 Original line number Diff line number Diff line Loading @@ -908,14 +908,8 @@ public class BubbleStackView extends FrameLayout { * The {@link Bubble} that is expanded, null if one does not exist. */ @Nullable Bubble getExpandedBubble() { if (mExpandedBubble == null || (BubbleExperimentConfig.allowBubbleOverflow(mContext) && mExpandedBubble.getIconView() == mBubbleOverflow.getBtn() && BubbleOverflow.KEY.equals(mExpandedBubble.getKey()))) { return null; } return (Bubble) mExpandedBubble; BubbleViewProvider getExpandedBubble() { return mExpandedBubble; } // via BubbleData.Listener Loading Loading @@ -1288,7 +1282,7 @@ public class BubbleStackView extends FrameLayout { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "animateCollapse"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(), getExpandedBubble())); mExpandedBubble)); } updateOverflowBtnVisibility(/* apply */ false); mBubbleContainer.cancelAllAnimations(); Loading Loading @@ -1862,17 +1856,16 @@ public class BubbleStackView extends FrameLayout { } private void updatePointerPosition() { Bubble expandedBubble = getExpandedBubble(); if (expandedBubble == null) { if (mExpandedBubble == null) { return; } int index = getBubbleIndex(expandedBubble); int index = getBubbleIndex(mExpandedBubble); float bubbleLeftFromScreenLeft = mExpandedAnimationController.getBubbleLeft(index); float halfBubble = mBubbleSize / 2f; float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble; // Padding might be adjusted for insets, so get it directly from the view bubbleCenter -= mExpandedViewContainer.getPaddingLeft(); expandedBubble.getExpandedView().setPointerPosition(bubbleCenter); mExpandedBubble.getExpandedView().setPointerPosition(bubbleCenter); } /** Loading @@ -1894,11 +1887,10 @@ public class BubbleStackView extends FrameLayout { * is between 0 and the bubble count minus 1. */ int getBubbleIndex(@Nullable BubbleViewProvider provider) { if (provider == null || provider.getKey() == BubbleOverflow.KEY) { if (provider == null) { return 0; } Bubble b = (Bubble) provider; return mBubbleContainer.indexOfChild(b.getIconView()); return mBubbleContainer.indexOfChild(provider.getIconView()); } /** Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +2 −1 Original line number Diff line number Diff line Loading @@ -279,7 +279,8 @@ class Bubble implements BubbleViewProvider { /** * @return the display id of the virtual display on which bubble contents is drawn. */ int getDisplayId() { @Override public int getDisplayId() { return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −12 Original line number Diff line number Diff line Loading @@ -1175,23 +1175,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi * status bar, otherwise returns {@link Display#INVALID_DISPLAY}. */ public int getExpandedDisplayId(Context context) { final Bubble bubble = getExpandedBubble(context); return bubble != null ? bubble.getDisplayId() : INVALID_DISPLAY; } @Nullable private Bubble getExpandedBubble(Context context) { if (mStackView == null) { return null; return INVALID_DISPLAY; } final boolean defaultDisplay = context.getDisplay() != null && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY; final Bubble expandedBubble = mStackView.getExpandedBubble(); if (defaultDisplay && expandedBubble != null && isStackExpanded() final BubbleViewProvider expandedViewProvider = mStackView.getExpandedBubble(); if (defaultDisplay && expandedViewProvider != null && isStackExpanded() && !mNotificationShadeWindowController.getPanelExpanded()) { return expandedBubble; return expandedViewProvider.getDisplayId(); } return null; return INVALID_DISPLAY; } @VisibleForTesting Loading Loading @@ -1256,7 +1250,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi @Override public void onSingleTaskDisplayEmpty(int displayId) { final Bubble expandedBubble = mStackView != null final BubbleViewProvider expandedBubble = mStackView != null ? mStackView.getExpandedBubble() : null; int expandedId = expandedBubble != null ? expandedBubble.getDisplayId() : -1; Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java +4 −2 Original line number Diff line number Diff line Loading @@ -59,13 +59,15 @@ public class BubbleDebugConfig { return FORCE_SHOW_USER_EDUCATION || forceShow; } static String formatBubblesString(List<Bubble> bubbles, Bubble selected) { static String formatBubblesString(List<Bubble> bubbles, BubbleViewProvider selected) { StringBuilder sb = new StringBuilder(); for (Bubble bubble : bubbles) { if (bubble == null) { sb.append(" <null> !!!!!\n"); } else { boolean isSelected = (selected != null && bubble == selected); boolean isSelected = (selected != null && selected.getKey() != BubbleOverflow.KEY && bubble == selected); String arrow = isSelected ? "=>" : " "; sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n", arrow, Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java +12 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.bubbles; import static android.view.Display.INVALID_DISPLAY; import static android.view.View.GONE; import static com.android.systemui.bubbles.BadgedImageView.DEFAULT_PATH_SIZE; Loading Loading @@ -45,7 +46,7 @@ public class BubbleOverflow implements BubbleViewProvider { public static final String KEY = "Overflow"; private BadgedImageView mOverflowBtn; private BubbleExpandedView mOverflowExpandedView; private BubbleExpandedView mExpandedView; private LayoutInflater mInflater; private Context mContext; private Bitmap mIcon; Loading @@ -63,11 +64,11 @@ public class BubbleOverflow implements BubbleViewProvider { } void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mOverflowExpandedView = (BubbleExpandedView) mInflater.inflate( mExpandedView = (BubbleExpandedView) mInflater.inflate( R.layout.bubble_expanded_view, parentViewGroup /* root */, false /* attachToRoot */); mOverflowExpandedView.setOverflow(true); mOverflowExpandedView.setStackView(stackView); mExpandedView.setOverflow(true); mExpandedView.setStackView(stackView); updateIcon(mContext, parentViewGroup); } Loading Loading @@ -124,7 +125,7 @@ public class BubbleOverflow implements BubbleViewProvider { @Override public BubbleExpandedView getExpandedView() { return mOverflowExpandedView; return mExpandedView; } @Override Loading @@ -149,7 +150,7 @@ public class BubbleOverflow implements BubbleViewProvider { @Override public void setContentVisibility(boolean visible) { mOverflowExpandedView.setContentVisibility(visible); mExpandedView.setContentVisibility(visible); } @Override Loading @@ -167,4 +168,9 @@ public class BubbleOverflow implements BubbleViewProvider { public String getKey() { return BubbleOverflow.KEY; } @Override public int getDisplayId() { return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } }
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +8 −16 Original line number Diff line number Diff line Loading @@ -908,14 +908,8 @@ public class BubbleStackView extends FrameLayout { * The {@link Bubble} that is expanded, null if one does not exist. */ @Nullable Bubble getExpandedBubble() { if (mExpandedBubble == null || (BubbleExperimentConfig.allowBubbleOverflow(mContext) && mExpandedBubble.getIconView() == mBubbleOverflow.getBtn() && BubbleOverflow.KEY.equals(mExpandedBubble.getKey()))) { return null; } return (Bubble) mExpandedBubble; BubbleViewProvider getExpandedBubble() { return mExpandedBubble; } // via BubbleData.Listener Loading Loading @@ -1288,7 +1282,7 @@ public class BubbleStackView extends FrameLayout { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "animateCollapse"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(), getExpandedBubble())); mExpandedBubble)); } updateOverflowBtnVisibility(/* apply */ false); mBubbleContainer.cancelAllAnimations(); Loading Loading @@ -1862,17 +1856,16 @@ public class BubbleStackView extends FrameLayout { } private void updatePointerPosition() { Bubble expandedBubble = getExpandedBubble(); if (expandedBubble == null) { if (mExpandedBubble == null) { return; } int index = getBubbleIndex(expandedBubble); int index = getBubbleIndex(mExpandedBubble); float bubbleLeftFromScreenLeft = mExpandedAnimationController.getBubbleLeft(index); float halfBubble = mBubbleSize / 2f; float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble; // Padding might be adjusted for insets, so get it directly from the view bubbleCenter -= mExpandedViewContainer.getPaddingLeft(); expandedBubble.getExpandedView().setPointerPosition(bubbleCenter); mExpandedBubble.getExpandedView().setPointerPosition(bubbleCenter); } /** Loading @@ -1894,11 +1887,10 @@ public class BubbleStackView extends FrameLayout { * is between 0 and the bubble count minus 1. */ int getBubbleIndex(@Nullable BubbleViewProvider provider) { if (provider == null || provider.getKey() == BubbleOverflow.KEY) { if (provider == null) { return 0; } Bubble b = (Bubble) provider; return mBubbleContainer.indexOfChild(b.getIconView()); return mBubbleContainer.indexOfChild(provider.getIconView()); } /** Loading