Duplicate ambient display setting in battery settings.

Also fixed a bug where ambient display was duplicated
in search results.

Change-Id: Iacdb53c70e90f8240da1ed9acec7e382ed1df5de
Fixes: 62298578
Test: robotests
This commit is contained in:
Andrew Sapperstein
2017-07-07 11:02:00 -07:00
parent e1d46b005b
commit fedae393ef
4 changed files with 25 additions and 6 deletions

View File

@@ -35,6 +35,7 @@
settings:widgetLayout="@null"
settings:keywords="@string/keywords_display_night_display" />
<!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
<SwitchPreference
android:key="auto_brightness"
android:title="@string/auto_brightness_title"
@@ -51,6 +52,7 @@
android:targetClass="@string/config_wallpaper_picker_class" />
</com.android.settingslib.RestrictedPreference>
<!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
<com.android.settings.TimeoutListPreference
android:key="screen_timeout"
android:title="@string/screen_timeout"
@@ -82,6 +84,7 @@
android:title="@string/screensaver_settings_title"
android:fragment="com.android.settings.dream.DreamSettings" />
<!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
<Preference
android:key="ambient_display"
android:title="@string/ambient_display_screen_title"

View File

@@ -59,14 +59,14 @@
android:title="@string/battery_percentage"
android:summary="@string/battery_percentage_description"/>
<!-- Cross-listed item, if you change this, also change it in ia_display_settings.xml -->
<!-- Cross-listed item, if you change this, also change it in display_settings.xml -->
<SwitchPreference
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 -->
<!-- Cross-listed item, if you change this, also change it in display_settings.xml -->
<com.android.settings.TimeoutListPreference
android:key="screen_timeout_battery"
android:title="@string/screen_timeout"
@@ -74,6 +74,12 @@
android:entries="@array/screen_timeout_entries"
android:entryValues="@array/screen_timeout_values"/>
<!-- Cross-listed item, if you change this, also change it in display_settings.xml -->
<Preference
android:key="ambient_display_battery"
android:title="@string/ambient_display_screen_title"
android:fragment="com.android.settings.display.AmbientDisplaySettings" />
</PreferenceCategory>
<PreferenceCategory

View File

@@ -89,7 +89,6 @@ public class DisplaySettings extends DashboardFragment {
private static List<AbstractPreferenceController> buildPreferenceControllers(
Context context, Lifecycle lifecycle) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final AmbientDisplayConfiguration ambientDisplayConfig = new AmbientDisplayConfiguration(context);
controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
controllers.add(new AutoRotatePreferenceController(context, lifecycle));
controllers.add(new CameraGesturePreferenceController(context));
@@ -98,7 +97,9 @@ public class DisplaySettings extends DashboardFragment {
controllers.add(new NightDisplayPreferenceController(context));
controllers.add(new NightModePreferenceController(context));
controllers.add(new ScreenSaverPreferenceController(context));
controllers.add(new AmbientDisplayPreferenceController(context, ambientDisplayConfig,
controllers.add(new AmbientDisplayPreferenceController(
context,
new AmbientDisplayConfiguration(context),
KEY_AMBIENT_DISPLAY));
controllers.add(new TapToWakePreferenceController(context));
controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
@@ -128,6 +129,7 @@ public class DisplaySettings extends DashboardFragment {
List<String> keys = super.getNonIndexableKeys(context);
keys.add(KEY_DISPLAY_SIZE);
keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
keys.add(KEY_AMBIENT_DISPLAY);
return keys;
}

View File

@@ -46,6 +46,7 @@ import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.TextView;
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.os.BatterySipper;
import com.android.internal.os.BatterySipper.DrainType;
@@ -58,6 +59,7 @@ import com.android.settings.applications.LayoutPreference;
import com.android.settings.applications.ManageApplications;
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
import com.android.settings.dashboard.SummaryLoader;
import com.android.settings.display.AmbientDisplayPreferenceController;
import com.android.settings.display.AutoBrightnessPreferenceController;
import com.android.settings.display.BatteryPercentagePreferenceController;
import com.android.settings.display.TimeoutPreferenceController;
@@ -96,6 +98,7 @@ public class PowerUsageSummary extends PowerUsageBase implements
private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness_battery";
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout_battery";
private static final String KEY_AMBIENT_DISPLAY = "ambient_display_battery";
private static final String KEY_BATTERY_SAVER_SUMMARY = "battery_saver_summary";
private static final String KEY_HIGH_USAGE = "high_usage";
@@ -314,6 +317,10 @@ public class PowerUsageSummary extends PowerUsageBase implements
controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
controllers.add(new BatterySaverController(context, getLifecycle()));
controllers.add(new BatteryPercentagePreferenceController(context));
controllers.add(new AmbientDisplayPreferenceController(
context,
new AmbientDisplayConfiguration(context),
KEY_AMBIENT_DISPLAY));
return controllers;
}
@@ -895,11 +902,12 @@ public class PowerUsageSummary extends PowerUsageBase implements
@Override
public List<String> getNonIndexableKeys(Context context) {
List<String> niks = super.getNonIndexableKeys(context);
niks.add(KEY_HIGH_USAGE);
niks.add(KEY_BATTERY_SAVER_SUMMARY);
// Duplicates in display
niks.add(KEY_AUTO_BRIGHTNESS);
niks.add(KEY_SCREEN_TIMEOUT);
niks.add(KEY_BATTERY_SAVER_SUMMARY);
niks.add(KEY_HIGH_USAGE);
niks.add(KEY_AMBIENT_DISPLAY);
return niks;
}
};