Merge "Revert "Enable orientation listener at all times."" into sc-dev

This commit is contained in:
Manish Varma
2021-07-09 17:39:47 +00:00
committed by Android (Google) Code Review

View File

@@ -121,15 +121,11 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
} }
private class BiometricOrientationEventListener extends OrientationEventListener { private class BiometricOrientationEventListener extends OrientationEventListener {
@Surface.Rotation private int mLastRotation = ORIENTATION_UNKNOWN; @Surface.Rotation private int mLastRotation;
BiometricOrientationEventListener(Context context) { BiometricOrientationEventListener(Context context) {
super(context); super(context);
mLastRotation = context.getDisplay().getRotation();
final Display display = context.getDisplay();
if (display != null) {
mLastRotation = display.getRotation();
}
} }
@Override @Override
@@ -204,6 +200,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
Log.w(TAG, "ACTION_CLOSE_SYSTEM_DIALOGS received"); Log.w(TAG, "ACTION_CLOSE_SYSTEM_DIALOGS received");
mCurrentDialog.dismissWithoutCallback(true /* animate */); mCurrentDialog.dismissWithoutCallback(true /* animate */);
mCurrentDialog = null; mCurrentDialog = null;
mOrientationListener.disable();
try { try {
if (mReceiver != null) { if (mReceiver != null) {
@@ -232,6 +229,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
Log.w(TAG, "Evicting client due to: " + topPackage); Log.w(TAG, "Evicting client due to: " + topPackage);
mCurrentDialog.dismissWithoutCallback(true /* animate */); mCurrentDialog.dismissWithoutCallback(true /* animate */);
mCurrentDialog = null; mCurrentDialog = null;
mOrientationListener.disable();
if (mReceiver != null) { if (mReceiver != null) {
mReceiver.onDialogDismissed( mReceiver.onDialogDismissed(
@@ -471,7 +469,6 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
mSidefpsControllerFactory = sidefpsControllerFactory; mSidefpsControllerFactory = sidefpsControllerFactory;
mWindowManager = windowManager; mWindowManager = windowManager;
mOrientationListener = new BiometricOrientationEventListener(context); mOrientationListener = new BiometricOrientationEventListener(context);
mOrientationListener.enable();
mFaceProps = mFaceManager != null ? mFaceManager.getSensorPropertiesInternal() : null; mFaceProps = mFaceManager != null ? mFaceManager.getSensorPropertiesInternal() : null;
@@ -666,6 +663,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
// BiometricService will have already sent the callback to the client in this case. // BiometricService will have already sent the callback to the client in this case.
// This avoids a round trip to SystemUI. So, just dismiss the dialog and we're done. // This avoids a round trip to SystemUI. So, just dismiss the dialog and we're done.
mCurrentDialog = null; mCurrentDialog = null;
mOrientationListener.disable();
} }
/** /**
@@ -748,6 +746,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
mReceiver = (IBiometricSysuiReceiver) args.arg2; mReceiver = (IBiometricSysuiReceiver) args.arg2;
mCurrentDialog = newDialog; mCurrentDialog = newDialog;
mCurrentDialog.show(mWindowManager, savedState); mCurrentDialog.show(mWindowManager, savedState);
mOrientationListener.enable();
} }
private void onDialogDismissed(@DismissedReason int reason) { private void onDialogDismissed(@DismissedReason int reason) {
@@ -757,6 +756,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
} }
mReceiver = null; mReceiver = null;
mCurrentDialog = null; mCurrentDialog = null;
mOrientationListener.disable();
} }
@Override @Override
@@ -769,6 +769,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
mCurrentDialog.onSaveState(savedState); mCurrentDialog.onSaveState(savedState);
mCurrentDialog.dismissWithoutCallback(false /* animate */); mCurrentDialog.dismissWithoutCallback(false /* animate */);
mCurrentDialog = null; mCurrentDialog = null;
mOrientationListener.disable();
// Only show the dialog if necessary. If it was animating out, the dialog is supposed // Only show the dialog if necessary. If it was animating out, the dialog is supposed
// to send its pending callback immediately. // to send its pending callback immediately.