Merge "Rename "Network slicing" to "Enterprise network preference" in the 5G Slicing API" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
baf818032a
@@ -7183,6 +7183,7 @@ package android.app.admin {
|
||||
method public boolean isCommonCriteriaModeEnabled(@Nullable android.content.ComponentName);
|
||||
method public boolean isDeviceIdAttestationSupported();
|
||||
method public boolean isDeviceOwnerApp(String);
|
||||
method public boolean isEnterpriseNetworkPreferenceEnabled();
|
||||
method public boolean isEphemeralUser(@NonNull android.content.ComponentName);
|
||||
method public boolean isKeyPairGrantedToWifiAuth(@NonNull String);
|
||||
method public boolean isLockTaskPermitted(String);
|
||||
@@ -7190,7 +7191,6 @@ package android.app.admin {
|
||||
method public boolean isManagedProfile(@NonNull android.content.ComponentName);
|
||||
method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName);
|
||||
method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName);
|
||||
method public boolean isNetworkSlicingEnabled();
|
||||
method public boolean isOrganizationOwnedDeviceWithManagedProfile();
|
||||
method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName);
|
||||
method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||
@@ -7245,6 +7245,7 @@ package android.app.admin {
|
||||
method public void setDelegatedScopes(@NonNull android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.lang.String>);
|
||||
method public void setDeviceOwnerLockScreenInfo(@NonNull android.content.ComponentName, CharSequence);
|
||||
method public void setEndUserSessionMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
|
||||
method public void setEnterpriseNetworkPreferenceEnabled(boolean);
|
||||
method public void setFactoryResetProtectionPolicy(@NonNull android.content.ComponentName, @Nullable android.app.admin.FactoryResetProtectionPolicy);
|
||||
method public int setGlobalPrivateDnsModeOpportunistic(@NonNull android.content.ComponentName);
|
||||
method @WorkerThread public int setGlobalPrivateDnsModeSpecifiedHost(@NonNull android.content.ComponentName, @NonNull String);
|
||||
@@ -7264,7 +7265,6 @@ package android.app.admin {
|
||||
method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long);
|
||||
method @NonNull public java.util.List<java.lang.String> setMeteredDataDisabledPackages(@NonNull android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
|
||||
method public void setNetworkLoggingEnabled(@Nullable android.content.ComponentName, boolean);
|
||||
method public void setNetworkSlicingEnabled(boolean);
|
||||
method @Deprecated public void setOrganizationColor(@NonNull android.content.ComponentName, int);
|
||||
method public void setOrganizationId(@NonNull String);
|
||||
method public void setOrganizationName(@NonNull android.content.ComponentName, @Nullable CharSequence);
|
||||
|
||||
@@ -9990,26 +9990,24 @@ public class DevicePolicyManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether 5g slicing is enabled on the work profile.
|
||||
* Sets whether enterprise network preference is enabled on the work profile.
|
||||
*
|
||||
* Slicing allows operators to virtually divide their networks in portions and use different
|
||||
* portions for specific use cases; for example, a corporation can have a deal/agreement with
|
||||
* a carrier that all of its employees’ devices use data on a slice dedicated for enterprise
|
||||
* use.
|
||||
* For example, a corporation can have a deal/agreement with a carrier that all of its
|
||||
* employees’ devices use data on a network preference dedicated for enterprise use.
|
||||
*
|
||||
* By default, 5g slicing is enabled on the work profile on supported carriers and devices.
|
||||
* Admins can explicitly disable it with this API.
|
||||
* By default, enterprise network preference is enabled on the work profile on supported
|
||||
* carriers and devices. Admins can explicitly disable it with this API.
|
||||
*
|
||||
* <p>This method can only be called by the profile owner of a managed profile.
|
||||
*
|
||||
* @param enabled whether 5g Slice should be enabled.
|
||||
* @param enabled whether enterprise network preference should be enabled.
|
||||
* @throws SecurityException if the caller is not the profile owner.
|
||||
**/
|
||||
public void setNetworkSlicingEnabled(boolean enabled) {
|
||||
throwIfParentInstance("setNetworkSlicingEnabled");
|
||||
public void setEnterpriseNetworkPreferenceEnabled(boolean enabled) {
|
||||
throwIfParentInstance("setEnterpriseNetworkPreferenceEnabled");
|
||||
if (mService != null) {
|
||||
try {
|
||||
mService.setNetworkSlicingEnabled(enabled);
|
||||
mService.setEnterpriseNetworkPreferenceEnabled(enabled);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
@@ -10017,20 +10015,20 @@ public class DevicePolicyManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether 5g slicing is enabled.
|
||||
* Indicates whether whether enterprise network preference is enabled.
|
||||
*
|
||||
* <p>This method can be called by the profile owner of a managed profile.
|
||||
*
|
||||
* @return whether 5g Slice is enabled.
|
||||
* @return whether whether enterprise network preference is enabled.
|
||||
* @throws SecurityException if the caller is not the profile owner.
|
||||
*/
|
||||
public boolean isNetworkSlicingEnabled() {
|
||||
throwIfParentInstance("isNetworkSlicingEnabled");
|
||||
public boolean isEnterpriseNetworkPreferenceEnabled() {
|
||||
throwIfParentInstance("isEnterpriseNetworkPreferenceEnabled");
|
||||
if (mService == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return mService.isNetworkSlicingEnabled(myUserId());
|
||||
return mService.isEnterpriseNetworkPreferenceEnabled(myUserId());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ interface IDevicePolicyManager {
|
||||
void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled);
|
||||
boolean isSecondaryLockscreenEnabled(in UserHandle userHandle);
|
||||
|
||||
void setNetworkSlicingEnabled(in boolean enabled);
|
||||
boolean isNetworkSlicingEnabled(int userHandle);
|
||||
void setEnterpriseNetworkPreferenceEnabled(in boolean enabled);
|
||||
boolean isEnterpriseNetworkPreferenceEnabled(int userHandle);
|
||||
|
||||
void setLockTaskPackages(in ComponentName who, in String[] packages);
|
||||
String[] getLockTaskPackages(in ComponentName who);
|
||||
|
||||
@@ -139,12 +139,13 @@ class ActiveAdmin {
|
||||
private static final String TAG_ENROLLMENT_SPECIFIC_ID = "enrollment-specific-id";
|
||||
private static final String TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS =
|
||||
"admin-can-grant-sensors-permissions";
|
||||
private static final String TAG_NETWORK_SLICING_ENABLED = "network-slicing-enabled";
|
||||
private static final String TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED =
|
||||
"enterprise-network-preference-enabled";
|
||||
private static final String TAG_USB_DATA_SIGNALING = "usb-data-signaling";
|
||||
private static final String ATTR_VALUE = "value";
|
||||
private static final String ATTR_LAST_NETWORK_LOGGING_NOTIFICATION = "last-notification";
|
||||
private static final String ATTR_NUM_NETWORK_LOGGING_NOTIFICATIONS = "num-notifications";
|
||||
private static final boolean NETWORK_SLICING_ENABLED_DEFAULT = true;
|
||||
private static final boolean ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT = true;
|
||||
|
||||
DeviceAdminInfo info;
|
||||
|
||||
@@ -284,7 +285,8 @@ class ActiveAdmin {
|
||||
public String mOrganizationId;
|
||||
public String mEnrollmentSpecificId;
|
||||
public boolean mAdminCanGrantSensorsPermissions;
|
||||
public boolean mNetworkSlicingEnabled = NETWORK_SLICING_ENABLED_DEFAULT;
|
||||
public boolean mEnterpriseNetworkPreferenceEnabled =
|
||||
ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT;
|
||||
|
||||
private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
|
||||
boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
|
||||
@@ -555,8 +557,9 @@ class ActiveAdmin {
|
||||
}
|
||||
writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
|
||||
mAdminCanGrantSensorsPermissions);
|
||||
if (mNetworkSlicingEnabled != NETWORK_SLICING_ENABLED_DEFAULT) {
|
||||
writeAttributeValueToXml(out, TAG_NETWORK_SLICING_ENABLED, mNetworkSlicingEnabled);
|
||||
if (mEnterpriseNetworkPreferenceEnabled != ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT) {
|
||||
writeAttributeValueToXml(out, TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED,
|
||||
mEnterpriseNetworkPreferenceEnabled);
|
||||
}
|
||||
if (mUsbDataSignalingEnabled != USB_DATA_SIGNALING_ENABLED_DEFAULT) {
|
||||
writeAttributeValueToXml(out, TAG_USB_DATA_SIGNALING, mUsbDataSignalingEnabled);
|
||||
@@ -784,9 +787,9 @@ class ActiveAdmin {
|
||||
mAlwaysOnVpnPackage = parser.getAttributeValue(null, ATTR_VALUE);
|
||||
} else if (TAG_ALWAYS_ON_VPN_LOCKDOWN.equals(tag)) {
|
||||
mAlwaysOnVpnLockdown = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
||||
} else if (TAG_NETWORK_SLICING_ENABLED.equals(tag)) {
|
||||
mNetworkSlicingEnabled = parser.getAttributeBoolean(
|
||||
null, ATTR_VALUE, NETWORK_SLICING_ENABLED_DEFAULT);
|
||||
} else if (TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED.equals(tag)) {
|
||||
mEnterpriseNetworkPreferenceEnabled = parser.getAttributeBoolean(
|
||||
null, ATTR_VALUE, ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT);
|
||||
} else if (TAG_COMMON_CRITERIA_MODE.equals(tag)) {
|
||||
mCommonCriteriaMode = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
||||
} else if (TAG_PASSWORD_COMPLEXITY.equals(tag)) {
|
||||
@@ -1142,8 +1145,8 @@ class ActiveAdmin {
|
||||
pw.print("mAlwaysOnVpnLockdown=");
|
||||
pw.println(mAlwaysOnVpnLockdown);
|
||||
|
||||
pw.print("mNetworkSlicingEnabled=");
|
||||
pw.println(mNetworkSlicingEnabled);
|
||||
pw.print("mEnterpriseNetworkPreferenceEnabled=");
|
||||
pw.println(mEnterpriseNetworkPreferenceEnabled);
|
||||
|
||||
pw.print("mCommonCriteriaMode=");
|
||||
pw.println(mCommonCriteriaMode);
|
||||
|
||||
@@ -3092,7 +3092,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
boolean enableEnterpriseNetworkSlice = true;
|
||||
synchronized (getLockObject()) {
|
||||
ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
|
||||
enableEnterpriseNetworkSlice = owner != null ? owner.mNetworkSlicingEnabled : true;
|
||||
enableEnterpriseNetworkSlice = owner != null
|
||||
? owner.mEnterpriseNetworkPreferenceEnabled : true;
|
||||
}
|
||||
updateNetworkPreferenceForUser(userId, enableEnterpriseNetworkSlice);
|
||||
|
||||
@@ -11423,30 +11424,32 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetworkSlicingEnabled(boolean enabled) {
|
||||
public void setEnterpriseNetworkPreferenceEnabled(boolean enabled) {
|
||||
if (!mHasFeature) {
|
||||
return;
|
||||
}
|
||||
final CallerIdentity caller = getCallerIdentity();
|
||||
Preconditions.checkCallAuthorization(isProfileOwner(caller),
|
||||
"Caller is not profile owner; only profile owner may control the network slicing");
|
||||
"Caller is not profile owner;"
|
||||
+ " only profile owner may control the enterprise network preference");
|
||||
synchronized (getLockObject()) {
|
||||
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
|
||||
caller.getUserId());
|
||||
if (requiredAdmin != null && requiredAdmin.mNetworkSlicingEnabled != enabled) {
|
||||
requiredAdmin.mNetworkSlicingEnabled = enabled;
|
||||
if (requiredAdmin != null
|
||||
&& requiredAdmin.mEnterpriseNetworkPreferenceEnabled != enabled) {
|
||||
requiredAdmin.mEnterpriseNetworkPreferenceEnabled = enabled;
|
||||
saveSettingsLocked(caller.getUserId());
|
||||
}
|
||||
}
|
||||
updateNetworkPreferenceForUser(caller.getUserId(), enabled);
|
||||
DevicePolicyEventLogger
|
||||
.createEvent(DevicePolicyEnums.SET_NETWORK_SLICING_ENABLED)
|
||||
.createEvent(DevicePolicyEnums.SET_ENTERPRISE_NETWORK_PREFERENCE_ENABLED)
|
||||
.setBoolean(enabled)
|
||||
.write();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkSlicingEnabled(int userHandle) {
|
||||
public boolean isEnterpriseNetworkPreferenceEnabled(int userHandle) {
|
||||
if (!mHasFeature) {
|
||||
return false;
|
||||
}
|
||||
@@ -11457,7 +11460,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
synchronized (getLockObject()) {
|
||||
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(userHandle);
|
||||
if (requiredAdmin != null) {
|
||||
return requiredAdmin.mNetworkSlicingEnabled;
|
||||
return requiredAdmin.mEnterpriseNetworkPreferenceEnabled;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4037,16 +4037,16 @@ public class DevicePolicyManagerTest extends DpmTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSetNetworkSlicing() throws Exception {
|
||||
public void testGetSetEnterpriseNetworkPreference() throws Exception {
|
||||
assertExpectException(SecurityException.class, null,
|
||||
() -> dpm.setNetworkSlicingEnabled(false));
|
||||
() -> dpm.setEnterpriseNetworkPreferenceEnabled(false));
|
||||
|
||||
assertExpectException(SecurityException.class, null,
|
||||
() -> dpm.isNetworkSlicingEnabled());
|
||||
() -> dpm.isEnterpriseNetworkPreferenceEnabled());
|
||||
|
||||
setupProfileOwner();
|
||||
dpm.setNetworkSlicingEnabled(false);
|
||||
assertThat(dpm.isNetworkSlicingEnabled()).isFalse();
|
||||
dpm.setEnterpriseNetworkPreferenceEnabled(false);
|
||||
assertThat(dpm.isEnterpriseNetworkPreferenceEnabled()).isFalse();
|
||||
// TODO(b/178655595)
|
||||
// verify(getServices().connectivityManager, times(1)).setNetworkPreferenceForUser(
|
||||
// any(UserHandle.class),
|
||||
@@ -4055,8 +4055,8 @@ public class DevicePolicyManagerTest extends DpmTestBase {
|
||||
// any(Runnable.class)
|
||||
//);
|
||||
|
||||
dpm.setNetworkSlicingEnabled(true);
|
||||
assertThat(dpm.isNetworkSlicingEnabled()).isTrue();
|
||||
dpm.setEnterpriseNetworkPreferenceEnabled(true);
|
||||
assertThat(dpm.isEnterpriseNetworkPreferenceEnabled()).isTrue();
|
||||
// TODO(b/178655595)
|
||||
// verify(getServices().connectivityManager, times(1)).setNetworkPreferenceForUser(
|
||||
// any(UserHandle.class),
|
||||
|
||||
Reference in New Issue
Block a user