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)
This commit is contained in:
Fan Zhang
2018-04-10 13:08:22 -07:00
parent 8064782d77
commit 3dfcb3b326
9 changed files with 120 additions and 18 deletions

View File

View File

View File

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

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: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"

View File

@@ -23,7 +23,6 @@ import com.android.internal.hardware.AmbientDisplayConfiguration;
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 @@ public class DisplaySettings extends DashboardFragment {
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 @@ public class DisplaySettings extends DashboardFragment {
keys.add(KEY_DISPLAY_SIZE);
keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
keys.add(KEY_NIGHT_DISPLAY);
keys.add(KEY_AUTO_BRIGHTNESS);
return keys;
}

View File

@@ -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);
}
};
}

View File

@@ -27,7 +27,6 @@ import com.android.settings.core.InstrumentedPreferenceFragment;
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 @@ import java.util.List;
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);
@@ -93,11 +89,6 @@ public class SmartBatterySettings extends DashboardFragment {
return Arrays.asList(sir);
}
@Override
public List<String> getNonIndexableKeys(Context context) {
return super.getNonIndexableKeys(context);
}
@Override
public List<AbstractPreferenceController> createPreferenceControllers(
Context context) {

View File

@@ -44,6 +44,7 @@ import com.android.settings.deviceinfo.DeviceInfoSettings;
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 @@ public class SearchIndexableResourcesImpl implements SearchIndexableResources {
addIndex(DataUsageSummaryLegacy.class);
addIndex(ScreenZoomSettings.class);
addIndex(DisplaySettings.class);
addIndex(AutoBrightnessSettings.class);
addIndex(AmbientDisplaySettings.class);
addIndex(WallpaperTypeSettings.class);
addIndex(AppAndNotificationDashboardFragment.class);