Add ConnectivityManager.getNetworkWatchlistConfigHash()

Apps can use this API to get network watchlist config hash for auditing.

Bug: 63908748
Test: Able to compile
Change-Id: I5ce9e6bb6dad88139c0a102da58be0dd7c284b7a
This commit is contained in:
Ricky Wai
2018-01-23 04:09:45 +00:00
parent 7f0087be48
commit 44dcbde52a
7 changed files with 51 additions and 0 deletions

View File

@@ -3763,4 +3763,20 @@ public class ConnectivityManager {
throw e.rethrowFromSystemServer();
}
}
/**
* The network watchlist is a list of domains and IP addresses that are associated with
* potentially harmful apps. This method returns the hash of the watchlist currently
* used by the system.
*
* @return Hash of network watchlist config file. Null if config does not exist.
*/
public byte[] getNetworkWatchlistConfigHash() {
try {
return mService.getNetworkWatchlistConfigHash();
} catch (RemoteException e) {
Log.e(TAG, "Unable to get watchlist config hash");
throw e.rethrowFromSystemServer();
}
}
}

View File

@@ -180,4 +180,6 @@ interface IConnectivityManager
void stopKeepalive(in Network network, int slot);
String getCaptivePortalServerUrl();
byte[] getNetworkWatchlistConfigHash();
}

View File

@@ -86,4 +86,16 @@ public class NetworkWatchlistManager {
e.rethrowFromSystemServer();
}
}
/**
* Get Network Watchlist config file hash.
*/
public byte[] getWatchlistConfigHash() {
try {
return mNetworkWatchlistManager.getWatchlistConfigHash();
} catch (RemoteException e) {
Log.e(TAG, "Unable to get watchlist config hash");
throw e.rethrowFromSystemServer();
}
}
}