Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3266e3d7 authored by Matthew Fritze's avatar Matthew Fritze
Browse files

Remove duplicates between battery and display settings

Change preference keys of duplicate settings between
display and battery to avoid duplication in search.

Bug: 33701673
Test: make RunSettingsRoboTests
Change-Id: Iaad52f16ce33c478c64bcec656cc8edbe0c97283
Merged-In: I56c82e9e7f163d345065ca478849de9b14c173fe
parent eb624071
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@

        <com.android.settings.widget.MasterSwitchPreference
            android:fragment="com.android.settings.fuelgauge.BatterySaverSettings"
            android:key="battery_saver"
            android:key="battery_saver_summary"
            android:title="@string/battery_saver"/>

        <SwitchPreference
@@ -56,14 +56,14 @@

        <!-- Cross-listed item, if you change this, also change it in ia_display_settings.xml -->
        <SwitchPreference
            android:key="auto_brightness"
            android:key="auto_brightness_battery"
            android:title="@string/auto_brightness_title"
            android:summary="@string/auto_brightness_summary"
            settings:keywords="@string/keywords_display_auto_brightness"/>

        <!-- Cross-listed item, if you change this, also change it in ia_display_settings.xml -->
        <com.android.settings.TimeoutListPreference
            android:key="screen_timeout"
            android:key="screen_timeout_battery"
            android:title="@string/screen_timeout"
            android:summary="@string/screen_timeout_summary"
            android:entries="@array/screen_timeout_entries"
+5 −2
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ import java.util.List;
public class DisplaySettings extends DashboardFragment {
    private static final String TAG = "DisplaySettings";

    private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness";
    private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";

    @Override
    public int getMetricsCategory() {
        return MetricsEvent.DISPLAY;
@@ -85,7 +88,7 @@ public class DisplaySettings extends DashboardFragment {
    private static List<PreferenceController> buildPreferenceControllers(
            Context context, Lifecycle lifecycle) {
        final List<PreferenceController> controllers = new ArrayList<>();
        controllers.add(new AutoBrightnessPreferenceController(context));
        controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
        controllers.add(new AutoRotatePreferenceController(context));
        controllers.add(new CameraGesturePreferenceController(context));
        controllers.add(new DozePreferenceController(context));
@@ -100,7 +103,7 @@ public class DisplaySettings extends DashboardFragment {
        controllers.add(new DoubleTapScreenPreferenceController(
                context, lifecycle, ambientDisplayConfig, UserHandle.myUserId()));
        controllers.add(new TapToWakePreferenceController(context));
        controllers.add(new TimeoutPreferenceController(context));
        controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
        controllers.add(new VrDisplayPreferenceController(context));
        controllers.add(new WallpaperPreferenceController(context));
        controllers.add(new ThemePreferenceController(context));
+4 −3
Original line number Diff line number Diff line
@@ -33,10 +33,11 @@ import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
public class AutoBrightnessPreferenceController extends PreferenceController implements
        Preference.OnPreferenceChangeListener {

    private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness";
    private final String mAutoBrightnessKey;

    public AutoBrightnessPreferenceController(Context context) {
    public AutoBrightnessPreferenceController(Context context, String key) {
        super(context);
        mAutoBrightnessKey = key;
    }

    @Override
@@ -47,7 +48,7 @@ public class AutoBrightnessPreferenceController extends PreferenceController imp

    @Override
    public String getPreferenceKey() {
        return KEY_AUTO_BRIGHTNESS;
        return mAutoBrightnessKey;
    }

    @Override
+4 −3
Original line number Diff line number Diff line
@@ -35,10 +35,11 @@ public class TimeoutPreferenceController extends PreferenceController implements
    /** If there is no setting in the provider, use this. */
    public static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000;

    private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
    private final String mScreenTimeoutKey;

    public TimeoutPreferenceController(Context context) {
    public TimeoutPreferenceController(Context context, String key) {
        super(context);
        mScreenTimeoutKey = key;
    }

    @Override
@@ -48,7 +49,7 @@ public class TimeoutPreferenceController extends PreferenceController implements

    @Override
    public String getPreferenceKey() {
        return KEY_SCREEN_TIMEOUT;
        return mScreenTimeoutKey;
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import static android.os.PowerManager.ACTION_POWER_SAVE_MODE_CHANGING;

public class BatterySaverController extends PreferenceController implements
        Preference.OnPreferenceChangeListener, LifecycleObserver, OnStart, OnStop {
    private static final String KEY_BATTERY_SAVER = "battery_saver";
    private static final String KEY_BATTERY_SAVER = "battery_saver_summary";
    private static final String TAG = "BatterySaverController";
    private static final boolean DEBUG = false;

Loading