Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.settings; |
| 18 | |
Fan Zhang | 31b2100 | 2019-01-16 13:49:47 -0800 | [diff] [blame] | 19 | import android.app.settings.SettingsEnums; |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 20 | import android.content.Context; |
Salvador Martinez | ef7ce46 | 2019-04-11 14:06:08 -0700 | [diff] [blame] | 21 | import android.os.Bundle; |
Jason Monk | 1230ac8 | 2015-12-11 20:14:43 -0500 | [diff] [blame] | 22 | |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 23 | import com.android.settings.dashboard.DashboardFragment; |
Doris Ling | 2e4ff90 | 2017-04-13 15:06:36 -0700 | [diff] [blame] | 24 | import com.android.settings.display.BrightnessLevelPreferenceController; |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 25 | import com.android.settings.display.CameraGesturePreferenceController; |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 26 | import com.android.settings.display.LiftToWakePreferenceController; |
| 27 | import com.android.settings.display.NightDisplayPreferenceController; |
| 28 | import com.android.settings.display.NightModePreferenceController; |
| 29 | import com.android.settings.display.ScreenSaverPreferenceController; |
Yoshinori Hirano | 53cfd11 | 2017-10-10 13:57:07 +0900 | [diff] [blame] | 30 | import com.android.settings.display.ShowOperatorNamePreferenceController; |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 31 | import com.android.settings.display.TapToWakePreferenceController; |
Jason Monk | 6324cff | 2017-01-25 10:34:29 -0500 | [diff] [blame] | 32 | import com.android.settings.display.ThemePreferenceController; |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 33 | import com.android.settings.display.TimeoutPreferenceController; |
| 34 | import com.android.settings.display.VrDisplayPreferenceController; |
Jason Monk | 49b6103 | 2015-08-12 11:31:29 -0400 | [diff] [blame] | 35 | import com.android.settings.search.BaseSearchIndexProvider; |
Tony Mantler | 1d583e1 | 2017-06-13 13:09:25 -0700 | [diff] [blame] | 36 | import com.android.settingslib.core.AbstractPreferenceController; |
Juan Lang | 777ed25 | 2017-05-09 15:42:36 -0700 | [diff] [blame] | 37 | import com.android.settingslib.core.lifecycle.Lifecycle; |
Tony Mantler | 0fcd6cb | 2018-03-26 15:17:25 -0700 | [diff] [blame] | 38 | import com.android.settingslib.search.SearchIndexable; |
Jason Monk | 49b6103 | 2015-08-12 11:31:29 -0400 | [diff] [blame] | 39 | |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 40 | import java.util.ArrayList; |
Adrian Roos | 8ab0954 | 2014-06-02 20:33:56 +0200 | [diff] [blame] | 41 | import java.util.List; |
Amith Yamasani | d799347 | 2010-08-18 13:59:28 -0700 | [diff] [blame] | 42 | |
Tony Mantler | 0fcd6cb | 2018-03-26 15:17:25 -0700 | [diff] [blame] | 43 | @SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC) |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 44 | public class DisplaySettings extends DashboardFragment { |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 45 | private static final String TAG = "DisplaySettings"; |
| 46 | |
Matthew Fritze | c6f2638 | 2017-04-11 13:22:40 -0700 | [diff] [blame] | 47 | private static final String KEY_SCREEN_TIMEOUT = "screen_timeout"; |
Matthew Fritze | c448863 | 2017-11-28 14:36:35 -0800 | [diff] [blame] | 48 | |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 49 | @Override |
Fan Zhang | 6507613 | 2016-08-08 10:25:13 -0700 | [diff] [blame] | 50 | public int getMetricsCategory() { |
Fan Zhang | 31b2100 | 2019-01-16 13:49:47 -0800 | [diff] [blame] | 51 | return SettingsEnums.DISPLAY; |
Chris Wren | 8a963ba | 2015-03-20 10:29:14 -0400 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | @Override |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 55 | protected String getLogTag() { |
| 56 | return TAG; |
Stephen Chen | 2b98ffa | 2016-09-20 13:15:11 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 59 | @Override |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 60 | protected int getPreferenceScreenResId() { |
Raff Tsai | 966fa01 | 2019-09-25 11:19:06 +0800 | [diff] [blame] | 61 | return R.xml.display_settings; |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 62 | } |
Jeff Brown | 9e143f5 | 2012-09-19 20:46:07 -0700 | [diff] [blame] | 63 | |
Amith Yamasani | 9627a8e | 2012-09-23 12:54:14 -0700 | [diff] [blame] | 64 | @Override |
Salvador Martinez | ef7ce46 | 2019-04-11 14:06:08 -0700 | [diff] [blame] | 65 | public void onCreate(Bundle icicle) { |
| 66 | super.onCreate(icicle); |
Salvador Martinez | ef7ce46 | 2019-04-11 14:06:08 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | @Override |
Fan Zhang | f7843ad | 2018-02-22 13:51:41 -0800 | [diff] [blame] | 70 | protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { |
tmfang | 27c84de | 2018-06-28 11:39:05 +0800 | [diff] [blame] | 71 | return buildPreferenceControllers(context, getSettingsLifecycle()); |
Fan Zhang | b00811d | 2017-02-28 10:52:46 -0800 | [diff] [blame] | 72 | } |
| 73 | |
| 74 | @Override |
Fan Zhang | e0b0e9f | 2017-11-29 14:55:59 -0800 | [diff] [blame] | 75 | public int getHelpResource() { |
Fan Zhang | b00811d | 2017-02-28 10:52:46 -0800 | [diff] [blame] | 76 | return R.string.help_uri_display; |
| 77 | } |
| 78 | |
Tony Mantler | 1d583e1 | 2017-06-13 13:09:25 -0700 | [diff] [blame] | 79 | private static List<AbstractPreferenceController> buildPreferenceControllers( |
Andrew Sapperstein | 6138f1a | 2017-03-22 18:00:47 -0700 | [diff] [blame] | 80 | Context context, Lifecycle lifecycle) { |
Tony Mantler | 1d583e1 | 2017-06-13 13:09:25 -0700 | [diff] [blame] | 81 | final List<AbstractPreferenceController> controllers = new ArrayList<>(); |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 82 | controllers.add(new CameraGesturePreferenceController(context)); |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 83 | controllers.add(new LiftToWakePreferenceController(context)); |
| 84 | controllers.add(new NightDisplayPreferenceController(context)); |
| 85 | controllers.add(new NightModePreferenceController(context)); |
| 86 | controllers.add(new ScreenSaverPreferenceController(context)); |
| 87 | controllers.add(new TapToWakePreferenceController(context)); |
Matthew Fritze | c6f2638 | 2017-04-11 13:22:40 -0700 | [diff] [blame] | 88 | controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT)); |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 89 | controllers.add(new VrDisplayPreferenceController(context)); |
Yoshinori Hirano | 53cfd11 | 2017-10-10 13:57:07 +0900 | [diff] [blame] | 90 | controllers.add(new ShowOperatorNamePreferenceController(context)); |
Jason Monk | 6324cff | 2017-01-25 10:34:29 -0500 | [diff] [blame] | 91 | controllers.add(new ThemePreferenceController(context)); |
Doris Ling | 2e4ff90 | 2017-04-13 15:06:36 -0700 | [diff] [blame] | 92 | controllers.add(new BrightnessLevelPreferenceController(context, lifecycle)); |
Fan Zhang | 66b573a | 2016-10-06 16:33:13 -0700 | [diff] [blame] | 93 | return controllers; |
Doris Ling | b727e9c | 2016-08-01 14:56:26 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Raff Tsai | ac3e0d0 | 2019-09-19 17:06:45 +0800 | [diff] [blame] | 96 | public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = |
Raff Tsai | 1f30b1c | 2019-09-12 10:56:13 +0800 | [diff] [blame] | 97 | new BaseSearchIndexProvider(R.xml.display_settings) { |
Adrian Roos | 8ab0954 | 2014-06-02 20:33:56 +0200 | [diff] [blame] | 98 | |
| 99 | @Override |
Fan Zhang | aed8994 | 2018-02-22 13:32:32 -0800 | [diff] [blame] | 100 | public List<AbstractPreferenceController> createPreferenceControllers( |
| 101 | Context context) { |
Andrew Sapperstein | 6138f1a | 2017-03-22 18:00:47 -0700 | [diff] [blame] | 102 | return buildPreferenceControllers(context, null); |
Matthew Fritze | 516b0f1 | 2017-01-26 14:37:48 -0800 | [diff] [blame] | 103 | } |
Adrian Roos | 8ab0954 | 2014-06-02 20:33:56 +0200 | [diff] [blame] | 104 | }; |
Amith Yamasani | 992f102 | 2010-01-25 09:17:53 -0800 | [diff] [blame] | 105 | } |