Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4c278d8 authored by Shuo Qian's avatar Shuo Qian Committed by Automerger Merge Worker
Browse files

Merge "Change default value from true to false for preferential network...

Merge "Change default value from true to false for preferential network service enabling" into sc-dev am: 5fcdcebf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14669178

Change-Id: I06db4028ce17762115ecc755f8d1e23eda6c7c37
parents 59970582 5fcdcebf
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -504,6 +504,13 @@ public class DevicePolicyManager {
    public static final String EXTRA_BUGREPORT_NOTIFICATION_TYPE =
            "android.app.extra.bugreport_notification_type";
    /**
     * Default value for preferential network service enabling.
     *
     * @hide
     */
    public static final boolean PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT = false;
    /**
     * Notification type for a started remote bugreport flow.
     *
+5 −8
Original line number Diff line number Diff line
@@ -150,7 +150,6 @@ class ActiveAdmin {
    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 PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT = true;

    DeviceAdminInfo info;

@@ -297,7 +296,7 @@ class ActiveAdmin {
    public String mEnrollmentSpecificId;
    public boolean mAdminCanGrantSensorsPermissions;
    public boolean mPreferentialNetworkServiceEnabled =
            PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT;
            DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT;

    private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
    boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
@@ -576,10 +575,8 @@ class ActiveAdmin {
        }
        writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
                mAdminCanGrantSensorsPermissions);
        if (mPreferentialNetworkServiceEnabled != PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT) {
        writeAttributeValueToXml(out, TAG_PREFERENTIAL_NETWORK_SERVICE_ENABLED,
                mPreferentialNetworkServiceEnabled);
        }
        if (mUsbDataSignalingEnabled != USB_DATA_SIGNALING_ENABLED_DEFAULT) {
            writeAttributeValueToXml(out, TAG_USB_DATA_SIGNALING, mUsbDataSignalingEnabled);
        }
@@ -807,8 +804,8 @@ class ActiveAdmin {
            } else if (TAG_ALWAYS_ON_VPN_LOCKDOWN.equals(tag)) {
                mAlwaysOnVpnLockdown = parser.getAttributeBoolean(null, ATTR_VALUE, false);
            } else if (TAG_PREFERENTIAL_NETWORK_SERVICE_ENABLED.equals(tag)) {
                mPreferentialNetworkServiceEnabled = parser.getAttributeBoolean(
                        null, ATTR_VALUE, PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT);
                mPreferentialNetworkServiceEnabled = parser.getAttributeBoolean(null, ATTR_VALUE,
                        DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT);
            } else if (TAG_COMMON_CRITERIA_MODE.equals(tag)) {
                mCommonCriteriaMode = parser.getAttributeBoolean(null, ATTR_VALUE, false);
            } else if (TAG_PASSWORD_COMPLEXITY.equals(tag)) {
+3 −2
Original line number Diff line number Diff line
@@ -3176,11 +3176,12 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        updatePermissionPolicyCache(userId);
        updateAdminCanGrantSensorsPermissionCache(userId);
        boolean preferentialNetworkServiceEnabled = true;
        final boolean preferentialNetworkServiceEnabled;
        synchronized (getLockObject()) {
            ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
            preferentialNetworkServiceEnabled = owner != null
                    ? owner.mPreferentialNetworkServiceEnabled : true;
                    ? owner.mPreferentialNetworkServiceEnabled
                             : DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT;
        }
        updateNetworkPreferenceForUser(userId, preferentialNetworkServiceEnabled);
+10 −1
Original line number Diff line number Diff line
@@ -4030,7 +4030,7 @@ public class DevicePolicyManagerTest extends DpmTestBase {
    }

    @Test
    public void testUpdateNetworkPreferenceOnStartOnStopUser() throws Exception {
    public void testUpdateNetworkPreferenceOnStartUser() throws Exception {
        final int managedProfileUserId = 15;
        final int managedProfileAdminUid = UserHandle.getUid(managedProfileUserId, 19436);
        addManagedProfile(admin1, managedProfileAdminUid, admin1);
@@ -4044,6 +4044,15 @@ public class DevicePolicyManagerTest extends DpmTestBase {
                any(),
                any()
        );
    }

    @Test
    public void testUpdateNetworkPreferenceOnStopUser() throws Exception {
        final int managedProfileUserId = 15;
        final int managedProfileAdminUid = UserHandle.getUid(managedProfileUserId, 19436);
        addManagedProfile(admin1, managedProfileAdminUid, admin1);
        mContext.binder.callingUid = managedProfileAdminUid;
        mServiceContext.permissions.add(permission.INTERACT_ACROSS_USERS_FULL);

        dpms.handleStopUser(managedProfileUserId);
        verify(getServices().connectivityManager, times(1)).setProfileNetworkPreference(