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