Merge "Drop the 'initial' of suppressInitialNotification API" into qt-dev
This commit is contained in:
@@ -5481,7 +5481,8 @@ package android.app {
|
|||||||
method @DimenRes public int getDesiredHeightResId();
|
method @DimenRes public int getDesiredHeightResId();
|
||||||
method @NonNull public android.graphics.drawable.Icon getIcon();
|
method @NonNull public android.graphics.drawable.Icon getIcon();
|
||||||
method @NonNull public android.app.PendingIntent getIntent();
|
method @NonNull public android.app.PendingIntent getIntent();
|
||||||
method public boolean getSuppressInitialNotification();
|
method @Deprecated public boolean getSuppressInitialNotification();
|
||||||
|
method public boolean getSuppressNotification();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.BubbleMetadata> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.BubbleMetadata> CREATOR;
|
||||||
}
|
}
|
||||||
@@ -5495,7 +5496,8 @@ package android.app {
|
|||||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
|
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 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 setIntent(@NonNull android.app.PendingIntent);
|
||||||
method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressInitialNotification(boolean);
|
method @Deprecated @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressInitialNotification(boolean);
|
||||||
|
method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressNotification(boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Notification.Builder {
|
public static class Notification.Builder {
|
||||||
|
|||||||
@@ -8557,16 +8557,16 @@ public class Notification implements Parcelable
|
|||||||
private static final int FLAG_AUTO_EXPAND_BUBBLE = 0x00000001;
|
private static final int FLAG_AUTO_EXPAND_BUBBLE = 0x00000001;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set and the app creating the bubble is in the foreground, the bubble will be posted
|
* If set and the app posting the bubble is in the foreground, the bubble will
|
||||||
* <b>without</b> the associated notification in the notification shade. Subsequent update
|
* be posted <b>without</b> the associated notification in the notification shade.
|
||||||
* notifications to this bubble will post a notification in the shade.
|
|
||||||
*
|
*
|
||||||
* <p>If the app creating the bubble is not in the foreground this flag has no effect.</p>
|
* <p>If the app posting the bubble is not in the foreground this flag has no effect.</p>
|
||||||
*
|
*
|
||||||
* <p>Generally this flag should only be set if the user has performed an action to request
|
* <p>Generally this flag should only be set if the user has performed an action to request
|
||||||
* or create a bubble.</p>
|
* or create a bubble, or if the user has seen the content in the notification and the
|
||||||
|
* notification is no longer relevant.</p>
|
||||||
*/
|
*/
|
||||||
private static final int FLAG_SUPPRESS_INITIAL_NOTIFICATION = 0x00000002;
|
private static final int FLAG_SUPPRESS_NOTIFICATION = 0x00000002;
|
||||||
|
|
||||||
private BubbleMetadata(PendingIntent expandIntent, PendingIntent deleteIntent,
|
private BubbleMetadata(PendingIntent expandIntent, PendingIntent deleteIntent,
|
||||||
Icon icon, int height, @DimenRes int heightResId) {
|
Icon icon, int height, @DimenRes int heightResId) {
|
||||||
@@ -8645,9 +8645,20 @@ public class Notification implements Parcelable
|
|||||||
* @return whether this bubble should suppress the initial notification when it is posted.
|
* @return whether this bubble should suppress the initial notification when it is posted.
|
||||||
*
|
*
|
||||||
* @see BubbleMetadata.Builder#setSuppressInitialNotification(boolean)
|
* @see BubbleMetadata.Builder#setSuppressInitialNotification(boolean)
|
||||||
|
* @deprecated TO BE REMOVED, use {@link #getSuppressNotification()} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public boolean getSuppressInitialNotification() {
|
public boolean getSuppressInitialNotification() {
|
||||||
return (mFlags & FLAG_SUPPRESS_INITIAL_NOTIFICATION) != 0;
|
return (mFlags & FLAG_SUPPRESS_NOTIFICATION) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether this bubble should suppress the notification when it is posted.
|
||||||
|
*
|
||||||
|
* @see BubbleMetadata.Builder#setSuppressInitialNotification(boolean)
|
||||||
|
*/
|
||||||
|
public boolean getSuppressNotification() {
|
||||||
|
return (mFlags & FLAG_SUPPRESS_NOTIFICATION) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Parcelable.Creator<BubbleMetadata> CREATOR =
|
public static final @android.annotation.NonNull Parcelable.Creator<BubbleMetadata> CREATOR =
|
||||||
@@ -8806,11 +8817,31 @@ public class Notification implements Parcelable
|
|||||||
*
|
*
|
||||||
* <p>Generally this flag should only be set if the user has performed an action to
|
* <p>Generally this flag should only be set if the user has performed an action to
|
||||||
* request or create a bubble.</p>
|
* request or create a bubble.</p>
|
||||||
|
*
|
||||||
|
* @deprecated TO BE REMOVED, use {@link #setSuppressNotification(boolean)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@NonNull
|
@NonNull
|
||||||
public BubbleMetadata.Builder setSuppressInitialNotification(
|
public BubbleMetadata.Builder setSuppressInitialNotification(
|
||||||
boolean shouldSupressNotif) {
|
boolean shouldSupressNotif) {
|
||||||
setFlag(FLAG_SUPPRESS_INITIAL_NOTIFICATION, shouldSupressNotif);
|
setFlag(FLAG_SUPPRESS_NOTIFICATION, shouldSupressNotif);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set and the app posting the bubble is in the foreground, the bubble will be
|
||||||
|
* posted <b>without</b> the associated notification in the notification shade.
|
||||||
|
*
|
||||||
|
* <p>If the app posting the bubble is not in the foreground this flag has no effect.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>Generally this flag should only be set if the user has performed an action to
|
||||||
|
* request or create a bubble, or if the user has seen the content in the notification
|
||||||
|
* and the notification is no longer relevant.</p>
|
||||||
|
*/
|
||||||
|
@NonNull
|
||||||
|
public BubbleMetadata.Builder setSuppressNotification(boolean shouldSupressNotif) {
|
||||||
|
setFlag(FLAG_SUPPRESS_NOTIFICATION, shouldSupressNotif);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -397,11 +397,8 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) {
|
if (shouldAutoBubbleForFlags(mContext, entry) || shouldBubble(entry)) {
|
||||||
// TODO: handle group summaries
|
// TODO: handle group summaries?
|
||||||
boolean suppressNotification = entry.getBubbleMetadata() != null
|
updateShowInShadeForSuppressNotification(entry);
|
||||||
&& entry.getBubbleMetadata().getSuppressInitialNotification()
|
|
||||||
&& isForegroundApp(entry.notification.getPackageName());
|
|
||||||
entry.setShowInShadeWhenBubble(!suppressNotification);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +419,7 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
}
|
}
|
||||||
if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
|
if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry)
|
||||||
&& alertAgain(entry, entry.notification.getNotification())) {
|
&& alertAgain(entry, entry.notification.getNotification())) {
|
||||||
entry.setShowInShadeWhenBubble(true);
|
updateShowInShadeForSuppressNotification(entry);
|
||||||
entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
|
entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed
|
||||||
updateBubble(entry);
|
updateBubble(entry);
|
||||||
mStackView.updateDotVisibility(entry.key);
|
mStackView.updateDotVisibility(entry.key);
|
||||||
@@ -589,6 +586,13 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe
|
|||||||
&& isForegroundApp(entry.notification.getPackageName());
|
&& isForegroundApp(entry.notification.getPackageName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateShowInShadeForSuppressNotification(NotificationEntry entry) {
|
||||||
|
boolean suppressNotification = entry.getBubbleMetadata() != null
|
||||||
|
&& entry.getBubbleMetadata().getSuppressNotification()
|
||||||
|
&& isForegroundApp(entry.notification.getPackageName());
|
||||||
|
entry.setShowInShadeWhenBubble(!suppressNotification);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the applications with the package name is running in foreground.
|
* Return true if the applications with the package name is running in foreground.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user