Merge "Updates sfps animations for natural orientation" into tm-qpr-dev am: 28d0e72a6d am: 305fbd98db

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20860930

Change-Id: Ia3ffc6fadcec112adc45265bb6953881a9b02ca0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Grace Cheng
2023-01-06 11:36:09 +00:00
committed by Automerger Merge Worker

View File

@@ -73,6 +73,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
private int mPreviousRotation = 0;
private ScreenSizeFoldProvider mScreenSizeFoldProvider;
private boolean mIsFolded;
private boolean mIsReverseDefaultRotation;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -120,6 +121,8 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
} else if (mCanAssumeSfps) {
setHeaderText(R.string.security_settings_sfps_enroll_find_sensor_title);
setDescriptionText(R.string.security_settings_sfps_enroll_find_sensor_message);
mIsReverseDefaultRotation = getApplicationContext().getResources().getBoolean(
com.android.internal.R.bool.config_reverseDefaultRotation);
} else {
setHeaderText(R.string.security_settings_fingerprint_enroll_find_sensor_title);
setDescriptionText(R.string.security_settings_fingerprint_enroll_find_sensor_message);
@@ -175,11 +178,20 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
}
}
private int getRotationFromDefault(int rotation) {
if (mIsReverseDefaultRotation) {
return (rotation + 1) % 4;
} else {
return rotation;
}
}
private void updateSfpsFindSensorAnimationAsset() {
mScreenSizeFoldProvider
.onConfigurationChange(getApplicationContext().getResources().getConfiguration());
mIllustrationLottie = findViewById(R.id.illustration_lottie);
final int rotation = getApplicationContext().getDisplay().getRotation();
final int rotation = getRotationFromDefault(
getApplicationContext().getDisplay().getRotation());
switch (rotation) {
case Surface.ROTATION_90:
@@ -441,7 +453,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
mOrientationEventListener = new OrientationEventListener(this) {
@Override
public void onOrientationChanged(int orientation) {
final int currentRotation = getDisplay().getRotation();
final int currentRotation = getRotationFromDefault(getDisplay().getRotation());
if ((currentRotation + 2) % 4 == mPreviousRotation) {
mPreviousRotation = currentRotation;
recreate();
@@ -449,7 +461,7 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
}
};
mOrientationEventListener.enable();
mPreviousRotation = getDisplay().getRotation();
mPreviousRotation = getRotationFromDefault(getDisplay().getRotation());
}
private void stopListenOrientationEvent() {