Merge "API feedback: setSuppressableBubble/setSuppressBubble" into sc-dev
This commit is contained in:
@@ -5883,8 +5883,8 @@ package android.app {
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setIcon(@NonNull android.graphics.drawable.Icon);
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setIntent(@NonNull android.app.PendingIntent);
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressBubble(boolean);
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressNotification(boolean);
|
||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressableBubble(boolean);
|
||||
}
|
||||
|
||||
public static class Notification.Builder {
|
||||
|
||||
@@ -9908,7 +9908,7 @@ public class Notification implements Parcelable
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public static final int FLAG_SHOULD_SUPPRESS_BUBBLE = 0x00000004;
|
||||
public static final int FLAG_SUPPRESSABLE_BUBBLE = 0x00000004;
|
||||
|
||||
/**
|
||||
* Indicates whether the bubble is visually suppressed from the bubble stack.
|
||||
@@ -10070,21 +10070,65 @@ public class Notification implements Parcelable
|
||||
* @return whether this bubble should be suppressed when the same content is visible
|
||||
* outside of the bubble.
|
||||
*
|
||||
* @see BubbleMetadata.Builder#setSuppressBubble(boolean)
|
||||
* @see BubbleMetadata.Builder#setSuppressableBubble(boolean)
|
||||
*/
|
||||
public boolean isBubbleSuppressable() {
|
||||
return (mFlags & FLAG_SHOULD_SUPPRESS_BUBBLE) != 0;
|
||||
return (mFlags & FLAG_SUPPRESSABLE_BUBBLE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the bubble is currently visually suppressed from the bubble stack.
|
||||
*
|
||||
* @see BubbleMetadata.Builder#setSuppressBubble(boolean)
|
||||
* @see BubbleMetadata.Builder#setSuppressableBubble(boolean)
|
||||
*/
|
||||
public boolean isBubbleSuppressed() {
|
||||
return (mFlags & FLAG_SUPPRESS_BUBBLE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the notification associated with the bubble is being visually
|
||||
* suppressed from the notification shade. When <code>true</code> the notification is
|
||||
* hidden, when <code>false</code> the notification shows as normal.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void setSuppressNotification(boolean suppressed) {
|
||||
if (suppressed) {
|
||||
mFlags |= Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
|
||||
} else {
|
||||
mFlags &= ~Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the bubble should be visually suppressed from the bubble stack if the
|
||||
* user is viewing the same content outside of the bubble. For example, the user has a
|
||||
* bubble with Alice and then opens up the main app and navigates to Alice's page.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public void setSuppressBubble(boolean suppressed) {
|
||||
if (suppressed) {
|
||||
mFlags |= Notification.BubbleMetadata.FLAG_SUPPRESS_BUBBLE;
|
||||
} else {
|
||||
mFlags &= ~Notification.BubbleMetadata.FLAG_SUPPRESS_BUBBLE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setFlags(int flags) {
|
||||
mFlags = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int getFlags() {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<BubbleMetadata> CREATOR =
|
||||
new Parcelable.Creator<BubbleMetadata>() {
|
||||
|
||||
@@ -10127,20 +10171,6 @@ public class Notification implements Parcelable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void setFlags(int flags) {
|
||||
mFlags = flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int getFlags() {
|
||||
return mFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder to construct a {@link BubbleMetadata} object.
|
||||
*/
|
||||
@@ -10438,8 +10468,8 @@ public class Notification implements Parcelable
|
||||
* {@link Activity#setLocusContext(LocusId, Bundle)}
|
||||
*/
|
||||
@NonNull
|
||||
public BubbleMetadata.Builder setSuppressBubble(boolean suppressBubble) {
|
||||
setFlag(FLAG_SHOULD_SUPPRESS_BUBBLE, suppressBubble);
|
||||
public BubbleMetadata.Builder setSuppressableBubble(boolean suppressBubble) {
|
||||
setFlag(FLAG_SUPPRESSABLE_BUBBLE, suppressBubble);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ public class Bubble implements BubbleViewProvider {
|
||||
* hide the bubble when in the same content).
|
||||
*/
|
||||
boolean isSuppressable() {
|
||||
return (mFlags & Notification.BubbleMetadata.FLAG_SHOULD_SUPPRESS_BUBBLE) != 0;
|
||||
return (mFlags & Notification.BubbleMetadata.FLAG_SUPPRESSABLE_BUBBLE) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1332,26 +1332,16 @@ public class NotificationManagerService extends SystemService {
|
||||
return;
|
||||
}
|
||||
|
||||
int flags = data.getFlags();
|
||||
boolean flagChanged = false;
|
||||
if (data.isNotificationSuppressed() != isNotifSuppressed) {
|
||||
flagChanged = true;
|
||||
if (isNotifSuppressed) {
|
||||
flags |= Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
|
||||
} else {
|
||||
flags &= ~Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION;
|
||||
}
|
||||
data.setSuppressNotification(isNotifSuppressed);
|
||||
}
|
||||
if (data.isBubbleSuppressed() != isBubbleSuppressed) {
|
||||
flagChanged = true;
|
||||
if (isBubbleSuppressed) {
|
||||
flags |= Notification.BubbleMetadata.FLAG_SUPPRESS_BUBBLE;
|
||||
} else {
|
||||
flags &= ~Notification.BubbleMetadata.FLAG_SUPPRESS_BUBBLE;
|
||||
}
|
||||
data.setSuppressBubble(isBubbleSuppressed);
|
||||
}
|
||||
if (flagChanged) {
|
||||
data.setFlags(flags);
|
||||
r.getNotification().flags |= FLAG_ONLY_ALERT_ONCE;
|
||||
mHandler.post(
|
||||
new EnqueueNotificationRunnable(r.getUser().getIdentifier(), r,
|
||||
|
||||
Reference in New Issue
Block a user