From 5119787a2745addb7a7458a43165cdbb26657aa0 Mon Sep 17 00:00:00 2001 From: paulhu Date: Fri, 19 Feb 2021 15:30:02 +0800 Subject: [PATCH] Expose NetworkWatchlistManager#getWatchlistConfigHash Connectivity is becoming a mainline module in S and ConnectivityService is used this API for getting watch list configurations. However, Mainline modules are not allowed to use non-formal APIs. Thus, make this API as module-lib api to support the usage. Bug: 172183305 Test: make update-api Change-Id: I21ce5f158850892926b92cf6347c61a57ac95b72 --- core/api/module-lib-current.txt | 4 ++++ core/java/android/net/NetworkWatchlistManager.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt index 527cf9e5e27d4..374c1c74d8e56 100644 --- a/core/api/module-lib-current.txt +++ b/core/api/module-lib-current.txt @@ -36,6 +36,10 @@ package android.net { field public static final int TRANSPORT_TEST = 7; // 0x7 } + public class NetworkWatchlistManager { + method @Nullable public byte[] getWatchlistConfigHash(); + } + public final class Proxy { method public static void setHttpProxyConfiguration(@Nullable android.net.ProxyInfo); } diff --git a/core/java/android/net/NetworkWatchlistManager.java b/core/java/android/net/NetworkWatchlistManager.java index 49047d3a0c873..8f6510ed3ea57 100644 --- a/core/java/android/net/NetworkWatchlistManager.java +++ b/core/java/android/net/NetworkWatchlistManager.java @@ -16,6 +16,8 @@ package android.net; +import android.annotation.Nullable; +import android.annotation.SystemApi; import android.annotation.SystemService; import android.content.Context; import android.os.RemoteException; @@ -29,6 +31,7 @@ import com.android.internal.util.Preconditions; * Class that manage network watchlist in system. * @hide */ +@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @SystemService(Context.NETWORK_WATCHLIST_SERVICE) public class NetworkWatchlistManager { @@ -90,6 +93,7 @@ public class NetworkWatchlistManager { /** * Get Network Watchlist config file hash. */ + @Nullable public byte[] getWatchlistConfigHash() { try { return mNetworkWatchlistManager.getWatchlistConfigHash();