Merge "Fix landscape to reverse landscape issue" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
493db88bf4
@@ -36,6 +36,8 @@ import android.os.Vibrator;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.OrientationEventListener;
|
||||||
|
import android.view.Surface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
@@ -116,6 +118,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
private AccessibilityManager mAccessibilityManager;
|
private AccessibilityManager mAccessibilityManager;
|
||||||
private boolean mIsAccessibilityEnabled;
|
private boolean mIsAccessibilityEnabled;
|
||||||
|
|
||||||
|
private OrientationEventListener mOrientationEventListener;
|
||||||
|
private int mPreviousRotation = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -128,6 +133,8 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
mAccessibilityManager = getSystemService(AccessibilityManager.class);
|
mAccessibilityManager = getSystemService(AccessibilityManager.class);
|
||||||
mIsAccessibilityEnabled = mAccessibilityManager.isEnabled();
|
mIsAccessibilityEnabled = mAccessibilityManager.isEnabled();
|
||||||
|
|
||||||
|
listenOrientationEvent();
|
||||||
|
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
if (BiometricUtils.isReverseLandscape(getApplicationContext())) {
|
if (BiometricUtils.isReverseLandscape(getApplicationContext())) {
|
||||||
setContentView(R.layout.udfps_enroll_enrolling_land);
|
setContentView(R.layout.udfps_enroll_enrolling_land);
|
||||||
@@ -255,6 +262,12 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
stopIconAnimation();
|
stopIconAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
stopListenOrientationEvent();
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
private void animateProgress(int progress) {
|
private void animateProgress(int progress) {
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
// UDFPS animations are owned by SystemUI
|
// UDFPS animations are owned by SystemUI
|
||||||
@@ -451,6 +464,31 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void listenOrientationEvent() {
|
||||||
|
mOrientationEventListener = new OrientationEventListener(this) {
|
||||||
|
@Override
|
||||||
|
public void onOrientationChanged(int orientation) {
|
||||||
|
final int currentRotation = getDisplay().getRotation();
|
||||||
|
if ((mPreviousRotation == Surface.ROTATION_90
|
||||||
|
&& currentRotation == Surface.ROTATION_270) || (
|
||||||
|
mPreviousRotation == Surface.ROTATION_270
|
||||||
|
&& currentRotation == Surface.ROTATION_90)) {
|
||||||
|
mPreviousRotation = currentRotation;
|
||||||
|
recreate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mOrientationEventListener.enable();
|
||||||
|
mPreviousRotation = getDisplay().getRotation();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopListenOrientationEvent() {
|
||||||
|
if (mOrientationEventListener != null) {
|
||||||
|
mOrientationEventListener.disable();
|
||||||
|
}
|
||||||
|
mOrientationEventListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
private final Animator.AnimatorListener mProgressAnimationListener
|
private final Animator.AnimatorListener mProgressAnimationListener
|
||||||
= new Animator.AnimatorListener() {
|
= new Animator.AnimatorListener() {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user