blob: 9bacde6dd498b7928a826a342b80dcfa7748ec98 [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;
41import android.util.Log;
42
43import java.net.URISyntaxException;
44import java.security.MessageDigest;
45import java.security.NoSuchAlgorithmException;
46import java.util.HashMap;
47import java.util.HashSet;
48
49
50/**
51 * The Settings provider contains global system-level device preferences.
52 */
53public final class Settings {
54
55 // Intent actions for Settings
56
57 /**
58 * Activity Action: Show system settings.
59 * <p>
60 * Input: Nothing.
61 * <p>
62 * Output: nothing.
63 */
64 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
65 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
66
67 /**
68 * Activity Action: Show settings to allow configuration of APNs.
69 * <p>
70 * Input: Nothing.
71 * <p>
72 * Output: nothing.
73 */
74 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
75 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
76
77 /**
78 * Activity Action: Show settings to allow configuration of current location
79 * sources.
80 * <p>
81 * In some cases, a matching Activity may not exist, so ensure you
82 * safeguard against this.
83 * <p>
84 * Input: Nothing.
85 * <p>
86 * Output: Nothing.
87 */
88 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
89 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
90 "android.settings.LOCATION_SOURCE_SETTINGS";
91
92 /**
93 * Activity Action: Show settings to allow configuration of wireless controls
94 * such as Wi-Fi, Bluetooth and Mobile networks.
95 * <p>
96 * In some cases, a matching Activity may not exist, so ensure you
97 * safeguard against this.
98 * <p>
99 * Input: Nothing.
100 * <p>
101 * Output: Nothing.
102 */
103 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
104 public static final String ACTION_WIRELESS_SETTINGS =
105 "android.settings.WIRELESS_SETTINGS";
106
107 /**
108 * Activity Action: Show settings to allow entering/exiting airplane mode.
109 * <p>
110 * In some cases, a matching Activity may not exist, so ensure you
111 * safeguard against this.
112 * <p>
113 * Input: Nothing.
114 * <p>
115 * Output: Nothing.
116 */
117 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
118 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
119 "android.settings.AIRPLANE_MODE_SETTINGS";
120
121 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700122 * Activity Action: Show settings for accessibility modules.
123 * <p>
124 * In some cases, a matching Activity may not exist, so ensure you
125 * safeguard against this.
126 * <p>
127 * Input: Nothing.
128 * <p>
129 * Output: Nothing.
130 */
131 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
132 public static final String ACTION_ACCESSIBILITY_SETTINGS =
133 "android.settings.ACCESSIBILITY_SETTINGS";
134
135 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800136 * Activity Action: Show settings to allow configuration of security and
137 * location privacy.
138 * <p>
139 * In some cases, a matching Activity may not exist, so ensure you
140 * safeguard against this.
141 * <p>
142 * Input: Nothing.
143 * <p>
144 * Output: Nothing.
145 */
146 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
147 public static final String ACTION_SECURITY_SETTINGS =
148 "android.settings.SECURITY_SETTINGS";
149
150 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700151 * Activity Action: Show settings to allow configuration of privacy options.
152 * <p>
153 * In some cases, a matching Activity may not exist, so ensure you
154 * safeguard against this.
155 * <p>
156 * Input: Nothing.
157 * <p>
158 * Output: Nothing.
159 */
160 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
161 public static final String ACTION_PRIVACY_SETTINGS =
162 "android.settings.PRIVACY_SETTINGS";
163
164 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165 * Activity Action: Show settings to allow configuration of Wi-Fi.
166
167 * <p>
168 * In some cases, a matching Activity may not exist, so ensure you
169 * safeguard against this.
170 * <p>
171 * Input: Nothing.
172 * <p>
173 * Output: Nothing.
174
175 */
176 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
177 public static final String ACTION_WIFI_SETTINGS =
178 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700179
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180 /**
181 * Activity Action: Show settings to allow configuration of a static IP
182 * address for Wi-Fi.
183 * <p>
184 * In some cases, a matching Activity may not exist, so ensure you safeguard
185 * against this.
186 * <p>
187 * Input: Nothing.
188 * <p>
189 * Output: Nothing.
190 */
191 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
192 public static final String ACTION_WIFI_IP_SETTINGS =
193 "android.settings.WIFI_IP_SETTINGS";
194
195 /**
196 * Activity Action: Show settings to allow configuration of Bluetooth.
197 * <p>
198 * In some cases, a matching Activity may not exist, so ensure you
199 * safeguard against this.
200 * <p>
201 * Input: Nothing.
202 * <p>
203 * Output: Nothing.
204 */
205 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
206 public static final String ACTION_BLUETOOTH_SETTINGS =
207 "android.settings.BLUETOOTH_SETTINGS";
208
209 /**
210 * Activity Action: Show settings to allow configuration of date and time.
211 * <p>
212 * In some cases, a matching Activity may not exist, so ensure you
213 * safeguard against this.
214 * <p>
215 * Input: Nothing.
216 * <p>
217 * Output: Nothing.
218 */
219 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
220 public static final String ACTION_DATE_SETTINGS =
221 "android.settings.DATE_SETTINGS";
222
223 /**
224 * Activity Action: Show settings to allow configuration of sound and volume.
225 * <p>
226 * In some cases, a matching Activity may not exist, so ensure you
227 * safeguard against this.
228 * <p>
229 * Input: Nothing.
230 * <p>
231 * Output: Nothing.
232 */
233 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
234 public static final String ACTION_SOUND_SETTINGS =
235 "android.settings.SOUND_SETTINGS";
236
237 /**
238 * Activity Action: Show settings to allow configuration of display.
239 * <p>
240 * In some cases, a matching Activity may not exist, so ensure you
241 * safeguard against this.
242 * <p>
243 * Input: Nothing.
244 * <p>
245 * Output: Nothing.
246 */
247 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
248 public static final String ACTION_DISPLAY_SETTINGS =
249 "android.settings.DISPLAY_SETTINGS";
250
251 /**
252 * Activity Action: Show settings to allow configuration of locale.
253 * <p>
254 * In some cases, a matching Activity may not exist, so ensure you
255 * safeguard against this.
256 * <p>
257 * Input: Nothing.
258 * <p>
259 * Output: Nothing.
260 */
261 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
262 public static final String ACTION_LOCALE_SETTINGS =
263 "android.settings.LOCALE_SETTINGS";
264
265 /**
266 * Activity Action: Show settings to configure input methods, in particular
267 * allowing the user to enable input methods.
268 * <p>
269 * In some cases, a matching Activity may not exist, so ensure you
270 * safeguard against this.
271 * <p>
272 * Input: Nothing.
273 * <p>
274 * Output: Nothing.
275 */
276 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
277 public static final String ACTION_INPUT_METHOD_SETTINGS =
278 "android.settings.INPUT_METHOD_SETTINGS";
279
280 /**
281 * Activity Action: Show settings to manage the user input dictionary.
282 * <p>
283 * In some cases, a matching Activity may not exist, so ensure you
284 * safeguard against this.
285 * <p>
286 * Input: Nothing.
287 * <p>
288 * Output: Nothing.
289 */
290 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
291 public static final String ACTION_USER_DICTIONARY_SETTINGS =
292 "android.settings.USER_DICTIONARY_SETTINGS";
293
294 /**
295 * Activity Action: Show settings to allow configuration of application-related settings.
296 * <p>
297 * In some cases, a matching Activity may not exist, so ensure you
298 * safeguard against this.
299 * <p>
300 * Input: Nothing.
301 * <p>
302 * Output: Nothing.
303 */
304 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
305 public static final String ACTION_APPLICATION_SETTINGS =
306 "android.settings.APPLICATION_SETTINGS";
307
308 /**
309 * Activity Action: Show settings to allow configuration of application
310 * development-related settings.
311 * <p>
312 * In some cases, a matching Activity may not exist, so ensure you safeguard
313 * against this.
314 * <p>
315 * Input: Nothing.
316 * <p>
317 * Output: Nothing.
318 */
319 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
320 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
321 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
322
323 /**
324 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
325 * <p>
326 * In some cases, a matching Activity may not exist, so ensure you
327 * safeguard against this.
328 * <p>
329 * Input: Nothing.
330 * <p>
331 * Output: Nothing.
332 */
333 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
334 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
335 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700336
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800337 /**
338 * Activity Action: Show settings to manage installed applications.
339 * <p>
340 * In some cases, a matching Activity may not exist, so ensure you
341 * safeguard against this.
342 * <p>
343 * Input: Nothing.
344 * <p>
345 * Output: Nothing.
346 */
347 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
348 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
349 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 /**
352 * Activity Action: Show settings for system update functionality.
353 * <p>
354 * In some cases, a matching Activity may not exist, so ensure you
355 * safeguard against this.
356 * <p>
357 * Input: Nothing.
358 * <p>
359 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700360 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800361 * @hide
362 */
363 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
364 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
365 "android.settings.SYSTEM_UPDATE_SETTINGS";
366
367 /**
368 * Activity Action: Show settings to allow configuration of sync settings.
369 * <p>
370 * In some cases, a matching Activity may not exist, so ensure you
371 * safeguard against this.
372 * <p>
373 * Input: Nothing.
374 * <p>
375 * Output: Nothing.
376 */
377 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
378 public static final String ACTION_SYNC_SETTINGS =
379 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800381 /**
382 * Activity Action: Show settings for selecting the network operator.
383 * <p>
384 * In some cases, a matching Activity may not exist, so ensure you
385 * safeguard against this.
386 * <p>
387 * Input: Nothing.
388 * <p>
389 * Output: Nothing.
390 */
391 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
392 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
393 "android.settings.NETWORK_OPERATOR_SETTINGS";
394
395 /**
396 * Activity Action: Show settings for selection of 2G/3G.
397 * <p>
398 * In some cases, a matching Activity may not exist, so ensure you
399 * safeguard against this.
400 * <p>
401 * Input: Nothing.
402 * <p>
403 * Output: Nothing.
404 */
405 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
406 public static final String ACTION_DATA_ROAMING_SETTINGS =
407 "android.settings.DATA_ROAMING_SETTINGS";
408
409 /**
410 * Activity Action: Show settings for internal storage.
411 * <p>
412 * In some cases, a matching Activity may not exist, so ensure you
413 * safeguard against this.
414 * <p>
415 * Input: Nothing.
416 * <p>
417 * Output: Nothing.
418 */
419 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
420 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
421 "android.settings.INTERNAL_STORAGE_SETTINGS";
422 /**
423 * Activity Action: Show settings for memory card storage.
424 * <p>
425 * In some cases, a matching Activity may not exist, so ensure you
426 * safeguard against this.
427 * <p>
428 * Input: Nothing.
429 * <p>
430 * Output: Nothing.
431 */
432 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
433 public static final String ACTION_MEMORY_CARD_SETTINGS =
434 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700435
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800436 // End of Intent actions for Settings
437
438 private static final String JID_RESOURCE_PREFIX = "android";
439
440 public static final String AUTHORITY = "settings";
441
442 private static final String TAG = "Settings";
443
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800444 public static class SettingNotFoundException extends AndroidException {
445 public SettingNotFoundException(String msg) {
446 super(msg);
447 }
448 }
449
450 /**
451 * Common base for tables of name/value settings.
452 */
453 public static class NameValueTable implements BaseColumns {
454 public static final String NAME = "name";
455 public static final String VALUE = "value";
456
457 protected static boolean putString(ContentResolver resolver, Uri uri,
458 String name, String value) {
459 // The database will take care of replacing duplicates.
460 try {
461 ContentValues values = new ContentValues();
462 values.put(NAME, name);
463 values.put(VALUE, value);
464 resolver.insert(uri, values);
465 return true;
466 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700467 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800468 return false;
469 }
470 }
471
472 public static Uri getUriFor(Uri uri, String name) {
473 return Uri.withAppendedPath(uri, name);
474 }
475 }
476
477 private static class NameValueCache {
478 private final String mVersionSystemProperty;
479 private final HashMap<String, String> mValues = Maps.newHashMap();
480 private long mValuesVersion = 0;
481 private final Uri mUri;
482
483 NameValueCache(String versionSystemProperty, Uri uri) {
484 mVersionSystemProperty = versionSystemProperty;
485 mUri = uri;
486 }
487
488 String getString(ContentResolver cr, String name) {
489 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
490 if (mValuesVersion != newValuesVersion) {
491 mValues.clear();
492 mValuesVersion = newValuesVersion;
493 }
494 if (!mValues.containsKey(name)) {
495 String value = null;
496 Cursor c = null;
497 try {
498 c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE },
499 Settings.NameValueTable.NAME + "=?", new String[]{name}, null);
500 if (c != null && c.moveToNext()) value = c.getString(0);
501 mValues.put(name, value);
502 } catch (SQLException e) {
503 // SQL error: return null, but don't cache it.
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700504 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 } finally {
506 if (c != null) c.close();
507 }
508 return value;
509 } else {
510 return mValues.get(name);
511 }
512 }
513 }
514
515 /**
516 * System settings, containing miscellaneous system preferences. This
517 * table holds simple name/value pairs. There are convenience
518 * functions for accessing individual settings entries.
519 */
520 public static final class System extends NameValueTable {
521 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
522
523 private static volatile NameValueCache mNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700524
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 private static final HashSet<String> MOVED_TO_SECURE;
526 static {
527 MOVED_TO_SECURE = new HashSet<String>(30);
528 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
529 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
530 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
531 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
532 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
533 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
534 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
535 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
536 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
537 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
538 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
539 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
540 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
541 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
542 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
543 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
544 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
545 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
546 MOVED_TO_SECURE.add(Secure.WIFI_ON);
547 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
548 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
549 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
550 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
551 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
552 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
553 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
554 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
555 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
556 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
557 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
558 }
559
560 /**
561 * Look up a name in the database.
562 * @param resolver to access the database with
563 * @param name to look up in the table
564 * @return the corresponding value, or null if not present
565 */
566 public synchronized static String getString(ContentResolver resolver, String name) {
567 if (MOVED_TO_SECURE.contains(name)) {
568 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
569 + " to android.provider.Settings.Secure, returning read-only value.");
570 return Secure.getString(resolver, name);
571 }
572 if (mNameValueCache == null) {
573 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
574 }
575 return mNameValueCache.getString(resolver, name);
576 }
577
578 /**
579 * Store a name/value pair into the database.
580 * @param resolver to access the database with
581 * @param name to store
582 * @param value to associate with the name
583 * @return true if the value was set, false on database errors
584 */
585 public static boolean putString(ContentResolver resolver, String name, String value) {
586 if (MOVED_TO_SECURE.contains(name)) {
587 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
588 + " to android.provider.Settings.Secure, value is unchanged.");
589 return false;
590 }
591 return putString(resolver, CONTENT_URI, name, value);
592 }
593
594 /**
595 * Construct the content URI for a particular name/value pair,
596 * useful for monitoring changes with a ContentObserver.
597 * @param name to look up in the table
598 * @return the corresponding content URI, or null if not present
599 */
600 public static Uri getUriFor(String name) {
601 if (MOVED_TO_SECURE.contains(name)) {
602 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
603 + " to android.provider.Settings.Secure, returning Secure URI.");
604 return Secure.getUriFor(Secure.CONTENT_URI, name);
605 }
606 return getUriFor(CONTENT_URI, name);
607 }
608
609 /**
610 * Convenience function for retrieving a single system settings value
611 * as an integer. Note that internally setting values are always
612 * stored as strings; this function converts the string to an integer
613 * for you. The default value will be returned if the setting is
614 * not defined or not an integer.
615 *
616 * @param cr The ContentResolver to access.
617 * @param name The name of the setting to retrieve.
618 * @param def Value to return if the setting is not defined.
619 *
620 * @return The setting's current value, or 'def' if it is not defined
621 * or not a valid integer.
622 */
623 public static int getInt(ContentResolver cr, String name, int def) {
624 String v = getString(cr, name);
625 try {
626 return v != null ? Integer.parseInt(v) : def;
627 } catch (NumberFormatException e) {
628 return def;
629 }
630 }
631
632 /**
633 * Convenience function for retrieving a single system settings value
634 * as an integer. Note that internally setting values are always
635 * stored as strings; this function converts the string to an integer
636 * for you.
637 * <p>
638 * This version does not take a default value. If the setting has not
639 * been set, or the string value is not a number,
640 * it throws {@link SettingNotFoundException}.
641 *
642 * @param cr The ContentResolver to access.
643 * @param name The name of the setting to retrieve.
644 *
645 * @throws SettingNotFoundException Thrown if a setting by the given
646 * name can't be found or the setting value is not an integer.
647 *
648 * @return The setting's current value.
649 */
650 public static int getInt(ContentResolver cr, String name)
651 throws SettingNotFoundException {
652 String v = getString(cr, name);
653 try {
654 return Integer.parseInt(v);
655 } catch (NumberFormatException e) {
656 throw new SettingNotFoundException(name);
657 }
658 }
659
660 /**
661 * Convenience function for updating a single settings value as an
662 * integer. This will either create a new entry in the table if the
663 * given name does not exist, or modify the value of the existing row
664 * with that name. Note that internally setting values are always
665 * stored as strings, so this function converts the given value to a
666 * string before storing it.
667 *
668 * @param cr The ContentResolver to access.
669 * @param name The name of the setting to modify.
670 * @param value The new value for the setting.
671 * @return true if the value was set, false on database errors
672 */
673 public static boolean putInt(ContentResolver cr, String name, int value) {
674 return putString(cr, name, Integer.toString(value));
675 }
676
677 /**
678 * Convenience function for retrieving a single system settings value
679 * as a {@code long}. Note that internally setting values are always
680 * stored as strings; this function converts the string to a {@code long}
681 * for you. The default value will be returned if the setting is
682 * not defined or not a {@code long}.
683 *
684 * @param cr The ContentResolver to access.
685 * @param name The name of the setting to retrieve.
686 * @param def Value to return if the setting is not defined.
687 *
688 * @return The setting's current value, or 'def' if it is not defined
689 * or not a valid {@code long}.
690 */
691 public static long getLong(ContentResolver cr, String name, long def) {
692 String valString = getString(cr, name);
693 long value;
694 try {
695 value = valString != null ? Long.parseLong(valString) : def;
696 } catch (NumberFormatException e) {
697 value = def;
698 }
699 return value;
700 }
701
702 /**
703 * Convenience function for retrieving a single system settings value
704 * as a {@code long}. Note that internally setting values are always
705 * stored as strings; this function converts the string to a {@code long}
706 * for you.
707 * <p>
708 * This version does not take a default value. If the setting has not
709 * been set, or the string value is not a number,
710 * it throws {@link SettingNotFoundException}.
711 *
712 * @param cr The ContentResolver to access.
713 * @param name The name of the setting to retrieve.
714 *
715 * @return The setting's current value.
716 * @throws SettingNotFoundException Thrown if a setting by the given
717 * name can't be found or the setting value is not an integer.
718 */
719 public static long getLong(ContentResolver cr, String name)
720 throws SettingNotFoundException {
721 String valString = getString(cr, name);
722 try {
723 return Long.parseLong(valString);
724 } catch (NumberFormatException e) {
725 throw new SettingNotFoundException(name);
726 }
727 }
728
729 /**
730 * Convenience function for updating a single settings value as a long
731 * integer. This will either create a new entry in the table if the
732 * given name does not exist, or modify the value of the existing row
733 * with that name. Note that internally setting values are always
734 * stored as strings, so this function converts the given value to a
735 * string before storing it.
736 *
737 * @param cr The ContentResolver to access.
738 * @param name The name of the setting to modify.
739 * @param value The new value for the setting.
740 * @return true if the value was set, false on database errors
741 */
742 public static boolean putLong(ContentResolver cr, String name, long value) {
743 return putString(cr, name, Long.toString(value));
744 }
745
746 /**
747 * Convenience function for retrieving a single system settings value
748 * as a floating point number. Note that internally setting values are
749 * always stored as strings; this function converts the string to an
750 * float for you. The default value will be returned if the setting
751 * is not defined or not a valid float.
752 *
753 * @param cr The ContentResolver to access.
754 * @param name The name of the setting to retrieve.
755 * @param def Value to return if the setting is not defined.
756 *
757 * @return The setting's current value, or 'def' if it is not defined
758 * or not a valid float.
759 */
760 public static float getFloat(ContentResolver cr, String name, float def) {
761 String v = getString(cr, name);
762 try {
763 return v != null ? Float.parseFloat(v) : def;
764 } catch (NumberFormatException e) {
765 return def;
766 }
767 }
768
769 /**
770 * Convenience function for retrieving a single system settings value
771 * as a float. Note that internally setting values are always
772 * stored as strings; this function converts the string to a float
773 * for you.
774 * <p>
775 * This version does not take a default value. If the setting has not
776 * been set, or the string value is not a number,
777 * it throws {@link SettingNotFoundException}.
778 *
779 * @param cr The ContentResolver to access.
780 * @param name The name of the setting to retrieve.
781 *
782 * @throws SettingNotFoundException Thrown if a setting by the given
783 * name can't be found or the setting value is not a float.
784 *
785 * @return The setting's current value.
786 */
787 public static float getFloat(ContentResolver cr, String name)
788 throws SettingNotFoundException {
789 String v = getString(cr, name);
790 try {
791 return Float.parseFloat(v);
792 } catch (NumberFormatException e) {
793 throw new SettingNotFoundException(name);
794 }
795 }
796
797 /**
798 * Convenience function for updating a single settings value as a
799 * floating point number. This will either create a new entry in the
800 * table if the given name does not exist, or modify the value of the
801 * existing row with that name. Note that internally setting values
802 * are always stored as strings, so this function converts the given
803 * value to a string before storing it.
804 *
805 * @param cr The ContentResolver to access.
806 * @param name The name of the setting to modify.
807 * @param value The new value for the setting.
808 * @return true if the value was set, false on database errors
809 */
810 public static boolean putFloat(ContentResolver cr, String name, float value) {
811 return putString(cr, name, Float.toString(value));
812 }
813
814 /**
815 * Convenience function to read all of the current
816 * configuration-related settings into a
817 * {@link Configuration} object.
818 *
819 * @param cr The ContentResolver to access.
820 * @param outConfig Where to place the configuration settings.
821 */
822 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
823 outConfig.fontScale = Settings.System.getFloat(
824 cr, FONT_SCALE, outConfig.fontScale);
825 if (outConfig.fontScale < 0) {
826 outConfig.fontScale = 1;
827 }
828 }
829
830 /**
831 * Convenience function to write a batch of configuration-related
832 * settings from a {@link Configuration} object.
833 *
834 * @param cr The ContentResolver to access.
835 * @param config The settings to write.
836 * @return true if the values were set, false on database errors
837 */
838 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
839 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
840 }
841
842 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
843 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
844 }
845
846 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
847 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
848 }
849
850 /**
851 * The content:// style URL for this table
852 */
853 public static final Uri CONTENT_URI =
854 Uri.parse("content://" + AUTHORITY + "/system");
855
856 /**
857 * Whether we keep the device on while the device is plugged in.
858 * Supported values are:
859 * <ul>
860 * <li>{@code 0} to never stay on while plugged in</li>
861 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
862 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
863 * </ul>
864 * These values can be OR-ed together.
865 */
866 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
867
868 /**
869 * What happens when the user presses the end call button if they're not
870 * on a call.<br/>
871 * <b>Values:</b><br/>
872 * 0 - The end button does nothing.<br/>
873 * 1 - The end button goes to the home screen.<br/>
874 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
875 * 3 - The end button goes to the home screen. If the user is already on the
876 * home screen, it puts the device to sleep.
877 */
878 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
879
880 /**
881 * Whether Airplane Mode is on.
882 */
883 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
884
885 /**
886 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
887 */
888 public static final String RADIO_BLUETOOTH = "bluetooth";
889
890 /**
891 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
892 */
893 public static final String RADIO_WIFI = "wifi";
894
895 /**
896 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
897 */
898 public static final String RADIO_CELL = "cell";
899
900 /**
901 * A comma separated list of radios that need to be disabled when airplane mode
902 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
903 * included in the comma separated list.
904 */
905 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
906
907 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -0700908 * A comma separated list of radios that should to be disabled when airplane mode
909 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
910 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
911 * will be turned off when entering airplane mode, but the user will be able to reenable
912 * Wifi in the Settings app.
913 *
914 * {@hide}
915 */
916 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
917
918 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800919 * The policy for deciding when Wi-Fi should go to sleep (which will in
920 * turn switch to using the mobile data as an Internet connection).
921 * <p>
922 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
923 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
924 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800925 */
926 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
927
928 /**
929 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
930 * policy, which is to sleep shortly after the turning off
931 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800932 */
933 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
934
935 /**
936 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
937 * the device is on battery, and never go to sleep when the device is
938 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800939 */
940 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700941
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800942 /**
943 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 */
945 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700946
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800947 /**
948 * Whether to use static IP and other static network attributes.
949 * <p>
950 * Set to 1 for true and 0 for false.
951 */
952 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
953
954 /**
955 * The static IP address.
956 * <p>
957 * Example: "192.168.1.51"
958 */
959 public static final String WIFI_STATIC_IP = "wifi_static_ip";
960
961 /**
962 * If using static IP, the gateway's IP address.
963 * <p>
964 * Example: "192.168.1.1"
965 */
966 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
967
968 /**
969 * If using static IP, the net mask.
970 * <p>
971 * Example: "255.255.255.0"
972 */
973 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
974
975 /**
976 * If using static IP, the primary DNS's IP address.
977 * <p>
978 * Example: "192.168.1.1"
979 */
980 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
981
982 /**
983 * If using static IP, the secondary DNS's IP address.
984 * <p>
985 * Example: "192.168.1.2"
986 */
987 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
988
989 /**
990 * The number of radio channels that are allowed in the local
991 * 802.11 regulatory domain.
992 * @hide
993 */
994 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
995
996 /**
997 * Determines whether remote devices may discover and/or connect to
998 * this device.
999 * <P>Type: INT</P>
1000 * 2 -- discoverable and connectable
1001 * 1 -- connectable but not discoverable
1002 * 0 -- neither connectable nor discoverable
1003 */
1004 public static final String BLUETOOTH_DISCOVERABILITY =
1005 "bluetooth_discoverability";
1006
1007 /**
1008 * Bluetooth discoverability timeout. If this value is nonzero, then
1009 * Bluetooth becomes discoverable for a certain number of seconds,
1010 * after which is becomes simply connectable. The value is in seconds.
1011 */
1012 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1013 "bluetooth_discoverability_timeout";
1014
1015 /**
1016 * Whether autolock is enabled (0 = false, 1 = true)
1017 */
1018 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
1019
1020 /**
1021 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
1022 */
1023 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1024
1025 /**
1026 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
1027 */
1028 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1029 "lock_pattern_tactile_feedback_enabled";
1030
1031
1032 /**
1033 * A formatted string of the next alarm that is set, or the empty string
1034 * if there is no alarm set.
1035 */
1036 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1037
1038 /**
1039 * Scaling factor for fonts, float.
1040 */
1041 public static final String FONT_SCALE = "font_scale";
1042
1043 /**
1044 * Name of an application package to be debugged.
1045 */
1046 public static final String DEBUG_APP = "debug_app";
1047
1048 /**
1049 * If 1, when launching DEBUG_APP it will wait for the debugger before
1050 * starting user code. If 0, it will run normally.
1051 */
1052 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1053
1054 /**
1055 * Whether or not to dim the screen. 0=no 1=yes
1056 */
1057 public static final String DIM_SCREEN = "dim_screen";
1058
1059 /**
1060 * The timeout before the screen turns off.
1061 */
1062 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1063
1064 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001065 * If 0, the compatibility mode is off for all applications.
1066 * If 1, older applications run under compatibility mode.
1067 * TODO: remove this settings before code freeze (bug/1907571)
1068 * @hide
1069 */
1070 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1071
1072 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001073 * The screen backlight brightness between 0 and 255.
1074 */
1075 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1076
1077 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001078 * Control whether to enable automatic brightness mode.
1079 * @hide
1080 */
1081 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1082
1083 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001084 * Control whether the process CPU usage meter should be shown.
1085 */
1086 public static final String SHOW_PROCESSES = "show_processes";
1087
1088 /**
1089 * If 1, the activity manager will aggressively finish activities and
1090 * processes as soon as they are no longer needed. If 0, the normal
1091 * extended lifetime is used.
1092 */
1093 public static final String ALWAYS_FINISH_ACTIVITIES =
1094 "always_finish_activities";
1095
1096
1097 /**
1098 * Ringer mode. This is used internally, changing this value will not
1099 * change the ringer mode. See AudioManager.
1100 */
1101 public static final String MODE_RINGER = "mode_ringer";
1102
1103 /**
1104 * Determines which streams are affected by ringer mode changes. The
1105 * stream type's bit should be set to 1 if it should be muted when going
1106 * into an inaudible ringer mode.
1107 */
1108 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1109
1110 /**
1111 * Determines which streams are affected by mute. The
1112 * stream type's bit should be set to 1 if it should be muted when a mute request
1113 * is received.
1114 */
1115 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1116
1117 /**
1118 * Whether vibrate is on for different events. This is used internally,
1119 * changing this value will not change the vibrate. See AudioManager.
1120 */
1121 public static final String VIBRATE_ON = "vibrate_on";
1122
1123 /**
1124 * Ringer volume. This is used internally, changing this value will not
1125 * change the volume. See AudioManager.
1126 */
1127 public static final String VOLUME_RING = "volume_ring";
1128
1129 /**
1130 * System/notifications volume. This is used internally, changing this
1131 * value will not change the volume. See AudioManager.
1132 */
1133 public static final String VOLUME_SYSTEM = "volume_system";
1134
1135 /**
1136 * Voice call volume. This is used internally, changing this value will
1137 * not change the volume. See AudioManager.
1138 */
1139 public static final String VOLUME_VOICE = "volume_voice";
1140
1141 /**
1142 * Music/media/gaming volume. This is used internally, changing this
1143 * value will not change the volume. See AudioManager.
1144 */
1145 public static final String VOLUME_MUSIC = "volume_music";
1146
1147 /**
1148 * Alarm volume. This is used internally, changing this
1149 * value will not change the volume. See AudioManager.
1150 */
1151 public static final String VOLUME_ALARM = "volume_alarm";
1152
1153 /**
1154 * Notification volume. This is used internally, changing this
1155 * value will not change the volume. See AudioManager.
1156 */
1157 public static final String VOLUME_NOTIFICATION = "volume_notification";
1158
1159 /**
1160 * Whether the notifications should use the ring volume (value of 1) or
1161 * a separate notification volume (value of 0). In most cases, users
1162 * will have this enabled so the notification and ringer volumes will be
1163 * the same. However, power users can disable this and use the separate
1164 * notification volume control.
1165 * <p>
1166 * Note: This is a one-off setting that will be removed in the future
1167 * when there is profile support. For this reason, it is kept hidden
1168 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001169 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001170 * @hide
1171 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001172 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001173 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001174
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001175 /**
1176 * The mapping of stream type (integer) to its setting.
1177 */
1178 public static final String[] VOLUME_SETTINGS = {
1179 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
1180 VOLUME_ALARM, VOLUME_NOTIFICATION
1181 };
1182
1183 /**
1184 * Appended to various volume related settings to record the previous
1185 * values before they the settings were affected by a silent/vibrate
1186 * ringer mode change.
1187 */
1188 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1189
1190 /**
1191 * Persistent store for the system-wide default ringtone URI.
1192 * <p>
1193 * If you need to play the default ringtone at any given time, it is recommended
1194 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1195 * to the set default ringtone at the time of playing.
1196 *
1197 * @see #DEFAULT_RINGTONE_URI
1198 */
1199 public static final String RINGTONE = "ringtone";
1200
1201 /**
1202 * A {@link Uri} that will point to the current default ringtone at any
1203 * given time.
1204 * <p>
1205 * If the current default ringtone is in the DRM provider and the caller
1206 * does not have permission, the exception will be a
1207 * FileNotFoundException.
1208 */
1209 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1210
1211 /**
1212 * Persistent store for the system-wide default notification sound.
1213 *
1214 * @see #RINGTONE
1215 * @see #DEFAULT_NOTIFICATION_URI
1216 */
1217 public static final String NOTIFICATION_SOUND = "notification_sound";
1218
1219 /**
1220 * A {@link Uri} that will point to the current default notification
1221 * sound at any given time.
1222 *
1223 * @see #DEFAULT_RINGTONE_URI
1224 */
1225 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1226
1227 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001228 * Persistent store for the system-wide default alarm alert.
1229 *
1230 * @see #RINGTONE
1231 * @see #DEFAULT_ALARM_ALERT_URI
1232 */
1233 public static final String ALARM_ALERT = "alarm_alert";
1234
1235 /**
1236 * A {@link Uri} that will point to the current default alarm alert at
1237 * any given time.
1238 *
1239 * @see #DEFAULT_ALARM_ALERT_URI
1240 */
1241 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1242
1243 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001244 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1245 */
1246 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1247
1248 /**
1249 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1250 */
1251 public static final String TEXT_AUTO_CAPS = "auto_caps";
1252
1253 /**
1254 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1255 * feature converts two spaces to a "." and space.
1256 */
1257 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001258
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 /**
1260 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1261 */
1262 public static final String TEXT_SHOW_PASSWORD = "show_password";
1263
1264 public static final String SHOW_GTALK_SERVICE_STATUS =
1265 "SHOW_GTALK_SERVICE_STATUS";
1266
1267 /**
1268 * Name of activity to use for wallpaper on the home screen.
1269 */
1270 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1271
1272 /**
1273 * Value to specify if the user prefers the date, time and time zone
1274 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1275 */
1276 public static final String AUTO_TIME = "auto_time";
1277
1278 /**
1279 * Display times as 12 or 24 hours
1280 * 12
1281 * 24
1282 */
1283 public static final String TIME_12_24 = "time_12_24";
1284
1285 /**
1286 * Date format string
1287 * mm/dd/yyyy
1288 * dd/mm/yyyy
1289 * yyyy/mm/dd
1290 */
1291 public static final String DATE_FORMAT = "date_format";
1292
1293 /**
1294 * Whether the setup wizard has been run before (on first boot), or if
1295 * it still needs to be run.
1296 *
1297 * nonzero = it has been run in the past
1298 * 0 = it has not been run in the past
1299 */
1300 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1301
1302 /**
1303 * Scaling factor for normal window animations. Setting to 0 will disable window
1304 * animations.
1305 */
1306 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1307
1308 /**
1309 * Scaling factor for activity transition animations. Setting to 0 will disable window
1310 * animations.
1311 */
1312 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1313
1314 /**
1315 * Scaling factor for normal window animations. Setting to 0 will disable window
1316 * animations.
1317 * @hide
1318 */
1319 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1320
1321 /**
1322 * Control whether the accelerometer will be used to change screen
1323 * orientation. If 0, it will not be used unless explicitly requested
1324 * by the application; if 1, it will be used by default unless explicitly
1325 * disabled by the application.
1326 */
1327 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1328
1329 /**
1330 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1331 * boolean (1 or 0).
1332 */
1333 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1334
1335 /**
David Kraused0f67152009-06-13 18:01:13 -05001336 * CDMA only settings
1337 * DTMF tone type played by the dialer when dialing.
1338 * 0 = Normal
1339 * 1 = Long
1340 * @hide
1341 */
1342 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1343
1344 /**
1345 * CDMA only settings
1346 * Emergency Tone 0 = Off
1347 * 1 = Alert
1348 * 2 = Vibrate
1349 * @hide
1350 */
1351 public static final String EMERGENCY_TONE = "emergency_tone";
1352
1353 /**
1354 * CDMA only settings
1355 * Whether the auto retry is enabled. The value is
1356 * boolean (1 or 0).
1357 * @hide
1358 */
1359 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1360
1361 /**
1362 * Whether the hearing aid is enabled. The value is
1363 * boolean (1 or 0).
1364 * @hide
1365 */
1366 public static final String HEARING_AID = "hearing_aid";
1367
1368 /**
1369 * CDMA only settings
1370 * TTY Mode
1371 * 0 = OFF
1372 * 1 = FULL
1373 * 2 = VCO
1374 * 3 = HCO
1375 * @hide
1376 */
1377 public static final String TTY_MODE = "tty_mode";
1378
1379 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001380 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1381 * boolean (1 or 0).
1382 */
1383 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001385 /**
1386 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1387 * boolean (1 or 0).
1388 */
1389 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001390
Mike LeBeau48603e72009-06-05 00:27:00 +01001391 /**
1392 * Whether live web suggestions while the user types into search dialogs are
1393 * enabled. Browsers and other search UIs should respect this, as it allows
1394 * a user to avoid sending partial queries to a search engine, if it poses
1395 * any privacy concern. The value is boolean (1 or 0).
1396 */
1397 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001398
-b master501eec92009-07-06 13:53:11 -07001399 /**
1400 * Settings to backup. This is here so that it's in the same place as the settings
1401 * keys and easy to update.
1402 * @hide
1403 */
1404 public static final String[] SETTINGS_TO_BACKUP = {
1405 STAY_ON_WHILE_PLUGGED_IN,
1406 END_BUTTON_BEHAVIOR,
1407 WIFI_SLEEP_POLICY,
1408 WIFI_USE_STATIC_IP,
1409 WIFI_STATIC_IP,
1410 WIFI_STATIC_GATEWAY,
1411 WIFI_STATIC_NETMASK,
1412 WIFI_STATIC_DNS1,
1413 WIFI_STATIC_DNS2,
1414 BLUETOOTH_DISCOVERABILITY,
1415 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1416 DIM_SCREEN,
1417 SCREEN_OFF_TIMEOUT,
1418 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001419 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001420 VIBRATE_ON,
1421 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001422 MODE_RINGER,
1423 MODE_RINGER_STREAMS_AFFECTED,
1424 MUTE_STREAMS_AFFECTED,
1425 VOLUME_VOICE,
1426 VOLUME_SYSTEM,
1427 VOLUME_RING,
1428 VOLUME_MUSIC,
1429 VOLUME_ALARM,
1430 VOLUME_NOTIFICATION,
1431 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1432 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1433 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1434 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1435 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1436 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
-b master501eec92009-07-06 13:53:11 -07001437 TEXT_AUTO_REPLACE,
1438 TEXT_AUTO_CAPS,
1439 TEXT_AUTO_PUNCTUATE,
1440 TEXT_SHOW_PASSWORD,
1441 AUTO_TIME,
1442 TIME_12_24,
1443 DATE_FORMAT,
1444 ACCELEROMETER_ROTATION,
1445 DTMF_TONE_WHEN_DIALING,
1446 DTMF_TONE_TYPE_WHEN_DIALING,
1447 EMERGENCY_TONE,
1448 CALL_AUTO_RETRY,
1449 HEARING_AID,
1450 TTY_MODE,
1451 SOUND_EFFECTS_ENABLED,
1452 HAPTIC_FEEDBACK_ENABLED,
1453 SHOW_WEB_SUGGESTIONS
1454 };
1455
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001456 // Settings moved to Settings.Secure
1457
1458 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001459 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001460 * instead
1461 */
1462 @Deprecated
1463 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1464
1465 /**
1466 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1467 */
1468 @Deprecated
1469 public static final String ANDROID_ID = Secure.ANDROID_ID;
1470
1471 /**
1472 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1473 */
1474 @Deprecated
1475 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1476
1477 /**
1478 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1479 */
1480 @Deprecated
1481 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1482
1483 /**
1484 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1485 */
1486 @Deprecated
1487 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1488
1489 /**
1490 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1491 */
1492 @Deprecated
1493 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1494
1495 /**
1496 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1497 */
1498 @Deprecated
1499 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001501 /**
1502 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1503 * instead
1504 */
1505 @Deprecated
1506 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1507
1508 /**
1509 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1510 */
1511 @Deprecated
1512 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001513
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001514 /**
1515 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1516 */
1517 @Deprecated
1518 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1519
1520 /**
1521 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1522 * instead
1523 */
1524 @Deprecated
1525 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1526
1527 /**
1528 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1529 * instead
1530 */
1531 @Deprecated
1532 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1533
1534 /**
1535 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1536 * instead
1537 */
1538 @Deprecated
1539 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1540 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1541
1542 /**
1543 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1544 */
1545 @Deprecated
1546 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1547
1548 /**
1549 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1550 */
1551 @Deprecated
1552 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001553
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001554 /**
1555 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1556 */
1557 @Deprecated
1558 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1559
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001560 /**
1561 * @deprecated Use
1562 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1563 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001564 @Deprecated
1565 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1566
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001567 /**
1568 * @deprecated Use
1569 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1570 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001571 @Deprecated
1572 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1573 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1574
1575 /**
1576 * @deprecated Use
1577 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1578 */
1579 @Deprecated
1580 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1581 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1582
1583 /**
1584 * @deprecated Use
1585 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1586 */
1587 @Deprecated
1588 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1589 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001590
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001591 /**
1592 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1593 * instead
1594 */
1595 @Deprecated
1596 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1597
1598 /**
1599 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1600 */
1601 @Deprecated
1602 public static final String WIFI_ON = Secure.WIFI_ON;
1603
1604 /**
1605 * @deprecated Use
1606 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1607 * instead
1608 */
1609 @Deprecated
1610 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1611 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1612
1613 /**
1614 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1615 */
1616 @Deprecated
1617 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1618
1619 /**
1620 * @deprecated Use
1621 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1622 */
1623 @Deprecated
1624 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1625 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001626
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001627 /**
1628 * @deprecated Use
1629 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1630 */
1631 @Deprecated
1632 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1633 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1634
1635 /**
1636 * @deprecated Use
1637 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1638 * instead
1639 */
1640 @Deprecated
1641 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1642 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1643
1644 /**
1645 * @deprecated Use
1646 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1647 */
1648 @Deprecated
1649 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1650 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1651
1652 /**
1653 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1654 * instead
1655 */
1656 @Deprecated
1657 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1658
1659 /**
1660 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1661 */
1662 @Deprecated
1663 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1664
1665 /**
1666 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1667 */
1668 @Deprecated
1669 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1670
1671 /**
1672 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1673 * instead
1674 */
1675 @Deprecated
1676 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1677
1678 /**
1679 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1680 * instead
1681 */
1682 @Deprecated
1683 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1684 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1685 }
1686
1687 /**
1688 * Secure system settings, containing system preferences that applications
1689 * can read but are not allowed to write. These are for preferences that
1690 * the user must explicitly modify through the system UI or specialized
1691 * APIs for those values, not modified directly by applications.
1692 */
1693 public static final class Secure extends NameValueTable {
1694 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1695
1696 private static volatile NameValueCache mNameValueCache = null;
1697
1698 /**
1699 * Look up a name in the database.
1700 * @param resolver to access the database with
1701 * @param name to look up in the table
1702 * @return the corresponding value, or null if not present
1703 */
1704 public synchronized static String getString(ContentResolver resolver, String name) {
1705 if (mNameValueCache == null) {
1706 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
1707 }
1708 return mNameValueCache.getString(resolver, name);
1709 }
1710
1711 /**
1712 * Store a name/value pair into the database.
1713 * @param resolver to access the database with
1714 * @param name to store
1715 * @param value to associate with the name
1716 * @return true if the value was set, false on database errors
1717 */
1718 public static boolean putString(ContentResolver resolver,
1719 String name, String value) {
1720 return putString(resolver, CONTENT_URI, name, value);
1721 }
1722
1723 /**
1724 * Construct the content URI for a particular name/value pair,
1725 * useful for monitoring changes with a ContentObserver.
1726 * @param name to look up in the table
1727 * @return the corresponding content URI, or null if not present
1728 */
1729 public static Uri getUriFor(String name) {
1730 return getUriFor(CONTENT_URI, name);
1731 }
1732
1733 /**
1734 * Convenience function for retrieving a single secure settings value
1735 * as an integer. Note that internally setting values are always
1736 * stored as strings; this function converts the string to an integer
1737 * for you. The default value will be returned if the setting is
1738 * not defined or not an integer.
1739 *
1740 * @param cr The ContentResolver to access.
1741 * @param name The name of the setting to retrieve.
1742 * @param def Value to return if the setting is not defined.
1743 *
1744 * @return The setting's current value, or 'def' if it is not defined
1745 * or not a valid integer.
1746 */
1747 public static int getInt(ContentResolver cr, String name, int def) {
1748 String v = getString(cr, name);
1749 try {
1750 return v != null ? Integer.parseInt(v) : def;
1751 } catch (NumberFormatException e) {
1752 return def;
1753 }
1754 }
1755
1756 /**
1757 * Convenience function for retrieving a single secure settings value
1758 * as an integer. Note that internally setting values are always
1759 * stored as strings; this function converts the string to an integer
1760 * for you.
1761 * <p>
1762 * This version does not take a default value. If the setting has not
1763 * been set, or the string value is not a number,
1764 * it throws {@link SettingNotFoundException}.
1765 *
1766 * @param cr The ContentResolver to access.
1767 * @param name The name of the setting to retrieve.
1768 *
1769 * @throws SettingNotFoundException Thrown if a setting by the given
1770 * name can't be found or the setting value is not an integer.
1771 *
1772 * @return The setting's current value.
1773 */
1774 public static int getInt(ContentResolver cr, String name)
1775 throws SettingNotFoundException {
1776 String v = getString(cr, name);
1777 try {
1778 return Integer.parseInt(v);
1779 } catch (NumberFormatException e) {
1780 throw new SettingNotFoundException(name);
1781 }
1782 }
1783
1784 /**
1785 * Convenience function for updating a single settings value as an
1786 * integer. This will either create a new entry in the table if the
1787 * given name does not exist, or modify the value of the existing row
1788 * with that name. Note that internally setting values are always
1789 * stored as strings, so this function converts the given value to a
1790 * string before storing it.
1791 *
1792 * @param cr The ContentResolver to access.
1793 * @param name The name of the setting to modify.
1794 * @param value The new value for the setting.
1795 * @return true if the value was set, false on database errors
1796 */
1797 public static boolean putInt(ContentResolver cr, String name, int value) {
1798 return putString(cr, name, Integer.toString(value));
1799 }
1800
1801 /**
1802 * Convenience function for retrieving a single secure settings value
1803 * as a {@code long}. Note that internally setting values are always
1804 * stored as strings; this function converts the string to a {@code long}
1805 * for you. The default value will be returned if the setting is
1806 * not defined or not a {@code long}.
1807 *
1808 * @param cr The ContentResolver to access.
1809 * @param name The name of the setting to retrieve.
1810 * @param def Value to return if the setting is not defined.
1811 *
1812 * @return The setting's current value, or 'def' if it is not defined
1813 * or not a valid {@code long}.
1814 */
1815 public static long getLong(ContentResolver cr, String name, long def) {
1816 String valString = getString(cr, name);
1817 long value;
1818 try {
1819 value = valString != null ? Long.parseLong(valString) : def;
1820 } catch (NumberFormatException e) {
1821 value = def;
1822 }
1823 return value;
1824 }
1825
1826 /**
1827 * Convenience function for retrieving a single secure settings value
1828 * as a {@code long}. Note that internally setting values are always
1829 * stored as strings; this function converts the string to a {@code long}
1830 * for you.
1831 * <p>
1832 * This version does not take a default value. If the setting has not
1833 * been set, or the string value is not a number,
1834 * it throws {@link SettingNotFoundException}.
1835 *
1836 * @param cr The ContentResolver to access.
1837 * @param name The name of the setting to retrieve.
1838 *
1839 * @return The setting's current value.
1840 * @throws SettingNotFoundException Thrown if a setting by the given
1841 * name can't be found or the setting value is not an integer.
1842 */
1843 public static long getLong(ContentResolver cr, String name)
1844 throws SettingNotFoundException {
1845 String valString = getString(cr, name);
1846 try {
1847 return Long.parseLong(valString);
1848 } catch (NumberFormatException e) {
1849 throw new SettingNotFoundException(name);
1850 }
1851 }
1852
1853 /**
1854 * Convenience function for updating a secure settings value as a long
1855 * integer. This will either create a new entry in the table if the
1856 * given name does not exist, or modify the value of the existing row
1857 * with that name. Note that internally setting values are always
1858 * stored as strings, so this function converts the given value to a
1859 * string before storing it.
1860 *
1861 * @param cr The ContentResolver to access.
1862 * @param name The name of the setting to modify.
1863 * @param value The new value for the setting.
1864 * @return true if the value was set, false on database errors
1865 */
1866 public static boolean putLong(ContentResolver cr, String name, long value) {
1867 return putString(cr, name, Long.toString(value));
1868 }
1869
1870 /**
1871 * Convenience function for retrieving a single secure settings value
1872 * as a floating point number. Note that internally setting values are
1873 * always stored as strings; this function converts the string to an
1874 * float for you. The default value will be returned if the setting
1875 * is not defined or not a valid float.
1876 *
1877 * @param cr The ContentResolver to access.
1878 * @param name The name of the setting to retrieve.
1879 * @param def Value to return if the setting is not defined.
1880 *
1881 * @return The setting's current value, or 'def' if it is not defined
1882 * or not a valid float.
1883 */
1884 public static float getFloat(ContentResolver cr, String name, float def) {
1885 String v = getString(cr, name);
1886 try {
1887 return v != null ? Float.parseFloat(v) : def;
1888 } catch (NumberFormatException e) {
1889 return def;
1890 }
1891 }
1892
1893 /**
1894 * Convenience function for retrieving a single secure settings value
1895 * as a float. Note that internally setting values are always
1896 * stored as strings; this function converts the string to a float
1897 * for you.
1898 * <p>
1899 * This version does not take a default value. If the setting has not
1900 * been set, or the string value is not a number,
1901 * it throws {@link SettingNotFoundException}.
1902 *
1903 * @param cr The ContentResolver to access.
1904 * @param name The name of the setting to retrieve.
1905 *
1906 * @throws SettingNotFoundException Thrown if a setting by the given
1907 * name can't be found or the setting value is not a float.
1908 *
1909 * @return The setting's current value.
1910 */
1911 public static float getFloat(ContentResolver cr, String name)
1912 throws SettingNotFoundException {
1913 String v = getString(cr, name);
1914 try {
1915 return Float.parseFloat(v);
1916 } catch (NumberFormatException e) {
1917 throw new SettingNotFoundException(name);
1918 }
1919 }
1920
1921 /**
1922 * Convenience function for updating a single settings value as a
1923 * floating point number. This will either create a new entry in the
1924 * table if the given name does not exist, or modify the value of the
1925 * existing row with that name. Note that internally setting values
1926 * are always stored as strings, so this function converts the given
1927 * value to a string before storing it.
1928 *
1929 * @param cr The ContentResolver to access.
1930 * @param name The name of the setting to modify.
1931 * @param value The new value for the setting.
1932 * @return true if the value was set, false on database errors
1933 */
1934 public static boolean putFloat(ContentResolver cr, String name, float value) {
1935 return putString(cr, name, Float.toString(value));
1936 }
1937
1938 /**
1939 * The content:// style URL for this table
1940 */
1941 public static final Uri CONTENT_URI =
1942 Uri.parse("content://" + AUTHORITY + "/secure");
1943
1944 /**
1945 * Whether ADB is enabled.
1946 */
1947 public static final String ADB_ENABLED = "adb_enabled";
1948
1949 /**
1950 * Setting to allow mock locations and location provider status to be injected into the
1951 * LocationManager service for testing purposes during application development. These
1952 * locations and status values override actual location and status information generated
1953 * by network, gps, or other location providers.
1954 */
1955 public static final String ALLOW_MOCK_LOCATION = "mock_location";
1956
1957 /**
1958 * The Android ID (a unique 64-bit value) as a hex string.
1959 * Identical to that obtained by calling
1960 * GoogleLoginService.getAndroidId(); it is also placed here
1961 * so you can get it without binding to a service.
1962 */
1963 public static final String ANDROID_ID = "android_id";
1964
1965 /**
1966 * Whether bluetooth is enabled/disabled
1967 * 0=disabled. 1=enabled.
1968 */
1969 public static final String BLUETOOTH_ON = "bluetooth_on";
1970
1971 /**
1972 * Get the key that retrieves a bluetooth headset's priority.
1973 * @hide
1974 */
1975 public static final String getBluetoothHeadsetPriorityKey(String address) {
1976 return ("bluetooth_headset_priority_" + address.toUpperCase());
1977 }
1978
1979 /**
1980 * Get the key that retrieves a bluetooth a2dp sink's priority.
1981 * @hide
1982 */
1983 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
1984 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
1985 }
1986
1987 /**
1988 * Whether or not data roaming is enabled. (0 = false, 1 = true)
1989 */
1990 public static final String DATA_ROAMING = "data_roaming";
1991
1992 /**
1993 * Setting to record the input method used by default, holding the ID
1994 * of the desired method.
1995 */
1996 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
1997
1998 /**
1999 * Whether the device has been provisioned (0 = false, 1 = true)
2000 */
2001 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002002
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002003 /**
2004 * List of input methods that are currently enabled. This is a string
2005 * containing the IDs of all enabled input methods, each ID separated
2006 * by ':'.
2007 */
2008 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002010 /**
2011 * Host name and port for a user-selected proxy.
2012 */
2013 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002015 /**
2016 * Whether the package installer should allow installation of apps downloaded from
2017 * sources other than the Android Market (vending machine).
2018 *
2019 * 1 = allow installing from other sources
2020 * 0 = only allow installing from the Android Market
2021 */
2022 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002023
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002024 /**
2025 * Comma-separated list of location providers that activities may access.
2026 */
2027 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002028
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002029 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002030 * Whether assisted GPS should be enabled or not.
2031 * @hide
2032 */
2033 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2034
2035 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002036 * The Logging ID (a unique 64-bit value) as a hex string.
2037 * Used as a pseudonymous identifier for logging.
2038 * @deprecated This identifier is poorly initialized and has
2039 * many collisions. It should not be used.
2040 */
2041 @Deprecated
2042 public static final String LOGGING_ID = "logging_id";
2043
2044 /**
2045 * The Logging ID (a unique 64-bit value) as a hex string.
2046 * Used as a pseudonymous identifier for logging.
2047 * @hide
2048 */
2049 public static final String LOGGING_ID2 = "logging_id2";
2050
2051 /**
2052 * User preference for which network(s) should be used. Only the
2053 * connectivity service should touch this.
2054 */
2055 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002056
2057 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002058 */
2059 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002060
2061 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002062 */
2063 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002064
2065 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002066 */
2067 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 /**
2070 * Settings classname to launch when Settings is clicked from All
2071 * Applications. Needed because of user testing between the old
2072 * and new Settings apps.
2073 */
2074 // TODO: 881807
2075 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002076
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002077 /**
2078 * USB Mass Storage Enabled
2079 */
2080 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002081
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002082 /**
2083 * If this setting is set (to anything), then all references
2084 * to Gmail on the device must change to Google Mail.
2085 */
2086 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002087
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002089 * If accessibility is enabled.
2090 */
2091 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2092
2093 /**
2094 * List of the enabled accessibility providers.
2095 */
2096 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2097 "enabled_accessibility_services";
2098
2099 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002100 * Setting to always use the default text-to-speech settings regardless
2101 * of the application settings.
2102 * 1 = override application settings,
2103 * 0 = use application settings (if specified).
2104 */
2105 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2106
2107 /**
2108 * Default text-to-speech engine speech rate. 100 = 1x
2109 */
2110 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2111
2112 /**
2113 * Default text-to-speech engine pitch. 100 = 1x
2114 */
2115 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2116
2117 /**
2118 * Default text-to-speech engine.
2119 */
2120 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2121
2122 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002123 * Default text-to-speech language.
2124 */
2125 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2126
2127 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002128 * Default text-to-speech country.
2129 */
2130 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2131
2132 /**
2133 * Default text-to-speech locale variant.
2134 */
2135 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2136
2137 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002138 * Whether to notify the user of open networks.
2139 * <p>
2140 * If not connected and the scan results have an open network, we will
2141 * put this notification up. If we attempt to connect to a network or
2142 * the open network(s) disappear, we remove the notification. When we
2143 * show the notification, we will not show it again for
2144 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2145 */
2146 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2147 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002148
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002149 /**
2150 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2151 * Connecting to a network will reset the timer.
2152 */
2153 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2154 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002155
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002156 /**
2157 * The number of radio channels that are allowed in the local
2158 * 802.11 regulatory domain.
2159 * @hide
2160 */
2161 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002163 /**
2164 * When the number of open networks exceeds this number, the
2165 * least-recently-used excess networks will be removed.
2166 */
2167 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002168
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002169 /**
2170 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2171 */
2172 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002173
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002174 /**
2175 * The acceptable packet loss percentage (range 0 - 100) before trying
2176 * another AP on the same network.
2177 */
2178 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2179 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002181 /**
2182 * The number of access points required for a network in order for the
2183 * watchdog to monitor it.
2184 */
2185 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002186
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002187 /**
2188 * The delay between background checks.
2189 */
2190 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2191 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002192
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002193 /**
2194 * Whether the Wi-Fi watchdog is enabled for background checking even
2195 * after it thinks the user has connected to a good access point.
2196 */
2197 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2198 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002199
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002200 /**
2201 * The timeout for a background ping
2202 */
2203 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2204 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002205
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002206 /**
2207 * The number of initial pings to perform that *may* be ignored if they
2208 * fail. Again, if these fail, they will *not* be used in packet loss
2209 * calculation. For example, one network always seemed to time out for
2210 * the first couple pings, so this is set to 3 by default.
2211 */
2212 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2213 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 /**
2216 * The maximum number of access points (per network) to attempt to test.
2217 * If this number is reached, the watchdog will no longer monitor the
2218 * initial connection state for the network. This is a safeguard for
2219 * networks containing multiple APs whose DNS does not respond to pings.
2220 */
2221 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002222
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002223 /**
2224 * Whether the Wi-Fi watchdog is enabled.
2225 */
2226 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2227
2228 /**
2229 * 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 -08002230 */
2231 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2232
2233 /**
2234 * The number of pings to test if an access point is a good connection.
2235 */
2236 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002238 /**
2239 * The delay between pings.
2240 */
2241 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002242
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 /**
2244 * The timeout per ping.
2245 */
2246 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002247
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002248 /**
2249 * The maximum number of times we will retry a connection to an access
2250 * point for which we have failed in acquiring an IP address from DHCP.
2251 * 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 -08002252 */
2253 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002254
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002255 /**
2256 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2257 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 */
2259 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2260 "wifi_mobile_data_transition_wakelock_timeout_ms";
2261
2262 /**
2263 * Whether background data usage is allowed by the user. See
2264 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002265 */
2266 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002267
2268 /**
Christian Sonntag62d95ea2009-09-02 09:28:37 -07002269 * The time in msec, when the LAST_KMSG file was send to the checkin server.
2270 * We will only send the LAST_KMSG file if it was modified after this time.
2271 *
2272 * @hide
2273 */
2274 public static final String CHECKIN_SEND_LAST_KMSG_TIME = "checkin_kmsg_time";
2275
2276 /**
2277 * The time in msec, when the apanic_console file was send to the checkin server.
2278 * We will only send the apanic_console file if it was modified after this time.
2279 *
2280 * @hide
2281 */
2282 public static final String CHECKIN_SEND_APANIC_CONSOLE_TIME =
2283 "checkin_apanic_console_time";
2284
2285 /**
2286 * The time in msec, when the apanic_thread file was send to the checkin server.
2287 * We will only send the apanic_thread file if it was modified after this time.
2288 *
2289 * @hide
2290 */
2291 public static final String CHECKIN_SEND_APANIC_THREAD_TIME =
2292 "checkin_apanic_thread_time";
2293
2294 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002295 * The CDMA roaming mode 0 = Home Networks, CDMA default
2296 * 1 = Roaming on Affiliated networks
2297 * 2 = Roaming on any networks
2298 * @hide
2299 */
2300 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2301
2302 /**
2303 * The CDMA subscription mode 0 = RUIM/SIM (default)
2304 * 1 = NV
2305 * @hide
2306 */
2307 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2308
2309 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002310 * The preferred network mode 7 = Global
2311 * 6 = EvDo only
2312 * 5 = CDMA w/o EvDo
2313 * 4 = CDMA / EvDo auto
2314 * 3 = GSM / WCDMA auto
2315 * 2 = WCDMA only
2316 * 1 = GSM only
2317 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002318 * @hide
2319 */
2320 public static final String PREFERRED_NETWORK_MODE =
2321 "preferred_network_mode";
2322
2323 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002324 * The preferred TTY mode 0 = TTy Off, CDMA default
2325 * 1 = TTY Full
2326 * 2 = TTY HCO
2327 * 3 = TTY VCO
2328 * @hide
2329 */
2330 public static final String PREFERRED_TTY_MODE =
2331 "preferred_tty_mode";
2332
2333
2334 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002335 * CDMA Cell Broadcast SMS
2336 * 0 = CDMA Cell Broadcast SMS disabled
2337 * 1 = CDMA Cell Broadcast SMS enabled
2338 * @hide
2339 */
2340 public static final String CDMA_CELL_BROADCAST_SMS =
2341 "cdma_cell_broadcast_sms";
2342
2343 /**
2344 * The cdma subscription 0 = Subscription from RUIM, when available
2345 * 1 = Subscription from NV
2346 * @hide
2347 */
2348 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2349 "preferred_cdma_subscription";
2350
2351 /**
2352 * Whether the enhanced voice privacy mode is enabled.
2353 * 0 = normal voice privacy
2354 * 1 = enhanced voice privacy
2355 * @hide
2356 */
2357 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2358
2359 /**
2360 * Whether the TTY mode mode is enabled.
2361 * 0 = disabled
2362 * 1 = enabled
2363 * @hide
2364 */
2365 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002366
2367 /**
Amith Yamasani630cd062009-06-19 12:07:02 -07002368 * Flag for allowing service provider to use location information to improve products and
2369 * services.
2370 * Type: int ( 0 = disallow, 1 = allow )
2371 * @hide
2372 */
2373 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
2374
2375 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002376 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002377 * Type: int ( 0 = disabled, 1 = enabled )
2378 * @hide
2379 */
2380 public static final String BACKUP_ENABLED = "backup_enabled";
2381
2382 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002383 * Indicates whether settings backup has been fully provisioned.
2384 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2385 * @hide
2386 */
2387 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2388
2389 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002390 * Component of the transport to use for backup/restore.
2391 * @hide
2392 */
2393 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002394
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002395 /**
2396 * Version for which the setup wizard was last shown. Bumped for
2397 * each release when there is new setup information to show.
2398 * @hide
2399 */
2400 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002401
2402 /**
-b master501eec92009-07-06 13:53:11 -07002403 * @hide
2404 */
2405 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07002406 ADB_ENABLED,
2407 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07002408 PARENTAL_CONTROL_ENABLED,
2409 PARENTAL_CONTROL_REDIRECT_URL,
2410 USB_MASS_STORAGE_ENABLED,
2411 ACCESSIBILITY_ENABLED,
2412 ENABLED_ACCESSIBILITY_SERVICES,
2413 TTS_USE_DEFAULTS,
2414 TTS_DEFAULT_RATE,
2415 TTS_DEFAULT_PITCH,
2416 TTS_DEFAULT_SYNTH,
2417 TTS_DEFAULT_LANG,
2418 TTS_DEFAULT_COUNTRY,
2419 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
2420 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
2421 WIFI_NUM_ALLOWED_CHANNELS,
2422 WIFI_NUM_OPEN_NETWORKS_KEPT,
-b master501eec92009-07-06 13:53:11 -07002423 };
2424
2425 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002426 * Helper method for determining if a location provider is enabled.
2427 * @param cr the content resolver to use
2428 * @param provider the location provider to query
2429 * @return true if the provider is enabled
2430 *
2431 * @hide
2432 */
2433 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
2434 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
2435 if (allowedProviders != null) {
2436 return (allowedProviders.equals(provider) ||
2437 allowedProviders.contains("," + provider + ",") ||
2438 allowedProviders.startsWith(provider + ",") ||
2439 allowedProviders.endsWith("," + provider));
2440 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002441 return false;
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002442 }
2443
2444 /**
2445 * Thread-safe method for enabling or disabling a single location provider.
2446 * @param cr the content resolver to use
2447 * @param provider the location provider to enable or disable
2448 * @param enabled true if the provider should be enabled
2449 *
2450 * @hide
2451 */
2452 public static final void setLocationProviderEnabled(ContentResolver cr,
2453 String provider, boolean enabled) {
2454 // to ensure thread safety, we write the provider name with a '+' or '-'
2455 // and let the SettingsProvider handle it rather than reading and modifying
2456 // the list of enabled providers.
2457 if (enabled) {
2458 provider = "+" + provider;
2459 } else {
2460 provider = "-" + provider;
2461 }
2462 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
2463 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002464 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002465
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002466 /**
2467 * Gservices settings, containing the network names for Google's
2468 * various services. This table holds simple name/addr pairs.
2469 * Addresses can be accessed through the getString() method.
2470 *
2471 * TODO: This should move to partner/google/... somewhere.
2472 *
2473 * @hide
2474 */
2475 public static final class Gservices extends NameValueTable {
2476 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_gservices_version";
2477
2478 /**
2479 * Intent action broadcast when the Gservices table is updated by the server.
2480 * This is broadcast once after settings change (so many values may have been updated).
2481 */
2482 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2483 public static final String CHANGED_ACTION =
2484 "com.google.gservices.intent.action.GSERVICES_CHANGED";
2485
Dan Egnorabc25e32009-05-13 19:22:08 -07002486 /**
2487 * Intent action to override Gservices for testing. (Requires WRITE_GSERVICES permission.)
2488 */
2489 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2490 public static final String OVERRIDE_ACTION =
2491 "com.google.gservices.intent.action.GSERVICES_OVERRIDE";
2492
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002493 private static volatile NameValueCache mNameValueCache = null;
2494 private static final Object mNameValueCacheLock = new Object();
2495
2496 /**
2497 * Look up a name in the database.
2498 * @param resolver to access the database with
2499 * @param name to look up in the table
2500 * @return the corresponding value, or null if not present
2501 */
2502 public static String getString(ContentResolver resolver, String name) {
2503 synchronized (mNameValueCacheLock) {
2504 if (mNameValueCache == null) {
2505 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
2506 }
2507 return mNameValueCache.getString(resolver, name);
2508 }
2509 }
2510
2511 /**
2512 * Store a name/value pair into the database.
2513 * @param resolver to access the database with
2514 * @param name to store
2515 * @param value to associate with the name
2516 * @return true if the value was set, false on database errors
2517 */
2518 public static boolean putString(ContentResolver resolver,
2519 String name, String value) {
2520 return putString(resolver, CONTENT_URI, name, value);
2521 }
2522
2523 /**
2524 * Look up the value for name in the database, convert it to an int using Integer.parseInt
2525 * and return it. If it is null or if a NumberFormatException is caught during the
2526 * conversion then return defValue.
2527 */
2528 public static int getInt(ContentResolver resolver, String name, int defValue) {
2529 String valString = getString(resolver, name);
2530 int value;
2531 try {
2532 value = valString != null ? Integer.parseInt(valString) : defValue;
2533 } catch (NumberFormatException e) {
2534 value = defValue;
2535 }
2536 return value;
2537 }
2538
2539 /**
2540 * Look up the value for name in the database, convert it to a long using Long.parseLong
2541 * and return it. If it is null or if a NumberFormatException is caught during the
2542 * conversion then return defValue.
2543 */
2544 public static long getLong(ContentResolver resolver, String name, long defValue) {
2545 String valString = getString(resolver, name);
2546 long value;
2547 try {
2548 value = valString != null ? Long.parseLong(valString) : defValue;
2549 } catch (NumberFormatException e) {
2550 value = defValue;
2551 }
2552 return value;
2553 }
2554
2555 /**
2556 * Construct the content URI for a particular name/value pair,
2557 * useful for monitoring changes with a ContentObserver.
2558 * @param name to look up in the table
2559 * @return the corresponding content URI, or null if not present
2560 */
2561 public static Uri getUriFor(String name) {
2562 return getUriFor(CONTENT_URI, name);
2563 }
2564
2565 /**
2566 * The content:// style URL for this table
2567 */
2568 public static final Uri CONTENT_URI =
2569 Uri.parse("content://" + AUTHORITY + "/gservices");
2570
2571 /**
2572 * MMS - URL to use for HTTP "x-wap-profile" header
2573 */
2574 public static final String MMS_X_WAP_PROFILE_URL
2575 = "mms_x_wap_profile_url";
2576
2577 /**
2578 * YouTube - the flag to indicate whether to use proxy
2579 */
2580 public static final String YOUTUBE_USE_PROXY
2581 = "youtube_use_proxy";
2582
2583 /**
2584 * MMS - maximum message size in bytes for a MMS message.
2585 */
2586 public static final String MMS_MAXIMUM_MESSAGE_SIZE
2587 = "mms_maximum_message_size";
2588
2589 /**
2590 * Event tags from the kernel event log to upload during checkin.
2591 */
2592 public static final String CHECKIN_EVENTS = "checkin_events";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002593
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002594 /**
Dianne Hackborn9fdbf6a2009-07-19 14:18:51 -07002595 * Comma-separated list of service names to dump and upload during checkin.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002596 */
2597 public static final String CHECKIN_DUMPSYS_LIST = "checkin_dumpsys_list";
2598
2599 /**
Dianne Hackborn9fdbf6a2009-07-19 14:18:51 -07002600 * Comma-separated list of packages to specify for each service that is
2601 * dumped (currently only meaningful for user activity).
2602 */
2603 public static final String CHECKIN_PACKAGE_LIST = "checkin_package_list";
2604
2605 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 * The interval (in seconds) between periodic checkin attempts.
2607 */
2608 public static final String CHECKIN_INTERVAL = "checkin_interval";
2609
2610 /**
2611 * Boolean indicating if the market app should force market only checkins on
2612 * install/uninstall. Any non-0 value is considered true.
2613 */
2614 public static final String MARKET_FORCE_CHECKIN = "market_force_checkin";
2615
2616 /**
2617 * How frequently (in seconds) to check the memory status of the
2618 * device.
2619 */
2620 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2621
2622 /**
2623 * Max frequency (in seconds) to log memory check stats, in realtime
2624 * seconds. This allows for throttling of logs when the device is
2625 * running for large amounts of time.
2626 */
2627 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2628 "memcheck_log_realtime_interval";
2629
2630 /**
2631 * Boolean indicating whether rebooting due to system memory checks
2632 * is enabled.
2633 */
2634 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2635
2636 /**
2637 * How many bytes the system process must be below to avoid scheduling
2638 * a soft reboot. This reboot will happen when it is next determined
2639 * to be a good time.
2640 */
2641 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2642
2643 /**
2644 * How many bytes the system process must be below to avoid scheduling
2645 * a hard reboot. This reboot will happen immediately.
2646 */
2647 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2648
2649 /**
2650 * How many bytes the phone process must be below to avoid scheduling
2651 * a soft restart. This restart will happen when it is next determined
2652 * to be a good time.
2653 */
2654 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2655
2656 /**
2657 * How many bytes the phone process must be below to avoid scheduling
2658 * a hard restart. This restart will happen immediately.
2659 */
2660 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2661
2662 /**
2663 * Boolean indicating whether restarting the phone process due to
2664 * memory checks is enabled.
2665 */
2666 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2667
2668 /**
2669 * First time during the day it is okay to kill processes
2670 * or reboot the device due to low memory situations. This number is
2671 * in seconds since midnight.
2672 */
2673 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2674
2675 /**
2676 * Last time during the day it is okay to kill processes
2677 * or reboot the device due to low memory situations. This number is
2678 * in seconds since midnight.
2679 */
2680 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2681
2682 /**
2683 * How long the screen must have been off in order to kill processes
2684 * or reboot. This number is in seconds. A value of -1 means to
2685 * entirely disregard whether the screen is on.
2686 */
2687 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2688
2689 /**
2690 * How much time there must be until the next alarm in order to kill processes
2691 * or reboot. This number is in seconds. Note: this value must be
2692 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2693 * always see an alarm scheduled within its time.
2694 */
2695 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2696
2697 /**
2698 * How frequently to check whether it is a good time to restart things,
2699 * if the device is in a bad state. This number is in seconds. Note:
2700 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2701 * the alarm to schedule the recheck will always appear within the
2702 * minimum "do not execute now" time.
2703 */
2704 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2705
2706 /**
2707 * How frequently (in DAYS) to reboot the device. If 0, no reboots
2708 * will occur.
2709 */
2710 public static final String REBOOT_INTERVAL = "reboot_interval";
2711
2712 /**
2713 * First time during the day it is okay to force a reboot of the
2714 * device (if REBOOT_INTERVAL is set). This number is
2715 * in seconds since midnight.
2716 */
2717 public static final String REBOOT_START_TIME = "reboot_start_time";
2718
2719 /**
2720 * The window of time (in seconds) after each REBOOT_INTERVAL in which
2721 * a reboot can be executed. If 0, a reboot will always be executed at
2722 * exactly the given time. Otherwise, it will only be executed if
2723 * the device is idle within the window.
2724 */
2725 public static final String REBOOT_WINDOW = "reboot_window";
2726
2727 /**
2728 * The minimum version of the server that is required in order for the device to accept
2729 * the server's recommendations about the initial sync settings to use. When this is unset,
2730 * blank or can't be interpreted as an integer then we will not ask the server for a
2731 * recommendation.
2732 */
2733 public static final String GMAIL_CONFIG_INFO_MIN_SERVER_VERSION =
2734 "gmail_config_info_min_server_version";
2735
2736 /**
2737 * Controls whether Gmail offers a preview button for images.
2738 */
2739 public static final String GMAIL_DISALLOW_IMAGE_PREVIEWS = "gmail_disallow_image_previews";
2740
2741 /**
Cedric Beustafb6c8e2009-03-24 22:35:42 -07002742 * The maximal size in bytes allowed for attachments when composing messages in Gmail
2743 */
2744 public static final String GMAIL_MAX_ATTACHMENT_SIZE = "gmail_max_attachment_size_bytes";
2745
2746 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002747 * The timeout in milliseconds that Gmail uses when opening a connection and reading
2748 * from it. A missing value or a value of -1 instructs Gmail to use the defaults provided
2749 * by GoogleHttpClient.
2750 */
2751 public static final String GMAIL_TIMEOUT_MS = "gmail_timeout_ms";
2752
2753 /**
2754 * Controls whether Gmail will request an expedited sync when a message is sent. Value must
2755 * be an integer where non-zero means true. Defaults to 1.
2756 */
2757 public static final String GMAIL_SEND_IMMEDIATELY = "gmail_send_immediately";
2758
2759 /**
2760 * Controls whether gmail buffers server responses. Possible values are "memory", for a
2761 * memory-based buffer, or "file", for a temp-file-based buffer. All other values
2762 * (including not set) disable buffering.
2763 */
2764 public static final String GMAIL_BUFFER_SERVER_RESPONSE = "gmail_buffer_server_response";
2765
2766 /**
Cynthia Wong85427f712009-06-10 14:42:42 -07002767 * The maximum size in bytes allowed for the provider to gzip a protocol buffer uploaded to
2768 * the server.
2769 */
2770 public static final String GMAIL_MAX_GZIP_SIZE = "gmail_max_gzip_size_bytes";
2771
2772 /**
Cynthia Wong44e4aaf2009-04-08 13:32:09 -07002773 * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
Cynthia Wongcac13822009-09-16 10:47:42 -07002774 * an integer where non-zero means true. Defaults to 1. This flag controls Donut devices.
Cynthia Wong44e4aaf2009-04-08 13:32:09 -07002775 */
2776 public static final String GMAIL_DISCARD_ERROR_UPHILL_OP = "gmail_discard_error_uphill_op";
2777
2778 /**
Cynthia Wongcac13822009-09-16 10:47:42 -07002779 * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
2780 * an integer where non-zero means true. Defaults to 1. This flag controls Eclair and
2781 * future devices.
2782 */
2783 public static final String GMAIL_DISCARD_ERROR_UPHILL_OP_NEW =
2784 "gmail_discard_error_uphill_op_new";
2785
2786 /**
Cynthia Wong04f0b052009-07-07 11:14:21 -07002787 * Controls how many attempts Gmail will try to upload an uphill operations before it
2788 * abandons the operation. Defaults to 20.
2789 */
Cynthia Wong0d54b022009-08-10 16:39:36 -07002790 public static final String GMAIL_NUM_RETRY_UPHILL_OP = "gmail_num_retry_uphill_op";
2791
2792 /**
2793 * How much time in seconds Gmail will try to upload an uphill operations before it
2794 * abandons the operation. Defaults to 36400 (one day).
2795 */
2796 public static final String GMAIL_WAIT_TIME_RETRY_UPHILL_OP =
2797 "gmail_wait_time_retry_uphill_op";
Cynthia Wong04f0b052009-07-07 11:14:21 -07002798
2799 /**
Cynthia Wong278a8022009-07-10 13:27:03 -07002800 * Controls if the protocol buffer version of the protocol will use a multipart request for
2801 * attachment uploads. Value must be an integer where non-zero means true. Defaults to 0.
2802 */
2803 public static final String GMAIL_USE_MULTIPART_PROTOBUF = "gmail_use_multipart_protobuf";
2804
2805 /**
Wei Huangceca25f2009-06-19 13:08:39 -07002806 * the transcoder URL for mobile devices.
2807 */
2808 public static final String TRANSCODER_URL = "mobile_transcoder_url";
2809
2810 /**
2811 * URL that points to the privacy terms of the Google Talk service.
2812 */
Tom Taylor2c0a01a2009-06-22 15:17:59 -07002813 public static final String GTALK_TERMS_OF_SERVICE_URL = "gtalk_terms_of_service_url";
Wei Huangceca25f2009-06-19 13:08:39 -07002814
2815 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 * Hostname of the GTalk server.
2817 */
2818 public static final String GTALK_SERVICE_HOSTNAME = "gtalk_hostname";
2819
2820 /**
2821 * Secure port of the GTalk server.
2822 */
2823 public static final String GTALK_SERVICE_SECURE_PORT = "gtalk_secure_port";
2824
2825 /**
2826 * The server configurable RMQ acking interval
2827 */
2828 public static final String GTALK_SERVICE_RMQ_ACK_INTERVAL = "gtalk_rmq_ack_interval";
2829
2830 /**
2831 * The minimum reconnect delay for short network outages or when the network is suspended
2832 * due to phone use.
2833 */
2834 public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT =
2835 "gtalk_min_reconnect_delay_short";
2836
2837 /**
2838 * The reconnect variant range for short network outages or when the network is suspended
2839 * due to phone use. A random number between 0 and this constant is computed and
2840 * added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT} to form the initial reconnect
2841 * delay.
2842 */
2843 public static final String GTALK_SERVICE_RECONNECT_VARIANT_SHORT =
2844 "gtalk_reconnect_variant_short";
2845
2846 /**
2847 * The minimum reconnect delay for long network outages
2848 */
2849 public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG =
2850 "gtalk_min_reconnect_delay_long";
2851
2852 /**
2853 * The reconnect variant range for long network outages. A random number between 0 and this
2854 * constant is computed and added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG} to
2855 * form the initial reconnect delay.
2856 */
2857 public static final String GTALK_SERVICE_RECONNECT_VARIANT_LONG =
2858 "gtalk_reconnect_variant_long";
2859
2860 /**
2861 * The maximum reconnect delay time, in milliseconds.
2862 */
2863 public static final String GTALK_SERVICE_MAX_RECONNECT_DELAY =
2864 "gtalk_max_reconnect_delay";
2865
2866 /**
2867 * The network downtime that is considered "short" for the above calculations,
2868 * in milliseconds.
2869 */
2870 public static final String GTALK_SERVICE_SHORT_NETWORK_DOWNTIME =
2871 "gtalk_short_network_downtime";
2872
2873 /**
2874 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2875 * will reset the heartbeat timer. The away heartbeat should be used when the user is
2876 * logged into the GTalk app, but not actively using it.
2877 */
2878 public static final String GTALK_SERVICE_AWAY_HEARTBEAT_INTERVAL_MS =
2879 "gtalk_heartbeat_ping_interval_ms"; // keep the string backward compatible
2880
2881 /**
2882 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2883 * will reset the heartbeat timer. The active heartbeat should be used when the user is
2884 * actively using the GTalk app.
2885 */
2886 public static final String GTALK_SERVICE_ACTIVE_HEARTBEAT_INTERVAL_MS =
2887 "gtalk_active_heartbeat_ping_interval_ms";
2888
2889 /**
2890 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2891 * will reset the heartbeat timer. The sync heartbeat should be used when the user isn't
2892 * logged into the GTalk app, but auto-sync is enabled.
2893 */
2894 public static final String GTALK_SERVICE_SYNC_HEARTBEAT_INTERVAL_MS =
2895 "gtalk_sync_heartbeat_ping_interval_ms";
2896
2897 /**
2898 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2899 * will reset the heartbeat timer. The no sync heartbeat should be used when the user isn't
2900 * logged into the GTalk app, and auto-sync is not enabled.
2901 */
2902 public static final String GTALK_SERVICE_NOSYNC_HEARTBEAT_INTERVAL_MS =
2903 "gtalk_nosync_heartbeat_ping_interval_ms";
2904
2905 /**
Tom Taylor2debd562009-07-14 11:27:20 -07002906 * The maximum heartbeat interval used while on the WIFI network.
Wei Huange87b2f02009-06-02 15:16:04 -07002907 */
2908 public static final String GTALK_SERVICE_WIFI_MAX_HEARTBEAT_INTERVAL_MS =
2909 "gtalk_wifi_max_heartbeat_ping_interval_ms";
2910
2911 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002912 * How long we wait to receive a heartbeat ping acknowledgement (or another packet)
2913 * from the GTalk server, before deeming the connection dead.
2914 */
2915 public static final String GTALK_SERVICE_HEARTBEAT_ACK_TIMEOUT_MS =
2916 "gtalk_heartbeat_ack_timeout_ms";
2917
2918 /**
2919 * How long after screen is turned off before we consider the user to be idle.
2920 */
2921 public static final String GTALK_SERVICE_IDLE_TIMEOUT_MS =
2922 "gtalk_idle_timeout_ms";
2923
2924 /**
2925 * By default, GTalkService will always connect to the server regardless of the auto-sync
2926 * setting. However, if this parameter is true, then GTalkService will only connect
2927 * if auto-sync is enabled. Using the GTalk app will trigger the connection too.
2928 */
2929 public static final String GTALK_SERVICE_CONNECT_ON_AUTO_SYNC =
2930 "gtalk_connect_on_auto_sync";
2931
2932 /**
2933 * GTalkService holds a wakelock while broadcasting the intent for data message received.
2934 * It then automatically release the wakelock after a timeout. This setting controls what
2935 * the timeout should be.
2936 */
2937 public static final String GTALK_DATA_MESSAGE_WAKELOCK_MS =
2938 "gtalk_data_message_wakelock_ms";
2939
2940 /**
2941 * The socket read timeout used to control how long ssl handshake wait for reads before
2942 * timing out. This is needed so the ssl handshake doesn't hang for a long time in some
2943 * circumstances.
2944 */
2945 public static final String GTALK_SSL_HANDSHAKE_TIMEOUT_MS =
2946 "gtalk_ssl_handshake_timeout_ms";
2947
2948 /**
Costin Manolachef967afd2009-04-17 17:37:29 -07002949 * Compress the gtalk stream.
2950 */
2951 public static final String GTALK_COMPRESS = "gtalk_compress";
2952
2953 /**
Wei Huang58eef7e2009-05-22 13:30:03 -07002954 * This is the timeout for which Google Talk will send the message using bareJID. In a
2955 * established chat between two XMPP endpoints, Google Talk uses fullJID in the format
2956 * of user@domain/resource in order to send the message to the specific client. However,
2957 * if Google Talk hasn't received a message from that client after some time, it would
2958 * fall back to use the bareJID, which would broadcast the message to all clients for
2959 * the other user.
2960 */
2961 public static final String GTALK_USE_BARE_JID_TIMEOUT_MS = "gtalk_use_barejid_timeout_ms";
2962
2963 /**
Ye Wen44c6e3e2009-06-19 12:48:16 -07002964 * This is the threshold of retry number when there is an authentication expired failure
2965 * for Google Talk. In some situation, e.g. when a Google Apps account is disabled chat
2966 * service, the connection keeps failing. This threshold controls when we should stop
2967 * the retrying.
2968 */
2969 public static final String GTALK_MAX_RETRIES_FOR_AUTH_EXPIRED =
Wei Huang1e4807a2009-07-29 18:50:00 -07002970 "gtalk_max_retries_for_auth_expired";
2971
2972 /**
2973 * a boolean setting indicating whether the GTalkService should use RMQ2 protocol or not.
2974 */
2975 public static final String GTALK_USE_RMQ2_PROTOCOL =
2976 "gtalk_use_rmq2";
2977
2978 /**
2979 * a boolean setting indicating whether the GTalkService should support both RMQ and
2980 * RMQ2 protocols. This setting is true for the transitional period when we need to
2981 * support both protocols.
2982 */
2983 public static final String GTALK_SUPPORT_RMQ_AND_RMQ2_PROTOCOLS =
2984 "gtalk_support_rmq_and_rmq2";
2985
2986 /**
2987 * a boolean setting controlling whether the rmq2 protocol will include stream ids in
2988 * the protobufs. This is used for debugging.
2989 */
2990 public static final String GTALK_RMQ2_INCLUDE_STREAM_ID =
2991 "gtalk_rmq2_include_stream_id";
2992
2993 /**
Wei Huang1abf4982009-08-21 07:56:36 -07002994 * when receiving a chat message from the server, the message could be an older message
2995 * whose "time sent" is x seconds from now. If x is significant enough, we want to flag
2996 * it so the UI can give it some special treatment when displaying the "time sent" for
2997 * it. This setting is to control what x is.
2998 */
Wei Huangcc6bd5a2009-08-24 14:29:44 -07002999 public static final String GTALK_OLD_CHAT_MESSAGE_THRESHOLD_IN_SEC =
3000 "gtalk_old_chat_msg_threshold_in_sec";
Wei Huang1abf4982009-08-21 07:56:36 -07003001
3002 /**
3003 * a setting to control the max connection history record GTalkService stores.
3004 */
3005 public static final String GTALK_MAX_CONNECTION_HISTORY_RECORDS =
3006 "gtalk_max_conn_history_records";
3007
3008 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003009 * This is gdata url to lookup album and picture info from picasa web. It also controls
3010 * whether url scraping for picasa is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003011 */
3012 public static final String GTALK_PICASA_ALBUM_URL =
3013 "gtalk_picasa_album_url";
3014
3015 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003016 * This is the url to lookup picture info from flickr. It also controls
3017 * whether url scraping for flickr is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003018 */
3019 public static final String GTALK_FLICKR_PHOTO_INFO_URL =
3020 "gtalk_flickr_photo_info_url";
3021
3022 /**
3023 * This is the url to lookup an actual picture from flickr.
3024 */
3025 public static final String GTALK_FLICKR_PHOTO_URL =
3026 "gtalk_flickr_photo_url";
3027
3028 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003029 * This is the gdata url to lookup info on a youtube video. It also controls
3030 * whether url scraping for youtube is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003031 */
3032 public static final String GTALK_YOUTUBE_VIDEO_URL =
3033 "gtalk_youtube_video_url";
Ye Wen44c6e3e2009-06-19 12:48:16 -07003034
3035 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003036 * Enable/disable GTalk URL scraping for JPG images ("true" to enable).
3037 */
3038 public static final String GTALK_URL_SCRAPING_FOR_JPG =
3039 "gtalk_url_scraping_for_jpg";
3040
3041 /**
Ye Wen48f886e2009-08-26 12:21:08 -07003042 * Chat message lifetime (for pruning old chat messages).
3043 */
3044 public static final String GTALK_CHAT_MESSAGE_LIFETIME =
3045 "gtalk_chat_message_lifetime";
3046
3047 /**
3048 * OTR message lifetime (for pruning old otr messages).
3049 */
3050 public static final String GTALK_OTR_MESSAGE_LIFETIME =
3051 "gtalk_otr_message_lifetime";
3052
3053 /**
3054 * Chat expiration time, i.e., time since last message in the chat (for pruning old chats).
3055 */
3056 public static final String GTALK_CHAT_EXPIRATION_TIME =
3057 "gtalk_chat_expiration_time";
3058
3059 /**
Wei Huang1c5e4032009-07-09 10:39:12 -07003060 * This is the url for getting the app token for server-to-device push messaging.
Wei Huang8ad22462009-06-24 18:32:45 -07003061 */
Wei Huang1c5e4032009-07-09 10:39:12 -07003062 public static final String PUSH_MESSAGING_REGISTRATION_URL =
3063 "push_messaging_registration_url";
Tom Taylor2debd562009-07-14 11:27:20 -07003064
Ye Wen48f886e2009-08-26 12:21:08 -07003065 /**
3066 * Use android://&lt;it&gt; routing infos for Google Sync Server subcriptions.
3067 */
3068 public static final String GSYNC_USE_RMQ2_ROUTING_INFO = "gsync_use_rmq2_routing_info";
Debajit Ghoshc030a482009-08-10 21:59:25 -07003069
Wei Huang8ad22462009-06-24 18:32:45 -07003070 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003071 * Enable use of ssl session caching.
3072 * 'db' - save each session in a (per process) database
3073 * 'file' - save each session in a (per process) file
3074 * not set or any other value - normal java in-memory caching
3075 */
3076 public static final String SSL_SESSION_CACHE = "ssl_session_cache";
3077
3078 /**
3079 * How many bytes long a message has to be, in order to be gzipped.
3080 */
3081 public static final String SYNC_MIN_GZIP_BYTES =
3082 "sync_min_gzip_bytes";
3083
3084 /**
3085 * The hash value of the current provisioning settings
3086 */
3087 public static final String PROVISIONING_DIGEST = "digest";
3088
3089 /**
3090 * Provisioning keys to block from server update
3091 */
3092 public static final String PROVISIONING_OVERRIDE = "override";
3093
3094 /**
3095 * "Generic" service name for authentication requests.
3096 */
3097 public static final String GOOGLE_LOGIN_GENERIC_AUTH_SERVICE
3098 = "google_login_generic_auth_service";
3099
3100 /**
3101 * Frequency in milliseconds at which we should sync the locally installed Vending Machine
3102 * content with the server.
3103 */
3104 public static final String VENDING_SYNC_FREQUENCY_MS = "vending_sync_frequency_ms";
3105
3106 /**
3107 * Support URL that is opened in a browser when user clicks on 'Help and Info' in Vending
3108 * Machine.
3109 */
3110 public static final String VENDING_SUPPORT_URL = "vending_support_url";
3111
3112 /**
3113 * Indicates if Vending Machine requires a SIM to be in the phone to allow a purchase.
3114 *
3115 * true = SIM is required
3116 * false = SIM is not required
3117 */
3118 public static final String VENDING_REQUIRE_SIM_FOR_PURCHASE =
3119 "vending_require_sim_for_purchase";
3120
3121 /**
Christian Sonntag058779c2009-08-07 10:50:06 -07003122 * Indicates the Vending Machine backup state. It is set if the
3123 * Vending application has been backed up at least once.
3124 */
3125 public static final String VENDING_BACKUP_STATE = "vending_backup_state";
3126
3127 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003128 * The current version id of the Vending Machine terms of service.
3129 */
3130 public static final String VENDING_TOS_VERSION = "vending_tos_version";
3131
3132 /**
3133 * URL that points to the terms of service for Vending Machine.
3134 */
3135 public static final String VENDING_TOS_URL = "vending_tos_url";
3136
3137 /**
lknguyenf965d162009-07-22 18:12:56 -07003138 * URL to navigate to in browser (not Market) when the terms of service
3139 * for Vending Machine could not be accessed due to bad network
3140 * connection.
3141 */
3142 public static final String VENDING_TOS_MISSING_URL = "vending_tos_missing_url";
3143
3144 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003145 * Whether to use sierraqa instead of sierra tokens for the purchase flow in
3146 * Vending Machine.
3147 *
3148 * true = use sierraqa
3149 * false = use sierra (default)
3150 */
3151 public static final String VENDING_USE_CHECKOUT_QA_SERVICE =
3152 "vending_use_checkout_qa_service";
3153
3154 /**
Mark Womack78ef4562009-03-25 16:10:13 -07003155 * Default value to use for all/free/priced filter in Market.
3156 * Valid values: ALL, FREE, PAID (case insensitive)
3157 */
3158 public static final String VENDING_DEFAULT_FILTER = "vending_default_filter";
3159 /**
3160 * Ranking type value to use for the first category tab (currently popular)
3161 */
3162 public static final String VENDING_TAB_1_RANKING_TYPE = "vending_tab_1_ranking_type";
3163
3164 /**
3165 * Title string to use for first category tab.
3166 */
3167 public static final String VENDING_TAB_1_TITLE = "vending_tab_1_title";
3168
3169 /**
3170 * Ranking type value to use for the second category tab (currently newest)
3171 */
3172 public static final String VENDING_TAB_2_RANKING_TYPE = "vending_tab_2_ranking_type";
3173
3174 /**
3175 * Title string to use for second category tab.
3176 */
3177 public static final String VENDING_TAB_2_TITLE = "vending_tab_2_title";
3178
3179 /**
Linda Nguyenabd7eba2009-06-18 18:52:59 -07003180 * Frequency in milliseconds at which we should request MCS heartbeats
3181 * from the Vending Machine client.
3182 */
3183 public static final String VENDING_HEARTBEAT_FREQUENCY_MS =
3184 "vending_heartbeat_frequency_ms";
3185
3186 /**
lknguyenb0cba432009-06-29 20:50:25 -07003187 * Frequency in milliseconds at which we should resend pending download
3188 * requests to the API Server from the Vending Machine client.
3189 */
3190 public static final String VENDING_PENDING_DOWNLOAD_RESEND_FREQUENCY_MS =
lknguyen09b33732009-06-30 13:52:45 -07003191 "vending_pd_resend_frequency_ms";
lknguyenb0cba432009-06-29 20:50:25 -07003192
3193 /**
lknguyenf602c512009-09-28 20:22:45 -07003194 * Time before an asset in the 'DOWNLOADING' state is considered ready
3195 * for an install kick on the client.
3196 */
3197 public static final String VENDING_DOWNLOADING_KICK_TIMEOUT_MS =
3198 "vending_downloading_kick_ms";
3199
3200 /**
Jasperlnb95277e2009-08-17 13:29:11 -07003201 * Size of buffer in bytes for Vending to use when reading cache files.
3202 */
3203 public static final String VENDING_DISK_INPUT_BUFFER_BYTES =
3204 "vending_disk_input_buffer_bytes";
3205
3206 /**
3207 * Size of buffer in bytes for Vending to use when writing cache files.
3208 */
3209 public static final String VENDING_DISK_OUTPUT_BUFFER_BYTES =
3210 "vending_disk_output_buffer_bytes";
3211
3212 /**
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07003213 * Frequency in milliseconds at which we should cycle through the promoted applications
3214 * on the home screen or the categories page.
3215 */
3216 public static final String VENDING_PROMO_REFRESH_FREQUENCY_MS =
3217 "vending_promo_refresh_freq_ms";
3218
3219 /**
Sanjay Jeyakumarebd84162009-08-26 16:01:08 -07003220 * Frequency in milliseconds when we should refresh the provisioning information from
3221 * the carrier backend.
3222 */
3223 public static final String VENDING_CARRIER_PROVISIONING_REFRESH_FREQUENCY_MS =
3224 "vending_carrier_ref_freq_ms";
3225
3226 /**
Sanjay Jeyakumar8cbaa832009-09-17 13:50:30 -07003227 * Interval in milliseconds after which a failed provisioning request should be retried.
3228 */
3229 public static final String VENDING_CARRIER_PROVISIONING_RETRY_MS =
3230 "vending_carrier_prov_retry_ms";
3231
3232 /**
3233 * Buffer in milliseconds for carrier credentials to be considered valid.
3234 */
3235 public static final String VENDING_CARRIER_CREDENTIALS_BUFFER_MS =
3236 "vending_carrier_cred_buf_ms";
3237
3238 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003239 * URL that points to the legal terms of service to display in Settings.
3240 * <p>
3241 * This should be a https URL. For a pretty user-friendly URL, use
3242 * {@link #SETTINGS_TOS_PRETTY_URL}.
3243 */
3244 public static final String SETTINGS_TOS_URL = "settings_tos_url";
3245
3246 /**
3247 * URL that points to the legal terms of service to display in Settings.
3248 * <p>
3249 * This should be a pretty http URL. For the URL the device will access
3250 * via Settings, use {@link #SETTINGS_TOS_URL}.
3251 */
3252 public static final String SETTINGS_TOS_PRETTY_URL = "settings_tos_pretty_url";
3253
3254 /**
3255 * URL that points to the contributors to display in Settings.
3256 * <p>
3257 * This should be a https URL. For a pretty user-friendly URL, use
3258 * {@link #SETTINGS_CONTRIBUTORS_PRETTY_URL}.
3259 */
3260 public static final String SETTINGS_CONTRIBUTORS_URL = "settings_contributors_url";
3261
3262 /**
3263 * URL that points to the contributors to display in Settings.
3264 * <p>
3265 * This should be a pretty http URL. For the URL the device will access
3266 * via Settings, use {@link #SETTINGS_CONTRIBUTORS_URL}.
3267 */
3268 public static final String SETTINGS_CONTRIBUTORS_PRETTY_URL =
3269 "settings_contributors_pretty_url";
3270
3271 /**
3272 * URL that points to the Terms Of Service for the device.
3273 * <p>
3274 * This should be a pretty http URL.
3275 */
3276 public static final String SETUP_GOOGLE_TOS_URL = "setup_google_tos_url";
3277
3278 /**
3279 * URL that points to the Android privacy policy for the device.
3280 * <p>
3281 * This should be a pretty http URL.
3282 */
3283 public static final String SETUP_ANDROID_PRIVACY_URL = "setup_android_privacy_url";
3284
3285 /**
3286 * URL that points to the Google privacy policy for the device.
3287 * <p>
3288 * This should be a pretty http URL.
3289 */
3290 public static final String SETUP_GOOGLE_PRIVACY_URL = "setup_google_privacy_url";
3291
3292 /**
3293 * Request an MSISDN token for various Google services.
3294 */
3295 public static final String USE_MSISDN_TOKEN = "use_msisdn_token";
3296
3297 /**
3298 * RSA public key used to encrypt passwords stored in the database.
3299 */
3300 public static final String GLS_PUBLIC_KEY = "google_login_public_key";
3301
3302 /**
3303 * Only check parental control status if this is set to "true".
3304 */
3305 public static final String PARENTAL_CONTROL_CHECK_ENABLED =
3306 "parental_control_check_enabled";
3307
3308 /**
3309 * The list of applications we need to block if parental control is
3310 * enabled.
3311 */
3312 public static final String PARENTAL_CONTROL_APPS_LIST =
3313 "parental_control_apps_list";
3314
3315 /**
3316 * Duration in which parental control status is valid.
3317 */
3318 public static final String PARENTAL_CONTROL_TIMEOUT_IN_MS =
3319 "parental_control_timeout_in_ms";
3320
3321 /**
3322 * When parental control is off, we expect to get this string from the
3323 * litmus url.
3324 */
3325 public static final String PARENTAL_CONTROL_EXPECTED_RESPONSE =
3326 "parental_control_expected_response";
3327
3328 /**
3329 * When the litmus url returns a 302, declare parental control to be on
3330 * only if the redirect url matches this regular expression.
3331 */
3332 public static final String PARENTAL_CONTROL_REDIRECT_REGEX =
3333 "parental_control_redirect_regex";
3334
3335 /**
3336 * Threshold for the amount of change in disk free space required to report the amount of
3337 * free space. Used to prevent spamming the logs when the disk free space isn't changing
3338 * frequently.
3339 */
3340 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3341 "disk_free_change_reporting_threshold";
3342
3343 /**
3344 * Prefix for new Google services published by the checkin
3345 * server.
3346 */
3347 public static final String GOOGLE_SERVICES_PREFIX
3348 = "google_services:";
3349
3350 /**
3351 * The maximum reconnect delay for short network outages or when the network is suspended
3352 * due to phone use.
3353 */
3354 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3355 "sync_max_retry_delay_in_seconds";
3356
3357 /**
3358 * Minimum percentage of free storage on the device that is used to determine if
3359 * the device is running low on storage.
3360 * Say this value is set to 10, the device is considered running low on storage
3361 * if 90% or more of the device storage is filled up.
3362 */
3363 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3364 "sys_storage_threshold_percentage";
3365
3366 /**
3367 * The interval in minutes after which the amount of free storage left on the
3368 * device is logged to the event log
3369 */
3370 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3371 "sys_free_storage_log_interval";
3372
3373 /**
3374 * The interval in milliseconds at which to check the number of SMS sent
3375 * out without asking for use permit, to limit the un-authorized SMS
3376 * usage.
3377 */
jsh867641e2009-05-27 17:32:50 -07003378 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003379 "sms_outgoing_check_interval_ms";
3380
3381 /**
3382 * The number of outgoing SMS sent without asking for user permit
jsh867641e2009-05-27 17:32:50 -07003383 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003384 */
3385 public static final String SMS_OUTGOING_CEHCK_MAX_COUNT =
3386 "sms_outgoing_check_max_count";
3387
3388 /**
3389 * The interval in milliseconds at which to check packet counts on the
3390 * mobile data interface when screen is on, to detect possible data
3391 * connection problems.
3392 */
3393 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3394 "pdp_watchdog_poll_interval_ms";
3395
3396 /**
3397 * The interval in milliseconds at which to check packet counts on the
3398 * mobile data interface when screen is off, to detect possible data
3399 * connection problems.
3400 */
3401 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3402 "pdp_watchdog_long_poll_interval_ms";
3403
3404 /**
3405 * The interval in milliseconds at which to check packet counts on the
3406 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3407 * outgoing packets has been reached without incoming packets.
3408 */
3409 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3410 "pdp_watchdog_error_poll_interval_ms";
3411
3412 /**
3413 * The number of outgoing packets sent without seeing an incoming packet
3414 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3415 * device is logged to the event log
3416 */
3417 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3418 "pdp_watchdog_trigger_packet_count";
3419
3420 /**
3421 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3422 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3423 * attempting data connection recovery.
3424 */
3425 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3426 "pdp_watchdog_error_poll_count";
3427
3428 /**
3429 * The number of failed PDP reset attempts before moving to something more
3430 * drastic: re-registering to the network.
3431 */
3432 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3433 "pdp_watchdog_max_pdp_reset_fail_count";
3434
3435 /**
3436 * Address to ping as a last sanity check before attempting any recovery.
3437 * Unset or set to "0.0.0.0" to skip this check.
3438 */
3439 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3440
3441 /**
3442 * The "-w deadline" parameter for the ping, ie, the max time in
3443 * seconds to spend pinging.
3444 */
3445 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3446
3447 /**
3448 * The interval in milliseconds at which to check gprs registration
3449 * after the first registration mismatch of gprs and voice service,
3450 * to detect possible data network registration problems.
3451 *
3452 */
3453 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3454 "gprs_register_check_period_ms";
3455
3456 /**
3457 * The interval in milliseconds after which Wi-Fi is considered idle.
3458 * When idle, it is possible for the device to be switched from Wi-Fi to
3459 * the mobile data network.
3460 */
3461 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3462
3463 /**
3464 * Screen timeout in milliseconds corresponding to the
3465 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3466 * possible screen timeout behavior.)
3467 */
3468 public static final String SHORT_KEYLIGHT_DELAY_MS =
3469 "short_keylight_delay_ms";
3470
3471 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003472 * List of test suites (local disk filename) for the automatic instrumentation test runner.
3473 * The file format is similar to automated_suites.xml, see AutoTesterService.
3474 * If this setting is missing or empty, the automatic test runner will not start.
3475 */
3476 public static final String AUTOTEST_SUITES_FILE = "autotest_suites_file";
3477
3478 /**
3479 * Interval between synchronous checkins forced by the automatic test runner.
3480 * If you set this to a value smaller than CHECKIN_INTERVAL, then the test runner's
3481 * frequent checkins will prevent asynchronous background checkins from interfering
3482 * with any performance measurements.
3483 */
3484 public static final String AUTOTEST_CHECKIN_SECONDS = "autotest_checkin_seconds";
3485
3486 /**
3487 * Interval between reboots forced by the automatic test runner.
3488 */
3489 public static final String AUTOTEST_REBOOT_SECONDS = "autotest_reboot_seconds";
3490
3491
3492 /**
3493 * Threshold values for the duration and level of a discharge cycle, under
3494 * which we log discharge cycle info.
3495 */
3496 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3497 "battery_discharge_duration_threshold";
3498 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003499
The Android Open Source Project4df24232009-03-05 14:34:35 -08003500 /**
3501 * An email address that anr bugreports should be sent to.
3502 */
3503 public static final String ANR_BUGREPORT_RECIPIENT = "anr_bugreport_recipient";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003504
3505 /**
Amith Yamasani430555ac2009-06-11 22:35:39 -07003506 * Flag for allowing service provider to use location information to improve products and
3507 * services.
3508 * Type: int ( 0 = disallow, 1 = allow )
Amith Yamasani630cd062009-06-19 12:07:02 -07003509 * @deprecated
Amith Yamasani430555ac2009-06-11 22:35:39 -07003510 */
3511 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
3512
3513 /**
Ken Shirriff326580d2009-08-10 14:21:46 -07003514 * The length of the calendar sync window into the future.
3515 * This specifies the number of days into the future for the sliding window sync.
3516 * Setting this to zero will disable sliding sync.
3517 */
3518 public static final String GOOGLE_CALENDAR_SYNC_WINDOW_DAYS =
3519 "google_calendar_sync_window_days";
3520
3521 /**
Ken Shirrifff0f13ae2009-08-20 13:19:14 -07003522 * How often to update the calendar sync window.
3523 * The window will be advanced every n days.
3524 */
3525 public static final String GOOGLE_CALENDAR_SYNC_WINDOW_UPDATE_DAYS =
3526 "google_calendar_sync_window_update_days";
3527
3528 /**
Bjorn Bringert96f86132009-09-04 12:01:53 +01003529 * The number of promoted sources in GlobalSearch.
3530 */
3531 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3532 /**
3533 * The maximum number of suggestions returned by GlobalSearch.
3534 */
3535 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3536 /**
3537 * The number of suggestions GlobalSearch will ask each non-web search source for.
3538 */
3539 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3540 /**
3541 * The number of suggestions the GlobalSearch will ask the web search source for.
3542 */
3543 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3544 "search_web_results_override_limit";
3545 /**
3546 * The number of milliseconds that GlobalSearch will wait for suggestions from
3547 * promoted sources before continuing with all other sources.
3548 */
3549 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3550 "search_promoted_source_deadline_millis";
3551 /**
3552 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3553 */
3554 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3555 /**
3556 * The maximum number of milliseconds that GlobalSearch shows the previous results
3557 * after receiving a new query.
3558 */
3559 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3560 /**
3561 * The maximum age of log data used for shortcuts in GlobalSearch.
3562 */
3563 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3564 /**
3565 * The maximum age of log data used for source ranking in GlobalSearch.
3566 */
3567 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3568 "search_max_source_event_age_millis";
3569 /**
3570 * The minimum number of impressions needed to rank a source in GlobalSearch.
3571 */
3572 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3573 "search_min_impressions_for_source_ranking";
3574 /**
3575 * The minimum number of clicks needed to rank a source in GlobalSearch.
3576 */
3577 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3578 "search_min_clicks_for_source_ranking";
3579 /**
3580 * The maximum number of shortcuts shown by GlobalSearch.
3581 */
3582 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3583 /**
3584 * The size of the core thread pool for suggestion queries in GlobalSearch.
3585 */
3586 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3587 "search_query_thread_core_pool_size";
3588 /**
3589 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3590 */
3591 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3592 "search_query_thread_max_pool_size";
3593 /**
3594 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3595 */
3596 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3597 "search_shortcut_refresh_core_pool_size";
3598 /**
3599 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3600 */
3601 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3602 "search_shortcut_refresh_max_pool_size";
3603 /**
3604 * The maximun time that excess threads in the GlobalSeach thread pools will
3605 * wait before terminating.
3606 */
3607 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3608 "search_thread_keepalive_seconds";
3609 /**
3610 * The maximum number of concurrent suggestion queries to each source.
3611 */
3612 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3613 "search_per_source_concurrent_query_limit";
Bjorn Bringert96f86132009-09-04 12:01:53 +01003614 /**
Jacek Surazskia2339432009-09-18 15:01:26 +02003615 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3616 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3617 * will never display the "Report" button.
3618 * Type: int ( 0 = disallow, 1 = allow )
3619 */
3620 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3621
3622 /**
Dan Egnoree649a82009-10-08 19:51:51 -07003623 * Maximum size of /proc/last_kmsg content to upload after reboot.
3624 */
3625 public static final String LAST_KMSG_KB = "last_kmsg_kb";
3626
3627 /**
Dan Egnor4410ec82009-09-11 16:40:01 -07003628 * Maximum age of entries kept by {@link android.os.IDropBox}.
3629 */
3630 public static final String DROPBOX_AGE_SECONDS =
3631 "dropbox_age_seconds";
3632 /**
3633 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
3634 */
3635 public static final String DROPBOX_QUOTA_KB =
3636 "dropbox_quota_kb";
3637 /**
3638 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
3639 */
3640 public static final String DROPBOX_QUOTA_PERCENT =
3641 "dropbox_quota_percent";
3642 /**
3643 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
3644 */
3645 public static final String DROPBOX_RESERVE_PERCENT =
3646 "dropbox_reserve_percent";
3647 /**
3648 * Prefix for per-tag dropbox disable/enable settings.
3649 */
3650 public static final String DROPBOX_TAG_PREFIX =
3651 "dropbox:";
3652
3653 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003654 * @deprecated
3655 * @hide
3656 */
3657 @Deprecated // Obviated by NameValueCache: just fetch the value directly.
3658 public static class QueryMap extends ContentQueryMap {
3659
3660 public QueryMap(ContentResolver contentResolver, Cursor cursor, boolean keepUpdated,
3661 Handler handlerForUpdateNotifications) {
3662 super(cursor, NAME, keepUpdated, handlerForUpdateNotifications);
3663 }
3664
3665 public QueryMap(ContentResolver contentResolver, boolean keepUpdated,
3666 Handler handlerForUpdateNotifications) {
3667 this(contentResolver,
3668 contentResolver.query(CONTENT_URI, null, null, null, null),
3669 keepUpdated, handlerForUpdateNotifications);
3670 }
3671
3672 public String getString(String name) {
3673 ContentValues cv = getValues(name);
3674 if (cv == null) return null;
3675 return cv.getAsString(VALUE);
3676 }
3677 }
3678
3679 }
3680
3681 /**
3682 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3683 * Intent URL, allowing it to be either a web page or a particular
3684 * application activity.
3685 *
3686 * @hide
3687 */
3688 public static final class Bookmarks implements BaseColumns
3689 {
3690 private static final String TAG = "Bookmarks";
3691
3692 /**
3693 * The content:// style URL for this table
3694 */
3695 public static final Uri CONTENT_URI =
3696 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3697
3698 /**
3699 * The row ID.
3700 * <p>Type: INTEGER</p>
3701 */
3702 public static final String ID = "_id";
3703
3704 /**
3705 * Descriptive name of the bookmark that can be displayed to the user.
3706 * If this is empty, the title should be resolved at display time (use
3707 * {@link #getTitle(Context, Cursor)} any time you want to display the
3708 * title of a bookmark.)
3709 * <P>
3710 * Type: TEXT
3711 * </P>
3712 */
3713 public static final String TITLE = "title";
3714
3715 /**
3716 * Arbitrary string (displayed to the user) that allows bookmarks to be
3717 * organized into categories. There are some special names for
3718 * standard folders, which all start with '@'. The label displayed for
3719 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3720 * the folder name does not change so you can consistently query for
3721 * the folder regardless of the current locale.
3722 *
3723 * <P>Type: TEXT</P>
3724 *
3725 */
3726 public static final String FOLDER = "folder";
3727
3728 /**
3729 * The Intent URL of the bookmark, describing what it points to. This
3730 * value is given to {@link android.content.Intent#getIntent} to create
3731 * an Intent that can be launched.
3732 * <P>Type: TEXT</P>
3733 */
3734 public static final String INTENT = "intent";
3735
3736 /**
3737 * Optional shortcut character associated with this bookmark.
3738 * <P>Type: INTEGER</P>
3739 */
3740 public static final String SHORTCUT = "shortcut";
3741
3742 /**
3743 * The order in which the bookmark should be displayed
3744 * <P>Type: INTEGER</P>
3745 */
3746 public static final String ORDERING = "ordering";
3747
3748 private static final String[] sIntentProjection = { INTENT };
3749 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3750 private static final String sShortcutSelection = SHORTCUT + "=?";
3751
3752 /**
3753 * Convenience function to retrieve the bookmarked Intent for a
3754 * particular shortcut key.
3755 *
3756 * @param cr The ContentResolver to query.
3757 * @param shortcut The shortcut key.
3758 *
3759 * @return Intent The bookmarked URL, or null if there is no bookmark
3760 * matching the given shortcut.
3761 */
3762 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3763 {
3764 Intent intent = null;
3765
3766 Cursor c = cr.query(CONTENT_URI,
3767 sIntentProjection, sShortcutSelection,
3768 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3769 // Keep trying until we find a valid shortcut
3770 try {
3771 while (intent == null && c.moveToNext()) {
3772 try {
3773 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3774 intent = Intent.getIntent(intentURI);
3775 } catch (java.net.URISyntaxException e) {
3776 // The stored URL is bad... ignore it.
3777 } catch (IllegalArgumentException e) {
3778 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003779 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003780 }
3781 }
3782 } finally {
3783 if (c != null) c.close();
3784 }
3785
3786 return intent;
3787 }
3788
3789 /**
3790 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003791 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003792 * @param cr The ContentResolver to query.
3793 * @param intent The desired target of the bookmark.
3794 * @param title Bookmark title that is shown to the user; null if none
3795 * or it should be resolved to the intent's title.
3796 * @param folder Folder in which to place the bookmark; null if none.
3797 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3798 * this is non-zero and there is an existing bookmark entry
3799 * with this same shortcut, then that existing shortcut is
3800 * cleared (the bookmark is not removed).
3801 * @return The unique content URL for the new bookmark entry.
3802 */
3803 public static Uri add(ContentResolver cr,
3804 Intent intent,
3805 String title,
3806 String folder,
3807 char shortcut,
3808 int ordering)
3809 {
3810 // If a shortcut is supplied, and it is already defined for
3811 // another bookmark, then remove the old definition.
3812 if (shortcut != 0) {
3813 Cursor c = cr.query(CONTENT_URI,
3814 sShortcutProjection, sShortcutSelection,
3815 new String[] { String.valueOf((int) shortcut) }, null);
3816 try {
3817 if (c.moveToFirst()) {
3818 while (c.getCount() > 0) {
3819 if (!c.deleteRow()) {
3820 Log.w(TAG, "Could not delete existing shortcut row");
3821 }
3822 }
3823 }
3824 } finally {
3825 if (c != null) c.close();
3826 }
3827 }
3828
3829 ContentValues values = new ContentValues();
3830 if (title != null) values.put(TITLE, title);
3831 if (folder != null) values.put(FOLDER, folder);
3832 values.put(INTENT, intent.toURI());
3833 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3834 values.put(ORDERING, ordering);
3835 return cr.insert(CONTENT_URI, values);
3836 }
3837
3838 /**
3839 * Return the folder name as it should be displayed to the user. This
3840 * takes care of localizing special folders.
3841 *
3842 * @param r Resources object for current locale; only need access to
3843 * system resources.
3844 * @param folder The value found in the {@link #FOLDER} column.
3845 *
3846 * @return CharSequence The label for this folder that should be shown
3847 * to the user.
3848 */
3849 public static CharSequence getLabelForFolder(Resources r, String folder) {
3850 return folder;
3851 }
3852
3853 /**
3854 * Return the title as it should be displayed to the user. This takes
3855 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003856 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003857 * @param context A context.
3858 * @param cursor A cursor pointing to the row whose title should be
3859 * returned. The cursor must contain at least the {@link #TITLE}
3860 * and {@link #INTENT} columns.
3861 * @return A title that is localized and can be displayed to the user,
3862 * or the empty string if one could not be found.
3863 */
3864 public static CharSequence getTitle(Context context, Cursor cursor) {
3865 int titleColumn = cursor.getColumnIndex(TITLE);
3866 int intentColumn = cursor.getColumnIndex(INTENT);
3867 if (titleColumn == -1 || intentColumn == -1) {
3868 throw new IllegalArgumentException(
3869 "The cursor must contain the TITLE and INTENT columns.");
3870 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003871
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003872 String title = cursor.getString(titleColumn);
3873 if (!TextUtils.isEmpty(title)) {
3874 return title;
3875 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003876
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003877 String intentUri = cursor.getString(intentColumn);
3878 if (TextUtils.isEmpty(intentUri)) {
3879 return "";
3880 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003881
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003882 Intent intent;
3883 try {
3884 intent = Intent.getIntent(intentUri);
3885 } catch (URISyntaxException e) {
3886 return "";
3887 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003888
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003889 PackageManager packageManager = context.getPackageManager();
3890 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3891 return info != null ? info.loadLabel(packageManager) : "";
3892 }
3893 }
3894
3895 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3897 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3898 * from the GoogleLoginService.
3899 *
3900 * @param androidId The Android ID for this device.
3901 * @return The device ID that should be used when connecting to the mobile gtalk server.
3902 * @hide
3903 */
3904 public static String getGTalkDeviceId(long androidId) {
3905 return "android-" + Long.toHexString(androidId);
3906 }
3907}