Commit 411c63df authored by Xi Han's avatar Xi Han Committed by Commit Bot

[WebAPKs] Fix: notification breaks on pre-O.

This is caused by a missing check of whether the android os version of the
device is o+.

Bug: 700228
Change-Id: Id944f681465f4bd5b2b0ec869f13506196b1140a
Reviewed-on: https://chromium-review.googlesource.com/814138Reviewed-by: default avatarPeter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522485}
parent ae2a67ea
......@@ -4,7 +4,6 @@
package org.chromium.webapk.lib.runtime_library;
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
......@@ -84,16 +83,17 @@ public class WebApkServiceImpl extends IWebApkApi.Stub {
return NotificationManagerCompat.from(mContext).areNotificationsEnabled();
}
@TargetApi(Build.VERSION_CODES.O)
@SuppressWarnings("NewApi")
@Override
public void notifyNotificationWithChannel(
String platformTag, int platformID, Notification notification, String channelName) {
NotificationManager notificationManager = getNotificationManager();
if (notification.getChannelId() != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notification.getChannelId() != null) {
NotificationChannel channel = new NotificationChannel(notification.getChannelId(),
channelName, NotificationManager.IMPORTANCE_DEFAULT);
notificationManager.createNotificationChannel(channel);
}
notificationManager.notify(platformTag, platformID, notification);
}
......
......@@ -5,4 +5,4 @@
# Must be incremented whenever the runtime library is updated. The WebAPK
# re-extracts the runtime library from the Chrome APK when
# |runtime_library_version| is incremented.
runtime_library_version = 4
runtime_library_version = 5
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment