public final class

CMHardwareManager

extends Object
java.lang.Object
   ↳ cyanogenmod.hardware.CMHardwareManager

Class Overview

Manages access to CyanogenMod hardware extensions

This manager requires the HARDWARE_ABSTRACTION_ACCESS permission.

To get the instance of this class, utilize CMHardwareManager#getInstance(Context context)

Summary

Constants
int FEATURE_ADAPTIVE_BACKLIGHT Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer, QCOM CABL or Samsung CABC)
int FEATURE_AUTO_CONTRAST Auto contrast
int FEATURE_COLOR_BALANCE Color balance
int FEATURE_COLOR_ENHANCEMENT Color enhancement support
int FEATURE_DISPLAY_COLOR_CALIBRATION Display RGB color calibration
int FEATURE_DISPLAY_GAMMA_CALIBRATION Display gamma calibration
int FEATURE_DISPLAY_MODES Display modes
int FEATURE_HIGH_TOUCH_SENSITIVITY High touch sensitivity for touch panels
int FEATURE_KEY_DISABLE Hardware navigation key disablement
int FEATURE_LONG_TERM_ORBITS Long term orbits (LTO)
int FEATURE_PERSISTENT_STORAGE Persistent storage
int FEATURE_PICTURE_ADJUSTMENT HSIC picture adjustment
int FEATURE_SERIAL_NUMBER Serial number other than ro.serialno
int FEATURE_SUNLIGHT_ENHANCEMENT Increased display readability in bright light
int FEATURE_TAP_TO_WAKE Double-tap the touch panel to wake up the device
int FEATURE_THERMAL_MONITOR Thermal change monitor
int FEATURE_TOUCH_HOVERING Touchscreen hovering
int FEATURE_UNIQUE_DEVICE_ID Unique device ID
int FEATURE_VIBRATOR Variable vibrator intensity
Public Methods
boolean deletePersistentObject(String key)
Delete an object from persistent storage
boolean get(int feature)
Determine if the given feature is enabled or disabled.
int getColorBalance()
Range<Integer> getColorBalanceRange()
DisplayMode getCurrentDisplayMode()
DisplayMode getDefaultDisplayMode()
HSIC getDefaultPictureAdjustment()
Gets the default picture adjustment for the current mode
int[] getDisplayColorCalibration()
int getDisplayColorCalibrationDefault()
int getDisplayColorCalibrationMax()
int getDisplayColorCalibrationMin()
int[] getDisplayGammaCalibration(int idx)
int getDisplayGammaCalibrationMax()
int getDisplayGammaCalibrationMin()
DisplayMode[] getDisplayModes()
static CMHardwareManager getInstance(Context context)
Get or create an instance of the CMHardwareManager
String getLtoDestination()
long getLtoDownloadInterval()
String getLtoSource()
int getNumGammaControls()
HSIC getPictureAdjustment()
Gets the current picture adjustment values
List<Range<Float>> getPictureAdjustmentRanges()
Get a list of ranges valid for picture adjustment.
String getSerialNumber()
int getSupportedFeatures()
int getThermalState()
String getUniqueDeviceId()
int getVibratorDefaultIntensity()
int getVibratorIntensity()
int getVibratorMaxIntensity()
int getVibratorMinIntensity()
int getVibratorWarningIntensity()
boolean isSunlightEnhancementSelfManaged()
boolean isSupported(int feature)
Determine if a CM Hardware feature is supported on this device
byte[] readPersistentBytes(String key)
Read a byte array from persistent storage
int readPersistentInt(String key)
Read an integer from persistent storage
String readPersistentString(String key)
Read a string from persistent storage
boolean registerThermalListener(ThermalListenerCallback thermalCallback)
Register a callback to be notified of thermal state changes
boolean requireAdaptiveBacklightForSunlightEnhancement()
boolean set(int feature, boolean enable)
Enable or disable the given feature Only used for features which have simple enable/disable controls.
boolean setColorBalance(int value)
Sets the desired color balance.
boolean setDisplayColorCalibration(int[] rgb)
Set the display color calibration to the given rgb triplet
boolean setDisplayGammaCalibration(int idx, int[] rgb)
Set the display gamma calibration for a specific control
boolean setDisplayMode(DisplayMode mode, boolean makeDefault)
boolean setPictureAdjustment(HSIC hsic)
Sets the desired hue/saturation/intensity/contrast
boolean setVibratorIntensity(int intensity)
Set the current vibrator intensity
boolean unRegisterThermalListener(ThermalListenerCallback thermalCallback)
Unregister a callback previously registered to be notified of thermal state changes
boolean writePersistentBytes(String key, byte[] value)
Write a byte array to persistent storage, which persists thru factory reset
boolean writePersistentInt(String key, int value)
Write an integer to persistent storage, which persists thru factory reset
boolean writePersistentString(String key, String value)
Write a string to persistent storage, which persists thru factory reset
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int FEATURE_ADAPTIVE_BACKLIGHT

