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

Commit 8a1eb3ca authored by Kangping Dong's avatar Kangping Dong Committed by Gerrit Code Review
Browse files

Merge "[Thread] add API UserManager#DISALLOW_THREAD_NETWORK" into main

parents ed2395aa 14a27640
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34032,6 +34032,7 @@ package android.os {
    field public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI = "no_sharing_admin_configured_wifi";
    field public static final String DISALLOW_SMS = "no_sms";
    field public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs";
    field @FlaggedApi("com.android.net.thread.flags.thread_user_restriction_enabled") public static final String DISALLOW_THREAD_NETWORK = "no_thread_network";
    field public static final String DISALLOW_ULTRA_WIDEBAND_RADIO = "no_ultra_wideband_radio";
    field public static final String DISALLOW_UNIFIED_PASSWORD = "no_unified_password";
    field public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
+25 −0
Original line number Diff line number Diff line
@@ -1846,6 +1846,30 @@ public class UserManager {
    public static final String DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO =
            "no_near_field_communication_radio";

    /**
     * This user restriction specifies if Thread network is disallowed on the device. If Thread
     * network is disallowed it cannot be turned on via Settings.
     *
     * <p>This restriction can only be set by a device owner or a profile owner of an
     * organization-owned managed profile on the parent profile.
     * In both cases, the restriction applies globally on the device and will turn off the
     * Thread network radio if it's currently on and prevent the radio from being turned
     * on in the future.
     *
     * <p> <a href="https://www.threadgroup.org">Thread</a> is a low-power and low-latency wireless
     * mesh networking protocol built on IPv6.
     *
     * <p>Default is <code>false</code>.
     *
     * <p>Key for user restrictions.
     * <p>Type: Boolean
     * @see DevicePolicyManager#addUserRestriction(ComponentName, String)
     * @see DevicePolicyManager#clearUserRestriction(ComponentName, String)
     * @see #getUserRestrictions()
     */
    @FlaggedApi("com.android.net.thread.flags.thread_user_restriction_enabled")
    public static final String DISALLOW_THREAD_NETWORK = "no_thread_network";

    /**
     * List of key values that can be passed into the various user restriction related methods
     * in {@link UserManager} & {@link DevicePolicyManager}.
@@ -1931,6 +1955,7 @@ public class UserManager {
            DISALLOW_ULTRA_WIDEBAND_RADIO,
            DISALLOW_GRANT_ADMIN,
            DISALLOW_NEAR_FIELD_COMMUNICATION_RADIO,
            DISALLOW_THREAD_NETWORK,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface UserRestrictionKey {}
+7 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import static android.Manifest.permission.MANAGE_DEVICE_POLICY_STATUS_BAR;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_SUPPORT_MESSAGE;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_SYSTEM_DIALOGS;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_SYSTEM_UPDATES;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_THREAD_NETWORK;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_TIME;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_USB_DATA_SIGNALLING;
import static android.Manifest.permission.MANAGE_DEVICE_POLICY_USB_FILE_TRANSFER;
@@ -482,6 +483,7 @@ import com.android.internal.widget.PasswordValidationError;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.net.module.util.ProxyUtils;
import com.android.net.thread.flags.Flags;
import com.android.server.AlarmManagerInternal;
import com.android.server.LocalManagerRegistry;
import com.android.server.LocalServices;
@@ -13834,6 +13836,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                UserManager.DISALLOW_SMS, new String[]{MANAGE_DEVICE_POLICY_SMS});
        USER_RESTRICTION_PERMISSIONS.put(
                UserManager.DISALLOW_SYSTEM_ERROR_DIALOGS, new String[]{MANAGE_DEVICE_POLICY_SYSTEM_DIALOGS});
        if (Flags.threadUserRestrictionEnabled()) {
            USER_RESTRICTION_PERMISSIONS.put(
                    UserManager.DISALLOW_THREAD_NETWORK,
                    new String[]{MANAGE_DEVICE_POLICY_THREAD_NETWORK});
        }
        USER_RESTRICTION_PERMISSIONS.put(
                UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, new String[]{MANAGE_DEVICE_POLICY_NEARBY_COMMUNICATION});
        USER_RESTRICTION_PERMISSIONS.put(