Merge "Make vendor can override the condition of adjusting properties of header text" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
0039f8ec2b
@@ -74,6 +74,7 @@ import com.android.settings.biometrics.fingerprint.feature.SfpsEnrollmentFeature
|
|||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settingslib.display.DisplayDensityUtils;
|
import com.android.settingslib.display.DisplayDensityUtils;
|
||||||
|
import com.android.systemui.unfold.compat.ScreenSizeFoldProvider;
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView;
|
import com.airbnb.lottie.LottieAnimationView;
|
||||||
import com.airbnb.lottie.LottieComposition;
|
import com.airbnb.lottie.LottieComposition;
|
||||||
@@ -89,7 +90,6 @@ import com.google.android.setupdesign.template.HeaderMixin;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity which handles the actual enrolling for fingerprint.
|
* Activity which handles the actual enrolling for fingerprint.
|
||||||
@@ -197,8 +197,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
private OrientationEventListener mOrientationEventListener;
|
private OrientationEventListener mOrientationEventListener;
|
||||||
private int mPreviousRotation = 0;
|
private int mPreviousRotation = 0;
|
||||||
|
|
||||||
@NonNull
|
private boolean mIsFolded = false;
|
||||||
private SfpsEnrollmentFeature mSfpsEnrollmentFeature = new EmptySfpsEnrollmentFeature();
|
|
||||||
|
private SfpsEnrollmentFeature mSfpsEnrollmentFeature;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private UdfpsEnrollCalibrator mCalibrator;
|
private UdfpsEnrollCalibrator mCalibrator;
|
||||||
|
|
||||||
@@ -386,6 +388,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
setupScreenFoldCallbackWhenNecessary();
|
||||||
updateProgress(false /* animate */);
|
updateProgress(false /* animate */);
|
||||||
updateTitleAndDescription(true);
|
updateTitleAndDescription(true);
|
||||||
if (mRestoring) {
|
if (mRestoring) {
|
||||||
@@ -393,6 +396,19 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupScreenFoldCallbackWhenNecessary() {
|
||||||
|
if (mCanAssumeSfps) {
|
||||||
|
// These two fields will be cleaned up in BiometricEnrollBase#onStop.
|
||||||
|
mScreenSizeFoldProvider = new ScreenSizeFoldProvider(getApplicationContext());
|
||||||
|
mFoldCallback = isFolded -> {
|
||||||
|
mIsFolded = isFolded;
|
||||||
|
maybeHideSfpsText(getResources().getConfiguration());
|
||||||
|
};
|
||||||
|
// The callback will be unregistered in BiometricEnrollBase#onStop.
|
||||||
|
mScreenSizeFoldProvider.registerCallback(mFoldCallback, getMainExecutor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnterAnimationComplete() {
|
public void onEnterAnimationComplete() {
|
||||||
super.onEnterAnimationComplete();
|
super.onEnterAnimationComplete();
|
||||||
@@ -1156,13 +1172,12 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
private void maybeHideSfpsText(@NonNull Configuration newConfig) {
|
private void maybeHideSfpsText(@NonNull Configuration newConfig) {
|
||||||
final HeaderMixin headerMixin = getLayout().getMixin(HeaderMixin.class);
|
final HeaderMixin headerMixin = getLayout().getMixin(HeaderMixin.class);
|
||||||
final DescriptionMixin descriptionMixin = getLayout().getMixin(DescriptionMixin.class);
|
final DescriptionMixin descriptionMixin = getLayout().getMixin(DescriptionMixin.class);
|
||||||
final boolean isLandscape = newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE;
|
|
||||||
|
|
||||||
if (mCanAssumeSfps) {
|
if (mCanAssumeSfps) {
|
||||||
// hide the description
|
// hide the description
|
||||||
descriptionMixin.getTextView().setVisibility(View.GONE);
|
descriptionMixin.getTextView().setVisibility(View.GONE);
|
||||||
headerMixin.getTextView().setHyphenationFrequency(HYPHENATION_FREQUENCY_NONE);
|
headerMixin.getTextView().setHyphenationFrequency(HYPHENATION_FREQUENCY_NONE);
|
||||||
if (isLandscape) {
|
if (mSfpsEnrollmentFeature.shouldAdjustHeaderText(newConfig, mIsFolded)) {
|
||||||
headerMixin.setAutoTextSizeEnabled(true);
|
headerMixin.setAutoTextSizeEnabled(true);
|
||||||
headerMixin.getTextView().setMinLines(0);
|
headerMixin.getTextView().setMinLines(0);
|
||||||
headerMixin.getTextView().setMaxLines(10);
|
headerMixin.getTextView().setMaxLines(10);
|
||||||
@@ -1209,32 +1224,4 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptySfpsEnrollmentFeature implements SfpsEnrollmentFeature {
|
|
||||||
private final String exceptionStr = "Assume sfps but no SfpsEnrollmentFeature impl.";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getCurrentSfpsEnrollStage(int progressSteps, Function<Integer, Integer> mapper) {
|
|
||||||
throw new IllegalStateException(exceptionStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFeaturedStageHeaderResource(int stage) {
|
|
||||||
throw new IllegalStateException(exceptionStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSfpsEnrollLottiePerStage(int stage) {
|
|
||||||
throw new IllegalStateException(exceptionStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getEnrollStageThreshold(@NonNull Context context, int index) {
|
|
||||||
throw new IllegalStateException(exceptionStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Animator getHelpAnimator(@NonNull View target) {
|
|
||||||
throw new IllegalStateException(exceptionStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ package com.android.settings.biometrics.fingerprint.feature;
|
|||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -114,4 +115,13 @@ public interface SfpsEnrollmentFeature {
|
|||||||
* @param remaining remaining
|
* @param remaining remaining
|
||||||
*/
|
*/
|
||||||
default void handleOnEnrollmentProgressChange(int steps, int remaining) {}
|
default void handleOnEnrollmentProgressChange(int steps, int remaining) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the properties of header text view like auto text size or min / max lines
|
||||||
|
* should be adjusted.
|
||||||
|
* @param conf the current configuration
|
||||||
|
* @param isFolded is the device folded
|
||||||
|
* @return true if should adjust auto size and max lines of header; otherwise false
|
||||||
|
*/
|
||||||
|
boolean shouldAdjustHeaderText(@NonNull Configuration conf, boolean isFolded);
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import static com.android.settings.biometrics.fingerprint.FingerprintEnrollEnrol
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
@@ -107,4 +108,9 @@ public class SfpsEnrollmentFeatureImpl implements SfpsEnrollmentFeature {
|
|||||||
help.setAutoCancel(false);
|
help.setAutoCancel(false);
|
||||||
return help;
|
return help;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldAdjustHeaderText(@NonNull Configuration conf, boolean isFolded) {
|
||||||
|
return conf.orientation == Configuration.ORIENTATION_LANDSCAPE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user