VpnProfileState
class VpnProfileState : Parcelable
kotlin.Any | |
↳ | android.net.VpnProfileState |
Describe the state of VPN.
Summary
Constants | |
---|---|
static Int |
The VPN was established successfully. |
static Int |
The VPN is attempting to connect, potentially after a failure. |
static Int |
The VPN has not been started, or some other VPN is active. |
static Int |
A non-recoverable error has occurred, and will not be retried. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
VpnProfileState(state: Int, sessionKey: String?, alwaysOn: Boolean, lockdown: Boolean) |
Public methods | |
---|---|
Int |
Implement the Parcelable interface |
Boolean |
Indicates whether some other object is "equal to" this one. |
String? |
Retrieves the Session Key |
Int |
getState() Returns the state of the Platform VPN |
Int |
hashCode() |
Boolean |
Returns the always-on status of the PlatformVpnProfile. |
Boolean |
Returns the lockdown mode status of the PlatformVpnProfile. |
String |
toString() |
Unit |
writeToParcel(out: Parcel, flags: Int) Implement the Parcelable interface |
Properties | |
---|---|
static Parcelable.Creator<VpnProfileState!> |
Constants
STATE_CONNECTED
static val STATE_CONNECTED: Int
The VPN was established successfully.
Value: 2
STATE_CONNECTING
static val STATE_CONNECTING: Int
The VPN is attempting to connect, potentially after a failure.
Value: 1
STATE_DISCONNECTED
static val STATE_DISCONNECTED: Int
The VPN has not been started, or some other VPN is active.
Value: 0
STATE_FAILED
static val STATE_FAILED: Int
A non-recoverable error has occurred, and will not be retried.
Value: 3
Public constructors
VpnProfileState
VpnProfileState(
state: Int,
sessionKey: String?,
alwaysOn: Boolean,
lockdown: Boolean)
Parameters | |
---|---|
state |
Int: Value is android.net.VpnProfileState#STATE_CONNECTED , android.net.VpnProfileState#STATE_CONNECTING , android.net.VpnProfileState#STATE_DISCONNECTED , or android.net.VpnProfileState#STATE_FAILED |
sessionKey |
String?: This value may be null . |
Public methods
describeContents
fun describeContents(): Int
Implement the Parcelable interface
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
equals
fun equals(other: Any?): Boolean
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
obj |
This value may be null . |
Return | |
---|---|
Boolean |
true if this object is the same as the obj argument; false otherwise. |
getSessionId
fun getSessionId(): String?
Retrieves the Session Key
The session key is an ephemeral key uniquely identifying the session for a Platform VPN. The lifetime of this key is tied to the lifetime of the VPN session. In other words, reprovisioning of the VPN profile, restarting of the device, or manually restarting the platform VPN session will result in a new VPN session, and a new key.
Return | |
---|---|
String? |
the unique key for the platform VPN session, or null if it is not running. |
getState
fun getState(): Int
Returns the state of the Platform VPN
This state represents the internal connection state of the VPN. This state may diverge from the VPN Network's state during error and recovery handling.
isAlwaysOn
fun isAlwaysOn(): Boolean
Returns the always-on status of the PlatformVpnProfile.
If the PlatformVpnProfile is set to be running in always-on mode, the system will ensure that the profile is always started, and restarting it when necessary (e.g. after reboot).
Always-on can be set by an appropriately privileged user via the Settings VPN menus, or by the Device Policy Manager app programmatically. See DevicePolicyManager#setAlwaysOnVpnPackage(ComponentName, String, boolean, Set)
isLockdownEnabled
fun isLockdownEnabled(): Boolean
Returns the lockdown mode status of the PlatformVpnProfile.
In lockdown mode, the system will ensure that apps are not allowed to bypass the VPN, including during startup or failure of the VPN.
Lockdown mode can be set by an appropriately privileged user via the Settings VPN menus, or by the Device Policy Manager app programmatically. See DevicePolicyManager#setAlwaysOnVpnPackage(ComponentName, String, boolean, Set)
toString
fun toString(): String
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
fun writeToParcel(
out: Parcel,
flags: Int
): Unit
Implement the Parcelable interface
Parameters | |
---|---|
dest |
The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
out |
Parcel: This value cannot be null . |