Root cause: there's a mismatch in how visibility is determined for the AutoBrightnessPreferenceControllerForSetupWizard. The getAvailabilityStatus method and the displayPreference method (specifically the preference.setVisible call) use different conditions for showing the preference. Solution: To ensure consistency, I propose aligning these conditions by incorporating an aconfig flag check in both places. This will prevent unexpected behavior and make the logic clearer. Bug: 389011125 Flag: com.android.settings.accessibility.add_brightness_settings_in_suw Test: atest AutoBrightnessPreferenceControllerForSetupWizardTest BrightnessLevelPreferenceControllerForSetupWizardTest Change-Id: I004bfe8b1e039734356715c971f0bfbe56ffa9db
Running Settings Robolectric tests
The full suite
$ croot
$ atest SettingsRoboTests
Running a single test class
With a filter
$ croot
$ atest SettingsRoboTests:com.android.settings.display.AdaptiveSleepPreferenceControllerTest
You can also run any single test class with atest (it will try to find the correct path)
$ atest AdaptiveSleepPreferenceControllerTest