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

Commit 7c47adef authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 26527 into eclair

* changes:
  Dock screen on config can now select AC or USB.
parents 520ca7e5 99f7eb45
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -79,12 +79,16 @@
    <integer name="config_carDockRotation">-1</integer>

    <!-- Control whether being in the desk dock (and powered) always
         keeps the screen on.  By default it doesn't.  Set to true to make it. -->
    <bool name="config_deskDockKeepsScreenOn">false</bool>
         keeps the screen on.  By default it stays on when plugged in to
         AC.  0 will not keep it on; or together 1 to stay on when plugged
         in to AC and 2 to stay on when plugged in to USB.  (So 3 for both.) -->
    <integer name="config_deskDockKeepsScreenOn">1</integer>

    <!-- Control whether being in the car dock (and powered) always
         keeps the screen on.  By default it does.  Set to false to not keep on. -->
    <bool name="config_carDockKeepsScreenOn">true</bool>
         keeps the screen on.  By default it stays on when plugged in to
         AC.  0 will not keep it on; or together 1 to stay on when plugged
         in to AC and 2 to stay on when plugged in to USB.  (So 3 for both.) -->
    <integer name="config_carDockKeepsScreenOn">1</integer>

    <!-- Control whether being in the desk dock should enable accelerometer based screen orientation -->
    <bool name="config_deskDockEnablesAccelerometer">false</bool>
+23 −22
Original line number Diff line number Diff line
@@ -267,6 +267,20 @@ class BatteryService extends Binder {
                logOutlier = true;
            }
            
            final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE;
            final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE;

            /* The ACTION_BATTERY_LOW broadcast is sent in these situations:
             * - is just un-plugged (previously was plugged) and battery level is under WARNING, or
             * - is not plugged and battery level crosses the WARNING boundary (becomes < 15).
             */
            final boolean sendBatteryLow = !plugged
                && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
                && mBatteryLevel < BATTERY_LEVEL_WARNING
                && (oldPlugged || mLastBatteryLevel >= BATTERY_LEVEL_WARNING);
            
            sendIntent();
            
            // Separate broadcast is sent for power connected / not connected
            // since the standard intent will not wake any applications and some
            // applications may want to have smart behavior based on this.
@@ -281,28 +295,6 @@ class BatteryService extends Binder {
                mContext.sendBroadcast(statusIntent);
            }

            final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE;
            final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE;

            /* The ACTION_BATTERY_LOW broadcast is sent in these situations:
             * - is just un-plugged (previously was plugged) and battery level is under WARNING, or
             * - is not plugged and battery level crosses the WARNING boundary (becomes < 15).
             */
            final boolean sendBatteryLow = !plugged
                && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
                && mBatteryLevel < BATTERY_LEVEL_WARNING
                && (oldPlugged || mLastBatteryLevel >= BATTERY_LEVEL_WARNING);
            
            mLastBatteryStatus = mBatteryStatus;
            mLastBatteryHealth = mBatteryHealth;
            mLastBatteryPresent = mBatteryPresent;
            mLastBatteryLevel = mBatteryLevel;
            mLastPlugType = mPlugType;
            mLastBatteryVoltage = mBatteryVoltage;
            mLastBatteryTemperature = mBatteryTemperature;
            mLastBatteryLevelCritical = mBatteryLevelCritical;

            sendIntent();
            if (sendBatteryLow) {
                mSentLowBatteryBroadcast = true;
                statusIntent.setAction(Intent.ACTION_BATTERY_LOW);
@@ -317,6 +309,15 @@ class BatteryService extends Binder {
            if (logOutlier && dischargeDuration != 0) {
                logOutlier(dischargeDuration);
            }
            
            mLastBatteryStatus = mBatteryStatus;
            mLastBatteryHealth = mBatteryHealth;
            mLastBatteryPresent = mBatteryPresent;
            mLastBatteryLevel = mBatteryLevel;
            mLastPlugType = mPlugType;
            mLastBatteryVoltage = mBatteryVoltage;
            mLastBatteryTemperature = mBatteryTemperature;
            mLastBatteryLevelCritical = mBatteryLevelCritical;
        }
    }