Added in API level 2

Adaptive backlight support (this refers to technologies like NVIDIA SmartDimmer, QCOM CABL or Samsung CABC)

Constant Value: 1 (0x00000001)

public static final int FEATURE_AUTO_CONTRAST

Added in API level 2

Auto contrast

Constant Value: 4096 (0x00001000)

public static final int FEATURE_COLOR_BALANCE

Added in API level 6

Color balance

Constant Value: 131072 (0x00020000)

public static final int FEATURE_COLOR_ENHANCEMENT

Added in API level 2

Color enhancement support

Constant Value: 2 (0x00000002)

public static final int FEATURE_DISPLAY_COLOR_CALIBRATION

Added in API level 2

Display RGB color calibration

Constant Value: 4 (0x00000004)

public static final int FEATURE_DISPLAY_GAMMA_CALIBRATION

Added in API level 2

Display gamma calibration

Constant Value: 8 (0x00000008)

public static final int FEATURE_DISPLAY_MODES

Added in API level 2

Display modes

Constant Value: 8192 (0x00002000)

public static final int FEATURE_HIGH_TOUCH_SENSITIVITY

Added in API level 2

High touch sensitivity for touch panels

Constant Value: 16 (0x00000010)

public static final int FEATURE_KEY_DISABLE

Added in API level 2

Hardware navigation key disablement

Constant Value: 32 (0x00000020)

public static final int FEATURE_LONG_TERM_ORBITS

Added in API level 2

Long term orbits (LTO)

Constant Value: 64 (0x00000040)

public static final int FEATURE_PERSISTENT_STORAGE

Added in API level 2

Persistent storage

Constant Value: 16384 (0x00004000)

public static final int FEATURE_PICTURE_ADJUSTMENT

Added in API level 6

HSIC picture adjustment

Constant Value: 262144 (0x00040000)

public static final int FEATURE_SERIAL_NUMBER

Added in API level 2

Serial number other than ro.serialno

Constant Value: 128 (0x00000080)

public static final int FEATURE_SUNLIGHT_ENHANCEMENT

Added in API level 2

Increased display readability in bright light

Constant Value: 256 (0x00000100)

public static final int FEATURE_TAP_TO_WAKE

Added in API level 2

Double-tap the touch panel to wake up the device

Constant Value: 512 (0x00000200)

public static final int FEATURE_THERMAL_MONITOR

Added in API level 2

Thermal change monitor

Constant Value: 32768 (0x00008000)

public static final int FEATURE_TOUCH_HOVERING

Added in API level 2

Touchscreen hovering

Constant Value: 2048 (0x00000800)

public static final int FEATURE_UNIQUE_DEVICE_ID

Added in API level 5

Unique device ID

Constant Value: 65536 (0x00010000)

public static final int FEATURE_VIBRATOR

Added in API level 2

Variable vibrator intensity

Constant Value: 1024 (0x00000400)

