diff options
| author | Alex Johnston <acjohnston@google.com> | 2021-02-16 15:55:26 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-02-16 15:55:26 +0000 |
| commit | 3f7da94bcf7af5aeb39dca3331f5b572dfe1a97c (patch) | |
| tree | 1415b6ba68575be67faac3ea9f259ae60d634d48 /core/java | |
| parent | 15c4d3210ad1374bc0feacecc74608eaae60b76a (diff) | |
| parent | 66e3908e391f2da9304ed3048e25ace89c6d99cb (diff) | |
Merge "Allow PO to enable network logging on work profile" into sc-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 3b4f720c654f..3b80f83aab0d 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -11718,8 +11718,11 @@ public class DevicePolicyManager { } /** - * Called by a device owner or delegated app with {@link #DELEGATION_NETWORK_LOGGING} to - * control the network logging feature. + * Called by a device owner, profile owner of a managed profile or delegated app with + * {@link #DELEGATION_NETWORK_LOGGING} to control the network logging feature. + * + * <p> When network logging is enabled by a profile owner, the network logs will only include + * work profile network activity, not activity on the personal profile. * * <p> Network logs contain DNS lookup and connect() library call events. The following library * functions are recorded while network logging is active: @@ -11759,7 +11762,7 @@ public class DevicePolicyManager { * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if called by a delegated app. * @param enabled whether network logging should be enabled or not. - * @throws SecurityException if {@code admin} is not a device owner. + * @throws SecurityException if {@code admin} is not a device owner or profile owner. * @see #setAffiliationIds * @see #retrieveNetworkLogs */ @@ -11773,14 +11776,16 @@ public class DevicePolicyManager { } /** - * Return whether network logging is enabled by a device owner. + * Return whether network logging is enabled by a device owner or profile owner of + * a managed profile. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. Can only * be {@code null} if the caller is a delegated app with {@link #DELEGATION_NETWORK_LOGGING} * or has MANAGE_USERS permission. - * @return {@code true} if network logging is enabled by device owner, {@code false} otherwise. - * @throws SecurityException if {@code admin} is not a device owner and caller has - * no MANAGE_USERS permission + * @return {@code true} if network logging is enabled by device owner or profile owner, + * {@code false} otherwise. + * @throws SecurityException if {@code admin} is not a device owner or profile owner and + * caller has no MANAGE_USERS permission */ public boolean isNetworkLoggingEnabled(@Nullable ComponentName admin) { throwIfParentInstance("isNetworkLoggingEnabled"); @@ -11792,9 +11797,14 @@ public class DevicePolicyManager { } /** - * Called by device owner or delegated app with {@link #DELEGATION_NETWORK_LOGGING} to retrieve - * the most recent batch of network logging events. - * A device owner has to provide a batchToken provided as part of + * Called by device owner, profile owner of a managed profile or delegated app with + * {@link #DELEGATION_NETWORK_LOGGING} to retrieve the most recent batch of + * network logging events. + * + * <p> When network logging is enabled by a profile owner, the network logs will only include + * work profile network activity, not activity on the personal profile. + * + * A device owner or profile owner has to provide a batchToken provided as part of * {@link DeviceAdminReceiver#onNetworkLogsAvailable} callback. If the token doesn't match the * token of the most recent available batch of logs, {@code null} will be returned. * @@ -11806,11 +11816,11 @@ public class DevicePolicyManager { * after the device device owner has been notified via * {@link DeviceAdminReceiver#onNetworkLogsAvailable}. * - * <p>If a secondary user or profile is created, calling this method will throw a - * {@link SecurityException} until all users become affiliated again. It will also no longer be - * possible to retrieve the network logs batch with the most recent batchToken provided - * by {@link DeviceAdminReceiver#onNetworkLogsAvailable}. See - * {@link DevicePolicyManager#setAffiliationIds}. + * <p>If the caller is not a profile owner and a secondary user or profile is created, calling + * this method will throw a {@link SecurityException} until all users become affiliated again. + * It will also no longer be possible to retrieve the network logs batch with the most recent + * batchToken provided by {@link DeviceAdminReceiver#onNetworkLogsAvailable}. + * See {@link DevicePolicyManager#setAffiliationIds}. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if called by a delegated app. @@ -11818,8 +11828,9 @@ public class DevicePolicyManager { * @return A new batch of network logs which is a list of {@link NetworkEvent}. Returns * {@code null} if the batch represented by batchToken is no longer available or if * logging is disabled. - * @throws SecurityException if {@code admin} is not a device owner, or there is at least one - * profile or secondary user that is not affiliated with the device. + * @throws SecurityException if {@code admin} is not a device owner, profile owner or if the + * {@code admin} is not a profile owner and there is at least one profile or secondary user + * that is not affiliated with the device. * @see #setAffiliationIds * @see DeviceAdminReceiver#onNetworkLogsAvailable */ @@ -11938,11 +11949,12 @@ public class DevicePolicyManager { } /** - * Called by the system to get the time at which the device owner last retrieved network logging - * events. + * Called by the system to get the time at which the device owner or profile owner of a + * managed profile last retrieved network logging events. * - * @return the time at which the device owner most recently retrieved network logging events, in - * milliseconds since epoch; -1 if network logging events were never retrieved. + * @return the time at which the device owner or profile owner most recently retrieved network + * logging events, in milliseconds since epoch; -1 if network logging events were + * never retrieved. * @throws SecurityException if the caller is not the device owner, does not hold the * MANAGE_USERS permission and is not the system. * |
