Skip to content

Commit

Permalink
Backlight settings, preliminary, but works
Browse files Browse the repository at this point in the history
based on CM9 code

Change-Id: Iddcbee98f6588bba428c4059e786d946d7ce2298
  • Loading branch information
tpruvot authored and Whitehawkx committed Aug 31, 2012
1 parent d40edab commit a790e78
Show file tree
Hide file tree
Showing 4 changed files with 618 additions and 28 deletions.
7 changes: 7 additions & 0 deletions core/java/android/os/IPowerManager.aidl
Expand Up @@ -46,4 +46,11 @@ interface IPowerManager
void setBacklightBrightness(int brightness); void setBacklightBrightness(int brightness);
void setAttentionLight(boolean on, int color); void setAttentionLight(boolean on, int color);
void setAutoBrightnessAdjustment(float adj); void setAutoBrightnessAdjustment(float adj);

// custom backlight things
int getLightSensorValue();
int getRawLightSensorValue();
int getLightSensorScreenBrightness();
int getLightSensorButtonBrightness();
int getLightSensorKeyboardBrightness();
} }
130 changes: 130 additions & 0 deletions core/java/android/provider/Settings.java
Expand Up @@ -1468,6 +1468,136 @@ public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
*/ */
public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;


/**
* Indicates that custom light sensor settings has changed. The value is
* random and changes reloads light settings.
*
* @hide
*/
public static final String LIGHTS_CHANGED = "lights_changed";

/**
* Whether custom light sensor levels & values are enabled. The value is
* boolean (1 or 0).
*
* @hide
*/
public static final String LIGHT_SENSOR_CUSTOM = "light_sensor_custom";

/**
* Screen dim value to use if LIGHT_SENSOR_CUSTOM is set. The value is int.
* Default is android.os.BRIGHTNESS_DIM.
*
* @hide
*/
public static final String LIGHT_SCREEN_DIM = "light_screen_dim";

/**
* Custom light sensor levels. The value is a comma separated int array
* with length N.
* Example: "100,300,3000".
*
* @hide
*/
public static final String LIGHT_SENSOR_LEVELS = "light_sensor_levels";

/**
* Custom light sensor lcd values. The value is a comma separated int array
* with length N+1.
* Example: "10,50,100,255".
*
* @hide
*/
public static final String LIGHT_SENSOR_LCD_VALUES = "light_sensor_lcd_values";

/**
* Custom light sensor lcd values. The value is a comma separated int array
* with length N+1.
* Example: "10,50,100,255".
*
* @hide
*/
public static final String LIGHT_SENSOR_BUTTON_VALUES = "light_sensor_button_values";

/**
* Custom light sensor lcd values. The value is a comma separated int array
* with length N+1.
* Example: "10,50,100,255".
*
* @hide
*/
public static final String LIGHT_SENSOR_KEYBOARD_VALUES = "light_sensor_keyboard_values";

/**
* Whether light sensor is allowed to decrease when calculating automatic
* backlight. The value is boolean (1 or 0).
*
* @hide
*/
public static final String LIGHT_DECREASE = "light_decrease";

/**
* Light sensor hysteresis for decreasing backlight. The value is
* int (0-99) representing % (0-0.99 as float). Example:
*
* Levels Output
* 0 - 100 50
* 100 - 200 100
* 200 - Inf 255
*
* Current sensor value is 150 which gives light value 100. Hysteresis is 50.
* Current level lower bound is 100 and previous lower bound is 0.
* Sensor value must drop below 100-(100-0)*(50/100)=50 for output to become 50
* (corresponding to the 0 - 100 level).
* @hide
*/
public static final String LIGHT_HYSTERESIS = "light_hysteresis";

/**
* Whether light sensor used when calculating automatic backlight should
* be filtered through an moving average filter.
* The value is boolean (1 or 0).
*
* @hide
*/
public static final String LIGHT_FILTER = "light_filter";

/**
* Window length of filter used when calculating automatic backlight.
* One minute means that the average sensor value last minute is used.
* The value is integer (milliseconds)
*
* @hide
*/
public static final String LIGHT_FILTER_WINDOW = "light_filter_window";

/**
* Reset threshold of filter used when calculating automatic backlight.
* Sudden large jumps in sensor value resets the filter. This is used
* to make the filter respond quickly to large enough changes in input
* while still filtering small changes. Example:
*
* Current filter value (average) is 100 and sensor value is changing to
* 10, 150, 100, 30, 50. The filter is continously taking the average of
* the samples. Now the user goes outside and the value jumps over 1000.
* The difference between current average and new sample is larger than
* the reset threshold and filter is reset. It begins calculating a new
* average on samples around 1000 (say, 800, 1200, 1000, 1100 etc.)
*
* The value is integer (lux)
*
* @hide
*/
public static final String LIGHT_FILTER_RESET = "light_filter_reset";

/**
* Sample interval of filter used when calculating automatic backlight.
* The value is integer (milliseconds)
*
* @hide
*/
public static final String LIGHT_FILTER_INTERVAL = "light_filter_interval";

/** /**
* Control whether the process CPU usage meter should be shown. * Control whether the process CPU usage meter should be shown.
*/ */
Expand Down

0 comments on commit a790e78

Please sign in to comment.