[cr138][Android] SiteChannelsManager.getChannelStatus is now getChannelStatusAsync
Chromium change: https://source.chromium.org/chromium/chromium/src/+/bce682524fa13d089a8a13b4f19b048a21326009 Switch to use BaseNotificationManagerProxy for Site Chnanels This CL switches SiteChannelsManager to use BaseNotificationManagerProxy. And it also changed the getChannelStatus() call to be async. Use BaseNotificationManagerProxy allows Chrome to experiment the effect of AsyncNotificationManagerProxy when it is enabled. Bug: 242038130 Change-Id: I9b1fd060382e65f81e85971d04dac26618473184 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516182
This commit is contained in:
+21
-3
@@ -5,17 +5,35 @@
|
||||
|
||||
package org.chromium.chrome.browser.notifications.channels;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
|
||||
import org.jni_zero.CalledByNative;
|
||||
|
||||
import org.chromium.base.BraveReflectionUtil;
|
||||
import org.chromium.chrome.browser.notifications.NotificationChannelStatus;
|
||||
import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl;
|
||||
|
||||
/**
|
||||
* This class provides our native code to access SiteChannelsManager without patching
|
||||
* notification_channels_provider_android.cc/h.
|
||||
* This class provides our native code to access NotificationManagerProxy/SiteChannelsManager
|
||||
* without patching notification_channels_provider_android.cc/h.
|
||||
*/
|
||||
public class BraveSiteChannelsManagerBridge {
|
||||
@CalledByNative
|
||||
static @NotificationChannelStatus int getChannelStatus(String channelId) {
|
||||
return SiteChannelsManager.getInstance().getChannelStatus(channelId);
|
||||
// NotificationManagerProxy.getNotificationChannel is now deprecated
|
||||
// But it goes eventually to Android API
|
||||
// androidx.core.app.NotificationManagerCompat.getNotificationChannel,
|
||||
// see components/browser_ui/notifications/NotificationManagerProxyImpl.java
|
||||
NotificationChannel channel =
|
||||
NotificationManagerProxyImpl.getInstance().getNotificationChannel(channelId);
|
||||
if (channel == null) return NotificationChannelStatus.UNAVAILABLE;
|
||||
|
||||
return (int)
|
||||
BraveReflectionUtil.invokeMethod(
|
||||
SiteChannelsManager.class,
|
||||
null,
|
||||
"toChannelStatus",
|
||||
int.class,
|
||||
channel.getImportance());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,3 +101,7 @@
|
||||
-keep class org.chromium.chrome.browser.media.FullscreenVideoPictureInPictureController {
|
||||
*** dismissActivityIfNeeded(...);
|
||||
}
|
||||
|
||||
-keep class org.chromium.chrome.browser.notifications.channels.SiteChannelsManager {
|
||||
*** toChannelStatus(...);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user