Cleanup offload controls doze autobrightness flag

Bug: 327392714
Flag: EXEMPT flag deletion
Test: EXEMPT flag deletion
Change-Id: Ie4da0790a84419770f7c831b5c6ec057e7796bc2
diff --git a/services/core/java/com/android/server/display/AutomaticBrightnessController.java b/services/core/java/com/android/server/display/AutomaticBrightnessController.java
index 88f5c81..c41b8db 100644
--- a/services/core/java/com/android/server/display/AutomaticBrightnessController.java
+++ b/services/core/java/com/android/server/display/AutomaticBrightnessController.java
@@ -333,7 +333,7 @@
             int ambientLightHorizonLong, float userLux, float userNits,
             DisplayManagerFlags displayManagerFlags) {
         mInjector = injector;
-        mClock = injector.createClock(displayManagerFlags.offloadControlsDozeAutoBrightness());
+        mClock = injector.createClock();
         mContext = context;
         mCallbacks = callbacks;
         mSensorManager = sensorManager;
@@ -1402,8 +1402,7 @@
         public void onSensorChanged(SensorEvent event) {
             if (mLightSensorEnabled) {
                 // The time received from the sensor is in nano seconds, hence changing it to ms
-                final long time = (mDisplayManagerFlags.offloadControlsDozeAutoBrightness())
-                        ? TimeUnit.NANOSECONDS.toMillis(event.timestamp) : mClock.uptimeMillis();
+                final long time = TimeUnit.NANOSECONDS.toMillis(event.timestamp);
                 final float lux = event.values[0];
                 handleLightSensorEvent(time, lux);
             }
@@ -1616,20 +1615,13 @@
     }
 
     private static class RealClock implements Clock {
-        private final boolean mOffloadControlsDozeBrightness;
-
-        RealClock(boolean offloadControlsDozeBrightness) {
-            mOffloadControlsDozeBrightness = offloadControlsDozeBrightness;
-        }
-
         @Override
         public long uptimeMillis() {
             return SystemClock.uptimeMillis();
         }
 
         public long getSensorEventScaleTime() {
-            return (mOffloadControlsDozeBrightness)
-                    ? SystemClock.elapsedRealtime() : uptimeMillis();
+            return SystemClock.elapsedRealtime();
         }
     }
 
@@ -1638,8 +1630,8 @@
             return BackgroundThread.getHandler();
         }
 
-        Clock createClock(boolean offloadControlsDozeBrightness) {
-            return new RealClock(offloadControlsDozeBrightness);
+        Clock createClock() {
+            return new RealClock();
         }
     }
 }
