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

Commit 48be69a7 authored by Shuo Qian's avatar Shuo Qian
Browse files

Rename "Network slicing" to "Enterprise network preference" in the 5G Slicing API

Test: Treehugger
Bug: 178655595
Change-Id: Ifbe6e5045f85fcf4b5ca2f941605796a788a8a60
parent 9a5dfd37
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -7183,6 +7183,7 @@ package android.app.admin {
    method public boolean isCommonCriteriaModeEnabled(@Nullable android.content.ComponentName);
    method public boolean isCommonCriteriaModeEnabled(@Nullable android.content.ComponentName);
    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);
@@ -7190,7 +7191,6 @@ package android.app.admin {
    method public boolean isManagedProfile(@NonNull android.content.ComponentName);
    method public boolean isManagedProfile(@NonNull android.content.ComponentName);
    method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName);
    method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName);
    method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName);
    method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName);
    method public boolean isNetworkSlicingEnabled();
    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;
@@ -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 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);
@@ -7264,7 +7265,6 @@ package android.app.admin {
    method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long);
    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 @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 setNetworkLoggingEnabled(@Nullable android.content.ComponentName, boolean);
    method public void setNetworkSlicingEnabled(boolean);
    method @Deprecated public void setOrganizationColor(@NonNull android.content.ComponentName, int);
    method @Deprecated public void setOrganizationColor(@NonNull android.content.ComponentName, int);
    method public void setOrganizationId(@NonNull String);
    method public void setOrganizationId(@NonNull String);
    method public void setOrganizationName(@NonNull android.content.ComponentName, @Nullable CharSequence);
    method public void setOrganizationName(@NonNull android.content.ComponentName, @Nullable CharSequence);
