Merge "Overflow dogfood flag" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f134ea991d
@@ -73,6 +73,9 @@ public class BubbleExperimentConfig {
|
|||||||
|
|
||||||
private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps";
|
private static final String WHITELISTED_AUTO_BUBBLE_APPS = "whitelisted_auto_bubble_apps";
|
||||||
|
|
||||||
|
private static final String ALLOW_BUBBLE_OVERFLOW = "allow_bubble_overflow";
|
||||||
|
private static final boolean ALLOW_BUBBLE_OVERFLOW_DEFAULT = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When true, if a notification has the information necessary to bubble (i.e. valid
|
* When true, if a notification has the information necessary to bubble (i.e. valid
|
||||||
* contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata}
|
* contentIntent and an icon or image), then a {@link android.app.Notification.BubbleMetadata}
|
||||||
@@ -86,6 +89,15 @@ public class BubbleExperimentConfig {
|
|||||||
ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT ? 1 : 0) != 0;
|
ALLOW_ANY_NOTIF_TO_BUBBLE_DEFAULT ? 1 : 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When true, show a menu with dismissed and aged-out bubbles.
|
||||||
|
*/
|
||||||
|
static boolean allowBubbleOverflow(Context context) {
|
||||||
|
return Settings.Secure.getInt(context.getContentResolver(),
|
||||||
|
ALLOW_BUBBLE_OVERFLOW,
|
||||||
|
ALLOW_BUBBLE_OVERFLOW_DEFAULT ? 1 : 0) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link #allowAnyNotifToBubble(Context)} except it filters for notifications that
|
* Same as {@link #allowAnyNotifToBubble(Context)} except it filters for notifications that
|
||||||
* are using {@link Notification.MessagingStyle} and have remote input.
|
* are using {@link Notification.MessagingStyle} and have remote input.
|
||||||
|
|||||||
@@ -589,6 +589,9 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setUpOverflow() {
|
private void setUpOverflow() {
|
||||||
|
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int overflowBtnIndex = 0;
|
int overflowBtnIndex = 0;
|
||||||
if (mBubbleOverflow == null) {
|
if (mBubbleOverflow == null) {
|
||||||
mBubbleOverflow = new BubbleOverflow(getContext());
|
mBubbleOverflow = new BubbleOverflow(getContext());
|
||||||
@@ -800,7 +803,8 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
@Nullable
|
@Nullable
|
||||||
Bubble getExpandedBubble() {
|
Bubble getExpandedBubble() {
|
||||||
if (mExpandedBubble == null
|
if (mExpandedBubble == null
|
||||||
|| (mExpandedBubble.getIconView() == mBubbleOverflow.getBtn()
|
|| (BubbleExperimentConfig.allowBubbleOverflow(mContext)
|
||||||
|
&& mExpandedBubble.getIconView() == mBubbleOverflow.getBtn()
|
||||||
&& BubbleOverflow.KEY.equals(mExpandedBubble.getKey()))) {
|
&& BubbleOverflow.KEY.equals(mExpandedBubble.getKey()))) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -857,6 +861,9 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateOverflowBtnVisibility(boolean apply) {
|
private void updateOverflowBtnVisibility(boolean apply) {
|
||||||
|
if (!BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mIsExpanded) {
|
if (mIsExpanded) {
|
||||||
if (DEBUG_BUBBLE_STACK_VIEW) {
|
if (DEBUG_BUBBLE_STACK_VIEW) {
|
||||||
Log.d(TAG, "Show overflow button.");
|
Log.d(TAG, "Show overflow button.");
|
||||||
@@ -1083,7 +1090,8 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
float y = event.getRawY();
|
float y = event.getRawY();
|
||||||
if (mIsExpanded) {
|
if (mIsExpanded) {
|
||||||
if (isIntersecting(mBubbleContainer, x, y)) {
|
if (isIntersecting(mBubbleContainer, x, y)) {
|
||||||
if (isIntersecting(mBubbleOverflow.getBtn(), x, y)) {
|
if (BubbleExperimentConfig.allowBubbleOverflow(mContext)
|
||||||
|
&& isIntersecting(mBubbleOverflow.getBtn(), x, y)) {
|
||||||
return mBubbleOverflow.getBtn();
|
return mBubbleOverflow.getBtn();
|
||||||
}
|
}
|
||||||
// Could be tapping or dragging a bubble while expanded
|
// Could be tapping or dragging a bubble while expanded
|
||||||
@@ -1820,9 +1828,12 @@ public class BubbleStackView extends FrameLayout {
|
|||||||
* @return the number of bubbles in the stack view.
|
* @return the number of bubbles in the stack view.
|
||||||
*/
|
*/
|
||||||
public int getBubbleCount() {
|
public int getBubbleCount() {
|
||||||
|
if (BubbleExperimentConfig.allowBubbleOverflow(mContext)) {
|
||||||
// Subtract 1 for the overflow button that is always in the bubble container.
|
// Subtract 1 for the overflow button that is always in the bubble container.
|
||||||
return mBubbleContainer.getChildCount() - 1;
|
return mBubbleContainer.getChildCount() - 1;
|
||||||
}
|
}
|
||||||
|
return mBubbleContainer.getChildCount();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the bubble index within the stack.
|
* Finds the bubble index within the stack.
|
||||||
|
|||||||
Reference in New Issue
Block a user