Files
app_Settings/src/com/android/settings/display/AutoBrightnessPreferenceControllerForSetupWizard.java
Menghan Li e0f734526d refactor(brightness suw): decouple auto brightness initialization logic for setup flow
The AccessibilitySettingsForSetupWizard class should not be responsible for managing the initial
logic of controllers, such as determining which controllers need to be dynamically added or updated
using setInSetupWizard APIs. This logic should be handled directly by the controllers themselves.

Bug: 311093618
Flag: EXEMPT bugfix
Test: atest AccessibilitySettingsForSetupWizardTest
            AutoBrightnessPreferenceControllerForSetupWizardTest
            AutoBrightnessPreferenceControllerTest
            BrightnessLevelPreferenceControllerForSetupWizardTest
            BrightnessLevelPreferenceControllerTest

Change-Id: I6065a10e72d002981c0f514543e6933d79c2aa1b
2024-09-24 05:41:23 +00:00

45 lines
1.4 KiB
Java

/*
* Copyright (C) 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.display;
import android.content.Context;
import androidx.annotation.NonNull;
import com.android.settings.accessibility.Flags;
/**
* The top-level preference controller that updates the adaptive brightness in the SetupWizard.
*/
public class AutoBrightnessPreferenceControllerForSetupWizard
extends AutoBrightnessPreferenceController {
public AutoBrightnessPreferenceControllerForSetupWizard(@NonNull Context context,
@NonNull String key) {
super(context, key);
}
@Override
@AvailabilityStatus
public int getAvailabilityStatus() {
if (!Flags.addBrightnessSettingsInSuw()) {
return CONDITIONALLY_UNAVAILABLE;
}
return super.getAvailabilityStatus();
}
}