diff --git a/packages/SettingsLib/res/values/arrays.xml b/packages/SettingsLib/res/values/arrays.xml
index 59e5cfb204401..c926e1ff48a71 100644
--- a/packages/SettingsLib/res/values/arrays.xml
+++ b/packages/SettingsLib/res/values/arrays.xml
@@ -563,18 +563,18 @@
- 0
- 334
+ - 3
- 0
- 5
- 0
- - 11
- 0
- - 11
- 5
- - 16
- 5
- - 16
- 11
- - 11
- 11
- - 11
- 16
- - 5
- 16
- - 5
- 11
- - 0
- 11
- - 0
- 5
+ - 5
- 3
+ - 8
- 3
+ - 8
- 5
- 5
- 5
+ - 5
- 8
+ - 3
- 8
+ - 3
- 5
+ - 0
- 5
+ - 0
- 3
+ - 3
- 3
diff --git a/packages/SettingsLib/res/values/dimens.xml b/packages/SettingsLib/res/values/dimens.xml
index cf4261c6bc914..aeb0a21b7d41a 100644
--- a/packages/SettingsLib/res/values/dimens.xml
+++ b/packages/SettingsLib/res/values/dimens.xml
@@ -57,6 +57,7 @@
14.5dp
9.5dp
+ 1dp
2dp
diff --git a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
index 696fe5b1e5471..13f00a1bac97f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
+++ b/packages/SettingsLib/src/com/android/settingslib/graph/BatteryMeterDrawableBase.java
@@ -24,9 +24,11 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
+import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Path.FillType;
+import android.graphics.Path.Op;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
@@ -49,6 +51,7 @@ public class BatteryMeterDrawableBase extends Drawable {
protected final Paint mTextPaint;
protected final Paint mBoltPaint;
protected final Paint mPlusPaint;
+ protected final Paint mPowersavePaint;
protected float mButtonHeightFraction;
private int mLevel = -1;
@@ -90,6 +93,7 @@ public class BatteryMeterDrawableBase extends Drawable {
private final RectF mPlusFrame = new RectF();
private final Path mShapePath = new Path();
+ private final Path mOutlinePath = new Path();
private final Path mTextPath = new Path();
public BatteryMeterDrawableBase(Context context, int frameColor) {
@@ -158,6 +162,12 @@ public class BatteryMeterDrawableBase extends Drawable {
R.color.batterymeter_plus_color));
mPlusPoints = loadPoints(res, R.array.batterymeter_plus_points);
+ mPowersavePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPowersavePaint.setColor(mPlusPaint.getColor());
+ mPowersavePaint.setStyle(Style.STROKE);
+ mPowersavePaint.setStrokeWidth(context.getResources()
+ .getDimensionPixelSize(R.dimen.battery_powersave_outline_thickness));
+
mIntrinsicWidth = context.getResources().getDimensionPixelSize(R.dimen.battery_width);
mIntrinsicHeight = context.getResources().getDimensionPixelSize(R.dimen.battery_height);
}
@@ -289,7 +299,9 @@ public class BatteryMeterDrawableBase extends Drawable {
}
protected int batteryColorForLevel(int level) {
- return mCharging ? mChargeColor : getColorForLevel(level);
+ return (mCharging || (mPowerSaveEnabled && mPowerSaveAsColorError))
+ ? mChargeColor
+ : getColorForLevel(level);
}
@Override
@@ -334,10 +346,15 @@ public class BatteryMeterDrawableBase extends Drawable {
// define the battery shape
mShapePath.reset();
+ mOutlinePath.reset();
final float radius = getRadiusRatio() * (mFrame.height() + buttonHeight);
mShapePath.setFillType(FillType.WINDING);
mShapePath.addRoundRect(mFrame, radius, radius, Direction.CW);
mShapePath.addRect(mButtonFrame, Direction.CW);
+ mOutlinePath.addRoundRect(mFrame, radius, radius, Direction.CW);
+ Path p = new Path();
+ p.addRect(mButtonFrame, Direction.CW);
+ mOutlinePath.op(p, Op.XOR);
if (mCharging) {
// define the bolt shape
@@ -446,6 +463,11 @@ public class BatteryMeterDrawableBase extends Drawable {
c.drawText(pctText, pctX, pctY, mTextPaint);
}
}
+
+ // Draw the powersave outline last
+ if (!mCharging && mPowerSaveEnabled && mPowerSaveAsColorError) {
+ c.drawPath(mOutlinePath, mPowersavePaint);
+ }
}
// Some stuff required by Drawable.
diff --git a/packages/SystemUI/res/layout/system_icons.xml b/packages/SystemUI/res/layout/system_icons.xml
index 258b82aacb2e3..9237477f17e88 100644
--- a/packages/SystemUI/res/layout/system_icons.xml
+++ b/packages/SystemUI/res/layout/system_icons.xml
@@ -31,5 +31,6 @@
+ android:clipToPadding="false"
+ android:clipChildren="false" />
\ No newline at end of file