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

Commit cc30a3f5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add null checker for parent profile" into main

parents eaaafca2 1494dac0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ constructor(
        userManager.getCredentialOwnerProfile(userId)

    override fun getParentProfileIdOrSelfId(userId: Int): Int =
        userManager.getProfileParent(userId).id
        userManager.getProfileParent(userId)?.id ?: userManager.getCredentialOwnerProfile(userId)

    override fun verifyCredential(
        request: BiometricPromptRequest.Credential,
+10 −0
Original line number Diff line number Diff line
@@ -99,6 +99,16 @@ class CredentialInteractorImplTest : SysuiTestCase() {
        }
    }

    @Test
    fun useCredentialOwnerWhenParentProfileIsNull() {
        val value = 1

        whenever(userManager.getProfileParent(eq(USER_ID))).thenReturn(null)
        whenever(userManager.getCredentialOwnerProfile(eq(USER_ID))).thenReturn(value)

        assertThat(interactor.getParentProfileIdOrSelfId(USER_ID)).isEqualTo(value)
    }

    @Test fun pinCredentialWhenGood() = pinCredential(goodCredential())

    @Test fun pinCredentialWhenBad() = pinCredential(badCredential())