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