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

Commit 3a746b4e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't rotate LS udfps location unless LS is occluded" into sc-qpr1-dev am: ed47c002

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

Change-Id: I78c9efde6cead95d72d0f5f602a393ea8fcb70f1
parents a608bf7c ed47c002
Loading
Loading
Loading
Loading
+23 −5
Original line number Original line Diff line number Diff line
@@ -659,6 +659,20 @@ public class UdfpsController implements DozeReceiver {
        }
        }
    }
    }


    private boolean shouldRotate(@Nullable UdfpsAnimationViewController animation) {
        if (!(animation instanceof UdfpsKeyguardViewController)) {
            // always rotate view if we're not on the keyguard
            return true;
        }

        // on the keyguard, make sure we don't rotate if we're going to sleep or not occluded
        if (mKeyguardUpdateMonitor.isGoingToSleep() || !mKeyguardStateController.isOccluded()) {
            return false;
        }

        return true;
    }

    private WindowManager.LayoutParams computeLayoutParams(
    private WindowManager.LayoutParams computeLayoutParams(
            @Nullable UdfpsAnimationViewController animation) {
            @Nullable UdfpsAnimationViewController animation) {
        final int paddingX = animation != null ? animation.getPaddingX() : 0;
        final int paddingX = animation != null ? animation.getPaddingX() : 0;
@@ -683,9 +697,11 @@ public class UdfpsController implements DozeReceiver {
        // Transform dimensions if the device is in landscape mode
        // Transform dimensions if the device is in landscape mode
        switch (mContext.getDisplay().getRotation()) {
        switch (mContext.getDisplay().getRotation()) {
            case Surface.ROTATION_90:
            case Surface.ROTATION_90:
                if (animation instanceof UdfpsKeyguardViewController
                if (!shouldRotate(animation)) {
                        && mKeyguardUpdateMonitor.isGoingToSleep()) {
                    Log.v(TAG, "skip rotating udfps location ROTATION_90");
                    break;
                    break;
                } else {
                    Log.v(TAG, "rotate udfps location ROTATION_90");
                }
                }
                mCoreLayoutParams.x = location.sensorLocationY - location.sensorRadius
                mCoreLayoutParams.x = location.sensorLocationY - location.sensorRadius
                        - paddingX;
                        - paddingX;
@@ -694,9 +710,11 @@ public class UdfpsController implements DozeReceiver {
                break;
                break;


            case Surface.ROTATION_270:
            case Surface.ROTATION_270:
                if (animation instanceof UdfpsKeyguardViewController
                if (!shouldRotate(animation)) {
                        && mKeyguardUpdateMonitor.isGoingToSleep()) {
                    Log.v(TAG, "skip rotating udfps location ROTATION_270");
                    break;
                    break;
                } else {
                    Log.v(TAG, "rotate udfps location ROTATION_270");
                }
                }
                mCoreLayoutParams.x = p.x - location.sensorLocationY - location.sensorRadius
                mCoreLayoutParams.x = p.x - location.sensorLocationY - location.sensorRadius
                        - paddingX;
                        - paddingX;
+1 −0
Original line number Original line Diff line number Diff line
@@ -192,6 +192,7 @@ public class UdfpsControllerTest extends SysuiTestCase {
        when(mLayoutInflater.inflate(R.layout.udfps_keyguard_view, null))
        when(mLayoutInflater.inflate(R.layout.udfps_keyguard_view, null))
                .thenReturn(mKeyguardView); // for showOverlay REASON_AUTH_FPM_KEYGUARD
                .thenReturn(mKeyguardView); // for showOverlay REASON_AUTH_FPM_KEYGUARD
        when(mEnrollView.getContext()).thenReturn(mContext);
        when(mEnrollView.getContext()).thenReturn(mContext);
        when(mKeyguardStateController.isOccluded()).thenReturn(false);
        final List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();
        final List<FingerprintSensorPropertiesInternal> props = new ArrayList<>();


        final List<ComponentInfoInternal> componentInfo = new ArrayList<>();
        final List<ComponentInfoInternal> componentInfo = new ArrayList<>();