Merge "Add new netd event callback for changes to private DNS validation state." into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fd36a5ddea
@@ -20,8 +20,9 @@ package android.net;
|
|||||||
oneway interface INetdEventCallback {
|
oneway interface INetdEventCallback {
|
||||||
|
|
||||||
// Possible addNetdEventCallback callers.
|
// Possible addNetdEventCallback callers.
|
||||||
const int CALLBACK_CALLER_DEVICE_POLICY = 0;
|
const int CALLBACK_CALLER_CONNECTIVITY_SERVICE = 0;
|
||||||
const int CALLBACK_CALLER_NETWORK_WATCHLIST = 1;
|
const int CALLBACK_CALLER_DEVICE_POLICY = 1;
|
||||||
|
const int CALLBACK_CALLER_NETWORK_WATCHLIST = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports a single DNS lookup function call.
|
* Reports a single DNS lookup function call.
|
||||||
@@ -38,6 +39,18 @@ oneway interface INetdEventCallback {
|
|||||||
void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp,
|
void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp,
|
||||||
int uid);
|
int uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a private DNS validation success or failure.
|
||||||
|
* This method must not block or perform long-running operations.
|
||||||
|
*
|
||||||
|
* @param netId the ID of the network the validation was performed on.
|
||||||
|
* @param ipAddress the IP address for which validation was performed.
|
||||||
|
* @param hostname the hostname for which validation was performed.
|
||||||
|
* @param validated whether or not validation was successful.
|
||||||
|
*/
|
||||||
|
void onPrivateDnsValidationEvent(int netId, String ipAddress, String hostname,
|
||||||
|
boolean validated);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports a single connect library call.
|
* Reports a single connect library call.
|
||||||
* This method must not block or perform long-running operations.
|
* This method must not block or perform long-running operations.
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ public class BaseNetdEventCallback extends INetdEventCallback.Stub {
|
|||||||
// default no-op
|
// default no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPrivateDnsValidationEvent(int netId, String ipAddress,
|
||||||
|
String hostname, boolean validated) {
|
||||||
|
// default no-op
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectEvent(String ipAddr, int port, long timestamp, int uid) {
|
public void onConnectEvent(String ipAddr, int port, long timestamp, int uid) {
|
||||||
// default no-op
|
// default no-op
|
||||||
|
|||||||
@@ -102,9 +102,12 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* There are only 2 possible callbacks.
|
* There are only 3 possible callbacks.
|
||||||
*
|
*
|
||||||
* mNetdEventCallbackList[CALLBACK_CALLER_DEVICE_POLICY].
|
* mNetdEventCallbackList[CALLBACK_CALLER_CONNECTIVITY_SERVICE]
|
||||||
|
* Callback registered/unregistered by ConnectivityService.
|
||||||
|
*
|
||||||
|
* mNetdEventCallbackList[CALLBACK_CALLER_DEVICE_POLICY]
|
||||||
* Callback registered/unregistered when logging is being enabled/disabled in DPM
|
* Callback registered/unregistered when logging is being enabled/disabled in DPM
|
||||||
* by the device owner. It's DevicePolicyManager's responsibility to ensure that.
|
* by the device owner. It's DevicePolicyManager's responsibility to ensure that.
|
||||||
*
|
*
|
||||||
@@ -113,6 +116,7 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
|
|||||||
*/
|
*/
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private static final int[] ALLOWED_CALLBACK_TYPES = {
|
private static final int[] ALLOWED_CALLBACK_TYPES = {
|
||||||
|
INetdEventCallback.CALLBACK_CALLER_CONNECTIVITY_SERVICE,
|
||||||
INetdEventCallback.CALLBACK_CALLER_DEVICE_POLICY,
|
INetdEventCallback.CALLBACK_CALLER_DEVICE_POLICY,
|
||||||
INetdEventCallback.CALLBACK_CALLER_NETWORK_WATCHLIST
|
INetdEventCallback.CALLBACK_CALLER_NETWORK_WATCHLIST
|
||||||
};
|
};
|
||||||
@@ -209,6 +213,19 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
// Called concurrently by multiple binder threads.
|
||||||
|
// This method must not block or perform long-running operations.
|
||||||
|
public synchronized void onPrivateDnsValidationEvent(int netId,
|
||||||
|
String ipAddress, String hostname, boolean validated)
|
||||||
|
throws RemoteException {
|
||||||
|
for (INetdEventCallback callback : mNetdEventCallbackList) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onPrivateDnsValidationEvent(netId, ipAddress, hostname, validated);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// Called concurrently by multiple binder threads.
|
// Called concurrently by multiple binder threads.
|
||||||
// This method must not block or perform long-running operations.
|
// This method must not block or perform long-running operations.
|
||||||
|
|||||||
Reference in New Issue
Block a user