Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java

Issue 2589333002: Revert of Revert "Revert of Implement GetDisplayed on android M+ (patchset #3 id:60001 of https://codereview.… (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
index d1f81e45c993b7bf59554082a81b594440443944..26a96f9942d9e99bed462404e521b9e30b7f6685 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -15,7 +15,6 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
-import android.service.notification.StatusBarNotification;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -44,8 +43,6 @@
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
import javax.annotation.Nullable;
@@ -575,15 +572,6 @@
makeDefaults(vibrationPattern.length, silent, vibrateEnabled));
notificationBuilder.setVibrate(makeVibrationPattern(vibrationPattern));
- // The extras bundle is available from API 20 but it's currenlty only used to retrieve
- // notifications which is only available from 23 (Marshmallow) onwards.
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- Bundle extras = new Bundle();
- extras.putString(NotificationConstants.EXTRA_NOTIFICATION_ID, notificationId);
- extras.putString(NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_ID, profileId);
- notificationBuilder.setExtras(extras);
- }
-
String platformTag = makePlatformTag(notificationId, origin, tag);
if (webApkPackage.isEmpty()) {
mNotificationManager.notify(platformTag, PLATFORM_ID, notificationBuilder.build());
@@ -685,39 +673,6 @@
} else {
WebApkNotificationClient.cancelNotification(webApkPackage, platformTag, PLATFORM_ID);
}
- }
-
- /**
- * Returns the notification ids on disply for a given |profileId|.
- *
- * @param profileId of the profile to retrieve notifications for.
- */
- @CalledByNative
- private String[] getNotificationsForProfile(String profileId) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
- return null;
- }
-
- if (mNotificationManager.getActiveNotifications() == null) {
- return null;
- }
-
- StatusBarNotification[] displayedNotifications =
- mNotificationManager.getActiveNotifications();
- List<String> notifications = new ArrayList<String>();
- for (StatusBarNotification notification : displayedNotifications) {
- Bundle extras = notification.getNotification().extras;
- String notificationId = extras.getString(NotificationConstants.EXTRA_NOTIFICATION_ID);
- String notificationProfileId =
- extras.getString(NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_ID);
- if (notificationId != null && profileId.equals(notificationProfileId)) {
- notifications.add(notificationId);
- }
- }
- if (notifications.size() == 0) return null;
-
- String[] result = new String[notifications.size()];
- return notifications.toArray(result);
}
/**

Powered by Google App Engine
This is Rietveld 408576698