blob: a66c9ed7740eb38f1459d5c39524bda898285ffc [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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020
21import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
Mike LeBeau5d34e9b2010-02-10 19:34:56 -080023import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.ContentResolver;
25import android.content.ContentValues;
26import android.content.Context;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080027import android.content.IContentProvider;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.Intent;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -080029import android.content.pm.ActivityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import 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.*;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038import android.text.TextUtils;
39import android.util.AndroidException;
Dan Egnor799f7212009-11-24 16:24:44 -080040import android.util.Config;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.util.Log;
42
43import java.net.URISyntaxException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import java.util.HashMap;
45import java.util.HashSet;
46
47
48/**
49 * The Settings provider contains global system-level device preferences.
50 */
51public final class Settings {
52
53 // Intent actions for Settings
54
55 /**
56 * Activity Action: Show system settings.
57 * <p>
58 * Input: Nothing.
59 * <p>
60 * Output: nothing.
61 */
62 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
63 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
64
65 /**
66 * Activity Action: Show settings to allow configuration of APNs.
67 * <p>
68 * Input: Nothing.
69 * <p>
70 * Output: nothing.
71 */
72 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
73 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
74
75 /**
76 * Activity Action: Show settings to allow configuration of current location
77 * sources.
78 * <p>
79 * In some cases, a matching Activity may not exist, so ensure you
80 * safeguard against this.
81 * <p>
82 * Input: Nothing.
83 * <p>
84 * Output: Nothing.
85 */
86 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
87 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
88 "android.settings.LOCATION_SOURCE_SETTINGS";
89
90 /**
91 * Activity Action: Show settings to allow configuration of wireless controls
92 * such as Wi-Fi, Bluetooth and Mobile networks.
93 * <p>
94 * In some cases, a matching Activity may not exist, so ensure you
95 * safeguard against this.
96 * <p>
97 * Input: Nothing.
98 * <p>
99 * Output: Nothing.
100 */
101 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
102 public static final String ACTION_WIRELESS_SETTINGS =
103 "android.settings.WIRELESS_SETTINGS";
104
105 /**
106 * Activity Action: Show settings to allow entering/exiting airplane mode.
107 * <p>
108 * In some cases, a matching Activity may not exist, so ensure you
109 * safeguard against this.
110 * <p>
111 * Input: Nothing.
112 * <p>
113 * Output: Nothing.
114 */
115 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
116 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
117 "android.settings.AIRPLANE_MODE_SETTINGS";
118
119 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700120 * Activity Action: Show settings for accessibility modules.
121 * <p>
122 * In some cases, a matching Activity may not exist, so ensure you
123 * safeguard against this.
124 * <p>
125 * Input: Nothing.
126 * <p>
127 * Output: Nothing.
128 */
129 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
130 public static final String ACTION_ACCESSIBILITY_SETTINGS =
131 "android.settings.ACCESSIBILITY_SETTINGS";
132
133 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800134 * Activity Action: Show settings to allow configuration of security and
135 * location privacy.
136 * <p>
137 * In some cases, a matching Activity may not exist, so ensure you
138 * safeguard against this.
139 * <p>
140 * Input: Nothing.
141 * <p>
142 * Output: Nothing.
143 */
144 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
145 public static final String ACTION_SECURITY_SETTINGS =
146 "android.settings.SECURITY_SETTINGS";
147
148 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700149 * Activity Action: Show settings to allow configuration of privacy options.
150 * <p>
151 * In some cases, a matching Activity may not exist, so ensure you
152 * safeguard against this.
153 * <p>
154 * Input: Nothing.
155 * <p>
156 * Output: Nothing.
157 */
158 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
159 public static final String ACTION_PRIVACY_SETTINGS =
160 "android.settings.PRIVACY_SETTINGS";
161
162 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800163 * Activity Action: Show settings to allow configuration of Wi-Fi.
164
165 * <p>
166 * In some cases, a matching Activity may not exist, so ensure you
167 * safeguard against this.
168 * <p>
169 * Input: Nothing.
170 * <p>
171 * Output: Nothing.
172
173 */
174 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
175 public static final String ACTION_WIFI_SETTINGS =
176 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700177
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178 /**
179 * Activity Action: Show settings to allow configuration of a static IP
180 * address for Wi-Fi.
181 * <p>
182 * In some cases, a matching Activity may not exist, so ensure you safeguard
183 * against this.
184 * <p>
185 * Input: Nothing.
186 * <p>
187 * Output: Nothing.
188 */
189 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
190 public static final String ACTION_WIFI_IP_SETTINGS =
191 "android.settings.WIFI_IP_SETTINGS";
192
193 /**
194 * Activity Action: Show settings to allow configuration of Bluetooth.
195 * <p>
196 * In some cases, a matching Activity may not exist, so ensure you
197 * safeguard against this.
198 * <p>
199 * Input: Nothing.
200 * <p>
201 * Output: Nothing.
202 */
203 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
204 public static final String ACTION_BLUETOOTH_SETTINGS =
205 "android.settings.BLUETOOTH_SETTINGS";
206
207 /**
208 * Activity Action: Show settings to allow configuration of date and time.
209 * <p>
210 * In some cases, a matching Activity may not exist, so ensure you
211 * safeguard against this.
212 * <p>
213 * Input: Nothing.
214 * <p>
215 * Output: Nothing.
216 */
217 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
218 public static final String ACTION_DATE_SETTINGS =
219 "android.settings.DATE_SETTINGS";
220
221 /**
222 * Activity Action: Show settings to allow configuration of sound and volume.
223 * <p>
224 * In some cases, a matching Activity may not exist, so ensure you
225 * safeguard against this.
226 * <p>
227 * Input: Nothing.
228 * <p>
229 * Output: Nothing.
230 */
231 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
232 public static final String ACTION_SOUND_SETTINGS =
233 "android.settings.SOUND_SETTINGS";
234
235 /**
236 * Activity Action: Show settings to allow configuration of display.
237 * <p>
238 * In some cases, a matching Activity may not exist, so ensure you
239 * safeguard against this.
240 * <p>
241 * Input: Nothing.
242 * <p>
243 * Output: Nothing.
244 */
245 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
246 public static final String ACTION_DISPLAY_SETTINGS =
247 "android.settings.DISPLAY_SETTINGS";
248
249 /**
250 * Activity Action: Show settings to allow configuration of locale.
251 * <p>
252 * In some cases, a matching Activity may not exist, so ensure you
253 * safeguard against this.
254 * <p>
255 * Input: Nothing.
256 * <p>
257 * Output: Nothing.
258 */
259 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
260 public static final String ACTION_LOCALE_SETTINGS =
261 "android.settings.LOCALE_SETTINGS";
262
263 /**
264 * Activity Action: Show settings to configure input methods, in particular
265 * allowing the user to enable input methods.
266 * <p>
267 * In some cases, a matching Activity may not exist, so ensure you
268 * safeguard against this.
269 * <p>
270 * Input: Nothing.
271 * <p>
272 * Output: Nothing.
273 */
274 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
275 public static final String ACTION_INPUT_METHOD_SETTINGS =
276 "android.settings.INPUT_METHOD_SETTINGS";
277
278 /**
279 * Activity Action: Show settings to manage the user input dictionary.
280 * <p>
281 * In some cases, a matching Activity may not exist, so ensure you
282 * safeguard against this.
283 * <p>
284 * Input: Nothing.
285 * <p>
286 * Output: Nothing.
287 */
288 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
289 public static final String ACTION_USER_DICTIONARY_SETTINGS =
290 "android.settings.USER_DICTIONARY_SETTINGS";
291
292 /**
293 * Activity Action: Show settings to allow configuration of application-related settings.
294 * <p>
295 * In some cases, a matching Activity may not exist, so ensure you
296 * safeguard against this.
297 * <p>
298 * Input: Nothing.
299 * <p>
300 * Output: Nothing.
301 */
302 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
303 public static final String ACTION_APPLICATION_SETTINGS =
304 "android.settings.APPLICATION_SETTINGS";
305
306 /**
307 * Activity Action: Show settings to allow configuration of application
308 * development-related settings.
309 * <p>
310 * In some cases, a matching Activity may not exist, so ensure you safeguard
311 * against this.
312 * <p>
313 * Input: Nothing.
314 * <p>
315 * Output: Nothing.
316 */
317 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
318 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
319 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
320
321 /**
322 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
323 * <p>
324 * In some cases, a matching Activity may not exist, so ensure you
325 * safeguard against this.
326 * <p>
327 * Input: Nothing.
328 * <p>
329 * Output: Nothing.
330 */
331 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
332 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
333 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 /**
336 * Activity Action: Show settings to manage installed applications.
337 * <p>
338 * In some cases, a matching Activity may not exist, so ensure you
339 * safeguard against this.
340 * <p>
341 * Input: Nothing.
342 * <p>
343 * Output: Nothing.
344 */
345 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
346 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
347 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700348
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800349 /**
Dianne Hackbornb7bb3b32010-06-06 22:47:50 -0700350 * Activity Action: Show screen of details about a particular application.
351 * <p>
352 * In some cases, a matching Activity may not exist, so ensure you
353 * safeguard against this.
354 * <p>
355 * Input: The Intent's data URI specifies the application package name
356 * to be shown, with the "package" scheme. That is "package:com.my.app".
357 * <p>
358 * Output: Nothing.
359 */
360 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
361 public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
362 "android.settings.APPLICATION_DETAILS_SETTINGS";
363
364 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 * Activity Action: Show settings for system update functionality.
366 * <p>
367 * In some cases, a matching Activity may not exist, so ensure you
368 * safeguard against this.
369 * <p>
370 * Input: Nothing.
371 * <p>
372 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700373 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800374 * @hide
375 */
376 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
377 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
378 "android.settings.SYSTEM_UPDATE_SETTINGS";
379
380 /**
381 * Activity Action: Show settings to allow configuration of sync settings.
382 * <p>
383 * In some cases, a matching Activity may not exist, so ensure you
384 * safeguard against this.
385 * <p>
Erikeebc8e22010-02-18 13:27:19 -0800386 * The account types available to add via the add account button may be restricted by adding an
387 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
388 * authorities. Only account types which can sync with that content provider will be offered to
389 * the user.
390 * <p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 * Input: Nothing.
392 * <p>
393 * Output: Nothing.
394 */
395 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
396 public static final String ACTION_SYNC_SETTINGS =
397 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700398
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 /**
Erikeebc8e22010-02-18 13:27:19 -0800400 * Activity Action: Show add account screen for creating a new account.
401 * <p>
402 * In some cases, a matching Activity may not exist, so ensure you
403 * safeguard against this.
404 * <p>
405 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
406 * extra to the Intent with one or more syncable content provider's authorities. Only account
407 * types which can sync with that content provider will be offered to the user.
408 * <p>
409 * Input: Nothing.
410 * <p>
411 * Output: Nothing.
412 */
413 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
414 public static final String ACTION_ADD_ACCOUNT =
415 "android.settings.ADD_ACCOUNT_SETTINGS";
416
417 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 * Activity Action: Show settings for selecting the network operator.
419 * <p>
420 * In some cases, a matching Activity may not exist, so ensure you
421 * safeguard against this.
422 * <p>
423 * Input: Nothing.
424 * <p>
425 * Output: Nothing.
426 */
427 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
428 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
429 "android.settings.NETWORK_OPERATOR_SETTINGS";
430
431 /**
432 * Activity Action: Show settings for selection of 2G/3G.
433 * <p>
434 * In some cases, a matching Activity may not exist, so ensure you
435 * safeguard against this.
436 * <p>
437 * Input: Nothing.
438 * <p>
439 * Output: Nothing.
440 */
441 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
442 public static final String ACTION_DATA_ROAMING_SETTINGS =
443 "android.settings.DATA_ROAMING_SETTINGS";
444
445 /**
446 * Activity Action: Show settings for internal storage.
447 * <p>
448 * In some cases, a matching Activity may not exist, so ensure you
449 * safeguard against this.
450 * <p>
451 * Input: Nothing.
452 * <p>
453 * Output: Nothing.
454 */
455 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
456 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
457 "android.settings.INTERNAL_STORAGE_SETTINGS";
458 /**
459 * Activity Action: Show settings for memory card storage.
460 * <p>
461 * In some cases, a matching Activity may not exist, so ensure you
462 * safeguard against this.
463 * <p>
464 * Input: Nothing.
465 * <p>
466 * Output: Nothing.
467 */
468 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
469 public static final String ACTION_MEMORY_CARD_SETTINGS =
470 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700471
Justin Mattsonef340352010-01-13 21:05:46 -0800472 /**
473 * Activity Action: Show settings for global search.
474 * <p>
475 * In some cases, a matching Activity may not exist, so ensure you
476 * safeguard against this.
477 * <p>
478 * Input: Nothing.
479 * <p>
480 * Output: Nothing
481 */
482 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
483 public static final String ACTION_SEARCH_SETTINGS =
484 "android.search.action.SEARCH_SETTINGS";
485
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500486 /**
487 * Activity Action: Show general device information settings (serial
488 * number, software version, phone number, etc.).
489 * <p>
490 * In some cases, a matching Activity may not exist, so ensure you
491 * safeguard against this.
492 * <p>
493 * Input: Nothing.
494 * <p>
495 * Output: Nothing
496 */
497 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
498 public static final String ACTION_DEVICE_INFO_SETTINGS =
499 "android.settings.DEVICE_INFO_SETTINGS";
500
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800501 // End of Intent actions for Settings
502
Erikeebc8e22010-02-18 13:27:19 -0800503 /**
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800504 * @hide - Private call() method on SettingsProvider to read from 'system' table.
505 */
506 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
507
508 /**
509 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
510 */
511 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
512
513 /**
Erikeebc8e22010-02-18 13:27:19 -0800514 * Activity Extra: Limit available options in launched activity based on the given authority.
515 * <p>
516 * This can be passed as an extra field in an Activity Intent with one or more syncable content
517 * provider's authorities as a String[]. This field is used by some intents to alter the
518 * behavior of the called activity.
519 * <p>
520 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
521 * on the authority given.
522 */
523 public static final String EXTRA_AUTHORITIES =
524 "authorities";
525
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800526 private static final String JID_RESOURCE_PREFIX = "android";
527
528 public static final String AUTHORITY = "settings";
529
530 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800531 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 public static class SettingNotFoundException extends AndroidException {
534 public SettingNotFoundException(String msg) {
535 super(msg);
536 }
537 }
538
539 /**
540 * Common base for tables of name/value settings.
541 */
542 public static class NameValueTable implements BaseColumns {
543 public static final String NAME = "name";
544 public static final String VALUE = "value";
545
546 protected static boolean putString(ContentResolver resolver, Uri uri,
547 String name, String value) {
548 // The database will take care of replacing duplicates.
549 try {
550 ContentValues values = new ContentValues();
551 values.put(NAME, name);
552 values.put(VALUE, value);
553 resolver.insert(uri, values);
554 return true;
555 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700556 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 return false;
558 }
559 }
560
561 public static Uri getUriFor(Uri uri, String name) {
562 return Uri.withAppendedPath(uri, name);
563 }
564 }
565
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800566 // Thread-safe.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800567 private static class NameValueCache {
568 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569 private final Uri mUri;
570
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800571 private static final String[] SELECT_VALUE =
572 new String[] { Settings.NameValueTable.VALUE };
573 private static final String NAME_EQ_PLACEHOLDER = "name=?";
574
575 // Must synchronize on 'this' to access mValues and mValuesVersion.
Dan Egnor799f7212009-11-24 16:24:44 -0800576 private final HashMap<String, String> mValues = new HashMap<String, String>();
577 private long mValuesVersion = 0;
578
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800579 // Initially null; set lazily and held forever. Synchronized on 'this'.
580 private IContentProvider mContentProvider = null;
581
582 // The method we'll call (or null, to not use) on the provider
583 // for the fast path of retrieving settings.
584 private final String mCallCommand;
585
586 public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800587 mVersionSystemProperty = versionSystemProperty;
588 mUri = uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800589 mCallCommand = callCommand;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800590 }
591
Dan Egnor799f7212009-11-24 16:24:44 -0800592 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800593 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800594
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800595 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800596 if (mValuesVersion != newValuesVersion) {
597 if (LOCAL_LOGV) {
598 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
599 newValuesVersion + " != cached " + mValuesVersion);
600 }
601
602 mValues.clear();
603 mValuesVersion = newValuesVersion;
604 }
605
606 if (mValues.containsKey(name)) {
607 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800608 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800609 }
Dan Egnor799f7212009-11-24 16:24:44 -0800610
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800611 IContentProvider cp = null;
612 synchronized (this) {
613 cp = mContentProvider;
614 if (cp == null) {
615 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
616 }
617 }
618
619 // Try the fast path first, not using query(). If this
620 // fails (alternate Settings provider that doesn't support
621 // this interface?) then we fall back to the query/table
622 // interface.
623 if (mCallCommand != null) {
624 try {
625 Bundle b = cp.call(mCallCommand, name, null);
626 if (b != null) {
627 String value = b.getPairValue();
628 synchronized (this) {
629 mValues.put(name, value);
630 }
631 return value;
632 }
633 // If the response Bundle is null, we fall through
634 // to the query interface below.
635 } catch (RemoteException e) {
636 // Not supported by the remote side? Fall through
637 // to query().
638 }
639 }
640
Dan Egnor799f7212009-11-24 16:24:44 -0800641 Cursor c = null;
642 try {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800643 c = cp.query(mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
644 new String[]{name}, null);
Dan Egnor799f7212009-11-24 16:24:44 -0800645 if (c == null) {
646 Log.w(TAG, "Can't get key " + name + " from " + mUri);
647 return null;
648 }
649
650 String value = c.moveToNext() ? c.getString(0) : null;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800651 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800652 mValues.put(name, value);
653 }
654 if (LOCAL_LOGV) {
655 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
656 name + " = " + (value == null ? "(null)" : value));
657 }
658 return value;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800659 } catch (RemoteException e) {
Dan Egnor799f7212009-11-24 16:24:44 -0800660 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
661 return null; // Return null, but don't cache it.
662 } finally {
663 if (c != null) c.close();
664 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800665 }
666 }
667
668 /**
669 * System settings, containing miscellaneous system preferences. This
670 * table holds simple name/value pairs. There are convenience
671 * functions for accessing individual settings entries.
672 */
673 public static final class System extends NameValueTable {
674 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
675
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800676 // Populated lazily, guarded by class object:
677 private static NameValueCache sNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700678
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800679 private static final HashSet<String> MOVED_TO_SECURE;
680 static {
681 MOVED_TO_SECURE = new HashSet<String>(30);
682 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
683 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
684 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
685 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
686 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
687 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
688 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
689 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
Amith Yamasani156c4352010-03-05 17:10:03 -0800690 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
691 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
692 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800693 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
694 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
695 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
696 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
697 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
698 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
699 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
700 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
701 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
702 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
703 MOVED_TO_SECURE.add(Secure.WIFI_ON);
704 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
705 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
706 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
707 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
708 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
709 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
710 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
711 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
712 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
713 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
714 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
715 }
716
717 /**
718 * Look up a name in the database.
719 * @param resolver to access the database with
720 * @param name to look up in the table
721 * @return the corresponding value, or null if not present
722 */
723 public synchronized static String getString(ContentResolver resolver, String name) {
724 if (MOVED_TO_SECURE.contains(name)) {
725 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
726 + " to android.provider.Settings.Secure, returning read-only value.");
727 return Secure.getString(resolver, name);
728 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800729 if (sNameValueCache == null) {
730 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
731 CALL_METHOD_GET_SYSTEM);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800732 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800733 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800734 }
735
736 /**
737 * Store a name/value pair into the database.
738 * @param resolver to access the database with
739 * @param name to store
740 * @param value to associate with the name
741 * @return true if the value was set, false on database errors
742 */
743 public static boolean putString(ContentResolver resolver, String name, String value) {
744 if (MOVED_TO_SECURE.contains(name)) {
745 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
746 + " to android.provider.Settings.Secure, value is unchanged.");
747 return false;
748 }
749 return putString(resolver, CONTENT_URI, name, value);
750 }
751
752 /**
753 * Construct the content URI for a particular name/value pair,
754 * useful for monitoring changes with a ContentObserver.
755 * @param name to look up in the table
756 * @return the corresponding content URI, or null if not present
757 */
758 public static Uri getUriFor(String name) {
759 if (MOVED_TO_SECURE.contains(name)) {
760 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
761 + " to android.provider.Settings.Secure, returning Secure URI.");
762 return Secure.getUriFor(Secure.CONTENT_URI, name);
763 }
764 return getUriFor(CONTENT_URI, name);
765 }
766
767 /**
768 * Convenience function for retrieving a single system settings value
769 * as an integer. Note that internally setting values are always
770 * stored as strings; this function converts the string to an integer
771 * for you. The default value will be returned if the setting is
772 * not defined or not an integer.
773 *
774 * @param cr The ContentResolver to access.
775 * @param name The name of the setting to retrieve.
776 * @param def Value to return if the setting is not defined.
777 *
778 * @return The setting's current value, or 'def' if it is not defined
779 * or not a valid integer.
780 */
781 public static int getInt(ContentResolver cr, String name, int def) {
782 String v = getString(cr, name);
783 try {
784 return v != null ? Integer.parseInt(v) : def;
785 } catch (NumberFormatException e) {
786 return def;
787 }
788 }
789
790 /**
791 * Convenience function for retrieving a single system settings value
792 * as an integer. Note that internally setting values are always
793 * stored as strings; this function converts the string to an integer
794 * for you.
795 * <p>
796 * This version does not take a default value. If the setting has not
797 * been set, or the string value is not a number,
798 * it throws {@link SettingNotFoundException}.
799 *
800 * @param cr The ContentResolver to access.
801 * @param name The name of the setting to retrieve.
802 *
803 * @throws SettingNotFoundException Thrown if a setting by the given
804 * name can't be found or the setting value is not an integer.
805 *
806 * @return The setting's current value.
807 */
808 public static int getInt(ContentResolver cr, String name)
809 throws SettingNotFoundException {
810 String v = getString(cr, name);
811 try {
812 return Integer.parseInt(v);
813 } catch (NumberFormatException e) {
814 throw new SettingNotFoundException(name);
815 }
816 }
817
818 /**
819 * Convenience function for updating a single settings value as an
820 * integer. This will either create a new entry in the table if the
821 * given name does not exist, or modify the value of the existing row
822 * with that name. Note that internally setting values are always
823 * stored as strings, so this function converts the given value to a
824 * string before storing it.
825 *
826 * @param cr The ContentResolver to access.
827 * @param name The name of the setting to modify.
828 * @param value The new value for the setting.
829 * @return true if the value was set, false on database errors
830 */
831 public static boolean putInt(ContentResolver cr, String name, int value) {
832 return putString(cr, name, Integer.toString(value));
833 }
834
835 /**
836 * Convenience function for retrieving a single system settings value
837 * as a {@code long}. Note that internally setting values are always
838 * stored as strings; this function converts the string to a {@code long}
839 * for you. The default value will be returned if the setting is
840 * not defined or not a {@code long}.
841 *
842 * @param cr The ContentResolver to access.
843 * @param name The name of the setting to retrieve.
844 * @param def Value to return if the setting is not defined.
845 *
846 * @return The setting's current value, or 'def' if it is not defined
847 * or not a valid {@code long}.
848 */
849 public static long getLong(ContentResolver cr, String name, long def) {
850 String valString = getString(cr, name);
851 long value;
852 try {
853 value = valString != null ? Long.parseLong(valString) : def;
854 } catch (NumberFormatException e) {
855 value = def;
856 }
857 return value;
858 }
859
860 /**
861 * Convenience function for retrieving a single system settings value
862 * as a {@code long}. Note that internally setting values are always
863 * stored as strings; this function converts the string to a {@code long}
864 * for you.
865 * <p>
866 * This version does not take a default value. If the setting has not
867 * been set, or the string value is not a number,
868 * it throws {@link SettingNotFoundException}.
869 *
870 * @param cr The ContentResolver to access.
871 * @param name The name of the setting to retrieve.
872 *
873 * @return The setting's current value.
874 * @throws SettingNotFoundException Thrown if a setting by the given
875 * name can't be found or the setting value is not an integer.
876 */
877 public static long getLong(ContentResolver cr, String name)
878 throws SettingNotFoundException {
879 String valString = getString(cr, name);
880 try {
881 return Long.parseLong(valString);
882 } catch (NumberFormatException e) {
883 throw new SettingNotFoundException(name);
884 }
885 }
886
887 /**
888 * Convenience function for updating a single settings value as a long
889 * integer. This will either create a new entry in the table if the
890 * given name does not exist, or modify the value of the existing row
891 * with that name. Note that internally setting values are always
892 * stored as strings, so this function converts the given value to a
893 * string before storing it.
894 *
895 * @param cr The ContentResolver to access.
896 * @param name The name of the setting to modify.
897 * @param value The new value for the setting.
898 * @return true if the value was set, false on database errors
899 */
900 public static boolean putLong(ContentResolver cr, String name, long value) {
901 return putString(cr, name, Long.toString(value));
902 }
903
904 /**
905 * Convenience function for retrieving a single system settings value
906 * as a floating point number. Note that internally setting values are
907 * always stored as strings; this function converts the string to an
908 * float for you. The default value will be returned if the setting
909 * is not defined or not a valid float.
910 *
911 * @param cr The ContentResolver to access.
912 * @param name The name of the setting to retrieve.
913 * @param def Value to return if the setting is not defined.
914 *
915 * @return The setting's current value, or 'def' if it is not defined
916 * or not a valid float.
917 */
918 public static float getFloat(ContentResolver cr, String name, float def) {
919 String v = getString(cr, name);
920 try {
921 return v != null ? Float.parseFloat(v) : def;
922 } catch (NumberFormatException e) {
923 return def;
924 }
925 }
926
927 /**
928 * Convenience function for retrieving a single system settings value
929 * as a float. Note that internally setting values are always
930 * stored as strings; this function converts the string to a float
931 * for you.
932 * <p>
933 * This version does not take a default value. If the setting has not
934 * been set, or the string value is not a number,
935 * it throws {@link SettingNotFoundException}.
936 *
937 * @param cr The ContentResolver to access.
938 * @param name The name of the setting to retrieve.
939 *
940 * @throws SettingNotFoundException Thrown if a setting by the given
941 * name can't be found or the setting value is not a float.
942 *
943 * @return The setting's current value.
944 */
945 public static float getFloat(ContentResolver cr, String name)
946 throws SettingNotFoundException {
947 String v = getString(cr, name);
948 try {
949 return Float.parseFloat(v);
950 } catch (NumberFormatException e) {
951 throw new SettingNotFoundException(name);
952 }
953 }
954
955 /**
956 * Convenience function for updating a single settings value as a
957 * floating point number. This will either create a new entry in the
958 * table if the given name does not exist, or modify the value of the
959 * existing row with that name. Note that internally setting values
960 * are always stored as strings, so this function converts the given
961 * value to a string before storing it.
962 *
963 * @param cr The ContentResolver to access.
964 * @param name The name of the setting to modify.
965 * @param value The new value for the setting.
966 * @return true if the value was set, false on database errors
967 */
968 public static boolean putFloat(ContentResolver cr, String name, float value) {
969 return putString(cr, name, Float.toString(value));
970 }
971
972 /**
973 * Convenience function to read all of the current
974 * configuration-related settings into a
975 * {@link Configuration} object.
976 *
977 * @param cr The ContentResolver to access.
978 * @param outConfig Where to place the configuration settings.
979 */
980 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
981 outConfig.fontScale = Settings.System.getFloat(
982 cr, FONT_SCALE, outConfig.fontScale);
983 if (outConfig.fontScale < 0) {
984 outConfig.fontScale = 1;
985 }
986 }
987
988 /**
989 * Convenience function to write a batch of configuration-related
990 * settings from a {@link Configuration} object.
991 *
992 * @param cr The ContentResolver to access.
993 * @param config The settings to write.
994 * @return true if the values were set, false on database errors
995 */
996 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
997 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
998 }
999
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001000 /** @hide */
1001 public static boolean hasInterestingConfigurationChanges(int changes) {
1002 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1003 }
1004
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001005 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1006 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
1007 }
1008
1009 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1010 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
1011 }
1012
1013 /**
1014 * The content:// style URL for this table
1015 */
1016 public static final Uri CONTENT_URI =
1017 Uri.parse("content://" + AUTHORITY + "/system");
1018
1019 /**
1020 * Whether we keep the device on while the device is plugged in.
1021 * Supported values are:
1022 * <ul>
1023 * <li>{@code 0} to never stay on while plugged in</li>
1024 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
1025 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
1026 * </ul>
1027 * These values can be OR-ed together.
1028 */
1029 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
1030
1031 /**
1032 * What happens when the user presses the end call button if they're not
1033 * on a call.<br/>
1034 * <b>Values:</b><br/>
1035 * 0 - The end button does nothing.<br/>
1036 * 1 - The end button goes to the home screen.<br/>
1037 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1038 * 3 - The end button goes to the home screen. If the user is already on the
1039 * home screen, it puts the device to sleep.
1040 */
1041 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1042
1043 /**
David Brown458e8062010-03-08 21:52:11 -08001044 * END_BUTTON_BEHAVIOR value for "go home".
1045 * @hide
1046 */
1047 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1048
1049 /**
1050 * END_BUTTON_BEHAVIOR value for "go to sleep".
1051 * @hide
1052 */
1053 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1054
1055 /**
1056 * END_BUTTON_BEHAVIOR default value.
1057 * @hide
1058 */
1059 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1060
1061 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001062 * Whether Airplane Mode is on.
1063 */
1064 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
1065
1066 /**
1067 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
1068 */
1069 public static final String RADIO_BLUETOOTH = "bluetooth";
1070
1071 /**
1072 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
1073 */
1074 public static final String RADIO_WIFI = "wifi";
1075
1076 /**
1077 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
1078 */
1079 public static final String RADIO_CELL = "cell";
1080
1081 /**
1082 * A comma separated list of radios that need to be disabled when airplane mode
1083 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
1084 * included in the comma separated list.
1085 */
1086 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
1087
1088 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -07001089 * A comma separated list of radios that should to be disabled when airplane mode
1090 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
1091 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
1092 * will be turned off when entering airplane mode, but the user will be able to reenable
1093 * Wifi in the Settings app.
1094 *
1095 * {@hide}
1096 */
1097 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
1098
1099 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001100 * The policy for deciding when Wi-Fi should go to sleep (which will in
1101 * turn switch to using the mobile data as an Internet connection).
1102 * <p>
1103 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
1104 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
1105 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001106 */
1107 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
1108
1109 /**
1110 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
1111 * policy, which is to sleep shortly after the turning off
1112 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001113 */
1114 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
1115
1116 /**
1117 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
1118 * the device is on battery, and never go to sleep when the device is
1119 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001120 */
1121 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001122
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001123 /**
1124 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001125 */
1126 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001127
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001128 /**
1129 * Whether to use static IP and other static network attributes.
1130 * <p>
1131 * Set to 1 for true and 0 for false.
1132 */
1133 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1134
1135 /**
1136 * The static IP address.
1137 * <p>
1138 * Example: "192.168.1.51"
1139 */
1140 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1141
1142 /**
1143 * If using static IP, the gateway's IP address.
1144 * <p>
1145 * Example: "192.168.1.1"
1146 */
1147 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1148
1149 /**
1150 * If using static IP, the net mask.
1151 * <p>
1152 * Example: "255.255.255.0"
1153 */
1154 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1155
1156 /**
1157 * If using static IP, the primary DNS's IP address.
1158 * <p>
1159 * Example: "192.168.1.1"
1160 */
1161 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1162
1163 /**
1164 * If using static IP, the secondary DNS's IP address.
1165 * <p>
1166 * Example: "192.168.1.2"
1167 */
1168 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1169
1170 /**
1171 * The number of radio channels that are allowed in the local
1172 * 802.11 regulatory domain.
1173 * @hide
1174 */
1175 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1176
1177 /**
1178 * Determines whether remote devices may discover and/or connect to
1179 * this device.
1180 * <P>Type: INT</P>
1181 * 2 -- discoverable and connectable
1182 * 1 -- connectable but not discoverable
1183 * 0 -- neither connectable nor discoverable
1184 */
1185 public static final String BLUETOOTH_DISCOVERABILITY =
1186 "bluetooth_discoverability";
1187
1188 /**
1189 * Bluetooth discoverability timeout. If this value is nonzero, then
1190 * Bluetooth becomes discoverable for a certain number of seconds,
1191 * after which is becomes simply connectable. The value is in seconds.
1192 */
1193 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1194 "bluetooth_discoverability_timeout";
1195
1196 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001197 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1198 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001199 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001200 @Deprecated
1201 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001202
1203 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001204 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1205 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001206 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001207 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001208 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1209
1210 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001211 * @deprecated Use
1212 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1213 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001215 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1217 "lock_pattern_tactile_feedback_enabled";
1218
1219
1220 /**
1221 * A formatted string of the next alarm that is set, or the empty string
1222 * if there is no alarm set.
1223 */
1224 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1225
1226 /**
1227 * Scaling factor for fonts, float.
1228 */
1229 public static final String FONT_SCALE = "font_scale";
1230
1231 /**
1232 * Name of an application package to be debugged.
1233 */
1234 public static final String DEBUG_APP = "debug_app";
1235
1236 /**
1237 * If 1, when launching DEBUG_APP it will wait for the debugger before
1238 * starting user code. If 0, it will run normally.
1239 */
1240 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1241
1242 /**
1243 * Whether or not to dim the screen. 0=no 1=yes
1244 */
1245 public static final String DIM_SCREEN = "dim_screen";
1246
1247 /**
1248 * The timeout before the screen turns off.
1249 */
1250 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1251
1252 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001253 * If 0, the compatibility mode is off for all applications.
1254 * If 1, older applications run under compatibility mode.
1255 * TODO: remove this settings before code freeze (bug/1907571)
1256 * @hide
1257 */
1258 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1259
1260 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001261 * The screen backlight brightness between 0 and 255.
1262 */
1263 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1264
1265 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001266 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05001267 */
1268 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1269
1270 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001271 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001272 */
1273 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1274
1275 /**
1276 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001277 */
1278 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1279
1280 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001281 * Control whether the process CPU usage meter should be shown.
1282 */
1283 public static final String SHOW_PROCESSES = "show_processes";
1284
1285 /**
1286 * If 1, the activity manager will aggressively finish activities and
1287 * processes as soon as they are no longer needed. If 0, the normal
1288 * extended lifetime is used.
1289 */
1290 public static final String ALWAYS_FINISH_ACTIVITIES =
1291 "always_finish_activities";
1292
1293
1294 /**
1295 * Ringer mode. This is used internally, changing this value will not
1296 * change the ringer mode. See AudioManager.
1297 */
1298 public static final String MODE_RINGER = "mode_ringer";
1299
1300 /**
1301 * Determines which streams are affected by ringer mode changes. The
1302 * stream type's bit should be set to 1 if it should be muted when going
1303 * into an inaudible ringer mode.
1304 */
1305 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1306
1307 /**
1308 * Determines which streams are affected by mute. The
1309 * stream type's bit should be set to 1 if it should be muted when a mute request
1310 * is received.
1311 */
1312 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1313
1314 /**
1315 * Whether vibrate is on for different events. This is used internally,
1316 * changing this value will not change the vibrate. See AudioManager.
1317 */
1318 public static final String VIBRATE_ON = "vibrate_on";
1319
1320 /**
1321 * Ringer volume. This is used internally, changing this value will not
1322 * change the volume. See AudioManager.
1323 */
1324 public static final String VOLUME_RING = "volume_ring";
1325
1326 /**
1327 * System/notifications volume. This is used internally, changing this
1328 * value will not change the volume. See AudioManager.
1329 */
1330 public static final String VOLUME_SYSTEM = "volume_system";
1331
1332 /**
1333 * Voice call volume. This is used internally, changing this value will
1334 * not change the volume. See AudioManager.
1335 */
1336 public static final String VOLUME_VOICE = "volume_voice";
1337
1338 /**
1339 * Music/media/gaming volume. This is used internally, changing this
1340 * value will not change the volume. See AudioManager.
1341 */
1342 public static final String VOLUME_MUSIC = "volume_music";
1343
1344 /**
1345 * Alarm volume. This is used internally, changing this
1346 * value will not change the volume. See AudioManager.
1347 */
1348 public static final String VOLUME_ALARM = "volume_alarm";
1349
1350 /**
1351 * Notification volume. This is used internally, changing this
1352 * value will not change the volume. See AudioManager.
1353 */
1354 public static final String VOLUME_NOTIFICATION = "volume_notification";
1355
1356 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001357 * Bluetooth Headset volume. This is used internally, changing this value will
1358 * not change the volume. See AudioManager.
1359 */
1360 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1361
1362 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 * Whether the notifications should use the ring volume (value of 1) or
1364 * a separate notification volume (value of 0). In most cases, users
1365 * will have this enabled so the notification and ringer volumes will be
1366 * the same. However, power users can disable this and use the separate
1367 * notification volume control.
1368 * <p>
1369 * Note: This is a one-off setting that will be removed in the future
1370 * when there is profile support. For this reason, it is kept hidden
1371 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001372 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001373 * @hide
1374 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001375 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001376 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001378 /**
Daniel Sandler6329bf72010-02-26 15:17:44 -05001379 * Whether silent mode should allow vibration feedback. This is used
1380 * internally in AudioService and the Sound settings activity to
1381 * coordinate decoupling of vibrate and silent modes. This setting
1382 * will likely be removed in a future release with support for
1383 * audio/vibe feedback profiles.
1384 *
1385 * @hide
1386 */
1387 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1388
1389 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 * The mapping of stream type (integer) to its setting.
1391 */
1392 public static final String[] VOLUME_SETTINGS = {
1393 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001394 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395 };
1396
1397 /**
1398 * Appended to various volume related settings to record the previous
1399 * values before they the settings were affected by a silent/vibrate
1400 * ringer mode change.
1401 */
1402 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1403
1404 /**
1405 * Persistent store for the system-wide default ringtone URI.
1406 * <p>
1407 * If you need to play the default ringtone at any given time, it is recommended
1408 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1409 * to the set default ringtone at the time of playing.
1410 *
1411 * @see #DEFAULT_RINGTONE_URI
1412 */
1413 public static final String RINGTONE = "ringtone";
1414
1415 /**
1416 * A {@link Uri} that will point to the current default ringtone at any
1417 * given time.
1418 * <p>
1419 * If the current default ringtone is in the DRM provider and the caller
1420 * does not have permission, the exception will be a
1421 * FileNotFoundException.
1422 */
1423 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1424
1425 /**
1426 * Persistent store for the system-wide default notification sound.
1427 *
1428 * @see #RINGTONE
1429 * @see #DEFAULT_NOTIFICATION_URI
1430 */
1431 public static final String NOTIFICATION_SOUND = "notification_sound";
1432
1433 /**
1434 * A {@link Uri} that will point to the current default notification
1435 * sound at any given time.
1436 *
1437 * @see #DEFAULT_RINGTONE_URI
1438 */
1439 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1440
1441 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001442 * Persistent store for the system-wide default alarm alert.
1443 *
1444 * @see #RINGTONE
1445 * @see #DEFAULT_ALARM_ALERT_URI
1446 */
1447 public static final String ALARM_ALERT = "alarm_alert";
1448
1449 /**
1450 * A {@link Uri} that will point to the current default alarm alert at
1451 * any given time.
1452 *
1453 * @see #DEFAULT_ALARM_ALERT_URI
1454 */
1455 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1456
1457 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1459 */
1460 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1461
1462 /**
1463 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1464 */
1465 public static final String TEXT_AUTO_CAPS = "auto_caps";
1466
1467 /**
1468 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1469 * feature converts two spaces to a "." and space.
1470 */
1471 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001472
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001473 /**
1474 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1475 */
1476 public static final String TEXT_SHOW_PASSWORD = "show_password";
1477
1478 public static final String SHOW_GTALK_SERVICE_STATUS =
1479 "SHOW_GTALK_SERVICE_STATUS";
1480
1481 /**
1482 * Name of activity to use for wallpaper on the home screen.
1483 */
1484 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1485
1486 /**
1487 * Value to specify if the user prefers the date, time and time zone
1488 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1489 */
1490 public static final String AUTO_TIME = "auto_time";
1491
1492 /**
1493 * Display times as 12 or 24 hours
1494 * 12
1495 * 24
1496 */
1497 public static final String TIME_12_24 = "time_12_24";
1498
1499 /**
1500 * Date format string
1501 * mm/dd/yyyy
1502 * dd/mm/yyyy
1503 * yyyy/mm/dd
1504 */
1505 public static final String DATE_FORMAT = "date_format";
1506
1507 /**
1508 * Whether the setup wizard has been run before (on first boot), or if
1509 * it still needs to be run.
1510 *
1511 * nonzero = it has been run in the past
1512 * 0 = it has not been run in the past
1513 */
1514 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1515
1516 /**
1517 * Scaling factor for normal window animations. Setting to 0 will disable window
1518 * animations.
1519 */
1520 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1521
1522 /**
1523 * Scaling factor for activity transition animations. Setting to 0 will disable window
1524 * animations.
1525 */
1526 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1527
1528 /**
1529 * Scaling factor for normal window animations. Setting to 0 will disable window
1530 * animations.
1531 * @hide
1532 */
1533 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1534
1535 /**
1536 * Control whether the accelerometer will be used to change screen
1537 * orientation. If 0, it will not be used unless explicitly requested
1538 * by the application; if 1, it will be used by default unless explicitly
1539 * disabled by the application.
1540 */
1541 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1542
1543 /**
1544 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1545 * boolean (1 or 0).
1546 */
1547 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1548
1549 /**
David Kraused0f67152009-06-13 18:01:13 -05001550 * CDMA only settings
1551 * DTMF tone type played by the dialer when dialing.
1552 * 0 = Normal
1553 * 1 = Long
1554 * @hide
1555 */
1556 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1557
1558 /**
1559 * CDMA only settings
1560 * Emergency Tone 0 = Off
1561 * 1 = Alert
1562 * 2 = Vibrate
1563 * @hide
1564 */
1565 public static final String EMERGENCY_TONE = "emergency_tone";
1566
1567 /**
1568 * CDMA only settings
1569 * Whether the auto retry is enabled. The value is
1570 * boolean (1 or 0).
1571 * @hide
1572 */
1573 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1574
1575 /**
1576 * Whether the hearing aid is enabled. The value is
1577 * boolean (1 or 0).
1578 * @hide
1579 */
1580 public static final String HEARING_AID = "hearing_aid";
1581
1582 /**
1583 * CDMA only settings
1584 * TTY Mode
1585 * 0 = OFF
1586 * 1 = FULL
1587 * 2 = VCO
1588 * 3 = HCO
1589 * @hide
1590 */
1591 public static final String TTY_MODE = "tty_mode";
1592
1593 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1595 * boolean (1 or 0).
1596 */
1597 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001599 /**
1600 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1601 * boolean (1 or 0).
1602 */
1603 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001604
Mike LeBeau48603e72009-06-05 00:27:00 +01001605 /**
1606 * Whether live web suggestions while the user types into search dialogs are
1607 * enabled. Browsers and other search UIs should respect this, as it allows
1608 * a user to avoid sending partial queries to a search engine, if it poses
1609 * any privacy concern. The value is boolean (1 or 0).
1610 */
1611 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001612
-b master501eec92009-07-06 13:53:11 -07001613 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001614 * Whether the notification LED should repeatedly flash when a notification is
1615 * pending. The value is boolean (1 or 0).
1616 * @hide
1617 */
1618 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1619
1620 /**
Dianne Hackborn90d2db32010-02-11 22:19:06 -08001621 * Show pointer location on screen?
1622 * 0 = no
1623 * 1 = yes
1624 * @hide
1625 */
1626 public static final String POINTER_LOCATION = "pointer_location";
1627
1628 /**
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05001629 * Whether to play a sound for low-battery alerts.
1630 * @hide
1631 */
1632 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1633
1634 /**
1635 * Whether to play a sound for dock events.
1636 * @hide
1637 */
1638 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1639
1640 /**
1641 * Whether to play sounds when the keyguard is shown and dismissed.
1642 * @hide
1643 */
1644 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1645
1646 /**
1647 * URI for the low battery sound file.
1648 * @hide
1649 */
1650 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1651
1652 /**
1653 * URI for the desk dock "in" event sound.
1654 * @hide
1655 */
1656 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1657
1658 /**
1659 * URI for the desk dock "out" event sound.
1660 * @hide
1661 */
1662 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1663
1664 /**
1665 * URI for the car dock "in" event sound.
1666 * @hide
1667 */
1668 public static final String CAR_DOCK_SOUND = "car_dock_sound";
1669
1670 /**
1671 * URI for the car dock "out" event sound.
1672 * @hide
1673 */
1674 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1675
1676 /**
1677 * URI for the "device locked" (keyguard shown) sound.
1678 * @hide
1679 */
1680 public static final String LOCK_SOUND = "lock_sound";
1681
1682 /**
1683 * URI for the "device unlocked" (keyguard dismissed) sound.
1684 * @hide
1685 */
1686 public static final String UNLOCK_SOUND = "unlock_sound";
1687
1688 /**
-b master501eec92009-07-06 13:53:11 -07001689 * Settings to backup. This is here so that it's in the same place as the settings
1690 * keys and easy to update.
1691 * @hide
1692 */
1693 public static final String[] SETTINGS_TO_BACKUP = {
1694 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001695 WIFI_SLEEP_POLICY,
1696 WIFI_USE_STATIC_IP,
1697 WIFI_STATIC_IP,
1698 WIFI_STATIC_GATEWAY,
1699 WIFI_STATIC_NETMASK,
1700 WIFI_STATIC_DNS1,
1701 WIFI_STATIC_DNS2,
1702 BLUETOOTH_DISCOVERABILITY,
1703 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1704 DIM_SCREEN,
1705 SCREEN_OFF_TIMEOUT,
1706 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001707 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001708 VIBRATE_ON,
1709 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001710 MODE_RINGER,
1711 MODE_RINGER_STREAMS_AFFECTED,
1712 MUTE_STREAMS_AFFECTED,
1713 VOLUME_VOICE,
1714 VOLUME_SYSTEM,
1715 VOLUME_RING,
1716 VOLUME_MUSIC,
1717 VOLUME_ALARM,
1718 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001719 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001720 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1721 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1722 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1723 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1724 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1725 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001726 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
Daniel Sandler1c7fa482010-03-10 09:45:01 -05001727 VIBRATE_IN_SILENT,
-b master501eec92009-07-06 13:53:11 -07001728 TEXT_AUTO_REPLACE,
1729 TEXT_AUTO_CAPS,
1730 TEXT_AUTO_PUNCTUATE,
1731 TEXT_SHOW_PASSWORD,
1732 AUTO_TIME,
1733 TIME_12_24,
1734 DATE_FORMAT,
1735 ACCELEROMETER_ROTATION,
1736 DTMF_TONE_WHEN_DIALING,
1737 DTMF_TONE_TYPE_WHEN_DIALING,
1738 EMERGENCY_TONE,
1739 CALL_AUTO_RETRY,
1740 HEARING_AID,
1741 TTY_MODE,
1742 SOUND_EFFECTS_ENABLED,
1743 HAPTIC_FEEDBACK_ENABLED,
Christopher Tate14c2d792010-02-25 16:49:44 -08001744 POWER_SOUNDS_ENABLED,
1745 DOCK_SOUNDS_ENABLED,
1746 LOCKSCREEN_SOUNDS_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001747 SHOW_WEB_SUGGESTIONS,
1748 NOTIFICATION_LIGHT_PULSE
-b master501eec92009-07-06 13:53:11 -07001749 };
1750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001751 // Settings moved to Settings.Secure
1752
1753 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001754 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001755 * instead
1756 */
1757 @Deprecated
1758 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1759
1760 /**
1761 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1762 */
1763 @Deprecated
1764 public static final String ANDROID_ID = Secure.ANDROID_ID;
1765
1766 /**
1767 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1768 */
1769 @Deprecated
1770 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1771
1772 /**
1773 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1774 */
1775 @Deprecated
1776 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1777
1778 /**
1779 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1780 */
1781 @Deprecated
1782 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1783
1784 /**
1785 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1786 */
1787 @Deprecated
1788 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1789
1790 /**
1791 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1792 */
1793 @Deprecated
1794 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001795
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 /**
1797 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1798 * instead
1799 */
1800 @Deprecated
1801 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1802
1803 /**
1804 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1805 */
1806 @Deprecated
1807 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001808
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001809 /**
1810 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1811 */
1812 @Deprecated
1813 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1814
1815 /**
1816 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1817 * instead
1818 */
1819 @Deprecated
1820 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1821
1822 /**
1823 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1824 * instead
1825 */
1826 @Deprecated
1827 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1828
1829 /**
1830 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1831 * instead
1832 */
1833 @Deprecated
1834 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1835 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1836
1837 /**
1838 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1839 */
1840 @Deprecated
1841 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1842
1843 /**
1844 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1845 */
1846 @Deprecated
1847 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001848
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001849 /**
1850 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1851 */
1852 @Deprecated
1853 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1854
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001855 /**
1856 * @deprecated Use
1857 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1858 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 @Deprecated
1860 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1861
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001862 /**
1863 * @deprecated Use
1864 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1865 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001866 @Deprecated
1867 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1868 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1869
1870 /**
1871 * @deprecated Use
1872 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1873 */
1874 @Deprecated
1875 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1876 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1877
1878 /**
1879 * @deprecated Use
1880 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1881 */
1882 @Deprecated
1883 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1884 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001886 /**
1887 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1888 * instead
1889 */
1890 @Deprecated
1891 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1892
1893 /**
1894 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1895 */
1896 @Deprecated
1897 public static final String WIFI_ON = Secure.WIFI_ON;
1898
1899 /**
1900 * @deprecated Use
1901 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1902 * instead
1903 */
1904 @Deprecated
1905 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1906 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1907
1908 /**
1909 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1910 */
1911 @Deprecated
1912 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1913
1914 /**
1915 * @deprecated Use
1916 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1917 */
1918 @Deprecated
1919 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1920 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001921
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 /**
1923 * @deprecated Use
1924 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1925 */
1926 @Deprecated
1927 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1928 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1929
1930 /**
1931 * @deprecated Use
1932 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1933 * instead
1934 */
1935 @Deprecated
1936 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1937 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1938
1939 /**
1940 * @deprecated Use
1941 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1942 */
1943 @Deprecated
1944 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1945 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1946
1947 /**
1948 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1949 * instead
1950 */
1951 @Deprecated
1952 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1953
1954 /**
1955 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1956 */
1957 @Deprecated
1958 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1959
1960 /**
1961 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1962 */
1963 @Deprecated
1964 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1965
1966 /**
1967 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1968 * instead
1969 */
1970 @Deprecated
1971 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1972
1973 /**
1974 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1975 * instead
1976 */
1977 @Deprecated
1978 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1979 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1980 }
1981
1982 /**
1983 * Secure system settings, containing system preferences that applications
1984 * can read but are not allowed to write. These are for preferences that
1985 * the user must explicitly modify through the system UI or specialized
1986 * APIs for those values, not modified directly by applications.
1987 */
1988 public static final class Secure extends NameValueTable {
1989 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1990
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001991 // Populated lazily, guarded by class object:
1992 private static NameValueCache sNameValueCache = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001993
1994 /**
1995 * Look up a name in the database.
1996 * @param resolver to access the database with
1997 * @param name to look up in the table
1998 * @return the corresponding value, or null if not present
1999 */
2000 public synchronized static String getString(ContentResolver resolver, String name) {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002001 if (sNameValueCache == null) {
2002 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
2003 CALL_METHOD_GET_SECURE);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002004 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002005 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002006 }
2007
2008 /**
2009 * Store a name/value pair into the database.
2010 * @param resolver to access the database with
2011 * @param name to store
2012 * @param value to associate with the name
2013 * @return true if the value was set, false on database errors
2014 */
2015 public static boolean putString(ContentResolver resolver,
2016 String name, String value) {
2017 return putString(resolver, CONTENT_URI, name, value);
2018 }
2019
2020 /**
2021 * Construct the content URI for a particular name/value pair,
2022 * useful for monitoring changes with a ContentObserver.
2023 * @param name to look up in the table
2024 * @return the corresponding content URI, or null if not present
2025 */
2026 public static Uri getUriFor(String name) {
2027 return getUriFor(CONTENT_URI, name);
2028 }
2029
2030 /**
2031 * Convenience function for retrieving a single secure settings value
2032 * as an integer. Note that internally setting values are always
2033 * stored as strings; this function converts the string to an integer
2034 * for you. The default value will be returned if the setting is
2035 * not defined or not an integer.
2036 *
2037 * @param cr The ContentResolver to access.
2038 * @param name The name of the setting to retrieve.
2039 * @param def Value to return if the setting is not defined.
2040 *
2041 * @return The setting's current value, or 'def' if it is not defined
2042 * or not a valid integer.
2043 */
2044 public static int getInt(ContentResolver cr, String name, int def) {
2045 String v = getString(cr, name);
2046 try {
2047 return v != null ? Integer.parseInt(v) : def;
2048 } catch (NumberFormatException e) {
2049 return def;
2050 }
2051 }
2052
2053 /**
2054 * Convenience function for retrieving a single secure settings value
2055 * as an integer. Note that internally setting values are always
2056 * stored as strings; this function converts the string to an integer
2057 * for you.
2058 * <p>
2059 * This version does not take a default value. If the setting has not
2060 * been set, or the string value is not a number,
2061 * it throws {@link SettingNotFoundException}.
2062 *
2063 * @param cr The ContentResolver to access.
2064 * @param name The name of the setting to retrieve.
2065 *
2066 * @throws SettingNotFoundException Thrown if a setting by the given
2067 * name can't be found or the setting value is not an integer.
2068 *
2069 * @return The setting's current value.
2070 */
2071 public static int getInt(ContentResolver cr, String name)
2072 throws SettingNotFoundException {
2073 String v = getString(cr, name);
2074 try {
2075 return Integer.parseInt(v);
2076 } catch (NumberFormatException e) {
2077 throw new SettingNotFoundException(name);
2078 }
2079 }
2080
2081 /**
2082 * Convenience function for updating a single settings value as an
2083 * integer. This will either create a new entry in the table if the
2084 * given name does not exist, or modify the value of the existing row
2085 * with that name. Note that internally setting values are always
2086 * stored as strings, so this function converts the given value to a
2087 * string before storing it.
2088 *
2089 * @param cr The ContentResolver to access.
2090 * @param name The name of the setting to modify.
2091 * @param value The new value for the setting.
2092 * @return true if the value was set, false on database errors
2093 */
2094 public static boolean putInt(ContentResolver cr, String name, int value) {
2095 return putString(cr, name, Integer.toString(value));
2096 }
2097
2098 /**
2099 * Convenience function for retrieving a single secure settings value
2100 * as a {@code long}. Note that internally setting values are always
2101 * stored as strings; this function converts the string to a {@code long}
2102 * for you. The default value will be returned if the setting is
2103 * not defined or not a {@code long}.
2104 *
2105 * @param cr The ContentResolver to access.
2106 * @param name The name of the setting to retrieve.
2107 * @param def Value to return if the setting is not defined.
2108 *
2109 * @return The setting's current value, or 'def' if it is not defined
2110 * or not a valid {@code long}.
2111 */
2112 public static long getLong(ContentResolver cr, String name, long def) {
2113 String valString = getString(cr, name);
2114 long value;
2115 try {
2116 value = valString != null ? Long.parseLong(valString) : def;
2117 } catch (NumberFormatException e) {
2118 value = def;
2119 }
2120 return value;
2121 }
2122
2123 /**
2124 * Convenience function for retrieving a single secure settings value
2125 * as a {@code long}. Note that internally setting values are always
2126 * stored as strings; this function converts the string to a {@code long}
2127 * for you.
2128 * <p>
2129 * This version does not take a default value. If the setting has not
2130 * been set, or the string value is not a number,
2131 * it throws {@link SettingNotFoundException}.
2132 *
2133 * @param cr The ContentResolver to access.
2134 * @param name The name of the setting to retrieve.
2135 *
2136 * @return The setting's current value.
2137 * @throws SettingNotFoundException Thrown if a setting by the given
2138 * name can't be found or the setting value is not an integer.
2139 */
2140 public static long getLong(ContentResolver cr, String name)
2141 throws SettingNotFoundException {
2142 String valString = getString(cr, name);
2143 try {
2144 return Long.parseLong(valString);
2145 } catch (NumberFormatException e) {
2146 throw new SettingNotFoundException(name);
2147 }
2148 }
2149
2150 /**
2151 * Convenience function for updating a secure settings value as a long
2152 * integer. This will either create a new entry in the table if the
2153 * given name does not exist, or modify the value of the existing row
2154 * with that name. Note that internally setting values are always
2155 * stored as strings, so this function converts the given value to a
2156 * string before storing it.
2157 *
2158 * @param cr The ContentResolver to access.
2159 * @param name The name of the setting to modify.
2160 * @param value The new value for the setting.
2161 * @return true if the value was set, false on database errors
2162 */
2163 public static boolean putLong(ContentResolver cr, String name, long value) {
2164 return putString(cr, name, Long.toString(value));
2165 }
2166
2167 /**
2168 * Convenience function for retrieving a single secure settings value
2169 * as a floating point number. Note that internally setting values are
2170 * always stored as strings; this function converts the string to an
2171 * float for you. The default value will be returned if the setting
2172 * is not defined or not a valid float.
2173 *
2174 * @param cr The ContentResolver to access.
2175 * @param name The name of the setting to retrieve.
2176 * @param def Value to return if the setting is not defined.
2177 *
2178 * @return The setting's current value, or 'def' if it is not defined
2179 * or not a valid float.
2180 */
2181 public static float getFloat(ContentResolver cr, String name, float def) {
2182 String v = getString(cr, name);
2183 try {
2184 return v != null ? Float.parseFloat(v) : def;
2185 } catch (NumberFormatException e) {
2186 return def;
2187 }
2188 }
2189
2190 /**
2191 * Convenience function for retrieving a single secure settings value
2192 * as a float. Note that internally setting values are always
2193 * stored as strings; this function converts the string to a float
2194 * for you.
2195 * <p>
2196 * This version does not take a default value. If the setting has not
2197 * been set, or the string value is not a number,
2198 * it throws {@link SettingNotFoundException}.
2199 *
2200 * @param cr The ContentResolver to access.
2201 * @param name The name of the setting to retrieve.
2202 *
2203 * @throws SettingNotFoundException Thrown if a setting by the given
2204 * name can't be found or the setting value is not a float.
2205 *
2206 * @return The setting's current value.
2207 */
2208 public static float getFloat(ContentResolver cr, String name)
2209 throws SettingNotFoundException {
2210 String v = getString(cr, name);
2211 try {
2212 return Float.parseFloat(v);
2213 } catch (NumberFormatException e) {
2214 throw new SettingNotFoundException(name);
2215 }
2216 }
2217
2218 /**
2219 * Convenience function for updating a single settings value as a
2220 * floating point number. This will either create a new entry in the
2221 * table if the given name does not exist, or modify the value of the
2222 * existing row with that name. Note that internally setting values
2223 * are always stored as strings, so this function converts the given
2224 * value to a string before storing it.
2225 *
2226 * @param cr The ContentResolver to access.
2227 * @param name The name of the setting to modify.
2228 * @param value The new value for the setting.
2229 * @return true if the value was set, false on database errors
2230 */
2231 public static boolean putFloat(ContentResolver cr, String name, float value) {
2232 return putString(cr, name, Float.toString(value));
2233 }
2234
2235 /**
2236 * The content:// style URL for this table
2237 */
2238 public static final Uri CONTENT_URI =
2239 Uri.parse("content://" + AUTHORITY + "/secure");
2240
2241 /**
2242 * Whether ADB is enabled.
2243 */
2244 public static final String ADB_ENABLED = "adb_enabled";
2245
2246 /**
2247 * Setting to allow mock locations and location provider status to be injected into the
2248 * LocationManager service for testing purposes during application development. These
2249 * locations and status values override actual location and status information generated
2250 * by network, gps, or other location providers.
2251 */
2252 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2253
2254 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08002255 * A 64-bit number (as a hex string) that is randomly
2256 * generated on the device's first boot and should remain
2257 * constant for the lifetime of the device. (The value may
2258 * change if a factory reset is performed on the device.)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002259 */
2260 public static final String ANDROID_ID = "android_id";
2261
2262 /**
2263 * Whether bluetooth is enabled/disabled
2264 * 0=disabled. 1=enabled.
2265 */
2266 public static final String BLUETOOTH_ON = "bluetooth_on";
2267
2268 /**
2269 * Get the key that retrieves a bluetooth headset's priority.
2270 * @hide
2271 */
2272 public static final String getBluetoothHeadsetPriorityKey(String address) {
2273 return ("bluetooth_headset_priority_" + address.toUpperCase());
2274 }
2275
2276 /**
2277 * Get the key that retrieves a bluetooth a2dp sink's priority.
2278 * @hide
2279 */
2280 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2281 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2282 }
2283
2284 /**
2285 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2286 */
2287 public static final String DATA_ROAMING = "data_roaming";
2288
2289 /**
2290 * Setting to record the input method used by default, holding the ID
2291 * of the desired method.
2292 */
2293 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2294
2295 /**
2296 * Whether the device has been provisioned (0 = false, 1 = true)
2297 */
2298 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 /**
2301 * List of input methods that are currently enabled. This is a string
2302 * containing the IDs of all enabled input methods, each ID separated
2303 * by ':'.
2304 */
2305 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 /**
Amith Yamasanie861ec12010-03-24 21:39:27 -07002308 * List of system input methods that are currently disabled. This is a string
2309 * containing the IDs of all disabled input methods, each ID separated
2310 * by ':'.
2311 * @hide
2312 */
2313 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
2314
2315 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002316 * Host name and port for a user-selected proxy.
2317 */
2318 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002319
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002320 /**
2321 * Whether the package installer should allow installation of apps downloaded from
2322 * sources other than the Android Market (vending machine).
2323 *
2324 * 1 = allow installing from other sources
2325 * 0 = only allow installing from the Android Market
2326 */
2327 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002328
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002329 /**
2330 * Comma-separated list of location providers that activities may access.
2331 */
2332 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002333
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08002335 * Whether autolock is enabled (0 = false, 1 = true)
2336 */
2337 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
2338
2339 /**
2340 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
2341 */
2342 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2343
2344 /**
2345 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
2346 */
2347 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2348 "lock_pattern_tactile_feedback_enabled";
2349
2350 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002351 * Whether assisted GPS should be enabled or not.
2352 * @hide
2353 */
2354 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2355
2356 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002357 * The Logging ID (a unique 64-bit value) as a hex string.
2358 * Used as a pseudonymous identifier for logging.
2359 * @deprecated This identifier is poorly initialized and has
2360 * many collisions. It should not be used.
2361 */
2362 @Deprecated
2363 public static final String LOGGING_ID = "logging_id";
2364
2365 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002366 * User preference for which network(s) should be used. Only the
2367 * connectivity service should touch this.
2368 */
2369 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002370
2371 /**
Robert Greenwalt2a091d72010-02-11 18:18:40 -08002372 * Used to disable Tethering on a device - defaults to true
2373 * @hide
2374 */
2375 public static final String TETHER_SUPPORTED = "tether_supported";
2376
2377 /**
Robert Greenwalt77b32dd2010-06-03 18:57:26 -07002378 * Used to require DUN APN on the device or not - defaults to a build config value
2379 * which defaults to false
2380 * @hide
2381 */
2382 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2383
2384 /**
2385 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
2386 * corresponding build config values are set it will override the APN DB
2387 * values.
2388 * Consists of a comma seperated list of strings:
2389 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2390 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2391 * @hide
2392 */
2393 public static final String TETHER_DUN_APN = "tether_dun_apn";
2394
2395 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002396 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002397 */
2398 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002399
2400 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002401 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002402 */
2403 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002404
2405 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002406 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 */
2408 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002410 /**
Sen Hubde75702010-05-28 01:54:03 -07002411 * A positive value indicates the frequency of SamplingProfiler
2412 * taking snapshots in hertz. Zero value means SamplingProfiler is disabled.
2413 *
2414 * @hide
2415 */
2416 public static final String SAMPLING_PROFILER_HZ = "sampling_profiler_hz";
2417
2418 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002419 * Settings classname to launch when Settings is clicked from All
2420 * Applications. Needed because of user testing between the old
2421 * and new Settings apps.
2422 */
2423 // TODO: 881807
2424 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002425
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002426 /**
2427 * USB Mass Storage Enabled
2428 */
2429 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002431 /**
2432 * If this setting is set (to anything), then all references
2433 * to Gmail on the device must change to Google Mail.
2434 */
2435 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002436
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002437 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002438 * If accessibility is enabled.
2439 */
2440 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2441
2442 /**
2443 * List of the enabled accessibility providers.
2444 */
2445 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2446 "enabled_accessibility_services";
2447
2448 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002449 * Setting to always use the default text-to-speech settings regardless
2450 * of the application settings.
2451 * 1 = override application settings,
2452 * 0 = use application settings (if specified).
2453 */
2454 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2455
2456 /**
2457 * Default text-to-speech engine speech rate. 100 = 1x
2458 */
2459 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2460
2461 /**
2462 * Default text-to-speech engine pitch. 100 = 1x
2463 */
2464 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2465
2466 /**
2467 * Default text-to-speech engine.
2468 */
2469 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2470
2471 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002472 * Default text-to-speech language.
2473 */
2474 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2475
2476 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002477 * Default text-to-speech country.
2478 */
2479 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2480
2481 /**
2482 * Default text-to-speech locale variant.
2483 */
2484 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2485
2486 /**
Charles Chenceffa152010-03-16 21:18:10 -07002487 * Space delimited list of plugin packages that are enabled.
2488 */
2489 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2490
2491 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002492 * Whether to notify the user of open networks.
2493 * <p>
2494 * If not connected and the scan results have an open network, we will
2495 * put this notification up. If we attempt to connect to a network or
2496 * the open network(s) disappear, we remove the notification. When we
2497 * show the notification, we will not show it again for
2498 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2499 */
2500 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2501 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002502
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002503 /**
2504 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2505 * Connecting to a network will reset the timer.
2506 */
2507 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2508 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002509
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002510 /**
2511 * The number of radio channels that are allowed in the local
2512 * 802.11 regulatory domain.
2513 * @hide
2514 */
2515 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002516
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002517 /**
2518 * When the number of open networks exceeds this number, the
2519 * least-recently-used excess networks will be removed.
2520 */
2521 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002522
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002523 /**
2524 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2525 */
2526 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002527
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002528 /**
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002529 * Used to save the Wifi_ON state prior to tethering.
2530 * This state will be checked to restore Wifi after
2531 * the user turns off tethering.
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002532 *
2533 * @hide
2534 */
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002535 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002536
2537 /**
Irfan Sheriff9ab518ad2010-03-12 15:48:17 -08002538 * AP SSID
2539 *
2540 * @hide
2541 */
2542 public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2543
2544 /**
2545 * AP security
2546 *
2547 * @hide
2548 */
2549 public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2550
2551 /**
2552 * AP passphrase
2553 *
2554 * @hide
2555 */
2556 public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2557
2558 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 * The acceptable packet loss percentage (range 0 - 100) before trying
2560 * another AP on the same network.
2561 */
2562 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2563 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002565 /**
2566 * The number of access points required for a network in order for the
2567 * watchdog to monitor it.
2568 */
2569 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 /**
2572 * The delay between background checks.
2573 */
2574 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2575 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 /**
2578 * Whether the Wi-Fi watchdog is enabled for background checking even
2579 * after it thinks the user has connected to a good access point.
2580 */
2581 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2582 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002583
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002584 /**
2585 * The timeout for a background ping
2586 */
2587 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2588 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002589
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002590 /**
2591 * The number of initial pings to perform that *may* be ignored if they
2592 * fail. Again, if these fail, they will *not* be used in packet loss
2593 * calculation. For example, one network always seemed to time out for
2594 * the first couple pings, so this is set to 3 by default.
2595 */
2596 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2597 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002598
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002599 /**
2600 * The maximum number of access points (per network) to attempt to test.
2601 * If this number is reached, the watchdog will no longer monitor the
2602 * initial connection state for the network. This is a safeguard for
2603 * networks containing multiple APs whose DNS does not respond to pings.
2604 */
2605 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002606
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002607 /**
2608 * Whether the Wi-Fi watchdog is enabled.
2609 */
2610 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2611
2612 /**
2613 * 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 -08002614 */
2615 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2616
2617 /**
2618 * The number of pings to test if an access point is a good connection.
2619 */
2620 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002622 /**
2623 * The delay between pings.
2624 */
2625 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002626
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002627 /**
2628 * The timeout per ping.
2629 */
2630 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002631
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002632 /**
2633 * The maximum number of times we will retry a connection to an access
2634 * point for which we have failed in acquiring an IP address from DHCP.
2635 * 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 -08002636 */
2637 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002638
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002639 /**
2640 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2641 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002642 */
2643 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2644 "wifi_mobile_data_transition_wakelock_timeout_ms";
2645
2646 /**
2647 * Whether background data usage is allowed by the user. See
2648 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002649 */
2650 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002651
2652 /**
Bjorn Bringert98bfa392010-03-24 10:59:48 +00002653 * Origins for which browsers should allow geolocation by default.
2654 * The value is a space-separated list of origins.
2655 */
2656 public static final String ALLOWED_GEOLOCATION_ORIGINS
2657 = "allowed_geolocation_origins";
2658
2659 /**
Robert Greenwaltc03fa502010-02-23 18:58:05 -08002660 * Whether mobile data connections are allowed by the user. See
2661 * ConnectivityManager for more info.
2662 * @hide
2663 */
2664 public static final String MOBILE_DATA = "mobile_data";
2665
2666 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002667 * The CDMA roaming mode 0 = Home Networks, CDMA default
2668 * 1 = Roaming on Affiliated networks
2669 * 2 = Roaming on any networks
2670 * @hide
2671 */
2672 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2673
2674 /**
2675 * The CDMA subscription mode 0 = RUIM/SIM (default)
2676 * 1 = NV
2677 * @hide
2678 */
2679 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2680
2681 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002682 * The preferred network mode 7 = Global
2683 * 6 = EvDo only
2684 * 5 = CDMA w/o EvDo
2685 * 4 = CDMA / EvDo auto
2686 * 3 = GSM / WCDMA auto
2687 * 2 = WCDMA only
2688 * 1 = GSM only
2689 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002690 * @hide
2691 */
2692 public static final String PREFERRED_NETWORK_MODE =
2693 "preferred_network_mode";
2694
2695 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002696 * The preferred TTY mode 0 = TTy Off, CDMA default
2697 * 1 = TTY Full
2698 * 2 = TTY HCO
2699 * 3 = TTY VCO
2700 * @hide
2701 */
2702 public static final String PREFERRED_TTY_MODE =
2703 "preferred_tty_mode";
2704
2705
2706 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002707 * CDMA Cell Broadcast SMS
2708 * 0 = CDMA Cell Broadcast SMS disabled
2709 * 1 = CDMA Cell Broadcast SMS enabled
2710 * @hide
2711 */
2712 public static final String CDMA_CELL_BROADCAST_SMS =
2713 "cdma_cell_broadcast_sms";
2714
2715 /**
2716 * The cdma subscription 0 = Subscription from RUIM, when available
2717 * 1 = Subscription from NV
2718 * @hide
2719 */
2720 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2721 "preferred_cdma_subscription";
2722
2723 /**
2724 * Whether the enhanced voice privacy mode is enabled.
2725 * 0 = normal voice privacy
2726 * 1 = enhanced voice privacy
2727 * @hide
2728 */
2729 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2730
2731 /**
2732 * Whether the TTY mode mode is enabled.
2733 * 0 = disabled
2734 * 1 = enabled
2735 * @hide
2736 */
2737 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002738
2739 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002740 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002741 * Type: int ( 0 = disabled, 1 = enabled )
2742 * @hide
2743 */
2744 public static final String BACKUP_ENABLED = "backup_enabled";
2745
2746 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08002747 * Controls whether application data is automatically restored from backup
2748 * at install time.
2749 * Type: int ( 0 = disabled, 1 = enabled )
2750 * @hide
2751 */
2752 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2753
2754 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002755 * Indicates whether settings backup has been fully provisioned.
2756 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2757 * @hide
2758 */
2759 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2760
2761 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002762 * Component of the transport to use for backup/restore.
2763 * @hide
2764 */
2765 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002766
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002767 /**
2768 * Version for which the setup wizard was last shown. Bumped for
2769 * each release when there is new setup information to show.
2770 * @hide
2771 */
2772 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002773
2774 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08002775 * How frequently (in seconds) to check the memory status of the
2776 * device.
2777 * @hide
2778 */
2779 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2780
2781 /**
2782 * Max frequency (in seconds) to log memory check stats, in realtime
2783 * seconds. This allows for throttling of logs when the device is
2784 * running for large amounts of time.
2785 * @hide
2786 */
2787 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2788 "memcheck_log_realtime_interval";
2789
2790 /**
2791 * Boolean indicating whether rebooting due to system memory checks
2792 * is enabled.
2793 * @hide
2794 */
2795 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2796
2797 /**
2798 * How many bytes the system process must be below to avoid scheduling
2799 * a soft reboot. This reboot will happen when it is next determined
2800 * to be a good time.
2801 * @hide
2802 */
2803 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2804
2805 /**
2806 * How many bytes the system process must be below to avoid scheduling
2807 * a hard reboot. This reboot will happen immediately.
2808 * @hide
2809 */
2810 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2811
2812 /**
2813 * How many bytes the phone process must be below to avoid scheduling
2814 * a soft restart. This restart will happen when it is next determined
2815 * to be a good time.
2816 * @hide
2817 */
2818 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2819
2820 /**
2821 * How many bytes the phone process must be below to avoid scheduling
2822 * a hard restart. This restart will happen immediately.
2823 * @hide
2824 */
2825 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2826
2827 /**
2828 * Boolean indicating whether restarting the phone process due to
2829 * memory checks is enabled.
2830 * @hide
2831 */
2832 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2833
2834 /**
2835 * First time during the day it is okay to kill processes
2836 * or reboot the device due to low memory situations. This number is
2837 * in seconds since midnight.
2838 * @hide
2839 */
2840 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2841
2842 /**
2843 * Last time during the day it is okay to kill processes
2844 * or reboot the device due to low memory situations. This number is
2845 * in seconds since midnight.
2846 * @hide
2847 */
2848 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2849
2850 /**
2851 * How long the screen must have been off in order to kill processes
2852 * or reboot. This number is in seconds. A value of -1 means to
2853 * entirely disregard whether the screen is on.
2854 * @hide
2855 */
2856 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2857
2858 /**
2859 * How much time there must be until the next alarm in order to kill processes
2860 * or reboot. This number is in seconds. Note: this value must be
2861 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2862 * always see an alarm scheduled within its time.
2863 * @hide
2864 */
2865 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2866
2867 /**
2868 * How frequently to check whether it is a good time to restart things,
2869 * if the device is in a bad state. This number is in seconds. Note:
2870 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2871 * the alarm to schedule the recheck will always appear within the
2872 * minimum "do not execute now" time.
2873 * @hide
2874 */
2875 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2876
2877 /**
2878 * How frequently (in DAYS) to reboot the device. If 0, no reboots
2879 * will occur.
2880 * @hide
2881 */
2882 public static final String REBOOT_INTERVAL = "reboot_interval";
2883
2884 /**
2885 * First time during the day it is okay to force a reboot of the
2886 * device (if REBOOT_INTERVAL is set). This number is
2887 * in seconds since midnight.
2888 * @hide
2889 */
2890 public static final String REBOOT_START_TIME = "reboot_start_time";
2891
2892 /**
2893 * The window of time (in seconds) after each REBOOT_INTERVAL in which
2894 * a reboot can be executed. If 0, a reboot will always be executed at
2895 * exactly the given time. Otherwise, it will only be executed if
2896 * the device is idle within the window.
2897 * @hide
2898 */
2899 public static final String REBOOT_WINDOW = "reboot_window";
2900
2901 /**
Doug Zongker43866e02010-01-07 12:09:54 -08002902 * Threshold values for the duration and level of a discharge cycle, under
2903 * which we log discharge cycle info.
2904 * @hide
2905 */
2906 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
2907 "battery_discharge_duration_threshold";
2908 /** @hide */
2909 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
2910
2911 /**
2912 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
2913 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
2914 * will never display the "Report" button.
2915 * Type: int ( 0 = disallow, 1 = allow )
2916 * @hide
2917 */
2918 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
2919
2920 /**
2921 * Nonzero causes Log.wtf() to crash.
2922 * @hide
2923 */
2924 public static final String WTF_IS_FATAL = "wtf_is_fatal";
2925
2926 /**
2927 * Maximum age of entries kept by {@link android.os.IDropBox}.
2928 * @hide
2929 */
2930 public static final String DROPBOX_AGE_SECONDS =
2931 "dropbox_age_seconds";
2932 /**
Dan Egnor3a8b0c12010-03-24 17:48:20 -07002933 * Maximum number of entry files which {@link android.os.IDropBox} will keep around.
2934 * @hide
2935 */
2936 public static final String DROPBOX_MAX_FILES =
2937 "dropbox_max_files";
2938 /**
Doug Zongker43866e02010-01-07 12:09:54 -08002939 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
2940 * @hide
2941 */
2942 public static final String DROPBOX_QUOTA_KB =
2943 "dropbox_quota_kb";
2944 /**
2945 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
2946 * @hide
2947 */
2948 public static final String DROPBOX_QUOTA_PERCENT =
2949 "dropbox_quota_percent";
2950 /**
2951 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
2952 * @hide
2953 */
2954 public static final String DROPBOX_RESERVE_PERCENT =
2955 "dropbox_reserve_percent";
2956 /**
2957 * Prefix for per-tag dropbox disable/enable settings.
2958 * @hide
2959 */
2960 public static final String DROPBOX_TAG_PREFIX =
2961 "dropbox:";
Dan Egnora455d192010-03-12 08:52:28 -08002962 /**
2963 * Lines of logcat to include with system crash/ANR/etc. reports,
2964 * as a prefix of the dropbox tag of the report type.
2965 * For example, "logcat_for_system_server_anr" controls the lines
2966 * of logcat captured with system server ANR reports. 0 to disable.
2967 * @hide
2968 */
2969 public static final String ERROR_LOGCAT_PREFIX =
2970 "logcat_for_";
Doug Zongker43866e02010-01-07 12:09:54 -08002971
2972
2973 /**
2974 * Screen timeout in milliseconds corresponding to the
2975 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
2976 * possible screen timeout behavior.)
2977 * @hide
2978 */
2979 public static final String SHORT_KEYLIGHT_DELAY_MS =
2980 "short_keylight_delay_ms";
2981
2982 /**
2983 * The interval in minutes after which the amount of free storage left on the
2984 * device is logged to the event log
2985 * @hide
2986 */
2987 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
2988 "sys_free_storage_log_interval";
2989
2990 /**
2991 * Threshold for the amount of change in disk free space required to report the amount of
2992 * free space. Used to prevent spamming the logs when the disk free space isn't changing
2993 * frequently.
2994 * @hide
2995 */
2996 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
2997 "disk_free_change_reporting_threshold";
2998
2999
3000 /**
3001 * Minimum percentage of free storage on the device that is used to determine if
3002 * the device is running low on storage.
3003 * Say this value is set to 10, the device is considered running low on storage
3004 * if 90% or more of the device storage is filled up.
3005 * @hide
3006 */
3007 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3008 "sys_storage_threshold_percentage";
3009
3010 /**
3011 * The interval in milliseconds after which Wi-Fi is considered idle.
3012 * When idle, it is possible for the device to be switched from Wi-Fi to
3013 * the mobile data network.
3014 * @hide
3015 */
3016 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3017
3018 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08003019 * The interval in milliseconds at which to check packet counts on the
3020 * mobile data interface when screen is on, to detect possible data
3021 * connection problems.
3022 * @hide
3023 */
3024 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3025 "pdp_watchdog_poll_interval_ms";
3026
3027 /**
3028 * The interval in milliseconds at which to check packet counts on the
3029 * mobile data interface when screen is off, to detect possible data
3030 * connection problems.
3031 * @hide
3032 */
3033 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3034 "pdp_watchdog_long_poll_interval_ms";
3035
3036 /**
3037 * The interval in milliseconds at which to check packet counts on the
3038 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3039 * outgoing packets has been reached without incoming packets.
3040 * @hide
3041 */
3042 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3043 "pdp_watchdog_error_poll_interval_ms";
3044
3045 /**
3046 * The number of outgoing packets sent without seeing an incoming packet
3047 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3048 * device is logged to the event log
3049 * @hide
3050 */
3051 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3052 "pdp_watchdog_trigger_packet_count";
3053
3054 /**
3055 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3056 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3057 * attempting data connection recovery.
3058 * @hide
3059 */
3060 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3061 "pdp_watchdog_error_poll_count";
3062
3063 /**
3064 * The number of failed PDP reset attempts before moving to something more
3065 * drastic: re-registering to the network.
3066 * @hide
3067 */
3068 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3069 "pdp_watchdog_max_pdp_reset_fail_count";
3070
3071 /**
3072 * Address to ping as a last sanity check before attempting any recovery.
3073 * Unset or set to "0.0.0.0" to skip this check.
3074 * @hide
3075 */
3076 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3077
3078 /**
3079 * The "-w deadline" parameter for the ping, ie, the max time in
3080 * seconds to spend pinging.
3081 * @hide
3082 */
3083 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3084
3085 /**
3086 * The interval in milliseconds at which to check gprs registration
3087 * after the first registration mismatch of gprs and voice service,
3088 * to detect possible data network registration problems.
3089 *
3090 * @hide
3091 */
3092 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3093 "gprs_register_check_period_ms";
3094
3095 /**
3096 * The length of time in milli-seconds that automatic small adjustments to
3097 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3098 * @hide
3099 */
3100 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3101
3102 /**
3103 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3104 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3105 * exceeded.
3106 * @hide
3107 */
3108 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3109
3110 /**
3111 * The maximum reconnect delay for short network outages or when the network is suspended
3112 * due to phone use.
3113 * @hide
3114 */
3115 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3116 "sync_max_retry_delay_in_seconds";
3117
3118 /**
3119 * The interval in milliseconds at which to check the number of SMS sent
3120 * out without asking for use permit, to limit the un-authorized SMS
3121 * usage.
3122 * @hide
3123 */
3124 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3125 "sms_outgoing_check_interval_ms";
3126
3127 /**
3128 * The number of outgoing SMS sent without asking for user permit
3129 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3130 * @hide
3131 */
3132 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3133 "sms_outgoing_check_max_count";
3134
3135 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003136 * The number of promoted sources in GlobalSearch.
3137 * @hide
3138 */
3139 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3140 /**
3141 * The maximum number of suggestions returned by GlobalSearch.
3142 * @hide
3143 */
3144 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3145 /**
3146 * The number of suggestions GlobalSearch will ask each non-web search source for.
3147 * @hide
3148 */
3149 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3150 /**
3151 * The number of suggestions the GlobalSearch will ask the web search source for.
3152 * @hide
3153 */
3154 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3155 "search_web_results_override_limit";
3156 /**
3157 * The number of milliseconds that GlobalSearch will wait for suggestions from
3158 * promoted sources before continuing with all other sources.
3159 * @hide
3160 */
3161 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3162 "search_promoted_source_deadline_millis";
3163 /**
3164 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3165 * @hide
3166 */
3167 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3168 /**
3169 * The maximum number of milliseconds that GlobalSearch shows the previous results
3170 * after receiving a new query.
3171 * @hide
3172 */
3173 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3174 /**
3175 * The maximum age of log data used for shortcuts in GlobalSearch.
3176 * @hide
3177 */
3178 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3179 /**
3180 * The maximum age of log data used for source ranking in GlobalSearch.
3181 * @hide
3182 */
3183 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3184 "search_max_source_event_age_millis";
3185 /**
3186 * The minimum number of impressions needed to rank a source in GlobalSearch.
3187 * @hide
3188 */
3189 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3190 "search_min_impressions_for_source_ranking";
3191 /**
3192 * The minimum number of clicks needed to rank a source in GlobalSearch.
3193 * @hide
3194 */
3195 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3196 "search_min_clicks_for_source_ranking";
3197 /**
3198 * The maximum number of shortcuts shown by GlobalSearch.
3199 * @hide
3200 */
3201 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3202 /**
3203 * The size of the core thread pool for suggestion queries in GlobalSearch.
3204 * @hide
3205 */
3206 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3207 "search_query_thread_core_pool_size";
3208 /**
3209 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3210 * @hide
3211 */
3212 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3213 "search_query_thread_max_pool_size";
3214 /**
3215 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3216 * @hide
3217 */
3218 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3219 "search_shortcut_refresh_core_pool_size";
3220 /**
3221 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3222 * @hide
3223 */
3224 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3225 "search_shortcut_refresh_max_pool_size";
3226 /**
3227 * The maximun time that excess threads in the GlobalSeach thread pools will
3228 * wait before terminating.
3229 * @hide
3230 */
3231 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3232 "search_thread_keepalive_seconds";
3233 /**
3234 * The maximum number of concurrent suggestion queries to each source.
3235 * @hide
3236 */
3237 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3238 "search_per_source_concurrent_query_limit";
3239
San Mehat87734d32010-01-08 12:53:06 -08003240 /**
3241 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3242 * @hide
3243 */
3244 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3245
3246 /**
3247 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3248 * @hide
3249 */
3250 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3251
3252 /**
3253 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3254 * @hide
3255 */
3256 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3257
3258 /**
3259 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3260 * @hide
3261 */
3262 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003263
Dan Egnor42471dd2010-01-07 17:25:22 -08003264 /**
3265 * If nonzero, ANRs in invisible background processes bring up a dialog.
3266 * Otherwise, the process will be silently killed.
3267 * @hide
3268 */
3269 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
Erikeebc8e22010-02-18 13:27:19 -08003270
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003271 /**
3272 * The {@link ComponentName} string of the service to be used as the voice recognition
3273 * service.
Erikeebc8e22010-02-18 13:27:19 -08003274 *
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003275 * @hide
3276 */
3277 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
Dan Egnor42471dd2010-01-07 17:25:22 -08003278
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003279 /**
David Brown458e8062010-03-08 21:52:11 -08003280 * What happens when the user presses the Power button while in-call
3281 * and the screen is on.<br/>
3282 * <b>Values:</b><br/>
3283 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3284 * 2 - The Power button hangs up the current call.<br/>
3285 *
3286 * @hide
3287 */
3288 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3289
3290 /**
3291 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3292 * @hide
3293 */
3294 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3295
3296 /**
3297 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3298 * @hide
3299 */
3300 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3301
3302 /**
3303 * INCALL_POWER_BUTTON_BEHAVIOR default value.
3304 * @hide
3305 */
3306 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3307 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3308
3309 /**
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003310 * The current night mode that has been selected by the user. Owned
3311 * and controlled by UiModeManagerService. Constants are as per
3312 * UiModeManager.
3313 * @hide
3314 */
3315 public static final String UI_NIGHT_MODE = "ui_night_mode";
Suchi Amalapurapu40e47252010-04-07 16:15:50 -07003316
3317 /**
3318 * Let user pick default install location.
3319 * @hide
3320 */
3321 public static final String SET_INSTALL_LOCATION = "set_install_location";
3322
3323 /**
3324 * Default install location value.
3325 * 0 = auto, let system decide
3326 * 1 = internal
3327 * 2 = sdcard
3328 * @hide
3329 */
3330 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003331
3332 /**
3333 * The bandwidth throttle polling freqency in seconds
3334 * @hide
3335 */
3336 public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3337
3338 /**
3339 * The bandwidth throttle threshold (long)
3340 * @hide
3341 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003342 public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003343
3344 /**
3345 * The bandwidth throttle value (kbps)
3346 * @hide
3347 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003348 public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003349
3350 /**
3351 * The bandwidth throttle reset calendar day (1-28)
3352 * @hide
3353 */
3354 public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3355
3356 /**
3357 * The throttling notifications we should send
3358 * @hide
3359 */
3360 public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3361
3362 /**
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003363 * Help URI for data throttling policy
3364 * @hide
3365 */
3366 public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3367
Robert Greenwaltd1055a22010-05-25 15:54:52 -07003368 /**
3369 * The length of time in Sec that we allow our notion of NTP time
3370 * to be cached before we refresh it
3371 * @hide
3372 */
3373 public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3374 "throttle_max_ntp_cache_age_sec";
3375
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003376
3377 /**
-b master501eec92009-07-06 13:53:11 -07003378 * @hide
3379 */
3380 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07003381 ADB_ENABLED,
3382 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07003383 PARENTAL_CONTROL_ENABLED,
3384 PARENTAL_CONTROL_REDIRECT_URL,
3385 USB_MASS_STORAGE_ENABLED,
3386 ACCESSIBILITY_ENABLED,
Christopher Tate14c2d792010-02-25 16:49:44 -08003387 BACKUP_AUTO_RESTORE,
-b master501eec92009-07-06 13:53:11 -07003388 ENABLED_ACCESSIBILITY_SERVICES,
3389 TTS_USE_DEFAULTS,
3390 TTS_DEFAULT_RATE,
3391 TTS_DEFAULT_PITCH,
3392 TTS_DEFAULT_SYNTH,
3393 TTS_DEFAULT_LANG,
3394 TTS_DEFAULT_COUNTRY,
Charles Chenceffa152010-03-16 21:18:10 -07003395 TTS_ENABLED_PLUGINS,
-b master501eec92009-07-06 13:53:11 -07003396 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3397 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3398 WIFI_NUM_ALLOWED_CHANNELS,
3399 WIFI_NUM_OPEN_NETWORKS_KEPT,
San Mehat87734d32010-01-08 12:53:06 -08003400 MOUNT_PLAY_NOTIFICATION_SND,
3401 MOUNT_UMS_AUTOSTART,
3402 MOUNT_UMS_PROMPT,
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003403 MOUNT_UMS_NOTIFY_ENABLED,
3404 UI_NIGHT_MODE
-b master501eec92009-07-06 13:53:11 -07003405 };
3406
3407 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003408 * Helper method for determining if a location provider is enabled.
3409 * @param cr the content resolver to use
3410 * @param provider the location provider to query
3411 * @return true if the provider is enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003412 */
3413 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3414 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
3415 if (allowedProviders != null) {
3416 return (allowedProviders.equals(provider) ||
3417 allowedProviders.contains("," + provider + ",") ||
3418 allowedProviders.startsWith(provider + ",") ||
3419 allowedProviders.endsWith("," + provider));
3420 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003421 return false;
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003422 }
3423
3424 /**
3425 * Thread-safe method for enabling or disabling a single location provider.
3426 * @param cr the content resolver to use
3427 * @param provider the location provider to enable or disable
3428 * @param enabled true if the provider should be enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003429 */
3430 public static final void setLocationProviderEnabled(ContentResolver cr,
3431 String provider, boolean enabled) {
3432 // to ensure thread safety, we write the provider name with a '+' or '-'
3433 // and let the SettingsProvider handle it rather than reading and modifying
3434 // the list of enabled providers.
3435 if (enabled) {
3436 provider = "+" + provider;
3437 } else {
3438 provider = "-" + provider;
3439 }
3440 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3441 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003442 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003443
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003444 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003445 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3446 * Intent URL, allowing it to be either a web page or a particular
3447 * application activity.
3448 *
3449 * @hide
3450 */
3451 public static final class Bookmarks implements BaseColumns
3452 {
3453 private static final String TAG = "Bookmarks";
3454
3455 /**
3456 * The content:// style URL for this table
3457 */
3458 public static final Uri CONTENT_URI =
3459 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3460
3461 /**
3462 * The row ID.
3463 * <p>Type: INTEGER</p>
3464 */
3465 public static final String ID = "_id";
3466
3467 /**
3468 * Descriptive name of the bookmark that can be displayed to the user.
3469 * If this is empty, the title should be resolved at display time (use
3470 * {@link #getTitle(Context, Cursor)} any time you want to display the
3471 * title of a bookmark.)
3472 * <P>
3473 * Type: TEXT
3474 * </P>
3475 */
3476 public static final String TITLE = "title";
3477
3478 /**
3479 * Arbitrary string (displayed to the user) that allows bookmarks to be
3480 * organized into categories. There are some special names for
3481 * standard folders, which all start with '@'. The label displayed for
3482 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3483 * the folder name does not change so you can consistently query for
3484 * the folder regardless of the current locale.
3485 *
3486 * <P>Type: TEXT</P>
3487 *
3488 */
3489 public static final String FOLDER = "folder";
3490
3491 /**
3492 * The Intent URL of the bookmark, describing what it points to. This
3493 * value is given to {@link android.content.Intent#getIntent} to create
3494 * an Intent that can be launched.
3495 * <P>Type: TEXT</P>
3496 */
3497 public static final String INTENT = "intent";
3498
3499 /**
3500 * Optional shortcut character associated with this bookmark.
3501 * <P>Type: INTEGER</P>
3502 */
3503 public static final String SHORTCUT = "shortcut";
3504
3505 /**
3506 * The order in which the bookmark should be displayed
3507 * <P>Type: INTEGER</P>
3508 */
3509 public static final String ORDERING = "ordering";
3510
3511 private static final String[] sIntentProjection = { INTENT };
3512 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3513 private static final String sShortcutSelection = SHORTCUT + "=?";
3514
3515 /**
3516 * Convenience function to retrieve the bookmarked Intent for a
3517 * particular shortcut key.
3518 *
3519 * @param cr The ContentResolver to query.
3520 * @param shortcut The shortcut key.
3521 *
3522 * @return Intent The bookmarked URL, or null if there is no bookmark
3523 * matching the given shortcut.
3524 */
3525 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3526 {
3527 Intent intent = null;
3528
3529 Cursor c = cr.query(CONTENT_URI,
3530 sIntentProjection, sShortcutSelection,
3531 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3532 // Keep trying until we find a valid shortcut
3533 try {
3534 while (intent == null && c.moveToNext()) {
3535 try {
3536 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003537 intent = Intent.parseUri(intentURI, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538 } catch (java.net.URISyntaxException e) {
3539 // The stored URL is bad... ignore it.
3540 } catch (IllegalArgumentException e) {
3541 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003542 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003543 }
3544 }
3545 } finally {
3546 if (c != null) c.close();
3547 }
3548
3549 return intent;
3550 }
3551
3552 /**
3553 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003554 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003555 * @param cr The ContentResolver to query.
3556 * @param intent The desired target of the bookmark.
3557 * @param title Bookmark title that is shown to the user; null if none
3558 * or it should be resolved to the intent's title.
3559 * @param folder Folder in which to place the bookmark; null if none.
3560 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3561 * this is non-zero and there is an existing bookmark entry
3562 * with this same shortcut, then that existing shortcut is
3563 * cleared (the bookmark is not removed).
3564 * @return The unique content URL for the new bookmark entry.
3565 */
3566 public static Uri add(ContentResolver cr,
3567 Intent intent,
3568 String title,
3569 String folder,
3570 char shortcut,
3571 int ordering)
3572 {
3573 // If a shortcut is supplied, and it is already defined for
3574 // another bookmark, then remove the old definition.
3575 if (shortcut != 0) {
Jeff Hamilton7cd51ef2010-05-12 17:30:27 -05003576 cr.delete(CONTENT_URI, sShortcutSelection,
3577 new String[] { String.valueOf((int) shortcut) });
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003578 }
3579
3580 ContentValues values = new ContentValues();
3581 if (title != null) values.put(TITLE, title);
3582 if (folder != null) values.put(FOLDER, folder);
3583 values.put(INTENT, intent.toURI());
3584 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3585 values.put(ORDERING, ordering);
3586 return cr.insert(CONTENT_URI, values);
3587 }
3588
3589 /**
3590 * Return the folder name as it should be displayed to the user. This
3591 * takes care of localizing special folders.
3592 *
3593 * @param r Resources object for current locale; only need access to
3594 * system resources.
3595 * @param folder The value found in the {@link #FOLDER} column.
3596 *
3597 * @return CharSequence The label for this folder that should be shown
3598 * to the user.
3599 */
3600 public static CharSequence getLabelForFolder(Resources r, String folder) {
3601 return folder;
3602 }
3603
3604 /**
3605 * Return the title as it should be displayed to the user. This takes
3606 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003607 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003608 * @param context A context.
3609 * @param cursor A cursor pointing to the row whose title should be
3610 * returned. The cursor must contain at least the {@link #TITLE}
3611 * and {@link #INTENT} columns.
3612 * @return A title that is localized and can be displayed to the user,
3613 * or the empty string if one could not be found.
3614 */
3615 public static CharSequence getTitle(Context context, Cursor cursor) {
3616 int titleColumn = cursor.getColumnIndex(TITLE);
3617 int intentColumn = cursor.getColumnIndex(INTENT);
3618 if (titleColumn == -1 || intentColumn == -1) {
3619 throw new IllegalArgumentException(
3620 "The cursor must contain the TITLE and INTENT columns.");
3621 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003623 String title = cursor.getString(titleColumn);
3624 if (!TextUtils.isEmpty(title)) {
3625 return title;
3626 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 String intentUri = cursor.getString(intentColumn);
3629 if (TextUtils.isEmpty(intentUri)) {
3630 return "";
3631 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003632
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003633 Intent intent;
3634 try {
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003635 intent = Intent.parseUri(intentUri, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 } catch (URISyntaxException e) {
3637 return "";
3638 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003639
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003640 PackageManager packageManager = context.getPackageManager();
3641 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3642 return info != null ? info.loadLabel(packageManager) : "";
3643 }
3644 }
3645
3646 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3648 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3649 * from the GoogleLoginService.
3650 *
3651 * @param androidId The Android ID for this device.
3652 * @return The device ID that should be used when connecting to the mobile gtalk server.
3653 * @hide
3654 */
3655 public static String getGTalkDeviceId(long androidId) {
3656 return "android-" + Long.toHexString(androidId);
3657 }
3658}