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

Commit 06b2e8c5 authored by Grace Cheng's avatar Grace Cheng Committed by Automerger Merge Worker
Browse files

Merge "Updates AuthBiometricFingerprintIconController for reverse default...

Merge "Updates AuthBiometricFingerprintIconController for reverse default orientation devices" into tm-qpr-dev am: da2c8df7 am: 7053ca07

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21166605



Change-Id: I04b869daf008ac17e35411b818614e84d37d4048
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ee68eee9 7053ca07
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -46,6 +46,8 @@ open class AuthBiometricFingerprintIconController(


    private var isDeviceFolded: Boolean = false
    private var isDeviceFolded: Boolean = false
    private val isSideFps: Boolean
    private val isSideFps: Boolean
    private val isReverseDefaultRotation =
            context.resources.getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)
    private val screenSizeFoldProvider: ScreenSizeFoldProvider = ScreenSizeFoldProvider(context)
    private val screenSizeFoldProvider: ScreenSizeFoldProvider = ScreenSizeFoldProvider(context)
    var iconLayoutParamSize: Pair<Int, Int> = Pair(1, 1)
    var iconLayoutParamSize: Pair<Int, Int> = Pair(1, 1)
        set(value) {
        set(value) {
@@ -76,7 +78,7 @@ open class AuthBiometricFingerprintIconController(
        isSideFps = sideFps
        isSideFps = sideFps
        val displayInfo = DisplayInfo()
        val displayInfo = DisplayInfo()
        context.display?.getDisplayInfo(displayInfo)
        context.display?.getDisplayInfo(displayInfo)
        if (isSideFps && displayInfo.rotation == Surface.ROTATION_180) {
        if (isSideFps && getRotationFromDefault(displayInfo.rotation) == Surface.ROTATION_180) {
            iconView.rotation = 180f
            iconView.rotation = 180f
        }
        }
        screenSizeFoldProvider.registerCallback(this, context.mainExecutor)
        screenSizeFoldProvider.registerCallback(this, context.mainExecutor)
@@ -86,7 +88,7 @@ open class AuthBiometricFingerprintIconController(
    private fun updateIconSideFps(@BiometricState lastState: Int, @BiometricState newState: Int) {
    private fun updateIconSideFps(@BiometricState lastState: Int, @BiometricState newState: Int) {
        val displayInfo = DisplayInfo()
        val displayInfo = DisplayInfo()
        context.display?.getDisplayInfo(displayInfo)
        context.display?.getDisplayInfo(displayInfo)
        val rotation = displayInfo.rotation
        val rotation = getRotationFromDefault(displayInfo.rotation)
        val iconAnimation = getSideFpsAnimationForTransition(rotation)
        val iconAnimation = getSideFpsAnimationForTransition(rotation)
        val iconViewOverlayAnimation =
        val iconViewOverlayAnimation =
                getSideFpsOverlayAnimationForTransition(lastState, newState, rotation) ?: return
                getSideFpsOverlayAnimationForTransition(lastState, newState, rotation) ?: return
@@ -217,6 +219,9 @@ open class AuthBiometricFingerprintIconController(
        return if (id != null) return id else null
        return if (id != null) return id else null
    }
    }


    private fun getRotationFromDefault(rotation: Int): Int =
            if (isReverseDefaultRotation) (rotation + 1) % 4 else rotation

    @RawRes
    @RawRes
    private fun getSideFpsAnimationForTransition(rotation: Int): Int = when (rotation) {
    private fun getSideFpsAnimationForTransition(rotation: Int): Int = when (rotation) {
        Surface.ROTATION_90 -> if (isDeviceFolded) {
        Surface.ROTATION_90 -> if (isDeviceFolded) {