Loading packages/SystemUI/res/values/dimens.xml +2 −2 Original line number Diff line number Diff line Loading @@ -1013,8 +1013,8 @@ <dimen name="bubble_icon_inset">16dp</dimen> <!-- Padding around the view displayed when the bubble is expanded --> <dimen name="bubble_expanded_view_padding">8dp</dimen> <!-- Default height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">400dp</dimen> <!-- Default (and minimum) height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">180dp</dimen> <!-- Height of the triangle that points to the expanded bubble --> <dimen name="bubble_pointer_height">4dp</dimen> <!-- Width of the triangle that points to the expanded bubble --> Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,6 @@ class Bubble { public void setEntry(NotificationEntry entry) { key = entry.key; iconView.update(entry); // TODO: should also update the expanded view here (e.g. height change) expandedView.update(entry); } } packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +43 −11 Original line number Diff line number Diff line Loading @@ -89,8 +89,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private boolean mActivityViewReady = false; private PendingIntent mBubbleIntent; private int mBubbleHeight; private int mDefaultHeight; private int mMinHeight; private int mHeaderHeight; private NotificationEntry mEntry; private PackageManager mPm; Loading Loading @@ -149,7 +149,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mPm = context.getPackageManager(); mDefaultHeight = getResources().getDimensionPixelSize( mMinHeight = getResources().getDimensionPixelSize( R.dimen.bubble_expanded_default_height); try { mNotificationManagerService = INotificationManager.Stub.asInterface( Loading Loading @@ -194,6 +194,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList viewWrapper.setLayoutTransition(transition); viewWrapper.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); mHeaderHeight = getContext().getResources().getDimensionPixelSize( R.dimen.bubble_expanded_header_height); mHeaderView = findViewById(R.id.header_layout); mHeaderTextView = findViewById(R.id.header_text); mDeepLinkIcon = findViewById(R.id.deep_link_button); Loading Loading @@ -273,6 +275,21 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mActivityView.setCallback(mStateCallback); } /** * Updates the entry backing this view. This will not re-populate ActivityView, it will * only update the deep-links in the header, the title, and the height of the view. */ public void update(NotificationEntry entry) { if (entry.key.equals(mEntry.key)) { mEntry = entry; updateHeaderView(); updateHeight(); } else { Log.w(TAG, "Trying to update entry with different key, new entry: " + entry.key + " old entry: " + mEntry.key); } } private void updateHeaderView() { mSettingsIcon.setContentDescription(getResources().getString( R.string.bubbles_settings_button_description, mAppName)); Loading Loading @@ -315,14 +332,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList removeView(mNotifRow); mNotifRow = null; } Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); mBubbleHeight = data != null && data.getDesiredHeight() > 0 ? data.getDesiredHeight() : mDefaultHeight; // XXX: enforce max / min height LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams(); lp.height = mBubbleHeight; mActivityView.setLayoutParams(lp); mActivityView.setVisibility(VISIBLE); } else { // Hide activity view if we had it previously Loading @@ -343,6 +352,28 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return true; } void updateHeight() { if (usingActivityView()) { Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); int desiredHeight; if (data == null) { // This is a contentIntent based bubble, lets allow it to be the max height // as it was forced into this mode and not prepared to be small desiredHeight = mStackView.getMaxExpandedHeight(); } else { desiredHeight = data.getDesiredHeight() > 0 ? data.getDesiredHeight() : mMinHeight; } int max = mStackView.getMaxExpandedHeight() - mHeaderHeight; int height = Math.min(desiredHeight, max); height = Math.max(height, mMinHeight); LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams(); lp.height = height; mActivityView.setLayoutParams(lp); } } @Override public void onClick(View view) { if (mEntry == null) { Loading Loading @@ -407,6 +438,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } else if (mNotifRow != null) { applyRowState(mNotifRow); } updateHeight(); } /** Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +26 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class BubbleStackView extends FrameLayout { private int mExpandedAnimateXDistance; private int mExpandedAnimateYDistance; private int mStatusBarHeight; private int mPipDismissHeight; private Bubble mExpandedBubble; private boolean mIsExpanded; Loading Loading @@ -159,6 +160,8 @@ public class BubbleStackView extends FrameLayout { res.getDimensionPixelSize(R.dimen.bubble_expanded_animate_y_distance); mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mPipDismissHeight = mContext.getResources().getDimensionPixelSize( R.dimen.pip_dismiss_gradient_height); mDisplaySize = new Point(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Loading Loading @@ -390,8 +393,7 @@ public class BubbleStackView extends FrameLayout { */ public void updateBubble(NotificationEntry entry, boolean updatePosition) { Bubble b = mBubbleData.getBubble(entry.key); b.iconView.update(entry); // TODO: should also update the expanded view here (e.g. height change) mBubbleData.updateBubble(entry.key, entry); if (updatePosition && !mIsExpanded) { // If alerting it gets promoted to top of the stack. Loading Loading @@ -652,6 +654,20 @@ public class BubbleStackView extends FrameLayout { StatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED); } /** * Calculates how large the expanded view of the bubble can be. This takes into account the * y position when the bubbles are expanded as well as the bounds of the dismiss target. */ int getMaxExpandedHeight() { int expandedY = (int) mExpandedAnimationController.getExpandedY(); int bubbleContainerHeight = mBubbleContainer.getChildAt(0) != null ? mBubbleContainer.getChildAt(0).getHeight() : 0; // PIP dismiss view uses FLAG_LAYOUT_IN_SCREEN so we need to subtract the bottom inset int pipDismissHeight = mPipDismissHeight - getBottomInset(); return mDisplaySize.y - expandedY - mBubbleSize - pipDismissHeight; } /** * Minimum velocity, in pixels/second, required to get from x to destX while being slowed by a * given frictional force. Loading Loading @@ -688,6 +704,14 @@ public class BubbleStackView extends FrameLayout { return 0; } private int getBottomInset() { if (getRootWindowInsets() != null) { WindowInsets insets = getRootWindowInsets(); return insets.getSystemWindowInsetBottom(); } return 0; } private boolean isIntersecting(View view, float x, float y) { mTempLoc = view.getLocationOnScreen(); mTempRect.set(mTempLoc[0], mTempLoc[1], mTempLoc[0] + view.getWidth(), Loading packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -203,8 +203,8 @@ public class ExpandedAnimationController } /** The Y value of the row of expanded bubbles. */ private float getExpandedY() { final WindowInsets insets = mLayout.getRootWindowInsets(); public float getExpandedY() { final WindowInsets insets = mLayout != null ? mLayout.getRootWindowInsets() : null; if (insets != null) { return mBubblePaddingPx + Math.max( mStatusBarHeight, Loading Loading
packages/SystemUI/res/values/dimens.xml +2 −2 Original line number Diff line number Diff line Loading @@ -1013,8 +1013,8 @@ <dimen name="bubble_icon_inset">16dp</dimen> <!-- Padding around the view displayed when the bubble is expanded --> <dimen name="bubble_expanded_view_padding">8dp</dimen> <!-- Default height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">400dp</dimen> <!-- Default (and minimum) height of the expanded view shown when the bubble is expanded --> <dimen name="bubble_expanded_default_height">180dp</dimen> <!-- Height of the triangle that points to the expanded bubble --> <dimen name="bubble_pointer_height">4dp</dimen> <!-- Width of the triangle that points to the expanded bubble --> Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,6 @@ class Bubble { public void setEntry(NotificationEntry entry) { key = entry.key; iconView.update(entry); // TODO: should also update the expanded view here (e.g. height change) expandedView.update(entry); } }
packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +43 −11 Original line number Diff line number Diff line Loading @@ -89,8 +89,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList private boolean mActivityViewReady = false; private PendingIntent mBubbleIntent; private int mBubbleHeight; private int mDefaultHeight; private int mMinHeight; private int mHeaderHeight; private NotificationEntry mEntry; private PackageManager mPm; Loading Loading @@ -149,7 +149,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mPm = context.getPackageManager(); mDefaultHeight = getResources().getDimensionPixelSize( mMinHeight = getResources().getDimensionPixelSize( R.dimen.bubble_expanded_default_height); try { mNotificationManagerService = INotificationManager.Stub.asInterface( Loading Loading @@ -194,6 +194,8 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList viewWrapper.setLayoutTransition(transition); viewWrapper.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); mHeaderHeight = getContext().getResources().getDimensionPixelSize( R.dimen.bubble_expanded_header_height); mHeaderView = findViewById(R.id.header_layout); mHeaderTextView = findViewById(R.id.header_text); mDeepLinkIcon = findViewById(R.id.deep_link_button); Loading Loading @@ -273,6 +275,21 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList mActivityView.setCallback(mStateCallback); } /** * Updates the entry backing this view. This will not re-populate ActivityView, it will * only update the deep-links in the header, the title, and the height of the view. */ public void update(NotificationEntry entry) { if (entry.key.equals(mEntry.key)) { mEntry = entry; updateHeaderView(); updateHeight(); } else { Log.w(TAG, "Trying to update entry with different key, new entry: " + entry.key + " old entry: " + mEntry.key); } } private void updateHeaderView() { mSettingsIcon.setContentDescription(getResources().getString( R.string.bubbles_settings_button_description, mAppName)); Loading Loading @@ -315,14 +332,6 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList removeView(mNotifRow); mNotifRow = null; } Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); mBubbleHeight = data != null && data.getDesiredHeight() > 0 ? data.getDesiredHeight() : mDefaultHeight; // XXX: enforce max / min height LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams(); lp.height = mBubbleHeight; mActivityView.setLayoutParams(lp); mActivityView.setVisibility(VISIBLE); } else { // Hide activity view if we had it previously Loading @@ -343,6 +352,28 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList return true; } void updateHeight() { if (usingActivityView()) { Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); int desiredHeight; if (data == null) { // This is a contentIntent based bubble, lets allow it to be the max height // as it was forced into this mode and not prepared to be small desiredHeight = mStackView.getMaxExpandedHeight(); } else { desiredHeight = data.getDesiredHeight() > 0 ? data.getDesiredHeight() : mMinHeight; } int max = mStackView.getMaxExpandedHeight() - mHeaderHeight; int height = Math.min(desiredHeight, max); height = Math.max(height, mMinHeight); LayoutParams lp = (LayoutParams) mActivityView.getLayoutParams(); lp.height = height; mActivityView.setLayoutParams(lp); } } @Override public void onClick(View view) { if (mEntry == null) { Loading Loading @@ -407,6 +438,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } else if (mNotifRow != null) { applyRowState(mNotifRow); } updateHeight(); } /** Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +26 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ public class BubbleStackView extends FrameLayout { private int mExpandedAnimateXDistance; private int mExpandedAnimateYDistance; private int mStatusBarHeight; private int mPipDismissHeight; private Bubble mExpandedBubble; private boolean mIsExpanded; Loading Loading @@ -159,6 +160,8 @@ public class BubbleStackView extends FrameLayout { res.getDimensionPixelSize(R.dimen.bubble_expanded_animate_y_distance); mStatusBarHeight = res.getDimensionPixelSize(com.android.internal.R.dimen.status_bar_height); mPipDismissHeight = mContext.getResources().getDimensionPixelSize( R.dimen.pip_dismiss_gradient_height); mDisplaySize = new Point(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Loading Loading @@ -390,8 +393,7 @@ public class BubbleStackView extends FrameLayout { */ public void updateBubble(NotificationEntry entry, boolean updatePosition) { Bubble b = mBubbleData.getBubble(entry.key); b.iconView.update(entry); // TODO: should also update the expanded view here (e.g. height change) mBubbleData.updateBubble(entry.key, entry); if (updatePosition && !mIsExpanded) { // If alerting it gets promoted to top of the stack. Loading Loading @@ -652,6 +654,20 @@ public class BubbleStackView extends FrameLayout { StatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED); } /** * Calculates how large the expanded view of the bubble can be. This takes into account the * y position when the bubbles are expanded as well as the bounds of the dismiss target. */ int getMaxExpandedHeight() { int expandedY = (int) mExpandedAnimationController.getExpandedY(); int bubbleContainerHeight = mBubbleContainer.getChildAt(0) != null ? mBubbleContainer.getChildAt(0).getHeight() : 0; // PIP dismiss view uses FLAG_LAYOUT_IN_SCREEN so we need to subtract the bottom inset int pipDismissHeight = mPipDismissHeight - getBottomInset(); return mDisplaySize.y - expandedY - mBubbleSize - pipDismissHeight; } /** * Minimum velocity, in pixels/second, required to get from x to destX while being slowed by a * given frictional force. Loading Loading @@ -688,6 +704,14 @@ public class BubbleStackView extends FrameLayout { return 0; } private int getBottomInset() { if (getRootWindowInsets() != null) { WindowInsets insets = getRootWindowInsets(); return insets.getSystemWindowInsetBottom(); } return 0; } private boolean isIntersecting(View view, float x, float y) { mTempLoc = view.getLocationOnScreen(); mTempRect.set(mTempLoc[0], mTempLoc[1], mTempLoc[0] + view.getWidth(), Loading
packages/SystemUI/src/com/android/systemui/bubbles/animation/ExpandedAnimationController.java +2 −2 Original line number Diff line number Diff line Loading @@ -203,8 +203,8 @@ public class ExpandedAnimationController } /** The Y value of the row of expanded bubbles. */ private float getExpandedY() { final WindowInsets insets = mLayout.getRootWindowInsets(); public float getExpandedY() { final WindowInsets insets = mLayout != null ? mLayout.getRootWindowInsets() : null; if (insets != null) { return mBubblePaddingPx + Math.max( mStatusBarHeight, Loading