Public Methods

public boolean deletePersistentObject (String key)

Added in API level 2

Delete an object from persistent storage

Parameters
key String identifier for this item
Returns
  • true if an item was deleted

public boolean get (int feature)

Added in API level 2

Determine if the given feature is enabled or disabled. Only used for features which have simple enable/disable controls.

Parameters
feature the CM Hardware feature to query
Returns
  • true if the feature is enabled, false otherwise.

public int getColorBalance ()

Added in API level 6

Returns
  • the current color balance value

public Range<Integer> getColorBalanceRange ()

Added in API level 6

Returns
  • the available range for color temperature adjustments

public DisplayMode getCurrentDisplayMode ()

Added in API level 2

Returns
  • the currently active display mode

public DisplayMode getDefaultDisplayMode ()

Added in API level 2

Returns
  • the default display mode to be set on boot

public HSIC getDefaultPictureAdjustment ()

Added in API level 6

Gets the default picture adjustment for the current mode

Returns
  • HSIC object with default settings

public int[] getDisplayColorCalibration ()

Added in API level 2

Returns
  • the current RGB calibration, where int[0] = R, int[1] = G, int[2] = B.

public int getDisplayColorCalibrationDefault ()

Added in API level 2

Returns
  • the default value for all colors

public int getDisplayColorCalibrationMax ()

Added in API level 2

Returns
  • The minimum value for all colors

public int getDisplayColorCalibrationMin ()

Added in API level 2

Returns
  • The minimum value for all colors

public int[] getDisplayGammaCalibration (int idx)

Added in API level 2

Parameters
idx the control to query
Returns
  • the current RGB gamma calibration for the given control

public int getDisplayGammaCalibrationMax ()

Added in API level 2

Returns
  • the maximum value for all colors

public int getDisplayGammaCalibrationMin ()

Added in API level 2

Returns
  • the minimum value for all colors

public DisplayMode[] getDisplayModes ()

Added in API level 2

Returns
  • a list of available display modes on the devices

public static CMHardwareManager getInstance (Context context)

Added in API level 2

Get or create an instance of the CMHardwareManager

public String getLtoDestination ()

Added in API level 2

Returns
  • the destination location of LTO data, or null on failure

public long getLtoDownloadInterval ()

Added in API level 2

Returns
  • the interval, in milliseconds, to trigger LTO data download

public String getLtoSource ()

Added in API level 2

Returns
  • the source location of LTO data, or null on failure

public int getNumGammaControls ()

Added in API level 2

Returns
  • the number of RGB controls the device supports

public HSIC getPictureAdjustment ()

Added in API level 6

Gets the current picture adjustment values

Returns
  • HSIC object with current settings

public List<Range<Float>> getPictureAdjustmentRanges ()

Added in API level 6

Get a list of ranges valid for picture adjustment.

Returns
  • range list

public String getSerialNumber ()

Added in API level 2

Returns
  • the serial number to display instead of ro.serialno, or null on failure

public int getSupportedFeatures ()

Added in API level 2

Returns
  • the supported features bitmask

public int getThermalState ()

Added in API level 2

Returns

public String getUniqueDeviceId ()

Added in API level 5

Returns
  • an id that's both unique and deterministic for the device

public int getVibratorDefaultIntensity ()

Added in API level 2

Returns
  • The default vibrator intensity.

public int getVibratorIntensity ()

Added in API level 2

Returns
  • The current vibrator intensity.

public int getVibratorMaxIntensity ()

Added in API level 2

Returns
  • The maximum vibrator intensity.

public int getVibratorMinIntensity ()

Added in API level 2

Returns
  • The minimum vibrator intensity.

public int getVibratorWarningIntensity ()

Added in API level 2

Returns
  • The warning threshold vibrator intensity.

public boolean isSunlightEnhancementSelfManaged ()

Added in API level 4

Returns
  • true if this implementation does it's own lux metering

public boolean isSupported (int feature)

