DO NOT MERGE Turn off LAYER_TYPE_SOFTWARE on BatteryMeterView

We still need to save a layer for the BlendMode.CLEAR paint to do the
right thing. But with this we can save just the layer needed to draw the
battery instead of the whole battery meter view.

Test: visual
Bug: 130536257
Change-Id: I9d5844440250ccd9174e6c001e051c9adf62a2d0
(cherry picked from commit b4c703b8e3)
This commit is contained in:
Evan Laird
2019-04-02 12:56:00 -04:00
parent bac0795aff
commit 3a0c58ae57
2 changed files with 2 additions and 4 deletions

View File

@@ -173,6 +173,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
}
override fun draw(c: Canvas) {
c.saveLayer(null, null)
unifiedPath.reset()
levelPath.reset()
levelRect.set(fillRect)
@@ -243,6 +244,7 @@ open class ThemedBatteryDrawable(private val context: Context, frameColor: Int)
// And draw the plus sign on top of the fill
c.drawPath(scaledPlus, errorPaint)
}
c.restore()
}
private fun batteryColorForLevel(level: Int): Int {

View File

@@ -180,10 +180,6 @@ public class BatteryMeterView extends LinearLayout implements
setClipChildren(false);
setClipToPadding(false);
Dependency.get(ConfigurationController.class).observe(viewAttachLifecycle(this), this);
// Needed for PorderDuff.Mode.CLEAR operations to work properly, but redraws don't happen
// enough to justify a hardware layer.
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
private void setupLayoutTransition() {