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

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

Issue 2611333002: Android web notifications: Schedule job instead of starting service (N+) (Closed)
Patch Set: Created 3 years, 11 months 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 c2ff7ecb4343185c234717e366540016d6d41359..de379996314bc6466b8ce800469405790600057c 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
@@ -223,9 +223,14 @@ public class NotificationPlatformBridge {
}
@Nullable
- private static String getNotificationReply(Intent intent) {
+ static String getNotificationReply(Intent intent) {
Peter Beverloo 2017/01/09 14:28:05 nit: why remove `private`? That's more restricted
awdf 2017/01/11 14:56:18 Because it's now also called from NotificationServ
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
// RemoteInput was added in KITKAT_WATCH.
+ if (intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY) != null) {
+ // If the notification click went through the job scheduler, we will have set
+ // the reply as a standard string extra.
+ return intent.getStringExtra(NotificationConstants.EXTRA_NOTIFICATION_REPLY);
+ }
Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent);
if (remoteInputResults != null) {
CharSequence reply =
@@ -320,6 +325,9 @@ public class NotificationPlatformBridge {
* Returns the PendingIntent for completing |action| on the notification identified by the data
* in the other parameters.
*
+ * All parameters set here should also be set in
+ * {@link NotificationService.Receiver#getJobExtrasFromIntent(Intent)}.
+ *
* @param action The action this pending intent will represent.
* @param notificationId The id of the notification.
* @param origin The origin to whom the notification belongs.
@@ -336,7 +344,6 @@ public class NotificationPlatformBridge {
Uri intentData = makeIntentData(notificationId, origin, actionIndex);
Intent intent = new Intent(action, intentData);
intent.setClass(mAppContext, NotificationService.Receiver.class);
-
intent.putExtra(NotificationConstants.EXTRA_NOTIFICATION_ID, notificationId);
intent.putExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_ORIGIN, origin);
intent.putExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_PROFILE_ID, profileId);
@@ -345,7 +352,6 @@ public class NotificationPlatformBridge {
intent.putExtra(
NotificationConstants.EXTRA_NOTIFICATION_INFO_WEBAPK_PACKAGE, webApkPackage);
intent.putExtra(NotificationConstants.EXTRA_NOTIFICATION_INFO_ACTION_INDEX, actionIndex);
-
return PendingIntent.getBroadcast(mAppContext, PENDING_INTENT_REQUEST_CODE, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
}

Powered by Google App Engine
This is Rietveld 408576698