summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheScarastic <warabhishek@gmail.com>2021-10-06 06:44:17 +0000
committeralk3pInjection <webmaster@raspii.tech>2023-04-20 00:08:54 +0800
commit3de93040a9a86fb43744b5c413e2d5cafa25b81e (patch)
tree2eefb807d0e0b9759c50e643defe0d4f37b019ca
parent8424f4a5235b417daa977241cdd9384b5e7639b9 (diff)
udfps: Make pressed udfp 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
-rw-r--r--packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.pngbin0 -> 108 bytes
-rw-r--r--packages/SystemUI/res/values/ice_config.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java16
3 files changed, 18 insertions, 1 deletions
diff --git a/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
new file mode 100644
index 000000000000..4102e28c1300
--- /dev/null
+++ b/packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.png
Binary files differ
diff --git a/packages/SystemUI/res/values/ice_config.xml b/packages/SystemUI/res/values/ice_config.xml
index c13dda7076a9..563d63f7ac2a 100644
--- a/packages/SystemUI/res/values/ice_config.xml
+++ b/packages/SystemUI/res/values/ice_config.xml
@@ -14,6 +14,9 @@
limitations under the License.
-->
<resources>
+ <!-- Color of the UDFPS pressed view -->
+ <color name="config_udfpsColor">#ffffffff</color>
+
<!-- Allow devices override audio panel location to the left side -->
<bool name="config_audioPanelOnLeftSide">false</bool>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
index f5ada948dab7..2488132b508b 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
@@ -19,6 +19,7 @@ package com.android.systemui.biometrics;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+import android.graphics.drawable.Drawable;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PixelFormat;
@@ -29,6 +30,8 @@ import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
+import com.android.systemui.R;
+
/**
* Surface View for providing the Global High-Brightness Mode (GHBM) illumination for UDFPS.
*/
@@ -54,6 +57,8 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb
boolean mAwaitingSurfaceToStartIllumination;
boolean mHasValidSurface;
+ private Drawable mUdfpsIconPressed;
+
public UdfpsSurfaceView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -69,8 +74,10 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb
mSensorPaint = new Paint(0 /* flags */);
mSensorPaint.setAntiAlias(true);
- mSensorPaint.setARGB(255, 255, 255, 255);
+ mSensorPaint.setColor(context.getColor(R.color.config_udfpsColor));
mSensorPaint.setStyle(Paint.Style.FILL);
+
+ mUdfpsIconPressed = context.getDrawable(R.drawable.udfps_icon_pressed);
}
@Override public void surfaceCreated(SurfaceHolder holder) {
@@ -134,6 +141,13 @@ public class UdfpsSurfaceView extends SurfaceView implements SurfaceHolder.Callb
Canvas canvas = null;
try {
canvas = mHolder.lockCanvas();
+ mUdfpsIconPressed.setBounds(
+ Math.round(sensorRect.left),
+ Math.round(sensorRect.top),
+ Math.round(sensorRect.right),
+ Math.round(sensorRect.bottom)
+ );
+ mUdfpsIconPressed.draw(canvas);
canvas.drawOval(sensorRect, mSensorPaint);
} finally {
// Make sure the surface is never left in a bad state.