WifiSsidPolicy


public final class WifiSsidPolicy
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.admin.WifiSsidPolicy


Used to indicate the Wi-Fi SSID restriction policy the network must satisfy in order to be eligible for a connection. If the policy type is a denylist, the device may not connect to networks on the denylist. If the policy type is an allowlist, the device may only connect to networks on the allowlist. Admin configured networks are not exempt from this restriction. This policy only prohibits connecting to a restricted network and does not affect adding a restricted network. If the current network is present in the denylist or not present in the allowlist, it will be disconnected.

Summary

Constants

int WIFI_SSID_POLICY_TYPE_ALLOWLIST

SSID policy type indicator for WifiSsidPolicy.

int WIFI_SSID_POLICY_TYPE_DENYLIST

SSID policy type indicator for WifiSsidPolicy.

Inherited constants

Fields

public static final Creator<WifiSsidPolicy> CREATOR

Public constructors

WifiSsidPolicy(int policyType, Set<WifiSsid> ssids)

Create the Wi-Fi SSID Policy.

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

boolean equals(Object thatObject)

Two instances of WifiSsidPolicy are considered equal if they have the same WifiSsidPolicyType and the same set of WifiSsids

int getPolicyType()

Returns the policy type.

Set<WifiSsid> getSsids()

Returns the set of WifiSsid

int hashCode()

Returns the hash code value of WifiSsidPolicyType and WifiSsid set

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

WIFI_SSID_POLICY_TYPE_ALLOWLIST

Added in API level 33
public static final int WIFI_SSID_POLICY_TYPE_ALLOWLIST

SSID policy type indicator for WifiSsidPolicy.

When returned from WifiSsidPolicy.getPolicyType(), the constant indicates that the SSID policy type is an allowlist.

Constant Value: 0 (0x00000000)

WIFI_SSID_POLICY_TYPE_DENYLIST

Added in API level 33
public static final int WIFI_SSID_POLICY_TYPE_DENYLIST

SSID policy type indicator for WifiSsidPolicy.

When returned from WifiSsidPolicy.getPolicyType(), the constant indicates that the SSID policy type is a denylist.

Constant Value: 1 (0x00000001)

Fields

CREATOR

Added in API level 33
public static final Creator<WifiSsidPolicy> CREATOR

See also:

Public constructors

WifiSsidPolicy

Added in API level 33
public WifiSsidPolicy (int policyType, 
                Set<WifiSsid> ssids)

Create the Wi-Fi SSID Policy.

Parameters
policyType int: indicate whether the policy is an allowlist or a denylist Value is WIFI_SSID_POLICY_TYPE_ALLOWLIST, or WIFI_SSID_POLICY_TYPE_DENYLIST

ssids Set: set of WifiSsid This value cannot be null.

Throws
IllegalArgumentException if the input ssids set is empty or the policyType is invalid

Public methods

describeContents

Added in API level 33
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 33
public boolean equals (Object thatObject)

Two instances of WifiSsidPolicy are considered equal if they have the same WifiSsidPolicyType and the same set of WifiSsids

Parameters
thatObject Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

getPolicyType

Added in API level 33
public int getPolicyType ()

Returns the policy type.

Returns
int Value is WIFI_SSID_POLICY_TYPE_ALLOWLIST, or WIFI_SSID_POLICY_TYPE_DENYLIST

getSsids

Added in API level 33
public Set<WifiSsid> getSsids ()

Returns the set of WifiSsid

Returns
Set<WifiSsid> This value cannot be null.

hashCode

Added in API level 33
public int hashCode ()

Returns the hash code value of WifiSsidPolicyType and WifiSsid set

Returns
int a hash code value for this object.

writeToParcel

Added in API level 33
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES