public final class

ConnectionSettings

extends Object
implements Parcelable
java.lang.Object
   ↳ lineageos.profiles.ConnectionSettings

Class Overview

The ConnectionSettings class allows for creating Network/Hardware overrides depending on their capabilities.

Example for enabling/disabling sync settings:

 ConnectionSettings connectionSettings =
         new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_SYNC,
         shouldBeEnabled() ?
         STATE_ENABLED : STATE_DISALED,
         true)
 profile.setConnectionSettings(connectionSettings);
 

Summary

Nested Classes
class ConnectionSettings.BooleanState BooleanStates for specific ConnectionSettings  
Constants
int PROFILE_CONNECTION_2G3G4G The PROFILE_CONNECTION_2G3G4G allows for flipping between 2G/3G/4G (if exists) on the device.
int PROFILE_CONNECTION_BLUETOOTH The PROFILE_CONNECTION_BLUETOOTH allows for enabling and disabling the Bluetooth device (if exists) on the device.
int PROFILE_CONNECTION_GPS The PROFILE_CONNECTION_GPS allows for enabling and disabling the GPS radio (if exists) on the device.
int PROFILE_CONNECTION_MOBILEDATA The PROFILE_CONNECTION_MOBILEDATA allows for enabling and disabling the mobile data connection.
int PROFILE_CONNECTION_NFC The PROFILE_CONNECTION_NFC allows for enabling and disabling the NFC device (if exists) on the device.
int PROFILE_CONNECTION_SYNC The PROFILE_CONNECTION_SYNC allows for enabling and disabling the global sync state on the device.
int PROFILE_CONNECTION_WIFI The PROFILE_CONNECTION_WIFI allows for enabling and disabling the WiFi connection on the device.
int PROFILE_CONNECTION_WIFIAP The PROFILE_CONNECTION_WIFIAP allows for enabling and disabling the WiFi hotspot on the device.
int PROFILE_CONNECTION_WIMAX This constant was deprecated in API level 7. No replacement.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Public Constructors
ConnectionSettings(Parcel parcel)
Unwrap ConnectionSettings from a parcel.
ConnectionSettings(int connectionId)
Construct a ConnectionSettings with a connection id and default states.
ConnectionSettings(int connectionId, int value, boolean override)
Construct a ConnectionSettings with a connection id, default value , and if the setting should override the user defaults.
Public Methods
int describeContents()
int getConnectionId()
Retrieve the connection id associated with the ConnectionSettings
int getSubId()
Get the subscription id which this ConnectionSettings should apply to.
int getValue()
Get the default value for the ConnectionSettings
boolean isOverride()
Check whether or not the ConnectionSettings overrides user settings.
void setOverride(boolean override)
Set whether or not the ConnectionSettings should override default user values
void setSubId(int subId)
void setValue(int value)
Set the default value for the ConnectionSettings
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int PROFILE_CONNECTION_2G3G4G

added in API level 2

The PROFILE_CONNECTION_2G3G4G allows for flipping between 2G/3G/4G (if exists) on the device.

Constant Value: 9 (0x00000009)

public static final int PROFILE_CONNECTION_BLUETOOTH

added in API level 2

The PROFILE_CONNECTION_BLUETOOTH allows for enabling and disabling the Bluetooth device (if exists) on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 7 (0x00000007)

public static final int PROFILE_CONNECTION_GPS

added in API level 2

The PROFILE_CONNECTION_GPS allows for enabling and disabling the GPS radio (if exists) on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 4 (0x00000004)

public static final int PROFILE_CONNECTION_MOBILEDATA

added in API level 2

The PROFILE_CONNECTION_MOBILEDATA allows for enabling and disabling the mobile data connection. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 0 (0x00000000)

public static final int PROFILE_CONNECTION_NFC

added in API level 2

The PROFILE_CONNECTION_NFC allows for enabling and disabling the NFC device (if exists) on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 8 (0x00000008)

public static final int PROFILE_CONNECTION_SYNC

added in API level 2

The PROFILE_CONNECTION_SYNC allows for enabling and disabling the global sync state on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 5 (0x00000005)

public static final int PROFILE_CONNECTION_WIFI

added in API level 2

The PROFILE_CONNECTION_WIFI allows for enabling and disabling the WiFi connection on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 1 (0x00000001)

public static final int PROFILE_CONNECTION_WIFIAP

added in API level 2

The PROFILE_CONNECTION_WIFIAP allows for enabling and disabling the WiFi hotspot on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 2 (0x00000002)

public static final int PROFILE_CONNECTION_WIMAX

added in API level 2

This constant was deprecated in API level 7.
No replacement.

The PROFILE_CONNECTION_WIMAX allows for enabling and disabling the WIMAX radio (if exists) on the device. Boolean connection settings ConnectionSettings.BooleanState

Constant Value: 3 (0x00000003)

Public Constructors

public ConnectionSettings (Parcel parcel)

added in API level 2

Unwrap ConnectionSettings from a parcel.

public ConnectionSettings (int connectionId)

added in API level 2

Construct a ConnectionSettings with a connection id and default states.

Parameters
connectionId int: ex: #PROFILE_CONNECTION_NFC

public ConnectionSettings (int connectionId, int value, boolean override)

added in API level 2

Construct a ConnectionSettings with a connection id, default value , and if the setting should override the user defaults.

Parameters
connectionId int: an identifier for the ConnectionSettings (ex:#PROFILE_CONNECTION_WIFI)
value int: default value for the ConnectionSettings (ex:STATE_ENABLED)
override boolean: whether or not the ConnectionSettings should override user defaults

Public Methods

public int describeContents ()

added in API level 2

Returns
int

public int getConnectionId ()

added in API level 2

Retrieve the connection id associated with the ConnectionSettings

Returns
int an integer identifier

public int getSubId ()

added in API level 5

Get the subscription id which this ConnectionSettings should apply to.

Returns
int

public int getValue ()

added in API level 2

Get the default value for the ConnectionSettings

Returns
int integer value corresponding with its state

public boolean isOverride ()

added in API level 2

Check whether or not the ConnectionSettings overrides user settings.

Returns
boolean true if override

public void setOverride (boolean override)

added in API level 2

Set whether or not the ConnectionSettings should override default user values

Parameters
override boolean: boolean override

public void setSubId (int subId)

added in API level 5

Parameters
subId int

public void setValue (int value)

added in API level 2

Set the default value for the ConnectionSettings

Parameters
value int: ConnectionSettings.BooleanState