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

Unverified Commit d9d3cb7b authored by Michael Bestas's avatar Michael Bestas Committed by Michael Bestas
Browse files

Revert "Revert "Revert "Update animation for fingerprint edu page"""

This makes side fps devices crash when trying to set up a fingerprint
since the submitted lottie animations are empty.

This reverts commit e6554d23.

Change-Id: I44ea4a5af6bab3690e143ec95cb55c2319473193
parent d85c8982
Loading
Loading
Loading
Loading
+0 −56
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<com.google.android.setupdesign.GlifLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/setup_wizard_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    style="?attr/fingerprint_layout_theme">

    <LinearLayout
        style="@style/SudContentFrame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:clipToPadding="false"
        android:clipChildren="false">

        <com.airbnb.lottie.LottieAnimationView
            android:id="@+id/illustration_lottie"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerInside"
            app:lottie_imageAssetsFolder="images"
            app:lottie_autoPlay="true"
            app:lottie_loop="true"
            app:lottie_rawRes="@raw/fingerprint_edu_lottie"/>

        <com.airbnb.lottie.LottieAnimationView
            android:id="@+id/illustration_lottie_portrait"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:scaleType="centerInside"
            android:visibility="gone"
            app:lottie_imageAssetsFolder="images"
            app:lottie_autoPlay="true"
            app:lottie_loop="true"
            app:lottie_rawRes="@raw/fingerprint_edu_lottie_portrait"/>

    </LinearLayout>
</com.google.android.setupdesign.GlifLayout>
+0 −0

Empty file deleted.

+0 −0

Empty file deleted.

+1 −68
Original line number Diff line number Diff line
@@ -21,14 +21,13 @@ import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.Bundle;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.accessibility.AccessibilityManager;

import androidx.annotation.Nullable;

import com.airbnb.lottie.LottieAnimationView;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricEnrollBase;
@@ -36,7 +35,6 @@ import com.android.settings.biometrics.BiometricEnrollSidecar;
import com.android.settings.biometrics.BiometricUtils;
import com.android.settings.password.ChooseLockSettingsHelper;

import com.airbnb.lottie.LottieAnimationView;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;

@@ -56,9 +54,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
    private boolean mCanAssumeUdfps;
    private boolean mCanAssumeSidefps;

    private OrientationEventListener mOrientationEventListener;
    private int mPreviousRotation = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
@@ -79,8 +74,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
                        .build()
        );

        listenOrientationEvent();

        if (mCanAssumeUdfps) {
            setHeaderText(R.string.security_settings_udfps_enroll_find_sensor_title);
            setDescriptionText(R.string.security_settings_udfps_enroll_find_sensor_message);
@@ -99,33 +92,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
                lottieAnimationView.setAnimation(R.raw.udfps_edu_a11y_lottie);
            }

        } else if (mCanAssumeSidefps) {
            setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
            setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
            final LottieAnimationView lottieAnimationView = findViewById(R.id.illustration_lottie);
            final LottieAnimationView lottieAnimationViewPortrait =
                    findViewById(R.id.illustration_lottie_portrait);
            final int rotation = getApplicationContext().getDisplay().getRotation();
            switch(rotation) {
                case Surface.ROTATION_90:
                    lottieAnimationView.setVisibility(View.GONE);
                    lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
                    break;
                case Surface.ROTATION_180:
                    lottieAnimationView.setVisibility(View.VISIBLE);
                    lottieAnimationView.setRotation(180);
                    lottieAnimationViewPortrait.setVisibility(View.GONE);
                    break;
                case Surface.ROTATION_270:
                    lottieAnimationView.setVisibility(View.GONE);
                    lottieAnimationViewPortrait.setVisibility(View.VISIBLE);
                    lottieAnimationViewPortrait.setRotation(180);
                    break;
                default:
                    lottieAnimationView.setVisibility(View.VISIBLE);
                    lottieAnimationViewPortrait.setVisibility(View.GONE);
                    break;
            }
        } else {
            final boolean isFrontFacingFps = getResources().getBoolean(
                    R.bool.config_is_front_facing_fps);
@@ -192,8 +158,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
    protected int getContentView() {
        if (mCanAssumeUdfps) {
            return R.layout.udfps_enroll_find_sensor_layout;
        } else if (mCanAssumeSidefps) {
            return R.layout.sfps_enroll_find_sensor_layout;
        }
        return R.layout.fingerprint_enroll_find_sensor;
    }
@@ -269,7 +233,6 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements

    @Override
    protected void onDestroy() {
        stopListenOrientationEvent();
        super.onDestroy();
        if (mAnimation != null) {
            mAnimation.stopAnimation();
@@ -348,34 +311,4 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
    public int getMetricsCategory() {
        return SettingsEnums.FINGERPRINT_FIND_SENSOR;
    }

    private void listenOrientationEvent() {
        if (!mCanAssumeSidefps) {
            // Do nothing if the device doesn't support SideFPS.
            return;
        }
        mOrientationEventListener = new OrientationEventListener(this) {
            @Override
            public void onOrientationChanged(int orientation) {
                final int currentRotation = getDisplay().getRotation();
                if ((currentRotation + 2) % 4 == mPreviousRotation) {
                    mPreviousRotation = currentRotation;
                    recreate();
                }
            }
        };
        mOrientationEventListener.enable();
        mPreviousRotation = getDisplay().getRotation();
    }

    private void stopListenOrientationEvent() {
        if (!mCanAssumeSidefps) {
            // Do nothing if the device doesn't support SideFPS.
            return;
        }
        if (mOrientationEventListener != null) {
            mOrientationEventListener.disable();
        }
        mOrientationEventListener = null;
    }
}