1 /* 2 * Copyright (C) 2014 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.search; 18 19 import android.provider.SearchIndexableResource; 20 import com.android.settings.DateTimeSettings; 21 import com.android.settings.DevelopmentSettings; 22 import com.android.settings.DeviceInfoSettings; 23 import com.android.settings.DisplaySettings; 24 import com.android.settings.LegalSettings; 25 import com.android.settings.PrivacySettings; 26 import com.android.settings.R; 27 import com.android.settings.ScreenPinningSettings; 28 import com.android.settings.SecuritySettings; 29 import com.android.settings.WallpaperTypeSettings; 30 import com.android.settings.WirelessSettings; 31 import com.android.settings.accessibility.AccessibilitySettings; 32 import com.android.settings.accounts.AccountSettings; 33 import com.android.settings.applications.AdvancedAppSettings; 34 import com.android.settings.applications.SpecialAccessSettings; 35 import com.android.settings.bluetooth.BluetoothSettings; 36 import com.android.settings.datausage.DataUsageMeteredSettings; 37 import com.android.settings.datausage.DataUsageSummary; 38 import com.android.settings.deviceinfo.StorageSettings; 39 import com.android.settings.display.ScreenZoomSettings; 40 import com.android.settings.fuelgauge.BatterySaverSettings; 41 import com.android.settings.fuelgauge.PowerUsageSummary; 42 import com.android.settings.inputmethod.InputMethodAndLanguageSettings; 43 import com.android.settings.location.LocationSettings; 44 import com.android.settings.location.ScanningSettings; 45 import com.android.settings.notification.ConfigureNotificationSettings; 46 import com.android.settings.notification.OtherSoundSettings; 47 import com.android.settings.notification.SoundSettings; 48 import com.android.settings.notification.ZenModePrioritySettings; 49 import com.android.settings.notification.ZenModeSettings; 50 import com.android.settings.notification.ZenModeVisualInterruptionSettings; 51 import com.android.settings.print.PrintSettingsFragment; 52 import com.android.settings.sim.SimSettings; 53 import com.android.settings.users.UserSettings; 54 import com.android.settings.wifi.AdvancedWifiSettings; 55 import com.android.settings.wifi.SavedAccessPointsWifiSettings; 56 import com.android.settings.wifi.WifiSettings; 57 58 import java.util.Collection; 59 import java.util.HashMap; 60 61 public final class SearchIndexableResources { 62 63 public static int NO_DATA_RES_ID = 0; 64 65 private static HashMap<String, SearchIndexableResource> sResMap = 66 new HashMap<String, SearchIndexableResource>(); 67 68 static { WifiSettings.class.getName()69 sResMap.put(WifiSettings.class.getName(), 70 new SearchIndexableResource( 71 Ranking.getRankForClassName(WifiSettings.class.getName()), 72 NO_DATA_RES_ID, 73 WifiSettings.class.getName(), 74 R.drawable.ic_settings_wireless)); 75 AdvancedWifiSettings.class.getName()76 sResMap.put(AdvancedWifiSettings.class.getName(), 77 new SearchIndexableResource( 78 Ranking.getRankForClassName(AdvancedWifiSettings.class.getName()), 79 R.xml.wifi_advanced_settings, 80 AdvancedWifiSettings.class.getName(), 81 R.drawable.ic_settings_wireless)); 82 SavedAccessPointsWifiSettings.class.getName()83 sResMap.put(SavedAccessPointsWifiSettings.class.getName(), 84 new SearchIndexableResource( 85 Ranking.getRankForClassName(SavedAccessPointsWifiSettings.class.getName()), 86 R.xml.wifi_display_saved_access_points, 87 SavedAccessPointsWifiSettings.class.getName(), 88 R.drawable.ic_settings_wireless)); 89 BluetoothSettings.class.getName()90 sResMap.put(BluetoothSettings.class.getName(), 91 new SearchIndexableResource( 92 Ranking.getRankForClassName(BluetoothSettings.class.getName()), 93 NO_DATA_RES_ID, 94 BluetoothSettings.class.getName(), 95 R.drawable.ic_settings_bluetooth)); 96 SimSettings.class.getName()97 sResMap.put(SimSettings.class.getName(), 98 new SearchIndexableResource( 99 Ranking.getRankForClassName(SimSettings.class.getName()), 100 NO_DATA_RES_ID, 101 SimSettings.class.getName(), 102 R.drawable.ic_sim_sd)); 103 DataUsageSummary.class.getName()104 sResMap.put(DataUsageSummary.class.getName(), 105 new SearchIndexableResource( 106 Ranking.getRankForClassName(DataUsageSummary.class.getName()), 107 NO_DATA_RES_ID, 108 DataUsageSummary.class.getName(), 109 R.drawable.ic_settings_data_usage)); 110 DataUsageMeteredSettings.class.getName()111 sResMap.put(DataUsageMeteredSettings.class.getName(), 112 new SearchIndexableResource( 113 Ranking.getRankForClassName(DataUsageMeteredSettings.class.getName()), 114 NO_DATA_RES_ID, 115 DataUsageMeteredSettings.class.getName(), 116 R.drawable.ic_settings_data_usage)); 117 WirelessSettings.class.getName()118 sResMap.put(WirelessSettings.class.getName(), 119 new SearchIndexableResource( 120 Ranking.getRankForClassName(WirelessSettings.class.getName()), 121 NO_DATA_RES_ID, 122 WirelessSettings.class.getName(), 123 R.drawable.ic_settings_more)); 124 ScreenZoomSettings.class.getName()125 sResMap.put(ScreenZoomSettings.class.getName(), 126 new SearchIndexableResource( 127 Ranking.getRankForClassName(ScreenZoomSettings.class.getName()), 128 NO_DATA_RES_ID, 129 ScreenZoomSettings.class.getName(), 130 R.drawable.ic_settings_display)); 131 DisplaySettings.class.getName()132 sResMap.put(DisplaySettings.class.getName(), 133 new SearchIndexableResource( 134 Ranking.getRankForClassName(DisplaySettings.class.getName()), 135 NO_DATA_RES_ID, 136 DisplaySettings.class.getName(), 137 R.drawable.ic_settings_display)); 138 WallpaperTypeSettings.class.getName()139 sResMap.put(WallpaperTypeSettings.class.getName(), 140 new SearchIndexableResource( 141 Ranking.getRankForClassName(WallpaperTypeSettings.class.getName()), 142 NO_DATA_RES_ID, 143 WallpaperTypeSettings.class.getName(), 144 R.drawable.ic_settings_display)); 145 ConfigureNotificationSettings.class.getName()146 sResMap.put(ConfigureNotificationSettings.class.getName(), 147 new SearchIndexableResource( 148 Ranking.getRankForClassName(ConfigureNotificationSettings.class.getName()), 149 R.xml.configure_notification_settings, 150 ConfigureNotificationSettings.class.getName(), 151 R.drawable.ic_settings_notifications)); 152 SoundSettings.class.getName()153 sResMap.put(SoundSettings.class.getName(), 154 new SearchIndexableResource( 155 Ranking.getRankForClassName(SoundSettings.class.getName()), 156 NO_DATA_RES_ID, 157 SoundSettings.class.getName(), 158 R.drawable.ic_settings_sound)); 159 OtherSoundSettings.class.getName()160 sResMap.put(OtherSoundSettings.class.getName(), 161 new SearchIndexableResource( 162 Ranking.getRankForClassName(OtherSoundSettings.class.getName()), 163 NO_DATA_RES_ID, 164 OtherSoundSettings.class.getName(), 165 R.drawable.ic_settings_sound)); 166 ZenModeSettings.class.getName()167 sResMap.put(ZenModeSettings.class.getName(), 168 new SearchIndexableResource( 169 Ranking.getRankForClassName(ZenModeSettings.class.getName()), 170 R.xml.zen_mode_settings, 171 ZenModeSettings.class.getName(), 172 R.drawable.ic_settings_notifications)); 173 ZenModePrioritySettings.class.getName()174 sResMap.put(ZenModePrioritySettings.class.getName(), 175 new SearchIndexableResource( 176 Ranking.getRankForClassName(ZenModePrioritySettings.class.getName()), 177 R.xml.zen_mode_priority_settings, 178 ZenModePrioritySettings.class.getName(), 179 R.drawable.ic_settings_notifications)); 180 StorageSettings.class.getName()181 sResMap.put(StorageSettings.class.getName(), 182 new SearchIndexableResource( 183 Ranking.getRankForClassName(StorageSettings.class.getName()), 184 NO_DATA_RES_ID, 185 StorageSettings.class.getName(), 186 R.drawable.ic_settings_storage)); 187 PowerUsageSummary.class.getName()188 sResMap.put(PowerUsageSummary.class.getName(), 189 new SearchIndexableResource( 190 Ranking.getRankForClassName(PowerUsageSummary.class.getName()), 191 R.xml.power_usage_summary, 192 PowerUsageSummary.class.getName(), 193 R.drawable.ic_settings_battery)); 194 BatterySaverSettings.class.getName()195 sResMap.put(BatterySaverSettings.class.getName(), 196 new SearchIndexableResource( 197 Ranking.getRankForClassName(BatterySaverSettings.class.getName()), 198 R.xml.battery_saver_settings, 199 BatterySaverSettings.class.getName(), 200 R.drawable.ic_settings_battery)); 201 AdvancedAppSettings.class.getName()202 sResMap.put(AdvancedAppSettings.class.getName(), 203 new SearchIndexableResource( 204 Ranking.getRankForClassName(AdvancedAppSettings.class.getName()), 205 NO_DATA_RES_ID, 206 AdvancedAppSettings.class.getName(), 207 R.drawable.ic_settings_applications)); 208 SpecialAccessSettings.class.getName()209 sResMap.put(SpecialAccessSettings.class.getName(), 210 new SearchIndexableResource( 211 Ranking.getRankForClassName(SpecialAccessSettings.class.getName()), 212 R.xml.special_access, 213 SpecialAccessSettings.class.getName(), 214 R.drawable.ic_settings_applications)); 215 UserSettings.class.getName()216 sResMap.put(UserSettings.class.getName(), 217 new SearchIndexableResource( 218 Ranking.getRankForClassName(UserSettings.class.getName()), 219 NO_DATA_RES_ID, 220 UserSettings.class.getName(), 221 R.drawable.ic_settings_multiuser)); 222 LocationSettings.class.getName()223 sResMap.put(LocationSettings.class.getName(), 224 new SearchIndexableResource( 225 Ranking.getRankForClassName(LocationSettings.class.getName()), 226 R.xml.location_settings, 227 LocationSettings.class.getName(), 228 R.drawable.ic_settings_location)); 229 ScanningSettings.class.getName()230 sResMap.put(ScanningSettings.class.getName(), 231 new SearchIndexableResource( 232 Ranking.getRankForClassName(ScanningSettings.class.getName()), 233 R.xml.location_scanning, 234 ScanningSettings.class.getName(), 235 R.drawable.ic_settings_location)); 236 SecuritySettings.class.getName()237 sResMap.put(SecuritySettings.class.getName(), 238 new SearchIndexableResource( 239 Ranking.getRankForClassName(SecuritySettings.class.getName()), 240 NO_DATA_RES_ID, 241 SecuritySettings.class.getName(), 242 R.drawable.ic_settings_security)); 243 ScreenPinningSettings.class.getName()244 sResMap.put(ScreenPinningSettings.class.getName(), 245 new SearchIndexableResource( 246 Ranking.getRankForClassName(ScreenPinningSettings.class.getName()), 247 NO_DATA_RES_ID, 248 ScreenPinningSettings.class.getName(), 249 R.drawable.ic_settings_security)); 250 AccountSettings.class.getName()251 sResMap.put(AccountSettings.class.getName(), 252 new SearchIndexableResource( 253 Ranking.getRankForClassName(AccountSettings.class.getName()), 254 NO_DATA_RES_ID, 255 AccountSettings.class.getName(), 256 R.drawable.ic_settings_accounts)); 257 InputMethodAndLanguageSettings.class.getName()258 sResMap.put(InputMethodAndLanguageSettings.class.getName(), 259 new SearchIndexableResource( 260 Ranking.getRankForClassName(InputMethodAndLanguageSettings.class.getName()), 261 NO_DATA_RES_ID, 262 InputMethodAndLanguageSettings.class.getName(), 263 R.drawable.ic_settings_language)); 264 PrivacySettings.class.getName()265 sResMap.put(PrivacySettings.class.getName(), 266 new SearchIndexableResource( 267 Ranking.getRankForClassName(PrivacySettings.class.getName()), 268 NO_DATA_RES_ID, 269 PrivacySettings.class.getName(), 270 R.drawable.ic_settings_backup)); 271 DateTimeSettings.class.getName()272 sResMap.put(DateTimeSettings.class.getName(), 273 new SearchIndexableResource( 274 Ranking.getRankForClassName(DateTimeSettings.class.getName()), 275 R.xml.date_time_prefs, 276 DateTimeSettings.class.getName(), 277 R.drawable.ic_settings_date_time)); 278 AccessibilitySettings.class.getName()279 sResMap.put(AccessibilitySettings.class.getName(), 280 new SearchIndexableResource( 281 Ranking.getRankForClassName(AccessibilitySettings.class.getName()), 282 NO_DATA_RES_ID, 283 AccessibilitySettings.class.getName(), 284 R.drawable.ic_settings_accessibility)); 285 PrintSettingsFragment.class.getName()286 sResMap.put(PrintSettingsFragment.class.getName(), 287 new SearchIndexableResource( 288 Ranking.getRankForClassName(PrintSettingsFragment.class.getName()), 289 NO_DATA_RES_ID, 290 PrintSettingsFragment.class.getName(), 291 R.drawable.ic_settings_print)); 292 DevelopmentSettings.class.getName()293 sResMap.put(DevelopmentSettings.class.getName(), 294 new SearchIndexableResource( 295 Ranking.getRankForClassName(DevelopmentSettings.class.getName()), 296 NO_DATA_RES_ID, 297 DevelopmentSettings.class.getName(), 298 R.drawable.ic_settings_development)); 299 DeviceInfoSettings.class.getName()300 sResMap.put(DeviceInfoSettings.class.getName(), 301 new SearchIndexableResource( 302 Ranking.getRankForClassName(DeviceInfoSettings.class.getName()), 303 NO_DATA_RES_ID, 304 DeviceInfoSettings.class.getName(), 305 R.drawable.ic_settings_about)); 306 LegalSettings.class.getName()307 sResMap.put(LegalSettings.class.getName(), 308 new SearchIndexableResource( 309 Ranking.getRankForClassName(LegalSettings.class.getName()), 310 NO_DATA_RES_ID, 311 LegalSettings.class.getName(), 312 R.drawable.ic_settings_about)); 313 ZenModeVisualInterruptionSettings.class.getName()314 sResMap.put(ZenModeVisualInterruptionSettings.class.getName(), 315 new SearchIndexableResource( 316 Ranking.getRankForClassName( 317 ZenModeVisualInterruptionSettings.class.getName()), 318 R.xml.zen_mode_visual_interruptions_settings, 319 ZenModeVisualInterruptionSettings.class.getName(), 320 R.drawable.ic_settings_notifications)); 321 } 322 SearchIndexableResources()323 private SearchIndexableResources() { 324 } 325 size()326 public static int size() { 327 return sResMap.size(); 328 } 329 getResourceByName(String className)330 public static SearchIndexableResource getResourceByName(String className) { 331 return sResMap.get(className); 332 } 333 values()334 public static Collection<SearchIndexableResource> values() { 335 return sResMap.values(); 336 } 337 } 338