+14 −16
Original line number Original line Diff line number Diff line
@@ -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
     * For example, a corporation can have a deal/agreement with a carrier that all of its
     * portions for specific use cases; for example, a corporation can have a deal/agreement with
     * employees’ devices use data on a network preference dedicated for enterprise use.
     * a carrier that all of its employees’ devices use data on a slice dedicated for enterprise
     * use.
     *
     *
     * By default, 5g slicing is enabled on the work profile on supported carriers and devices.
     * By default, enterprise network preference is enabled on the work profile on supported
     * Admins can explicitly disable it with this API.
     * 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.
     * <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.
     * @throws SecurityException if the caller is not the profile owner.
     **/
     **/
    public void setNetworkSlicingEnabled(boolean enabled) {
    public void setEnterpriseNetworkPreferenceEnabled(boolean enabled) {
        throwIfParentInstance("setNetworkSlicingEnabled");
        throwIfParentInstance("setEnterpriseNetworkPreferenceEnabled");
        if (mService != null) {
        if (mService != null) {
            try {
            try {
                mService.setNetworkSlicingEnabled(enabled);
                mService.setEnterpriseNetworkPreferenceEnabled(enabled);
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
                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.
     * <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.
     * @throws SecurityException if the caller is not the profile owner.
     */
     */
    public boolean isNetworkSlicingEnabled() {
    public boolean isEnterpriseNetworkPreferenceEnabled() {
        throwIfParentInstance("isNetworkSlicingEnabled");
        throwIfParentInstance("isEnterpriseNetworkPreferenceEnabled");
        if (mService == null) {
        if (mService == null) {
            return false;
            return false;
        }
        }
        try {
        try {
            return mService.isNetworkSlicingEnabled(myUserId());
            return mService.isEnterpriseNetworkPreferenceEnabled(myUserId());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -268,8 +268,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 setNetworkSlicingEnabled(in boolean enabled);
    void setEnterpriseNetworkPreferenceEnabled(in boolean enabled);
    boolean isNetworkSlicingEnabled(int userHandle);
    boolean isEnterpriseNetworkPreferenceEnabled(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);
+13 −10
Original line number Original line Diff line number Diff line
@@ -139,12 +139,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_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 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 NETWORK_SLICING_ENABLED_DEFAULT = true;
    private static final boolean ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT = true;


    DeviceAdminInfo info;
    DeviceAdminInfo info;


@@ -284,7 +285,8 @@ class ActiveAdmin {
    public String mOrganizationId;
    public String mOrganizationId;
    public String mEnrollmentSpecificId;
    public String mEnrollmentSpecificId;
    public boolean mAdminCanGrantSensorsPermissions;
    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;
    private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
    boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
    boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
@@ -555,8 +557,9 @@ class ActiveAdmin {
        }
        }
        writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
        writeAttributeValueToXml(out, TAG_ADMIN_CAN_GRANT_SENSORS_PERMISSIONS,
                mAdminCanGrantSensorsPermissions);
                mAdminCanGrantSensorsPermissions);
        if (mNetworkSlicingEnabled != NETWORK_SLICING_ENABLED_DEFAULT) {
        if (mEnterpriseNetworkPreferenceEnabled != ENTERPRISE_NETWORK_PREFERENCE_ENABLED_DEFAULT) {
            writeAttributeValueToXml(out, TAG_NETWORK_SLICING_ENABLED, mNetworkSlicingEnabled);
            writeAttributeValueToXml(out, TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED,
                    mEnterpriseNetworkPreferenceEnabled);
        }
        }
        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);
@@ -784,9 +787,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_NETWORK_SLICING_ENABLED.equals(tag)) {
            } else if (TAG_ENTERPRISE_NETWORK_PREFERENCE_ENABLED.equals(tag)) {
                mNetworkSlicingEnabled = parser.getAttributeBoolean(
                mEnterpriseNetworkPreferenceEnabled = parser.getAttributeBoolean(
                        null, ATTR_VALUE, NETWORK_SLICING_ENABLED_DEFAULT);
                        null, ATTR_VALUE, ENTERPRISE_NETWORK_PREFERENCE_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)) {
@@ -1142,8 +1145,8 @@ class ActiveAdmin {
        pw.print("mAlwaysOnVpnLockdown=");
        pw.print("mAlwaysOnVpnLockdown=");
        pw.println(mAlwaysOnVpnLockdown);
        pw.println(mAlwaysOnVpnLockdown);


        pw.print("mNetworkSlicingEnabled=");
        pw.print("mEnterpriseNetworkPreferenceEnabled=");
        pw.println(mNetworkSlicingEnabled);
        pw.println(mEnterpriseNetworkPreferenceEnabled);


        pw.print("mCommonCriteriaMode=");
        pw.print("mCommonCriteriaMode=");
        pw.println(mCommonCriteriaMode);
        pw.println(mCommonCriteriaMode);
+11 −8
Original line number Original line Diff line number Diff line
@@ -3092,7 +3092,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        boolean enableEnterpriseNetworkSlice = true;
        boolean enableEnterpriseNetworkSlice = true;
        synchronized (getLockObject()) {
        synchronized (getLockObject()) {
            ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
            ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
            enableEnterpriseNetworkSlice = owner != null ? owner.mNetworkSlicingEnabled : true;
            enableEnterpriseNetworkSlice = owner != null
                    ? owner.mEnterpriseNetworkPreferenceEnabled : true;
        }
        }
        updateNetworkPreferenceForUser(userId, enableEnterpriseNetworkSlice);
        updateNetworkPreferenceForUser(userId, enableEnterpriseNetworkSlice);
@@ -11423,30 +11424,32 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    }
    @Override
    @Override
    public void setNetworkSlicingEnabled(boolean enabled) {
    public void setEnterpriseNetworkPreferenceEnabled(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; only profile owner may control the network slicing");
                "Caller is not profile owner;"
                        + " only profile owner may control the enterprise network preference");
        synchronized (getLockObject()) {
        synchronized (getLockObject()) {
            final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
            final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
                    caller.getUserId());
                    caller.getUserId());
            if (requiredAdmin != null && requiredAdmin.mNetworkSlicingEnabled != enabled) {
            if (requiredAdmin != null
                requiredAdmin.mNetworkSlicingEnabled = enabled;
                    && requiredAdmin.mEnterpriseNetworkPreferenceEnabled != enabled) {
                requiredAdmin.mEnterpriseNetworkPreferenceEnabled = enabled;
                saveSettingsLocked(caller.getUserId());
                saveSettingsLocked(caller.getUserId());
            }
            }
        }
        }
        updateNetworkPreferenceForUser(caller.getUserId(), enabled);
        updateNetworkPreferenceForUser(caller.getUserId(), enabled);
        DevicePolicyEventLogger
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_NETWORK_SLICING_ENABLED)
                .createEvent(DevicePolicyEnums.SET_ENTERPRISE_NETWORK_PREFERENCE_ENABLED)
                .setBoolean(enabled)
                .setBoolean(enabled)
                .write();
                .write();
    }
    }
    @Override
    @Override
    public boolean isNetworkSlicingEnabled(int userHandle) {
    public boolean isEnterpriseNetworkPreferenceEnabled(int userHandle) {
        if (!mHasFeature) {
        if (!mHasFeature) {
            return false;
            return false;
        }
        }
@@ -11457,7 +11460,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.mNetworkSlicingEnabled;
                return requiredAdmin.mEnterpriseNetworkPreferenceEnabled;
            } else {
            } else {
                return false;
                return false;
            }
            }
Loading