Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87fbc21f authored by Hao Dong's avatar Hao Dong Committed by Android (Google) Code Review
Browse files

Merge "Flag showing logo on bp" into main

parents 143b9054 a35c0abd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.graphics.Rect
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import android.hardware.biometrics.BiometricPrompt
import android.hardware.biometrics.Flags.customBiometricPrompt
import android.hardware.biometrics.PromptContentView
import android.util.Log
import android.view.HapticFeedbackConstants
@@ -240,7 +241,7 @@ constructor(
        promptSelectorInteractor.prompt
            .map {
                when {
                    it == null -> null
                    !customBiometricPrompt() || it == null -> null
                    it.logoRes != -1 -> context.resources.getDrawable(it.logoRes, context.theme)
                    it.logoBitmap != null -> BitmapDrawable(context.resources, it.logoBitmap)
                    else -> context.packageManager.getApplicationIcon(it.opPackageName)
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.Point
import android.graphics.drawable.BitmapDrawable
import android.hardware.biometrics.Flags.FLAG_CUSTOM_BIOMETRIC_PROMPT
import android.hardware.biometrics.PromptContentItemBulletedText
import android.hardware.biometrics.PromptContentView
import android.hardware.biometrics.PromptInfo
@@ -1244,6 +1245,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa

    @Test
    fun defaultLogoIfNoLogoSet() = runGenericTest {
        mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
        val logo by collectLastValue(viewModel.logo)
        assertThat(logo).isEqualTo(defaultLogoIcon)
    }
@@ -1251,6 +1253,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
    @Test
    fun logoResSetByApp() =
        runGenericTest(logoRes = logoResFromApp) {
            mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
            val logo by collectLastValue(viewModel.logo)
            assertThat(logo).isEqualTo(logoFromApp)
        }
@@ -1258,6 +1261,7 @@ internal class PromptViewModelTest(private val testCase: TestCase) : SysuiTestCa
    @Test
    fun logoBitmapSetByApp() =
        runGenericTest(logoBitmap = logoBitmapFromApp) {
            mSetFlagsRule.enableFlags(FLAG_CUSTOM_BIOMETRIC_PROMPT)
            val logo by collectLastValue(viewModel.logo)
            assertThat((logo as BitmapDrawable).bitmap).isEqualTo(logoBitmapFromApp)
        }