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