Do not allow the FalsingManager sesion to start when AOD is showing.

Bug: 138220274
Test: manual

Change-Id: I6d14db66d53a668b7cf8dd15ebb489fb3ebf4c7c
Merged-In: I6d14db66d53a668b7cf8dd15ebb489fb3ebf4c7c
(cherry picked from commit bbc11cafee6fb1bf2768bc0b4befcb6f7e02d251)
diff --git a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
index 6280c9f..fbbba57 100644
--- a/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
+++ b/packages/SystemUI/src/com/android/systemui/classifier/brightline/BrightLineFalsingManager.java
@@ -44,6 +44,8 @@
     private final SensorManager mSensorManager;
     private final FalsingDataProvider mDataProvider;
     private boolean mSessionStarted;
+    private boolean mShowingAod;
+    private boolean mScreenOn;
 
     private final ExecutorService mBackgroundExecutor = Executors.newSingleThreadExecutor();
 
@@ -98,7 +100,7 @@
     }
 
     private void sessionStart() {
-        if (!mSessionStarted) {
+        if (!mSessionStarted && !mShowingAod && mScreenOn) {
             logDebug("Starting Session");
             mSessionStarted = true;
             registerSensors();
@@ -159,6 +161,7 @@
 
     @Override
     public void onSucccessfulUnlock() {
+        sessionEnd();
     }
 
     @Override
@@ -167,6 +170,7 @@
 
     @Override
     public void setShowingAod(boolean showingAod) {
+        mShowingAod = showingAod;
         if (showingAod) {
             sessionEnd();
         } else {
@@ -251,7 +255,7 @@
 
     @Override
     public void onScreenOnFromTouch() {
-        sessionStart();
+        onScreenTurningOn();
     }
 
     @Override
@@ -273,11 +277,13 @@
 
     @Override
     public void onScreenTurningOn() {
+        mScreenOn = true;
         sessionStart();
     }
 
     @Override
     public void onScreenOff() {
+        mScreenOn = false;
         sessionEnd();
     }