Merge "Rename Enterprise Network Preference to Preferential network service" into sc-dev
This commit is contained in:
@@ -7202,7 +7202,6 @@ package android.app.admin {
|
|||||||
method public boolean isComplianceAcknowledgementRequired();
|
method public boolean isComplianceAcknowledgementRequired();
|
||||||
method public boolean isDeviceIdAttestationSupported();
|
method public boolean isDeviceIdAttestationSupported();
|
||||||
method public boolean isDeviceOwnerApp(String);
|
method public boolean isDeviceOwnerApp(String);
|
||||||
method public boolean isEnterpriseNetworkPreferenceEnabled();
|
|
||||||
method public boolean isEphemeralUser(@NonNull android.content.ComponentName);
|
method public boolean isEphemeralUser(@NonNull android.content.ComponentName);
|
||||||
method public boolean isKeyPairGrantedToWifiAuth(@NonNull String);
|
method public boolean isKeyPairGrantedToWifiAuth(@NonNull String);
|
||||||
method public boolean isLockTaskPermitted(String);
|
method public boolean isLockTaskPermitted(String);
|
||||||
@@ -7213,6 +7212,7 @@ package android.app.admin {
|
|||||||
method public boolean isOrganizationOwnedDeviceWithManagedProfile();
|
method public boolean isOrganizationOwnedDeviceWithManagedProfile();
|
||||||
method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName);
|
method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName);
|
||||||
method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException;
|
method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException;
|
||||||
|
method public boolean isPreferentialNetworkServiceEnabled();
|
||||||
method public boolean isProfileOwnerApp(String);
|
method public boolean isProfileOwnerApp(String);
|
||||||
method public boolean isProvisioningAllowed(@NonNull String);
|
method public boolean isProvisioningAllowed(@NonNull String);
|
||||||
method public boolean isResetPasswordTokenActive(android.content.ComponentName);
|
method public boolean isResetPasswordTokenActive(android.content.ComponentName);
|
||||||
@@ -7264,7 +7264,6 @@ package android.app.admin {
|
|||||||
method public void setDelegatedScopes(@NonNull android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.lang.String>);
|
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 setDeviceOwnerLockScreenInfo(@NonNull android.content.ComponentName, CharSequence);
|
||||||
method public void setEndUserSessionMessage(@NonNull android.content.ComponentName, @Nullable 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 void setFactoryResetProtectionPolicy(@NonNull android.content.ComponentName, @Nullable android.app.admin.FactoryResetProtectionPolicy);
|
||||||
method public int setGlobalPrivateDnsModeOpportunistic(@NonNull android.content.ComponentName);
|
method public int setGlobalPrivateDnsModeOpportunistic(@NonNull android.content.ComponentName);
|
||||||
method @WorkerThread public int setGlobalPrivateDnsModeSpecifiedHost(@NonNull android.content.ComponentName, @NonNull String);
|
method @WorkerThread public int setGlobalPrivateDnsModeSpecifiedHost(@NonNull android.content.ComponentName, @NonNull String);
|
||||||
@@ -7307,6 +7306,7 @@ package android.app.admin {
|
|||||||
method public boolean setPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName, @Nullable java.util.List<java.lang.String>);
|
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 boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>);
|
||||||
method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean);
|
method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean);
|
||||||
|
method public void setPreferentialNetworkServiceEnabled(boolean);
|
||||||
method public void setProfileEnabled(@NonNull android.content.ComponentName);
|
method public void setProfileEnabled(@NonNull android.content.ComponentName);
|
||||||
method public void setProfileName(@NonNull android.content.ComponentName, String);
|
method public void setProfileName(@NonNull android.content.ComponentName, String);
|
||||||
method public void setRecommendedGlobalProxy(@NonNull android.content.ComponentName, @Nullable android.net.ProxyInfo);
|
method public void setRecommendedGlobalProxy(@NonNull android.content.ComponentName, @Nullable android.net.ProxyInfo);
|
||||||
|
|||||||
@@ -10121,45 +10121,51 @@ public class DevicePolicyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether enterprise network preference is enabled on the work profile.
|
* Sets whether preferential network service is enabled on the work profile.
|
||||||
|
* 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.
|
||||||
*
|
*
|
||||||
* For example, a corporation can have a deal/agreement with a carrier that all of its
|
* An example of a supported preferential network service is the Enterprise
|
||||||
* employees’ devices use data on a network preference dedicated for enterprise use.
|
* slice on 5G networks.
|
||||||
*
|
*
|
||||||
* By default, enterprise network preference is enabled on the work profile on supported
|
* By default, preferential network service is enabled on the work profile on supported
|
||||||
* carriers and devices. Admins can explicitly disable it with this API.
|
* carriers and devices. Admins can explicitly disable it with this API.
|
||||||
|
* On fully-managed devices this method is unsupported because all traffic is considered
|
||||||
|
* work traffic.
|
||||||
*
|
*
|
||||||
* <p>This method can only be called by the profile owner of a managed profile.
|
* <p>This method can only be called by the profile owner of a managed profile.
|
||||||
*
|
* @param enabled whether preferential network service should be enabled.
|
||||||
* @param enabled whether enterprise network preference should be enabled.
|
|
||||||
* @throws SecurityException if the caller is not the profile owner.
|
* @throws SecurityException if the caller is not the profile owner.
|
||||||
**/
|
**/
|
||||||
public void setEnterpriseNetworkPreferenceEnabled(boolean enabled) {
|
public void setPreferentialNetworkServiceEnabled(boolean enabled) {
|
||||||
throwIfParentInstance("setEnterpriseNetworkPreferenceEnabled");
|
throwIfParentInstance("setPreferentialNetworkServiceEnabled");
|
||||||
if (mService != null) {
|
if (mService == null) {
|
||||||
try {
|
return;
|
||||||
mService.setEnterpriseNetworkPreferenceEnabled(enabled);
|
}
|
||||||
} catch (RemoteException e) {
|
|
||||||
throw e.rethrowFromSystemServer();
|
try {
|
||||||
}
|
mService.setPreferentialNetworkServiceEnabled(enabled);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether whether enterprise network preference is enabled.
|
* Indicates whether preferential network service is enabled.
|
||||||
*
|
*
|
||||||
* <p>This method can be called by the profile owner of a managed profile.
|
* <p>This method can be called by the profile owner of a managed profile.
|
||||||
*
|
*
|
||||||
* @return whether whether enterprise network preference is enabled.
|
* @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.
|
||||||
*/
|
*/
|
||||||
public boolean isEnterpriseNetworkPreferenceEnabled() {
|
public boolean isPreferentialNetworkServiceEnabled() {
|
||||||
throwIfParentInstance("isEnterpriseNetworkPreferenceEnabled");
|
throwIfParentInstance("isPreferentialNetworkServiceEnabled");
|
||||||
if (mService == null) {
|
if (mService == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return mService.isEnterpriseNetworkPreferenceEnabled(myUserId());
|
return mService.isPreferentialNetworkServiceEnabled(myUserId());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,8 +274,8 @@ interface IDevicePolicyManager {
|
|||||||
void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled);
|
void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled);
|
||||||
boolean isSecondaryLockscreenEnabled(in UserHandle userHandle);
|
boolean isSecondaryLockscreenEnabled(in UserHandle userHandle);
|
||||||
|
|
||||||
void setEnterpriseNetworkPreferenceEnabled(in boolean enabled);
|
void setPreferentialNetworkServiceEnabled(in boolean enabled);
|
||||||
boolean isEnterpriseNetworkPreferenceEnabled(int userHandle);
|
boolean isPreferentialNetworkServiceEnabled(int userHandle);
|
||||||
|
|
||||||
void setLockTaskPackages(in ComponentName who, in String[] packages);
|
void setLockTaskPackages(in ComponentName who, in String[] packages);
|
||||||
String[] getLockTaskPackages(in ComponentName who);
|
String[] getLockTaskPackages(in ComponentName who);
|
||||||
|
|||||||
@@ -144,13 +144,13 @@ class ActiveAdmin {
|
|||||||
private static final String TAG_ENROLLMENT_SPECIFIC_ID = "enrollment-specific-id";
|
private static final String TAG_ENROLLMENT_SPECIFIC_ID = "enrollment-specific-id";
|
||||||
private static final String TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS =
|
private static final String TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS =
|
||||||
"admin-can-grant-sensors-permissions";
|
"admin-can-grant-sensors-permissions";
|
||||||
private static final String TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED =
|
private static final String TAG_PREFERENTIAL_NETWORK_SERVICE_ENABLED =
|
||||||
"enterprise-network-preference-enabled";
|
"preferential-network-service-enabled";
|
||||||
private static final String TAG_USB_DATA_SIGNALING = "usb-data-signaling";
|
private static final String TAG_USB_DATA_SIGNALING = "usb-data-signaling";
|
||||||
private static final String ATTR_VALUE = "value";
|
private static final String ATTR_VALUE = "value";
|
||||||
private static final String ATTR_LAST_NETWORK_LOGGING_NOTIFICATION = "last-notification";
|
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 String ATTR_NUM_NETWORK_LOGGING_NOTIFICATIONS = "num-notifications";
|
||||||
private static final boolean ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT = true;
|
private static final boolean PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT = true;
|
||||||
|
|
||||||
DeviceAdminInfo info;
|
DeviceAdminInfo info;
|
||||||
|
|
||||||
@@ -296,8 +296,8 @@ class ActiveAdmin {
|
|||||||
public String mOrganizationId;
|
public String mOrganizationId;
|
||||||
public String mEnrollmentSpecificId;
|
public String mEnrollmentSpecificId;
|
||||||
public boolean mAdminCanGrantSensorsPermissions;
|
public boolean mAdminCanGrantSensorsPermissions;
|
||||||
public boolean mEnterpriseNetworkPreferenceEnabled =
|
public boolean mPreferentialNetworkServiceEnabled =
|
||||||
ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT;
|
PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT;
|
||||||
|
|
||||||
private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
|
private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
|
||||||
boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
|
boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
|
||||||
@@ -576,9 +576,9 @@ class ActiveAdmin {
|
|||||||
}
|
}
|
||||||
writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
|
writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
|
||||||
mAdminCanGrantSensorsPermissions);
|
mAdminCanGrantSensorsPermissions);
|
||||||
if (mEnterpriseNetworkPreferenceEnabled != ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT) {
|
if (mPreferentialNetworkServiceEnabled != PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT) {
|
||||||
writeAttributeValueToXml(out, TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED,
|
writeAttributeValueToXml(out, TAG_PREFERENTIAL_NETWORK_SERVICE_ENABLED,
|
||||||
mEnterpriseNetworkPreferenceEnabled);
|
mPreferentialNetworkServiceEnabled);
|
||||||
}
|
}
|
||||||
if (mUsbDataSignalingEnabled != USB_DATA_SIGNALING_ENABLED_DEFAULT) {
|
if (mUsbDataSignalingEnabled != USB_DATA_SIGNALING_ENABLED_DEFAULT) {
|
||||||
writeAttributeValueToXml(out, TAG_USB_DATA_SIGNALING, mUsbDataSignalingEnabled);
|
writeAttributeValueToXml(out, TAG_USB_DATA_SIGNALING, mUsbDataSignalingEnabled);
|
||||||
@@ -806,9 +806,9 @@ class ActiveAdmin {
|
|||||||
mAlwaysOnVpnPackage = parser.getAttributeValue(null, ATTR_VALUE);
|
mAlwaysOnVpnPackage = parser.getAttributeValue(null, ATTR_VALUE);
|
||||||
} else if (TAG_ALWAYS_ON_VPN_LOCKDOWN.equals(tag)) {
|
} else if (TAG_ALWAYS_ON_VPN_LOCKDOWN.equals(tag)) {
|
||||||
mAlwaysOnVpnLockdown = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
mAlwaysOnVpnLockdown = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
||||||
} else if (TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED.equals(tag)) {
|
} else if (TAG_PREFERENTIAL_NETWORK_SERVICE_ENABLED.equals(tag)) {
|
||||||
mEnterpriseNetworkPreferenceEnabled = parser.getAttributeBoolean(
|
mPreferentialNetworkServiceEnabled = parser.getAttributeBoolean(
|
||||||
null, ATTR_VALUE, ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT);
|
null, ATTR_VALUE, PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT);
|
||||||
} else if (TAG_COMMON_CRITERIA_MODE.equals(tag)) {
|
} else if (TAG_COMMON_CRITERIA_MODE.equals(tag)) {
|
||||||
mCommonCriteriaMode = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
mCommonCriteriaMode = parser.getAttributeBoolean(null, ATTR_VALUE, false);
|
||||||
} else if (TAG_PASSWORD_COMPLEXITY.equals(tag)) {
|
} else if (TAG_PASSWORD_COMPLEXITY.equals(tag)) {
|
||||||
@@ -1168,8 +1168,8 @@ class ActiveAdmin {
|
|||||||
pw.print("mAlwaysOnVpnLockdown=");
|
pw.print("mAlwaysOnVpnLockdown=");
|
||||||
pw.println(mAlwaysOnVpnLockdown);
|
pw.println(mAlwaysOnVpnLockdown);
|
||||||
|
|
||||||
pw.print("mEnterpriseNetworkPreferenceEnabled=");
|
pw.print("mPreferentialNetworkServiceEnabled=");
|
||||||
pw.println(mEnterpriseNetworkPreferenceEnabled);
|
pw.println(mPreferentialNetworkServiceEnabled);
|
||||||
|
|
||||||
pw.print("mCommonCriteriaMode=");
|
pw.print("mCommonCriteriaMode=");
|
||||||
pw.println(mCommonCriteriaMode);
|
pw.println(mCommonCriteriaMode);
|
||||||
|
|||||||
@@ -3123,13 +3123,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
updatePermissionPolicyCache(userId);
|
updatePermissionPolicyCache(userId);
|
||||||
updateAdminCanGrantSensorsPermissionCache(userId);
|
updateAdminCanGrantSensorsPermissionCache(userId);
|
||||||
|
|
||||||
boolean enableEnterpriseNetworkPreferenceEnabled = true;
|
boolean preferentialNetworkServiceEnabled = true;
|
||||||
synchronized (getLockObject()) {
|
synchronized (getLockObject()) {
|
||||||
ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
|
ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
|
||||||
enableEnterpriseNetworkPreferenceEnabled = owner != null
|
preferentialNetworkServiceEnabled = owner != null
|
||||||
? owner.mEnterpriseNetworkPreferenceEnabled : true;
|
? owner.mPreferentialNetworkServiceEnabled : true;
|
||||||
}
|
}
|
||||||
updateNetworkPreferenceForUser(userId, enableEnterpriseNetworkPreferenceEnabled);
|
updateNetworkPreferenceForUser(userId, preferentialNetworkServiceEnabled);
|
||||||
|
|
||||||
startOwnerService(userId, "start-user");
|
startOwnerService(userId, "start-user");
|
||||||
}
|
}
|
||||||
@@ -11616,32 +11616,32 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnterpriseNetworkPreferenceEnabled(boolean enabled) {
|
public void setPreferentialNetworkServiceEnabled(boolean enabled) {
|
||||||
if (!mHasFeature) {
|
if (!mHasFeature) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final CallerIdentity caller = getCallerIdentity();
|
final CallerIdentity caller = getCallerIdentity();
|
||||||
Preconditions.checkCallAuthorization(isProfileOwner(caller),
|
Preconditions.checkCallAuthorization(isProfileOwner(caller),
|
||||||
"Caller is not profile owner;"
|
"Caller is not profile owner;"
|
||||||
+ " only profile owner may control the enterprise network preference");
|
+ " only profile owner may control the preferntial network service");
|
||||||
synchronized (getLockObject()) {
|
synchronized (getLockObject()) {
|
||||||
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
|
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
|
||||||
caller.getUserId());
|
caller.getUserId());
|
||||||
if (requiredAdmin != null
|
if (requiredAdmin != null
|
||||||
&& requiredAdmin.mEnterpriseNetworkPreferenceEnabled != enabled) {
|
&& requiredAdmin.mPreferentialNetworkServiceEnabled != enabled) {
|
||||||
requiredAdmin.mEnterpriseNetworkPreferenceEnabled = enabled;
|
requiredAdmin.mPreferentialNetworkServiceEnabled = enabled;
|
||||||
saveSettingsLocked(caller.getUserId());
|
saveSettingsLocked(caller.getUserId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateNetworkPreferenceForUser(caller.getUserId(), enabled);
|
updateNetworkPreferenceForUser(caller.getUserId(), enabled);
|
||||||
DevicePolicyEventLogger
|
DevicePolicyEventLogger
|
||||||
.createEvent(DevicePolicyEnums.SET_ENTERPRISE_NETWORK_PREFERENCE_ENABLED)
|
.createEvent(DevicePolicyEnums.SET_PREFERENTIAL_NETWORK_SERVICE_ENABLED)
|
||||||
.setBoolean(enabled)
|
.setBoolean(enabled)
|
||||||
.write();
|
.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnterpriseNetworkPreferenceEnabled(int userHandle) {
|
public boolean isPreferentialNetworkServiceEnabled(int userHandle) {
|
||||||
if (!mHasFeature) {
|
if (!mHasFeature) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -11652,7 +11652,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
synchronized (getLockObject()) {
|
synchronized (getLockObject()) {
|
||||||
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(userHandle);
|
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(userHandle);
|
||||||
if (requiredAdmin != null) {
|
if (requiredAdmin != null) {
|
||||||
return requiredAdmin.mEnterpriseNetworkPreferenceEnabled;
|
return requiredAdmin.mPreferentialNetworkServiceEnabled;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -17227,11 +17227,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateNetworkPreferenceForUser(int userId,
|
private void updateNetworkPreferenceForUser(int userId,
|
||||||
boolean enableEnterpriseNetworkPreferenceEnabled) {
|
boolean preferentialNetworkServiceEnabled) {
|
||||||
if (!isManagedProfile(userId)) {
|
if (!isManagedProfile(userId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int networkPreference = enableEnterpriseNetworkPreferenceEnabled
|
int networkPreference = preferentialNetworkServiceEnabled
|
||||||
? PROFILE_NETWORK_PREFERENCE_ENTERPRISE : PROFILE_NETWORK_PREFERENCE_DEFAULT;
|
? PROFILE_NETWORK_PREFERENCE_ENTERPRISE : PROFILE_NETWORK_PREFERENCE_DEFAULT;
|
||||||
mInjector.binderWithCleanCallingIdentity(() ->
|
mInjector.binderWithCleanCallingIdentity(() ->
|
||||||
mInjector.getConnectivityManager().setProfileNetworkPreference(
|
mInjector.getConnectivityManager().setProfileNetworkPreference(
|
||||||
|
|||||||
@@ -4032,20 +4032,20 @@ public class DevicePolicyManagerTest extends DpmTestBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSetEnterpriseNetworkPreference() throws Exception {
|
public void testGetSetPreferentialNetworkService() throws Exception {
|
||||||
assertExpectException(SecurityException.class, null,
|
assertExpectException(SecurityException.class, null,
|
||||||
() -> dpm.setEnterpriseNetworkPreferenceEnabled(false));
|
() -> dpm.setPreferentialNetworkServiceEnabled(false));
|
||||||
|
|
||||||
assertExpectException(SecurityException.class, null,
|
assertExpectException(SecurityException.class, null,
|
||||||
() -> dpm.isEnterpriseNetworkPreferenceEnabled());
|
() -> dpm.isPreferentialNetworkServiceEnabled());
|
||||||
|
|
||||||
final int managedProfileUserId = 15;
|
final int managedProfileUserId = 15;
|
||||||
final int managedProfileAdminUid = UserHandle.getUid(managedProfileUserId, 19436);
|
final int managedProfileAdminUid = UserHandle.getUid(managedProfileUserId, 19436);
|
||||||
addManagedProfile(admin1, managedProfileAdminUid, admin1);
|
addManagedProfile(admin1, managedProfileAdminUid, admin1);
|
||||||
mContext.binder.callingUid = managedProfileAdminUid;
|
mContext.binder.callingUid = managedProfileAdminUid;
|
||||||
|
|
||||||
dpm.setEnterpriseNetworkPreferenceEnabled(false);
|
dpm.setPreferentialNetworkServiceEnabled(false);
|
||||||
assertThat(dpm.isEnterpriseNetworkPreferenceEnabled()).isFalse();
|
assertThat(dpm.isPreferentialNetworkServiceEnabled()).isFalse();
|
||||||
verify(getServices().connectivityManager, times(1)).setProfileNetworkPreference(
|
verify(getServices().connectivityManager, times(1)).setProfileNetworkPreference(
|
||||||
eq(UserHandle.of(managedProfileUserId)),
|
eq(UserHandle.of(managedProfileUserId)),
|
||||||
eq(ConnectivityManager.PROFILE_NETWORK_PREFERENCE_DEFAULT),
|
eq(ConnectivityManager.PROFILE_NETWORK_PREFERENCE_DEFAULT),
|
||||||
@@ -4053,8 +4053,8 @@ public class DevicePolicyManagerTest extends DpmTestBase {
|
|||||||
any()
|
any()
|
||||||
);
|
);
|
||||||
|
|
||||||
dpm.setEnterpriseNetworkPreferenceEnabled(true);
|
dpm.setPreferentialNetworkServiceEnabled(true);
|
||||||
assertThat(dpm.isEnterpriseNetworkPreferenceEnabled()).isTrue();
|
assertThat(dpm.isPreferentialNetworkServiceEnabled()).isTrue();
|
||||||
verify(getServices().connectivityManager, times(1)).setProfileNetworkPreference(
|
verify(getServices().connectivityManager, times(1)).setProfileNetworkPreference(
|
||||||
eq(UserHandle.of(managedProfileUserId)),
|
eq(UserHandle.of(managedProfileUserId)),
|
||||||
eq(ConnectivityManager.PROFILE_NETWORK_PREFERENCE_ENTERPRISE),
|
eq(ConnectivityManager.PROFILE_NETWORK_PREFERENCE_ENTERPRISE),
|
||||||
|
|||||||
Reference in New Issue
Block a user