diff --git a/services/core/java/com/android/server/display/brightness/DisplayBrightnessStrategySelector.java b/services/core/java/com/android/server/display/brightness/DisplayBrightnessStrategySelector.java
index 2c6f374..6510441 100644
--- a/services/core/java/com/android/server/display/brightness/DisplayBrightnessStrategySelector.java
+++ b/services/core/java/com/android/server/display/brightness/DisplayBrightnessStrategySelector.java
@@ -291,8 +291,7 @@
     void setAllowAutoBrightnessWhileDozing(
             DisplayManagerInternal.DisplayOffloadSession displayOffloadSession) {
         mAllowAutoBrightnessWhileDozing = mAllowAutoBrightnessWhileDozingConfig;
-        if (mDisplayManagerFlags.offloadControlsDozeAutoBrightness()
-                && mDisplayManagerFlags.isDisplayOffloadEnabled()
+        if (mDisplayManagerFlags.isDisplayOffloadEnabled()
                 && displayOffloadSession != null) {
             mAllowAutoBrightnessWhileDozing &= displayOffloadSession.allowAutoBrightnessInDoze();
         }
diff --git a/services/core/java/com/android/server/display/feature/DisplayManagerFlags.java b/services/core/java/com/android/server/display/feature/DisplayManagerFlags.java
index e4b595a..c3057de 100644
--- a/services/core/java/com/android/server/display/feature/DisplayManagerFlags.java
+++ b/services/core/java/com/android/server/display/feature/DisplayManagerFlags.java
@@ -156,11 +156,6 @@
             Flags.FLAG_DOZE_BRIGHTNESS_FLOAT,
             Flags::dozeBrightnessFloat);
 
-    private final FlagState mOffloadControlsDozeAutoBrightness = new FlagState(
-            Flags.FLAG_OFFLOAD_CONTROLS_DOZE_AUTO_BRIGHTNESS,
-            Flags::offloadControlsDozeAutoBrightness
-    );
-
     private final FlagState mPeakRefreshRatePhysicalLimit = new FlagState(
             Flags.FLAG_ENABLE_PEAK_REFRESH_RATE_PHYSICAL_LIMIT,
             Flags::enablePeakRefreshRatePhysicalLimit
@@ -440,13 +435,6 @@
         return mDozeBrightnessFloat.isEnabled();
     }
 
-    /**
-     * @return Whether DisplayOffload should control auto-brightness in doze
-     */
-    public boolean offloadControlsDozeAutoBrightness() {
-        return mOffloadControlsDozeAutoBrightness.isEnabled();
-    }
-
     public boolean isPeakRefreshRatePhysicalLimitEnabled() {
         return mPeakRefreshRatePhysicalLimit.isEnabled();
     }
@@ -647,7 +635,6 @@
         pw.println(" " + mResolutionBackupRestore);
         pw.println(" " + mUseFusionProxSensor);
         pw.println(" " + mDozeBrightnessFloat);
-        pw.println(" " + mOffloadControlsDozeAutoBrightness);
         pw.println(" " + mPeakRefreshRatePhysicalLimit);
         pw.println(" " + mIgnoreAppPreferredRefreshRate);
         pw.println(" " + mSynthetic60hzModes);
diff --git a/services/core/java/com/android/server/display/feature/display_flags.aconfig b/services/core/java/com/android/server/display/feature/display_flags.aconfig
index acdc0e0..f545130 100644
--- a/services/core/java/com/android/server/display/feature/display_flags.aconfig
+++ b/services/core/java/com/android/server/display/feature/display_flags.aconfig
@@ -255,17 +255,6 @@
 }
 
 flag {
-    name: "offload_controls_doze_auto_brightness"
-    namespace: "display_manager"
-    description: "Allows the registered DisplayOffloader to control if auto-brightness is used in doze"
-    bug: "327392714"
-    is_fixed_read_only: true
-    metadata {
-        purpose: PURPOSE_BUGFIX
-    }
-}
-
-flag {
     name: "enable_peak_refresh_rate_physical_limit"
     namespace: "display_manager"
     description: "Flag for adding physical refresh rate limit if smooth display setting is on "
diff --git a/services/tests/displayservicetests/src/com/android/server/display/AutomaticBrightnessControllerTest.java b/services/tests/displayservicetests/src/com/android/server/display/AutomaticBrightnessControllerTest.java
index 7d25acd..a421163 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/AutomaticBrightnessControllerTest.java
+++ b/services/tests/displayservicetests/src/com/android/server/display/AutomaticBrightnessControllerTest.java
@@ -152,7 +152,7 @@
                     }
 
                     @Override
