public class

PartnerInterface

extends Object
java.lang.Object
   ↳ cyanogenmod.app.PartnerInterface

Class Overview

The PartnerInterface allows applications to interact with a subset of system settings.

Summary

Constants
String MODIFY_NETWORK_SETTINGS_PERMISSION Allows an application to change network settings, such as enabling or disabling airplane mode.
String MODIFY_SOUND_SETTINGS_PERMISSION Allows an application to change system sound settings, such as the zen mode.
int ZEN_MODE_IMPORTANT_INTERRUPTIONS Sets zen mode to important interruptions mode, so that only notifications that the user has chosen in Settings to be of high importance will cause the user's device to notify them.
int ZEN_MODE_NO_INTERRUPTIONS Sets zen mode so that no interruptions will be allowed.
int ZEN_MODE_OFF Turn off zen mode.
Public Methods
String getCurrentHotwordPackageName()
Retrieves the package name of the application that currently holds the HOTWORD input.
static PartnerInterface getInstance(Context context)
Get or create an instance of the PartnerInterface
void rebootDevice()
Reboots the device, immediately.
void setAirplaneModeEnabled(boolean enabled)
Turns on or off airplane mode.
void setMobileDataEnabled(boolean enabled)
Turns on or off mobile network.
boolean setZenMode(int mode)
Set the zen mode for the device.
boolean setZenModeWithDuration(int mode, long durationMillis)
Set the zen mode for the device, allow a duration parameter You will need MODIFY_SOUND_SETTINGS_PERMISSION to utilize this functionality.
void shutdownDevice()
Shuts down the device, immediately.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String MODIFY_NETWORK_SETTINGS_PERMISSION

Added in API level 2

Allows an application to change network settings, such as enabling or disabling airplane mode.

Constant Value: "cyanogenmod.permission.MODIFY_NETWORK_SETTINGS"

public static final String MODIFY_SOUND_SETTINGS_PERMISSION

Added in API level 2

Allows an application to change system sound settings, such as the zen mode.

Constant Value: "cyanogenmod.permission.MODIFY_SOUND_SETTINGS"

public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS

Added in API level 2

Sets zen mode to important interruptions mode, so that only notifications that the user has chosen in Settings to be of high importance will cause the user's device to notify them. This condition is held indefinitely until changed again.

Constant Value: 1 (0x00000001)

public static final int ZEN_MODE_NO_INTERRUPTIONS

Added in API level 2

Sets zen mode so that no interruptions will be allowed. The device is effectively silenced indefinitely, until the mode is changed again.

Constant Value: 2 (0x00000002)

public static final int ZEN_MODE_OFF

Added in API level 2

Turn off zen mode. This restores the original ring and interruption settings that the user had set before zen mode was enabled.

See Also
Constant Value: 0 (0x00000000)

Public Methods

public String getCurrentHotwordPackageName ()

Added in API level 2

Retrieves the package name of the application that currently holds the HOTWORD input.

Returns
  • The package name or null if no application currently holds the HOTWORD input.

public static PartnerInterface getInstance (Context context)

Added in API level 2

Get or create an instance of the PartnerInterface

public void rebootDevice ()

Added in API level 2

Reboots the device, immediately. You will need ERROR(/android.Manifest.permission.REBOOT) to utilize this functionality.

public void setAirplaneModeEnabled (boolean enabled)

Added in API level 2

Turns on or off airplane mode. You will need MODIFY_NETWORK_SETTINGS_PERMISSION to utilize this functionality.

Parameters
enabled if true, sets airplane mode to enabled, otherwise disables airplane mode.

public void setMobileDataEnabled (boolean enabled)

Added in API level 2

Turns on or off mobile network. You will need MODIFY_NETWORK_SETTINGS_PERMISSION to utilize this functionality.

Parameters
enabled if true, sets mobile network to enabled, otherwise disables mobile network.

public boolean setZenMode (int mode)

Added in API level 2

Set the zen mode for the device. You will need MODIFY_SOUND_SETTINGS_PERMISSION to utilize this functionality.

Parameters
mode The zen mode to set the device to. One of ZEN_MODE_IMPORTANT_INTERRUPTIONS, ZEN_MODE_NO_INTERRUPTIONS or ZEN_MODE_OFF.

public boolean setZenModeWithDuration (int mode, long durationMillis)

Added in API level 4

Set the zen mode for the device, allow a duration parameter You will need MODIFY_SOUND_SETTINGS_PERMISSION to utilize this functionality.

Parameters
mode The zen mode to set the device to. One of ZEN_MODE_IMPORTANT_INTERRUPTIONS, ZEN_MODE_NO_INTERRUPTIONS. If using ZEN_MODE_OFF, the duration will be ignored
durationMillis The duration in milliseconds, if duration + System.currentTimeMillis() results in long overflow, duration will be "indefinitely". all durationMillis < 0 will mean "indefinitely".

public void shutdownDevice ()

Added in API level 2

Shuts down the device, immediately. You will need ERROR(/android.Manifest.permission.REBOOT) to utilize this functionality.