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

Commit a35c0abd authored by Hao Dong's avatar Hao Dong
Browse files

Flag showing logo on bp

Test: Manually test on test app
Test: atest PromptViewModelTest
Flag: ACONFIG android.hardware.biometrics.custom_biometric_prompt DEVELOPMENT
Bug: 321852561
Change-Id: Id64b5b8af6411a22c7ebf460a3c426923bca133f
parent d1693d79
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)
        }