blob: 7b52f7f70d99e9d369f01f374182d9b40c4eab7e [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>
377 * Input: Nothing.
378 * <p>
379 * Output: Nothing.
380 */
381 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
382 public static final String ACTION_SYNC_SETTINGS =
383 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700384
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800385 /**
386 * Activity Action: Show settings for selecting the network operator.
387 * <p>
388 * In some cases, a matching Activity may not exist, so ensure you
389 * safeguard against this.
390 * <p>
391 * Input: Nothing.
392 * <p>
393 * Output: Nothing.
394 */
395 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
396 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
397 "android.settings.NETWORK_OPERATOR_SETTINGS";
398
399 /**
400 * Activity Action: Show settings for selection of 2G/3G.
401 * <p>
402 * In some cases, a matching Activity may not exist, so ensure you
403 * safeguard against this.
404 * <p>
405 * Input: Nothing.
406 * <p>
407 * Output: Nothing.
408 */
409 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
410 public static final String ACTION_DATA_ROAMING_SETTINGS =
411 "android.settings.DATA_ROAMING_SETTINGS";
412
413 /**
414 * Activity Action: Show settings for internal storage.
415 * <p>
416 * In some cases, a matching Activity may not exist, so ensure you
417 * safeguard against this.
418 * <p>
419 * Input: Nothing.
420 * <p>
421 * Output: Nothing.
422 */
423 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
424 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
425 "android.settings.INTERNAL_STORAGE_SETTINGS";
426 /**
427 * Activity Action: Show settings for memory card storage.
428 * <p>
429 * In some cases, a matching Activity may not exist, so ensure you
430 * safeguard against this.
431 * <p>
432 * Input: Nothing.
433 * <p>
434 * Output: Nothing.
435 */
436 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
437 public static final String ACTION_MEMORY_CARD_SETTINGS =
438 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700439
Justin Mattsonef340352010-01-13 21:05:46 -0800440 /**
441 * Activity Action: Show settings for global search.
442 * <p>
443 * In some cases, a matching Activity may not exist, so ensure you
444 * safeguard against this.
445 * <p>
446 * Input: Nothing.
447 * <p>
448 * Output: Nothing
449 */
450 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
451 public static final String ACTION_SEARCH_SETTINGS =
452 "android.search.action.SEARCH_SETTINGS";
453
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500454 /**
455 * Activity Action: Show general device information settings (serial
456 * number, software version, phone number, etc.).
457 * <p>
458 * In some cases, a matching Activity may not exist, so ensure you
459 * safeguard against this.
460 * <p>
461 * Input: Nothing.
462 * <p>
463 * Output: Nothing
464 */
465 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
466 public static final String ACTION_DEVICE_INFO_SETTINGS =
467 "android.settings.DEVICE_INFO_SETTINGS";
468
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800469 // End of Intent actions for Settings
470
471 private static final String JID_RESOURCE_PREFIX = "android";
472
473 public static final String AUTHORITY = "settings";
474
475 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800476 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800477
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800478 public static class SettingNotFoundException extends AndroidException {
479 public SettingNotFoundException(String msg) {
480 super(msg);
481 }
482 }
483
484 /**
485 * Common base for tables of name/value settings.
486 */
487 public static class NameValueTable implements BaseColumns {
488 public static final String NAME = "name";
489 public static final String VALUE = "value";
490
491 protected static boolean putString(ContentResolver resolver, Uri uri,
492 String name, String value) {
493 // The database will take care of replacing duplicates.
494 try {
495 ContentValues values = new ContentValues();
496 values.put(NAME, name);
497 values.put(VALUE, value);
498 resolver.insert(uri, values);
499 return true;
500 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700501 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800502 return false;
503 }
504 }
505
506 public static Uri getUriFor(Uri uri, String name) {
507 return Uri.withAppendedPath(uri, name);
508 }
509 }
510
511 private static class NameValueCache {
512 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800513 private final Uri mUri;
514
Dan Egnor799f7212009-11-24 16:24:44 -0800515 // Must synchronize(mValues) to access mValues and mValuesVersion.
516 private final HashMap<String, String> mValues = new HashMap<String, String>();
517 private long mValuesVersion = 0;
518
519 public NameValueCache(String versionSystemProperty, Uri uri) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800520 mVersionSystemProperty = versionSystemProperty;
521 mUri = uri;
522 }
523
Dan Egnor799f7212009-11-24 16:24:44 -0800524 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800525 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800526
527 synchronized (mValues) {
528 if (mValuesVersion != newValuesVersion) {
529 if (LOCAL_LOGV) {
530 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
531 newValuesVersion + " != cached " + mValuesVersion);
532 }
533
534 mValues.clear();
535 mValuesVersion = newValuesVersion;
536 }
537
538 if (mValues.containsKey(name)) {
539 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800541 }
Dan Egnor799f7212009-11-24 16:24:44 -0800542
543 Cursor c = null;
544 try {
545 c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE },
546 Settings.NameValueTable.NAME + "=?", new String[]{name}, null);
547 if (c == null) {
548 Log.w(TAG, "Can't get key " + name + " from " + mUri);
549 return null;
550 }
551
552 String value = c.moveToNext() ? c.getString(0) : null;
553 synchronized (mValues) {
554 mValues.put(name, value);
555 }
556 if (LOCAL_LOGV) {
557 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
558 name + " = " + (value == null ? "(null)" : value));
559 }
560 return value;
561 } catch (SQLException e) {
562 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
563 return null; // Return null, but don't cache it.
564 } finally {
565 if (c != null) c.close();
566 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 }
568 }
569
570 /**
571 * System settings, containing miscellaneous system preferences. This
572 * table holds simple name/value pairs. There are convenience
573 * functions for accessing individual settings entries.
574 */
575 public static final class System extends NameValueTable {
576 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
577
578 private static volatile NameValueCache mNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700579
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800580 private static final HashSet<String> MOVED_TO_SECURE;
581 static {
582 MOVED_TO_SECURE = new HashSet<String>(30);
583 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
584 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
585 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
586 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
587 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
588 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
589 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
590 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
591 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
592 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
593 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
594 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
595 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
596 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
597 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
598 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
599 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
600 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
601 MOVED_TO_SECURE.add(Secure.WIFI_ON);
602 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
603 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
604 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
605 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
606 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
607 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
608 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
609 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
610 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
611 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
612 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
613 }
614
615 /**
616 * Look up a name in the database.
617 * @param resolver to access the database with
618 * @param name to look up in the table
619 * @return the corresponding value, or null if not present
620 */
621 public synchronized static String getString(ContentResolver resolver, String name) {
622 if (MOVED_TO_SECURE.contains(name)) {
623 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
624 + " to android.provider.Settings.Secure, returning read-only value.");
625 return Secure.getString(resolver, name);
626 }
627 if (mNameValueCache == null) {
628 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
629 }
630 return mNameValueCache.getString(resolver, name);
631 }
632
633 /**
634 * Store a name/value pair into the database.
635 * @param resolver to access the database with
636 * @param name to store
637 * @param value to associate with the name
638 * @return true if the value was set, false on database errors
639 */
640 public static boolean putString(ContentResolver resolver, String name, String value) {
641 if (MOVED_TO_SECURE.contains(name)) {
642 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
643 + " to android.provider.Settings.Secure, value is unchanged.");
644 return false;
645 }
646 return putString(resolver, CONTENT_URI, name, value);
647 }
648
649 /**
650 * Construct the content URI for a particular name/value pair,
651 * useful for monitoring changes with a ContentObserver.
652 * @param name to look up in the table
653 * @return the corresponding content URI, or null if not present
654 */
655 public static Uri getUriFor(String name) {
656 if (MOVED_TO_SECURE.contains(name)) {
657 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
658 + " to android.provider.Settings.Secure, returning Secure URI.");
659 return Secure.getUriFor(Secure.CONTENT_URI, name);
660 }
661 return getUriFor(CONTENT_URI, name);
662 }
663
664 /**
665 * Convenience function for retrieving a single system settings value
666 * as an integer. Note that internally setting values are always
667 * stored as strings; this function converts the string to an integer
668 * for you. The default value will be returned if the setting is
669 * not defined or not an integer.
670 *
671 * @param cr The ContentResolver to access.
672 * @param name The name of the setting to retrieve.
673 * @param def Value to return if the setting is not defined.
674 *
675 * @return The setting's current value, or 'def' if it is not defined
676 * or not a valid integer.
677 */
678 public static int getInt(ContentResolver cr, String name, int def) {
679 String v = getString(cr, name);
680 try {
681 return v != null ? Integer.parseInt(v) : def;
682 } catch (NumberFormatException e) {
683 return def;
684 }
685 }
686
687 /**
688 * Convenience function for retrieving a single system settings value
689 * as an integer. Note that internally setting values are always
690 * stored as strings; this function converts the string to an integer
691 * for you.
692 * <p>
693 * This version does not take a default value. If the setting has not
694 * been set, or the string value is not a number,
695 * it throws {@link SettingNotFoundException}.
696 *
697 * @param cr The ContentResolver to access.
698 * @param name The name of the setting to retrieve.
699 *
700 * @throws SettingNotFoundException Thrown if a setting by the given
701 * name can't be found or the setting value is not an integer.
702 *
703 * @return The setting's current value.
704 */
705 public static int getInt(ContentResolver cr, String name)
706 throws SettingNotFoundException {
707 String v = getString(cr, name);
708 try {
709 return Integer.parseInt(v);
710 } catch (NumberFormatException e) {
711 throw new SettingNotFoundException(name);
712 }
713 }
714
715 /**
716 * Convenience function for updating a single settings value as an
717 * integer. This will either create a new entry in the table if the
718 * given name does not exist, or modify the value of the existing row
719 * with that name. Note that internally setting values are always
720 * stored as strings, so this function converts the given value to a
721 * string before storing it.
722 *
723 * @param cr The ContentResolver to access.
724 * @param name The name of the setting to modify.
725 * @param value The new value for the setting.
726 * @return true if the value was set, false on database errors
727 */
728 public static boolean putInt(ContentResolver cr, String name, int value) {
729 return putString(cr, name, Integer.toString(value));
730 }
731
732 /**
733 * Convenience function for retrieving a single system settings value
734 * as a {@code long}. Note that internally setting values are always
735 * stored as strings; this function converts the string to a {@code long}
736 * for you. The default value will be returned if the setting is
737 * not defined or not a {@code long}.
738 *
739 * @param cr The ContentResolver to access.
740 * @param name The name of the setting to retrieve.
741 * @param def Value to return if the setting is not defined.
742 *
743 * @return The setting's current value, or 'def' if it is not defined
744 * or not a valid {@code long}.
745 */
746 public static long getLong(ContentResolver cr, String name, long def) {
747 String valString = getString(cr, name);
748 long value;
749 try {
750 value = valString != null ? Long.parseLong(valString) : def;
751 } catch (NumberFormatException e) {
752 value = def;
753 }
754 return value;
755 }
756
757 /**
758 * Convenience function for retrieving a single system settings value
759 * as a {@code long}. Note that internally setting values are always
760 * stored as strings; this function converts the string to a {@code long}
761 * for you.
762 * <p>
763 * This version does not take a default value. If the setting has not
764 * been set, or the string value is not a number,
765 * it throws {@link SettingNotFoundException}.
766 *
767 * @param cr The ContentResolver to access.
768 * @param name The name of the setting to retrieve.
769 *
770 * @return The setting's current value.
771 * @throws SettingNotFoundException Thrown if a setting by the given
772 * name can't be found or the setting value is not an integer.
773 */
774 public static long getLong(ContentResolver cr, String name)
775 throws SettingNotFoundException {
776 String valString = getString(cr, name);
777 try {
778 return Long.parseLong(valString);
779 } catch (NumberFormatException e) {
780 throw new SettingNotFoundException(name);
781 }
782 }
783
784 /**
785 * Convenience function for updating a single settings value as a long
786 * integer. This will either create a new entry in the table if the
787 * given name does not exist, or modify the value of the existing row
788 * with that name. Note that internally setting values are always
789 * stored as strings, so this function converts the given value to a
790 * string before storing it.
791 *
792 * @param cr The ContentResolver to access.
793 * @param name The name of the setting to modify.
794 * @param value The new value for the setting.
795 * @return true if the value was set, false on database errors
796 */
797 public static boolean putLong(ContentResolver cr, String name, long value) {
798 return putString(cr, name, Long.toString(value));
799 }
800
801 /**
802 * Convenience function for retrieving a single system settings value
803 * as a floating point number. Note that internally setting values are
804 * always stored as strings; this function converts the string to an
805 * float for you. The default value will be returned if the setting
806 * is not defined or not a valid float.
807 *
808 * @param cr The ContentResolver to access.
809 * @param name The name of the setting to retrieve.
810 * @param def Value to return if the setting is not defined.
811 *
812 * @return The setting's current value, or 'def' if it is not defined
813 * or not a valid float.
814 */
815 public static float getFloat(ContentResolver cr, String name, float def) {
816 String v = getString(cr, name);
817 try {
818 return v != null ? Float.parseFloat(v) : def;
819 } catch (NumberFormatException e) {
820 return def;
821 }
822 }
823
824 /**
825 * Convenience function for retrieving a single system settings value
826 * as a float. Note that internally setting values are always
827 * stored as strings; this function converts the string to a float
828 * for you.
829 * <p>
830 * This version does not take a default value. If the setting has not
831 * been set, or the string value is not a number,
832 * it throws {@link SettingNotFoundException}.
833 *
834 * @param cr The ContentResolver to access.
835 * @param name The name of the setting to retrieve.
836 *
837 * @throws SettingNotFoundException Thrown if a setting by the given
838 * name can't be found or the setting value is not a float.
839 *
840 * @return The setting's current value.
841 */
842 public static float getFloat(ContentResolver cr, String name)
843 throws SettingNotFoundException {
844 String v = getString(cr, name);
845 try {
846 return Float.parseFloat(v);
847 } catch (NumberFormatException e) {
848 throw new SettingNotFoundException(name);
849 }
850 }
851
852 /**
853 * Convenience function for updating a single settings value as a
854 * floating point number. This will either create a new entry in the
855 * table if the given name does not exist, or modify the value of the
856 * existing row with that name. Note that internally setting values
857 * are always stored as strings, so this function converts the given
858 * value to a string before storing it.
859 *
860 * @param cr The ContentResolver to access.
861 * @param name The name of the setting to modify.
862 * @param value The new value for the setting.
863 * @return true if the value was set, false on database errors
864 */
865 public static boolean putFloat(ContentResolver cr, String name, float value) {
866 return putString(cr, name, Float.toString(value));
867 }
868
869 /**
870 * Convenience function to read all of the current
871 * configuration-related settings into a
872 * {@link Configuration} object.
873 *
874 * @param cr The ContentResolver to access.
875 * @param outConfig Where to place the configuration settings.
876 */
877 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
878 outConfig.fontScale = Settings.System.getFloat(
879 cr, FONT_SCALE, outConfig.fontScale);
880 if (outConfig.fontScale < 0) {
881 outConfig.fontScale = 1;
882 }
883 }
884
885 /**
886 * Convenience function to write a batch of configuration-related
887 * settings from a {@link Configuration} object.
888 *
889 * @param cr The ContentResolver to access.
890 * @param config The settings to write.
891 * @return true if the values were set, false on database errors
892 */
893 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
894 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
895 }
896
897 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
898 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
899 }
900
901 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
902 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
903 }
904
905 /**
906 * The content:// style URL for this table
907 */
908 public static final Uri CONTENT_URI =
909 Uri.parse("content://" + AUTHORITY + "/system");
910
911 /**
912 * Whether we keep the device on while the device is plugged in.
913 * Supported values are:
914 * <ul>
915 * <li>{@code 0} to never stay on while plugged in</li>
916 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
917 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
918 * </ul>
919 * These values can be OR-ed together.
920 */
921 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
922
923 /**
924 * What happens when the user presses the end call button if they're not
925 * on a call.<br/>
926 * <b>Values:</b><br/>
927 * 0 - The end button does nothing.<br/>
928 * 1 - The end button goes to the home screen.<br/>
929 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
930 * 3 - The end button goes to the home screen. If the user is already on the
931 * home screen, it puts the device to sleep.
932 */
933 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
934
935 /**
936 * Whether Airplane Mode is on.
937 */
938 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
939
940 /**
941 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
942 */
943 public static final String RADIO_BLUETOOTH = "bluetooth";
944
945 /**
946 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
947 */
948 public static final String RADIO_WIFI = "wifi";
949
950 /**
951 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
952 */
953 public static final String RADIO_CELL = "cell";
954
955 /**
956 * A comma separated list of radios that need to be disabled when airplane mode
957 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
958 * included in the comma separated list.
959 */
960 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
961
962 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -0700963 * A comma separated list of radios that should to be disabled when airplane mode
964 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
965 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
966 * will be turned off when entering airplane mode, but the user will be able to reenable
967 * Wifi in the Settings app.
968 *
969 * {@hide}
970 */
971 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
972
973 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800974 * The policy for deciding when Wi-Fi should go to sleep (which will in
975 * turn switch to using the mobile data as an Internet connection).
976 * <p>
977 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
978 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
979 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800980 */
981 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
982
983 /**
984 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
985 * policy, which is to sleep shortly after the turning off
986 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800987 */
988 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
989
990 /**
991 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
992 * the device is on battery, and never go to sleep when the device is
993 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800994 */
995 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700996
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800997 /**
998 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800999 */
1000 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001001
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001002 /**
1003 * Whether to use static IP and other static network attributes.
1004 * <p>
1005 * Set to 1 for true and 0 for false.
1006 */
1007 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1008
1009 /**
1010 * The static IP address.
1011 * <p>
1012 * Example: "192.168.1.51"
1013 */
1014 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1015
1016 /**
1017 * If using static IP, the gateway's IP address.
1018 * <p>
1019 * Example: "192.168.1.1"
1020 */
1021 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1022
1023 /**
1024 * If using static IP, the net mask.
1025 * <p>
1026 * Example: "255.255.255.0"
1027 */
1028 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1029
1030 /**
1031 * If using static IP, the primary DNS's IP address.
1032 * <p>
1033 * Example: "192.168.1.1"
1034 */
1035 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1036
1037 /**
1038 * If using static IP, the secondary DNS's IP address.
1039 * <p>
1040 * Example: "192.168.1.2"
1041 */
1042 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1043
1044 /**
1045 * The number of radio channels that are allowed in the local
1046 * 802.11 regulatory domain.
1047 * @hide
1048 */
1049 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1050
1051 /**
1052 * Determines whether remote devices may discover and/or connect to
1053 * this device.
1054 * <P>Type: INT</P>
1055 * 2 -- discoverable and connectable
1056 * 1 -- connectable but not discoverable
1057 * 0 -- neither connectable nor discoverable
1058 */
1059 public static final String BLUETOOTH_DISCOVERABILITY =
1060 "bluetooth_discoverability";
1061
1062 /**
1063 * Bluetooth discoverability timeout. If this value is nonzero, then
1064 * Bluetooth becomes discoverable for a certain number of seconds,
1065 * after which is becomes simply connectable. The value is in seconds.
1066 */
1067 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1068 "bluetooth_discoverability_timeout";
1069
1070 /**
1071 * Whether autolock is enabled (0 = false, 1 = true)
1072 */
1073 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
1074
1075 /**
1076 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
1077 */
1078 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1079
1080 /**
1081 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
1082 */
1083 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1084 "lock_pattern_tactile_feedback_enabled";
1085
1086
1087 /**
1088 * A formatted string of the next alarm that is set, or the empty string
1089 * if there is no alarm set.
1090 */
1091 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1092
1093 /**
1094 * Scaling factor for fonts, float.
1095 */
1096 public static final String FONT_SCALE = "font_scale";
1097
1098 /**
1099 * Name of an application package to be debugged.
1100 */
1101 public static final String DEBUG_APP = "debug_app";
1102
1103 /**
1104 * If 1, when launching DEBUG_APP it will wait for the debugger before
1105 * starting user code. If 0, it will run normally.
1106 */
1107 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1108
1109 /**
1110 * Whether or not to dim the screen. 0=no 1=yes
1111 */
1112 public static final String DIM_SCREEN = "dim_screen";
1113
1114 /**
1115 * The timeout before the screen turns off.
1116 */
1117 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1118
1119 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001120 * If 0, the compatibility mode is off for all applications.
1121 * If 1, older applications run under compatibility mode.
1122 * TODO: remove this settings before code freeze (bug/1907571)
1123 * @hide
1124 */
1125 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1126
1127 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001128 * The screen backlight brightness between 0 and 255.
1129 */
1130 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1131
1132 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001133 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05001134 */
1135 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1136
1137 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001138 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001139 */
1140 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1141
1142 /**
1143 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001144 */
1145 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1146
1147 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001148 * Control whether the process CPU usage meter should be shown.
1149 */
1150 public static final String SHOW_PROCESSES = "show_processes";
1151
1152 /**
1153 * If 1, the activity manager will aggressively finish activities and
1154 * processes as soon as they are no longer needed. If 0, the normal
1155 * extended lifetime is used.
1156 */
1157 public static final String ALWAYS_FINISH_ACTIVITIES =
1158 "always_finish_activities";
1159
1160
1161 /**
1162 * Ringer mode. This is used internally, changing this value will not
1163 * change the ringer mode. See AudioManager.
1164 */
1165 public static final String MODE_RINGER = "mode_ringer";
1166
1167 /**
1168 * Determines which streams are affected by ringer mode changes. The
1169 * stream type's bit should be set to 1 if it should be muted when going
1170 * into an inaudible ringer mode.
1171 */
1172 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1173
1174 /**
1175 * Determines which streams are affected by mute. The
1176 * stream type's bit should be set to 1 if it should be muted when a mute request
1177 * is received.
1178 */
1179 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1180
1181 /**
1182 * Whether vibrate is on for different events. This is used internally,
1183 * changing this value will not change the vibrate. See AudioManager.
1184 */
1185 public static final String VIBRATE_ON = "vibrate_on";
1186
1187 /**
1188 * Ringer volume. This is used internally, changing this value will not
1189 * change the volume. See AudioManager.
1190 */
1191 public static final String VOLUME_RING = "volume_ring";
1192
1193 /**
1194 * System/notifications volume. This is used internally, changing this
1195 * value will not change the volume. See AudioManager.
1196 */
1197 public static final String VOLUME_SYSTEM = "volume_system";
1198
1199 /**
1200 * Voice call volume. This is used internally, changing this value will
1201 * not change the volume. See AudioManager.
1202 */
1203 public static final String VOLUME_VOICE = "volume_voice";
1204
1205 /**
1206 * Music/media/gaming volume. This is used internally, changing this
1207 * value will not change the volume. See AudioManager.
1208 */
1209 public static final String VOLUME_MUSIC = "volume_music";
1210
1211 /**
1212 * Alarm volume. This is used internally, changing this
1213 * value will not change the volume. See AudioManager.
1214 */
1215 public static final String VOLUME_ALARM = "volume_alarm";
1216
1217 /**
1218 * Notification volume. This is used internally, changing this
1219 * value will not change the volume. See AudioManager.
1220 */
1221 public static final String VOLUME_NOTIFICATION = "volume_notification";
1222
1223 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001224 * Bluetooth Headset volume. This is used internally, changing this value will
1225 * not change the volume. See AudioManager.
1226 */
1227 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1228
1229 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001230 * Whether the notifications should use the ring volume (value of 1) or
1231 * a separate notification volume (value of 0). In most cases, users
1232 * will have this enabled so the notification and ringer volumes will be
1233 * the same. However, power users can disable this and use the separate
1234 * notification volume control.
1235 * <p>
1236 * Note: This is a one-off setting that will be removed in the future
1237 * when there is profile support. For this reason, it is kept hidden
1238 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001239 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 * @hide
1241 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001242 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001245 /**
1246 * The mapping of stream type (integer) to its setting.
1247 */
1248 public static final String[] VOLUME_SETTINGS = {
1249 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001250 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001251 };
1252
1253 /**
1254 * Appended to various volume related settings to record the previous
1255 * values before they the settings were affected by a silent/vibrate
1256 * ringer mode change.
1257 */
1258 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1259
1260 /**
1261 * Persistent store for the system-wide default ringtone URI.
1262 * <p>
1263 * If you need to play the default ringtone at any given time, it is recommended
1264 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1265 * to the set default ringtone at the time of playing.
1266 *
1267 * @see #DEFAULT_RINGTONE_URI
1268 */
1269 public static final String RINGTONE = "ringtone";
1270
1271 /**
1272 * A {@link Uri} that will point to the current default ringtone at any
1273 * given time.
1274 * <p>
1275 * If the current default ringtone is in the DRM provider and the caller
1276 * does not have permission, the exception will be a
1277 * FileNotFoundException.
1278 */
1279 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1280
1281 /**
1282 * Persistent store for the system-wide default notification sound.
1283 *
1284 * @see #RINGTONE
1285 * @see #DEFAULT_NOTIFICATION_URI
1286 */
1287 public static final String NOTIFICATION_SOUND = "notification_sound";
1288
1289 /**
1290 * A {@link Uri} that will point to the current default notification
1291 * sound at any given time.
1292 *
1293 * @see #DEFAULT_RINGTONE_URI
1294 */
1295 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1296
1297 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001298 * Persistent store for the system-wide default alarm alert.
1299 *
1300 * @see #RINGTONE
1301 * @see #DEFAULT_ALARM_ALERT_URI
1302 */
1303 public static final String ALARM_ALERT = "alarm_alert";
1304
1305 /**
1306 * A {@link Uri} that will point to the current default alarm alert at
1307 * any given time.
1308 *
1309 * @see #DEFAULT_ALARM_ALERT_URI
1310 */
1311 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1312
1313 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1315 */
1316 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1317
1318 /**
1319 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1320 */
1321 public static final String TEXT_AUTO_CAPS = "auto_caps";
1322
1323 /**
1324 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1325 * feature converts two spaces to a "." and space.
1326 */
1327 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001329 /**
1330 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1331 */
1332 public static final String TEXT_SHOW_PASSWORD = "show_password";
1333
1334 public static final String SHOW_GTALK_SERVICE_STATUS =
1335 "SHOW_GTALK_SERVICE_STATUS";
1336
1337 /**
1338 * Name of activity to use for wallpaper on the home screen.
1339 */
1340 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1341
1342 /**
1343 * Value to specify if the user prefers the date, time and time zone
1344 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1345 */
1346 public static final String AUTO_TIME = "auto_time";
1347
1348 /**
1349 * Display times as 12 or 24 hours
1350 * 12
1351 * 24
1352 */
1353 public static final String TIME_12_24 = "time_12_24";
1354
1355 /**
1356 * Date format string
1357 * mm/dd/yyyy
1358 * dd/mm/yyyy
1359 * yyyy/mm/dd
1360 */
1361 public static final String DATE_FORMAT = "date_format";
1362
1363 /**
1364 * Whether the setup wizard has been run before (on first boot), or if
1365 * it still needs to be run.
1366 *
1367 * nonzero = it has been run in the past
1368 * 0 = it has not been run in the past
1369 */
1370 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1371
1372 /**
1373 * Scaling factor for normal window animations. Setting to 0 will disable window
1374 * animations.
1375 */
1376 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1377
1378 /**
1379 * Scaling factor for activity transition animations. Setting to 0 will disable window
1380 * animations.
1381 */
1382 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1383
1384 /**
1385 * Scaling factor for normal window animations. Setting to 0 will disable window
1386 * animations.
1387 * @hide
1388 */
1389 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1390
1391 /**
1392 * Control whether the accelerometer will be used to change screen
1393 * orientation. If 0, it will not be used unless explicitly requested
1394 * by the application; if 1, it will be used by default unless explicitly
1395 * disabled by the application.
1396 */
1397 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1398
1399 /**
1400 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1401 * boolean (1 or 0).
1402 */
1403 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1404
1405 /**
David Kraused0f67152009-06-13 18:01:13 -05001406 * CDMA only settings
1407 * DTMF tone type played by the dialer when dialing.
1408 * 0 = Normal
1409 * 1 = Long
1410 * @hide
1411 */
1412 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1413
1414 /**
1415 * CDMA only settings
1416 * Emergency Tone 0 = Off
1417 * 1 = Alert
1418 * 2 = Vibrate
1419 * @hide
1420 */
1421 public static final String EMERGENCY_TONE = "emergency_tone";
1422
1423 /**
1424 * CDMA only settings
1425 * Whether the auto retry is enabled. The value is
1426 * boolean (1 or 0).
1427 * @hide
1428 */
1429 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1430
1431 /**
1432 * Whether the hearing aid is enabled. The value is
1433 * boolean (1 or 0).
1434 * @hide
1435 */
1436 public static final String HEARING_AID = "hearing_aid";
1437
1438 /**
1439 * CDMA only settings
1440 * TTY Mode
1441 * 0 = OFF
1442 * 1 = FULL
1443 * 2 = VCO
1444 * 3 = HCO
1445 * @hide
1446 */
1447 public static final String TTY_MODE = "tty_mode";
1448
1449 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001450 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1451 * boolean (1 or 0).
1452 */
1453 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001454
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001455 /**
1456 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1457 * boolean (1 or 0).
1458 */
1459 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001460
Mike LeBeau48603e72009-06-05 00:27:00 +01001461 /**
1462 * Whether live web suggestions while the user types into search dialogs are
1463 * enabled. Browsers and other search UIs should respect this, as it allows
1464 * a user to avoid sending partial queries to a search engine, if it poses
1465 * any privacy concern. The value is boolean (1 or 0).
1466 */
1467 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001468
-b master501eec92009-07-06 13:53:11 -07001469 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001470 * Whether the notification LED should repeatedly flash when a notification is
1471 * pending. The value is boolean (1 or 0).
1472 * @hide
1473 */
1474 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1475
1476 /**
Suchi Amalapurapu117818e2010-02-09 03:45:40 -08001477 * Let user pick default install location.
1478 * @hide
1479 */
1480 public static final String SET_INSTALL_LOCATION = "set_install_location";
1481
1482 /**
1483 * Default install location value.
1484 * 0 = auto, let system decide
1485 * 1 = internal
1486 * 2 = sdcard
1487 * @hide
1488 */
1489 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
1490
1491 /**
Dianne Hackborn90d2db32010-02-11 22:19:06 -08001492 * Show pointer location on screen?
1493 * 0 = no
1494 * 1 = yes
1495 * @hide
1496 */
1497 public static final String POINTER_LOCATION = "pointer_location";
1498
1499 /**
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05001500 * Whether to play a sound for low-battery alerts.
1501 * @hide
1502 */
1503 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1504
1505 /**
1506 * Whether to play a sound for dock events.
1507 * @hide
1508 */
1509 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1510
1511 /**
1512 * Whether to play sounds when the keyguard is shown and dismissed.
1513 * @hide
1514 */
1515 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1516
1517 /**
1518 * URI for the low battery sound file.
1519 * @hide
1520 */
1521 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1522
1523 /**
1524 * URI for the desk dock "in" event sound.
1525 * @hide
1526 */
1527 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1528
1529 /**
1530 * URI for the desk dock "out" event sound.
1531 * @hide
1532 */
1533 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1534
1535 /**
1536 * URI for the car dock "in" event sound.
1537 * @hide
1538 */
1539 public static final String CAR_DOCK_SOUND = "car_dock_sound";
1540
1541 /**
1542 * URI for the car dock "out" event sound.
1543 * @hide
1544 */
1545 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1546
1547 /**
1548 * URI for the "device locked" (keyguard shown) sound.
1549 * @hide
1550 */
1551 public static final String LOCK_SOUND = "lock_sound";
1552
1553 /**
1554 * URI for the "device unlocked" (keyguard dismissed) sound.
1555 * @hide
1556 */
1557 public static final String UNLOCK_SOUND = "unlock_sound";
1558
1559 /**
-b master501eec92009-07-06 13:53:11 -07001560 * Settings to backup. This is here so that it's in the same place as the settings
1561 * keys and easy to update.
1562 * @hide
1563 */
1564 public static final String[] SETTINGS_TO_BACKUP = {
1565 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001566 WIFI_SLEEP_POLICY,
1567 WIFI_USE_STATIC_IP,
1568 WIFI_STATIC_IP,
1569 WIFI_STATIC_GATEWAY,
1570 WIFI_STATIC_NETMASK,
1571 WIFI_STATIC_DNS1,
1572 WIFI_STATIC_DNS2,
1573 BLUETOOTH_DISCOVERABILITY,
1574 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1575 DIM_SCREEN,
1576 SCREEN_OFF_TIMEOUT,
1577 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001578 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001579 VIBRATE_ON,
1580 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001581 MODE_RINGER,
1582 MODE_RINGER_STREAMS_AFFECTED,
1583 MUTE_STREAMS_AFFECTED,
1584 VOLUME_VOICE,
1585 VOLUME_SYSTEM,
1586 VOLUME_RING,
1587 VOLUME_MUSIC,
1588 VOLUME_ALARM,
1589 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001590 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001591 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1592 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1593 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1594 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1595 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1596 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001597 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
-b master501eec92009-07-06 13:53:11 -07001598 TEXT_AUTO_REPLACE,
1599 TEXT_AUTO_CAPS,
1600 TEXT_AUTO_PUNCTUATE,
1601 TEXT_SHOW_PASSWORD,
1602 AUTO_TIME,
1603 TIME_12_24,
1604 DATE_FORMAT,
1605 ACCELEROMETER_ROTATION,
1606 DTMF_TONE_WHEN_DIALING,
1607 DTMF_TONE_TYPE_WHEN_DIALING,
1608 EMERGENCY_TONE,
1609 CALL_AUTO_RETRY,
1610 HEARING_AID,
1611 TTY_MODE,
1612 SOUND_EFFECTS_ENABLED,
1613 HAPTIC_FEEDBACK_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001614 SHOW_WEB_SUGGESTIONS,
1615 NOTIFICATION_LIGHT_PULSE
-b master501eec92009-07-06 13:53:11 -07001616 };
1617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 // Settings moved to Settings.Secure
1619
1620 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001621 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001622 * instead
1623 */
1624 @Deprecated
1625 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1626
1627 /**
1628 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1629 */
1630 @Deprecated
1631 public static final String ANDROID_ID = Secure.ANDROID_ID;
1632
1633 /**
1634 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1635 */
1636 @Deprecated
1637 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1638
1639 /**
1640 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1641 */
1642 @Deprecated
1643 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1644
1645 /**
1646 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1647 */
1648 @Deprecated
1649 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1650
1651 /**
1652 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1653 */
1654 @Deprecated
1655 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1656
1657 /**
1658 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1659 */
1660 @Deprecated
1661 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001662
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001663 /**
1664 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1665 * instead
1666 */
1667 @Deprecated
1668 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1669
1670 /**
1671 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1672 */
1673 @Deprecated
1674 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001676 /**
1677 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1678 */
1679 @Deprecated
1680 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1681
1682 /**
1683 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1684 * instead
1685 */
1686 @Deprecated
1687 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1688
1689 /**
1690 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1691 * instead
1692 */
1693 @Deprecated
1694 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1695
1696 /**
1697 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1698 * instead
1699 */
1700 @Deprecated
1701 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1702 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1703
1704 /**
1705 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1706 */
1707 @Deprecated
1708 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1709
1710 /**
1711 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1712 */
1713 @Deprecated
1714 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001715
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001716 /**
1717 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1718 */
1719 @Deprecated
1720 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1721
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001722 /**
1723 * @deprecated Use
1724 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1725 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001726 @Deprecated
1727 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1728
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001729 /**
1730 * @deprecated Use
1731 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1732 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001733 @Deprecated
1734 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1735 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1736
1737 /**
1738 * @deprecated Use
1739 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1740 */
1741 @Deprecated
1742 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1743 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1744
1745 /**
1746 * @deprecated Use
1747 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1748 */
1749 @Deprecated
1750 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1751 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001752
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001753 /**
1754 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1755 * instead
1756 */
1757 @Deprecated
1758 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1759
1760 /**
1761 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1762 */
1763 @Deprecated
1764 public static final String WIFI_ON = Secure.WIFI_ON;
1765
1766 /**
1767 * @deprecated Use
1768 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1769 * instead
1770 */
1771 @Deprecated
1772 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1773 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1774
1775 /**
1776 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1777 */
1778 @Deprecated
1779 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1780
1781 /**
1782 * @deprecated Use
1783 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1784 */
1785 @Deprecated
1786 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1787 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001788
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001789 /**
1790 * @deprecated Use
1791 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1792 */
1793 @Deprecated
1794 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1795 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1796
1797 /**
1798 * @deprecated Use
1799 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1800 * instead
1801 */
1802 @Deprecated
1803 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1804 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1805
1806 /**
1807 * @deprecated Use
1808 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1809 */
1810 @Deprecated
1811 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1812 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1813
1814 /**
1815 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1816 * instead
1817 */
1818 @Deprecated
1819 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1820
1821 /**
1822 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1823 */
1824 @Deprecated
1825 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1826
1827 /**
1828 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1829 */
1830 @Deprecated
1831 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1832
1833 /**
1834 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1835 * instead
1836 */
1837 @Deprecated
1838 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1839
1840 /**
1841 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1842 * instead
1843 */
1844 @Deprecated
1845 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1846 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1847 }
1848
1849 /**
1850 * Secure system settings, containing system preferences that applications
1851 * can read but are not allowed to write. These are for preferences that
1852 * the user must explicitly modify through the system UI or specialized
1853 * APIs for those values, not modified directly by applications.
1854 */
1855 public static final class Secure extends NameValueTable {
1856 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1857
1858 private static volatile NameValueCache mNameValueCache = null;
1859
1860 /**
1861 * Look up a name in the database.
1862 * @param resolver to access the database with
1863 * @param name to look up in the table
1864 * @return the corresponding value, or null if not present
1865 */
1866 public synchronized static String getString(ContentResolver resolver, String name) {
1867 if (mNameValueCache == null) {
1868 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
1869 }
1870 return mNameValueCache.getString(resolver, name);
1871 }
1872
1873 /**
1874 * Store a name/value pair into the database.
1875 * @param resolver to access the database with
1876 * @param name to store
1877 * @param value to associate with the name
1878 * @return true if the value was set, false on database errors
1879 */
1880 public static boolean putString(ContentResolver resolver,
1881 String name, String value) {
1882 return putString(resolver, CONTENT_URI, name, value);
1883 }
1884
1885 /**
1886 * Construct the content URI for a particular name/value pair,
1887 * useful for monitoring changes with a ContentObserver.
1888 * @param name to look up in the table
1889 * @return the corresponding content URI, or null if not present
1890 */
1891 public static Uri getUriFor(String name) {
1892 return getUriFor(CONTENT_URI, name);
1893 }
1894
1895 /**
1896 * Convenience function for retrieving a single secure settings value
1897 * as an integer. Note that internally setting values are always
1898 * stored as strings; this function converts the string to an integer
1899 * for you. The default value will be returned if the setting is
1900 * not defined or not an integer.
1901 *
1902 * @param cr The ContentResolver to access.
1903 * @param name The name of the setting to retrieve.
1904 * @param def Value to return if the setting is not defined.
1905 *
1906 * @return The setting's current value, or 'def' if it is not defined
1907 * or not a valid integer.
1908 */
1909 public static int getInt(ContentResolver cr, String name, int def) {
1910 String v = getString(cr, name);
1911 try {
1912 return v != null ? Integer.parseInt(v) : def;
1913 } catch (NumberFormatException e) {
1914 return def;
1915 }
1916 }
1917
1918 /**
1919 * Convenience function for retrieving a single secure settings value
1920 * as an integer. Note that internally setting values are always
1921 * stored as strings; this function converts the string to an integer
1922 * for you.
1923 * <p>
1924 * This version does not take a default value. If the setting has not
1925 * been set, or the string value is not a number,
1926 * it throws {@link SettingNotFoundException}.
1927 *
1928 * @param cr The ContentResolver to access.
1929 * @param name The name of the setting to retrieve.
1930 *
1931 * @throws SettingNotFoundException Thrown if a setting by the given
1932 * name can't be found or the setting value is not an integer.
1933 *
1934 * @return The setting's current value.
1935 */
1936 public static int getInt(ContentResolver cr, String name)
1937 throws SettingNotFoundException {
1938 String v = getString(cr, name);
1939 try {
1940 return Integer.parseInt(v);
1941 } catch (NumberFormatException e) {
1942 throw new SettingNotFoundException(name);
1943 }
1944 }
1945
1946 /**
1947 * Convenience function for updating a single settings value as an
1948 * integer. This will either create a new entry in the table if the
1949 * given name does not exist, or modify the value of the existing row
1950 * with that name. Note that internally setting values are always
1951 * stored as strings, so this function converts the given value to a
1952 * string before storing it.
1953 *
1954 * @param cr The ContentResolver to access.
1955 * @param name The name of the setting to modify.
1956 * @param value The new value for the setting.
1957 * @return true if the value was set, false on database errors
1958 */
1959 public static boolean putInt(ContentResolver cr, String name, int value) {
1960 return putString(cr, name, Integer.toString(value));
1961 }
1962
1963 /**
1964 * Convenience function for retrieving a single secure settings value
1965 * as a {@code long}. Note that internally setting values are always
1966 * stored as strings; this function converts the string to a {@code long}
1967 * for you. The default value will be returned if the setting is
1968 * not defined or not a {@code long}.
1969 *
1970 * @param cr The ContentResolver to access.
1971 * @param name The name of the setting to retrieve.
1972 * @param def Value to return if the setting is not defined.
1973 *
1974 * @return The setting's current value, or 'def' if it is not defined
1975 * or not a valid {@code long}.
1976 */
1977 public static long getLong(ContentResolver cr, String name, long def) {
1978 String valString = getString(cr, name);
1979 long value;
1980 try {
1981 value = valString != null ? Long.parseLong(valString) : def;
1982 } catch (NumberFormatException e) {
1983 value = def;
1984 }
1985 return value;
1986 }
1987
1988 /**
1989 * Convenience function for retrieving a single secure settings value
1990 * as a {@code long}. Note that internally setting values are always
1991 * stored as strings; this function converts the string to a {@code long}
1992 * for you.
1993 * <p>
1994 * This version does not take a default value. If the setting has not
1995 * been set, or the string value is not a number,
1996 * it throws {@link SettingNotFoundException}.
1997 *
1998 * @param cr The ContentResolver to access.
1999 * @param name The name of the setting to retrieve.
2000 *
2001 * @return The setting's current value.
2002 * @throws SettingNotFoundException Thrown if a setting by the given
2003 * name can't be found or the setting value is not an integer.
2004 */
2005 public static long getLong(ContentResolver cr, String name)
2006 throws SettingNotFoundException {
2007 String valString = getString(cr, name);
2008 try {
2009 return Long.parseLong(valString);
2010 } catch (NumberFormatException e) {
2011 throw new SettingNotFoundException(name);
2012 }
2013 }
2014
2015 /**
2016 * Convenience function for updating a secure settings value as a long
2017 * integer. This will either create a new entry in the table if the
2018 * given name does not exist, or modify the value of the existing row
2019 * with that name. Note that internally setting values are always
2020 * stored as strings, so this function converts the given value to a
2021 * string before storing it.
2022 *
2023 * @param cr The ContentResolver to access.
2024 * @param name The name of the setting to modify.
2025 * @param value The new value for the setting.
2026 * @return true if the value was set, false on database errors
2027 */
2028 public static boolean putLong(ContentResolver cr, String name, long value) {
2029 return putString(cr, name, Long.toString(value));
2030 }
2031
2032 /**
2033 * Convenience function for retrieving a single secure settings value
2034 * as a floating point number. Note that internally setting values are
2035 * always stored as strings; this function converts the string to an
2036 * float for you. The default value will be returned if the setting
2037 * is not defined or not a valid float.
2038 *
2039 * @param cr The ContentResolver to access.
2040 * @param name The name of the setting to retrieve.
2041 * @param def Value to return if the setting is not defined.
2042 *
2043 * @return The setting's current value, or 'def' if it is not defined
2044 * or not a valid float.
2045 */
2046 public static float getFloat(ContentResolver cr, String name, float def) {
2047 String v = getString(cr, name);
2048 try {
2049 return v != null ? Float.parseFloat(v) : def;
2050 } catch (NumberFormatException e) {
2051 return def;
2052 }
2053 }
2054
2055 /**
2056 * Convenience function for retrieving a single secure settings value
2057 * as a float. Note that internally setting values are always
2058 * stored as strings; this function converts the string to a float
2059 * for you.
2060 * <p>
2061 * This version does not take a default value. If the setting has not
2062 * been set, or the string value is not a number,
2063 * it throws {@link SettingNotFoundException}.
2064 *
2065 * @param cr The ContentResolver to access.
2066 * @param name The name of the setting to retrieve.
2067 *
2068 * @throws SettingNotFoundException Thrown if a setting by the given
2069 * name can't be found or the setting value is not a float.
2070 *
2071 * @return The setting's current value.
2072 */
2073 public static float getFloat(ContentResolver cr, String name)
2074 throws SettingNotFoundException {
2075 String v = getString(cr, name);
2076 try {
2077 return Float.parseFloat(v);
2078 } catch (NumberFormatException e) {
2079 throw new SettingNotFoundException(name);
2080 }
2081 }
2082
2083 /**
2084 * Convenience function for updating a single settings value as a
2085 * floating point number. This will either create a new entry in the
2086 * table if the given name does not exist, or modify the value of the
2087 * existing row with that name. Note that internally setting values
2088 * are always stored as strings, so this function converts the given
2089 * value to a string before storing it.
2090 *
2091 * @param cr The ContentResolver to access.
2092 * @param name The name of the setting to modify.
2093 * @param value The new value for the setting.
2094 * @return true if the value was set, false on database errors
2095 */
2096 public static boolean putFloat(ContentResolver cr, String name, float value) {
2097 return putString(cr, name, Float.toString(value));
2098 }
2099
2100 /**
2101 * The content:// style URL for this table
2102 */
2103 public static final Uri CONTENT_URI =
2104 Uri.parse("content://" + AUTHORITY + "/secure");
2105
2106 /**
2107 * Whether ADB is enabled.
2108 */
2109 public static final String ADB_ENABLED = "adb_enabled";
2110
2111 /**
2112 * Setting to allow mock locations and location provider status to be injected into the
2113 * LocationManager service for testing purposes during application development. These
2114 * locations and status values override actual location and status information generated
2115 * by network, gps, or other location providers.
2116 */
2117 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2118
2119 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08002120 * A 64-bit number (as a hex string) that is randomly
2121 * generated on the device's first boot and should remain
2122 * constant for the lifetime of the device. (The value may
2123 * change if a factory reset is performed on the device.)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002124 */
2125 public static final String ANDROID_ID = "android_id";
2126
2127 /**
2128 * Whether bluetooth is enabled/disabled
2129 * 0=disabled. 1=enabled.
2130 */
2131 public static final String BLUETOOTH_ON = "bluetooth_on";
2132
2133 /**
2134 * Get the key that retrieves a bluetooth headset's priority.
2135 * @hide
2136 */
2137 public static final String getBluetoothHeadsetPriorityKey(String address) {
2138 return ("bluetooth_headset_priority_" + address.toUpperCase());
2139 }
2140
2141 /**
2142 * Get the key that retrieves a bluetooth a2dp sink's priority.
2143 * @hide
2144 */
2145 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2146 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2147 }
2148
2149 /**
2150 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2151 */
2152 public static final String DATA_ROAMING = "data_roaming";
2153
2154 /**
2155 * Setting to record the input method used by default, holding the ID
2156 * of the desired method.
2157 */
2158 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2159
2160 /**
2161 * Whether the device has been provisioned (0 = false, 1 = true)
2162 */
2163 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002164
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002165 /**
2166 * List of input methods that are currently enabled. This is a string
2167 * containing the IDs of all enabled input methods, each ID separated
2168 * by ':'.
2169 */
2170 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002171
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002172 /**
2173 * Host name and port for a user-selected proxy.
2174 */
2175 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002176
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002177 /**
2178 * Whether the package installer should allow installation of apps downloaded from
2179 * sources other than the Android Market (vending machine).
2180 *
2181 * 1 = allow installing from other sources
2182 * 0 = only allow installing from the Android Market
2183 */
2184 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002185
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002186 /**
2187 * Comma-separated list of location providers that activities may access.
2188 */
2189 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002190
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002191 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002192 * Whether assisted GPS should be enabled or not.
2193 * @hide
2194 */
2195 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2196
2197 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002198 * The Logging ID (a unique 64-bit value) as a hex string.
2199 * Used as a pseudonymous identifier for logging.
2200 * @deprecated This identifier is poorly initialized and has
2201 * many collisions. It should not be used.
2202 */
2203 @Deprecated
2204 public static final String LOGGING_ID = "logging_id";
2205
2206 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002207 * User preference for which network(s) should be used. Only the
2208 * connectivity service should touch this.
2209 */
2210 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002211
2212 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002213 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002214 */
2215 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002216
2217 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002218 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002219 */
2220 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002221
2222 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002223 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002224 */
2225 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002227 /**
2228 * Settings classname to launch when Settings is clicked from All
2229 * Applications. Needed because of user testing between the old
2230 * and new Settings apps.
2231 */
2232 // TODO: 881807
2233 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002234
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002235 /**
2236 * USB Mass Storage Enabled
2237 */
2238 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002240 /**
2241 * If this setting is set (to anything), then all references
2242 * to Gmail on the device must change to Google Mail.
2243 */
2244 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002245
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002246 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002247 * If accessibility is enabled.
2248 */
2249 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2250
2251 /**
2252 * List of the enabled accessibility providers.
2253 */
2254 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2255 "enabled_accessibility_services";
2256
2257 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002258 * Setting to always use the default text-to-speech settings regardless
2259 * of the application settings.
2260 * 1 = override application settings,
2261 * 0 = use application settings (if specified).
2262 */
2263 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2264
2265 /**
2266 * Default text-to-speech engine speech rate. 100 = 1x
2267 */
2268 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2269
2270 /**
2271 * Default text-to-speech engine pitch. 100 = 1x
2272 */
2273 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2274
2275 /**
2276 * Default text-to-speech engine.
2277 */
2278 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2279
2280 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002281 * Default text-to-speech language.
2282 */
2283 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2284
2285 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002286 * Default text-to-speech country.
2287 */
2288 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2289
2290 /**
2291 * Default text-to-speech locale variant.
2292 */
2293 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2294
2295 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002296 * Whether to notify the user of open networks.
2297 * <p>
2298 * If not connected and the scan results have an open network, we will
2299 * put this notification up. If we attempt to connect to a network or
2300 * the open network(s) disappear, we remove the notification. When we
2301 * show the notification, we will not show it again for
2302 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2303 */
2304 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2305 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 /**
2308 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2309 * Connecting to a network will reset the timer.
2310 */
2311 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2312 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002313
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002314 /**
2315 * The number of radio channels that are allowed in the local
2316 * 802.11 regulatory domain.
2317 * @hide
2318 */
2319 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002321 /**
2322 * When the number of open networks exceeds this number, the
2323 * least-recently-used excess networks will be removed.
2324 */
2325 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002327 /**
2328 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2329 */
2330 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002331
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 /**
2333 * The acceptable packet loss percentage (range 0 - 100) before trying
2334 * another AP on the same network.
2335 */
2336 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2337 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002338
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002339 /**
2340 * The number of access points required for a network in order for the
2341 * watchdog to monitor it.
2342 */
2343 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 /**
2346 * The delay between background checks.
2347 */
2348 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2349 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002351 /**
2352 * Whether the Wi-Fi watchdog is enabled for background checking even
2353 * after it thinks the user has connected to a good access point.
2354 */
2355 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2356 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002358 /**
2359 * The timeout for a background ping
2360 */
2361 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2362 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002364 /**
2365 * The number of initial pings to perform that *may* be ignored if they
2366 * fail. Again, if these fail, they will *not* be used in packet loss
2367 * calculation. For example, one network always seemed to time out for
2368 * the first couple pings, so this is set to 3 by default.
2369 */
2370 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2371 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002372
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002373 /**
2374 * The maximum number of access points (per network) to attempt to test.
2375 * If this number is reached, the watchdog will no longer monitor the
2376 * initial connection state for the network. This is a safeguard for
2377 * networks containing multiple APs whose DNS does not respond to pings.
2378 */
2379 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002380
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002381 /**
2382 * Whether the Wi-Fi watchdog is enabled.
2383 */
2384 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2385
2386 /**
2387 * 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 -08002388 */
2389 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2390
2391 /**
2392 * The number of pings to test if an access point is a good connection.
2393 */
2394 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002395
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002396 /**
2397 * The delay between pings.
2398 */
2399 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002400
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002401 /**
2402 * The timeout per ping.
2403 */
2404 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002406 /**
2407 * The maximum number of times we will retry a connection to an access
2408 * point for which we have failed in acquiring an IP address from DHCP.
2409 * 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 -08002410 */
2411 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002412
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002413 /**
2414 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2415 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 */
2417 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2418 "wifi_mobile_data_transition_wakelock_timeout_ms";
2419
2420 /**
2421 * Whether background data usage is allowed by the user. See
2422 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002423 */
2424 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002425
2426 /**
2427 * The CDMA roaming mode 0 = Home Networks, CDMA default
2428 * 1 = Roaming on Affiliated networks
2429 * 2 = Roaming on any networks
2430 * @hide
2431 */
2432 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2433
2434 /**
2435 * The CDMA subscription mode 0 = RUIM/SIM (default)
2436 * 1 = NV
2437 * @hide
2438 */
2439 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2440
2441 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002442 * The preferred network mode 7 = Global
2443 * 6 = EvDo only
2444 * 5 = CDMA w/o EvDo
2445 * 4 = CDMA / EvDo auto
2446 * 3 = GSM / WCDMA auto
2447 * 2 = WCDMA only
2448 * 1 = GSM only
2449 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002450 * @hide
2451 */
2452 public static final String PREFERRED_NETWORK_MODE =
2453 "preferred_network_mode";
2454
2455 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002456 * The preferred TTY mode 0 = TTy Off, CDMA default
2457 * 1 = TTY Full
2458 * 2 = TTY HCO
2459 * 3 = TTY VCO
2460 * @hide
2461 */
2462 public static final String PREFERRED_TTY_MODE =
2463 "preferred_tty_mode";
2464
2465
2466 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002467 * CDMA Cell Broadcast SMS
2468 * 0 = CDMA Cell Broadcast SMS disabled
2469 * 1 = CDMA Cell Broadcast SMS enabled
2470 * @hide
2471 */
2472 public static final String CDMA_CELL_BROADCAST_SMS =
2473 "cdma_cell_broadcast_sms";
2474
2475 /**
2476 * The cdma subscription 0 = Subscription from RUIM, when available
2477 * 1 = Subscription from NV
2478 * @hide
2479 */
2480 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2481 "preferred_cdma_subscription";
2482
2483 /**
2484 * Whether the enhanced voice privacy mode is enabled.
2485 * 0 = normal voice privacy
2486 * 1 = enhanced voice privacy
2487 * @hide
2488 */
2489 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2490
2491 /**
2492 * Whether the TTY mode mode is enabled.
2493 * 0 = disabled
2494 * 1 = enabled
2495 * @hide
2496 */
2497 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002498
2499 /**
Amith Yamasani630cd062009-06-19 12:07:02 -07002500 * Flag for allowing service provider to use location information to improve products and
2501 * services.
2502 * Type: int ( 0 = disallow, 1 = allow )
2503 * @hide
2504 */
2505 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
2506
2507 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002508 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002509 * Type: int ( 0 = disabled, 1 = enabled )
2510 * @hide
2511 */
2512 public static final String BACKUP_ENABLED = "backup_enabled";
2513
2514 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08002515 * Controls whether application data is automatically restored from backup
2516 * at install time.
2517 * Type: int ( 0 = disabled, 1 = enabled )
2518 * @hide
2519 */
2520 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2521
2522 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002523 * Indicates whether settings backup has been fully provisioned.
2524 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2525 * @hide
2526 */
2527 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2528
2529 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002530 * Component of the transport to use for backup/restore.
2531 * @hide
2532 */
2533 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002534
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002535 /**
2536 * Version for which the setup wizard was last shown. Bumped for
2537 * each release when there is new setup information to show.
2538 * @hide
2539 */
2540 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002541
2542 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08002543 * How frequently (in seconds) to check the memory status of the
2544 * device.
2545 * @hide
2546 */
2547 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2548
2549 /**
2550 * Max frequency (in seconds) to log memory check stats, in realtime
2551 * seconds. This allows for throttling of logs when the device is
2552 * running for large amounts of time.
2553 * @hide
2554 */
2555 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2556 "memcheck_log_realtime_interval";
2557
2558 /**
2559 * Boolean indicating whether rebooting due to system memory checks
2560 * is enabled.
2561 * @hide
2562 */
2563 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2564
2565 /**
2566 * How many bytes the system process must be below to avoid scheduling
2567 * a soft reboot. This reboot will happen when it is next determined
2568 * to be a good time.
2569 * @hide
2570 */
2571 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2572
2573 /**
2574 * How many bytes the system process must be below to avoid scheduling
2575 * a hard reboot. This reboot will happen immediately.
2576 * @hide
2577 */
2578 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2579
2580 /**
2581 * How many bytes the phone process must be below to avoid scheduling
2582 * a soft restart. This restart will happen when it is next determined
2583 * to be a good time.
2584 * @hide
2585 */
2586 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2587
2588 /**
2589 * How many bytes the phone process must be below to avoid scheduling
2590 * a hard restart. This restart will happen immediately.
2591 * @hide
2592 */
2593 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2594
2595 /**
2596 * Boolean indicating whether restarting the phone process due to
2597 * memory checks is enabled.
2598 * @hide
2599 */
2600 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2601
2602 /**
2603 * First time during the day it is okay to kill processes
2604 * or reboot the device due to low memory situations. This number is
2605 * in seconds since midnight.
2606 * @hide
2607 */
2608 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2609
2610 /**
2611 * Last time during the day it is okay to kill processes
2612 * or reboot the device due to low memory situations. This number is
2613 * in seconds since midnight.
2614 * @hide
2615 */
2616 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2617
2618 /**
2619 * How long the screen must have been off in order to kill processes
2620 * or reboot. This number is in seconds. A value of -1 means to
2621 * entirely disregard whether the screen is on.
2622 * @hide
2623 */
2624 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2625
2626 /**
2627 * How much time there must be until the next alarm in order to kill processes
2628 * or reboot. This number is in seconds. Note: this value must be
2629 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2630 * always see an alarm scheduled within its time.
2631 * @hide
2632 */
2633 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2634
2635 /**
2636 * How frequently to check whether it is a good time to restart things,
2637 * if the device is in a bad state. This number is in seconds. Note:
2638 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2639 * the alarm to schedule the recheck will always appear within the
2640 * minimum "do not execute now" time.
2641 * @hide
2642 */
2643 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2644
2645 /**
2646 * How frequently (in DAYS) to reboot the device. If 0, no reboots
2647 * will occur.
2648 * @hide
2649 */
2650 public static final String REBOOT_INTERVAL = "reboot_interval";
2651
2652 /**
2653 * First time during the day it is okay to force a reboot of the
2654 * device (if REBOOT_INTERVAL is set). This number is
2655 * in seconds since midnight.
2656 * @hide
2657 */
2658 public static final String REBOOT_START_TIME = "reboot_start_time";
2659
2660 /**
2661 * The window of time (in seconds) after each REBOOT_INTERVAL in which
2662 * a reboot can be executed. If 0, a reboot will always be executed at
2663 * exactly the given time. Otherwise, it will only be executed if
2664 * the device is idle within the window.
2665 * @hide
2666 */
2667 public static final String REBOOT_WINDOW = "reboot_window";
2668
2669 /**
Doug Zongker43866e02010-01-07 12:09:54 -08002670 * Threshold values for the duration and level of a discharge cycle, under
2671 * which we log discharge cycle info.
2672 * @hide
2673 */
2674 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
2675 "battery_discharge_duration_threshold";
2676 /** @hide */
2677 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
2678
2679 /**
2680 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
2681 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
2682 * will never display the "Report" button.
2683 * Type: int ( 0 = disallow, 1 = allow )
2684 * @hide
2685 */
2686 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
2687
2688 /**
2689 * Nonzero causes Log.wtf() to crash.
2690 * @hide
2691 */
2692 public static final String WTF_IS_FATAL = "wtf_is_fatal";
2693
2694 /**
2695 * Maximum age of entries kept by {@link android.os.IDropBox}.
2696 * @hide
2697 */
2698 public static final String DROPBOX_AGE_SECONDS =
2699 "dropbox_age_seconds";
2700 /**
2701 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
2702 * @hide
2703 */
2704 public static final String DROPBOX_QUOTA_KB =
2705 "dropbox_quota_kb";
2706 /**
2707 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
2708 * @hide
2709 */
2710 public static final String DROPBOX_QUOTA_PERCENT =
2711 "dropbox_quota_percent";
2712 /**
2713 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
2714 * @hide
2715 */
2716 public static final String DROPBOX_RESERVE_PERCENT =
2717 "dropbox_reserve_percent";
2718 /**
2719 * Prefix for per-tag dropbox disable/enable settings.
2720 * @hide
2721 */
2722 public static final String DROPBOX_TAG_PREFIX =
2723 "dropbox:";
2724
2725
2726 /**
2727 * Screen timeout in milliseconds corresponding to the
2728 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
2729 * possible screen timeout behavior.)
2730 * @hide
2731 */
2732 public static final String SHORT_KEYLIGHT_DELAY_MS =
2733 "short_keylight_delay_ms";
2734
2735 /**
2736 * The interval in minutes after which the amount of free storage left on the
2737 * device is logged to the event log
2738 * @hide
2739 */
2740 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
2741 "sys_free_storage_log_interval";
2742
2743 /**
2744 * Threshold for the amount of change in disk free space required to report the amount of
2745 * free space. Used to prevent spamming the logs when the disk free space isn't changing
2746 * frequently.
2747 * @hide
2748 */
2749 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
2750 "disk_free_change_reporting_threshold";
2751
2752
2753 /**
2754 * Minimum percentage of free storage on the device that is used to determine if
2755 * the device is running low on storage.
2756 * Say this value is set to 10, the device is considered running low on storage
2757 * if 90% or more of the device storage is filled up.
2758 * @hide
2759 */
2760 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
2761 "sys_storage_threshold_percentage";
2762
2763 /**
2764 * The interval in milliseconds after which Wi-Fi is considered idle.
2765 * When idle, it is possible for the device to be switched from Wi-Fi to
2766 * the mobile data network.
2767 * @hide
2768 */
2769 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
2770
2771 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08002772 * The interval in milliseconds at which to check packet counts on the
2773 * mobile data interface when screen is on, to detect possible data
2774 * connection problems.
2775 * @hide
2776 */
2777 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
2778 "pdp_watchdog_poll_interval_ms";
2779
2780 /**
2781 * The interval in milliseconds at which to check packet counts on the
2782 * mobile data interface when screen is off, to detect possible data
2783 * connection problems.
2784 * @hide
2785 */
2786 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
2787 "pdp_watchdog_long_poll_interval_ms";
2788
2789 /**
2790 * The interval in milliseconds at which to check packet counts on the
2791 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
2792 * outgoing packets has been reached without incoming packets.
2793 * @hide
2794 */
2795 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
2796 "pdp_watchdog_error_poll_interval_ms";
2797
2798 /**
2799 * The number of outgoing packets sent without seeing an incoming packet
2800 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
2801 * device is logged to the event log
2802 * @hide
2803 */
2804 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
2805 "pdp_watchdog_trigger_packet_count";
2806
2807 /**
2808 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
2809 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
2810 * attempting data connection recovery.
2811 * @hide
2812 */
2813 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
2814 "pdp_watchdog_error_poll_count";
2815
2816 /**
2817 * The number of failed PDP reset attempts before moving to something more
2818 * drastic: re-registering to the network.
2819 * @hide
2820 */
2821 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
2822 "pdp_watchdog_max_pdp_reset_fail_count";
2823
2824 /**
2825 * Address to ping as a last sanity check before attempting any recovery.
2826 * Unset or set to "0.0.0.0" to skip this check.
2827 * @hide
2828 */
2829 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
2830
2831 /**
2832 * The "-w deadline" parameter for the ping, ie, the max time in
2833 * seconds to spend pinging.
2834 * @hide
2835 */
2836 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
2837
2838 /**
2839 * The interval in milliseconds at which to check gprs registration
2840 * after the first registration mismatch of gprs and voice service,
2841 * to detect possible data network registration problems.
2842 *
2843 * @hide
2844 */
2845 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
2846 "gprs_register_check_period_ms";
2847
2848 /**
2849 * The length of time in milli-seconds that automatic small adjustments to
2850 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
2851 * @hide
2852 */
2853 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
2854
2855 /**
2856 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
2857 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
2858 * exceeded.
2859 * @hide
2860 */
2861 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
2862
2863 /**
2864 * The maximum reconnect delay for short network outages or when the network is suspended
2865 * due to phone use.
2866 * @hide
2867 */
2868 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
2869 "sync_max_retry_delay_in_seconds";
2870
2871 /**
2872 * The interval in milliseconds at which to check the number of SMS sent
2873 * out without asking for use permit, to limit the un-authorized SMS
2874 * usage.
2875 * @hide
2876 */
2877 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
2878 "sms_outgoing_check_interval_ms";
2879
2880 /**
2881 * The number of outgoing SMS sent without asking for user permit
2882 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
2883 * @hide
2884 */
2885 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
2886 "sms_outgoing_check_max_count";
2887
2888 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08002889 * The number of promoted sources in GlobalSearch.
2890 * @hide
2891 */
2892 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
2893 /**
2894 * The maximum number of suggestions returned by GlobalSearch.
2895 * @hide
2896 */
2897 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
2898 /**
2899 * The number of suggestions GlobalSearch will ask each non-web search source for.
2900 * @hide
2901 */
2902 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
2903 /**
2904 * The number of suggestions the GlobalSearch will ask the web search source for.
2905 * @hide
2906 */
2907 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
2908 "search_web_results_override_limit";
2909 /**
2910 * The number of milliseconds that GlobalSearch will wait for suggestions from
2911 * promoted sources before continuing with all other sources.
2912 * @hide
2913 */
2914 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
2915 "search_promoted_source_deadline_millis";
2916 /**
2917 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
2918 * @hide
2919 */
2920 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
2921 /**
2922 * The maximum number of milliseconds that GlobalSearch shows the previous results
2923 * after receiving a new query.
2924 * @hide
2925 */
2926 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
2927 /**
2928 * The maximum age of log data used for shortcuts in GlobalSearch.
2929 * @hide
2930 */
2931 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
2932 /**
2933 * The maximum age of log data used for source ranking in GlobalSearch.
2934 * @hide
2935 */
2936 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
2937 "search_max_source_event_age_millis";
2938 /**
2939 * The minimum number of impressions needed to rank a source in GlobalSearch.
2940 * @hide
2941 */
2942 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
2943 "search_min_impressions_for_source_ranking";
2944 /**
2945 * The minimum number of clicks needed to rank a source in GlobalSearch.
2946 * @hide
2947 */
2948 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
2949 "search_min_clicks_for_source_ranking";
2950 /**
2951 * The maximum number of shortcuts shown by GlobalSearch.
2952 * @hide
2953 */
2954 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
2955 /**
2956 * The size of the core thread pool for suggestion queries in GlobalSearch.
2957 * @hide
2958 */
2959 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
2960 "search_query_thread_core_pool_size";
2961 /**
2962 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
2963 * @hide
2964 */
2965 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
2966 "search_query_thread_max_pool_size";
2967 /**
2968 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
2969 * @hide
2970 */
2971 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
2972 "search_shortcut_refresh_core_pool_size";
2973 /**
2974 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
2975 * @hide
2976 */
2977 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
2978 "search_shortcut_refresh_max_pool_size";
2979 /**
2980 * The maximun time that excess threads in the GlobalSeach thread pools will
2981 * wait before terminating.
2982 * @hide
2983 */
2984 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
2985 "search_thread_keepalive_seconds";
2986 /**
2987 * The maximum number of concurrent suggestion queries to each source.
2988 * @hide
2989 */
2990 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
2991 "search_per_source_concurrent_query_limit";
2992
San Mehat87734d32010-01-08 12:53:06 -08002993 /**
2994 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
2995 * @hide
2996 */
2997 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
2998
2999 /**
3000 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3001 * @hide
3002 */
3003 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3004
3005 /**
3006 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3007 * @hide
3008 */
3009 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3010
3011 /**
3012 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3013 * @hide
3014 */
3015 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003016
Dan Egnor42471dd2010-01-07 17:25:22 -08003017 /**
Robert Greenwaltd0e18ff2010-01-26 11:40:34 -08003018 * Whether or not a notification is displayed when a Tetherable interface is detected.
3019 * (0 = false, 1 = true)
3020 * @hide
3021 */
3022 public static final String TETHER_NOTIFY = "tether_notify";
3023
3024 /**
Dan Egnor42471dd2010-01-07 17:25:22 -08003025 * If nonzero, ANRs in invisible background processes bring up a dialog.
3026 * Otherwise, the process will be silently killed.
3027 * @hide
3028 */
3029 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003030
3031 /**
3032 * The {@link ComponentName} string of the service to be used as the voice recognition
3033 * service.
3034 *
3035 * @hide
3036 */
3037 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
Dan Egnor42471dd2010-01-07 17:25:22 -08003038
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003039 /**
-b master501eec92009-07-06 13:53:11 -07003040 * @hide
3041 */
3042 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07003043 ADB_ENABLED,
3044 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07003045 PARENTAL_CONTROL_ENABLED,
3046 PARENTAL_CONTROL_REDIRECT_URL,
3047 USB_MASS_STORAGE_ENABLED,
3048 ACCESSIBILITY_ENABLED,
3049 ENABLED_ACCESSIBILITY_SERVICES,
3050 TTS_USE_DEFAULTS,
3051 TTS_DEFAULT_RATE,
3052 TTS_DEFAULT_PITCH,
3053 TTS_DEFAULT_SYNTH,
3054 TTS_DEFAULT_LANG,
3055 TTS_DEFAULT_COUNTRY,
3056 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3057 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3058 WIFI_NUM_ALLOWED_CHANNELS,
3059 WIFI_NUM_OPEN_NETWORKS_KEPT,
San Mehat87734d32010-01-08 12:53:06 -08003060 MOUNT_PLAY_NOTIFICATION_SND,
3061 MOUNT_UMS_AUTOSTART,
3062 MOUNT_UMS_PROMPT,
3063 MOUNT_UMS_NOTIFY_ENABLED
-b master501eec92009-07-06 13:53:11 -07003064 };
3065
3066 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003067 * Helper method for determining if a location provider is enabled.
3068 * @param cr the content resolver to use
3069 * @param provider the location provider to query
3070 * @return true if the provider is enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003071 */
3072 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3073 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
3074 if (allowedProviders != null) {
3075 return (allowedProviders.equals(provider) ||
3076 allowedProviders.contains("," + provider + ",") ||
3077 allowedProviders.startsWith(provider + ",") ||
3078 allowedProviders.endsWith("," + provider));
3079 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003080 return false;
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003081 }
3082
3083 /**
3084 * Thread-safe method for enabling or disabling a single location provider.
3085 * @param cr the content resolver to use
3086 * @param provider the location provider to enable or disable
3087 * @param enabled true if the provider should be enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003088 */
3089 public static final void setLocationProviderEnabled(ContentResolver cr,
3090 String provider, boolean enabled) {
3091 // to ensure thread safety, we write the provider name with a '+' or '-'
3092 // and let the SettingsProvider handle it rather than reading and modifying
3093 // the list of enabled providers.
3094 if (enabled) {
3095 provider = "+" + provider;
3096 } else {
3097 provider = "-" + provider;
3098 }
3099 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3100 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003101 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003103 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003104 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3105 * Intent URL, allowing it to be either a web page or a particular
3106 * application activity.
3107 *
3108 * @hide
3109 */
3110 public static final class Bookmarks implements BaseColumns
3111 {
3112 private static final String TAG = "Bookmarks";
3113
3114 /**
3115 * The content:// style URL for this table
3116 */
3117 public static final Uri CONTENT_URI =
3118 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3119
3120 /**
3121 * The row ID.
3122 * <p>Type: INTEGER</p>
3123 */
3124 public static final String ID = "_id";
3125
3126 /**
3127 * Descriptive name of the bookmark that can be displayed to the user.
3128 * If this is empty, the title should be resolved at display time (use
3129 * {@link #getTitle(Context, Cursor)} any time you want to display the
3130 * title of a bookmark.)
3131 * <P>
3132 * Type: TEXT
3133 * </P>
3134 */
3135 public static final String TITLE = "title";
3136
3137 /**
3138 * Arbitrary string (displayed to the user) that allows bookmarks to be
3139 * organized into categories. There are some special names for
3140 * standard folders, which all start with '@'. The label displayed for
3141 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3142 * the folder name does not change so you can consistently query for
3143 * the folder regardless of the current locale.
3144 *
3145 * <P>Type: TEXT</P>
3146 *
3147 */
3148 public static final String FOLDER = "folder";
3149
3150 /**
3151 * The Intent URL of the bookmark, describing what it points to. This
3152 * value is given to {@link android.content.Intent#getIntent} to create
3153 * an Intent that can be launched.
3154 * <P>Type: TEXT</P>
3155 */
3156 public static final String INTENT = "intent";
3157
3158 /**
3159 * Optional shortcut character associated with this bookmark.
3160 * <P>Type: INTEGER</P>
3161 */
3162 public static final String SHORTCUT = "shortcut";
3163
3164 /**
3165 * The order in which the bookmark should be displayed
3166 * <P>Type: INTEGER</P>
3167 */
3168 public static final String ORDERING = "ordering";
3169
3170 private static final String[] sIntentProjection = { INTENT };
3171 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3172 private static final String sShortcutSelection = SHORTCUT + "=?";
3173
3174 /**
3175 * Convenience function to retrieve the bookmarked Intent for a
3176 * particular shortcut key.
3177 *
3178 * @param cr The ContentResolver to query.
3179 * @param shortcut The shortcut key.
3180 *
3181 * @return Intent The bookmarked URL, or null if there is no bookmark
3182 * matching the given shortcut.
3183 */
3184 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3185 {
3186 Intent intent = null;
3187
3188 Cursor c = cr.query(CONTENT_URI,
3189 sIntentProjection, sShortcutSelection,
3190 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3191 // Keep trying until we find a valid shortcut
3192 try {
3193 while (intent == null && c.moveToNext()) {
3194 try {
3195 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3196 intent = Intent.getIntent(intentURI);
3197 } catch (java.net.URISyntaxException e) {
3198 // The stored URL is bad... ignore it.
3199 } catch (IllegalArgumentException e) {
3200 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003201 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003202 }
3203 }
3204 } finally {
3205 if (c != null) c.close();
3206 }
3207
3208 return intent;
3209 }
3210
3211 /**
3212 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003213 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003214 * @param cr The ContentResolver to query.
3215 * @param intent The desired target of the bookmark.
3216 * @param title Bookmark title that is shown to the user; null if none
3217 * or it should be resolved to the intent's title.
3218 * @param folder Folder in which to place the bookmark; null if none.
3219 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3220 * this is non-zero and there is an existing bookmark entry
3221 * with this same shortcut, then that existing shortcut is
3222 * cleared (the bookmark is not removed).
3223 * @return The unique content URL for the new bookmark entry.
3224 */
3225 public static Uri add(ContentResolver cr,
3226 Intent intent,
3227 String title,
3228 String folder,
3229 char shortcut,
3230 int ordering)
3231 {
3232 // If a shortcut is supplied, and it is already defined for
3233 // another bookmark, then remove the old definition.
3234 if (shortcut != 0) {
3235 Cursor c = cr.query(CONTENT_URI,
3236 sShortcutProjection, sShortcutSelection,
3237 new String[] { String.valueOf((int) shortcut) }, null);
3238 try {
3239 if (c.moveToFirst()) {
3240 while (c.getCount() > 0) {
3241 if (!c.deleteRow()) {
3242 Log.w(TAG, "Could not delete existing shortcut row");
3243 }
3244 }
3245 }
3246 } finally {
3247 if (c != null) c.close();
3248 }
3249 }
3250
3251 ContentValues values = new ContentValues();
3252 if (title != null) values.put(TITLE, title);
3253 if (folder != null) values.put(FOLDER, folder);
3254 values.put(INTENT, intent.toURI());
3255 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3256 values.put(ORDERING, ordering);
3257 return cr.insert(CONTENT_URI, values);
3258 }
3259
3260 /**
3261 * Return the folder name as it should be displayed to the user. This
3262 * takes care of localizing special folders.
3263 *
3264 * @param r Resources object for current locale; only need access to
3265 * system resources.
3266 * @param folder The value found in the {@link #FOLDER} column.
3267 *
3268 * @return CharSequence The label for this folder that should be shown
3269 * to the user.
3270 */
3271 public static CharSequence getLabelForFolder(Resources r, String folder) {
3272 return folder;
3273 }
3274
3275 /**
3276 * Return the title as it should be displayed to the user. This takes
3277 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003278 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003279 * @param context A context.
3280 * @param cursor A cursor pointing to the row whose title should be
3281 * returned. The cursor must contain at least the {@link #TITLE}
3282 * and {@link #INTENT} columns.
3283 * @return A title that is localized and can be displayed to the user,
3284 * or the empty string if one could not be found.
3285 */
3286 public static CharSequence getTitle(Context context, Cursor cursor) {
3287 int titleColumn = cursor.getColumnIndex(TITLE);
3288 int intentColumn = cursor.getColumnIndex(INTENT);
3289 if (titleColumn == -1 || intentColumn == -1) {
3290 throw new IllegalArgumentException(
3291 "The cursor must contain the TITLE and INTENT columns.");
3292 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003293
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003294 String title = cursor.getString(titleColumn);
3295 if (!TextUtils.isEmpty(title)) {
3296 return title;
3297 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003298
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003299 String intentUri = cursor.getString(intentColumn);
3300 if (TextUtils.isEmpty(intentUri)) {
3301 return "";
3302 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003303
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003304 Intent intent;
3305 try {
3306 intent = Intent.getIntent(intentUri);
3307 } catch (URISyntaxException e) {
3308 return "";
3309 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003311 PackageManager packageManager = context.getPackageManager();
3312 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3313 return info != null ? info.loadLabel(packageManager) : "";
3314 }
3315 }
3316
3317 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003318 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3319 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3320 * from the GoogleLoginService.
3321 *
3322 * @param androidId The Android ID for this device.
3323 * @return The device ID that should be used when connecting to the mobile gtalk server.
3324 * @hide
3325 */
3326 public static String getGTalkDeviceId(long androidId) {
3327 return "android-" + Long.toHexString(androidId);
3328 }
3329}