blob: ed71da2bbe4b994ead7d23c7a109712059afeec4 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.provider;
18
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080020
21import android.annotation.SdkConstant;
22import android.annotation.SdkConstant.SdkConstantType;
Mike LeBeau5d34e9b2010-02-10 19:34:56 -080023import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024import android.content.ContentResolver;
25import android.content.ContentValues;
26import android.content.Context;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080027import android.content.IContentProvider;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.Intent;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -080029import android.content.pm.ActivityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030import android.content.pm.PackageManager;
31import android.content.pm.ResolveInfo;
32import android.content.res.Configuration;
33import android.content.res.Resources;
34import android.database.Cursor;
35import android.database.SQLException;
36import android.net.Uri;
Irfan Sheriff36f74132010-11-04 16:57:37 -070037import android.net.wifi.WifiManager;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070038import android.os.BatteryManager;
39import android.os.Bundle;
40import android.os.RemoteException;
41import android.os.SystemProperties;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.text.TextUtils;
43import android.util.AndroidException;
Dan Egnor799f7212009-11-24 16:24:44 -080044import android.util.Config;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080045import android.util.Log;
46
47import java.net.URISyntaxException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import java.util.HashMap;
49import java.util.HashSet;
50
51
52/**
53 * The Settings provider contains global system-level device preferences.
54 */
55public final class Settings {
56
57 // Intent actions for Settings
58
59 /**
60 * Activity Action: Show system settings.
61 * <p>
62 * Input: Nothing.
63 * <p>
64 * Output: nothing.
65 */
66 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
67 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
68
69 /**
70 * Activity Action: Show settings to allow configuration of APNs.
71 * <p>
72 * Input: Nothing.
73 * <p>
74 * Output: nothing.
75 */
76 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
77 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
78
79 /**
80 * Activity Action: Show settings to allow configuration of current location
81 * sources.
82 * <p>
83 * In some cases, a matching Activity may not exist, so ensure you
84 * safeguard against this.
85 * <p>
86 * Input: Nothing.
87 * <p>
88 * Output: Nothing.
89 */
90 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
91 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
92 "android.settings.LOCATION_SOURCE_SETTINGS";
93
94 /**
95 * Activity Action: Show settings to allow configuration of wireless controls
96 * such as Wi-Fi, Bluetooth and Mobile networks.
97 * <p>
98 * In some cases, a matching Activity may not exist, so ensure you
99 * safeguard against this.
100 * <p>
101 * Input: Nothing.
102 * <p>
103 * Output: Nothing.
104 */
105 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
106 public static final String ACTION_WIRELESS_SETTINGS =
107 "android.settings.WIRELESS_SETTINGS";
108
109 /**
110 * Activity Action: Show settings to allow entering/exiting airplane mode.
111 * <p>
112 * In some cases, a matching Activity may not exist, so ensure you
113 * safeguard against this.
114 * <p>
115 * Input: Nothing.
116 * <p>
117 * Output: Nothing.
118 */
119 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
120 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
121 "android.settings.AIRPLANE_MODE_SETTINGS";
122
123 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700124 * Activity Action: Show settings for accessibility modules.
125 * <p>
126 * In some cases, a matching Activity may not exist, so ensure you
127 * safeguard against this.
128 * <p>
129 * Input: Nothing.
130 * <p>
131 * Output: Nothing.
132 */
133 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
134 public static final String ACTION_ACCESSIBILITY_SETTINGS =
135 "android.settings.ACCESSIBILITY_SETTINGS";
136
137 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800138 * Activity Action: Show settings to allow configuration of security and
139 * location privacy.
140 * <p>
141 * In some cases, a matching Activity may not exist, so ensure you
142 * safeguard against this.
143 * <p>
144 * Input: Nothing.
145 * <p>
146 * Output: Nothing.
147 */
148 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
149 public static final String ACTION_SECURITY_SETTINGS =
150 "android.settings.SECURITY_SETTINGS";
151
152 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700153 * Activity Action: Show settings to allow configuration of privacy options.
154 * <p>
155 * In some cases, a matching Activity may not exist, so ensure you
156 * safeguard against this.
157 * <p>
158 * Input: Nothing.
159 * <p>
160 * Output: Nothing.
161 */
162 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
163 public static final String ACTION_PRIVACY_SETTINGS =
164 "android.settings.PRIVACY_SETTINGS";
165
166 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800167 * Activity Action: Show settings to allow configuration of Wi-Fi.
168
169 * <p>
170 * In some cases, a matching Activity may not exist, so ensure you
171 * safeguard against this.
172 * <p>
173 * Input: Nothing.
174 * <p>
175 * Output: Nothing.
176
177 */
178 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
179 public static final String ACTION_WIFI_SETTINGS =
180 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700181
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800182 /**
183 * Activity Action: Show settings to allow configuration of a static IP
184 * address for Wi-Fi.
185 * <p>
186 * In some cases, a matching Activity may not exist, so ensure you safeguard
187 * against this.
188 * <p>
189 * Input: Nothing.
190 * <p>
191 * Output: Nothing.
192 */
193 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
194 public static final String ACTION_WIFI_IP_SETTINGS =
195 "android.settings.WIFI_IP_SETTINGS";
196
197 /**
198 * Activity Action: Show settings to allow configuration of Bluetooth.
199 * <p>
200 * In some cases, a matching Activity may not exist, so ensure you
201 * safeguard against this.
202 * <p>
203 * Input: Nothing.
204 * <p>
205 * Output: Nothing.
206 */
207 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
208 public static final String ACTION_BLUETOOTH_SETTINGS =
209 "android.settings.BLUETOOTH_SETTINGS";
210
211 /**
212 * Activity Action: Show settings to allow configuration of date and time.
213 * <p>
214 * In some cases, a matching Activity may not exist, so ensure you
215 * safeguard against this.
216 * <p>
217 * Input: Nothing.
218 * <p>
219 * Output: Nothing.
220 */
221 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
222 public static final String ACTION_DATE_SETTINGS =
223 "android.settings.DATE_SETTINGS";
224
225 /**
226 * Activity Action: Show settings to allow configuration of sound and volume.
227 * <p>
228 * In some cases, a matching Activity may not exist, so ensure you
229 * safeguard against this.
230 * <p>
231 * Input: Nothing.
232 * <p>
233 * Output: Nothing.
234 */
235 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
236 public static final String ACTION_SOUND_SETTINGS =
237 "android.settings.SOUND_SETTINGS";
238
239 /**
240 * Activity Action: Show settings to allow configuration of display.
241 * <p>
242 * In some cases, a matching Activity may not exist, so ensure you
243 * safeguard against this.
244 * <p>
245 * Input: Nothing.
246 * <p>
247 * Output: Nothing.
248 */
249 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
250 public static final String ACTION_DISPLAY_SETTINGS =
251 "android.settings.DISPLAY_SETTINGS";
252
253 /**
254 * Activity Action: Show settings to allow configuration of locale.
255 * <p>
256 * In some cases, a matching Activity may not exist, so ensure you
257 * safeguard against this.
258 * <p>
259 * Input: Nothing.
260 * <p>
261 * Output: Nothing.
262 */
263 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
264 public static final String ACTION_LOCALE_SETTINGS =
265 "android.settings.LOCALE_SETTINGS";
266
267 /**
268 * Activity Action: Show settings to configure input methods, in particular
269 * allowing the user to enable input methods.
270 * <p>
271 * In some cases, a matching Activity may not exist, so ensure you
272 * safeguard against this.
273 * <p>
274 * Input: Nothing.
275 * <p>
276 * Output: Nothing.
277 */
278 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
279 public static final String ACTION_INPUT_METHOD_SETTINGS =
280 "android.settings.INPUT_METHOD_SETTINGS";
281
282 /**
satok86417ea2010-10-27 14:11:03 +0900283 * Activity Action: Show enabler activity to enable/disable input methods and subtypes.
284 * <p>
285 * In some cases, a matching Activity may not exist, so ensure you
286 * safeguard against this.
287 * <p>
288 * Input: Nothing.
289 * <p>
290 * Output: Nothing.
291 */
292 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
293 public static final String ACTION_INPUT_METHOD_AND_SUBTYPE_ENABLER =
294 "android.settings.INPUT_METHOD_AND_SUBTYPE_ENABLER";
295
296 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800297 * Activity Action: Show settings to manage the user input dictionary.
298 * <p>
299 * In some cases, a matching Activity may not exist, so ensure you
300 * safeguard against this.
301 * <p>
302 * Input: Nothing.
303 * <p>
304 * Output: Nothing.
305 */
306 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
307 public static final String ACTION_USER_DICTIONARY_SETTINGS =
308 "android.settings.USER_DICTIONARY_SETTINGS";
309
310 /**
311 * Activity Action: Show settings to allow configuration of application-related settings.
312 * <p>
313 * In some cases, a matching Activity may not exist, so ensure you
314 * safeguard against this.
315 * <p>
316 * Input: Nothing.
317 * <p>
318 * Output: Nothing.
319 */
320 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
321 public static final String ACTION_APPLICATION_SETTINGS =
322 "android.settings.APPLICATION_SETTINGS";
323
324 /**
325 * Activity Action: Show settings to allow configuration of application
326 * development-related settings.
327 * <p>
328 * In some cases, a matching Activity may not exist, so ensure you safeguard
329 * against this.
330 * <p>
331 * Input: Nothing.
332 * <p>
333 * Output: Nothing.
334 */
335 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
336 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
337 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
338
339 /**
340 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
341 * <p>
342 * In some cases, a matching Activity may not exist, so ensure you
343 * safeguard against this.
344 * <p>
345 * Input: Nothing.
346 * <p>
347 * Output: Nothing.
348 */
349 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
350 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
351 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700352
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800353 /**
354 * Activity Action: Show settings to manage installed applications.
355 * <p>
356 * In some cases, a matching Activity may not exist, so ensure you
357 * safeguard against this.
358 * <p>
359 * Input: Nothing.
360 * <p>
361 * Output: Nothing.
362 */
363 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
364 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
365 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700366
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800367 /**
Winson Chung44e8ff92010-09-27 14:36:52 -0700368 * Activity Action: Show settings to manage all applications.
369 * <p>
370 * In some cases, a matching Activity may not exist, so ensure you
371 * safeguard against this.
372 * <p>
373 * Input: Nothing.
374 * <p>
375 * Output: Nothing.
376 */
377 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
378 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
379 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
380
381 /**
Dianne Hackbornb7bb3b32010-06-06 22:47:50 -0700382 * Activity Action: Show screen of details about a particular application.
383 * <p>
384 * In some cases, a matching Activity may not exist, so ensure you
385 * safeguard against this.
386 * <p>
387 * Input: The Intent's data URI specifies the application package name
388 * to be shown, with the "package" scheme. That is "package:com.my.app".
389 * <p>
390 * Output: Nothing.
391 */
392 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
393 public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
394 "android.settings.APPLICATION_DETAILS_SETTINGS";
395
396 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800397 * Activity Action: Show settings for system update functionality.
398 * <p>
399 * In some cases, a matching Activity may not exist, so ensure you
400 * safeguard against this.
401 * <p>
402 * Input: Nothing.
403 * <p>
404 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700405 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 * @hide
407 */
408 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
409 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
410 "android.settings.SYSTEM_UPDATE_SETTINGS";
411
412 /**
413 * Activity Action: Show settings to allow configuration of sync settings.
414 * <p>
415 * In some cases, a matching Activity may not exist, so ensure you
416 * safeguard against this.
417 * <p>
Erikeebc8e22010-02-18 13:27:19 -0800418 * The account types available to add via the add account button may be restricted by adding an
419 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
420 * authorities. Only account types which can sync with that content provider will be offered to
421 * the user.
422 * <p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800423 * Input: Nothing.
424 * <p>
425 * Output: Nothing.
426 */
427 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
428 public static final String ACTION_SYNC_SETTINGS =
429 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700430
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800431 /**
Erikeebc8e22010-02-18 13:27:19 -0800432 * Activity Action: Show add account screen for creating a new account.
433 * <p>
434 * In some cases, a matching Activity may not exist, so ensure you
435 * safeguard against this.
436 * <p>
437 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
438 * extra to the Intent with one or more syncable content provider's authorities. Only account
439 * types which can sync with that content provider will be offered to the user.
440 * <p>
441 * Input: Nothing.
442 * <p>
443 * Output: Nothing.
444 */
445 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
446 public static final String ACTION_ADD_ACCOUNT =
447 "android.settings.ADD_ACCOUNT_SETTINGS";
448
449 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800450 * Activity Action: Show settings for selecting the network operator.
451 * <p>
452 * In some cases, a matching Activity may not exist, so ensure you
453 * safeguard against this.
454 * <p>
455 * Input: Nothing.
456 * <p>
457 * Output: Nothing.
458 */
459 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
460 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
461 "android.settings.NETWORK_OPERATOR_SETTINGS";
462
463 /**
464 * Activity Action: Show settings for selection of 2G/3G.
465 * <p>
466 * In some cases, a matching Activity may not exist, so ensure you
467 * safeguard against this.
468 * <p>
469 * Input: Nothing.
470 * <p>
471 * Output: Nothing.
472 */
473 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
474 public static final String ACTION_DATA_ROAMING_SETTINGS =
475 "android.settings.DATA_ROAMING_SETTINGS";
476
477 /**
478 * Activity Action: Show settings for internal storage.
479 * <p>
480 * In some cases, a matching Activity may not exist, so ensure you
481 * safeguard against this.
482 * <p>
483 * Input: Nothing.
484 * <p>
485 * Output: Nothing.
486 */
487 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
488 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
489 "android.settings.INTERNAL_STORAGE_SETTINGS";
490 /**
491 * Activity Action: Show settings for memory card storage.
492 * <p>
493 * In some cases, a matching Activity may not exist, so ensure you
494 * safeguard against this.
495 * <p>
496 * Input: Nothing.
497 * <p>
498 * Output: Nothing.
499 */
500 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
501 public static final String ACTION_MEMORY_CARD_SETTINGS =
502 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700503
Justin Mattsonef340352010-01-13 21:05:46 -0800504 /**
505 * Activity Action: Show settings for global search.
506 * <p>
507 * In some cases, a matching Activity may not exist, so ensure you
508 * safeguard against this.
509 * <p>
510 * Input: Nothing.
511 * <p>
512 * Output: Nothing
513 */
514 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
515 public static final String ACTION_SEARCH_SETTINGS =
516 "android.search.action.SEARCH_SETTINGS";
517
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500518 /**
519 * Activity Action: Show general device information settings (serial
520 * number, software version, phone number, etc.).
521 * <p>
522 * In some cases, a matching Activity may not exist, so ensure you
523 * safeguard against this.
524 * <p>
525 * Input: Nothing.
526 * <p>
527 * Output: Nothing
528 */
529 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
530 public static final String ACTION_DEVICE_INFO_SETTINGS =
531 "android.settings.DEVICE_INFO_SETTINGS";
532
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800533 // End of Intent actions for Settings
534
Erikeebc8e22010-02-18 13:27:19 -0800535 /**
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800536 * @hide - Private call() method on SettingsProvider to read from 'system' table.
537 */
538 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
539
540 /**
541 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
542 */
543 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
544
545 /**
Erikeebc8e22010-02-18 13:27:19 -0800546 * Activity Extra: Limit available options in launched activity based on the given authority.
547 * <p>
548 * This can be passed as an extra field in an Activity Intent with one or more syncable content
549 * provider's authorities as a String[]. This field is used by some intents to alter the
550 * behavior of the called activity.
551 * <p>
552 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
553 * on the authority given.
554 */
555 public static final String EXTRA_AUTHORITIES =
556 "authorities";
557
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800558 private static final String JID_RESOURCE_PREFIX = "android";
559
560 public static final String AUTHORITY = "settings";
561
562 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800563 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800564
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800565 public static class SettingNotFoundException extends AndroidException {
566 public SettingNotFoundException(String msg) {
567 super(msg);
568 }
569 }
570
571 /**
572 * Common base for tables of name/value settings.
573 */
574 public static class NameValueTable implements BaseColumns {
575 public static final String NAME = "name";
576 public static final String VALUE = "value";
577
578 protected static boolean putString(ContentResolver resolver, Uri uri,
579 String name, String value) {
580 // The database will take care of replacing duplicates.
581 try {
582 ContentValues values = new ContentValues();
583 values.put(NAME, name);
584 values.put(VALUE, value);
585 resolver.insert(uri, values);
586 return true;
587 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700588 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800589 return false;
590 }
591 }
592
593 public static Uri getUriFor(Uri uri, String name) {
594 return Uri.withAppendedPath(uri, name);
595 }
596 }
597
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800598 // Thread-safe.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800599 private static class NameValueCache {
600 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800601 private final Uri mUri;
602
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800603 private static final String[] SELECT_VALUE =
604 new String[] { Settings.NameValueTable.VALUE };
605 private static final String NAME_EQ_PLACEHOLDER = "name=?";
606
607 // Must synchronize on 'this' to access mValues and mValuesVersion.
Dan Egnor799f7212009-11-24 16:24:44 -0800608 private final HashMap<String, String> mValues = new HashMap<String, String>();
609 private long mValuesVersion = 0;
610
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800611 // Initially null; set lazily and held forever. Synchronized on 'this'.
612 private IContentProvider mContentProvider = null;
613
614 // The method we'll call (or null, to not use) on the provider
615 // for the fast path of retrieving settings.
616 private final String mCallCommand;
617
618 public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800619 mVersionSystemProperty = versionSystemProperty;
620 mUri = uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800621 mCallCommand = callCommand;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 }
623
Dan Egnor799f7212009-11-24 16:24:44 -0800624 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800626
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800627 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800628 if (mValuesVersion != newValuesVersion) {
629 if (LOCAL_LOGV) {
630 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
631 newValuesVersion + " != cached " + mValuesVersion);
632 }
633
634 mValues.clear();
635 mValuesVersion = newValuesVersion;
636 }
637
638 if (mValues.containsKey(name)) {
639 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800641 }
Dan Egnor799f7212009-11-24 16:24:44 -0800642
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800643 IContentProvider cp = null;
644 synchronized (this) {
645 cp = mContentProvider;
646 if (cp == null) {
647 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
648 }
649 }
650
651 // Try the fast path first, not using query(). If this
652 // fails (alternate Settings provider that doesn't support
653 // this interface?) then we fall back to the query/table
654 // interface.
655 if (mCallCommand != null) {
656 try {
657 Bundle b = cp.call(mCallCommand, name, null);
658 if (b != null) {
659 String value = b.getPairValue();
660 synchronized (this) {
661 mValues.put(name, value);
662 }
663 return value;
664 }
665 // If the response Bundle is null, we fall through
666 // to the query interface below.
667 } catch (RemoteException e) {
668 // Not supported by the remote side? Fall through
669 // to query().
670 }
671 }
672
Dan Egnor799f7212009-11-24 16:24:44 -0800673 Cursor c = null;
674 try {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800675 c = cp.query(mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
676 new String[]{name}, null);
Dan Egnor799f7212009-11-24 16:24:44 -0800677 if (c == null) {
678 Log.w(TAG, "Can't get key " + name + " from " + mUri);
679 return null;
680 }
681
682 String value = c.moveToNext() ? c.getString(0) : null;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800683 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800684 mValues.put(name, value);
685 }
686 if (LOCAL_LOGV) {
687 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
688 name + " = " + (value == null ? "(null)" : value));
689 }
690 return value;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800691 } catch (RemoteException e) {
Dan Egnor799f7212009-11-24 16:24:44 -0800692 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
693 return null; // Return null, but don't cache it.
694 } finally {
695 if (c != null) c.close();
696 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 }
698 }
699
700 /**
701 * System settings, containing miscellaneous system preferences. This
702 * table holds simple name/value pairs. There are convenience
703 * functions for accessing individual settings entries.
704 */
705 public static final class System extends NameValueTable {
706 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
707
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800708 // Populated lazily, guarded by class object:
709 private static NameValueCache sNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 private static final HashSet<String> MOVED_TO_SECURE;
712 static {
713 MOVED_TO_SECURE = new HashSet<String>(30);
714 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
715 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
716 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
717 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
718 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
719 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
720 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
721 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
Amith Yamasani156c4352010-03-05 17:10:03 -0800722 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
723 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
724 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800725 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
726 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
727 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
728 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
729 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
730 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
731 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
732 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
733 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
734 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
735 MOVED_TO_SECURE.add(Secure.WIFI_ON);
736 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
737 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
738 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
739 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
740 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
741 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
742 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
743 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
744 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
745 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
746 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
747 }
748
749 /**
750 * Look up a name in the database.
751 * @param resolver to access the database with
752 * @param name to look up in the table
753 * @return the corresponding value, or null if not present
754 */
755 public synchronized static String getString(ContentResolver resolver, String name) {
756 if (MOVED_TO_SECURE.contains(name)) {
757 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
758 + " to android.provider.Settings.Secure, returning read-only value.");
759 return Secure.getString(resolver, name);
760 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800761 if (sNameValueCache == null) {
762 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
763 CALL_METHOD_GET_SYSTEM);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800764 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800765 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800766 }
767
768 /**
769 * Store a name/value pair into the database.
770 * @param resolver to access the database with
771 * @param name to store
772 * @param value to associate with the name
773 * @return true if the value was set, false on database errors
774 */
775 public static boolean putString(ContentResolver resolver, String name, String value) {
776 if (MOVED_TO_SECURE.contains(name)) {
777 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
778 + " to android.provider.Settings.Secure, value is unchanged.");
779 return false;
780 }
781 return putString(resolver, CONTENT_URI, name, value);
782 }
783
784 /**
785 * Construct the content URI for a particular name/value pair,
786 * useful for monitoring changes with a ContentObserver.
787 * @param name to look up in the table
788 * @return the corresponding content URI, or null if not present
789 */
790 public static Uri getUriFor(String name) {
791 if (MOVED_TO_SECURE.contains(name)) {
792 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
793 + " to android.provider.Settings.Secure, returning Secure URI.");
794 return Secure.getUriFor(Secure.CONTENT_URI, name);
795 }
796 return getUriFor(CONTENT_URI, name);
797 }
798
799 /**
800 * Convenience function for retrieving a single system settings value
801 * as an integer. Note that internally setting values are always
802 * stored as strings; this function converts the string to an integer
803 * for you. The default value will be returned if the setting is
804 * not defined or not an integer.
805 *
806 * @param cr The ContentResolver to access.
807 * @param name The name of the setting to retrieve.
808 * @param def Value to return if the setting is not defined.
809 *
810 * @return The setting's current value, or 'def' if it is not defined
811 * or not a valid integer.
812 */
813 public static int getInt(ContentResolver cr, String name, int def) {
814 String v = getString(cr, name);
815 try {
816 return v != null ? Integer.parseInt(v) : def;
817 } catch (NumberFormatException e) {
818 return def;
819 }
820 }
821
822 /**
823 * Convenience function for retrieving a single system settings value
824 * as an integer. Note that internally setting values are always
825 * stored as strings; this function converts the string to an integer
826 * for you.
827 * <p>
828 * This version does not take a default value. If the setting has not
829 * been set, or the string value is not a number,
830 * it throws {@link SettingNotFoundException}.
831 *
832 * @param cr The ContentResolver to access.
833 * @param name The name of the setting to retrieve.
834 *
835 * @throws SettingNotFoundException Thrown if a setting by the given
836 * name can't be found or the setting value is not an integer.
837 *
838 * @return The setting's current value.
839 */
840 public static int getInt(ContentResolver cr, String name)
841 throws SettingNotFoundException {
842 String v = getString(cr, name);
843 try {
844 return Integer.parseInt(v);
845 } catch (NumberFormatException e) {
846 throw new SettingNotFoundException(name);
847 }
848 }
849
850 /**
851 * Convenience function for updating a single settings value as an
852 * integer. This will either create a new entry in the table if the
853 * given name does not exist, or modify the value of the existing row
854 * with that name. Note that internally setting values are always
855 * stored as strings, so this function converts the given value to a
856 * string before storing it.
857 *
858 * @param cr The ContentResolver to access.
859 * @param name The name of the setting to modify.
860 * @param value The new value for the setting.
861 * @return true if the value was set, false on database errors
862 */
863 public static boolean putInt(ContentResolver cr, String name, int value) {
864 return putString(cr, name, Integer.toString(value));
865 }
866
867 /**
868 * Convenience function for retrieving a single system settings value
869 * as a {@code long}. Note that internally setting values are always
870 * stored as strings; this function converts the string to a {@code long}
871 * for you. The default value will be returned if the setting is
872 * not defined or not a {@code long}.
873 *
874 * @param cr The ContentResolver to access.
875 * @param name The name of the setting to retrieve.
876 * @param def Value to return if the setting is not defined.
877 *
878 * @return The setting's current value, or 'def' if it is not defined
879 * or not a valid {@code long}.
880 */
881 public static long getLong(ContentResolver cr, String name, long def) {
882 String valString = getString(cr, name);
883 long value;
884 try {
885 value = valString != null ? Long.parseLong(valString) : def;
886 } catch (NumberFormatException e) {
887 value = def;
888 }
889 return value;
890 }
891
892 /**
893 * Convenience function for retrieving a single system settings value
894 * as a {@code long}. Note that internally setting values are always
895 * stored as strings; this function converts the string to a {@code long}
896 * for you.
897 * <p>
898 * This version does not take a default value. If the setting has not
899 * been set, or the string value is not a number,
900 * it throws {@link SettingNotFoundException}.
901 *
902 * @param cr The ContentResolver to access.
903 * @param name The name of the setting to retrieve.
904 *
905 * @return The setting's current value.
906 * @throws SettingNotFoundException Thrown if a setting by the given
907 * name can't be found or the setting value is not an integer.
908 */
909 public static long getLong(ContentResolver cr, String name)
910 throws SettingNotFoundException {
911 String valString = getString(cr, name);
912 try {
913 return Long.parseLong(valString);
914 } catch (NumberFormatException e) {
915 throw new SettingNotFoundException(name);
916 }
917 }
918
919 /**
920 * Convenience function for updating a single settings value as a long
921 * integer. This will either create a new entry in the table if the
922 * given name does not exist, or modify the value of the existing row
923 * with that name. Note that internally setting values are always
924 * stored as strings, so this function converts the given value to a
925 * string before storing it.
926 *
927 * @param cr The ContentResolver to access.
928 * @param name The name of the setting to modify.
929 * @param value The new value for the setting.
930 * @return true if the value was set, false on database errors
931 */
932 public static boolean putLong(ContentResolver cr, String name, long value) {
933 return putString(cr, name, Long.toString(value));
934 }
935
936 /**
937 * Convenience function for retrieving a single system settings value
938 * as a floating point number. Note that internally setting values are
939 * always stored as strings; this function converts the string to an
940 * float for you. The default value will be returned if the setting
941 * is not defined or not a valid float.
942 *
943 * @param cr The ContentResolver to access.
944 * @param name The name of the setting to retrieve.
945 * @param def Value to return if the setting is not defined.
946 *
947 * @return The setting's current value, or 'def' if it is not defined
948 * or not a valid float.
949 */
950 public static float getFloat(ContentResolver cr, String name, float def) {
951 String v = getString(cr, name);
952 try {
953 return v != null ? Float.parseFloat(v) : def;
954 } catch (NumberFormatException e) {
955 return def;
956 }
957 }
958
959 /**
960 * Convenience function for retrieving a single system settings value
961 * as a float. Note that internally setting values are always
962 * stored as strings; this function converts the string to a float
963 * for you.
964 * <p>
965 * This version does not take a default value. If the setting has not
966 * been set, or the string value is not a number,
967 * it throws {@link SettingNotFoundException}.
968 *
969 * @param cr The ContentResolver to access.
970 * @param name The name of the setting to retrieve.
971 *
972 * @throws SettingNotFoundException Thrown if a setting by the given
973 * name can't be found or the setting value is not a float.
974 *
975 * @return The setting's current value.
976 */
977 public static float getFloat(ContentResolver cr, String name)
978 throws SettingNotFoundException {
979 String v = getString(cr, name);
980 try {
981 return Float.parseFloat(v);
982 } catch (NumberFormatException e) {
983 throw new SettingNotFoundException(name);
984 }
985 }
986
987 /**
988 * Convenience function for updating a single settings value as a
989 * floating point number. This will either create a new entry in the
990 * table if the given name does not exist, or modify the value of the
991 * existing row with that name. Note that internally setting values
992 * are always stored as strings, so this function converts the given
993 * value to a string before storing it.
994 *
995 * @param cr The ContentResolver to access.
996 * @param name The name of the setting to modify.
997 * @param value The new value for the setting.
998 * @return true if the value was set, false on database errors
999 */
1000 public static boolean putFloat(ContentResolver cr, String name, float value) {
1001 return putString(cr, name, Float.toString(value));
1002 }
1003
1004 /**
1005 * Convenience function to read all of the current
1006 * configuration-related settings into a
1007 * {@link Configuration} object.
1008 *
1009 * @param cr The ContentResolver to access.
1010 * @param outConfig Where to place the configuration settings.
1011 */
1012 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
1013 outConfig.fontScale = Settings.System.getFloat(
1014 cr, FONT_SCALE, outConfig.fontScale);
1015 if (outConfig.fontScale < 0) {
1016 outConfig.fontScale = 1;
1017 }
1018 }
1019
1020 /**
1021 * Convenience function to write a batch of configuration-related
1022 * settings from a {@link Configuration} object.
1023 *
1024 * @param cr The ContentResolver to access.
1025 * @param config The settings to write.
1026 * @return true if the values were set, false on database errors
1027 */
1028 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
1029 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
1030 }
1031
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001032 /** @hide */
1033 public static boolean hasInterestingConfigurationChanges(int changes) {
1034 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1035 }
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07001036
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001037 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1038 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
1039 }
1040
1041 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1042 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
1043 }
1044
1045 /**
1046 * The content:// style URL for this table
1047 */
1048 public static final Uri CONTENT_URI =
1049 Uri.parse("content://" + AUTHORITY + "/system");
1050
1051 /**
1052 * Whether we keep the device on while the device is plugged in.
1053 * Supported values are:
1054 * <ul>
1055 * <li>{@code 0} to never stay on while plugged in</li>
1056 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
1057 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
1058 * </ul>
1059 * These values can be OR-ed together.
1060 */
1061 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
1062
1063 /**
1064 * What happens when the user presses the end call button if they're not
1065 * on a call.<br/>
1066 * <b>Values:</b><br/>
1067 * 0 - The end button does nothing.<br/>
1068 * 1 - The end button goes to the home screen.<br/>
1069 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1070 * 3 - The end button goes to the home screen. If the user is already on the
1071 * home screen, it puts the device to sleep.
1072 */
1073 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1074
1075 /**
David Brown458e8062010-03-08 21:52:11 -08001076 * END_BUTTON_BEHAVIOR value for "go home".
1077 * @hide
1078 */
1079 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1080
1081 /**
1082 * END_BUTTON_BEHAVIOR value for "go to sleep".
1083 * @hide
1084 */
1085 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1086
1087 /**
1088 * END_BUTTON_BEHAVIOR default value.
1089 * @hide
1090 */
1091 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1092
1093 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001094 * Whether Airplane Mode is on.
1095 */
1096 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
1097
1098 /**
1099 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
1100 */
1101 public static final String RADIO_BLUETOOTH = "bluetooth";
1102
1103 /**
1104 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
1105 */
1106 public static final String RADIO_WIFI = "wifi";
1107
1108 /**
1109 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
1110 */
1111 public static final String RADIO_CELL = "cell";
1112
1113 /**
1114 * A comma separated list of radios that need to be disabled when airplane mode
1115 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
1116 * included in the comma separated list.
1117 */
1118 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
1119
1120 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -07001121 * A comma separated list of radios that should to be disabled when airplane mode
1122 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
1123 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
1124 * will be turned off when entering airplane mode, but the user will be able to reenable
1125 * Wifi in the Settings app.
1126 *
1127 * {@hide}
1128 */
1129 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
1130
1131 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001132 * The policy for deciding when Wi-Fi should go to sleep (which will in
1133 * turn switch to using the mobile data as an Internet connection).
1134 * <p>
1135 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
1136 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
1137 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001138 */
1139 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
1140
1141 /**
1142 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
1143 * policy, which is to sleep shortly after the turning off
1144 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001145 */
1146 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
1147
1148 /**
1149 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
1150 * the device is on battery, and never go to sleep when the device is
1151 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001152 */
1153 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001154
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001155 /**
1156 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001157 */
1158 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001159
Irfan Sheriff31b62322010-08-30 12:26:00 -07001160 //TODO: deprecate static IP constants
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001161 /**
1162 * Whether to use static IP and other static network attributes.
1163 * <p>
1164 * Set to 1 for true and 0 for false.
1165 */
1166 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1167
1168 /**
1169 * The static IP address.
1170 * <p>
1171 * Example: "192.168.1.51"
1172 */
1173 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1174
1175 /**
1176 * If using static IP, the gateway's IP address.
1177 * <p>
1178 * Example: "192.168.1.1"
1179 */
1180 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1181
1182 /**
1183 * If using static IP, the net mask.
1184 * <p>
1185 * Example: "255.255.255.0"
1186 */
1187 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1188
1189 /**
1190 * If using static IP, the primary DNS's IP address.
1191 * <p>
1192 * Example: "192.168.1.1"
1193 */
1194 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1195
1196 /**
1197 * If using static IP, the secondary DNS's IP address.
1198 * <p>
1199 * Example: "192.168.1.2"
1200 */
1201 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1202
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203
1204 /**
1205 * Determines whether remote devices may discover and/or connect to
1206 * this device.
1207 * <P>Type: INT</P>
1208 * 2 -- discoverable and connectable
1209 * 1 -- connectable but not discoverable
1210 * 0 -- neither connectable nor discoverable
1211 */
1212 public static final String BLUETOOTH_DISCOVERABILITY =
1213 "bluetooth_discoverability";
1214
1215 /**
1216 * Bluetooth discoverability timeout. If this value is nonzero, then
1217 * Bluetooth becomes discoverable for a certain number of seconds,
1218 * after which is becomes simply connectable. The value is in seconds.
1219 */
1220 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1221 "bluetooth_discoverability_timeout";
1222
1223 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001224 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1225 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001226 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001227 @Deprecated
1228 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001229
1230 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001231 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1232 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001234 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001235 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1236
1237 /**
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07001238 * @deprecated Use
Amith Yamasani156c4352010-03-05 17:10:03 -08001239 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1240 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001241 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001242 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001243 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1244 "lock_pattern_tactile_feedback_enabled";
1245
1246
1247 /**
1248 * A formatted string of the next alarm that is set, or the empty string
1249 * if there is no alarm set.
1250 */
1251 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1252
1253 /**
1254 * Scaling factor for fonts, float.
1255 */
1256 public static final String FONT_SCALE = "font_scale";
1257
1258 /**
1259 * Name of an application package to be debugged.
1260 */
1261 public static final String DEBUG_APP = "debug_app";
1262
1263 /**
1264 * If 1, when launching DEBUG_APP it will wait for the debugger before
1265 * starting user code. If 0, it will run normally.
1266 */
1267 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1268
1269 /**
1270 * Whether or not to dim the screen. 0=no 1=yes
1271 */
1272 public static final String DIM_SCREEN = "dim_screen";
1273
1274 /**
1275 * The timeout before the screen turns off.
1276 */
1277 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1278
1279 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001280 * If 0, the compatibility mode is off for all applications.
1281 * If 1, older applications run under compatibility mode.
1282 * TODO: remove this settings before code freeze (bug/1907571)
1283 * @hide
1284 */
1285 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1286
1287 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288 * The screen backlight brightness between 0 and 255.
1289 */
1290 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1291
1292 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001293 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05001294 */
1295 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1296
1297 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001298 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001299 */
1300 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1301
1302 /**
1303 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001304 */
1305 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1306
1307 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001308 * Control whether the process CPU usage meter should be shown.
1309 */
1310 public static final String SHOW_PROCESSES = "show_processes";
1311
1312 /**
1313 * If 1, the activity manager will aggressively finish activities and
1314 * processes as soon as they are no longer needed. If 0, the normal
1315 * extended lifetime is used.
1316 */
1317 public static final String ALWAYS_FINISH_ACTIVITIES =
1318 "always_finish_activities";
1319
1320
1321 /**
1322 * Ringer mode. This is used internally, changing this value will not
1323 * change the ringer mode. See AudioManager.
1324 */
1325 public static final String MODE_RINGER = "mode_ringer";
1326
1327 /**
1328 * Determines which streams are affected by ringer mode changes. The
1329 * stream type's bit should be set to 1 if it should be muted when going
1330 * into an inaudible ringer mode.
1331 */
1332 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1333
1334 /**
1335 * Determines which streams are affected by mute. The
1336 * stream type's bit should be set to 1 if it should be muted when a mute request
1337 * is received.
1338 */
1339 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1340
1341 /**
1342 * Whether vibrate is on for different events. This is used internally,
1343 * changing this value will not change the vibrate. See AudioManager.
1344 */
1345 public static final String VIBRATE_ON = "vibrate_on";
1346
1347 /**
1348 * Ringer volume. This is used internally, changing this value will not
1349 * change the volume. See AudioManager.
1350 */
1351 public static final String VOLUME_RING = "volume_ring";
1352
1353 /**
1354 * System/notifications volume. This is used internally, changing this
1355 * value will not change the volume. See AudioManager.
1356 */
1357 public static final String VOLUME_SYSTEM = "volume_system";
1358
1359 /**
1360 * Voice call volume. This is used internally, changing this value will
1361 * not change the volume. See AudioManager.
1362 */
1363 public static final String VOLUME_VOICE = "volume_voice";
1364
1365 /**
1366 * Music/media/gaming volume. This is used internally, changing this
1367 * value will not change the volume. See AudioManager.
1368 */
1369 public static final String VOLUME_MUSIC = "volume_music";
1370
1371 /**
1372 * Alarm volume. This is used internally, changing this
1373 * value will not change the volume. See AudioManager.
1374 */
1375 public static final String VOLUME_ALARM = "volume_alarm";
1376
1377 /**
1378 * Notification volume. This is used internally, changing this
1379 * value will not change the volume. See AudioManager.
1380 */
1381 public static final String VOLUME_NOTIFICATION = "volume_notification";
1382
1383 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001384 * Bluetooth Headset volume. This is used internally, changing this value will
1385 * not change the volume. See AudioManager.
1386 */
1387 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1388
1389 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001390 * Whether the notifications should use the ring volume (value of 1) or
1391 * a separate notification volume (value of 0). In most cases, users
1392 * will have this enabled so the notification and ringer volumes will be
1393 * the same. However, power users can disable this and use the separate
1394 * notification volume control.
1395 * <p>
1396 * Note: This is a one-off setting that will be removed in the future
1397 * when there is profile support. For this reason, it is kept hidden
1398 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001399 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001400 * @hide
1401 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001402 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001403 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001404
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 /**
Daniel Sandler6329bf72010-02-26 15:17:44 -05001406 * Whether silent mode should allow vibration feedback. This is used
1407 * internally in AudioService and the Sound settings activity to
1408 * coordinate decoupling of vibrate and silent modes. This setting
1409 * will likely be removed in a future release with support for
1410 * audio/vibe feedback profiles.
1411 *
1412 * @hide
1413 */
1414 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1415
1416 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001417 * The mapping of stream type (integer) to its setting.
1418 */
1419 public static final String[] VOLUME_SETTINGS = {
1420 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001421 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 };
1423
1424 /**
1425 * Appended to various volume related settings to record the previous
1426 * values before they the settings were affected by a silent/vibrate
1427 * ringer mode change.
1428 */
1429 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1430
1431 /**
1432 * Persistent store for the system-wide default ringtone URI.
1433 * <p>
1434 * If you need to play the default ringtone at any given time, it is recommended
1435 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1436 * to the set default ringtone at the time of playing.
1437 *
1438 * @see #DEFAULT_RINGTONE_URI
1439 */
1440 public static final String RINGTONE = "ringtone";
1441
1442 /**
1443 * A {@link Uri} that will point to the current default ringtone at any
1444 * given time.
1445 * <p>
1446 * If the current default ringtone is in the DRM provider and the caller
1447 * does not have permission, the exception will be a
1448 * FileNotFoundException.
1449 */
1450 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1451
1452 /**
1453 * Persistent store for the system-wide default notification sound.
1454 *
1455 * @see #RINGTONE
1456 * @see #DEFAULT_NOTIFICATION_URI
1457 */
1458 public static final String NOTIFICATION_SOUND = "notification_sound";
1459
1460 /**
1461 * A {@link Uri} that will point to the current default notification
1462 * sound at any given time.
1463 *
1464 * @see #DEFAULT_RINGTONE_URI
1465 */
1466 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1467
1468 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001469 * Persistent store for the system-wide default alarm alert.
1470 *
1471 * @see #RINGTONE
1472 * @see #DEFAULT_ALARM_ALERT_URI
1473 */
1474 public static final String ALARM_ALERT = "alarm_alert";
1475
1476 /**
1477 * A {@link Uri} that will point to the current default alarm alert at
1478 * any given time.
1479 *
1480 * @see #DEFAULT_ALARM_ALERT_URI
1481 */
1482 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1483
1484 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001485 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1486 */
1487 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1488
1489 /**
1490 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1491 */
1492 public static final String TEXT_AUTO_CAPS = "auto_caps";
1493
1494 /**
1495 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1496 * feature converts two spaces to a "." and space.
1497 */
1498 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001499
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001500 /**
1501 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1502 */
1503 public static final String TEXT_SHOW_PASSWORD = "show_password";
1504
1505 public static final String SHOW_GTALK_SERVICE_STATUS =
1506 "SHOW_GTALK_SERVICE_STATUS";
1507
1508 /**
1509 * Name of activity to use for wallpaper on the home screen.
1510 */
1511 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1512
1513 /**
1514 * Value to specify if the user prefers the date, time and time zone
1515 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1516 */
1517 public static final String AUTO_TIME = "auto_time";
1518
1519 /**
Amith Yamasaniad450be2010-09-16 16:47:00 -07001520 * Value to specify if the user prefers the time zone
1521 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1522 */
1523 public static final String AUTO_TIME_ZONE = "auto_time_zone";
1524
1525 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001526 * Display times as 12 or 24 hours
1527 * 12
1528 * 24
1529 */
1530 public static final String TIME_12_24 = "time_12_24";
1531
1532 /**
1533 * Date format string
1534 * mm/dd/yyyy
1535 * dd/mm/yyyy
1536 * yyyy/mm/dd
1537 */
1538 public static final String DATE_FORMAT = "date_format";
1539
1540 /**
1541 * Whether the setup wizard has been run before (on first boot), or if
1542 * it still needs to be run.
1543 *
1544 * nonzero = it has been run in the past
1545 * 0 = it has not been run in the past
1546 */
1547 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1548
1549 /**
1550 * Scaling factor for normal window animations. Setting to 0 will disable window
1551 * animations.
1552 */
1553 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1554
1555 /**
1556 * Scaling factor for activity transition animations. Setting to 0 will disable window
1557 * animations.
1558 */
1559 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1560
1561 /**
1562 * Scaling factor for normal window animations. Setting to 0 will disable window
1563 * animations.
1564 * @hide
1565 */
1566 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1567
1568 /**
1569 * Control whether the accelerometer will be used to change screen
1570 * orientation. If 0, it will not be used unless explicitly requested
1571 * by the application; if 1, it will be used by default unless explicitly
1572 * disabled by the application.
1573 */
1574 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1575
1576 /**
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001577 * Default screen rotation when no other policy applies.
1578 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
1579 * preference, this rotation value will be used. Must be one of the
1580 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
1581 *
1582 * @see Display#getRotation
1583 */
1584 public static final String USER_ROTATION = "user_rotation";
1585
1586 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001587 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1588 * boolean (1 or 0).
1589 */
1590 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1591
1592 /**
David Kraused0f67152009-06-13 18:01:13 -05001593 * CDMA only settings
1594 * DTMF tone type played by the dialer when dialing.
1595 * 0 = Normal
1596 * 1 = Long
1597 * @hide
1598 */
1599 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1600
1601 /**
1602 * CDMA only settings
1603 * Emergency Tone 0 = Off
1604 * 1 = Alert
1605 * 2 = Vibrate
1606 * @hide
1607 */
1608 public static final String EMERGENCY_TONE = "emergency_tone";
1609
1610 /**
1611 * CDMA only settings
1612 * Whether the auto retry is enabled. The value is
1613 * boolean (1 or 0).
1614 * @hide
1615 */
1616 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1617
1618 /**
1619 * Whether the hearing aid is enabled. The value is
1620 * boolean (1 or 0).
1621 * @hide
1622 */
1623 public static final String HEARING_AID = "hearing_aid";
1624
1625 /**
1626 * CDMA only settings
1627 * TTY Mode
1628 * 0 = OFF
1629 * 1 = FULL
1630 * 2 = VCO
1631 * 3 = HCO
1632 * @hide
1633 */
1634 public static final String TTY_MODE = "tty_mode";
1635
1636 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001637 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1638 * boolean (1 or 0).
1639 */
1640 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001642 /**
1643 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1644 * boolean (1 or 0).
1645 */
1646 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001647
Mike LeBeau48603e72009-06-05 00:27:00 +01001648 /**
Bjorn Bringert24abb662010-09-21 12:21:18 +01001649 * @deprecated Each application that shows web suggestions should have its own
1650 * setting for this.
Mike LeBeau48603e72009-06-05 00:27:00 +01001651 */
Bjorn Bringert24abb662010-09-21 12:21:18 +01001652 @Deprecated
Mike LeBeau48603e72009-06-05 00:27:00 +01001653 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001654
-b master501eec92009-07-06 13:53:11 -07001655 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001656 * Whether the notification LED should repeatedly flash when a notification is
1657 * pending. The value is boolean (1 or 0).
1658 * @hide
1659 */
1660 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1661
1662 /**
Dianne Hackborn90d2db32010-02-11 22:19:06 -08001663 * Show pointer location on screen?
1664 * 0 = no
1665 * 1 = yes
1666 * @hide
1667 */
1668 public static final String POINTER_LOCATION = "pointer_location";
1669
1670 /**
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05001671 * Whether to play a sound for low-battery alerts.
1672 * @hide
1673 */
1674 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1675
1676 /**
1677 * Whether to play a sound for dock events.
1678 * @hide
1679 */
1680 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1681
1682 /**
1683 * Whether to play sounds when the keyguard is shown and dismissed.
1684 * @hide
1685 */
1686 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1687
1688 /**
1689 * URI for the low battery sound file.
1690 * @hide
1691 */
1692 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1693
1694 /**
1695 * URI for the desk dock "in" event sound.
1696 * @hide
1697 */
1698 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1699
1700 /**
1701 * URI for the desk dock "out" event sound.
1702 * @hide
1703 */
1704 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1705
1706 /**
1707 * URI for the car dock "in" event sound.
1708 * @hide
1709 */
1710 public static final String CAR_DOCK_SOUND = "car_dock_sound";
1711
1712 /**
1713 * URI for the car dock "out" event sound.
1714 * @hide
1715 */
1716 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1717
1718 /**
1719 * URI for the "device locked" (keyguard shown) sound.
1720 * @hide
1721 */
1722 public static final String LOCK_SOUND = "lock_sound";
1723
1724 /**
1725 * URI for the "device unlocked" (keyguard dismissed) sound.
1726 * @hide
1727 */
1728 public static final String UNLOCK_SOUND = "unlock_sound";
1729
1730 /**
Mike Lockwoodeabe8bf2010-08-31 14:35:23 -04001731 * True if we should appear as a PTP device instead of MTP.
1732 * @hide
1733 */
1734 public static final String USE_PTP_INTERFACE = "use_ptp_interface";
1735
1736 /**
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08001737 * Receive incoming SIP calls?
1738 * 0 = no
1739 * 1 = yes
1740 * @hide
1741 */
1742 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
1743
1744 /**
1745 * Call Preference String.
1746 * "SIP_ALWAYS" : Always use SIP with network access
1747 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
1748 * "SIP_ASK_ME_EACH_TIME" : Always ask me each time
1749 * @hide
1750 */
1751 public static final String SIP_CALL_OPTIONS = "sip_call_options";
1752
1753 /**
1754 * One of the sip call options: Always use SIP with network access.
1755 * @hide
1756 */
1757 public static final String SIP_ALWAYS = "SIP_ALWAYS";
1758
1759 /**
1760 * One of the sip call options: Only if destination is a SIP address.
1761 * @hide
1762 */
1763 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
1764
1765 /**
1766 * One of the sip call options: Always ask me each time.
1767 * @hide
1768 */
1769 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
1770
1771 /**
-b master501eec92009-07-06 13:53:11 -07001772 * Settings to backup. This is here so that it's in the same place as the settings
1773 * keys and easy to update.
1774 * @hide
1775 */
1776 public static final String[] SETTINGS_TO_BACKUP = {
1777 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001778 WIFI_SLEEP_POLICY,
1779 WIFI_USE_STATIC_IP,
1780 WIFI_STATIC_IP,
1781 WIFI_STATIC_GATEWAY,
1782 WIFI_STATIC_NETMASK,
1783 WIFI_STATIC_DNS1,
1784 WIFI_STATIC_DNS2,
1785 BLUETOOTH_DISCOVERABILITY,
1786 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1787 DIM_SCREEN,
1788 SCREEN_OFF_TIMEOUT,
1789 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001790 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001791 VIBRATE_ON,
1792 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001793 MODE_RINGER,
1794 MODE_RINGER_STREAMS_AFFECTED,
1795 MUTE_STREAMS_AFFECTED,
1796 VOLUME_VOICE,
1797 VOLUME_SYSTEM,
1798 VOLUME_RING,
1799 VOLUME_MUSIC,
1800 VOLUME_ALARM,
1801 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001802 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001803 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1804 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1805 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1806 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1807 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1808 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001809 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
Daniel Sandler1c7fa482010-03-10 09:45:01 -05001810 VIBRATE_IN_SILENT,
-b master501eec92009-07-06 13:53:11 -07001811 TEXT_AUTO_REPLACE,
1812 TEXT_AUTO_CAPS,
1813 TEXT_AUTO_PUNCTUATE,
1814 TEXT_SHOW_PASSWORD,
1815 AUTO_TIME,
Amith Yamasaniad450be2010-09-16 16:47:00 -07001816 AUTO_TIME_ZONE,
-b master501eec92009-07-06 13:53:11 -07001817 TIME_12_24,
1818 DATE_FORMAT,
1819 ACCELEROMETER_ROTATION,
Daniel Sandlerb73617d2010-08-17 00:41:00 -04001820 USER_ROTATION,
-b master501eec92009-07-06 13:53:11 -07001821 DTMF_TONE_WHEN_DIALING,
1822 DTMF_TONE_TYPE_WHEN_DIALING,
1823 EMERGENCY_TONE,
1824 CALL_AUTO_RETRY,
1825 HEARING_AID,
1826 TTY_MODE,
1827 SOUND_EFFECTS_ENABLED,
1828 HAPTIC_FEEDBACK_ENABLED,
Christopher Tate14c2d792010-02-25 16:49:44 -08001829 POWER_SOUNDS_ENABLED,
1830 DOCK_SOUNDS_ENABLED,
1831 LOCKSCREEN_SOUNDS_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001832 SHOW_WEB_SUGGESTIONS,
Mike Lockwoodeabe8bf2010-08-31 14:35:23 -04001833 NOTIFICATION_LIGHT_PULSE,
1834 USE_PTP_INTERFACE,
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08001835 SIP_CALL_OPTIONS,
Nick Pelly038cabe2010-09-23 16:12:11 -07001836 SIP_RECEIVE_CALLS,
-b master501eec92009-07-06 13:53:11 -07001837 };
1838
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001839 // Settings moved to Settings.Secure
1840
1841 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001842 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001843 * instead
1844 */
1845 @Deprecated
1846 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1847
1848 /**
1849 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1850 */
1851 @Deprecated
1852 public static final String ANDROID_ID = Secure.ANDROID_ID;
1853
1854 /**
1855 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1856 */
1857 @Deprecated
1858 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1859
1860 /**
1861 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1862 */
1863 @Deprecated
1864 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1865
1866 /**
1867 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1868 */
1869 @Deprecated
1870 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1871
1872 /**
1873 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1874 */
1875 @Deprecated
1876 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1877
1878 /**
1879 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1880 */
1881 @Deprecated
1882 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001883
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001884 /**
1885 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1886 * instead
1887 */
1888 @Deprecated
1889 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1890
1891 /**
1892 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1893 */
1894 @Deprecated
1895 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001896
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001897 /**
1898 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1899 */
1900 @Deprecated
1901 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1902
1903 /**
1904 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1905 * instead
1906 */
1907 @Deprecated
1908 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1909
1910 /**
1911 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1912 * instead
1913 */
1914 @Deprecated
1915 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1916
1917 /**
1918 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1919 * instead
1920 */
1921 @Deprecated
1922 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1923 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1924
1925 /**
1926 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1927 */
1928 @Deprecated
1929 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1930
1931 /**
1932 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1933 */
1934 @Deprecated
1935 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001936
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001937 /**
1938 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1939 */
1940 @Deprecated
1941 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1942
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001943 /**
1944 * @deprecated Use
1945 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1946 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001947 @Deprecated
1948 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1949
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001950 /**
1951 * @deprecated Use
1952 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1953 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001954 @Deprecated
1955 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1956 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1957
1958 /**
1959 * @deprecated Use
1960 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1961 */
1962 @Deprecated
1963 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1964 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1965
1966 /**
1967 * @deprecated Use
1968 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1969 */
1970 @Deprecated
1971 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1972 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001973
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001974 /**
1975 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1976 * instead
1977 */
1978 @Deprecated
1979 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1980
1981 /**
1982 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1983 */
1984 @Deprecated
1985 public static final String WIFI_ON = Secure.WIFI_ON;
1986
1987 /**
1988 * @deprecated Use
1989 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1990 * instead
1991 */
1992 @Deprecated
1993 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1994 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1995
1996 /**
1997 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1998 */
1999 @Deprecated
2000 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
2001
2002 /**
2003 * @deprecated Use
2004 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
2005 */
2006 @Deprecated
2007 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2008 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002009
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002010 /**
2011 * @deprecated Use
2012 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
2013 */
2014 @Deprecated
2015 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2016 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
2017
2018 /**
2019 * @deprecated Use
2020 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
2021 * instead
2022 */
2023 @Deprecated
2024 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2025 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
2026
2027 /**
2028 * @deprecated Use
2029 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
2030 */
2031 @Deprecated
2032 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2033 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
2034
2035 /**
2036 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
2037 * instead
2038 */
2039 @Deprecated
2040 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
2041
2042 /**
2043 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
2044 */
2045 @Deprecated
2046 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
2047
2048 /**
2049 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
2050 */
2051 @Deprecated
2052 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
2053
2054 /**
2055 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
2056 * instead
2057 */
2058 @Deprecated
2059 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
2060
2061 /**
2062 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
2063 * instead
2064 */
2065 @Deprecated
2066 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
2067 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
2068 }
2069
2070 /**
2071 * Secure system settings, containing system preferences that applications
2072 * can read but are not allowed to write. These are for preferences that
2073 * the user must explicitly modify through the system UI or specialized
2074 * APIs for those values, not modified directly by applications.
2075 */
2076 public static final class Secure extends NameValueTable {
2077 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
2078
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002079 // Populated lazily, guarded by class object:
2080 private static NameValueCache sNameValueCache = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081
2082 /**
2083 * Look up a name in the database.
2084 * @param resolver to access the database with
2085 * @param name to look up in the table
2086 * @return the corresponding value, or null if not present
2087 */
2088 public synchronized static String getString(ContentResolver resolver, String name) {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002089 if (sNameValueCache == null) {
2090 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
2091 CALL_METHOD_GET_SECURE);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002092 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002093 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094 }
2095
2096 /**
2097 * Store a name/value pair into the database.
2098 * @param resolver to access the database with
2099 * @param name to store
2100 * @param value to associate with the name
2101 * @return true if the value was set, false on database errors
2102 */
2103 public static boolean putString(ContentResolver resolver,
2104 String name, String value) {
2105 return putString(resolver, CONTENT_URI, name, value);
2106 }
2107
2108 /**
2109 * Construct the content URI for a particular name/value pair,
2110 * useful for monitoring changes with a ContentObserver.
2111 * @param name to look up in the table
2112 * @return the corresponding content URI, or null if not present
2113 */
2114 public static Uri getUriFor(String name) {
2115 return getUriFor(CONTENT_URI, name);
2116 }
2117
2118 /**
2119 * Convenience function for retrieving a single secure settings value
2120 * as an integer. Note that internally setting values are always
2121 * stored as strings; this function converts the string to an integer
2122 * for you. The default value will be returned if the setting is
2123 * not defined or not an integer.
2124 *
2125 * @param cr The ContentResolver to access.
2126 * @param name The name of the setting to retrieve.
2127 * @param def Value to return if the setting is not defined.
2128 *
2129 * @return The setting's current value, or 'def' if it is not defined
2130 * or not a valid integer.
2131 */
2132 public static int getInt(ContentResolver cr, String name, int def) {
2133 String v = getString(cr, name);
2134 try {
2135 return v != null ? Integer.parseInt(v) : def;
2136 } catch (NumberFormatException e) {
2137 return def;
2138 }
2139 }
2140
2141 /**
2142 * Convenience function for retrieving a single secure settings value
2143 * as an integer. Note that internally setting values are always
2144 * stored as strings; this function converts the string to an integer
2145 * for you.
2146 * <p>
2147 * This version does not take a default value. If the setting has not
2148 * been set, or the string value is not a number,
2149 * it throws {@link SettingNotFoundException}.
2150 *
2151 * @param cr The ContentResolver to access.
2152 * @param name The name of the setting to retrieve.
2153 *
2154 * @throws SettingNotFoundException Thrown if a setting by the given
2155 * name can't be found or the setting value is not an integer.
2156 *
2157 * @return The setting's current value.
2158 */
2159 public static int getInt(ContentResolver cr, String name)
2160 throws SettingNotFoundException {
2161 String v = getString(cr, name);
2162 try {
2163 return Integer.parseInt(v);
2164 } catch (NumberFormatException e) {
2165 throw new SettingNotFoundException(name);
2166 }
2167 }
2168
2169 /**
2170 * Convenience function for updating a single settings value as an
2171 * integer. This will either create a new entry in the table if the
2172 * given name does not exist, or modify the value of the existing row
2173 * with that name. Note that internally setting values are always
2174 * stored as strings, so this function converts the given value to a
2175 * string before storing it.
2176 *
2177 * @param cr The ContentResolver to access.
2178 * @param name The name of the setting to modify.
2179 * @param value The new value for the setting.
2180 * @return true if the value was set, false on database errors
2181 */
2182 public static boolean putInt(ContentResolver cr, String name, int value) {
2183 return putString(cr, name, Integer.toString(value));
2184 }
2185
2186 /**
2187 * Convenience function for retrieving a single secure settings value
2188 * as a {@code long}. Note that internally setting values are always
2189 * stored as strings; this function converts the string to a {@code long}
2190 * for you. The default value will be returned if the setting is
2191 * not defined or not a {@code long}.
2192 *
2193 * @param cr The ContentResolver to access.
2194 * @param name The name of the setting to retrieve.
2195 * @param def Value to return if the setting is not defined.
2196 *
2197 * @return The setting's current value, or 'def' if it is not defined
2198 * or not a valid {@code long}.
2199 */
2200 public static long getLong(ContentResolver cr, String name, long def) {
2201 String valString = getString(cr, name);
2202 long value;
2203 try {
2204 value = valString != null ? Long.parseLong(valString) : def;
2205 } catch (NumberFormatException e) {
2206 value = def;
2207 }
2208 return value;
2209 }
2210
2211 /**
2212 * Convenience function for retrieving a single secure settings value
2213 * as a {@code long}. Note that internally setting values are always
2214 * stored as strings; this function converts the string to a {@code long}
2215 * for you.
2216 * <p>
2217 * This version does not take a default value. If the setting has not
2218 * been set, or the string value is not a number,
2219 * it throws {@link SettingNotFoundException}.
2220 *
2221 * @param cr The ContentResolver to access.
2222 * @param name The name of the setting to retrieve.
2223 *
2224 * @return The setting's current value.
2225 * @throws SettingNotFoundException Thrown if a setting by the given
2226 * name can't be found or the setting value is not an integer.
2227 */
2228 public static long getLong(ContentResolver cr, String name)
2229 throws SettingNotFoundException {
2230 String valString = getString(cr, name);
2231 try {
2232 return Long.parseLong(valString);
2233 } catch (NumberFormatException e) {
2234 throw new SettingNotFoundException(name);
2235 }
2236 }
2237
2238 /**
2239 * Convenience function for updating a secure settings value as a long
2240 * integer. This will either create a new entry in the table if the
2241 * given name does not exist, or modify the value of the existing row
2242 * with that name. Note that internally setting values are always
2243 * stored as strings, so this function converts the given value to a
2244 * string before storing it.
2245 *
2246 * @param cr The ContentResolver to access.
2247 * @param name The name of the setting to modify.
2248 * @param value The new value for the setting.
2249 * @return true if the value was set, false on database errors
2250 */
2251 public static boolean putLong(ContentResolver cr, String name, long value) {
2252 return putString(cr, name, Long.toString(value));
2253 }
2254
2255 /**
2256 * Convenience function for retrieving a single secure settings value
2257 * as a floating point number. Note that internally setting values are
2258 * always stored as strings; this function converts the string to an
2259 * float for you. The default value will be returned if the setting
2260 * is not defined or not a valid float.
2261 *
2262 * @param cr The ContentResolver to access.
2263 * @param name The name of the setting to retrieve.
2264 * @param def Value to return if the setting is not defined.
2265 *
2266 * @return The setting's current value, or 'def' if it is not defined
2267 * or not a valid float.
2268 */
2269 public static float getFloat(ContentResolver cr, String name, float def) {
2270 String v = getString(cr, name);
2271 try {
2272 return v != null ? Float.parseFloat(v) : def;
2273 } catch (NumberFormatException e) {
2274 return def;
2275 }
2276 }
2277
2278 /**
2279 * Convenience function for retrieving a single secure settings value
2280 * as a float. Note that internally setting values are always
2281 * stored as strings; this function converts the string to a float
2282 * for you.
2283 * <p>
2284 * This version does not take a default value. If the setting has not
2285 * been set, or the string value is not a number,
2286 * it throws {@link SettingNotFoundException}.
2287 *
2288 * @param cr The ContentResolver to access.
2289 * @param name The name of the setting to retrieve.
2290 *
2291 * @throws SettingNotFoundException Thrown if a setting by the given
2292 * name can't be found or the setting value is not a float.
2293 *
2294 * @return The setting's current value.
2295 */
2296 public static float getFloat(ContentResolver cr, String name)
2297 throws SettingNotFoundException {
2298 String v = getString(cr, name);
2299 try {
2300 return Float.parseFloat(v);
2301 } catch (NumberFormatException e) {
2302 throw new SettingNotFoundException(name);
2303 }
2304 }
2305
2306 /**
2307 * Convenience function for updating a single settings value as a
2308 * floating point number. This will either create a new entry in the
2309 * table if the given name does not exist, or modify the value of the
2310 * existing row with that name. Note that internally setting values
2311 * are always stored as strings, so this function converts the given
2312 * value to a string before storing it.
2313 *
2314 * @param cr The ContentResolver to access.
2315 * @param name The name of the setting to modify.
2316 * @param value The new value for the setting.
2317 * @return true if the value was set, false on database errors
2318 */
2319 public static boolean putFloat(ContentResolver cr, String name, float value) {
2320 return putString(cr, name, Float.toString(value));
2321 }
2322
2323 /**
2324 * The content:// style URL for this table
2325 */
2326 public static final Uri CONTENT_URI =
2327 Uri.parse("content://" + AUTHORITY + "/secure");
2328
2329 /**
2330 * Whether ADB is enabled.
2331 */
2332 public static final String ADB_ENABLED = "adb_enabled";
2333
2334 /**
2335 * Setting to allow mock locations and location provider status to be injected into the
2336 * LocationManager service for testing purposes during application development. These
2337 * locations and status values override actual location and status information generated
2338 * by network, gps, or other location providers.
2339 */
2340 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2341
2342 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08002343 * A 64-bit number (as a hex string) that is randomly
2344 * generated on the device's first boot and should remain
2345 * constant for the lifetime of the device. (The value may
2346 * change if a factory reset is performed on the device.)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002347 */
2348 public static final String ANDROID_ID = "android_id";
2349
2350 /**
2351 * Whether bluetooth is enabled/disabled
2352 * 0=disabled. 1=enabled.
2353 */
2354 public static final String BLUETOOTH_ON = "bluetooth_on";
2355
2356 /**
2357 * Get the key that retrieves a bluetooth headset's priority.
2358 * @hide
2359 */
2360 public static final String getBluetoothHeadsetPriorityKey(String address) {
2361 return ("bluetooth_headset_priority_" + address.toUpperCase());
2362 }
2363
2364 /**
2365 * Get the key that retrieves a bluetooth a2dp sink's priority.
2366 * @hide
2367 */
2368 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2369 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2370 }
2371
2372 /**
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07002373 * Get the key that retrieves a bluetooth Input Device's priority.
2374 * @hide
2375 */
2376 public static final String getBluetoothInputDevicePriorityKey(String address) {
2377 return ("bluetooth_input_device_priority_" + address.toUpperCase());
2378 }
2379
2380 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002381 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2382 */
2383 public static final String DATA_ROAMING = "data_roaming";
2384
2385 /**
2386 * Setting to record the input method used by default, holding the ID
2387 * of the desired method.
2388 */
2389 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2390
2391 /**
satokab751aa2010-09-14 19:17:36 +09002392 * Setting to record the input method subtype used by default, holding the ID
2393 * of the desired method.
2394 */
2395 public static final String SELECTED_INPUT_METHOD_SUBTYPE =
2396 "selected_input_method_subtype";
2397
2398 /**
satok723a27e2010-11-11 14:58:11 +09002399 * Setting to record the history of input method subtype, holding the pair of ID of IME
2400 * and its last used subtype.
2401 * @hide
2402 */
2403 public static final String INPUT_METHODS_SUBTYPE_HISTORY =
2404 "input_methods_subtype_history";
2405
2406 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002407 * Whether the device has been provisioned (0 = false, 1 = true)
2408 */
2409 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002410
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002411 /**
2412 * List of input methods that are currently enabled. This is a string
2413 * containing the IDs of all enabled input methods, each ID separated
2414 * by ':'.
2415 */
2416 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 /**
Amith Yamasanie861ec12010-03-24 21:39:27 -07002419 * List of system input methods that are currently disabled. This is a string
2420 * containing the IDs of all disabled input methods, each ID separated
2421 * by ':'.
2422 * @hide
2423 */
2424 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
2425
2426 /**
Robert Greenwalt434203a2010-10-11 16:00:27 -07002427 * Host name and port for global http proxy. Uses ':' seperator for between host and port
2428 * TODO - deprecate in favor of global_http_proxy_host, etc
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002429 */
2430 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002431
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002432 /**
Robert Greenwalt434203a2010-10-11 16:00:27 -07002433 * Host name for global http proxy. Set via ConnectivityManager.
2434 * @hide
2435 */
2436 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
2437
2438 /**
2439 * Integer host port for global http proxy. Set via ConnectivityManager.
2440 * @hide
2441 */
2442 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
2443
2444 /**
Oscar Montemayor16fb7912010-08-02 09:38:48 -07002445 * Exclusion list for global proxy. This string contains a list of comma-separated
2446 * domains where the global proxy does not apply. Domains should be listed in a comma-
2447 * separated list. Example of acceptable formats: ".domain1.com,my.domain2.com"
Robert Greenwalt434203a2010-10-11 16:00:27 -07002448 * Use ConnectivityManager to set/get.
Oscar Montemayor16fb7912010-08-02 09:38:48 -07002449 * @hide
2450 */
Robert Greenwalt434203a2010-10-11 16:00:27 -07002451 public static final String GLOBAL_HTTP_PROXY_EXCLUSION_LIST =
2452 "global_http_proxy_exclusion_list";
Oscar Montemayor16fb7912010-08-02 09:38:48 -07002453
2454 /**
2455 * Enables the UI setting to allow the user to specify the global HTTP proxy
2456 * and associated exclusion list.
2457 * @hide
2458 */
2459 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
2460
2461 /**
Robert Greenwalte90aa5e2010-09-01 11:34:05 -07002462 * Setting for default DNS in case nobody suggests one
2463 * @hide
2464 */
2465 public static final String DEFAULT_DNS_SERVER = "default_dns_server";
2466
2467 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002468 * Whether the package installer should allow installation of apps downloaded from
2469 * sources other than the Android Market (vending machine).
2470 *
2471 * 1 = allow installing from other sources
2472 * 0 = only allow installing from the Android Market
2473 */
2474 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002475
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002476 /**
2477 * Comma-separated list of location providers that activities may access.
2478 */
2479 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002480
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002481 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08002482 * Whether autolock is enabled (0 = false, 1 = true)
2483 */
2484 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
2485
2486 /**
2487 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
2488 */
2489 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2490
2491 /**
2492 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
2493 */
2494 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2495 "lock_pattern_tactile_feedback_enabled";
2496
2497 /**
Jim Millerbc4603b2010-08-30 21:21:34 -07002498 * This preference allows the device to be locked given time after screen goes off,
2499 * subject to current DeviceAdmin policy limits.
2500 * @hide
2501 */
2502 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
2503
2504
2505 /**
Jim Miller253a5ef2010-10-13 20:57:29 -07002506 * This preference contains the string that shows for owner info on LockScren.
2507 * @hide
2508 */
2509 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
2510
2511 /**
2512 * This preference enables showing the owner info on LockScren.
2513 * @hide
2514 */
2515 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
2516 "lock_screen_owner_info_enabled";
2517
2518 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002519 * Whether assisted GPS should be enabled or not.
2520 * @hide
2521 */
2522 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2523
2524 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002525 * The Logging ID (a unique 64-bit value) as a hex string.
2526 * Used as a pseudonymous identifier for logging.
2527 * @deprecated This identifier is poorly initialized and has
2528 * many collisions. It should not be used.
2529 */
2530 @Deprecated
2531 public static final String LOGGING_ID = "logging_id";
2532
2533 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002534 * User preference for which network(s) should be used. Only the
2535 * connectivity service should touch this.
2536 */
2537 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002538
2539 /**
Robert Greenwalt2a091d72010-02-11 18:18:40 -08002540 * Used to disable Tethering on a device - defaults to true
2541 * @hide
2542 */
2543 public static final String TETHER_SUPPORTED = "tether_supported";
2544
2545 /**
Robert Greenwalt77b32dd2010-06-03 18:57:26 -07002546 * Used to require DUN APN on the device or not - defaults to a build config value
2547 * which defaults to false
2548 * @hide
2549 */
2550 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2551
2552 /**
2553 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
2554 * corresponding build config values are set it will override the APN DB
2555 * values.
2556 * Consists of a comma seperated list of strings:
2557 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2558 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2559 * @hide
2560 */
2561 public static final String TETHER_DUN_APN = "tether_dun_apn";
2562
2563 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002564 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002565 */
2566 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002567
2568 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002569 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002570 */
2571 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002572
2573 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002574 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002575 */
2576 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002577
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002578 /**
Brad Fitzpatrickd7ad0d22010-12-02 15:30:23 -08002579 * A positive value indicates how often the SamplingProfiler
2580 * should take snapshots. Zero value means SamplingProfiler
2581 * is disabled.
Sen Hubde75702010-05-28 01:54:03 -07002582 *
2583 * @hide
2584 */
Brad Fitzpatrickd7ad0d22010-12-02 15:30:23 -08002585 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
Sen Hubde75702010-05-28 01:54:03 -07002586
2587 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002588 * Settings classname to launch when Settings is clicked from All
2589 * Applications. Needed because of user testing between the old
2590 * and new Settings apps.
2591 */
2592 // TODO: 881807
2593 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002594
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002595 /**
2596 * USB Mass Storage Enabled
2597 */
2598 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002599
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002600 /**
2601 * If this setting is set (to anything), then all references
2602 * to Gmail on the device must change to Google Mail.
2603 */
2604 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002606 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002607 * If accessibility is enabled.
2608 */
2609 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2610
2611 /**
2612 * List of the enabled accessibility providers.
2613 */
2614 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2615 "enabled_accessibility_services";
2616
2617 /**
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07002618 * If injection of accessibility enhancing JavaScript scripts
2619 * is enabled.
2620 * <p>
2621 * Note: Accessibility injecting scripts are served by the
2622 * Google infrastructure and enable users with disabilities to
2623 * efficiantly navigate in and explore web content.
2624 * </p>
2625 * <p>
2626 * This property represents a boolean value.
2627 * </p>
2628 * @hide
2629 */
2630 public static final String ACCESSIBILITY_SCRIPT_INJECTION =
2631 "accessibility_script_injection";
2632
2633 /**
2634 * Key bindings for navigation in built-in accessibility support for web content.
2635 * <p>
2636 * Note: These key bindings are for the built-in accessibility navigation for
2637 * web content which is used as a fall back solution if JavaScript in a WebView
2638 * is not enabled or the user has not opted-in script injection from Google.
2639 * </p>
2640 * <p>
2641 * The bindings are separated by semi-colon. A binding is a mapping from
2642 * a key to a sequence of actions (for more details look at
2643 * android.webkit.AccessibilityInjector). A key is represented as the hexademical
2644 * string representation of an integer obtained from a meta state (optional) shifted
2645 * sixteen times left and bitwise ored with a key code. An action is represented
2646 * as a hexademical string representation of an integer where the first two digits
2647 * are navigation action index, the second, the third, and the fourth digit pairs
2648 * represent the action arguments. The separate actions in a binding are colon
2649 * separated. The key and the action sequence it maps to are separated by equals.
2650 * </p>
2651 * <p>
2652 * For example, the binding below maps the DPAD right button to traverse the
2653 * current navigation axis once without firing an accessibility event and to
2654 * perform the same traversal again but to fire an event:
2655 * <code>
2656 * 0x16=0x01000100:0x01000101;
2657 * </code>
2658 * </p>
2659 * <p>
2660 * The goal of this binding is to enable dynamic rebinding of keys to
2661 * navigation actions for web content without requiring a framework change.
2662 * </p>
2663 * <p>
2664 * This property represents a string value.
2665 * </p>
2666 * @hide
2667 */
2668 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
2669 "accessibility_web_content_key_bindings";
2670
2671 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002672 * Setting to always use the default text-to-speech settings regardless
2673 * of the application settings.
2674 * 1 = override application settings,
2675 * 0 = use application settings (if specified).
2676 */
2677 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2678
2679 /**
2680 * Default text-to-speech engine speech rate. 100 = 1x
2681 */
2682 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2683
2684 /**
2685 * Default text-to-speech engine pitch. 100 = 1x
2686 */
2687 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2688
2689 /**
2690 * Default text-to-speech engine.
2691 */
2692 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2693
2694 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002695 * Default text-to-speech language.
2696 */
2697 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2698
2699 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002700 * Default text-to-speech country.
2701 */
2702 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2703
2704 /**
2705 * Default text-to-speech locale variant.
2706 */
2707 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2708
2709 /**
Charles Chenceffa152010-03-16 21:18:10 -07002710 * Space delimited list of plugin packages that are enabled.
2711 */
2712 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2713
2714 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002715 * Whether to notify the user of open networks.
2716 * <p>
2717 * If not connected and the scan results have an open network, we will
2718 * put this notification up. If we attempt to connect to a network or
2719 * the open network(s) disappear, we remove the notification. When we
2720 * show the notification, we will not show it again for
2721 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2722 */
2723 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2724 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002725
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002726 /**
2727 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2728 * Connecting to a network will reset the timer.
2729 */
2730 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2731 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002732
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002733 /**
Irfan Sheriffed4f28b2010-10-29 15:32:10 -07002734 * 802.11 country code in ISO 3166 format
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002735 * @hide
2736 */
Irfan Sheriffed4f28b2010-10-29 15:32:10 -07002737 public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
2738
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002739
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002740 /**
2741 * When the number of open networks exceeds this number, the
2742 * least-recently-used excess networks will be removed.
2743 */
2744 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002745
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002746 /**
2747 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2748 */
2749 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002750
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002751 /**
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002752 * Used to save the Wifi_ON state prior to tethering.
2753 * This state will be checked to restore Wifi after
2754 * the user turns off tethering.
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002755 *
2756 * @hide
2757 */
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002758 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002759
2760 /**
Irfan Sheriff9ab518ad2010-03-12 15:48:17 -08002761 * AP SSID
2762 *
2763 * @hide
2764 */
2765 public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2766
2767 /**
2768 * AP security
2769 *
2770 * @hide
2771 */
2772 public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2773
2774 /**
2775 * AP passphrase
2776 *
2777 * @hide
2778 */
2779 public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2780
2781 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002782 * The acceptable packet loss percentage (range 0 - 100) before trying
2783 * another AP on the same network.
2784 */
2785 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2786 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002787
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002788 /**
2789 * The number of access points required for a network in order for the
2790 * watchdog to monitor it.
2791 */
2792 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002793
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002794 /**
2795 * The delay between background checks.
2796 */
2797 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2798 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002799
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002800 /**
2801 * Whether the Wi-Fi watchdog is enabled for background checking even
2802 * after it thinks the user has connected to a good access point.
2803 */
2804 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2805 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002806
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002807 /**
2808 * The timeout for a background ping
2809 */
2810 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2811 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002812
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002813 /**
2814 * The number of initial pings to perform that *may* be ignored if they
2815 * fail. Again, if these fail, they will *not* be used in packet loss
2816 * calculation. For example, one network always seemed to time out for
2817 * the first couple pings, so this is set to 3 by default.
2818 */
2819 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2820 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002821
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002822 /**
2823 * The maximum number of access points (per network) to attempt to test.
2824 * If this number is reached, the watchdog will no longer monitor the
2825 * initial connection state for the network. This is a safeguard for
2826 * networks containing multiple APs whose DNS does not respond to pings.
2827 */
2828 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002829
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002830 /**
2831 * Whether the Wi-Fi watchdog is enabled.
2832 */
2833 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2834
2835 /**
2836 * 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 -08002837 */
2838 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2839
2840 /**
2841 * The number of pings to test if an access point is a good connection.
2842 */
2843 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002844
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002845 /**
2846 * The delay between pings.
2847 */
2848 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002849
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002850 /**
2851 * The timeout per ping.
2852 */
2853 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002854
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002855 /**
2856 * The maximum number of times we will retry a connection to an access
2857 * point for which we have failed in acquiring an IP address from DHCP.
2858 * 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 -08002859 */
2860 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002861
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 /**
Irfan Sheriff36f74132010-11-04 16:57:37 -07002863 * The operational wifi frequency band
2864 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
2865 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
2866 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
2867 *
2868 * @hide
2869 */
2870 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
2871
2872 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002873 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2874 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875 */
2876 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2877 "wifi_mobile_data_transition_wakelock_timeout_ms";
2878
2879 /**
2880 * Whether background data usage is allowed by the user. See
2881 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002882 */
2883 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002884
2885 /**
Bjorn Bringert98bfa392010-03-24 10:59:48 +00002886 * Origins for which browsers should allow geolocation by default.
2887 * The value is a space-separated list of origins.
2888 */
2889 public static final String ALLOWED_GEOLOCATION_ORIGINS
2890 = "allowed_geolocation_origins";
2891
2892 /**
Robert Greenwaltc03fa502010-02-23 18:58:05 -08002893 * Whether mobile data connections are allowed by the user. See
2894 * ConnectivityManager for more info.
2895 * @hide
2896 */
2897 public static final String MOBILE_DATA = "mobile_data";
2898
2899 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002900 * The CDMA roaming mode 0 = Home Networks, CDMA default
2901 * 1 = Roaming on Affiliated networks
2902 * 2 = Roaming on any networks
2903 * @hide
2904 */
2905 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2906
2907 /**
2908 * The CDMA subscription mode 0 = RUIM/SIM (default)
2909 * 1 = NV
2910 * @hide
2911 */
2912 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2913
2914 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002915 * The preferred network mode 7 = Global
2916 * 6 = EvDo only
2917 * 5 = CDMA w/o EvDo
2918 * 4 = CDMA / EvDo auto
2919 * 3 = GSM / WCDMA auto
2920 * 2 = WCDMA only
2921 * 1 = GSM only
2922 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002923 * @hide
2924 */
2925 public static final String PREFERRED_NETWORK_MODE =
2926 "preferred_network_mode";
2927
2928 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002929 * The preferred TTY mode 0 = TTy Off, CDMA default
2930 * 1 = TTY Full
2931 * 2 = TTY HCO
2932 * 3 = TTY VCO
2933 * @hide
2934 */
2935 public static final String PREFERRED_TTY_MODE =
2936 "preferred_tty_mode";
2937
2938
2939 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002940 * CDMA Cell Broadcast SMS
2941 * 0 = CDMA Cell Broadcast SMS disabled
2942 * 1 = CDMA Cell Broadcast SMS enabled
2943 * @hide
2944 */
2945 public static final String CDMA_CELL_BROADCAST_SMS =
2946 "cdma_cell_broadcast_sms";
2947
2948 /**
2949 * The cdma subscription 0 = Subscription from RUIM, when available
2950 * 1 = Subscription from NV
2951 * @hide
2952 */
2953 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2954 "preferred_cdma_subscription";
2955
2956 /**
2957 * Whether the enhanced voice privacy mode is enabled.
2958 * 0 = normal voice privacy
2959 * 1 = enhanced voice privacy
2960 * @hide
2961 */
2962 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2963
2964 /**
2965 * Whether the TTY mode mode is enabled.
2966 * 0 = disabled
2967 * 1 = enabled
2968 * @hide
2969 */
2970 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002971
2972 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002973 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002974 * Type: int ( 0 = disabled, 1 = enabled )
2975 * @hide
2976 */
2977 public static final String BACKUP_ENABLED = "backup_enabled";
2978
2979 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08002980 * Controls whether application data is automatically restored from backup
2981 * at install time.
2982 * Type: int ( 0 = disabled, 1 = enabled )
2983 * @hide
2984 */
2985 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2986
2987 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002988 * Indicates whether settings backup has been fully provisioned.
2989 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2990 * @hide
2991 */
2992 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2993
2994 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002995 * Component of the transport to use for backup/restore.
2996 * @hide
2997 */
2998 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002999
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07003000 /**
3001 * Version for which the setup wizard was last shown. Bumped for
3002 * each release when there is new setup information to show.
3003 * @hide
3004 */
3005 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07003006
3007 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08003008 * How frequently (in seconds) to check the memory status of the
3009 * device.
3010 * @hide
3011 */
3012 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
3013
3014 /**
3015 * Max frequency (in seconds) to log memory check stats, in realtime
3016 * seconds. This allows for throttling of logs when the device is
3017 * running for large amounts of time.
3018 * @hide
3019 */
3020 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
3021 "memcheck_log_realtime_interval";
3022
3023 /**
3024 * Boolean indicating whether rebooting due to system memory checks
3025 * is enabled.
3026 * @hide
3027 */
3028 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
3029
3030 /**
3031 * How many bytes the system process must be below to avoid scheduling
3032 * a soft reboot. This reboot will happen when it is next determined
3033 * to be a good time.
3034 * @hide
3035 */
3036 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
3037
3038 /**
3039 * How many bytes the system process must be below to avoid scheduling
3040 * a hard reboot. This reboot will happen immediately.
3041 * @hide
3042 */
3043 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
3044
3045 /**
3046 * How many bytes the phone process must be below to avoid scheduling
3047 * a soft restart. This restart will happen when it is next determined
3048 * to be a good time.
3049 * @hide
3050 */
3051 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
3052
3053 /**
3054 * How many bytes the phone process must be below to avoid scheduling
3055 * a hard restart. This restart will happen immediately.
3056 * @hide
3057 */
3058 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
3059
3060 /**
3061 * Boolean indicating whether restarting the phone process due to
3062 * memory checks is enabled.
3063 * @hide
3064 */
3065 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
3066
3067 /**
3068 * First time during the day it is okay to kill processes
3069 * or reboot the device due to low memory situations. This number is
3070 * in seconds since midnight.
3071 * @hide
3072 */
3073 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
3074
3075 /**
3076 * Last time during the day it is okay to kill processes
3077 * or reboot the device due to low memory situations. This number is
3078 * in seconds since midnight.
3079 * @hide
3080 */
3081 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
3082
3083 /**
3084 * How long the screen must have been off in order to kill processes
3085 * or reboot. This number is in seconds. A value of -1 means to
3086 * entirely disregard whether the screen is on.
3087 * @hide
3088 */
3089 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
3090
3091 /**
3092 * How much time there must be until the next alarm in order to kill processes
3093 * or reboot. This number is in seconds. Note: this value must be
3094 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
3095 * always see an alarm scheduled within its time.
3096 * @hide
3097 */
3098 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
3099
3100 /**
3101 * How frequently to check whether it is a good time to restart things,
3102 * if the device is in a bad state. This number is in seconds. Note:
3103 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
3104 * the alarm to schedule the recheck will always appear within the
3105 * minimum "do not execute now" time.
3106 * @hide
3107 */
3108 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
3109
3110 /**
3111 * How frequently (in DAYS) to reboot the device. If 0, no reboots
3112 * will occur.
3113 * @hide
3114 */
3115 public static final String REBOOT_INTERVAL = "reboot_interval";
3116
3117 /**
3118 * First time during the day it is okay to force a reboot of the
3119 * device (if REBOOT_INTERVAL is set). This number is
3120 * in seconds since midnight.
3121 * @hide
3122 */
3123 public static final String REBOOT_START_TIME = "reboot_start_time";
3124
3125 /**
3126 * The window of time (in seconds) after each REBOOT_INTERVAL in which
3127 * a reboot can be executed. If 0, a reboot will always be executed at
3128 * exactly the given time. Otherwise, it will only be executed if
3129 * the device is idle within the window.
3130 * @hide
3131 */
3132 public static final String REBOOT_WINDOW = "reboot_window";
3133
3134 /**
Doug Zongker43866e02010-01-07 12:09:54 -08003135 * Threshold values for the duration and level of a discharge cycle, under
3136 * which we log discharge cycle info.
3137 * @hide
3138 */
3139 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3140 "battery_discharge_duration_threshold";
3141 /** @hide */
3142 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3143
3144 /**
3145 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3146 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3147 * will never display the "Report" button.
3148 * Type: int ( 0 = disallow, 1 = allow )
3149 * @hide
3150 */
3151 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3152
3153 /**
3154 * Nonzero causes Log.wtf() to crash.
3155 * @hide
3156 */
3157 public static final String WTF_IS_FATAL = "wtf_is_fatal";
3158
3159 /**
Jake Hambybb371632010-08-23 18:16:48 -07003160 * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
Doug Zongker43866e02010-01-07 12:09:54 -08003161 * @hide
3162 */
3163 public static final String DROPBOX_AGE_SECONDS =
3164 "dropbox_age_seconds";
3165 /**
Jake Hambybb371632010-08-23 18:16:48 -07003166 * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around.
Dan Egnor3a8b0c12010-03-24 17:48:20 -07003167 * @hide
3168 */
3169 public static final String DROPBOX_MAX_FILES =
3170 "dropbox_max_files";
3171 /**
Jake Hambybb371632010-08-23 18:16:48 -07003172 * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what.
Doug Zongker43866e02010-01-07 12:09:54 -08003173 * @hide
3174 */
3175 public static final String DROPBOX_QUOTA_KB =
3176 "dropbox_quota_kb";
3177 /**
Jake Hambybb371632010-08-23 18:16:48 -07003178 * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use.
Doug Zongker43866e02010-01-07 12:09:54 -08003179 * @hide
3180 */
3181 public static final String DROPBOX_QUOTA_PERCENT =
3182 "dropbox_quota_percent";
3183 /**
Jake Hambybb371632010-08-23 18:16:48 -07003184 * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into.
Doug Zongker43866e02010-01-07 12:09:54 -08003185 * @hide
3186 */
3187 public static final String DROPBOX_RESERVE_PERCENT =
3188 "dropbox_reserve_percent";
3189 /**
3190 * Prefix for per-tag dropbox disable/enable settings.
3191 * @hide
3192 */
3193 public static final String DROPBOX_TAG_PREFIX =
3194 "dropbox:";
Dan Egnora455d192010-03-12 08:52:28 -08003195 /**
3196 * Lines of logcat to include with system crash/ANR/etc. reports,
3197 * as a prefix of the dropbox tag of the report type.
3198 * For example, "logcat_for_system_server_anr" controls the lines
3199 * of logcat captured with system server ANR reports. 0 to disable.
3200 * @hide
3201 */
3202 public static final String ERROR_LOGCAT_PREFIX =
3203 "logcat_for_";
Doug Zongker43866e02010-01-07 12:09:54 -08003204
3205
3206 /**
3207 * Screen timeout in milliseconds corresponding to the
3208 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3209 * possible screen timeout behavior.)
3210 * @hide
3211 */
3212 public static final String SHORT_KEYLIGHT_DELAY_MS =
3213 "short_keylight_delay_ms";
3214
3215 /**
3216 * The interval in minutes after which the amount of free storage left on the
3217 * device is logged to the event log
3218 * @hide
3219 */
3220 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3221 "sys_free_storage_log_interval";
3222
3223 /**
3224 * Threshold for the amount of change in disk free space required to report the amount of
3225 * free space. Used to prevent spamming the logs when the disk free space isn't changing
3226 * frequently.
3227 * @hide
3228 */
3229 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3230 "disk_free_change_reporting_threshold";
3231
3232
3233 /**
3234 * Minimum percentage of free storage on the device that is used to determine if
3235 * the device is running low on storage.
3236 * Say this value is set to 10, the device is considered running low on storage
3237 * if 90% or more of the device storage is filled up.
3238 * @hide
3239 */
3240 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3241 "sys_storage_threshold_percentage";
3242
3243 /**
Jake Hambybb371632010-08-23 18:16:48 -07003244 * Minimum bytes of free storage on the device before the data
3245 * partition is considered full. By default, 1 MB is reserved
3246 * to avoid system-wide SQLite disk full exceptions.
3247 * @hide
3248 */
3249 public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES =
3250 "sys_storage_full_threshold_bytes";
3251
3252 /**
Doug Zongker43866e02010-01-07 12:09:54 -08003253 * The interval in milliseconds after which Wi-Fi is considered idle.
3254 * When idle, it is possible for the device to be switched from Wi-Fi to
3255 * the mobile data network.
3256 * @hide
3257 */
3258 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3259
3260 /**
Irfan Sheriff4f5f7c92010-10-14 17:01:27 -07003261 * The interval in milliseconds to issue scans when the driver is
3262 * started. This is necessary to allow wifi to connect to an
3263 * access point when the driver is suspended.
3264 * @hide
3265 */
3266 public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms";
3267
3268 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08003269 * The interval in milliseconds at which to check packet counts on the
3270 * mobile data interface when screen is on, to detect possible data
3271 * connection problems.
3272 * @hide
3273 */
3274 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3275 "pdp_watchdog_poll_interval_ms";
3276
3277 /**
3278 * The interval in milliseconds at which to check packet counts on the
3279 * mobile data interface when screen is off, to detect possible data
3280 * connection problems.
3281 * @hide
3282 */
3283 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3284 "pdp_watchdog_long_poll_interval_ms";
3285
3286 /**
3287 * The interval in milliseconds at which to check packet counts on the
3288 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3289 * outgoing packets has been reached without incoming packets.
3290 * @hide
3291 */
3292 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3293 "pdp_watchdog_error_poll_interval_ms";
3294
3295 /**
3296 * The number of outgoing packets sent without seeing an incoming packet
3297 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3298 * device is logged to the event log
3299 * @hide
3300 */
3301 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3302 "pdp_watchdog_trigger_packet_count";
3303
3304 /**
3305 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3306 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3307 * attempting data connection recovery.
3308 * @hide
3309 */
3310 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3311 "pdp_watchdog_error_poll_count";
3312
3313 /**
3314 * The number of failed PDP reset attempts before moving to something more
3315 * drastic: re-registering to the network.
3316 * @hide
3317 */
3318 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3319 "pdp_watchdog_max_pdp_reset_fail_count";
3320
3321 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08003322 * The interval in milliseconds at which to check gprs registration
3323 * after the first registration mismatch of gprs and voice service,
3324 * to detect possible data network registration problems.
3325 *
3326 * @hide
3327 */
3328 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3329 "gprs_register_check_period_ms";
3330
3331 /**
3332 * The length of time in milli-seconds that automatic small adjustments to
3333 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3334 * @hide
3335 */
3336 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3337
3338 /**
3339 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3340 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3341 * exceeded.
3342 * @hide
3343 */
3344 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3345
3346 /**
3347 * The maximum reconnect delay for short network outages or when the network is suspended
3348 * due to phone use.
3349 * @hide
3350 */
3351 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3352 "sync_max_retry_delay_in_seconds";
3353
3354 /**
3355 * The interval in milliseconds at which to check the number of SMS sent
3356 * out without asking for use permit, to limit the un-authorized SMS
3357 * usage.
3358 * @hide
3359 */
3360 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3361 "sms_outgoing_check_interval_ms";
3362
3363 /**
3364 * The number of outgoing SMS sent without asking for user permit
3365 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3366 * @hide
3367 */
3368 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3369 "sms_outgoing_check_max_count";
3370
3371 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003372 * The number of promoted sources in GlobalSearch.
3373 * @hide
3374 */
3375 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3376 /**
3377 * The maximum number of suggestions returned by GlobalSearch.
3378 * @hide
3379 */
3380 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3381 /**
3382 * The number of suggestions GlobalSearch will ask each non-web search source for.
3383 * @hide
3384 */
3385 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3386 /**
3387 * The number of suggestions the GlobalSearch will ask the web search source for.
3388 * @hide
3389 */
3390 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3391 "search_web_results_override_limit";
3392 /**
3393 * The number of milliseconds that GlobalSearch will wait for suggestions from
3394 * promoted sources before continuing with all other sources.
3395 * @hide
3396 */
3397 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3398 "search_promoted_source_deadline_millis";
3399 /**
3400 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3401 * @hide
3402 */
3403 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3404 /**
3405 * The maximum number of milliseconds that GlobalSearch shows the previous results
3406 * after receiving a new query.
3407 * @hide
3408 */
3409 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3410 /**
3411 * The maximum age of log data used for shortcuts in GlobalSearch.
3412 * @hide
3413 */
3414 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3415 /**
3416 * The maximum age of log data used for source ranking in GlobalSearch.
3417 * @hide
3418 */
3419 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3420 "search_max_source_event_age_millis";
3421 /**
3422 * The minimum number of impressions needed to rank a source in GlobalSearch.
3423 * @hide
3424 */
3425 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3426 "search_min_impressions_for_source_ranking";
3427 /**
3428 * The minimum number of clicks needed to rank a source in GlobalSearch.
3429 * @hide
3430 */
3431 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3432 "search_min_clicks_for_source_ranking";
3433 /**
3434 * The maximum number of shortcuts shown by GlobalSearch.
3435 * @hide
3436 */
3437 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3438 /**
3439 * The size of the core thread pool for suggestion queries in GlobalSearch.
3440 * @hide
3441 */
3442 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3443 "search_query_thread_core_pool_size";
3444 /**
3445 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3446 * @hide
3447 */
3448 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3449 "search_query_thread_max_pool_size";
3450 /**
3451 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3452 * @hide
3453 */
3454 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3455 "search_shortcut_refresh_core_pool_size";
3456 /**
3457 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3458 * @hide
3459 */
3460 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3461 "search_shortcut_refresh_max_pool_size";
3462 /**
3463 * The maximun time that excess threads in the GlobalSeach thread pools will
3464 * wait before terminating.
3465 * @hide
3466 */
3467 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3468 "search_thread_keepalive_seconds";
3469 /**
3470 * The maximum number of concurrent suggestion queries to each source.
3471 * @hide
3472 */
3473 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3474 "search_per_source_concurrent_query_limit";
3475
San Mehat87734d32010-01-08 12:53:06 -08003476 /**
3477 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3478 * @hide
3479 */
3480 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3481
3482 /**
3483 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3484 * @hide
3485 */
3486 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3487
3488 /**
3489 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3490 * @hide
3491 */
3492 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3493
3494 /**
3495 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3496 * @hide
3497 */
3498 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003499
Dan Egnor42471dd2010-01-07 17:25:22 -08003500 /**
3501 * If nonzero, ANRs in invisible background processes bring up a dialog.
3502 * Otherwise, the process will be silently killed.
3503 * @hide
3504 */
3505 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
Erikeebc8e22010-02-18 13:27:19 -08003506
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003507 /**
3508 * The {@link ComponentName} string of the service to be used as the voice recognition
3509 * service.
Erikeebc8e22010-02-18 13:27:19 -08003510 *
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003511 * @hide
3512 */
3513 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
Dan Egnor42471dd2010-01-07 17:25:22 -08003514
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003515 /**
David Brown458e8062010-03-08 21:52:11 -08003516 * What happens when the user presses the Power button while in-call
3517 * and the screen is on.<br/>
3518 * <b>Values:</b><br/>
3519 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3520 * 2 - The Power button hangs up the current call.<br/>
3521 *
3522 * @hide
3523 */
3524 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3525
3526 /**
3527 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3528 * @hide
3529 */
3530 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3531
3532 /**
3533 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3534 * @hide
3535 */
3536 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3537
3538 /**
3539 * INCALL_POWER_BUTTON_BEHAVIOR default value.
3540 * @hide
3541 */
3542 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3543 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3544
3545 /**
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003546 * The current night mode that has been selected by the user. Owned
3547 * and controlled by UiModeManagerService. Constants are as per
3548 * UiModeManager.
3549 * @hide
3550 */
3551 public static final String UI_NIGHT_MODE = "ui_night_mode";
Suchi Amalapurapu40e47252010-04-07 16:15:50 -07003552
3553 /**
3554 * Let user pick default install location.
3555 * @hide
3556 */
3557 public static final String SET_INSTALL_LOCATION = "set_install_location";
3558
3559 /**
3560 * Default install location value.
3561 * 0 = auto, let system decide
3562 * 1 = internal
3563 * 2 = sdcard
3564 * @hide
3565 */
3566 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003567
3568 /**
3569 * The bandwidth throttle polling freqency in seconds
3570 * @hide
3571 */
3572 public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3573
3574 /**
3575 * The bandwidth throttle threshold (long)
3576 * @hide
3577 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003578 public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003579
3580 /**
3581 * The bandwidth throttle value (kbps)
3582 * @hide
3583 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003584 public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003585
3586 /**
3587 * The bandwidth throttle reset calendar day (1-28)
3588 * @hide
3589 */
3590 public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3591
3592 /**
3593 * The throttling notifications we should send
3594 * @hide
3595 */
3596 public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3597
3598 /**
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003599 * Help URI for data throttling policy
3600 * @hide
3601 */
3602 public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3603
Robert Greenwaltd1055a22010-05-25 15:54:52 -07003604 /**
3605 * The length of time in Sec that we allow our notion of NTP time
3606 * to be cached before we refresh it
3607 * @hide
3608 */
3609 public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3610 "throttle_max_ntp_cache_age_sec";
3611
Steve Howard9c4e33e2010-07-28 15:59:29 -07003612 /**
3613 * The maximum size, in bytes, of a download that the download manager will transfer over
3614 * a non-wifi connection.
3615 * @hide
3616 */
3617 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
3618 "download_manager_max_bytes_over_mobile";
3619
Robert Greenwaltd7085fc2010-09-08 15:24:47 -07003620 /**
Steve Howardf1766812010-09-17 16:46:19 -07003621 * The recommended maximum size, in bytes, of a download that the download manager should
3622 * transfer over a non-wifi connection. Over this size, the use will be warned, but will
3623 * have the option to start the download over the mobile connection anyway.
3624 * @hide
3625 */
3626 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
3627 "download_manager_recommended_max_bytes_over_mobile";
3628
3629 /**
Robert Greenwaltd7085fc2010-09-08 15:24:47 -07003630 * ms during which to consume extra events related to Inet connection condition
3631 * after a transtion to fully-connected
3632 * @hide
3633 */
3634 public static final String INET_CONDITION_DEBOUNCE_UP_DELAY =
3635 "inet_condition_debounce_up_delay";
3636
3637 /**
3638 * ms during which to consume extra events related to Inet connection condtion
3639 * after a transtion to partly-connected
3640 * @hide
3641 */
3642 public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY =
3643 "inet_condition_debounce_down_delay";
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003644
3645 /**
-b master501eec92009-07-06 13:53:11 -07003646 * @hide
3647 */
3648 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07003649 ADB_ENABLED,
3650 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07003651 PARENTAL_CONTROL_ENABLED,
3652 PARENTAL_CONTROL_REDIRECT_URL,
3653 USB_MASS_STORAGE_ENABLED,
3654 ACCESSIBILITY_ENABLED,
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07003655 ACCESSIBILITY_SCRIPT_INJECTION,
Christopher Tate14c2d792010-02-25 16:49:44 -08003656 BACKUP_AUTO_RESTORE,
-b master501eec92009-07-06 13:53:11 -07003657 ENABLED_ACCESSIBILITY_SERVICES,
3658 TTS_USE_DEFAULTS,
3659 TTS_DEFAULT_RATE,
3660 TTS_DEFAULT_PITCH,
3661 TTS_DEFAULT_SYNTH,
3662 TTS_DEFAULT_LANG,
3663 TTS_DEFAULT_COUNTRY,
Charles Chenceffa152010-03-16 21:18:10 -07003664 TTS_ENABLED_PLUGINS,
-b master501eec92009-07-06 13:53:11 -07003665 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3666 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
Irfan Sheriffed4f28b2010-10-29 15:32:10 -07003667 WIFI_COUNTRY_CODE,
-b master501eec92009-07-06 13:53:11 -07003668 WIFI_NUM_OPEN_NETWORKS_KEPT,
San Mehat87734d32010-01-08 12:53:06 -08003669 MOUNT_PLAY_NOTIFICATION_SND,
3670 MOUNT_UMS_AUTOSTART,
3671 MOUNT_UMS_PROMPT,
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003672 MOUNT_UMS_NOTIFY_ENABLED,
3673 UI_NIGHT_MODE
-b master501eec92009-07-06 13:53:11 -07003674 };
3675
3676 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003677 * Helper method for determining if a location provider is enabled.
3678 * @param cr the content resolver to use
3679 * @param provider the location provider to query
3680 * @return true if the provider is enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003681 */
3682 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3683 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
Brad Fitzpatrick11fe1812010-09-10 16:07:52 -07003684 return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003685 }
3686
3687 /**
3688 * Thread-safe method for enabling or disabling a single location provider.
3689 * @param cr the content resolver to use
3690 * @param provider the location provider to enable or disable
3691 * @param enabled true if the provider should be enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003692 */
3693 public static final void setLocationProviderEnabled(ContentResolver cr,
3694 String provider, boolean enabled) {
3695 // to ensure thread safety, we write the provider name with a '+' or '-'
3696 // and let the SettingsProvider handle it rather than reading and modifying
3697 // the list of enabled providers.
3698 if (enabled) {
3699 provider = "+" + provider;
3700 } else {
3701 provider = "-" + provider;
3702 }
3703 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3704 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003705 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003706
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003707 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003708 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3709 * Intent URL, allowing it to be either a web page or a particular
3710 * application activity.
3711 *
3712 * @hide
3713 */
3714 public static final class Bookmarks implements BaseColumns
3715 {
3716 private static final String TAG = "Bookmarks";
3717
3718 /**
3719 * The content:// style URL for this table
3720 */
3721 public static final Uri CONTENT_URI =
3722 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3723
3724 /**
3725 * The row ID.
3726 * <p>Type: INTEGER</p>
3727 */
3728 public static final String ID = "_id";
3729
3730 /**
3731 * Descriptive name of the bookmark that can be displayed to the user.
3732 * If this is empty, the title should be resolved at display time (use
3733 * {@link #getTitle(Context, Cursor)} any time you want to display the
3734 * title of a bookmark.)
3735 * <P>
3736 * Type: TEXT
3737 * </P>
3738 */
3739 public static final String TITLE = "title";
3740
3741 /**
3742 * Arbitrary string (displayed to the user) that allows bookmarks to be
3743 * organized into categories. There are some special names for
3744 * standard folders, which all start with '@'. The label displayed for
3745 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3746 * the folder name does not change so you can consistently query for
3747 * the folder regardless of the current locale.
3748 *
3749 * <P>Type: TEXT</P>
3750 *
3751 */
3752 public static final String FOLDER = "folder";
3753
3754 /**
3755 * The Intent URL of the bookmark, describing what it points to. This
3756 * value is given to {@link android.content.Intent#getIntent} to create
3757 * an Intent that can be launched.
3758 * <P>Type: TEXT</P>
3759 */
3760 public static final String INTENT = "intent";
3761
3762 /**
3763 * Optional shortcut character associated with this bookmark.
3764 * <P>Type: INTEGER</P>
3765 */
3766 public static final String SHORTCUT = "shortcut";
3767
3768 /**
3769 * The order in which the bookmark should be displayed
3770 * <P>Type: INTEGER</P>
3771 */
3772 public static final String ORDERING = "ordering";
3773
3774 private static final String[] sIntentProjection = { INTENT };
3775 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3776 private static final String sShortcutSelection = SHORTCUT + "=?";
3777
3778 /**
3779 * Convenience function to retrieve the bookmarked Intent for a
3780 * particular shortcut key.
3781 *
3782 * @param cr The ContentResolver to query.
3783 * @param shortcut The shortcut key.
3784 *
3785 * @return Intent The bookmarked URL, or null if there is no bookmark
3786 * matching the given shortcut.
3787 */
3788 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3789 {
3790 Intent intent = null;
3791
3792 Cursor c = cr.query(CONTENT_URI,
3793 sIntentProjection, sShortcutSelection,
3794 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3795 // Keep trying until we find a valid shortcut
3796 try {
3797 while (intent == null && c.moveToNext()) {
3798 try {
3799 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003800 intent = Intent.parseUri(intentURI, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003801 } catch (java.net.URISyntaxException e) {
3802 // The stored URL is bad... ignore it.
3803 } catch (IllegalArgumentException e) {
3804 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003805 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003806 }
3807 }
3808 } finally {
3809 if (c != null) c.close();
3810 }
3811
3812 return intent;
3813 }
3814
3815 /**
3816 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003817 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003818 * @param cr The ContentResolver to query.
3819 * @param intent The desired target of the bookmark.
3820 * @param title Bookmark title that is shown to the user; null if none
3821 * or it should be resolved to the intent's title.
3822 * @param folder Folder in which to place the bookmark; null if none.
3823 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3824 * this is non-zero and there is an existing bookmark entry
3825 * with this same shortcut, then that existing shortcut is
3826 * cleared (the bookmark is not removed).
3827 * @return The unique content URL for the new bookmark entry.
3828 */
3829 public static Uri add(ContentResolver cr,
3830 Intent intent,
3831 String title,
3832 String folder,
3833 char shortcut,
3834 int ordering)
3835 {
3836 // If a shortcut is supplied, and it is already defined for
3837 // another bookmark, then remove the old definition.
3838 if (shortcut != 0) {
Jeff Hamilton7cd51ef2010-05-12 17:30:27 -05003839 cr.delete(CONTENT_URI, sShortcutSelection,
3840 new String[] { String.valueOf((int) shortcut) });
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003841 }
3842
3843 ContentValues values = new ContentValues();
3844 if (title != null) values.put(TITLE, title);
3845 if (folder != null) values.put(FOLDER, folder);
Jean-Baptiste Queru3b9f0a32010-06-21 13:46:59 -07003846 values.put(INTENT, intent.toUri(0));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003847 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3848 values.put(ORDERING, ordering);
3849 return cr.insert(CONTENT_URI, values);
3850 }
3851
3852 /**
3853 * Return the folder name as it should be displayed to the user. This
3854 * takes care of localizing special folders.
3855 *
3856 * @param r Resources object for current locale; only need access to
3857 * system resources.
3858 * @param folder The value found in the {@link #FOLDER} column.
3859 *
3860 * @return CharSequence The label for this folder that should be shown
3861 * to the user.
3862 */
3863 public static CharSequence getLabelForFolder(Resources r, String folder) {
3864 return folder;
3865 }
3866
3867 /**
3868 * Return the title as it should be displayed to the user. This takes
3869 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003870 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 * @param context A context.
3872 * @param cursor A cursor pointing to the row whose title should be
3873 * returned. The cursor must contain at least the {@link #TITLE}
3874 * and {@link #INTENT} columns.
3875 * @return A title that is localized and can be displayed to the user,
3876 * or the empty string if one could not be found.
3877 */
3878 public static CharSequence getTitle(Context context, Cursor cursor) {
3879 int titleColumn = cursor.getColumnIndex(TITLE);
3880 int intentColumn = cursor.getColumnIndex(INTENT);
3881 if (titleColumn == -1 || intentColumn == -1) {
3882 throw new IllegalArgumentException(
3883 "The cursor must contain the TITLE and INTENT columns.");
3884 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003885
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003886 String title = cursor.getString(titleColumn);
3887 if (!TextUtils.isEmpty(title)) {
3888 return title;
3889 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003890
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003891 String intentUri = cursor.getString(intentColumn);
3892 if (TextUtils.isEmpty(intentUri)) {
3893 return "";
3894 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003895
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003896 Intent intent;
3897 try {
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003898 intent = Intent.parseUri(intentUri, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003899 } catch (URISyntaxException e) {
3900 return "";
3901 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003902
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003903 PackageManager packageManager = context.getPackageManager();
3904 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3905 return info != null ? info.loadLabel(packageManager) : "";
3906 }
3907 }
3908
3909 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003910 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3911 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3912 * from the GoogleLoginService.
3913 *
3914 * @param androidId The Android ID for this device.
3915 * @return The device ID that should be used when connecting to the mobile gtalk server.
3916 * @hide
3917 */
3918 public static String getGTalkDeviceId(long androidId) {
3919 return "android-" + Long.toHexString(androidId);
3920 }
3921}