Convert auto-brightness switch to a full screen UI.
Change-Id: Id5e5ec959201102a7c60372a441dc6813ceedbae
Merged-In: Id5e5ec959201102a7c60372a441dc6813ceedbae
Fixes: 69795935
Test: Existing conformance tests still pass (CodeInspectionTest,
UniquePreferenceTest, manual search test)
diff --git a/res/drawable-nodpi/aab_brightness b/res/drawable-nodpi/aab_brightness
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/drawable-nodpi/aab_brightness
diff --git a/res/raw/aab_brightness.mp4 b/res/raw/aab_brightness.mp4
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/res/raw/aab_brightness.mp4
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0922ebb..b92fb92 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6666,6 +6666,8 @@
<string name="help_url_font_size" translatable="false"></string>
<!-- Help URL, Display size [DO NOT TRANSLATE] -->
<string name="help_url_display_size" translatable="false"></string>
+ <!-- Help URL, Auto brightness [DO NOT TRANSLATE] -->
+ <string name="help_url_auto_brightness" translatable="false" />
<string name="help_url_network_dashboard" translatable="false"></string>
<string name="help_url_connected_devices" translatable="false"></string>
diff --git a/res/xml/auto_brightness_detail.xml b/res/xml/auto_brightness_detail.xml
new file mode 100644
index 0000000..aca9f14
--- /dev/null
+++ b/res/xml/auto_brightness_detail.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 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.
+ -->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:key="auto_brightness_detail"
+ android:title="@string/auto_brightness_title"
+ settings:keywords="@string/keywords_display_auto_brightness">
+
+ <com.android.settings.widget.VideoPreference
+ android:key="auto_brightness_video"
+ settings:animation="@raw/aab_brightness"
+ settings:preview="@drawable/aab_brightness"/>
+
+ <!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml -->
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="auto_brightness"
+ android:title="@string/auto_brightness_title"
+ settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
+ settings:useAdminDisabledSummary="true"
+ settings:userRestriction="no_config_brightness" />
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index eaa4a6b..90198ae 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -39,15 +39,12 @@
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 -->
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="auto_brightness"
+ <Preference
+ android:key="auto_brightness_entry"
android:title="@string/auto_brightness_title"
android:summary="@string/auto_brightness_summary"
- settings:keywords="@string/keywords_display_auto_brightness"
- settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"
- settings:useAdminDisabledSummary="true"
- settings:userRestriction="no_config_brightness" />
+ android:fragment="com.android.settings.display.AutoBrightnessSettings"
+ settings:controller="com.android.settings.display.AutoBrightnessPreferenceController" />
<com.android.settingslib.RestrictedPreference
android:key="wallpaper"
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index d8bd447..fef56ad 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -23,7 +23,6 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.display.AmbientDisplayPreferenceController;
-import com.android.settings.display.AutoRotatePreferenceController;
import com.android.settings.display.BrightnessLevelPreferenceController;
import com.android.settings.display.CameraGesturePreferenceController;
import com.android.settings.display.ColorModePreferenceController;
@@ -52,7 +51,7 @@
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
private static final String KEY_AMBIENT_DISPLAY = "ambient_display";
-
+ private static final String KEY_AUTO_BRIGHTNESS = "auto_brightness_entry";
private static final String KEY_NIGHT_DISPLAY = "night_display";
@Override
@@ -122,6 +121,7 @@
keys.add(KEY_DISPLAY_SIZE);
keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
keys.add(KEY_NIGHT_DISPLAY);
+ keys.add(KEY_AUTO_BRIGHTNESS);
return keys;
}
diff --git a/src/com/android/settings/display/AutoBrightnessSettings.java b/src/com/android/settings/display/AutoBrightnessSettings.java
new file mode 100644
index 0000000..778acf6
--- /dev/null
+++ b/src/com/android/settings/display/AutoBrightnessSettings.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2018 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 android.os.Bundle;
+import android.provider.SearchIndexableResource;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class AutoBrightnessSettings extends DashboardFragment {
+
+ private static final String TAG = "AutoBrightnessSettings";
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ mFooterPreferenceMixin.createFooterPreference()
+ .setTitle(R.string.auto_brightness_description);
+ }
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.auto_brightness_detail;
+ }
+
+ @Override
+ protected String getLogTag() {
+ return TAG;
+ }
+
+ @Override
+ public int getMetricsCategory() {
+ return MetricsProto.MetricsEvent.SETTINGS_AUTO_BRIGHTNESS;
+ }
+
+ @Override
+ public int getHelpResource() {
+ return R.string.help_url_auto_brightness;
+ }
+
+ public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+ new BaseSearchIndexProvider() {
+ @Override
+ public List<SearchIndexableResource> getXmlResourcesToIndex(
+ Context context, boolean enabled) {
+ final SearchIndexableResource sir = new SearchIndexableResource(context);
+ sir.xmlResId = R.xml.auto_brightness_detail;
+ return Arrays.asList(sir);
+ }
+ };
+}
diff --git a/src/com/android/settings/fuelgauge/SmartBatterySettings.java b/src/com/android/settings/fuelgauge/SmartBatterySettings.java
index 43ac960..bcbac3f 100644
--- a/src/com/android/settings/fuelgauge/SmartBatterySettings.java
+++ b/src/com/android/settings/fuelgauge/SmartBatterySettings.java
@@ -27,7 +27,6 @@
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.widget.FooterPreferenceMixin;
import java.util.ArrayList;
import java.util.Arrays;
@@ -39,9 +38,6 @@
public class SmartBatterySettings extends DashboardFragment {
public static final String TAG = "SmartBatterySettings";
- private final FooterPreferenceMixin mFooterPreferenceMixin =
- new FooterPreferenceMixin(this, getLifecycle());
-
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -94,11 +90,6 @@
}
@Override
- public List<String> getNonIndexableKeys(Context context) {
- return super.getNonIndexableKeys(context);
- }
-
- @Override
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {
return buildPreferenceControllers(context, null, null);
diff --git a/src/com/android/settings/search/SearchIndexableResourcesImpl.java b/src/com/android/settings/search/SearchIndexableResourcesImpl.java
index 78b18a6..decfe33 100644
--- a/src/com/android/settings/search/SearchIndexableResourcesImpl.java
+++ b/src/com/android/settings/search/SearchIndexableResourcesImpl.java
@@ -44,6 +44,7 @@
import com.android.settings.deviceinfo.StorageDashboardFragment;
import com.android.settings.deviceinfo.StorageSettings;
import com.android.settings.display.AmbientDisplaySettings;
+import com.android.settings.display.AutoBrightnessSettings;
import com.android.settings.display.NightDisplaySettings;
import com.android.settings.display.ScreenZoomSettings;
import com.android.settings.dream.DreamSettings;
@@ -114,6 +115,7 @@
addIndex(DataUsageSummaryLegacy.class);
addIndex(ScreenZoomSettings.class);
addIndex(DisplaySettings.class);
+ addIndex(AutoBrightnessSettings.class);
addIndex(AmbientDisplaySettings.class);
addIndex(WallpaperTypeSettings.class);
addIndex(AppAndNotificationDashboardFragment.class);