From b0b8c2e9a10699b140dd03840045f19cecca38d0 Mon Sep 17 00:00:00 2001 From: Adithya R Date: Tue, 25 Apr 2023 16:47:10 +0530 Subject: [PATCH] SystemUI: Add background protection to UdfpsFpmOtherView This is used in fingerprint settings for trial authentication (https://github.com/ArrowOS/android_packages_apps_Settings/commit/4a1115c07f4e285af808c93b08a83d4889c9e9b9). Change-Id: I9a9ee2e7946d78d9cb9562dbda6f943341064abe --- packages/SystemUI/res/layout/udfps_fpm_other_view.xml | 10 +++++++++- .../com/android/systemui/biometrics/UdfpsFpDrawable.kt | 5 +++++ .../android/systemui/biometrics/UdfpsFpmOtherView.kt | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/res/layout/udfps_fpm_other_view.xml b/packages/SystemUI/res/layout/udfps_fpm_other_view.xml index 6ecbb473d720..06d3090ab4d7 100644 --- a/packages/SystemUI/res/layout/udfps_fpm_other_view.xml +++ b/packages/SystemUI/res/layout/udfps_fpm_other_view.xml @@ -20,9 +20,17 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + android:layout_height="match_parent" + android:tint="?android:attr/textColorPrimary"/> diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpDrawable.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpDrawable.kt index 9f6b6d7472f9..7450430c18e2 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpDrawable.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpDrawable.kt @@ -17,6 +17,7 @@ package com.android.systemui.biometrics import android.content.Context import android.graphics.Canvas +import android.graphics.ColorFilter /** * Draws udfps fingerprint if sensor isn't illuminating. @@ -28,4 +29,8 @@ class UdfpsFpDrawable(context: Context) : UdfpsDrawable(context) { } fingerprintDrawable.draw(canvas) } + + override fun setColorFilter(colorFilter: ColorFilter?) { + fingerprintDrawable.colorFilter = colorFilter + } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt index 4d6da8f4b3eb..72229d1ee0d1 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsFpmOtherView.kt @@ -16,8 +16,12 @@ package com.android.systemui.biometrics import android.content.Context +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; import android.util.AttributeSet import android.widget.ImageView + +import com.android.settingslib.Utils; import com.android.systemui.R /** @@ -34,6 +38,8 @@ class UdfpsFpmOtherView( override fun onFinishInflate() { fingerprintView = findViewById(R.id.udfps_fpm_other_fp_view)!! fingerprintView.setImageDrawable(fingerprintDrawable) + fingerprintView.setColorFilter(PorterDuffColorFilter(Utils.getColorAttrDefaultColor( + mContext, android.R.attr.textColorPrimary), PorterDuff.Mode.SRC_ATOP)) } override fun getDrawable(): UdfpsDrawable = fingerprintDrawable