Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e3cdf85 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 23619 into eclair

* changes:
  Add automatic lighting control framework
parents 244f8c26 951764b9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ interface IHardwareService
    // sets the brightness of the backlights (screen, keyboard, button) 0-255
    void setBacklights(int brightness);

    // enables or disables automatic brightness mode
    void setAutoBrightness(boolean on);

    // for the phone
    void setAttentionLight(boolean on);
}
+6 −0
Original line number Diff line number Diff line
@@ -1060,6 +1060,12 @@ public final class Settings {
         */
        public static final String SCREEN_BRIGHTNESS = "screen_brightness";

        /**
         * Control whether to enable automatic brightness mode.
         * @hide
         */
        public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";

        /**
         * Control whether the process CPU usage meter should be shown.
         */
+2 −0
Original line number Diff line number Diff line
@@ -81,4 +81,6 @@
        <item>30</item>
    </integer-array>
    
    <!-- Flag indicating whether the device supports automatic brightness mode. -->
    <bool name="config_automatic_brightness_available">false</bool>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
    <bool name="def_accelerometer_rotation">true</bool>
    <!-- Default screen brightness, from 0 to 255.  102 is 40%. -->
    <integer name="def_screen_brightness">102</integer>
    <bool name="def_screen_brightness_automatic_mode">false</bool>
    <fraction name="def_window_animation_scale">100%</fraction>
    <fraction name="def_window_transition_scale">0%</fraction>
    
+20 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
    // database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
    // is properly propagated through your change.  Not doing so will result in a loss of user
    // settings.
    private static final int DATABASE_VERSION = 39;
    private static final int DATABASE_VERSION = 40;

    private Context mContext;

@@ -465,6 +465,22 @@ public class DatabaseHelper extends SQLiteOpenHelper {
            upgradeVersion = 39;
        }

        if (upgradeVersion == 39) {
            db.beginTransaction();
            try {
                String value =
                        mContext.getResources().getBoolean(
                        R.bool.def_screen_brightness_automatic_mode) ? "1" : "0";
                db.execSQL("INSERT OR IGNORE INTO system(name,value) values('" +
                        Settings.System.SCREEN_BRIGHTNESS_MODE + "','" + value + "');");
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }

            upgradeVersion = 40;
        }

        if (upgradeVersion != currentVersion) {
            Log.w(TAG, "Got stuck trying to upgrade from version " + upgradeVersion
                    + ", must wipe the settings provider");
@@ -701,6 +717,9 @@ public class DatabaseHelper extends SQLiteOpenHelper {
        loadIntegerSetting(stmt, Settings.System.SCREEN_BRIGHTNESS,
                R.integer.def_screen_brightness);

        loadBooleanSetting(stmt, Settings.System.SCREEN_BRIGHTNESS_MODE,
                R.bool.def_screen_brightness_automatic_mode);

        loadDefaultAnimationSettings(stmt);

        loadBooleanSetting(stmt, Settings.System.ACCELEROMETER_ROTATION,
Loading