Support find sensor screen with no animation

Some illustration view can manage their own start-stop lifecycle and
doesn't need to be handled by the activity.

Make mAnimation null if the animation is not an instance of
FingerprintFindSensorAnimation.

Test: cd tests/robotests && mma
Bug: 38463695
Change-Id: I41989e5cb0639407f58d9c8edda0eef93adbf2e8
This commit is contained in:
Maurice Lam
2017-05-22 11:19:26 -07:00
parent a0d327a5ac
commit ebb8294333
3 changed files with 131 additions and 14 deletions

View File

@@ -20,6 +20,8 @@ import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.UserHandle;
import android.support.annotation.Nullable;
import android.view.View;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -36,6 +38,7 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
private static final int ENROLLING = 2;
public static final String EXTRA_KEY_LAUNCHED_CONFIRM = "launched_confirm_lock";
@Nullable
private FingerprintFindSensorAnimation mAnimation;
private boolean mLaunchedConfirmLock;
private FingerprintEnrollSidecar mSidecar;
@@ -56,8 +59,12 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
} else if (mToken != null) {
startLookingForFingerprint(); // already confirmed, so start looking for fingerprint
}
mAnimation = (FingerprintFindSensorAnimation) findViewById(
R.id.fingerprint_sensor_location_animation);
View animationView = findViewById(R.id.fingerprint_sensor_location_animation);
if (animationView instanceof FingerprintFindSensorAnimation) {
mAnimation = (FingerprintFindSensorAnimation) animationView;
} else {
mAnimation = null;
}
}
protected int getContentView() {
@@ -67,7 +74,9 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
@Override
protected void onStart() {
super.onStart();
mAnimation.startAnimation();
if (mAnimation != null) {
mAnimation.startAnimation();
}
}
private void startLookingForFingerprint() {
@@ -102,13 +111,17 @@ public class FingerprintEnrollFindSensor extends FingerprintEnrollBase {
@Override
protected void onStop() {
super.onStop();
mAnimation.pauseAnimation();
if (mAnimation != null) {
mAnimation.pauseAnimation();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
mAnimation.stopAnimation();
if (mAnimation != null) {
mAnimation.stopAnimation();
}
}
@Override