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

Commit f149e793 authored by Les Lee's avatar Les Lee
Browse files

wifi: Add new user restrictions

The new multi-user Wi-Fi design provides private networks for guest users.
However, guest users cannot add shared networks.
Conversely, HSU users, who log in to the network, should be restricted
from creating private networks. These different use cases need new user
restrictions.

Note: Currently, there is no use case which DPC (device policy controller)
need to change it dynamically. Currently those restriction
will be used as pre-restriction on specific user role (for example:
guest user should not allow to add / change shared user config)

Flag: com.android.wifi.flags.multi_user_wifi_enhancement
Bug: 390240471
Test: TH
Change-Id: Ic8aad6c0bcfd4c7d839614df586acb89cc28a8ba
parent 34fa917f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ aconfig_declarations_group {
        "surfaceflinger_flags_java_lib",
        "telecom_flags_core_java_lib",
        "telephony_flags_core_java_lib",
        "wifi_framework_aconfig_flags_lib",
        // !!! KEEP THIS LIST ALPHABETICAL !!!
    ],
}
+5 −0
Original line number Diff line number Diff line
@@ -503,6 +503,11 @@ package android.os {
    method @FlaggedApi("android.os.update_engine_api") public void triggerPostinstall(@NonNull String);
  }

  public class UserManager {
    field @FlaggedApi("com.android.wifi.flags.multi_user_wifi_enhancement") public static final String DISALLOW_CONFIG_WIFI_PRIVATE = "no_config_wifi_private";
    field @FlaggedApi("com.android.wifi.flags.multi_user_wifi_enhancement") public static final String DISALLOW_CONFIG_WIFI_SHARED = "no_config_wifi_shared";
  }

}

package android.os.storage {
+44 −0
Original line number Diff line number Diff line
@@ -345,6 +345,50 @@ public class UserManager {
     */
    public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";

    /**
     * Specifies if a user is disallowed from adding or editing private Wi-Fi configurations,
     * that is, Wi-Fi configurations that are not shared with other users.
     *
     * Use {@link #DISALLOW_CONFIG_WIFI} if all types of Wi-Fi configurations are disallowed to
     * be added or edited.
     *
     * Note: This restriction is used for system only, it can't be used via
     * the DevicePolicyManager APIs.
     *
     * <p>The default value is <code>false</code>.
     *
     * <p>Key for user restrictions.
     * <p>Type: Boolean
     * @see #getUserRestrictions()
     *
     * @hide
     */
    @FlaggedApi(com.android.wifi.flags.Flags.FLAG_MULTI_USER_WIFI_ENHANCEMENT)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public static final String DISALLOW_CONFIG_WIFI_PRIVATE = "no_config_wifi_private";

    /**
     * Specifies if a user is disallowed from adding or editing shared Wi-Fi configurations,
     * that is, Wi-Fi configurations that are shared with other users.
     *
     * Use {@link #DISALLOW_CONFIG_WIFI} if all types of Wi-Fi configurations are disallowed
     * to be added or edited.
     *
     * Note: This restriction is used for system only, it can't be used via
     * the DevicePolicyManager APIs.
     *
     * <p>The default value is <code>false</code>.
     *
     * <p>Key for user restrictions.
     * <p>Type: Boolean
     * @see #getUserRestrictions()
     *
     * @hide
     */
    @FlaggedApi(com.android.wifi.flags.Flags.FLAG_MULTI_USER_WIFI_ENHANCEMENT)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public static final String DISALLOW_CONFIG_WIFI_SHARED = "no_config_wifi_shared";

    /**
     * Specifies if a user is disallowed from enabling/disabling Wi-Fi.
     *
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ public class UserRestrictionsUtils {

    public static final Set<String> USER_RESTRICTIONS = newSetWithUniqueCheck(new String[] {
            UserManager.DISALLOW_CONFIG_WIFI,
            UserManager.DISALLOW_CONFIG_WIFI_PRIVATE,
            UserManager.DISALLOW_CONFIG_WIFI_SHARED,
            UserManager.DISALLOW_CONFIG_LOCALE,
            UserManager.DISALLOW_MODIFY_ACCOUNTS,
            UserManager.DISALLOW_INSTALL_APPS,