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