Convert auto-brightness switch to a full screen UI.

Change-Id: Id5e5ec959201102a7c60372a441dc6813ceedbae
Bug: 69795935
Test: Existing conformance tests still pass (CodeInspectionTest,
      UniquePreferenceTest, manual search test)
This commit is contained in:
Fan Zhang
2018-04-10 13:08:22 -07:00
parent 9f2a9e431d
commit 89f668ce29
8 changed files with 120 additions and 18 deletions

View File

View File

View File

@@ -6664,6 +6664,8 @@
<string name="help_url_font_size" translatable="false"></string> <string name="help_url_font_size" translatable="false"></string>
<!-- Help URL, Display size [DO NOT TRANSLATE] --> <!-- Help URL, Display size [DO NOT TRANSLATE] -->
<string name="help_url_display_size" translatable="false"></string> <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_network_dashboard" translatable="false"></string>
<string name="help_url_connected_devices" translatable="false"></string> <string name="help_url_connected_devices" translatable="false"></string>

View File

@@ -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>

View File

@@ -39,15 +39,12 @@
settings:widgetLayout="@null" settings:widgetLayout="@null"
settings:keywords="@string/keywords_display_night_display" /> settings:keywords="@string/keywords_display_night_display" />
<!-- Cross-listed item, if you change this, also change it in power_usage_summary.xml --> <Preference
<com.android.settingslib.RestrictedSwitchPreference android:key="auto_brightness_entry"
android:key="auto_brightness"
android:title="@string/auto_brightness_title" android:title="@string/auto_brightness_title"
android:summary="@string/auto_brightness_summary" android:summary="@string/auto_brightness_summary"
settings:keywords="@string/keywords_display_auto_brightness" android:fragment="com.android.settings.display.AutoBrightnessSettings"
settings:controller="com.android.settings.display.AutoBrightnessPreferenceController" settings:controller="com.android.settings.display.AutoBrightnessPreferenceController" />
settings:useAdminDisabledSummary="true"
settings:userRestriction="no_config_brightness" />
<com.android.settingslib.RestrictedPreference <com.android.settingslib.RestrictedPreference
android:key="wallpaper" android:key="wallpaper"

View File

@@ -23,7 +23,6 @@ import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.dashboard.DashboardFragment; import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.display.AmbientDisplayPreferenceController; import com.android.settings.display.AmbientDisplayPreferenceController;
import com.android.settings.display.AutoRotatePreferenceController;
import com.android.settings.display.BrightnessLevelPreferenceController; import com.android.settings.display.BrightnessLevelPreferenceController;
import com.android.settings.display.CameraGesturePreferenceController; import com.android.settings.display.CameraGesturePreferenceController;
import com.android.settings.display.ColorModePreferenceController; import com.android.settings.display.ColorModePreferenceController;
@@ -54,7 +53,7 @@ public class DisplaySettings extends DashboardFragment {
private static final String KEY_SCREEN_TIMEOUT = "screen_timeout"; private static final String KEY_SCREEN_TIMEOUT = "screen_timeout";
private static final String KEY_AMBIENT_DISPLAY = "ambient_display"; 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"; private static final String KEY_NIGHT_DISPLAY = "night_display";
@Override @Override
@@ -124,6 +123,7 @@ public class DisplaySettings extends DashboardFragment {
keys.add(KEY_DISPLAY_SIZE); keys.add(KEY_DISPLAY_SIZE);
keys.add(WallpaperPreferenceController.KEY_WALLPAPER); keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
keys.add(KEY_NIGHT_DISPLAY); keys.add(KEY_NIGHT_DISPLAY);
keys.add(KEY_AUTO_BRIGHTNESS);
return keys; return keys;
} }

View File

@@ -0,0 +1,74 @@
/*
* 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 com.android.settingslib.search.SearchIndexable;
import java.util.Arrays;
import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
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);
}
};
}

View File

@@ -28,7 +28,6 @@ import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.widget.FooterPreferenceMixin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@@ -41,9 +40,6 @@ import java.util.List;
public class SmartBatterySettings extends DashboardFragment { public class SmartBatterySettings extends DashboardFragment {
public static final String TAG = "SmartBatterySettings"; public static final String TAG = "SmartBatterySettings";
private final FooterPreferenceMixin mFooterPreferenceMixin =
new FooterPreferenceMixin(this, getLifecycle());
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
@@ -95,11 +91,6 @@ public class SmartBatterySettings extends DashboardFragment {
return Arrays.asList(sir); return Arrays.asList(sir);
} }
@Override
public List<String> getNonIndexableKeys(Context context) {
return super.getNonIndexableKeys(context);
}
@Override @Override
public List<AbstractPreferenceController> createPreferenceControllers( public List<AbstractPreferenceController> createPreferenceControllers(
Context context) { Context context) {