Skip to content

Commit

Permalink
SystemUI: Add background protection to UdfpsFpmOtherView
Browse files Browse the repository at this point in the history
This is used in fingerprint settings for trial authentication
(ArrowOS/android_packages_apps_Settings@4a1115c).

Change-Id: I9a9ee2e7946d78d9cb9562dbda6f943341064abe
  • Loading branch information
ghostrider-reborn authored and basamaryan committed Jul 18, 2023
1 parent 2b0c477 commit b0b8c2e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/SystemUI/res/layout/udfps_fpm_other_view.xml
Expand Up @@ -20,9 +20,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Background protection -->
<ImageView
android:id="@+id/udfps_keyguard_fp_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/fingerprint_bg"/>

<!-- Fingerprint -->
<ImageView
android:id="@+id/udfps_fpm_other_fp_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:tint="?android:attr/textColorPrimary"/>
</com.android.systemui.biometrics.UdfpsFpmOtherView>
Expand Up @@ -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.
Expand All @@ -28,4 +29,8 @@ class UdfpsFpDrawable(context: Context) : UdfpsDrawable(context) {
}
fingerprintDrawable.draw(canvas)
}

override fun setColorFilter(colorFilter: ColorFilter?) {
fingerprintDrawable.colorFilter = colorFilter
}
}
Expand Up @@ -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

/**
Expand All @@ -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
Expand Down

0 comments on commit b0b8c2e

Please sign in to comment.