Loading Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -205,6 +205,7 @@ LOCAL_SRC_FILES += \ core/java/android/net/IIpConnectivityMetrics.aidl \ core/java/android/net/IIpConnectivityMetrics.aidl \ core/java/android/net/IEthernetManager.aidl \ core/java/android/net/IEthernetManager.aidl \ core/java/android/net/IEthernetServiceListener.aidl \ core/java/android/net/IEthernetServiceListener.aidl \ core/java/android/net/INetdEventCallback.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/INetworkPolicyListener.aidl \ core/java/android/net/INetworkPolicyListener.aidl \ core/java/android/net/INetworkPolicyManager.aidl \ core/java/android/net/INetworkPolicyManager.aidl \ Loading core/java/android/app/admin/DevicePolicyManager.java +42 −0 Original line number Original line Diff line number Diff line Loading @@ -6609,4 +6609,46 @@ public class DevicePolicyManager { throw re.rethrowFromSystemServer(); throw re.rethrowFromSystemServer(); } } } } /** * Called by a device owner to control the network logging feature. Logging can only be * enabled on single user devices where the sole user is managed by the device owner. If a new * user is added on the device, logging is disabled. * * <p> Network logs contain DNS lookup and connect() library call events. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled whether network logging should be enabled or not. * @throws {@link SecurityException} if {@code admin} is not a device owner. * @throws {@link RemoteException} if network logging could not be enabled or disabled due to * the logging service not being available * * @hide */ public void setNetworkLoggingEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setNetworkLoggingEnabled"); try { mService.setNetworkLoggingEnabled(admin, enabled); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Return whether network logging is enabled by a device owner. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return {@code true} if network logging is enabled by device owner, {@code false} otherwise. * @throws {@link SecurityException} if {@code admin} is not a device owner. * * @hide */ public boolean isNetworkLoggingEnabled(@NonNull ComponentName admin) { throwIfParentInstance("isNetworkLoggingEnabled"); try { return mService.isNetworkLoggingEnabled(admin); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } } } core/java/android/app/admin/IDevicePolicyManager.aidl +3 −0 Original line number Original line Diff line number Diff line Loading @@ -311,4 +311,7 @@ interface IDevicePolicyManager { void setBackupServiceEnabled(in ComponentName admin, boolean enabled); void setBackupServiceEnabled(in ComponentName admin, boolean enabled); boolean isBackupServiceEnabled(in ComponentName admin); boolean isBackupServiceEnabled(in ComponentName admin); void setNetworkLoggingEnabled(in ComponentName admin, boolean enabled); boolean isNetworkLoggingEnabled(in ComponentName admin); } } core/java/android/net/IIpConnectivityMetrics.aidl +10 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.net; import android.os.Parcelable; import android.os.Parcelable; import android.net.ConnectivityMetricsEvent; import android.net.ConnectivityMetricsEvent; import android.net.INetdEventCallback; /** {@hide} */ /** {@hide} */ interface IIpConnectivityMetrics { interface IIpConnectivityMetrics { Loading @@ -27,4 +28,13 @@ interface IIpConnectivityMetrics { * or -1 if the event was dropped due to rate limiting. * or -1 if the event was dropped due to rate limiting. */ */ int logEvent(in ConnectivityMetricsEvent event); int logEvent(in ConnectivityMetricsEvent event); /** * At most one callback can be registered (by DevicePolicyManager). * @return status {@code true} if registering/unregistering of the callback was successful, * {@code false} otherwise (might happen if IIpConnectivityMetrics is not available, * if it happens make sure you call it when the service is up in the caller) */ boolean registerNetdEventCallback(in INetdEventCallback callback); boolean unregisterNetdEventCallback(); } } core/java/android/net/INetdEventCallback.aidl 0 → 100644 +47 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net; /** {@hide} */ oneway interface INetdEventCallback { /** * Reports a single DNS lookup function call. * This method must not block or perform long-running operations. * * @param hostname the name that was looked up. * @param ipAddresses (possibly a subset of) the IP addresses returned. * At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged. * @param ipAddressesCount the number of IP addresses returned. May be different from the length * of ipAddresses if there were too many addresses to log. * @param timestamp the timestamp at which the query was reported by netd. * @param uid the UID of the application that performed the query. */ void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid); /** * Reports a single connect library call. * This method must not block or perform long-running operations. * * @param ipAddr destination IP address. * @param port destination port number. * @param timestamp the timestamp at which the call was reported by netd. * @param uid the UID of the application that performed the connection. */ void onConnectEvent(String ipAddr, int port, long timestamp, int uid); } Loading
Android.mk +1 −0 Original line number Original line Diff line number Diff line Loading @@ -205,6 +205,7 @@ LOCAL_SRC_FILES += \ core/java/android/net/IIpConnectivityMetrics.aidl \ core/java/android/net/IIpConnectivityMetrics.aidl \ core/java/android/net/IEthernetManager.aidl \ core/java/android/net/IEthernetManager.aidl \ core/java/android/net/IEthernetServiceListener.aidl \ core/java/android/net/IEthernetServiceListener.aidl \ core/java/android/net/INetdEventCallback.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/INetworkManagementEventObserver.aidl \ core/java/android/net/INetworkPolicyListener.aidl \ core/java/android/net/INetworkPolicyListener.aidl \ core/java/android/net/INetworkPolicyManager.aidl \ core/java/android/net/INetworkPolicyManager.aidl \ Loading
core/java/android/app/admin/DevicePolicyManager.java +42 −0 Original line number Original line Diff line number Diff line Loading @@ -6609,4 +6609,46 @@ public class DevicePolicyManager { throw re.rethrowFromSystemServer(); throw re.rethrowFromSystemServer(); } } } } /** * Called by a device owner to control the network logging feature. Logging can only be * enabled on single user devices where the sole user is managed by the device owner. If a new * user is added on the device, logging is disabled. * * <p> Network logs contain DNS lookup and connect() library call events. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled whether network logging should be enabled or not. * @throws {@link SecurityException} if {@code admin} is not a device owner. * @throws {@link RemoteException} if network logging could not be enabled or disabled due to * the logging service not being available * * @hide */ public void setNetworkLoggingEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setNetworkLoggingEnabled"); try { mService.setNetworkLoggingEnabled(admin, enabled); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Return whether network logging is enabled by a device owner. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return {@code true} if network logging is enabled by device owner, {@code false} otherwise. * @throws {@link SecurityException} if {@code admin} is not a device owner. * * @hide */ public boolean isNetworkLoggingEnabled(@NonNull ComponentName admin) { throwIfParentInstance("isNetworkLoggingEnabled"); try { return mService.isNetworkLoggingEnabled(admin); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } } }
core/java/android/app/admin/IDevicePolicyManager.aidl +3 −0 Original line number Original line Diff line number Diff line Loading @@ -311,4 +311,7 @@ interface IDevicePolicyManager { void setBackupServiceEnabled(in ComponentName admin, boolean enabled); void setBackupServiceEnabled(in ComponentName admin, boolean enabled); boolean isBackupServiceEnabled(in ComponentName admin); boolean isBackupServiceEnabled(in ComponentName admin); void setNetworkLoggingEnabled(in ComponentName admin, boolean enabled); boolean isNetworkLoggingEnabled(in ComponentName admin); } }
core/java/android/net/IIpConnectivityMetrics.aidl +10 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.net; import android.os.Parcelable; import android.os.Parcelable; import android.net.ConnectivityMetricsEvent; import android.net.ConnectivityMetricsEvent; import android.net.INetdEventCallback; /** {@hide} */ /** {@hide} */ interface IIpConnectivityMetrics { interface IIpConnectivityMetrics { Loading @@ -27,4 +28,13 @@ interface IIpConnectivityMetrics { * or -1 if the event was dropped due to rate limiting. * or -1 if the event was dropped due to rate limiting. */ */ int logEvent(in ConnectivityMetricsEvent event); int logEvent(in ConnectivityMetricsEvent event); /** * At most one callback can be registered (by DevicePolicyManager). * @return status {@code true} if registering/unregistering of the callback was successful, * {@code false} otherwise (might happen if IIpConnectivityMetrics is not available, * if it happens make sure you call it when the service is up in the caller) */ boolean registerNetdEventCallback(in INetdEventCallback callback); boolean unregisterNetdEventCallback(); } }
core/java/android/net/INetdEventCallback.aidl 0 → 100644 +47 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.net; /** {@hide} */ oneway interface INetdEventCallback { /** * Reports a single DNS lookup function call. * This method must not block or perform long-running operations. * * @param hostname the name that was looked up. * @param ipAddresses (possibly a subset of) the IP addresses returned. * At most {@link #DNS_REPORTED_IP_ADDRESSES_LIMIT} addresses are logged. * @param ipAddressesCount the number of IP addresses returned. May be different from the length * of ipAddresses if there were too many addresses to log. * @param timestamp the timestamp at which the query was reported by netd. * @param uid the UID of the application that performed the query. */ void onDnsEvent(String hostname, in String[] ipAddresses, int ipAddressesCount, long timestamp, int uid); /** * Reports a single connect library call. * This method must not block or perform long-running operations. * * @param ipAddr destination IP address. * @param port destination port number. * @param timestamp the timestamp at which the call was reported by netd. * @param uid the UID of the application that performed the connection. */ void onConnectEvent(String ipAddr, int port, long timestamp, int uid); }