Added in API level 2

Determine if a CM Hardware feature is supported on this device

Parameters
feature The CM Hardware feature to query
Returns
  • true if the feature is supported, false otherwise.

public byte[] readPersistentBytes (String key)

Added in API level 2

Read a byte array from persistent storage

Parameters
key String identifier for this item. Must not exceed 64 characters.
Returns
  • the stored byte array, null if not found

public int readPersistentInt (String key)

Added in API level 2

Read an integer from persistent storage

Parameters
key String identifier for this item. Must not exceed 64 characters.
Returns
  • the stored integer, zero if not found

public String readPersistentString (String key)

Added in API level 2

Read a string from persistent storage

Parameters
key String identifier for this item. Must not exceed 64 characters.
Returns
  • the stored UTF-8 encoded string, null if not found

public boolean registerThermalListener (ThermalListenerCallback thermalCallback)

Added in API level 2

Register a callback to be notified of thermal state changes

Returns
  • boolean indicating whether register succeeded or failed

public boolean requireAdaptiveBacklightForSunlightEnhancement ()

Added in API level 2

Returns
  • true if adaptive backlight should be enabled when sunlight enhancement is enabled.

public boolean set (int feature, boolean enable)

Added in API level 2

Enable or disable the given feature Only used for features which have simple enable/disable controls.

Parameters
feature the CM Hardware feature to set
enable true to enable, false to disale
Returns
  • true if the feature is enabled, false otherwise.

public boolean setColorBalance (int value)

Added in API level 6

Sets the desired color balance. Must fall within the range obtained from getColorBalanceRange()

Returns
  • true if success

public boolean setDisplayColorCalibration (int[] rgb)

Added in API level 2

Set the display color calibration to the given rgb triplet

Parameters
rgb RGB color calibration. Each value must be between getDisplayColorCalibrationMin() and getDisplayColorCalibrationMax(), inclusive.
Returns
  • true on success, false otherwise.

public boolean setDisplayGammaCalibration (int idx, int[] rgb)

Added in API level 2

Set the display gamma calibration for a specific control

Parameters
idx the control to set
rgb RGB color calibration. Each value must be between getDisplayGammaCalibrationMin() and getDisplayGammaCalibrationMax(), inclusive.
Returns
  • true on success, false otherwise.

public boolean setDisplayMode (DisplayMode mode, boolean makeDefault)

Added in API level 2

Returns
  • true if setting the mode was successful

public boolean setPictureAdjustment (HSIC hsic)

Added in API level 6

Sets the desired hue/saturation/intensity/contrast

Returns
  • true if success

public boolean setVibratorIntensity (int intensity)

Added in API level 2

Set the current vibrator intensity

Parameters
intensity the intensity to set, between getVibratorMinIntensity() and getVibratorMaxIntensity() inclusive.
Returns
  • true on success, false otherwise.

public boolean unRegisterThermalListener (ThermalListenerCallback thermalCallback)

Added in API level 2

Unregister a callback previously registered to be notified of thermal state changes

Returns
  • boolean indicating whether un-registering succeeded or failed

public boolean writePersistentBytes (String key, byte[] value)

Added in API level 2

Write a byte array to persistent storage, which persists thru factory reset

Parameters
key String identifier for this item. Must not exceed 64 characters.
value The byte array to store, must be 1-4096 bytes. null deletes the key/value pair.
Returns
  • true on success

public boolean writePersistentInt (String key, int value)

Added in API level 2

Write an integer to persistent storage, which persists thru factory reset

Parameters
key String identifier for this item. Must not exceed 64 characters.
value The integer to store
Returns
  • true on success

public boolean writePersistentString (String key, String value)

Added in API level 2

Write a string to persistent storage, which persists thru factory reset

Parameters
key String identifier for this item. Must not exceed 64 characters.
value The UTF-8 encoded string to store of at least 1 character. null deletes the key/value pair.
Returns
  • true on success