blob: bacaf439bafe07adf50e74ab2630622c04fb0ac5 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 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
17package android.provider;
18
19import com.google.android.collect.Maps;
20
21import org.apache.commons.codec.binary.Base64;
22
23import android.annotation.SdkConstant;
24import android.annotation.SdkConstant.SdkConstantType;
25import android.content.ContentQueryMap;
26import android.content.ContentResolver;
27import android.content.ContentValues;
28import android.content.Context;
29import android.content.Intent;
30import android.content.pm.PackageManager;
31import android.content.pm.ResolveInfo;
32import android.content.res.Configuration;
33import android.content.res.Resources;
34import android.database.Cursor;
35import android.database.SQLException;
36import android.net.Uri;
37import android.os.*;
38import android.telephony.TelephonyManager;
39import android.text.TextUtils;
40import android.util.AndroidException;
Dan Egnor799f7212009-11-24 16:24:44 -080041import android.util.Config;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.Log;
43
44import java.net.URISyntaxException;
45import java.security.MessageDigest;
46import java.security.NoSuchAlgorithmException;
Vasu Nori272af002009-11-04 16:26:55 -080047import java.util.Collections;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import java.util.HashMap;
49import java.util.HashSet;
Vasu Nori272af002009-11-04 16:26:55 -080050import java.util.Map;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
52
53/**
54 * The Settings provider contains global system-level device preferences.
55 */
56public final class Settings {
57
58 // Intent actions for Settings
59
60 /**
61 * Activity Action: Show system settings.
62 * <p>
63 * Input: Nothing.
64 * <p>
65 * Output: nothing.
66 */
67 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
68 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
69
70 /**
71 * Activity Action: Show settings to allow configuration of APNs.
72 * <p>
73 * Input: Nothing.
74 * <p>
75 * Output: nothing.
76 */
77 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
78 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
79
80 /**
81 * Activity Action: Show settings to allow configuration of current location
82 * sources.
83 * <p>
84 * In some cases, a matching Activity may not exist, so ensure you
85 * safeguard against this.
86 * <p>
87 * Input: Nothing.
88 * <p>
89 * Output: Nothing.
90 */
91 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
92 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
93 "android.settings.LOCATION_SOURCE_SETTINGS";
94
95 /**
96 * Activity Action: Show settings to allow configuration of wireless controls
97 * such as Wi-Fi, Bluetooth and Mobile networks.
98 * <p>
99 * In some cases, a matching Activity may not exist, so ensure you
100 * safeguard against this.
101 * <p>
102 * Input: Nothing.
103 * <p>
104 * Output: Nothing.
105 */
106 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
107 public static final String ACTION_WIRELESS_SETTINGS =
108 "android.settings.WIRELESS_SETTINGS";
109
110 /**
111 * Activity Action: Show settings to allow entering/exiting airplane mode.
112 * <p>
113 * In some cases, a matching Activity may not exist, so ensure you
114 * safeguard against this.
115 * <p>
116 * Input: Nothing.
117 * <p>
118 * Output: Nothing.
119 */
120 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
121 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
122 "android.settings.AIRPLANE_MODE_SETTINGS";
123
124 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700125 * Activity Action: Show settings for accessibility modules.
126 * <p>
127 * In some cases, a matching Activity may not exist, so ensure you
128 * safeguard against this.
129 * <p>
130 * Input: Nothing.
131 * <p>
132 * Output: Nothing.
133 */
134 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
135 public static final String ACTION_ACCESSIBILITY_SETTINGS =
136 "android.settings.ACCESSIBILITY_SETTINGS";
137
138 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 * Activity Action: Show settings to allow configuration of security and
140 * location privacy.
141 * <p>
142 * In some cases, a matching Activity may not exist, so ensure you
143 * safeguard against this.
144 * <p>
145 * Input: Nothing.
146 * <p>
147 * Output: Nothing.
148 */
149 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
150 public static final String ACTION_SECURITY_SETTINGS =
151 "android.settings.SECURITY_SETTINGS";
152
153 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700154 * Activity Action: Show settings to allow configuration of privacy options.
155 * <p>
156 * In some cases, a matching Activity may not exist, so ensure you
157 * safeguard against this.
158 * <p>
159 * Input: Nothing.
160 * <p>
161 * Output: Nothing.
162 */
163 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
164 public static final String ACTION_PRIVACY_SETTINGS =
165 "android.settings.PRIVACY_SETTINGS";
166
167 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 * Activity Action: Show settings to allow configuration of Wi-Fi.
169
170 * <p>
171 * In some cases, a matching Activity may not exist, so ensure you
172 * safeguard against this.
173 * <p>
174 * Input: Nothing.
175 * <p>
176 * Output: Nothing.
177
178 */
179 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
180 public static final String ACTION_WIFI_SETTINGS =
181 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 /**
184 * Activity Action: Show settings to allow configuration of a static IP
185 * address for Wi-Fi.
186 * <p>
187 * In some cases, a matching Activity may not exist, so ensure you safeguard
188 * against this.
189 * <p>
190 * Input: Nothing.
191 * <p>
192 * Output: Nothing.
193 */
194 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
195 public static final String ACTION_WIFI_IP_SETTINGS =
196 "android.settings.WIFI_IP_SETTINGS";
197
198 /**
199 * Activity Action: Show settings to allow configuration of Bluetooth.
200 * <p>
201 * In some cases, a matching Activity may not exist, so ensure you
202 * safeguard against this.
203 * <p>
204 * Input: Nothing.
205 * <p>
206 * Output: Nothing.
207 */
208 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
209 public static final String ACTION_BLUETOOTH_SETTINGS =
210 "android.settings.BLUETOOTH_SETTINGS";
211
212 /**
213 * Activity Action: Show settings to allow configuration of date and time.
214 * <p>
215 * In some cases, a matching Activity may not exist, so ensure you
216 * safeguard against this.
217 * <p>
218 * Input: Nothing.
219 * <p>
220 * Output: Nothing.
221 */
222 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
223 public static final String ACTION_DATE_SETTINGS =
224 "android.settings.DATE_SETTINGS";
225
226 /**
227 * Activity Action: Show settings to allow configuration of sound and volume.
228 * <p>
229 * In some cases, a matching Activity may not exist, so ensure you
230 * safeguard against this.
231 * <p>
232 * Input: Nothing.
233 * <p>
234 * Output: Nothing.
235 */
236 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
237 public static final String ACTION_SOUND_SETTINGS =
238 "android.settings.SOUND_SETTINGS";
239
240 /**
241 * Activity Action: Show settings to allow configuration of display.
242 * <p>
243 * In some cases, a matching Activity may not exist, so ensure you
244 * safeguard against this.
245 * <p>
246 * Input: Nothing.
247 * <p>
248 * Output: Nothing.
249 */
250 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
251 public static final String ACTION_DISPLAY_SETTINGS =
252 "android.settings.DISPLAY_SETTINGS";
253
254 /**
255 * Activity Action: Show settings to allow configuration of locale.
256 * <p>
257 * In some cases, a matching Activity may not exist, so ensure you
258 * safeguard against this.
259 * <p>
260 * Input: Nothing.
261 * <p>
262 * Output: Nothing.
263 */
264 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
265 public static final String ACTION_LOCALE_SETTINGS =
266 "android.settings.LOCALE_SETTINGS";
267
268 /**
269 * Activity Action: Show settings to configure input methods, in particular
270 * allowing the user to enable input methods.
271 * <p>
272 * In some cases, a matching Activity may not exist, so ensure you
273 * safeguard against this.
274 * <p>
275 * Input: Nothing.
276 * <p>
277 * Output: Nothing.
278 */
279 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
280 public static final String ACTION_INPUT_METHOD_SETTINGS =
281 "android.settings.INPUT_METHOD_SETTINGS";
282
283 /**
284 * Activity Action: Show settings to manage the user input dictionary.
285 * <p>
286 * In some cases, a matching Activity may not exist, so ensure you
287 * safeguard against this.
288 * <p>
289 * Input: Nothing.
290 * <p>
291 * Output: Nothing.
292 */
293 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
294 public static final String ACTION_USER_DICTIONARY_SETTINGS =
295 "android.settings.USER_DICTIONARY_SETTINGS";
296
297 /**
298 * Activity Action: Show settings to allow configuration of application-related settings.
299 * <p>
300 * In some cases, a matching Activity may not exist, so ensure you
301 * safeguard against this.
302 * <p>
303 * Input: Nothing.
304 * <p>
305 * Output: Nothing.
306 */
307 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
308 public static final String ACTION_APPLICATION_SETTINGS =
309 "android.settings.APPLICATION_SETTINGS";
310
311 /**
312 * Activity Action: Show settings to allow configuration of application
313 * development-related settings.
314 * <p>
315 * In some cases, a matching Activity may not exist, so ensure you safeguard
316 * against this.
317 * <p>
318 * Input: Nothing.
319 * <p>
320 * Output: Nothing.
321 */
322 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
323 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
324 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
325
326 /**
327 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
328 * <p>
329 * In some cases, a matching Activity may not exist, so ensure you
330 * safeguard against this.
331 * <p>
332 * Input: Nothing.
333 * <p>
334 * Output: Nothing.
335 */
336 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
337 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
338 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 /**
341 * Activity Action: Show settings to manage installed applications.
342 * <p>
343 * In some cases, a matching Activity may not exist, so ensure you
344 * safeguard against this.
345 * <p>
346 * Input: Nothing.
347 * <p>
348 * Output: Nothing.
349 */
350 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
351 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
352 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 /**
355 * Activity Action: Show settings for system update functionality.
356 * <p>
357 * In some cases, a matching Activity may not exist, so ensure you
358 * safeguard against this.
359 * <p>
360 * Input: Nothing.
361 * <p>
362 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700363 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 * @hide
365 */
366 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
367 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
368 "android.settings.SYSTEM_UPDATE_SETTINGS";
369
370 /**
371 * Activity Action: Show settings to allow configuration of sync settings.
372 * <p>
373 * In some cases, a matching Activity may not exist, so ensure you
374 * safeguard against this.
375 * <p>
376 * Input: Nothing.
377 * <p>
378 * Output: Nothing.
379 */
380 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
381 public static final String ACTION_SYNC_SETTINGS =
382 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 /**
385 * Activity Action: Show settings for selecting the network operator.
386 * <p>
387 * In some cases, a matching Activity may not exist, so ensure you
388 * safeguard against this.
389 * <p>
390 * Input: Nothing.
391 * <p>
392 * Output: Nothing.
393 */
394 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
395 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
396 "android.settings.NETWORK_OPERATOR_SETTINGS";
397
398 /**
399 * Activity Action: Show settings for selection of 2G/3G.
400 * <p>
401 * In some cases, a matching Activity may not exist, so ensure you
402 * safeguard against this.
403 * <p>
404 * Input: Nothing.
405 * <p>
406 * Output: Nothing.
407 */
408 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
409 public static final String ACTION_DATA_ROAMING_SETTINGS =
410 "android.settings.DATA_ROAMING_SETTINGS";
411
412 /**
413 * Activity Action: Show settings for internal storage.
414 * <p>
415 * In some cases, a matching Activity may not exist, so ensure you
416 * safeguard against this.
417 * <p>
418 * Input: Nothing.
419 * <p>
420 * Output: Nothing.
421 */
422 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
423 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
424 "android.settings.INTERNAL_STORAGE_SETTINGS";
425 /**
426 * Activity Action: Show settings for memory card storage.
427 * <p>
428 * In some cases, a matching Activity may not exist, so ensure you
429 * safeguard against this.
430 * <p>
431 * Input: Nothing.
432 * <p>
433 * Output: Nothing.
434 */
435 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
436 public static final String ACTION_MEMORY_CARD_SETTINGS =
437 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700438
Justin Mattsonef340352010-01-13 21:05:46 -0800439 /**
440 * Activity Action: Show settings for global search.
441 * <p>
442 * In some cases, a matching Activity may not exist, so ensure you
443 * safeguard against this.
444 * <p>
445 * Input: Nothing.
446 * <p>
447 * Output: Nothing
448 */
449 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
450 public static final String ACTION_SEARCH_SETTINGS =
451 "android.search.action.SEARCH_SETTINGS";
452
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500453 /**
454 * Activity Action: Show general device information settings (serial
455 * number, software version, phone number, etc.).
456 * <p>
457 * In some cases, a matching Activity may not exist, so ensure you
458 * safeguard against this.
459 * <p>
460 * Input: Nothing.
461 * <p>
462 * Output: Nothing
463 */
464 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
465 public static final String ACTION_DEVICE_INFO_SETTINGS =
466 "android.settings.DEVICE_INFO_SETTINGS";
467
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 // End of Intent actions for Settings
469
470 private static final String JID_RESOURCE_PREFIX = "android";
471
472 public static final String AUTHORITY = "settings";
473
474 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800475 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477 public static class SettingNotFoundException extends AndroidException {
478 public SettingNotFoundException(String msg) {
479 super(msg);
480 }
481 }
482
483 /**
484 * Common base for tables of name/value settings.
485 */
486 public static class NameValueTable implements BaseColumns {
487 public static final String NAME = "name";
488 public static final String VALUE = "value";
489
490 protected static boolean putString(ContentResolver resolver, Uri uri,
491 String name, String value) {
492 // The database will take care of replacing duplicates.
493 try {
494 ContentValues values = new ContentValues();
495 values.put(NAME, name);
496 values.put(VALUE, value);
497 resolver.insert(uri, values);
498 return true;
499 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700500 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 return false;
502 }
503 }
504
505 public static Uri getUriFor(Uri uri, String name) {
506 return Uri.withAppendedPath(uri, name);
507 }
508 }
509
510 private static class NameValueCache {
511 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800512 private final Uri mUri;
513
Dan Egnor799f7212009-11-24 16:24:44 -0800514 // Must synchronize(mValues) to access mValues and mValuesVersion.
515 private final HashMap<String, String> mValues = new HashMap<String, String>();
516 private long mValuesVersion = 0;
517
518 public NameValueCache(String versionSystemProperty, Uri uri) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800519 mVersionSystemProperty = versionSystemProperty;
520 mUri = uri;
521 }
522
Dan Egnor799f7212009-11-24 16:24:44 -0800523 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800524 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800525
526 synchronized (mValues) {
527 if (mValuesVersion != newValuesVersion) {
528 if (LOCAL_LOGV) {
529 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
530 newValuesVersion + " != cached " + mValuesVersion);
531 }
532
533 mValues.clear();
534 mValuesVersion = newValuesVersion;
535 }
536
537 if (mValues.containsKey(name)) {
538 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800539 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 }
Dan Egnor799f7212009-11-24 16:24:44 -0800541
542 Cursor c = null;
543 try {
544 c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE },
545 Settings.NameValueTable.NAME + "=?", new String[]{name}, null);
546 if (c == null) {
547 Log.w(TAG, "Can't get key " + name + " from " + mUri);
548 return null;
549 }
550
551 String value = c.moveToNext() ? c.getString(0) : null;
552 synchronized (mValues) {
553 mValues.put(name, value);
554 }
555 if (LOCAL_LOGV) {
556 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
557 name + " = " + (value == null ? "(null)" : value));
558 }
559 return value;
560 } catch (SQLException e) {
561 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
562 return null; // Return null, but don't cache it.
563 } finally {
564 if (c != null) c.close();
565 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800566 }
567 }
568
569 /**
570 * System settings, containing miscellaneous system preferences. This
571 * table holds simple name/value pairs. There are convenience
572 * functions for accessing individual settings entries.
573 */
574 public static final class System extends NameValueTable {
575 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
576
577 private static volatile NameValueCache mNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800579 private static final HashSet<String> MOVED_TO_SECURE;
580 static {
581 MOVED_TO_SECURE = new HashSet<String>(30);
582 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
583 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
584 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
585 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
586 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
587 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
588 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
589 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
590 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
591 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
592 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
593 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
594 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
595 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
596 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
597 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
598 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
599 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
600 MOVED_TO_SECURE.add(Secure.WIFI_ON);
601 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
602 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
603 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
604 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
605 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
606 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
607 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
608 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
609 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
610 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
611 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
612 }
613
614 /**
615 * Look up a name in the database.
616 * @param resolver to access the database with
617 * @param name to look up in the table
618 * @return the corresponding value, or null if not present
619 */
620 public synchronized static String getString(ContentResolver resolver, String name) {
621 if (MOVED_TO_SECURE.contains(name)) {
622 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
623 + " to android.provider.Settings.Secure, returning read-only value.");
624 return Secure.getString(resolver, name);
625 }
626 if (mNameValueCache == null) {
627 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
628 }
629 return mNameValueCache.getString(resolver, name);
630 }
631
632 /**
633 * Store a name/value pair into the database.
634 * @param resolver to access the database with
635 * @param name to store
636 * @param value to associate with the name
637 * @return true if the value was set, false on database errors
638 */
639 public static boolean putString(ContentResolver resolver, String name, String value) {
640 if (MOVED_TO_SECURE.contains(name)) {
641 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
642 + " to android.provider.Settings.Secure, value is unchanged.");
643 return false;
644 }
645 return putString(resolver, CONTENT_URI, name, value);
646 }
647
648 /**
649 * Construct the content URI for a particular name/value pair,
650 * useful for monitoring changes with a ContentObserver.
651 * @param name to look up in the table
652 * @return the corresponding content URI, or null if not present
653 */
654 public static Uri getUriFor(String name) {
655 if (MOVED_TO_SECURE.contains(name)) {
656 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
657 + " to android.provider.Settings.Secure, returning Secure URI.");
658 return Secure.getUriFor(Secure.CONTENT_URI, name);
659 }
660 return getUriFor(CONTENT_URI, name);
661 }
662
663 /**
664 * Convenience function for retrieving a single system settings value
665 * as an integer. Note that internally setting values are always
666 * stored as strings; this function converts the string to an integer
667 * for you. The default value will be returned if the setting is
668 * not defined or not an integer.
669 *
670 * @param cr The ContentResolver to access.
671 * @param name The name of the setting to retrieve.
672 * @param def Value to return if the setting is not defined.
673 *
674 * @return The setting's current value, or 'def' if it is not defined
675 * or not a valid integer.
676 */
677 public static int getInt(ContentResolver cr, String name, int def) {
678 String v = getString(cr, name);
679 try {
680 return v != null ? Integer.parseInt(v) : def;
681 } catch (NumberFormatException e) {
682 return def;
683 }
684 }
685
686 /**
687 * Convenience function for retrieving a single system settings value
688 * as an integer. Note that internally setting values are always
689 * stored as strings; this function converts the string to an integer
690 * for you.
691 * <p>
692 * This version does not take a default value. If the setting has not
693 * been set, or the string value is not a number,
694 * it throws {@link SettingNotFoundException}.
695 *
696 * @param cr The ContentResolver to access.
697 * @param name The name of the setting to retrieve.
698 *
699 * @throws SettingNotFoundException Thrown if a setting by the given
700 * name can't be found or the setting value is not an integer.
701 *
702 * @return The setting's current value.
703 */
704 public static int getInt(ContentResolver cr, String name)
705 throws SettingNotFoundException {
706 String v = getString(cr, name);
707 try {
708 return Integer.parseInt(v);
709 } catch (NumberFormatException e) {
710 throw new SettingNotFoundException(name);
711 }
712 }
713
714 /**
715 * Convenience function for updating a single settings value as an
716 * integer. This will either create a new entry in the table if the
717 * given name does not exist, or modify the value of the existing row
718 * with that name. Note that internally setting values are always
719 * stored as strings, so this function converts the given value to a
720 * string before storing it.
721 *
722 * @param cr The ContentResolver to access.
723 * @param name The name of the setting to modify.
724 * @param value The new value for the setting.
725 * @return true if the value was set, false on database errors
726 */
727 public static boolean putInt(ContentResolver cr, String name, int value) {
728 return putString(cr, name, Integer.toString(value));
729 }
730
731 /**
732 * Convenience function for retrieving a single system settings value
733 * as a {@code long}. Note that internally setting values are always
734 * stored as strings; this function converts the string to a {@code long}
735 * for you. The default value will be returned if the setting is
736 * not defined or not a {@code long}.
737 *
738 * @param cr The ContentResolver to access.
739 * @param name The name of the setting to retrieve.
740 * @param def Value to return if the setting is not defined.
741 *
742 * @return The setting's current value, or 'def' if it is not defined
743 * or not a valid {@code long}.
744 */
745 public static long getLong(ContentResolver cr, String name, long def) {
746 String valString = getString(cr, name);
747 long value;
748 try {
749 value = valString != null ? Long.parseLong(valString) : def;
750 } catch (NumberFormatException e) {
751 value = def;
752 }
753 return value;
754 }
755
756 /**
757 * Convenience function for retrieving a single system settings value
758 * as a {@code long}. Note that internally setting values are always
759 * stored as strings; this function converts the string to a {@code long}
760 * for you.
761 * <p>
762 * This version does not take a default value. If the setting has not
763 * been set, or the string value is not a number,
764 * it throws {@link SettingNotFoundException}.
765 *
766 * @param cr The ContentResolver to access.
767 * @param name The name of the setting to retrieve.
768 *
769 * @return The setting's current value.
770 * @throws SettingNotFoundException Thrown if a setting by the given
771 * name can't be found or the setting value is not an integer.
772 */
773 public static long getLong(ContentResolver cr, String name)
774 throws SettingNotFoundException {
775 String valString = getString(cr, name);
776 try {
777 return Long.parseLong(valString);
778 } catch (NumberFormatException e) {
779 throw new SettingNotFoundException(name);
780 }
781 }
782
783 /**
784 * Convenience function for updating a single settings value as a long
785 * integer. This will either create a new entry in the table if the
786 * given name does not exist, or modify the value of the existing row
787 * with that name. Note that internally setting values are always
788 * stored as strings, so this function converts the given value to a
789 * string before storing it.
790 *
791 * @param cr The ContentResolver to access.
792 * @param name The name of the setting to modify.
793 * @param value The new value for the setting.
794 * @return true if the value was set, false on database errors
795 */
796 public static boolean putLong(ContentResolver cr, String name, long value) {
797 return putString(cr, name, Long.toString(value));
798 }
799
800 /**
801 * Convenience function for retrieving a single system settings value
802 * as a floating point number. Note that internally setting values are
803 * always stored as strings; this function converts the string to an
804 * float for you. The default value will be returned if the setting
805 * is not defined or not a valid float.
806 *
807 * @param cr The ContentResolver to access.
808 * @param name The name of the setting to retrieve.
809 * @param def Value to return if the setting is not defined.
810 *
811 * @return The setting's current value, or 'def' if it is not defined
812 * or not a valid float.
813 */
814 public static float getFloat(ContentResolver cr, String name, float def) {
815 String v = getString(cr, name);
816 try {
817 return v != null ? Float.parseFloat(v) : def;
818 } catch (NumberFormatException e) {
819 return def;
820 }
821 }
822
823 /**
824 * Convenience function for retrieving a single system settings value
825 * as a float. Note that internally setting values are always
826 * stored as strings; this function converts the string to a float
827 * for you.
828 * <p>
829 * This version does not take a default value. If the setting has not
830 * been set, or the string value is not a number,
831 * it throws {@link SettingNotFoundException}.
832 *
833 * @param cr The ContentResolver to access.
834 * @param name The name of the setting to retrieve.
835 *
836 * @throws SettingNotFoundException Thrown if a setting by the given
837 * name can't be found or the setting value is not a float.
838 *
839 * @return The setting's current value.
840 */
841 public static float getFloat(ContentResolver cr, String name)
842 throws SettingNotFoundException {
843 String v = getString(cr, name);
844 try {
845 return Float.parseFloat(v);
846 } catch (NumberFormatException e) {
847 throw new SettingNotFoundException(name);
848 }
849 }
850
851 /**
852 * Convenience function for updating a single settings value as a
853 * floating point number. This will either create a new entry in the
854 * table if the given name does not exist, or modify the value of the
855 * existing row with that name. Note that internally setting values
856 * are always stored as strings, so this function converts the given
857 * value to a string before storing it.
858 *
859 * @param cr The ContentResolver to access.
860 * @param name The name of the setting to modify.
861 * @param value The new value for the setting.
862 * @return true if the value was set, false on database errors
863 */
864 public static boolean putFloat(ContentResolver cr, String name, float value) {
865 return putString(cr, name, Float.toString(value));
866 }
867
868 /**
869 * Convenience function to read all of the current
870 * configuration-related settings into a
871 * {@link Configuration} object.
872 *
873 * @param cr The ContentResolver to access.
874 * @param outConfig Where to place the configuration settings.
875 */
876 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
877 outConfig.fontScale = Settings.System.getFloat(
878 cr, FONT_SCALE, outConfig.fontScale);
879 if (outConfig.fontScale < 0) {
880 outConfig.fontScale = 1;
881 }
882 }
883
884 /**
885 * Convenience function to write a batch of configuration-related
886 * settings from a {@link Configuration} object.
887 *
888 * @param cr The ContentResolver to access.
889 * @param config The settings to write.
890 * @return true if the values were set, false on database errors
891 */
892 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
893 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
894 }
895
896 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
897 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
898 }
899
900 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
901 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
902 }
903
904 /**
905 * The content:// style URL for this table
906 */
907 public static final Uri CONTENT_URI =
908 Uri.parse("content://" + AUTHORITY + "/system");
909
910 /**
911 * Whether we keep the device on while the device is plugged in.
912 * Supported values are:
913 * <ul>
914 * <li>{@code 0} to never stay on while plugged in</li>
915 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
916 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
917 * </ul>
918 * These values can be OR-ed together.
919 */
920 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
921
922 /**
923 * What happens when the user presses the end call button if they're not
924 * on a call.<br/>
925 * <b>Values:</b><br/>
926 * 0 - The end button does nothing.<br/>
927 * 1 - The end button goes to the home screen.<br/>
928 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
929 * 3 - The end button goes to the home screen. If the user is already on the
930 * home screen, it puts the device to sleep.
931 */
932 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
933
934 /**
935 * Whether Airplane Mode is on.
936 */
937 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
938
939 /**
940 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
941 */
942 public static final String RADIO_BLUETOOTH = "bluetooth";
943
944 /**
945 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
946 */
947 public static final String RADIO_WIFI = "wifi";
948
949 /**
950 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
951 */
952 public static final String RADIO_CELL = "cell";
953
954 /**
955 * A comma separated list of radios that need to be disabled when airplane mode
956 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
957 * included in the comma separated list.
958 */
959 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
960
961 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -0700962 * A comma separated list of radios that should to be disabled when airplane mode
963 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
964 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
965 * will be turned off when entering airplane mode, but the user will be able to reenable
966 * Wifi in the Settings app.
967 *
968 * {@hide}
969 */
970 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
971
972 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800973 * The policy for deciding when Wi-Fi should go to sleep (which will in
974 * turn switch to using the mobile data as an Internet connection).
975 * <p>
976 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
977 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
978 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800979 */
980 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
981
982 /**
983 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
984 * policy, which is to sleep shortly after the turning off
985 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800986 */
987 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
988
989 /**
990 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
991 * the device is on battery, and never go to sleep when the device is
992 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800993 */
994 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700995
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800996 /**
997 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800998 */
999 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001000
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001001 /**
1002 * Whether to use static IP and other static network attributes.
1003 * <p>
1004 * Set to 1 for true and 0 for false.
1005 */
1006 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1007
1008 /**
1009 * The static IP address.
1010 * <p>
1011 * Example: "192.168.1.51"
1012 */
1013 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1014
1015 /**
1016 * If using static IP, the gateway's IP address.
1017 * <p>
1018 * Example: "192.168.1.1"
1019 */
1020 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1021
1022 /**
1023 * If using static IP, the net mask.
1024 * <p>
1025 * Example: "255.255.255.0"
1026 */
1027 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1028
1029 /**
1030 * If using static IP, the primary DNS's IP address.
1031 * <p>
1032 * Example: "192.168.1.1"
1033 */
1034 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1035
1036 /**
1037 * If using static IP, the secondary DNS's IP address.
1038 * <p>
1039 * Example: "192.168.1.2"
1040 */
1041 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1042
1043 /**
1044 * The number of radio channels that are allowed in the local
1045 * 802.11 regulatory domain.
1046 * @hide
1047 */
1048 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1049
1050 /**
1051 * Determines whether remote devices may discover and/or connect to
1052 * this device.
1053 * <P>Type: INT</P>
1054 * 2 -- discoverable and connectable
1055 * 1 -- connectable but not discoverable
1056 * 0 -- neither connectable nor discoverable
1057 */
1058 public static final String BLUETOOTH_DISCOVERABILITY =
1059 "bluetooth_discoverability";
1060
1061 /**
1062 * Bluetooth discoverability timeout. If this value is nonzero, then
1063 * Bluetooth becomes discoverable for a certain number of seconds,
1064 * after which is becomes simply connectable. The value is in seconds.
1065 */
1066 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1067 "bluetooth_discoverability_timeout";
1068
1069 /**
1070 * Whether autolock is enabled (0 = false, 1 = true)
1071 */
1072 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
1073
1074 /**
1075 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
1076 */
1077 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1078
1079 /**
1080 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
1081 */
1082 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1083 "lock_pattern_tactile_feedback_enabled";
1084
1085
1086 /**
1087 * A formatted string of the next alarm that is set, or the empty string
1088 * if there is no alarm set.
1089 */
1090 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1091
1092 /**
1093 * Scaling factor for fonts, float.
1094 */
1095 public static final String FONT_SCALE = "font_scale";
1096
1097 /**
1098 * Name of an application package to be debugged.
1099 */
1100 public static final String DEBUG_APP = "debug_app";
1101
1102 /**
1103 * If 1, when launching DEBUG_APP it will wait for the debugger before
1104 * starting user code. If 0, it will run normally.
1105 */
1106 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1107
1108 /**
1109 * Whether or not to dim the screen. 0=no 1=yes
1110 */
1111 public static final String DIM_SCREEN = "dim_screen";
1112
1113 /**
1114 * The timeout before the screen turns off.
1115 */
1116 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1117
1118 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001119 * If 0, the compatibility mode is off for all applications.
1120 * If 1, older applications run under compatibility mode.
1121 * TODO: remove this settings before code freeze (bug/1907571)
1122 * @hide
1123 */
1124 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1125
1126 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001127 * The screen backlight brightness between 0 and 255.
1128 */
1129 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1130
1131 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001132 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05001133 */
1134 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1135
1136 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001137 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001138 */
1139 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1140
1141 /**
1142 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001143 */
1144 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1145
1146 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001147 * Control whether the process CPU usage meter should be shown.
1148 */
1149 public static final String SHOW_PROCESSES = "show_processes";
1150
1151 /**
1152 * If 1, the activity manager will aggressively finish activities and
1153 * processes as soon as they are no longer needed. If 0, the normal
1154 * extended lifetime is used.
1155 */
1156 public static final String ALWAYS_FINISH_ACTIVITIES =
1157 "always_finish_activities";
1158
1159
1160 /**
1161 * Ringer mode. This is used internally, changing this value will not
1162 * change the ringer mode. See AudioManager.
1163 */
1164 public static final String MODE_RINGER = "mode_ringer";
1165
1166 /**
1167 * Determines which streams are affected by ringer mode changes. The
1168 * stream type's bit should be set to 1 if it should be muted when going
1169 * into an inaudible ringer mode.
1170 */
1171 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1172
1173 /**
1174 * Determines which streams are affected by mute. The
1175 * stream type's bit should be set to 1 if it should be muted when a mute request
1176 * is received.
1177 */
1178 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1179
1180 /**
1181 * Whether vibrate is on for different events. This is used internally,
1182 * changing this value will not change the vibrate. See AudioManager.
1183 */
1184 public static final String VIBRATE_ON = "vibrate_on";
1185
1186 /**
1187 * Ringer volume. This is used internally, changing this value will not
1188 * change the volume. See AudioManager.
1189 */
1190 public static final String VOLUME_RING = "volume_ring";
1191
1192 /**
1193 * System/notifications volume. This is used internally, changing this
1194 * value will not change the volume. See AudioManager.
1195 */
1196 public static final String VOLUME_SYSTEM = "volume_system";
1197
1198 /**
1199 * Voice call volume. This is used internally, changing this value will
1200 * not change the volume. See AudioManager.
1201 */
1202 public static final String VOLUME_VOICE = "volume_voice";
1203
1204 /**
1205 * Music/media/gaming volume. This is used internally, changing this
1206 * value will not change the volume. See AudioManager.
1207 */
1208 public static final String VOLUME_MUSIC = "volume_music";
1209
1210 /**
1211 * Alarm volume. This is used internally, changing this
1212 * value will not change the volume. See AudioManager.
1213 */
1214 public static final String VOLUME_ALARM = "volume_alarm";
1215
1216 /**
1217 * Notification volume. This is used internally, changing this
1218 * value will not change the volume. See AudioManager.
1219 */
1220 public static final String VOLUME_NOTIFICATION = "volume_notification";
1221
1222 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001223 * Bluetooth Headset volume. This is used internally, changing this value will
1224 * not change the volume. See AudioManager.
1225 */
1226 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1227
1228 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229 * Whether the notifications should use the ring volume (value of 1) or
1230 * a separate notification volume (value of 0). In most cases, users
1231 * will have this enabled so the notification and ringer volumes will be
1232 * the same. However, power users can disable this and use the separate
1233 * notification volume control.
1234 * <p>
1235 * Note: This is a one-off setting that will be removed in the future
1236 * when there is profile support. For this reason, it is kept hidden
1237 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001238 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001239 * @hide
1240 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001241 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001242 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001243
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 /**
1245 * The mapping of stream type (integer) to its setting.
1246 */
1247 public static final String[] VOLUME_SETTINGS = {
1248 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001249 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 };
1251
1252 /**
1253 * Appended to various volume related settings to record the previous
1254 * values before they the settings were affected by a silent/vibrate
1255 * ringer mode change.
1256 */
1257 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1258
1259 /**
1260 * Persistent store for the system-wide default ringtone URI.
1261 * <p>
1262 * If you need to play the default ringtone at any given time, it is recommended
1263 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1264 * to the set default ringtone at the time of playing.
1265 *
1266 * @see #DEFAULT_RINGTONE_URI
1267 */
1268 public static final String RINGTONE = "ringtone";
1269
1270 /**
1271 * A {@link Uri} that will point to the current default ringtone at any
1272 * given time.
1273 * <p>
1274 * If the current default ringtone is in the DRM provider and the caller
1275 * does not have permission, the exception will be a
1276 * FileNotFoundException.
1277 */
1278 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1279
1280 /**
1281 * Persistent store for the system-wide default notification sound.
1282 *
1283 * @see #RINGTONE
1284 * @see #DEFAULT_NOTIFICATION_URI
1285 */
1286 public static final String NOTIFICATION_SOUND = "notification_sound";
1287
1288 /**
1289 * A {@link Uri} that will point to the current default notification
1290 * sound at any given time.
1291 *
1292 * @see #DEFAULT_RINGTONE_URI
1293 */
1294 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1295
1296 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001297 * Persistent store for the system-wide default alarm alert.
1298 *
1299 * @see #RINGTONE
1300 * @see #DEFAULT_ALARM_ALERT_URI
1301 */
1302 public static final String ALARM_ALERT = "alarm_alert";
1303
1304 /**
1305 * A {@link Uri} that will point to the current default alarm alert at
1306 * any given time.
1307 *
1308 * @see #DEFAULT_ALARM_ALERT_URI
1309 */
1310 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1311
1312 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1314 */
1315 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1316
1317 /**
1318 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1319 */
1320 public static final String TEXT_AUTO_CAPS = "auto_caps";
1321
1322 /**
1323 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1324 * feature converts two spaces to a "." and space.
1325 */
1326 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001327
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 /**
1329 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1330 */
1331 public static final String TEXT_SHOW_PASSWORD = "show_password";
1332
1333 public static final String SHOW_GTALK_SERVICE_STATUS =
1334 "SHOW_GTALK_SERVICE_STATUS";
1335
1336 /**
1337 * Name of activity to use for wallpaper on the home screen.
1338 */
1339 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1340
1341 /**
1342 * Value to specify if the user prefers the date, time and time zone
1343 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1344 */
1345 public static final String AUTO_TIME = "auto_time";
1346
1347 /**
1348 * Display times as 12 or 24 hours
1349 * 12
1350 * 24
1351 */
1352 public static final String TIME_12_24 = "time_12_24";
1353
1354 /**
1355 * Date format string
1356 * mm/dd/yyyy
1357 * dd/mm/yyyy
1358 * yyyy/mm/dd
1359 */
1360 public static final String DATE_FORMAT = "date_format";
1361
1362 /**
1363 * Whether the setup wizard has been run before (on first boot), or if
1364 * it still needs to be run.
1365 *
1366 * nonzero = it has been run in the past
1367 * 0 = it has not been run in the past
1368 */
1369 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1370
1371 /**
1372 * Scaling factor for normal window animations. Setting to 0 will disable window
1373 * animations.
1374 */
1375 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1376
1377 /**
1378 * Scaling factor for activity transition animations. Setting to 0 will disable window
1379 * animations.
1380 */
1381 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1382
1383 /**
1384 * Scaling factor for normal window animations. Setting to 0 will disable window
1385 * animations.
1386 * @hide
1387 */
1388 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1389
1390 /**
1391 * Control whether the accelerometer will be used to change screen
1392 * orientation. If 0, it will not be used unless explicitly requested
1393 * by the application; if 1, it will be used by default unless explicitly
1394 * disabled by the application.
1395 */
1396 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1397
1398 /**
1399 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1400 * boolean (1 or 0).
1401 */
1402 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1403
1404 /**
David Kraused0f67152009-06-13 18:01:13 -05001405 * CDMA only settings
1406 * DTMF tone type played by the dialer when dialing.
1407 * 0 = Normal
1408 * 1 = Long
1409 * @hide
1410 */
1411 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1412
1413 /**
1414 * CDMA only settings
1415 * Emergency Tone 0 = Off
1416 * 1 = Alert
1417 * 2 = Vibrate
1418 * @hide
1419 */
1420 public static final String EMERGENCY_TONE = "emergency_tone";
1421
1422 /**
1423 * CDMA only settings
1424 * Whether the auto retry is enabled. The value is
1425 * boolean (1 or 0).
1426 * @hide
1427 */
1428 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1429
1430 /**
1431 * Whether the hearing aid is enabled. The value is
1432 * boolean (1 or 0).
1433 * @hide
1434 */
1435 public static final String HEARING_AID = "hearing_aid";
1436
1437 /**
1438 * CDMA only settings
1439 * TTY Mode
1440 * 0 = OFF
1441 * 1 = FULL
1442 * 2 = VCO
1443 * 3 = HCO
1444 * @hide
1445 */
1446 public static final String TTY_MODE = "tty_mode";
1447
1448 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001449 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1450 * boolean (1 or 0).
1451 */
1452 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001453
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001454 /**
1455 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1456 * boolean (1 or 0).
1457 */
1458 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001459
Mike LeBeau48603e72009-06-05 00:27:00 +01001460 /**
1461 * Whether live web suggestions while the user types into search dialogs are
1462 * enabled. Browsers and other search UIs should respect this, as it allows
1463 * a user to avoid sending partial queries to a search engine, if it poses
1464 * any privacy concern. The value is boolean (1 or 0).
1465 */
1466 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001467
-b master501eec92009-07-06 13:53:11 -07001468 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001469 * Whether the notification LED should repeatedly flash when a notification is
1470 * pending. The value is boolean (1 or 0).
1471 * @hide
1472 */
1473 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1474
1475 /**
-b master501eec92009-07-06 13:53:11 -07001476 * Settings to backup. This is here so that it's in the same place as the settings
1477 * keys and easy to update.
1478 * @hide
1479 */
1480 public static final String[] SETTINGS_TO_BACKUP = {
1481 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001482 WIFI_SLEEP_POLICY,
1483 WIFI_USE_STATIC_IP,
1484 WIFI_STATIC_IP,
1485 WIFI_STATIC_GATEWAY,
1486 WIFI_STATIC_NETMASK,
1487 WIFI_STATIC_DNS1,
1488 WIFI_STATIC_DNS2,
1489 BLUETOOTH_DISCOVERABILITY,
1490 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1491 DIM_SCREEN,
1492 SCREEN_OFF_TIMEOUT,
1493 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001494 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001495 VIBRATE_ON,
1496 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001497 MODE_RINGER,
1498 MODE_RINGER_STREAMS_AFFECTED,
1499 MUTE_STREAMS_AFFECTED,
1500 VOLUME_VOICE,
1501 VOLUME_SYSTEM,
1502 VOLUME_RING,
1503 VOLUME_MUSIC,
1504 VOLUME_ALARM,
1505 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001506 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001507 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1508 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1509 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1510 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1511 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1512 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001513 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
-b master501eec92009-07-06 13:53:11 -07001514 TEXT_AUTO_REPLACE,
1515 TEXT_AUTO_CAPS,
1516 TEXT_AUTO_PUNCTUATE,
1517 TEXT_SHOW_PASSWORD,
1518 AUTO_TIME,
1519 TIME_12_24,
1520 DATE_FORMAT,
1521 ACCELEROMETER_ROTATION,
1522 DTMF_TONE_WHEN_DIALING,
1523 DTMF_TONE_TYPE_WHEN_DIALING,
1524 EMERGENCY_TONE,
1525 CALL_AUTO_RETRY,
1526 HEARING_AID,
1527 TTY_MODE,
1528 SOUND_EFFECTS_ENABLED,
1529 HAPTIC_FEEDBACK_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001530 SHOW_WEB_SUGGESTIONS,
1531 NOTIFICATION_LIGHT_PULSE
-b master501eec92009-07-06 13:53:11 -07001532 };
1533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001534 // Settings moved to Settings.Secure
1535
1536 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001537 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001538 * instead
1539 */
1540 @Deprecated
1541 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1542
1543 /**
1544 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1545 */
1546 @Deprecated
1547 public static final String ANDROID_ID = Secure.ANDROID_ID;
1548
1549 /**
1550 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1551 */
1552 @Deprecated
1553 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1554
1555 /**
1556 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1557 */
1558 @Deprecated
1559 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1560
1561 /**
1562 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1563 */
1564 @Deprecated
1565 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1566
1567 /**
1568 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1569 */
1570 @Deprecated
1571 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1572
1573 /**
1574 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1575 */
1576 @Deprecated
1577 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001578
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001579 /**
1580 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1581 * instead
1582 */
1583 @Deprecated
1584 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1585
1586 /**
1587 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1588 */
1589 @Deprecated
1590 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001591
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001592 /**
1593 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1594 */
1595 @Deprecated
1596 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1597
1598 /**
1599 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1600 * instead
1601 */
1602 @Deprecated
1603 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1604
1605 /**
1606 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1607 * instead
1608 */
1609 @Deprecated
1610 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1611
1612 /**
1613 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1614 * instead
1615 */
1616 @Deprecated
1617 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1618 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1619
1620 /**
1621 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1622 */
1623 @Deprecated
1624 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1625
1626 /**
1627 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1628 */
1629 @Deprecated
1630 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001631
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001632 /**
1633 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1634 */
1635 @Deprecated
1636 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1637
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001638 /**
1639 * @deprecated Use
1640 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1641 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001642 @Deprecated
1643 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1644
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001645 /**
1646 * @deprecated Use
1647 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1648 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001649 @Deprecated
1650 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1651 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1652
1653 /**
1654 * @deprecated Use
1655 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1656 */
1657 @Deprecated
1658 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1659 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1660
1661 /**
1662 * @deprecated Use
1663 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1664 */
1665 @Deprecated
1666 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1667 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001668
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 /**
1670 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1671 * instead
1672 */
1673 @Deprecated
1674 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1675
1676 /**
1677 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1678 */
1679 @Deprecated
1680 public static final String WIFI_ON = Secure.WIFI_ON;
1681
1682 /**
1683 * @deprecated Use
1684 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1685 * instead
1686 */
1687 @Deprecated
1688 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1689 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1690
1691 /**
1692 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1693 */
1694 @Deprecated
1695 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1696
1697 /**
1698 * @deprecated Use
1699 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1700 */
1701 @Deprecated
1702 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1703 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001705 /**
1706 * @deprecated Use
1707 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1708 */
1709 @Deprecated
1710 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1711 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1712
1713 /**
1714 * @deprecated Use
1715 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1716 * instead
1717 */
1718 @Deprecated
1719 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1720 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1721
1722 /**
1723 * @deprecated Use
1724 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1725 */
1726 @Deprecated
1727 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1728 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1729
1730 /**
1731 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1732 * instead
1733 */
1734 @Deprecated
1735 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1736
1737 /**
1738 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1739 */
1740 @Deprecated
1741 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1742
1743 /**
1744 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1745 */
1746 @Deprecated
1747 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1748
1749 /**
1750 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1751 * instead
1752 */
1753 @Deprecated
1754 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1755
1756 /**
1757 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1758 * instead
1759 */
1760 @Deprecated
1761 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1762 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1763 }
1764
1765 /**
1766 * Secure system settings, containing system preferences that applications
1767 * can read but are not allowed to write. These are for preferences that
1768 * the user must explicitly modify through the system UI or specialized
1769 * APIs for those values, not modified directly by applications.
1770 */
1771 public static final class Secure extends NameValueTable {
1772 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1773
1774 private static volatile NameValueCache mNameValueCache = null;
1775
1776 /**
1777 * Look up a name in the database.
1778 * @param resolver to access the database with
1779 * @param name to look up in the table
1780 * @return the corresponding value, or null if not present
1781 */
1782 public synchronized static String getString(ContentResolver resolver, String name) {
1783 if (mNameValueCache == null) {
1784 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
1785 }
1786 return mNameValueCache.getString(resolver, name);
1787 }
1788
1789 /**
1790 * Store a name/value pair into the database.
1791 * @param resolver to access the database with
1792 * @param name to store
1793 * @param value to associate with the name
1794 * @return true if the value was set, false on database errors
1795 */
1796 public static boolean putString(ContentResolver resolver,
1797 String name, String value) {
1798 return putString(resolver, CONTENT_URI, name, value);
1799 }
1800
1801 /**
1802 * Construct the content URI for a particular name/value pair,
1803 * useful for monitoring changes with a ContentObserver.
1804 * @param name to look up in the table
1805 * @return the corresponding content URI, or null if not present
1806 */
1807 public static Uri getUriFor(String name) {
1808 return getUriFor(CONTENT_URI, name);
1809 }
1810
1811 /**
1812 * Convenience function for retrieving a single secure settings value
1813 * as an integer. Note that internally setting values are always
1814 * stored as strings; this function converts the string to an integer
1815 * for you. The default value will be returned if the setting is
1816 * not defined or not an integer.
1817 *
1818 * @param cr The ContentResolver to access.
1819 * @param name The name of the setting to retrieve.
1820 * @param def Value to return if the setting is not defined.
1821 *
1822 * @return The setting's current value, or 'def' if it is not defined
1823 * or not a valid integer.
1824 */
1825 public static int getInt(ContentResolver cr, String name, int def) {
1826 String v = getString(cr, name);
1827 try {
1828 return v != null ? Integer.parseInt(v) : def;
1829 } catch (NumberFormatException e) {
1830 return def;
1831 }
1832 }
1833
1834 /**
1835 * Convenience function for retrieving a single secure settings value
1836 * as an integer. Note that internally setting values are always
1837 * stored as strings; this function converts the string to an integer
1838 * for you.
1839 * <p>
1840 * This version does not take a default value. If the setting has not
1841 * been set, or the string value is not a number,
1842 * it throws {@link SettingNotFoundException}.
1843 *
1844 * @param cr The ContentResolver to access.
1845 * @param name The name of the setting to retrieve.
1846 *
1847 * @throws SettingNotFoundException Thrown if a setting by the given
1848 * name can't be found or the setting value is not an integer.
1849 *
1850 * @return The setting's current value.
1851 */
1852 public static int getInt(ContentResolver cr, String name)
1853 throws SettingNotFoundException {
1854 String v = getString(cr, name);
1855 try {
1856 return Integer.parseInt(v);
1857 } catch (NumberFormatException e) {
1858 throw new SettingNotFoundException(name);
1859 }
1860 }
1861
1862 /**
1863 * Convenience function for updating a single settings value as an
1864 * integer. This will either create a new entry in the table if the
1865 * given name does not exist, or modify the value of the existing row
1866 * with that name. Note that internally setting values are always
1867 * stored as strings, so this function converts the given value to a
1868 * string before storing it.
1869 *
1870 * @param cr The ContentResolver to access.
1871 * @param name The name of the setting to modify.
1872 * @param value The new value for the setting.
1873 * @return true if the value was set, false on database errors
1874 */
1875 public static boolean putInt(ContentResolver cr, String name, int value) {
1876 return putString(cr, name, Integer.toString(value));
1877 }
1878
1879 /**
1880 * Convenience function for retrieving a single secure settings value
1881 * as a {@code long}. Note that internally setting values are always
1882 * stored as strings; this function converts the string to a {@code long}
1883 * for you. The default value will be returned if the setting is
1884 * not defined or not a {@code long}.
1885 *
1886 * @param cr The ContentResolver to access.
1887 * @param name The name of the setting to retrieve.
1888 * @param def Value to return if the setting is not defined.
1889 *
1890 * @return The setting's current value, or 'def' if it is not defined
1891 * or not a valid {@code long}.
1892 */
1893 public static long getLong(ContentResolver cr, String name, long def) {
1894 String valString = getString(cr, name);
1895 long value;
1896 try {
1897 value = valString != null ? Long.parseLong(valString) : def;
1898 } catch (NumberFormatException e) {
1899 value = def;
1900 }
1901 return value;
1902 }
1903
1904 /**
1905 * Convenience function for retrieving a single secure settings value
1906 * as a {@code long}. Note that internally setting values are always
1907 * stored as strings; this function converts the string to a {@code long}
1908 * for you.
1909 * <p>
1910 * This version does not take a default value. If the setting has not
1911 * been set, or the string value is not a number,
1912 * it throws {@link SettingNotFoundException}.
1913 *
1914 * @param cr The ContentResolver to access.
1915 * @param name The name of the setting to retrieve.
1916 *
1917 * @return The setting's current value.
1918 * @throws SettingNotFoundException Thrown if a setting by the given
1919 * name can't be found or the setting value is not an integer.
1920 */
1921 public static long getLong(ContentResolver cr, String name)
1922 throws SettingNotFoundException {
1923 String valString = getString(cr, name);
1924 try {
1925 return Long.parseLong(valString);
1926 } catch (NumberFormatException e) {
1927 throw new SettingNotFoundException(name);
1928 }
1929 }
1930
1931 /**
1932 * Convenience function for updating a secure settings value as a long
1933 * integer. This will either create a new entry in the table if the
1934 * given name does not exist, or modify the value of the existing row
1935 * with that name. Note that internally setting values are always
1936 * stored as strings, so this function converts the given value to a
1937 * string before storing it.
1938 *
1939 * @param cr The ContentResolver to access.
1940 * @param name The name of the setting to modify.
1941 * @param value The new value for the setting.
1942 * @return true if the value was set, false on database errors
1943 */
1944 public static boolean putLong(ContentResolver cr, String name, long value) {
1945 return putString(cr, name, Long.toString(value));
1946 }
1947
1948 /**
1949 * Convenience function for retrieving a single secure settings value
1950 * as a floating point number. Note that internally setting values are
1951 * always stored as strings; this function converts the string to an
1952 * float for you. The default value will be returned if the setting
1953 * is not defined or not a valid float.
1954 *
1955 * @param cr The ContentResolver to access.
1956 * @param name The name of the setting to retrieve.
1957 * @param def Value to return if the setting is not defined.
1958 *
1959 * @return The setting's current value, or 'def' if it is not defined
1960 * or not a valid float.
1961 */
1962 public static float getFloat(ContentResolver cr, String name, float def) {
1963 String v = getString(cr, name);
1964 try {
1965 return v != null ? Float.parseFloat(v) : def;
1966 } catch (NumberFormatException e) {
1967 return def;
1968 }
1969 }
1970
1971 /**
1972 * Convenience function for retrieving a single secure settings value
1973 * as a float. Note that internally setting values are always
1974 * stored as strings; this function converts the string to a float
1975 * for you.
1976 * <p>
1977 * This version does not take a default value. If the setting has not
1978 * been set, or the string value is not a number,
1979 * it throws {@link SettingNotFoundException}.
1980 *
1981 * @param cr The ContentResolver to access.
1982 * @param name The name of the setting to retrieve.
1983 *
1984 * @throws SettingNotFoundException Thrown if a setting by the given
1985 * name can't be found or the setting value is not a float.
1986 *
1987 * @return The setting's current value.
1988 */
1989 public static float getFloat(ContentResolver cr, String name)
1990 throws SettingNotFoundException {
1991 String v = getString(cr, name);
1992 try {
1993 return Float.parseFloat(v);
1994 } catch (NumberFormatException e) {
1995 throw new SettingNotFoundException(name);
1996 }
1997 }
1998
1999 /**
2000 * Convenience function for updating a single settings value as a
2001 * floating point number. This will either create a new entry in the
2002 * table if the given name does not exist, or modify the value of the
2003 * existing row with that name. Note that internally setting values
2004 * are always stored as strings, so this function converts the given
2005 * value to a string before storing it.
2006 *
2007 * @param cr The ContentResolver to access.
2008 * @param name The name of the setting to modify.
2009 * @param value The new value for the setting.
2010 * @return true if the value was set, false on database errors
2011 */
2012 public static boolean putFloat(ContentResolver cr, String name, float value) {
2013 return putString(cr, name, Float.toString(value));
2014 }
2015
2016 /**
2017 * The content:// style URL for this table
2018 */
2019 public static final Uri CONTENT_URI =
2020 Uri.parse("content://" + AUTHORITY + "/secure");
2021
2022 /**
2023 * Whether ADB is enabled.
2024 */
2025 public static final String ADB_ENABLED = "adb_enabled";
2026
2027 /**
2028 * Setting to allow mock locations and location provider status to be injected into the
2029 * LocationManager service for testing purposes during application development. These
2030 * locations and status values override actual location and status information generated
2031 * by network, gps, or other location providers.
2032 */
2033 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2034
2035 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08002036 * A 64-bit number (as a hex string) that is randomly
2037 * generated on the device's first boot and should remain
2038 * constant for the lifetime of the device. (The value may
2039 * change if a factory reset is performed on the device.)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002040 */
2041 public static final String ANDROID_ID = "android_id";
2042
2043 /**
2044 * Whether bluetooth is enabled/disabled
2045 * 0=disabled. 1=enabled.
2046 */
2047 public static final String BLUETOOTH_ON = "bluetooth_on";
2048
2049 /**
2050 * Get the key that retrieves a bluetooth headset's priority.
2051 * @hide
2052 */
2053 public static final String getBluetoothHeadsetPriorityKey(String address) {
2054 return ("bluetooth_headset_priority_" + address.toUpperCase());
2055 }
2056
2057 /**
2058 * Get the key that retrieves a bluetooth a2dp sink's priority.
2059 * @hide
2060 */
2061 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2062 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2063 }
2064
2065 /**
2066 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2067 */
2068 public static final String DATA_ROAMING = "data_roaming";
2069
2070 /**
2071 * Setting to record the input method used by default, holding the ID
2072 * of the desired method.
2073 */
2074 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2075
2076 /**
2077 * Whether the device has been provisioned (0 = false, 1 = true)
2078 */
2079 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081 /**
2082 * List of input methods that are currently enabled. This is a string
2083 * containing the IDs of all enabled input methods, each ID separated
2084 * by ':'.
2085 */
2086 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 /**
2089 * Host name and port for a user-selected proxy.
2090 */
2091 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002092
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002093 /**
2094 * Whether the package installer should allow installation of apps downloaded from
2095 * sources other than the Android Market (vending machine).
2096 *
2097 * 1 = allow installing from other sources
2098 * 0 = only allow installing from the Android Market
2099 */
2100 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002101
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002102 /**
2103 * Comma-separated list of location providers that activities may access.
2104 */
2105 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002106
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002107 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002108 * Whether assisted GPS should be enabled or not.
2109 * @hide
2110 */
2111 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2112
2113 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002114 * The Logging ID (a unique 64-bit value) as a hex string.
2115 * Used as a pseudonymous identifier for logging.
2116 * @deprecated This identifier is poorly initialized and has
2117 * many collisions. It should not be used.
2118 */
2119 @Deprecated
2120 public static final String LOGGING_ID = "logging_id";
2121
2122 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002123 * User preference for which network(s) should be used. Only the
2124 * connectivity service should touch this.
2125 */
2126 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002127
2128 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002129 */
2130 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002131
2132 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002133 */
2134 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002135
2136 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002137 */
2138 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 /**
2141 * Settings classname to launch when Settings is clicked from All
2142 * Applications. Needed because of user testing between the old
2143 * and new Settings apps.
2144 */
2145 // TODO: 881807
2146 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002147
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002148 /**
2149 * USB Mass Storage Enabled
2150 */
2151 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002152
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002153 /**
2154 * If this setting is set (to anything), then all references
2155 * to Gmail on the device must change to Google Mail.
2156 */
2157 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002158
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002160 * If accessibility is enabled.
2161 */
2162 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2163
2164 /**
2165 * List of the enabled accessibility providers.
2166 */
2167 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2168 "enabled_accessibility_services";
2169
2170 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002171 * Setting to always use the default text-to-speech settings regardless
2172 * of the application settings.
2173 * 1 = override application settings,
2174 * 0 = use application settings (if specified).
2175 */
2176 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2177
2178 /**
2179 * Default text-to-speech engine speech rate. 100 = 1x
2180 */
2181 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2182
2183 /**
2184 * Default text-to-speech engine pitch. 100 = 1x
2185 */
2186 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2187
2188 /**
2189 * Default text-to-speech engine.
2190 */
2191 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2192
2193 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002194 * Default text-to-speech language.
2195 */
2196 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2197
2198 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002199 * Default text-to-speech country.
2200 */
2201 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2202
2203 /**
2204 * Default text-to-speech locale variant.
2205 */
2206 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2207
2208 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002209 * Whether to notify the user of open networks.
2210 * <p>
2211 * If not connected and the scan results have an open network, we will
2212 * put this notification up. If we attempt to connect to a network or
2213 * the open network(s) disappear, we remove the notification. When we
2214 * show the notification, we will not show it again for
2215 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2216 */
2217 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2218 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002219
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002220 /**
2221 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2222 * Connecting to a network will reset the timer.
2223 */
2224 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2225 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 /**
2228 * The number of radio channels that are allowed in the local
2229 * 802.11 regulatory domain.
2230 * @hide
2231 */
2232 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002233
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002234 /**
2235 * When the number of open networks exceeds this number, the
2236 * least-recently-used excess networks will be removed.
2237 */
2238 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 /**
2241 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2242 */
2243 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 /**
2246 * The acceptable packet loss percentage (range 0 - 100) before trying
2247 * another AP on the same network.
2248 */
2249 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2250 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 /**
2253 * The number of access points required for a network in order for the
2254 * watchdog to monitor it.
2255 */
2256 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 /**
2259 * The delay between background checks.
2260 */
2261 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2262 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002263
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002264 /**
2265 * Whether the Wi-Fi watchdog is enabled for background checking even
2266 * after it thinks the user has connected to a good access point.
2267 */
2268 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2269 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002270
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002271 /**
2272 * The timeout for a background ping
2273 */
2274 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2275 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002276
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002277 /**
2278 * The number of initial pings to perform that *may* be ignored if they
2279 * fail. Again, if these fail, they will *not* be used in packet loss
2280 * calculation. For example, one network always seemed to time out for
2281 * the first couple pings, so this is set to 3 by default.
2282 */
2283 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2284 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002285
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002286 /**
2287 * The maximum number of access points (per network) to attempt to test.
2288 * If this number is reached, the watchdog will no longer monitor the
2289 * initial connection state for the network. This is a safeguard for
2290 * networks containing multiple APs whose DNS does not respond to pings.
2291 */
2292 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002294 /**
2295 * Whether the Wi-Fi watchdog is enabled.
2296 */
2297 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2298
2299 /**
2300 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002301 */
2302 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2303
2304 /**
2305 * The number of pings to test if an access point is a good connection.
2306 */
2307 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002308
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002309 /**
2310 * The delay between pings.
2311 */
2312 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002313
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002314 /**
2315 * The timeout per ping.
2316 */
2317 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002318
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002319 /**
2320 * The maximum number of times we will retry a connection to an access
2321 * point for which we have failed in acquiring an IP address from DHCP.
2322 * A value of N means that we will make N+1 connection attempts in all.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002323 */
2324 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002325
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002326 /**
2327 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2328 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 */
2330 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2331 "wifi_mobile_data_transition_wakelock_timeout_ms";
2332
2333 /**
2334 * Whether background data usage is allowed by the user. See
2335 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002336 */
2337 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002338
2339 /**
2340 * The CDMA roaming mode 0 = Home Networks, CDMA default
2341 * 1 = Roaming on Affiliated networks
2342 * 2 = Roaming on any networks
2343 * @hide
2344 */
2345 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2346
2347 /**
2348 * The CDMA subscription mode 0 = RUIM/SIM (default)
2349 * 1 = NV
2350 * @hide
2351 */
2352 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2353
2354 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002355 * The preferred network mode 7 = Global
2356 * 6 = EvDo only
2357 * 5 = CDMA w/o EvDo
2358 * 4 = CDMA / EvDo auto
2359 * 3 = GSM / WCDMA auto
2360 * 2 = WCDMA only
2361 * 1 = GSM only
2362 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002363 * @hide
2364 */
2365 public static final String PREFERRED_NETWORK_MODE =
2366 "preferred_network_mode";
2367
2368 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002369 * The preferred TTY mode 0 = TTy Off, CDMA default
2370 * 1 = TTY Full
2371 * 2 = TTY HCO
2372 * 3 = TTY VCO
2373 * @hide
2374 */
2375 public static final String PREFERRED_TTY_MODE =
2376 "preferred_tty_mode";
2377
2378
2379 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002380 * CDMA Cell Broadcast SMS
2381 * 0 = CDMA Cell Broadcast SMS disabled
2382 * 1 = CDMA Cell Broadcast SMS enabled
2383 * @hide
2384 */
2385 public static final String CDMA_CELL_BROADCAST_SMS =
2386 "cdma_cell_broadcast_sms";
2387
2388 /**
2389 * The cdma subscription 0 = Subscription from RUIM, when available
2390 * 1 = Subscription from NV
2391 * @hide
2392 */
2393 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2394 "preferred_cdma_subscription";
2395
2396 /**
2397 * Whether the enhanced voice privacy mode is enabled.
2398 * 0 = normal voice privacy
2399 * 1 = enhanced voice privacy
2400 * @hide
2401 */
2402 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2403
2404 /**
2405 * Whether the TTY mode mode is enabled.
2406 * 0 = disabled
2407 * 1 = enabled
2408 * @hide
2409 */
2410 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002411
2412 /**
Amith Yamasani630cd062009-06-19 12:07:02 -07002413 * Flag for allowing service provider to use location information to improve products and
2414 * services.
2415 * Type: int ( 0 = disallow, 1 = allow )
2416 * @hide
2417 */
2418 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
2419
2420 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002421 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002422 * Type: int ( 0 = disabled, 1 = enabled )
2423 * @hide
2424 */
2425 public static final String BACKUP_ENABLED = "backup_enabled";
2426
2427 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08002428 * Controls whether application data is automatically restored from backup
2429 * at install time.
2430 * Type: int ( 0 = disabled, 1 = enabled )
2431 * @hide
2432 */
2433 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2434
2435 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002436 * Indicates whether settings backup has been fully provisioned.
2437 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2438 * @hide
2439 */
2440 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2441
2442 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002443 * Component of the transport to use for backup/restore.
2444 * @hide
2445 */
2446 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002447
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002448 /**
2449 * Version for which the setup wizard was last shown. Bumped for
2450 * each release when there is new setup information to show.
2451 * @hide
2452 */
2453 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002454
2455 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08002456 * How frequently (in seconds) to check the memory status of the
2457 * device.
2458 * @hide
2459 */
2460 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2461
2462 /**
2463 * Max frequency (in seconds) to log memory check stats, in realtime
2464 * seconds. This allows for throttling of logs when the device is
2465 * running for large amounts of time.
2466 * @hide
2467 */
2468 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2469 "memcheck_log_realtime_interval";
2470
2471 /**
2472 * Boolean indicating whether rebooting due to system memory checks
2473 * is enabled.
2474 * @hide
2475 */
2476 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2477
2478 /**
2479 * How many bytes the system process must be below to avoid scheduling
2480 * a soft reboot. This reboot will happen when it is next determined
2481 * to be a good time.
2482 * @hide
2483 */
2484 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2485
2486 /**
2487 * How many bytes the system process must be below to avoid scheduling
2488 * a hard reboot. This reboot will happen immediately.
2489 * @hide
2490 */
2491 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2492
2493 /**
2494 * How many bytes the phone process must be below to avoid scheduling
2495 * a soft restart. This restart will happen when it is next determined
2496 * to be a good time.
2497 * @hide
2498 */
2499 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2500
2501 /**
2502 * How many bytes the phone process must be below to avoid scheduling
2503 * a hard restart. This restart will happen immediately.
2504 * @hide
2505 */
2506 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2507
2508 /**
2509 * Boolean indicating whether restarting the phone process due to
2510 * memory checks is enabled.
2511 * @hide
2512 */
2513 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2514
2515 /**
2516 * First time during the day it is okay to kill processes
2517 * or reboot the device due to low memory situations. This number is
2518 * in seconds since midnight.
2519 * @hide
2520 */
2521 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2522
2523 /**
2524 * Last time during the day it is okay to kill processes
2525 * or reboot the device due to low memory situations. This number is
2526 * in seconds since midnight.
2527 * @hide
2528 */
2529 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2530
2531 /**
2532 * How long the screen must have been off in order to kill processes
2533 * or reboot. This number is in seconds. A value of -1 means to
2534 * entirely disregard whether the screen is on.
2535 * @hide
2536 */
2537 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2538
2539 /**
2540 * How much time there must be until the next alarm in order to kill processes
2541 * or reboot. This number is in seconds. Note: this value must be
2542 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2543 * always see an alarm scheduled within its time.
2544 * @hide
2545 */
2546 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2547
2548 /**
2549 * How frequently to check whether it is a good time to restart things,
2550 * if the device is in a bad state. This number is in seconds. Note:
2551 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2552 * the alarm to schedule the recheck will always appear within the
2553 * minimum "do not execute now" time.
2554 * @hide
2555 */
2556 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2557
2558 /**
2559 * How frequently (in DAYS) to reboot the device. If 0, no reboots
2560 * will occur.
2561 * @hide
2562 */
2563 public static final String REBOOT_INTERVAL = "reboot_interval";
2564
2565 /**
2566 * First time during the day it is okay to force a reboot of the
2567 * device (if REBOOT_INTERVAL is set). This number is
2568 * in seconds since midnight.
2569 * @hide
2570 */
2571 public static final String REBOOT_START_TIME = "reboot_start_time";
2572
2573 /**
2574 * The window of time (in seconds) after each REBOOT_INTERVAL in which
2575 * a reboot can be executed. If 0, a reboot will always be executed at
2576 * exactly the given time. Otherwise, it will only be executed if
2577 * the device is idle within the window.
2578 * @hide
2579 */
2580 public static final String REBOOT_WINDOW = "reboot_window";
2581
2582 /**
Doug Zongker43866e02010-01-07 12:09:54 -08002583 * Threshold values for the duration and level of a discharge cycle, under
2584 * which we log discharge cycle info.
2585 * @hide
2586 */
2587 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
2588 "battery_discharge_duration_threshold";
2589 /** @hide */
2590 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
2591
2592 /**
2593 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
2594 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
2595 * will never display the "Report" button.
2596 * Type: int ( 0 = disallow, 1 = allow )
2597 * @hide
2598 */
2599 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
2600
2601 /**
2602 * Nonzero causes Log.wtf() to crash.
2603 * @hide
2604 */
2605 public static final String WTF_IS_FATAL = "wtf_is_fatal";
2606
2607 /**
2608 * Maximum age of entries kept by {@link android.os.IDropBox}.
2609 * @hide
2610 */
2611 public static final String DROPBOX_AGE_SECONDS =
2612 "dropbox_age_seconds";
2613 /**
2614 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
2615 * @hide
2616 */
2617 public static final String DROPBOX_QUOTA_KB =
2618 "dropbox_quota_kb";
2619 /**
2620 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
2621 * @hide
2622 */
2623 public static final String DROPBOX_QUOTA_PERCENT =
2624 "dropbox_quota_percent";
2625 /**
2626 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
2627 * @hide
2628 */
2629 public static final String DROPBOX_RESERVE_PERCENT =
2630 "dropbox_reserve_percent";
2631 /**
2632 * Prefix for per-tag dropbox disable/enable settings.
2633 * @hide
2634 */
2635 public static final String DROPBOX_TAG_PREFIX =
2636 "dropbox:";
2637
2638
2639 /**
2640 * Screen timeout in milliseconds corresponding to the
2641 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
2642 * possible screen timeout behavior.)
2643 * @hide
2644 */
2645 public static final String SHORT_KEYLIGHT_DELAY_MS =
2646 "short_keylight_delay_ms";
2647
2648 /**
2649 * The interval in minutes after which the amount of free storage left on the
2650 * device is logged to the event log
2651 * @hide
2652 */
2653 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
2654 "sys_free_storage_log_interval";
2655
2656 /**
2657 * Threshold for the amount of change in disk free space required to report the amount of
2658 * free space. Used to prevent spamming the logs when the disk free space isn't changing
2659 * frequently.
2660 * @hide
2661 */
2662 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
2663 "disk_free_change_reporting_threshold";
2664
2665
2666 /**
2667 * Minimum percentage of free storage on the device that is used to determine if
2668 * the device is running low on storage.
2669 * Say this value is set to 10, the device is considered running low on storage
2670 * if 90% or more of the device storage is filled up.
2671 * @hide
2672 */
2673 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
2674 "sys_storage_threshold_percentage";
2675
2676 /**
2677 * The interval in milliseconds after which Wi-Fi is considered idle.
2678 * When idle, it is possible for the device to be switched from Wi-Fi to
2679 * the mobile data network.
2680 * @hide
2681 */
2682 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
2683
2684 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08002685 * The interval in milliseconds at which to check packet counts on the
2686 * mobile data interface when screen is on, to detect possible data
2687 * connection problems.
2688 * @hide
2689 */
2690 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
2691 "pdp_watchdog_poll_interval_ms";
2692
2693 /**
2694 * The interval in milliseconds at which to check packet counts on the
2695 * mobile data interface when screen is off, to detect possible data
2696 * connection problems.
2697 * @hide
2698 */
2699 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
2700 "pdp_watchdog_long_poll_interval_ms";
2701
2702 /**
2703 * The interval in milliseconds at which to check packet counts on the
2704 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
2705 * outgoing packets has been reached without incoming packets.
2706 * @hide
2707 */
2708 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
2709 "pdp_watchdog_error_poll_interval_ms";
2710
2711 /**
2712 * The number of outgoing packets sent without seeing an incoming packet
2713 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
2714 * device is logged to the event log
2715 * @hide
2716 */
2717 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
2718 "pdp_watchdog_trigger_packet_count";
2719
2720 /**
2721 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
2722 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
2723 * attempting data connection recovery.
2724 * @hide
2725 */
2726 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
2727 "pdp_watchdog_error_poll_count";
2728
2729 /**
2730 * The number of failed PDP reset attempts before moving to something more
2731 * drastic: re-registering to the network.
2732 * @hide
2733 */
2734 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
2735 "pdp_watchdog_max_pdp_reset_fail_count";
2736
2737 /**
2738 * Address to ping as a last sanity check before attempting any recovery.
2739 * Unset or set to "0.0.0.0" to skip this check.
2740 * @hide
2741 */
2742 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
2743
2744 /**
2745 * The "-w deadline" parameter for the ping, ie, the max time in
2746 * seconds to spend pinging.
2747 * @hide
2748 */
2749 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
2750
2751 /**
2752 * The interval in milliseconds at which to check gprs registration
2753 * after the first registration mismatch of gprs and voice service,
2754 * to detect possible data network registration problems.
2755 *
2756 * @hide
2757 */
2758 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
2759 "gprs_register_check_period_ms";
2760
2761 /**
2762 * The length of time in milli-seconds that automatic small adjustments to
2763 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
2764 * @hide
2765 */
2766 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
2767
2768 /**
2769 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
2770 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
2771 * exceeded.
2772 * @hide
2773 */
2774 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
2775
2776 /**
2777 * The maximum reconnect delay for short network outages or when the network is suspended
2778 * due to phone use.
2779 * @hide
2780 */
2781 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
2782 "sync_max_retry_delay_in_seconds";
2783
2784 /**
2785 * The interval in milliseconds at which to check the number of SMS sent
2786 * out without asking for use permit, to limit the un-authorized SMS
2787 * usage.
2788 * @hide
2789 */
2790 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
2791 "sms_outgoing_check_interval_ms";
2792
2793 /**
2794 * The number of outgoing SMS sent without asking for user permit
2795 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
2796 * @hide
2797 */
2798 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
2799 "sms_outgoing_check_max_count";
2800
2801 /**
2802 * Enable use of ssl session caching.
2803 * 'db' - save each session in a (per process) database
2804 * 'file' - save each session in a (per process) file
2805 * not set or any other value - normal java in-memory caching
2806 * @hide
2807 */
2808 public static final String SSL_SESSION_CACHE = "ssl_session_cache";
2809
2810 /**
2811 * How many bytes long a message has to be, in order to be gzipped.
2812 * @hide
2813 */
2814 public static final String SYNC_MIN_GZIP_BYTES =
2815 "sync_min_gzip_bytes";
2816
2817 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08002818 * The number of promoted sources in GlobalSearch.
2819 * @hide
2820 */
2821 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
2822 /**
2823 * The maximum number of suggestions returned by GlobalSearch.
2824 * @hide
2825 */
2826 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
2827 /**
2828 * The number of suggestions GlobalSearch will ask each non-web search source for.
2829 * @hide
2830 */
2831 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
2832 /**
2833 * The number of suggestions the GlobalSearch will ask the web search source for.
2834 * @hide
2835 */
2836 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
2837 "search_web_results_override_limit";
2838 /**
2839 * The number of milliseconds that GlobalSearch will wait for suggestions from
2840 * promoted sources before continuing with all other sources.
2841 * @hide
2842 */
2843 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
2844 "search_promoted_source_deadline_millis";
2845 /**
2846 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
2847 * @hide
2848 */
2849 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
2850 /**
2851 * The maximum number of milliseconds that GlobalSearch shows the previous results
2852 * after receiving a new query.
2853 * @hide
2854 */
2855 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
2856 /**
2857 * The maximum age of log data used for shortcuts in GlobalSearch.
2858 * @hide
2859 */
2860 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
2861 /**
2862 * The maximum age of log data used for source ranking in GlobalSearch.
2863 * @hide
2864 */
2865 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
2866 "search_max_source_event_age_millis";
2867 /**
2868 * The minimum number of impressions needed to rank a source in GlobalSearch.
2869 * @hide
2870 */
2871 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
2872 "search_min_impressions_for_source_ranking";
2873 /**
2874 * The minimum number of clicks needed to rank a source in GlobalSearch.
2875 * @hide
2876 */
2877 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
2878 "search_min_clicks_for_source_ranking";
2879 /**
2880 * The maximum number of shortcuts shown by GlobalSearch.
2881 * @hide
2882 */
2883 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
2884 /**
2885 * The size of the core thread pool for suggestion queries in GlobalSearch.
2886 * @hide
2887 */
2888 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
2889 "search_query_thread_core_pool_size";
2890 /**
2891 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
2892 * @hide
2893 */
2894 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
2895 "search_query_thread_max_pool_size";
2896 /**
2897 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
2898 * @hide
2899 */
2900 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
2901 "search_shortcut_refresh_core_pool_size";
2902 /**
2903 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
2904 * @hide
2905 */
2906 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
2907 "search_shortcut_refresh_max_pool_size";
2908 /**
2909 * The maximun time that excess threads in the GlobalSeach thread pools will
2910 * wait before terminating.
2911 * @hide
2912 */
2913 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
2914 "search_thread_keepalive_seconds";
2915 /**
2916 * The maximum number of concurrent suggestion queries to each source.
2917 * @hide
2918 */
2919 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
2920 "search_per_source_concurrent_query_limit";
2921
San Mehat87734d32010-01-08 12:53:06 -08002922 /**
2923 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
2924 * @hide
2925 */
2926 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
2927
2928 /**
2929 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
2930 * @hide
2931 */
2932 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
2933
2934 /**
2935 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
2936 * @hide
2937 */
2938 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
2939
2940 /**
2941 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
2942 * @hide
2943 */
2944 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08002945
Dan Egnor42471dd2010-01-07 17:25:22 -08002946 /**
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -08002947 * Whether or not a notification is displayed when a Tetherable interface is detected.
2948 * (0 = false, 1 = true)
2949 * @hide
2950 */
2951 public static final String TETHER_NOTIFY = "tether_notify";
2952
2953 /**
Dan Egnor42471dd2010-01-07 17:25:22 -08002954 * If nonzero, ANRs in invisible background processes bring up a dialog.
2955 * Otherwise, the process will be silently killed.
2956 * @hide
2957 */
2958 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
2959
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08002960 /**
-b master501eec92009-07-06 13:53:11 -07002961 * @hide
2962 */
2963 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07002964 ADB_ENABLED,
2965 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07002966 PARENTAL_CONTROL_ENABLED,
2967 PARENTAL_CONTROL_REDIRECT_URL,
2968 USB_MASS_STORAGE_ENABLED,
2969 ACCESSIBILITY_ENABLED,
2970 ENABLED_ACCESSIBILITY_SERVICES,
2971 TTS_USE_DEFAULTS,
2972 TTS_DEFAULT_RATE,
2973 TTS_DEFAULT_PITCH,
2974 TTS_DEFAULT_SYNTH,
2975 TTS_DEFAULT_LANG,
2976 TTS_DEFAULT_COUNTRY,
2977 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
2978 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
2979 WIFI_NUM_ALLOWED_CHANNELS,
2980 WIFI_NUM_OPEN_NETWORKS_KEPT,
San Mehat87734d32010-01-08 12:53:06 -08002981 MOUNT_PLAY_NOTIFICATION_SND,
2982 MOUNT_UMS_AUTOSTART,
2983 MOUNT_UMS_PROMPT,
2984 MOUNT_UMS_NOTIFY_ENABLED
-b master501eec92009-07-06 13:53:11 -07002985 };
2986
2987 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002988 * Helper method for determining if a location provider is enabled.
2989 * @param cr the content resolver to use
2990 * @param provider the location provider to query
2991 * @return true if the provider is enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002992 */
2993 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
2994 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
2995 if (allowedProviders != null) {
2996 return (allowedProviders.equals(provider) ||
2997 allowedProviders.contains("," + provider + ",") ||
2998 allowedProviders.startsWith(provider + ",") ||
2999 allowedProviders.endsWith("," + provider));
3000 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003001 return false;
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003002 }
3003
3004 /**
3005 * Thread-safe method for enabling or disabling a single location provider.
3006 * @param cr the content resolver to use
3007 * @param provider the location provider to enable or disable
3008 * @param enabled true if the provider should be enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003009 */
3010 public static final void setLocationProviderEnabled(ContentResolver cr,
3011 String provider, boolean enabled) {
3012 // to ensure thread safety, we write the provider name with a '+' or '-'
3013 // and let the SettingsProvider handle it rather than reading and modifying
3014 // the list of enabled providers.
3015 if (enabled) {
3016 provider = "+" + provider;
3017 } else {
3018 provider = "-" + provider;
3019 }
3020 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3021 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003022 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003023
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003024 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003025 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3026 * Intent URL, allowing it to be either a web page or a particular
3027 * application activity.
3028 *
3029 * @hide
3030 */
3031 public static final class Bookmarks implements BaseColumns
3032 {
3033 private static final String TAG = "Bookmarks";
3034
3035 /**
3036 * The content:// style URL for this table
3037 */
3038 public static final Uri CONTENT_URI =
3039 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3040
3041 /**
3042 * The row ID.
3043 * <p>Type: INTEGER</p>
3044 */
3045 public static final String ID = "_id";
3046
3047 /**
3048 * Descriptive name of the bookmark that can be displayed to the user.
3049 * If this is empty, the title should be resolved at display time (use
3050 * {@link #getTitle(Context, Cursor)} any time you want to display the
3051 * title of a bookmark.)
3052 * <P>
3053 * Type: TEXT
3054 * </P>
3055 */
3056 public static final String TITLE = "title";
3057
3058 /**
3059 * Arbitrary string (displayed to the user) that allows bookmarks to be
3060 * organized into categories. There are some special names for
3061 * standard folders, which all start with '@'. The label displayed for
3062 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3063 * the folder name does not change so you can consistently query for
3064 * the folder regardless of the current locale.
3065 *
3066 * <P>Type: TEXT</P>
3067 *
3068 */
3069 public static final String FOLDER = "folder";
3070
3071 /**
3072 * The Intent URL of the bookmark, describing what it points to. This
3073 * value is given to {@link android.content.Intent#getIntent} to create
3074 * an Intent that can be launched.
3075 * <P>Type: TEXT</P>
3076 */
3077 public static final String INTENT = "intent";
3078
3079 /**
3080 * Optional shortcut character associated with this bookmark.
3081 * <P>Type: INTEGER</P>
3082 */
3083 public static final String SHORTCUT = "shortcut";
3084
3085 /**
3086 * The order in which the bookmark should be displayed
3087 * <P>Type: INTEGER</P>
3088 */
3089 public static final String ORDERING = "ordering";
3090
3091 private static final String[] sIntentProjection = { INTENT };
3092 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3093 private static final String sShortcutSelection = SHORTCUT + "=?";
3094
3095 /**
3096 * Convenience function to retrieve the bookmarked Intent for a
3097 * particular shortcut key.
3098 *
3099 * @param cr The ContentResolver to query.
3100 * @param shortcut The shortcut key.
3101 *
3102 * @return Intent The bookmarked URL, or null if there is no bookmark
3103 * matching the given shortcut.
3104 */
3105 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3106 {
3107 Intent intent = null;
3108
3109 Cursor c = cr.query(CONTENT_URI,
3110 sIntentProjection, sShortcutSelection,
3111 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3112 // Keep trying until we find a valid shortcut
3113 try {
3114 while (intent == null && c.moveToNext()) {
3115 try {
3116 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3117 intent = Intent.getIntent(intentURI);
3118 } catch (java.net.URISyntaxException e) {
3119 // The stored URL is bad... ignore it.
3120 } catch (IllegalArgumentException e) {
3121 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003122 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003123 }
3124 }
3125 } finally {
3126 if (c != null) c.close();
3127 }
3128
3129 return intent;
3130 }
3131
3132 /**
3133 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003134 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003135 * @param cr The ContentResolver to query.
3136 * @param intent The desired target of the bookmark.
3137 * @param title Bookmark title that is shown to the user; null if none
3138 * or it should be resolved to the intent's title.
3139 * @param folder Folder in which to place the bookmark; null if none.
3140 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3141 * this is non-zero and there is an existing bookmark entry
3142 * with this same shortcut, then that existing shortcut is
3143 * cleared (the bookmark is not removed).
3144 * @return The unique content URL for the new bookmark entry.
3145 */
3146 public static Uri add(ContentResolver cr,
3147 Intent intent,
3148 String title,
3149 String folder,
3150 char shortcut,
3151 int ordering)
3152 {
3153 // If a shortcut is supplied, and it is already defined for
3154 // another bookmark, then remove the old definition.
3155 if (shortcut != 0) {
3156 Cursor c = cr.query(CONTENT_URI,
3157 sShortcutProjection, sShortcutSelection,
3158 new String[] { String.valueOf((int) shortcut) }, null);
3159 try {
3160 if (c.moveToFirst()) {
3161 while (c.getCount() > 0) {
3162 if (!c.deleteRow()) {
3163 Log.w(TAG, "Could not delete existing shortcut row");
3164 }
3165 }
3166 }
3167 } finally {
3168 if (c != null) c.close();
3169 }
3170 }
3171
3172 ContentValues values = new ContentValues();
3173 if (title != null) values.put(TITLE, title);
3174 if (folder != null) values.put(FOLDER, folder);
3175 values.put(INTENT, intent.toURI());
3176 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3177 values.put(ORDERING, ordering);
3178 return cr.insert(CONTENT_URI, values);
3179 }
3180
3181 /**
3182 * Return the folder name as it should be displayed to the user. This
3183 * takes care of localizing special folders.
3184 *
3185 * @param r Resources object for current locale; only need access to
3186 * system resources.
3187 * @param folder The value found in the {@link #FOLDER} column.
3188 *
3189 * @return CharSequence The label for this folder that should be shown
3190 * to the user.
3191 */
3192 public static CharSequence getLabelForFolder(Resources r, String folder) {
3193 return folder;
3194 }
3195
3196 /**
3197 * Return the title as it should be displayed to the user. This takes
3198 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003199 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003200 * @param context A context.
3201 * @param cursor A cursor pointing to the row whose title should be
3202 * returned. The cursor must contain at least the {@link #TITLE}
3203 * and {@link #INTENT} columns.
3204 * @return A title that is localized and can be displayed to the user,
3205 * or the empty string if one could not be found.
3206 */
3207 public static CharSequence getTitle(Context context, Cursor cursor) {
3208 int titleColumn = cursor.getColumnIndex(TITLE);
3209 int intentColumn = cursor.getColumnIndex(INTENT);
3210 if (titleColumn == -1 || intentColumn == -1) {
3211 throw new IllegalArgumentException(
3212 "The cursor must contain the TITLE and INTENT columns.");
3213 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003215 String title = cursor.getString(titleColumn);
3216 if (!TextUtils.isEmpty(title)) {
3217 return title;
3218 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003219
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003220 String intentUri = cursor.getString(intentColumn);
3221 if (TextUtils.isEmpty(intentUri)) {
3222 return "";
3223 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003224
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003225 Intent intent;
3226 try {
3227 intent = Intent.getIntent(intentUri);
3228 } catch (URISyntaxException e) {
3229 return "";
3230 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003231
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 PackageManager packageManager = context.getPackageManager();
3233 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3234 return info != null ? info.loadLabel(packageManager) : "";
3235 }
3236 }
3237
3238 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3240 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3241 * from the GoogleLoginService.
3242 *
3243 * @param androidId The Android ID for this device.
3244 * @return The device ID that should be used when connecting to the mobile gtalk server.
3245 * @hide
3246 */
3247 public static String getGTalkDeviceId(long androidId) {
3248 return "android-" + Long.toHexString(androidId);
3249 }
3250}