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

int CONTENTS_FILE_DESCRIPTOR

Descriptor bit used with describeContents(): indicates that the Parcelable object's flattened representation includes a file descriptor.

int PARCELABLE_WRITE_RETURN_VALUE

Flag for use with writeToParcel(Parcel, int): the object being written is a return value, that is the result of a function such as "Parcelable someFunction()", "void someFunction(out Parcelable)", or "void someFunction(inout Parcelable)".

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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

abstract int describeContents()

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

abstract void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

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.

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