Skip to content

Commit 34d533e

Browse files
TheScarasticralph950412
authored andcommitted
udfps: Make pressed udfps view configurable
* set a solid color by configuring config_udfpsColor * set a custom image by setting udfps_icon_pressed and making config_udfpsColor #00ffffff (transparent) Change-Id: I028e0ba6ee012dc84cd365078ef4cbfbaad5cedc
1 parent 205fe6d commit 34d533e

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

108 Bytes
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<!-- Color of the UDFPS pressed view -->
3+
<color name="config_udfpsColor">#ffffffff</color>
4+
</resources>

packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import android.annotation.NonNull;
2020
import android.annotation.Nullable;
2121
import android.content.Context;
22+
import android.graphics.drawable.Drawable;
2223
import android.graphics.Canvas;
2324
import android.graphics.Paint;
2425
import android.graphics.PixelFormat;
@@ -29,6 +30,8 @@
2930
import android.view.SurfaceHolder;
3031
import android.view.SurfaceView;
3132

33+
import com.android.systemui.res.R;
34+
3235
/**
3336
* Surface View for providing the Global High-Brightness Mode (GHBM) illumination for UDFPS.
3437
*/
@@ -54,6 +57,8 @@ interface GhbmIlluminationListener {
5457
boolean mAwaitingSurfaceToStartIllumination;
5558
boolean mHasValidSurface;
5659

60+
private Drawable mUdfpsIconPressed;
61+
5762
public UdfpsSurfaceView(Context context, AttributeSet attrs) {
5863
super(context, attrs);
5964

@@ -69,8 +74,10 @@ public UdfpsSurfaceView(Context context, AttributeSet attrs) {
6974

7075
mSensorPaint = new Paint(0 /* flags */);
7176
mSensorPaint.setAntiAlias(true);
72-
mSensorPaint.setARGB(255, 255, 255, 255);
77+
mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor));
7378
mSensorPaint.setStyle(Paint.Style.FILL);
79+
80+
mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed);
7481
}
7582

7683
@Override public void surfaceCreated(SurfaceHolder holder) {
@@ -134,6 +141,13 @@ public void drawIlluminationDot(@NonNull RectF sensorRect) {
134141
Canvas canvas = null;
135142
try {
136143
canvas = mHolder.lockCanvas();
144+
mUdfpsIconPressed.setBounds(
145+
Math.round(sensorRect.left),
146+
Math.round(sensorRect.top),
147+
Math.round(sensorRect.right),
148+
Math.round(sensorRect.bottom)
149+
);
150+
mUdfpsIconPressed.draw(canvas);
137151
canvas.drawOval(sensorRect, mSensorPaint);
138152
} finally {
139153
// Make sure the surface is never left in a bad state.

0 commit comments

Comments
 (0)