summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheScarastic <warabhishek@gmail.com>2021-10-06 06:44:17 +0000
committeralk3pInjection <webmaster@raspii.tech>2022-05-02 09:56:20 +0800
commit2be1940b57a65c373d9b326a730032804c69dac9 (patch)
treea1a0eb1d12b4c20e35f63a0d14e6289e18984f6b
parentd74e3c55576674522a098e774e1a8ebecfdc0dad (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: I2460f6196d32fe46eb97f9a5c767bde5c9976681
-rw-r--r--packages/SystemUI/res/drawable-nodpi/udfps_icon_pressed.pngbin0 -> 108 bytes
-rw-r--r--packages/SystemUI/res/values/ice_config.xml19
-rw-r--r--packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java16
3 files changed, 34 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
new file mode 100644
index 000000000000..46a3978f903e
--- /dev/null
+++ b/packages/SystemUI/res/values/ice_config.xml
@@ -0,0 +1,19 @@
+<!--
+ Copyright (C) 2022 Project ICE
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Color of the UDFPS pressed view -->
+ <color name="config_udfpsColor">#ffffffff</color>
+</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsSurfaceView.java
index 77fad35d32d4..71e33a699934 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.