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