summaryrefslogtreecommitdiff
path: root/core/java/android/app/Notification.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/app/Notification.java')
-rw-r--r--core/java/android/app/Notification.java26
1 files changed, 10 insertions, 16 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 61b1abe25ca2..9605cbdb48c6 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -6793,7 +6793,7 @@ public class Notification implements Parcelable
// We show these sorts of notifications immediately in the absence of
// any explicit app declaration
- if (isMediaNotification() || hasMediaSession()
+ if (isMediaNotification()
|| CATEGORY_CALL.equals(category)
|| CATEGORY_NAVIGATION.equals(category)
|| (actions != null && actions.length > 0)) {
@@ -6813,14 +6813,6 @@ public class Notification implements Parcelable
}
/**
- * @return whether this notification has a media session attached
- * @hide
- */
- public boolean hasMediaSession() {
- return extras.getParcelable(Notification.EXTRA_MEDIA_SESSION) != null;
- }
-
- /**
* @return the style class of this notification
* @hide
*/
@@ -6863,18 +6855,20 @@ public class Notification implements Parcelable
}
/**
- * @return true if this is a media notification
+ * @return true if this is a media style notification with a media session
*
* @hide
*/
public boolean isMediaNotification() {
Class<? extends Style> style = getNotificationStyle();
- if (MediaStyle.class.equals(style)) {
- return true;
- } else if (DecoratedMediaCustomViewStyle.class.equals(style)) {
- return true;
- }
- return false;
+ boolean isMediaStyle = (MediaStyle.class.equals(style)
+ || DecoratedMediaCustomViewStyle.class.equals(style));
+
+ boolean hasMediaSession = (extras.getParcelable(Notification.EXTRA_MEDIA_SESSION) != null
+ && extras.getParcelable(Notification.EXTRA_MEDIA_SESSION)
+ instanceof MediaSession.Token);
+
+ return isMediaStyle && hasMediaSession;
}
/**