-                    AutomaticBrightnessController.Clock createClock(boolean isEnabled) {
+                    AutomaticBrightnessController.Clock createClock() {
                         return new AutomaticBrightnessController.Clock() {
                             @Override
                             public long uptimeMillis() {
@@ -618,39 +618,46 @@
         long increment = 500;
         // set autobrightness to low
         // t = 0
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
 
         // t = 500
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
 
         // t = 1000
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(0.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 1500
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(0.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 2000
         // ensure that our reading is at 0.
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(0.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 2500
         // first 10000 lux sensor event reading
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertTrue(mController.getAmbientLux() > 0.0f);
         assertTrue(mController.getAmbientLux() < 10000.0f);
 
         // t = 3000
         // lux reading should still not yet be 10000.
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertTrue(mController.getAmbientLux() > 0.0f);
         assertTrue(mController.getAmbientLux() < 10000.0f);
 
@@ -659,45 +666,53 @@
         // lux has been high (10000) for 1000ms.
         // lux reading should be 10000
         // short horizon (ambient lux) is high, long horizon is still not high
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(10000.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 4000
         // stay high
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(10000.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 4500
         Mockito.clearInvocations(mBrightnessMappingStrategy);
         mClock.fastForward(increment);
         // short horizon is high, long horizon is high too
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 10000,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         verify(mBrightnessMappingStrategy, times(1)).getBrightness(10000, null, -1);
         assertEquals(10000.0f, mController.getAmbientLux(), EPSILON);
 
         // t = 5000
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertTrue(mController.getAmbientLux() > 0.0f);
         assertTrue(mController.getAmbientLux() < 10000.0f);
 
         // t = 5500
         mClock.fastForward(increment);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertTrue(mController.getAmbientLux() > 0.0f);
         assertTrue(mController.getAmbientLux() < 10000.0f);
 
         // t = 6000
         mClock.fastForward(increment);
         // ambient lux goes to 0
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 0,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(0.0f, mController.getAmbientLux(), EPSILON);
 
         // only the values within the horizon should be kept
         assertArrayEquals(new float[] {10000, 10000, 0, 0, 0}, mController.getLastSensorValues(),
                 EPSILON);
-        assertArrayEquals(new long[] {4000, 4500, 5000, 5500, 6000},
+        assertArrayEquals(new long[]{4000 + ANDROID_SLEEP_TIME, 4500 + ANDROID_SLEEP_TIME,
+                5000 + ANDROID_SLEEP_TIME, 5500 + ANDROID_SLEEP_TIME,
+                6000 + ANDROID_SLEEP_TIME},
                 mController.getLastSensorTimestamps());
     }
 
@@ -793,7 +808,8 @@
         for (int i = 0; i < 1000; i++) {
             lux += increment;
             mClock.fastForward(increment);
-            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux));
+            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux,
+                    (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         }
 
         int valuesCount = (int) Math.ceil((double) AMBIENT_LIGHT_HORIZON_LONG / increment + 1);
@@ -807,17 +823,17 @@
         long sensorTimestamp = mClock.now();
         for (int i = valuesCount - 1; i >= 1; i--) {
             assertEquals(lux, sensorValues[i], EPSILON);
-            assertEquals(sensorTimestamp, sensorTimestamps[i]);
+            assertEquals(sensorTimestamp + ANDROID_SLEEP_TIME, sensorTimestamps[i]);
             lux -= increment;
             sensorTimestamp -= increment;
         }
         assertEquals(lux, sensorValues[0], EPSILON);
-        assertEquals(mClock.now() - AMBIENT_LIGHT_HORIZON_LONG, sensorTimestamps[0]);
+        assertEquals(mClock.now() - AMBIENT_LIGHT_HORIZON_LONG + ANDROID_SLEEP_TIME,
+                sensorTimestamps[0]);
     }
 
     @Test
     public void testAmbientLuxBuffers_prunedBeyondLongHorizonExceptLatestValue() throws Exception {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         ArgumentCaptor<SensorEventListener> listenerCaptor =
                 ArgumentCaptor.forClass(SensorEventListener.class);
         verify(mSensorManager).registerListener(listenerCaptor.capture(), eq(mLightSensor),
@@ -867,7 +883,8 @@
         for (int i = 0; i < 20; i++) {
             lux += increment1;
             mClock.fastForward(increment1);
-            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux));
+            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux,
+                    (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         }
 
         int valuesCount = (int) Math.ceil((double) AMBIENT_LIGHT_HORIZON_LONG / increment1 + 1);
@@ -877,7 +894,8 @@
         for (int i = 0; i < initialCapacity - valuesCount; i++) {
             lux += increment2;
             mClock.fastForward(increment2);
-            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux));
+            listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, lux,
+                    (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         }
 
         float[] sensorValues = mController.getLastSensorValues();
@@ -890,7 +908,7 @@
         long sensorTimestamp = mClock.now();
         for (int i = initialCapacity - 1; i >= 1; i--) {
             assertEquals(lux, sensorValues[i], EPSILON);
-            assertEquals(sensorTimestamp, sensorTimestamps[i]);
+            assertEquals(sensorTimestamp + ANDROID_SLEEP_TIME, sensorTimestamps[i]);
 
             if (i >= valuesCount) {
                 lux -= increment2;
@@ -901,7 +919,8 @@
             }
         }
         assertEquals(lux, sensorValues[0], EPSILON);
-        assertEquals(mClock.now() - AMBIENT_LIGHT_HORIZON_LONG, sensorTimestamps[0]);
+        assertEquals(mClock.now() - AMBIENT_LIGHT_HORIZON_LONG + ANDROID_SLEEP_TIME,
+                sensorTimestamps[0]);
     }
 
     @Test
@@ -951,25 +970,29 @@
 
         // t = 0
         // Initial lux
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
 
         // t = 1000
         // Lux isn't steady yet
         mClock.fastForward(1000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
 
         // t = 1500
         // Lux isn't steady yet
         mClock.fastForward(500);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
 
         // t = 2500
         // Lux is steady now
         mClock.fastForward(1000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
     }
 
@@ -992,25 +1015,29 @@
 
         // t = 0
         // Initial lux
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
 
         // t = 2000
         // Lux isn't steady yet
         mClock.fastForward(2000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
 
         // t = 2500
         // Lux isn't steady yet
         mClock.fastForward(500);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
 
         // t = 4500
         // Lux is steady now
         mClock.fastForward(2000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
     }
 
@@ -1031,19 +1058,22 @@
 
         // t = 0
         // Initial lux
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
 
         // t = 500
         // Lux isn't steady yet
         mClock.fastForward(500);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
 
         // t = 1500
         // Lux is steady now
         mClock.fastForward(1000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
     }
 
@@ -1068,19 +1098,22 @@
 
         // t = 0
         // Initial lux
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 1200,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
 
         // t = 1000
         // Lux isn't steady yet
         mClock.fastForward(1000);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(1200, mController.getAmbientLux(), EPSILON);
 
         // t = 2500
         // Lux is steady now
         mClock.fastForward(1500);
-        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500));
+        listener.onSensorChanged(TestUtils.createSensorEvent(mLightSensor, 500,
+                (mClock.now() + ANDROID_SLEEP_TIME) * NANO_SECONDS_MULTIPLIER));
         assertEquals(500, mController.getAmbientLux(), EPSILON);
     }
 
diff --git a/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java b/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java
index aed1f98..db94958 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java
+++ b/services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java
@@ -1066,7 +1066,6 @@
                 com.android.internal.R.bool.config_allowAutoBrightnessWhileDozing, true);
         mHolder = createDisplayPowerController(DISPLAY_ID, UNIQUE_ID);
         when(mDisplayManagerFlagsMock.isDisplayOffloadEnabled()).thenReturn(true);
-        when(mDisplayManagerFlagsMock.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         mHolder.dpc.setDisplayOffloadSession(mDisplayOffloadSession);
 
@@ -1172,7 +1171,6 @@
                 com.android.internal.R.bool.config_allowAutoBrightnessWhileDozing, true);
         mHolder = createDisplayPowerController(DISPLAY_ID, UNIQUE_ID);
         when(mDisplayManagerFlagsMock.isDisplayOffloadEnabled()).thenReturn(true);
-        when(mDisplayManagerFlagsMock.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(false);
         mHolder.dpc.setDisplayOffloadSession(mDisplayOffloadSession);
 
diff --git a/services/tests/displayservicetests/src/com/android/server/display/brightness/DisplayBrightnessStrategySelectorTest.java b/services/tests/displayservicetests/src/com/android/server/display/brightness/DisplayBrightnessStrategySelectorTest.java
index 2ebb6c2a3..ef39167 100644
--- a/services/tests/displayservicetests/src/com/android/server/display/brightness/DisplayBrightnessStrategySelectorTest.java
+++ b/services/tests/displayservicetests/src/com/android/server/display/brightness/DisplayBrightnessStrategySelectorTest.java
@@ -240,7 +240,6 @@
 
     @Test
     public void selectStrategyDoesNotSelectDozeStrategyWhenOffloadSessionAutoBrightnessIsEnabled() {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -378,7 +377,6 @@
     @Test
     public void selectStrategy_selectsAutomaticStrategyWhenValid() {
         when(mDisplayManagerFlags.isRefactorDisplayPowerControllerEnabled()).thenReturn(true);
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -409,7 +407,6 @@
     @Test
     public void selectStrategy_doesNotSelectAutomaticStrategyWhenStylusInUse() {
         when(mDisplayManagerFlags.isRefactorDisplayPowerControllerEnabled()).thenReturn(true);
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -536,7 +533,6 @@
 
     @Test
     public void setAllowAutoBrightnessWhileDozing_enabledWhenConfigAndOffloadSessionAreEnabled() {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -550,7 +546,6 @@
 
     @Test
     public void setAllowAutoBrightnessWhileDozing_disabledWhenOffloadSessionFlagIsDisabled() {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(false);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -564,7 +559,6 @@
 
     @Test
     public void setAllowAutoBrightnessWhileDozing_disabledWhenABWhileDozingConfigIsDisabled() {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
         when(mDisplayOffloadSession.allowAutoBrightnessInDoze()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
@@ -588,7 +582,6 @@
 
     @Test
     public void setAllowAutoBrightnessWhileDozing_EnabledWhenFlagsAreDisabled() {
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(true);
         when(mResources.getBoolean(R.bool.config_allowAutoBrightnessWhileDozing)).thenReturn(
                 true);
         mDisplayBrightnessStrategySelector = new DisplayBrightnessStrategySelector(mContext,
@@ -600,11 +593,5 @@
         mDisplayBrightnessStrategySelector
                 .setAllowAutoBrightnessWhileDozing(mDisplayOffloadSession);
         assertTrue(mDisplayBrightnessStrategySelector.isAllowAutoBrightnessWhileDozing());
-
-        when(mDisplayManagerFlags.isDisplayOffloadEnabled()).thenReturn(true);
-        when(mDisplayManagerFlags.offloadControlsDozeAutoBrightness()).thenReturn(false);
-        mDisplayBrightnessStrategySelector
-                .setAllowAutoBrightnessWhileDozing(mDisplayOffloadSession);
-        assertTrue(mDisplayBrightnessStrategySelector.isAllowAutoBrightnessWhileDozing());
     }
 }