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

Commit 0d1fc26c authored by Grace Cheng's avatar Grace Cheng
Browse files

Fixes updateOverlayVisibility and updates SideFpsControllerTest for natural orientation shift

Fixes tests broken by ag/20860930 and ag/20860330. This change updates SideFpsControllerTest to reflect shift in natural orientation on
x-aligned sfps devices, and updates parameters of test device configs. Sets up SysUiTestableContext and override for isReverseDefaultRotation field in SideFpsController, and adds more comprehensive test coverage for x-aligned and y-aligned configurations in all rotations, and with and without reverseDefaultRotation. Also adds missing call to getRotationFromDefault in updateOverlayVisibility.

Test: atest SideFpsControllerTest
Fixes: 264589193
Fixes: 264274708
Change-Id: I23b819c7bbe6ad91284753c9bf35d34a30f38532
parent fed657bf
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ constructor(
        context.resources.getInteger(android.R.integer.config_mediumAnimTime).toLong()

    private val isReverseDefaultRotation =
        context.getResources().getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)
        context.resources.getBoolean(com.android.internal.R.bool.config_reverseDefaultRotation)

    private var overlayHideAnimator: ViewPropertyAnimator? = null

@@ -268,10 +268,12 @@ constructor(
        val isDefaultOrientation =
            if (isReverseDefaultRotation) !isNaturalOrientation else isNaturalOrientation
        val size = windowManager.maximumWindowMetrics.bounds

        val displayWidth = if (isDefaultOrientation) size.width() else size.height()
        val displayHeight = if (isDefaultOrientation) size.height() else size.width()
        val boundsWidth = if (isDefaultOrientation) bounds.width() else bounds.height()
        val boundsHeight = if (isDefaultOrientation) bounds.height() else bounds.width()

        val sensorBounds =
            if (overlayOffsets.isYAligned()) {
                Rect(
@@ -297,6 +299,7 @@ constructor(

        overlayViewParams.x = sensorBounds.left
        overlayViewParams.y = sensorBounds.top

        windowManager.updateViewLayout(overlayView, overlayViewParams)
    }

@@ -306,7 +309,12 @@ constructor(
        }
        // hide after a few seconds if the sensor is oriented down and there are
        // large overlapping system bars
        val rotation = context.display?.rotation
        var rotation = context.display?.rotation

        if (rotation != null) {
            rotation = getRotationFromDefault(rotation)
        }

        if (
            windowManager.currentWindowMetrics.windowInsets.hasBigNavigationBar() &&
                ((rotation == Surface.ROTATION_270 && overlayOffsets.isYAligned()) ||
+277 −67

File changed.

Preview size limit exceeded, changes collapsed.