Loading core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -7192,7 +7192,7 @@ package android.app.admin { method @Nullable public java.util.List<java.lang.String> getPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName); method @Nullable public java.util.List<java.lang.String> getPermittedInputMethods(@NonNull android.content.ComponentName); method public int getPersonalAppsSuspendedReasons(@NonNull android.content.ComponentName); method @NonNull public android.app.admin.PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig(); method @NonNull public java.util.List<android.app.admin.PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs(); method public int getRequiredPasswordComplexity(); method public long getRequiredStrongAuthTimeout(@Nullable android.content.ComponentName); method public boolean getScreenCaptureDisabled(@Nullable android.content.ComponentName); Loading Loading @@ -7335,7 +7335,7 @@ package android.app.admin { method public boolean setPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName, @Nullable java.util.List<java.lang.String>); method public boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>); method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean); method public void setPreferentialNetworkServiceConfig(@NonNull android.app.admin.PreferentialNetworkServiceConfig); method public void setPreferentialNetworkServiceConfigs(@NonNull java.util.List<android.app.admin.PreferentialNetworkServiceConfig>); method public void setPreferentialNetworkServiceEnabled(boolean); method public void setProfileEnabled(@NonNull android.content.ComponentName); method public void setProfileName(@NonNull android.content.ComponentName, String); core/java/android/app/admin/DevicePolicyManager.java +66 −51 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app.admin; import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.Manifest.permission; Loading Loading @@ -10266,7 +10268,7 @@ public class DevicePolicyManager { } /** * Sets whether preferential network service is enabled on the work profile. * Sets whether preferential network service is enabled. * For example, an organization can have a deal/agreement with a carrier that all of * the work data from its employees’ devices will be sent via a network service dedicated * for enterprise use. Loading @@ -10274,75 +10276,72 @@ public class DevicePolicyManager { * An example of a supported preferential network service is the Enterprise * slice on 5G networks. * * By default, preferential network service is disabled on the work profile on supported * carriers and devices. Admins can explicitly enable it with this API. * On fully-managed devices this method is unsupported because all traffic is considered * work traffic. * By default, preferential network service is disabled on the work profile and * fully managed devices, on supported carriers and devices. * Admins can explicitly enable it with this API. * * <p> This method enables preferential network service with a default configuration. * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfig) instead. * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfigs) instead. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * this method can be called by the profile owner of a managed profile. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile * or device owner. * * <p>This method can only be called by the profile owner of a managed profile. * @param enabled whether preferential network service should be enabled. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. **/ public void setPreferentialNetworkServiceEnabled(boolean enabled) { throwIfParentInstance("setPreferentialNetworkServiceEnabled"); if (mService == null) { return; } try { mService.setPreferentialNetworkServiceEnabled(enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); PreferentialNetworkServiceConfig.Builder configBuilder = new PreferentialNetworkServiceConfig.Builder(); configBuilder.setEnabled(enabled); if (enabled) { configBuilder.setNetworkId(NET_ENTERPRISE_ID_1); } setPreferentialNetworkServiceConfigs(List.of(configBuilder.build())); } /** * Indicates whether preferential network service is enabled. * * <p>This method can be called by the profile owner of a managed profile. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile * or device owner. * * @return whether preferential network service is enabled. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. */ public boolean isPreferentialNetworkServiceEnabled() { throwIfParentInstance("isPreferentialNetworkServiceEnabled"); if (mService == null) { return false; } try { return mService.isPreferentialNetworkServiceEnabled(myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return getPreferentialNetworkServiceConfigs().stream().anyMatch(c -> c.isEnabled()); } /** * Sets preferential network configuration on the work profile. * Sets preferential network configurations. * {@see PreferentialNetworkServiceConfig} * * An example of a supported preferential network service is the Enterprise * slice on 5G networks. * * By default, preferential network service is disabled on the work profile on supported * carriers and devices. Admins can explicitly enable it with this API. * On fully-managed devices this method is unsupported because all traffic is considered * work traffic. * By default, preferential network service is disabled on the work profile and fully managed * devices, on supported carriers and devices. Admins can explicitly enable it with this API. * If admin wants to have multiple enterprise slices, * it can be configured by passing list of {@link PreferentialNetworkServiceConfig} objects. * * <p>This method can only be called by the profile owner of a managed profile. * @param preferentialNetworkServiceConfig preferential network configuration. * @throws SecurityException if the caller is not the profile owner. * @param preferentialNetworkServiceConfigs list of preferential network configurations. * @throws SecurityException if the caller is not the profile owner or device owner. **/ public void setPreferentialNetworkServiceConfig( @NonNull PreferentialNetworkServiceConfig preferentialNetworkServiceConfig) { throwIfParentInstance("setPreferentialNetworkServiceConfig"); public void setPreferentialNetworkServiceConfigs( @NonNull List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs) { throwIfParentInstance("setPreferentialNetworkServiceConfigs"); if (mService == null) { return; } try { mService.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfig); mService.setPreferentialNetworkServiceConfigs(preferentialNetworkServiceConfigs); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -10352,18 +10351,16 @@ public class DevicePolicyManager { * Get preferential network configuration * {@see PreferentialNetworkServiceConfig} * * <p>This method can be called by the profile owner of a managed profile. * * @return preferential network configuration. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. */ public @NonNull PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig() { throwIfParentInstance("getPreferentialNetworkServiceConfig"); public @NonNull List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs() { throwIfParentInstance("getPreferentialNetworkServiceConfigs"); if (mService == null) { return PreferentialNetworkServiceConfig.DEFAULT; return List.of(PreferentialNetworkServiceConfig.DEFAULT); } try { return mService.getPreferentialNetworkServiceConfig(); return mService.getPreferentialNetworkServiceConfigs(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -12807,13 +12804,18 @@ public class DevicePolicyManager { } /** * Called by device owner to add an override APN. * Called by device owner or profile owner to add an override APN. * * <p>This method may returns {@code -1} if {@code apnSetting} conflicts with an existing * override APN. Update the existing conflicted APN with * {@link #updateOverrideApn(ComponentName, int, ApnSetting)} instead of adding a new entry. * <p>Two override APNs are considered to conflict when all the following APIs return * the same values on both override APNs: * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can add APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can add enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can add other type of APNs. * <ul> * <li>{@link ApnSetting#getOperatorNumeric()}</li> * <li>{@link ApnSetting#getApnName()}</li> Loading @@ -12832,7 +12834,8 @@ public class DevicePolicyManager { * @param apnSetting the override APN to insert * @return The {@code id} of inserted override APN. Or {@code -1} when failed to insert into * the database. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */ Loading @@ -12849,20 +12852,26 @@ public class DevicePolicyManager { } /** * Called by device owner to update an override APN. * Called by device owner or profile owner to update an override APN. * * <p>This method may returns {@code false} if there is no override APN with the given * {@code apnId}. * <p>This method may also returns {@code false} if {@code apnSetting} conflicts with an * existing override APN. Update the existing conflicted APN instead. * <p>See {@link #addOverrideApn} for the definition of conflict. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can update APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can update enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can update other type of APNs. * * @param admin which {@link DeviceAdminReceiver} this request is associated with * @param apnId the {@code id} of the override APN to update * @param apnSetting the override APN to update * @return {@code true} if the required override APN is successfully updated, * {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */ Loading @@ -12880,16 +12889,22 @@ public class DevicePolicyManager { } /** * Called by device owner to remove an override APN. * Called by device owner or profile owner to remove an override APN. * * <p>This method may returns {@code false} if there is no override APN with the given * {@code apnId}. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can remove APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can remove enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can remove other type of APNs. * * @param admin which {@link DeviceAdminReceiver} this request is associated with * @param apnId the {@code id} of the override APN to remove * @return {@code true} if the required override APN is successfully removed, {@code false} * otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */ core/java/android/app/admin/IDevicePolicyManager.aidl +3 −6 Original line number Diff line number Diff line Loading @@ -278,12 +278,9 @@ interface IDevicePolicyManager { void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled); boolean isSecondaryLockscreenEnabled(in UserHandle userHandle); void setPreferentialNetworkServiceEnabled(in boolean enabled); boolean isPreferentialNetworkServiceEnabled(int userHandle); void setPreferentialNetworkServiceConfig( in PreferentialNetworkServiceConfig preferentialNetworkServiceConfig); PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig(); void setPreferentialNetworkServiceConfigs( in List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs); List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs(); void setLockTaskPackages(in ComponentName who, in String[] packages); String[] getLockTaskPackages(in ComponentName who); Loading core/java/android/app/admin/PreferentialNetworkServiceConfig.java +1 −5 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import java.util.Objects; /** * Network configuration to be set for the user profile * {@see DevicePolicyManager#setPreferentialNetworkServiceConfig}. * {@see DevicePolicyManager#setPreferentialNetworkServiceConfigs}. */ public final class PreferentialNetworkServiceConfig implements Parcelable { final boolean mIsEnabled; Loading Loading @@ -147,8 +147,6 @@ public final class PreferentialNetworkServiceConfig implements Parcelable { /** * @return preference enterprise identifier. * valid values starts from * {@link #PREFERENTIAL_NETWORK_ID_1} to {@link #PREFERENTIAL_NETWORK_ID_5}. * preference identifier is applicable only if preference network service is enabled * */ Loading Loading @@ -286,8 +284,6 @@ public final class PreferentialNetworkServiceConfig implements Parcelable { /** * Set the preferential network identifier. * Valid values starts from {@link #PREFERENTIAL_NETWORK_ID_1} to * {@link #PREFERENTIAL_NETWORK_ID_5}. * preference identifier is applicable only if preferential network service is enabled. * @param preferenceId preference Id * @return The builder to facilitate chaining. Loading services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java +2 −2 Original line number Diff line number Diff line Loading @@ -295,8 +295,8 @@ class ActiveAdmin { public boolean mAdminCanGrantSensorsPermissions; public boolean mPreferentialNetworkServiceEnabled = DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT; public PreferentialNetworkServiceConfig mPreferentialNetworkServiceConfig = PreferentialNetworkServiceConfig.DEFAULT; public List<PreferentialNetworkServiceConfig> mPreferentialNetworkServiceConfigs = List.of(PreferentialNetworkServiceConfig.DEFAULT); private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true; boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT; Loading Loading
core/api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -7192,7 +7192,7 @@ package android.app.admin { method @Nullable public java.util.List<java.lang.String> getPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName); method @Nullable public java.util.List<java.lang.String> getPermittedInputMethods(@NonNull android.content.ComponentName); method public int getPersonalAppsSuspendedReasons(@NonNull android.content.ComponentName); method @NonNull public android.app.admin.PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig(); method @NonNull public java.util.List<android.app.admin.PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs(); method public int getRequiredPasswordComplexity(); method public long getRequiredStrongAuthTimeout(@Nullable android.content.ComponentName); method public boolean getScreenCaptureDisabled(@Nullable android.content.ComponentName); Loading Loading @@ -7335,7 +7335,7 @@ package android.app.admin { method public boolean setPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName, @Nullable java.util.List<java.lang.String>); method public boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>); method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean); method public void setPreferentialNetworkServiceConfig(@NonNull android.app.admin.PreferentialNetworkServiceConfig); method public void setPreferentialNetworkServiceConfigs(@NonNull java.util.List<android.app.admin.PreferentialNetworkServiceConfig>); method public void setPreferentialNetworkServiceEnabled(boolean); method public void setProfileEnabled(@NonNull android.content.ComponentName); method public void setProfileName(@NonNull android.content.ComponentName, String);
core/java/android/app/admin/DevicePolicyManager.java +66 −51 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.app.admin; import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1; import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage; import android.Manifest.permission; Loading Loading @@ -10266,7 +10268,7 @@ public class DevicePolicyManager { } /** * Sets whether preferential network service is enabled on the work profile. * Sets whether preferential network service is enabled. * For example, an organization can have a deal/agreement with a carrier that all of * the work data from its employees’ devices will be sent via a network service dedicated * for enterprise use. Loading @@ -10274,75 +10276,72 @@ public class DevicePolicyManager { * An example of a supported preferential network service is the Enterprise * slice on 5G networks. * * By default, preferential network service is disabled on the work profile on supported * carriers and devices. Admins can explicitly enable it with this API. * On fully-managed devices this method is unsupported because all traffic is considered * work traffic. * By default, preferential network service is disabled on the work profile and * fully managed devices, on supported carriers and devices. * Admins can explicitly enable it with this API. * * <p> This method enables preferential network service with a default configuration. * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfig) instead. * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfigs) instead. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * this method can be called by the profile owner of a managed profile. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile * or device owner. * * <p>This method can only be called by the profile owner of a managed profile. * @param enabled whether preferential network service should be enabled. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. **/ public void setPreferentialNetworkServiceEnabled(boolean enabled) { throwIfParentInstance("setPreferentialNetworkServiceEnabled"); if (mService == null) { return; } try { mService.setPreferentialNetworkServiceEnabled(enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); PreferentialNetworkServiceConfig.Builder configBuilder = new PreferentialNetworkServiceConfig.Builder(); configBuilder.setEnabled(enabled); if (enabled) { configBuilder.setNetworkId(NET_ENTERPRISE_ID_1); } setPreferentialNetworkServiceConfigs(List.of(configBuilder.build())); } /** * Indicates whether preferential network service is enabled. * * <p>This method can be called by the profile owner of a managed profile. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * This method can be called by the profile owner of a managed profile * or device owner. * * @return whether preferential network service is enabled. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. */ public boolean isPreferentialNetworkServiceEnabled() { throwIfParentInstance("isPreferentialNetworkServiceEnabled"); if (mService == null) { return false; } try { return mService.isPreferentialNetworkServiceEnabled(myUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } return getPreferentialNetworkServiceConfigs().stream().anyMatch(c -> c.isEnabled()); } /** * Sets preferential network configuration on the work profile. * Sets preferential network configurations. * {@see PreferentialNetworkServiceConfig} * * An example of a supported preferential network service is the Enterprise * slice on 5G networks. * * By default, preferential network service is disabled on the work profile on supported * carriers and devices. Admins can explicitly enable it with this API. * On fully-managed devices this method is unsupported because all traffic is considered * work traffic. * By default, preferential network service is disabled on the work profile and fully managed * devices, on supported carriers and devices. Admins can explicitly enable it with this API. * If admin wants to have multiple enterprise slices, * it can be configured by passing list of {@link PreferentialNetworkServiceConfig} objects. * * <p>This method can only be called by the profile owner of a managed profile. * @param preferentialNetworkServiceConfig preferential network configuration. * @throws SecurityException if the caller is not the profile owner. * @param preferentialNetworkServiceConfigs list of preferential network configurations. * @throws SecurityException if the caller is not the profile owner or device owner. **/ public void setPreferentialNetworkServiceConfig( @NonNull PreferentialNetworkServiceConfig preferentialNetworkServiceConfig) { throwIfParentInstance("setPreferentialNetworkServiceConfig"); public void setPreferentialNetworkServiceConfigs( @NonNull List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs) { throwIfParentInstance("setPreferentialNetworkServiceConfigs"); if (mService == null) { return; } try { mService.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfig); mService.setPreferentialNetworkServiceConfigs(preferentialNetworkServiceConfigs); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -10352,18 +10351,16 @@ public class DevicePolicyManager { * Get preferential network configuration * {@see PreferentialNetworkServiceConfig} * * <p>This method can be called by the profile owner of a managed profile. * * @return preferential network configuration. * @throws SecurityException if the caller is not the profile owner. * @throws SecurityException if the caller is not the profile owner or device owner. */ public @NonNull PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig() { throwIfParentInstance("getPreferentialNetworkServiceConfig"); public @NonNull List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs() { throwIfParentInstance("getPreferentialNetworkServiceConfigs"); if (mService == null) { return PreferentialNetworkServiceConfig.DEFAULT; return List.of(PreferentialNetworkServiceConfig.DEFAULT); } try { return mService.getPreferentialNetworkServiceConfig(); return mService.getPreferentialNetworkServiceConfigs(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -12807,13 +12804,18 @@ public class DevicePolicyManager { } /** * Called by device owner to add an override APN. * Called by device owner or profile owner to add an override APN. * * <p>This method may returns {@code -1} if {@code apnSetting} conflicts with an existing * override APN. Update the existing conflicted APN with * {@link #updateOverrideApn(ComponentName, int, ApnSetting)} instead of adding a new entry. * <p>Two override APNs are considered to conflict when all the following APIs return * the same values on both override APNs: * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can add APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can add enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can add other type of APNs. * <ul> * <li>{@link ApnSetting#getOperatorNumeric()}</li> * <li>{@link ApnSetting#getApnName()}</li> Loading @@ -12832,7 +12834,8 @@ public class DevicePolicyManager { * @param apnSetting the override APN to insert * @return The {@code id} of inserted override APN. Or {@code -1} when failed to insert into * the database. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */ Loading @@ -12849,20 +12852,26 @@ public class DevicePolicyManager { } /** * Called by device owner to update an override APN. * Called by device owner or profile owner to update an override APN. * * <p>This method may returns {@code false} if there is no override APN with the given * {@code apnId}. * <p>This method may also returns {@code false} if {@code apnSetting} conflicts with an * existing override APN. Update the existing conflicted APN instead. * <p>See {@link #addOverrideApn} for the definition of conflict. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can update APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can update enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can update other type of APNs. * * @param admin which {@link DeviceAdminReceiver} this request is associated with * @param apnId the {@code id} of the override APN to update * @param apnSetting the override APN to update * @return {@code true} if the required override APN is successfully updated, * {@code false} otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */ Loading @@ -12880,16 +12889,22 @@ public class DevicePolicyManager { } /** * Called by device owner to remove an override APN. * Called by device owner or profile owner to remove an override APN. * * <p>This method may returns {@code false} if there is no override APN with the given * {@code apnId}. * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Only device owners can remove APNs. * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}: * Device and profile owners can remove enterprise APNs * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can remove other type of APNs. * * @param admin which {@link DeviceAdminReceiver} this request is associated with * @param apnId the {@code id} of the override APN to remove * @return {@code true} if the required override APN is successfully removed, {@code false} * otherwise. * @throws SecurityException if {@code admin} is not a device owner. * @throws SecurityException If request is for enterprise APN {@code admin} is either device * owner or profile owner and in all other types of APN if {@code admin} is not a device owner. * * @see #setOverrideApnsEnabled(ComponentName, boolean) */
core/java/android/app/admin/IDevicePolicyManager.aidl +3 −6 Original line number Diff line number Diff line Loading @@ -278,12 +278,9 @@ interface IDevicePolicyManager { void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled); boolean isSecondaryLockscreenEnabled(in UserHandle userHandle); void setPreferentialNetworkServiceEnabled(in boolean enabled); boolean isPreferentialNetworkServiceEnabled(int userHandle); void setPreferentialNetworkServiceConfig( in PreferentialNetworkServiceConfig preferentialNetworkServiceConfig); PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig(); void setPreferentialNetworkServiceConfigs( in List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs); List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs(); void setLockTaskPackages(in ComponentName who, in String[] packages); String[] getLockTaskPackages(in ComponentName who); Loading
core/java/android/app/admin/PreferentialNetworkServiceConfig.java +1 −5 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import java.util.Objects; /** * Network configuration to be set for the user profile * {@see DevicePolicyManager#setPreferentialNetworkServiceConfig}. * {@see DevicePolicyManager#setPreferentialNetworkServiceConfigs}. */ public final class PreferentialNetworkServiceConfig implements Parcelable { final boolean mIsEnabled; Loading Loading @@ -147,8 +147,6 @@ public final class PreferentialNetworkServiceConfig implements Parcelable { /** * @return preference enterprise identifier. * valid values starts from * {@link #PREFERENTIAL_NETWORK_ID_1} to {@link #PREFERENTIAL_NETWORK_ID_5}. * preference identifier is applicable only if preference network service is enabled * */ Loading Loading @@ -286,8 +284,6 @@ public final class PreferentialNetworkServiceConfig implements Parcelable { /** * Set the preferential network identifier. * Valid values starts from {@link #PREFERENTIAL_NETWORK_ID_1} to * {@link #PREFERENTIAL_NETWORK_ID_5}. * preference identifier is applicable only if preferential network service is enabled. * @param preferenceId preference Id * @return The builder to facilitate chaining. Loading
services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java +2 −2 Original line number Diff line number Diff line Loading @@ -295,8 +295,8 @@ class ActiveAdmin { public boolean mAdminCanGrantSensorsPermissions; public boolean mPreferentialNetworkServiceEnabled = DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT; public PreferentialNetworkServiceConfig mPreferentialNetworkServiceConfig = PreferentialNetworkServiceConfig.DEFAULT; public List<PreferentialNetworkServiceConfig> mPreferentialNetworkServiceConfigs = List.of(PreferentialNetworkServiceConfig.DEFAULT); private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true; boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT; Loading