blob: 2b79037e14919aa71c929c84c7c163b9ac9c134c [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;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070037import android.os.BatteryManager;
38import android.os.Bundle;
39import android.os.RemoteException;
40import android.os.SystemProperties;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041import android.text.TextUtils;
42import android.util.AndroidException;
Dan Egnor799f7212009-11-24 16:24:44 -080043import android.util.Config;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044import android.util.Log;
45
46import java.net.URISyntaxException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047import java.util.HashMap;
48import java.util.HashSet;
49
50
51/**
52 * The Settings provider contains global system-level device preferences.
53 */
54public final class Settings {
55
56 // Intent actions for Settings
57
58 /**
59 * Activity Action: Show system settings.
60 * <p>
61 * Input: Nothing.
62 * <p>
63 * Output: nothing.
64 */
65 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
66 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
67
68 /**
69 * Activity Action: Show settings to allow configuration of APNs.
70 * <p>
71 * Input: Nothing.
72 * <p>
73 * Output: nothing.
74 */
75 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
76 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
77
78 /**
79 * Activity Action: Show settings to allow configuration of current location
80 * sources.
81 * <p>
82 * In some cases, a matching Activity may not exist, so ensure you
83 * safeguard against this.
84 * <p>
85 * Input: Nothing.
86 * <p>
87 * Output: Nothing.
88 */
89 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
90 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
91 "android.settings.LOCATION_SOURCE_SETTINGS";
92
93 /**
94 * Activity Action: Show settings to allow configuration of wireless controls
95 * such as Wi-Fi, Bluetooth and Mobile networks.
96 * <p>
97 * In some cases, a matching Activity may not exist, so ensure you
98 * safeguard against this.
99 * <p>
100 * Input: Nothing.
101 * <p>
102 * Output: Nothing.
103 */
104 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
105 public static final String ACTION_WIRELESS_SETTINGS =
106 "android.settings.WIRELESS_SETTINGS";
107
108 /**
109 * Activity Action: Show settings to allow entering/exiting airplane mode.
110 * <p>
111 * In some cases, a matching Activity may not exist, so ensure you
112 * safeguard against this.
113 * <p>
114 * Input: Nothing.
115 * <p>
116 * Output: Nothing.
117 */
118 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
119 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
120 "android.settings.AIRPLANE_MODE_SETTINGS";
121
122 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700123 * Activity Action: Show settings for accessibility modules.
124 * <p>
125 * In some cases, a matching Activity may not exist, so ensure you
126 * safeguard against this.
127 * <p>
128 * Input: Nothing.
129 * <p>
130 * Output: Nothing.
131 */
132 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
133 public static final String ACTION_ACCESSIBILITY_SETTINGS =
134 "android.settings.ACCESSIBILITY_SETTINGS";
135
136 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 * Activity Action: Show settings to allow configuration of security and
138 * location privacy.
139 * <p>
140 * In some cases, a matching Activity may not exist, so ensure you
141 * safeguard against this.
142 * <p>
143 * Input: Nothing.
144 * <p>
145 * Output: Nothing.
146 */
147 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
148 public static final String ACTION_SECURITY_SETTINGS =
149 "android.settings.SECURITY_SETTINGS";
150
151 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700152 * Activity Action: Show settings to allow configuration of privacy options.
153 * <p>
154 * In some cases, a matching Activity may not exist, so ensure you
155 * safeguard against this.
156 * <p>
157 * Input: Nothing.
158 * <p>
159 * Output: Nothing.
160 */
161 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
162 public static final String ACTION_PRIVACY_SETTINGS =
163 "android.settings.PRIVACY_SETTINGS";
164
165 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166 * Activity Action: Show settings to allow configuration of Wi-Fi.
167
168 * <p>
169 * In some cases, a matching Activity may not exist, so ensure you
170 * safeguard against this.
171 * <p>
172 * Input: Nothing.
173 * <p>
174 * Output: Nothing.
175
176 */
177 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
178 public static final String ACTION_WIFI_SETTINGS =
179 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700180
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181 /**
182 * Activity Action: Show settings to allow configuration of a static IP
183 * address for Wi-Fi.
184 * <p>
185 * In some cases, a matching Activity may not exist, so ensure you safeguard
186 * against this.
187 * <p>
188 * Input: Nothing.
189 * <p>
190 * Output: Nothing.
191 */
192 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
193 public static final String ACTION_WIFI_IP_SETTINGS =
194 "android.settings.WIFI_IP_SETTINGS";
195
196 /**
197 * Activity Action: Show settings to allow configuration of Bluetooth.
198 * <p>
199 * In some cases, a matching Activity may not exist, so ensure you
200 * safeguard against this.
201 * <p>
202 * Input: Nothing.
203 * <p>
204 * Output: Nothing.
205 */
206 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
207 public static final String ACTION_BLUETOOTH_SETTINGS =
208 "android.settings.BLUETOOTH_SETTINGS";
209
210 /**
211 * Activity Action: Show settings to allow configuration of date and time.
212 * <p>
213 * In some cases, a matching Activity may not exist, so ensure you
214 * safeguard against this.
215 * <p>
216 * Input: Nothing.
217 * <p>
218 * Output: Nothing.
219 */
220 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
221 public static final String ACTION_DATE_SETTINGS =
222 "android.settings.DATE_SETTINGS";
223
224 /**
225 * Activity Action: Show settings to allow configuration of sound and volume.
226 * <p>
227 * In some cases, a matching Activity may not exist, so ensure you
228 * safeguard against this.
229 * <p>
230 * Input: Nothing.
231 * <p>
232 * Output: Nothing.
233 */
234 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
235 public static final String ACTION_SOUND_SETTINGS =
236 "android.settings.SOUND_SETTINGS";
237
238 /**
239 * Activity Action: Show settings to allow configuration of display.
240 * <p>
241 * In some cases, a matching Activity may not exist, so ensure you
242 * safeguard against this.
243 * <p>
244 * Input: Nothing.
245 * <p>
246 * Output: Nothing.
247 */
248 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
249 public static final String ACTION_DISPLAY_SETTINGS =
250 "android.settings.DISPLAY_SETTINGS";
251
252 /**
253 * Activity Action: Show settings to allow configuration of locale.
254 * <p>
255 * In some cases, a matching Activity may not exist, so ensure you
256 * safeguard against this.
257 * <p>
258 * Input: Nothing.
259 * <p>
260 * Output: Nothing.
261 */
262 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
263 public static final String ACTION_LOCALE_SETTINGS =
264 "android.settings.LOCALE_SETTINGS";
265
266 /**
267 * Activity Action: Show settings to configure input methods, in particular
268 * allowing the user to enable input methods.
269 * <p>
270 * In some cases, a matching Activity may not exist, so ensure you
271 * safeguard against this.
272 * <p>
273 * Input: Nothing.
274 * <p>
275 * Output: Nothing.
276 */
277 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
278 public static final String ACTION_INPUT_METHOD_SETTINGS =
279 "android.settings.INPUT_METHOD_SETTINGS";
280
281 /**
satok86417ea2010-10-27 14:11:03 +0900282 * Activity Action: Show enabler activity to enable/disable input methods and subtypes.
283 * <p>
284 * In some cases, a matching Activity may not exist, so ensure you
285 * safeguard against this.
286 * <p>
287 * Input: Nothing.
288 * <p>
289 * Output: Nothing.
290 */
291 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
292 public static final String ACTION_INPUT_METHOD_AND_SUBTYPE_ENABLER =
293 "android.settings.INPUT_METHOD_AND_SUBTYPE_ENABLER";
294
295 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800296 * Activity Action: Show settings to manage the user input dictionary.
297 * <p>
298 * In some cases, a matching Activity may not exist, so ensure you
299 * safeguard against this.
300 * <p>
301 * Input: Nothing.
302 * <p>
303 * Output: Nothing.
304 */
305 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
306 public static final String ACTION_USER_DICTIONARY_SETTINGS =
307 "android.settings.USER_DICTIONARY_SETTINGS";
308
309 /**
310 * Activity Action: Show settings to allow configuration of application-related settings.
311 * <p>
312 * In some cases, a matching Activity may not exist, so ensure you
313 * safeguard against this.
314 * <p>
315 * Input: Nothing.
316 * <p>
317 * Output: Nothing.
318 */
319 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
320 public static final String ACTION_APPLICATION_SETTINGS =
321 "android.settings.APPLICATION_SETTINGS";
322
323 /**
324 * Activity Action: Show settings to allow configuration of application
325 * development-related settings.
326 * <p>
327 * In some cases, a matching Activity may not exist, so ensure you safeguard
328 * against this.
329 * <p>
330 * Input: Nothing.
331 * <p>
332 * Output: Nothing.
333 */
334 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
335 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
336 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
337
338 /**
339 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
340 * <p>
341 * In some cases, a matching Activity may not exist, so ensure you
342 * safeguard against this.
343 * <p>
344 * Input: Nothing.
345 * <p>
346 * Output: Nothing.
347 */
348 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
349 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
350 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700351
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800352 /**
353 * Activity Action: Show settings to manage installed applications.
354 * <p>
355 * In some cases, a matching Activity may not exist, so ensure you
356 * safeguard against this.
357 * <p>
358 * Input: Nothing.
359 * <p>
360 * Output: Nothing.
361 */
362 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
363 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
364 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700365
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800366 /**
Winson Chung44e8ff92010-09-27 14:36:52 -0700367 * Activity Action: Show settings to manage all applications.
368 * <p>
369 * In some cases, a matching Activity may not exist, so ensure you
370 * safeguard against this.
371 * <p>
372 * Input: Nothing.
373 * <p>
374 * Output: Nothing.
375 */
376 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
377 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
378 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
379
380 /**
Dianne Hackbornb7bb3b32010-06-06 22:47:50 -0700381 * Activity Action: Show screen of details about a particular application.
382 * <p>
383 * In some cases, a matching Activity may not exist, so ensure you
384 * safeguard against this.
385 * <p>
386 * Input: The Intent's data URI specifies the application package name
387 * to be shown, with the "package" scheme. That is "package:com.my.app".
388 * <p>
389 * Output: Nothing.
390 */
391 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
392 public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
393 "android.settings.APPLICATION_DETAILS_SETTINGS";
394
395 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 * Activity Action: Show settings for system update functionality.
397 * <p>
398 * In some cases, a matching Activity may not exist, so ensure you
399 * safeguard against this.
400 * <p>
401 * Input: Nothing.
402 * <p>
403 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700404 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800405 * @hide
406 */
407 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
408 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
409 "android.settings.SYSTEM_UPDATE_SETTINGS";
410
411 /**
412 * Activity Action: Show settings to allow configuration of sync settings.
413 * <p>
414 * In some cases, a matching Activity may not exist, so ensure you
415 * safeguard against this.
416 * <p>
Erikeebc8e22010-02-18 13:27:19 -0800417 * The account types available to add via the add account button may be restricted by adding an
418 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
419 * authorities. Only account types which can sync with that content provider will be offered to
420 * the user.
421 * <p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800422 * Input: Nothing.
423 * <p>
424 * Output: Nothing.
425 */
426 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
427 public static final String ACTION_SYNC_SETTINGS =
428 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700429
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800430 /**
Erikeebc8e22010-02-18 13:27:19 -0800431 * Activity Action: Show add account screen for creating a new account.
432 * <p>
433 * In some cases, a matching Activity may not exist, so ensure you
434 * safeguard against this.
435 * <p>
436 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
437 * extra to the Intent with one or more syncable content provider's authorities. Only account
438 * types which can sync with that content provider will be offered to the user.
439 * <p>
440 * Input: Nothing.
441 * <p>
442 * Output: Nothing.
443 */
444 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
445 public static final String ACTION_ADD_ACCOUNT =
446 "android.settings.ADD_ACCOUNT_SETTINGS";
447
448 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800449 * Activity Action: Show settings for selecting the network operator.
450 * <p>
451 * In some cases, a matching Activity may not exist, so ensure you
452 * safeguard against this.
453 * <p>
454 * Input: Nothing.
455 * <p>
456 * Output: Nothing.
457 */
458 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
459 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
460 "android.settings.NETWORK_OPERATOR_SETTINGS";
461
462 /**
463 * Activity Action: Show settings for selection of 2G/3G.
464 * <p>
465 * In some cases, a matching Activity may not exist, so ensure you
466 * safeguard against this.
467 * <p>
468 * Input: Nothing.
469 * <p>
470 * Output: Nothing.
471 */
472 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
473 public static final String ACTION_DATA_ROAMING_SETTINGS =
474 "android.settings.DATA_ROAMING_SETTINGS";
475
476 /**
477 * Activity Action: Show settings for internal storage.
478 * <p>
479 * In some cases, a matching Activity may not exist, so ensure you
480 * safeguard against this.
481 * <p>
482 * Input: Nothing.
483 * <p>
484 * Output: Nothing.
485 */
486 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
487 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
488 "android.settings.INTERNAL_STORAGE_SETTINGS";
489 /**
490 * Activity Action: Show settings for memory card storage.
491 * <p>
492 * In some cases, a matching Activity may not exist, so ensure you
493 * safeguard against this.
494 * <p>
495 * Input: Nothing.
496 * <p>
497 * Output: Nothing.
498 */
499 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
500 public static final String ACTION_MEMORY_CARD_SETTINGS =
501 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700502
Justin Mattsonef340352010-01-13 21:05:46 -0800503 /**
504 * Activity Action: Show settings for global search.
505 * <p>
506 * In some cases, a matching Activity may not exist, so ensure you
507 * safeguard against this.
508 * <p>
509 * Input: Nothing.
510 * <p>
511 * Output: Nothing
512 */
513 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
514 public static final String ACTION_SEARCH_SETTINGS =
515 "android.search.action.SEARCH_SETTINGS";
516
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500517 /**
518 * Activity Action: Show general device information settings (serial
519 * number, software version, phone number, etc.).
520 * <p>
521 * In some cases, a matching Activity may not exist, so ensure you
522 * safeguard against this.
523 * <p>
524 * Input: Nothing.
525 * <p>
526 * Output: Nothing
527 */
528 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
529 public static final String ACTION_DEVICE_INFO_SETTINGS =
530 "android.settings.DEVICE_INFO_SETTINGS";
531
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800532 // End of Intent actions for Settings
533
Erikeebc8e22010-02-18 13:27:19 -0800534 /**
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800535 * @hide - Private call() method on SettingsProvider to read from 'system' table.
536 */
537 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
538
539 /**
540 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
541 */
542 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
543
544 /**
Erikeebc8e22010-02-18 13:27:19 -0800545 * Activity Extra: Limit available options in launched activity based on the given authority.
546 * <p>
547 * This can be passed as an extra field in an Activity Intent with one or more syncable content
548 * provider's authorities as a String[]. This field is used by some intents to alter the
549 * behavior of the called activity.
550 * <p>
551 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
552 * on the authority given.
553 */
554 public static final String EXTRA_AUTHORITIES =
555 "authorities";
556
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800557 private static final String JID_RESOURCE_PREFIX = "android";
558
559 public static final String AUTHORITY = "settings";
560
561 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800562 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800563
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800564 public static class SettingNotFoundException extends AndroidException {
565 public SettingNotFoundException(String msg) {
566 super(msg);
567 }
568 }
569
570 /**
571 * Common base for tables of name/value settings.
572 */
573 public static class NameValueTable implements BaseColumns {
574 public static final String NAME = "name";
575 public static final String VALUE = "value";
576
577 protected static boolean putString(ContentResolver resolver, Uri uri,
578 String name, String value) {
579 // The database will take care of replacing duplicates.
580 try {
581 ContentValues values = new ContentValues();
582 values.put(NAME, name);
583 values.put(VALUE, value);
584 resolver.insert(uri, values);
585 return true;
586 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700587 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 return false;
589 }
590 }
591
592 public static Uri getUriFor(Uri uri, String name) {
593 return Uri.withAppendedPath(uri, name);
594 }
595 }
596
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800597 // Thread-safe.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 private static class NameValueCache {
599 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800600 private final Uri mUri;
601
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800602 private static final String[] SELECT_VALUE =
603 new String[] { Settings.NameValueTable.VALUE };
604 private static final String NAME_EQ_PLACEHOLDER = "name=?";
605
606 // Must synchronize on 'this' to access mValues and mValuesVersion.
Dan Egnor799f7212009-11-24 16:24:44 -0800607 private final HashMap<String, String> mValues = new HashMap<String, String>();
608 private long mValuesVersion = 0;
609
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800610 // Initially null; set lazily and held forever. Synchronized on 'this'.
611 private IContentProvider mContentProvider = null;
612
613 // The method we'll call (or null, to not use) on the provider
614 // for the fast path of retrieving settings.
615 private final String mCallCommand;
616
617 public NameValueCache(String versionSystemProperty, Uri uri, String callCommand) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800618 mVersionSystemProperty = versionSystemProperty;
619 mUri = uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800620 mCallCommand = callCommand;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800621 }
622
Dan Egnor799f7212009-11-24 16:24:44 -0800623 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800624 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800625
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800626 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800627 if (mValuesVersion != newValuesVersion) {
628 if (LOCAL_LOGV) {
629 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
630 newValuesVersion + " != cached " + mValuesVersion);
631 }
632
633 mValues.clear();
634 mValuesVersion = newValuesVersion;
635 }
636
637 if (mValues.containsKey(name)) {
638 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800639 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 }
Dan Egnor799f7212009-11-24 16:24:44 -0800641
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800642 IContentProvider cp = null;
643 synchronized (this) {
644 cp = mContentProvider;
645 if (cp == null) {
646 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
647 }
648 }
649
650 // Try the fast path first, not using query(). If this
651 // fails (alternate Settings provider that doesn't support
652 // this interface?) then we fall back to the query/table
653 // interface.
654 if (mCallCommand != null) {
655 try {
656 Bundle b = cp.call(mCallCommand, name, null);
657 if (b != null) {
658 String value = b.getPairValue();
659 synchronized (this) {
660 mValues.put(name, value);
661 }
662 return value;
663 }
664 // If the response Bundle is null, we fall through
665 // to the query interface below.
666 } catch (RemoteException e) {
667 // Not supported by the remote side? Fall through
668 // to query().
669 }
670 }
671
Dan Egnor799f7212009-11-24 16:24:44 -0800672 Cursor c = null;
673 try {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800674 c = cp.query(mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
675 new String[]{name}, null);
Dan Egnor799f7212009-11-24 16:24:44 -0800676 if (c == null) {
677 Log.w(TAG, "Can't get key " + name + " from " + mUri);
678 return null;
679 }
680
681 String value = c.moveToNext() ? c.getString(0) : null;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800682 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -0800683 mValues.put(name, value);
684 }
685 if (LOCAL_LOGV) {
686 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
687 name + " = " + (value == null ? "(null)" : value));
688 }
689 return value;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800690 } catch (RemoteException e) {
Dan Egnor799f7212009-11-24 16:24:44 -0800691 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
692 return null; // Return null, but don't cache it.
693 } finally {
694 if (c != null) c.close();
695 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800696 }
697 }
698
699 /**
700 * System settings, containing miscellaneous system preferences. This
701 * table holds simple name/value pairs. There are convenience
702 * functions for accessing individual settings entries.
703 */
704 public static final class System extends NameValueTable {
705 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
706
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800707 // Populated lazily, guarded by class object:
708 private static NameValueCache sNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700709
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800710 private static final HashSet<String> MOVED_TO_SECURE;
711 static {
712 MOVED_TO_SECURE = new HashSet<String>(30);
713 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
714 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
715 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
716 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
717 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
718 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
719 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
720 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
Amith Yamasani156c4352010-03-05 17:10:03 -0800721 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
722 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
723 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800724 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
725 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
726 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
727 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
728 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
729 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
730 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
731 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
732 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
733 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
734 MOVED_TO_SECURE.add(Secure.WIFI_ON);
735 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
736 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
737 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
738 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
739 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
740 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
741 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
742 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
743 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
744 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
745 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
746 }
747
748 /**
749 * Look up a name in the database.
750 * @param resolver to access the database with
751 * @param name to look up in the table
752 * @return the corresponding value, or null if not present
753 */
754 public synchronized static String getString(ContentResolver resolver, String name) {
755 if (MOVED_TO_SECURE.contains(name)) {
756 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
757 + " to android.provider.Settings.Secure, returning read-only value.");
758 return Secure.getString(resolver, name);
759 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800760 if (sNameValueCache == null) {
761 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
762 CALL_METHOD_GET_SYSTEM);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800763 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -0800764 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800765 }
766
767 /**
768 * Store a name/value pair into the database.
769 * @param resolver to access the database with
770 * @param name to store
771 * @param value to associate with the name
772 * @return true if the value was set, false on database errors
773 */
774 public static boolean putString(ContentResolver resolver, String name, String value) {
775 if (MOVED_TO_SECURE.contains(name)) {
776 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
777 + " to android.provider.Settings.Secure, value is unchanged.");
778 return false;
779 }
780 return putString(resolver, CONTENT_URI, name, value);
781 }
782
783 /**
784 * Construct the content URI for a particular name/value pair,
785 * useful for monitoring changes with a ContentObserver.
786 * @param name to look up in the table
787 * @return the corresponding content URI, or null if not present
788 */
789 public static Uri getUriFor(String name) {
790 if (MOVED_TO_SECURE.contains(name)) {
791 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
792 + " to android.provider.Settings.Secure, returning Secure URI.");
793 return Secure.getUriFor(Secure.CONTENT_URI, name);
794 }
795 return getUriFor(CONTENT_URI, name);
796 }
797
798 /**
799 * Convenience function for retrieving a single system settings value
800 * as an integer. Note that internally setting values are always
801 * stored as strings; this function converts the string to an integer
802 * for you. The default value will be returned if the setting is
803 * not defined or not an integer.
804 *
805 * @param cr The ContentResolver to access.
806 * @param name The name of the setting to retrieve.
807 * @param def Value to return if the setting is not defined.
808 *
809 * @return The setting's current value, or 'def' if it is not defined
810 * or not a valid integer.
811 */
812 public static int getInt(ContentResolver cr, String name, int def) {
813 String v = getString(cr, name);
814 try {
815 return v != null ? Integer.parseInt(v) : def;
816 } catch (NumberFormatException e) {
817 return def;
818 }
819 }
820
821 /**
822 * Convenience function for retrieving a single system settings value
823 * as an integer. Note that internally setting values are always
824 * stored as strings; this function converts the string to an integer
825 * for you.
826 * <p>
827 * This version does not take a default value. If the setting has not
828 * been set, or the string value is not a number,
829 * it throws {@link SettingNotFoundException}.
830 *
831 * @param cr The ContentResolver to access.
832 * @param name The name of the setting to retrieve.
833 *
834 * @throws SettingNotFoundException Thrown if a setting by the given
835 * name can't be found or the setting value is not an integer.
836 *
837 * @return The setting's current value.
838 */
839 public static int getInt(ContentResolver cr, String name)
840 throws SettingNotFoundException {
841 String v = getString(cr, name);
842 try {
843 return Integer.parseInt(v);
844 } catch (NumberFormatException e) {
845 throw new SettingNotFoundException(name);
846 }
847 }
848
849 /**
850 * Convenience function for updating a single settings value as an
851 * integer. This will either create a new entry in the table if the
852 * given name does not exist, or modify the value of the existing row
853 * with that name. Note that internally setting values are always
854 * stored as strings, so this function converts the given value to a
855 * string before storing it.
856 *
857 * @param cr The ContentResolver to access.
858 * @param name The name of the setting to modify.
859 * @param value The new value for the setting.
860 * @return true if the value was set, false on database errors
861 */
862 public static boolean putInt(ContentResolver cr, String name, int value) {
863 return putString(cr, name, Integer.toString(value));
864 }
865
866 /**
867 * Convenience function for retrieving a single system settings value
868 * as a {@code long}. Note that internally setting values are always
869 * stored as strings; this function converts the string to a {@code long}
870 * for you. The default value will be returned if the setting is
871 * not defined or not a {@code long}.
872 *
873 * @param cr The ContentResolver to access.
874 * @param name The name of the setting to retrieve.
875 * @param def Value to return if the setting is not defined.
876 *
877 * @return The setting's current value, or 'def' if it is not defined
878 * or not a valid {@code long}.
879 */
880 public static long getLong(ContentResolver cr, String name, long def) {
881 String valString = getString(cr, name);
882 long value;
883 try {
884 value = valString != null ? Long.parseLong(valString) : def;
885 } catch (NumberFormatException e) {
886 value = def;
887 }
888 return value;
889 }
890
891 /**
892 * Convenience function for retrieving a single system settings value
893 * as a {@code long}. Note that internally setting values are always
894 * stored as strings; this function converts the string to a {@code long}
895 * for you.
896 * <p>
897 * This version does not take a default value. If the setting has not
898 * been set, or the string value is not a number,
899 * it throws {@link SettingNotFoundException}.
900 *
901 * @param cr The ContentResolver to access.
902 * @param name The name of the setting to retrieve.
903 *
904 * @return The setting's current value.
905 * @throws SettingNotFoundException Thrown if a setting by the given
906 * name can't be found or the setting value is not an integer.
907 */
908 public static long getLong(ContentResolver cr, String name)
909 throws SettingNotFoundException {
910 String valString = getString(cr, name);
911 try {
912 return Long.parseLong(valString);
913 } catch (NumberFormatException e) {
914 throw new SettingNotFoundException(name);
915 }
916 }
917
918 /**
919 * Convenience function for updating a single settings value as a long
920 * integer. This will either create a new entry in the table if the
921 * given name does not exist, or modify the value of the existing row
922 * with that name. Note that internally setting values are always
923 * stored as strings, so this function converts the given value to a
924 * string before storing it.
925 *
926 * @param cr The ContentResolver to access.
927 * @param name The name of the setting to modify.
928 * @param value The new value for the setting.
929 * @return true if the value was set, false on database errors
930 */
931 public static boolean putLong(ContentResolver cr, String name, long value) {
932 return putString(cr, name, Long.toString(value));
933 }
934
935 /**
936 * Convenience function for retrieving a single system settings value
937 * as a floating point number. Note that internally setting values are
938 * always stored as strings; this function converts the string to an
939 * float for you. The default value will be returned if the setting
940 * is not defined or not a valid float.
941 *
942 * @param cr The ContentResolver to access.
943 * @param name The name of the setting to retrieve.
944 * @param def Value to return if the setting is not defined.
945 *
946 * @return The setting's current value, or 'def' if it is not defined
947 * or not a valid float.
948 */
949 public static float getFloat(ContentResolver cr, String name, float def) {
950 String v = getString(cr, name);
951 try {
952 return v != null ? Float.parseFloat(v) : def;
953 } catch (NumberFormatException e) {
954 return def;
955 }
956 }
957
958 /**
959 * Convenience function for retrieving a single system settings value
960 * as a float. Note that internally setting values are always
961 * stored as strings; this function converts the string to a float
962 * for you.
963 * <p>
964 * This version does not take a default value. If the setting has not
965 * been set, or the string value is not a number,
966 * it throws {@link SettingNotFoundException}.
967 *
968 * @param cr The ContentResolver to access.
969 * @param name The name of the setting to retrieve.
970 *
971 * @throws SettingNotFoundException Thrown if a setting by the given
972 * name can't be found or the setting value is not a float.
973 *
974 * @return The setting's current value.
975 */
976 public static float getFloat(ContentResolver cr, String name)
977 throws SettingNotFoundException {
978 String v = getString(cr, name);
979 try {
980 return Float.parseFloat(v);
981 } catch (NumberFormatException e) {
982 throw new SettingNotFoundException(name);
983 }
984 }
985
986 /**
987 * Convenience function for updating a single settings value as a
988 * floating point number. This will either create a new entry in the
989 * table if the given name does not exist, or modify the value of the
990 * existing row with that name. Note that internally setting values
991 * are always stored as strings, so this function converts the given
992 * value to a string before storing it.
993 *
994 * @param cr The ContentResolver to access.
995 * @param name The name of the setting to modify.
996 * @param value The new value for the setting.
997 * @return true if the value was set, false on database errors
998 */
999 public static boolean putFloat(ContentResolver cr, String name, float value) {
1000 return putString(cr, name, Float.toString(value));
1001 }
1002
1003 /**
1004 * Convenience function to read all of the current
1005 * configuration-related settings into a
1006 * {@link Configuration} object.
1007 *
1008 * @param cr The ContentResolver to access.
1009 * @param outConfig Where to place the configuration settings.
1010 */
1011 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
1012 outConfig.fontScale = Settings.System.getFloat(
1013 cr, FONT_SCALE, outConfig.fontScale);
1014 if (outConfig.fontScale < 0) {
1015 outConfig.fontScale = 1;
1016 }
1017 }
1018
1019 /**
1020 * Convenience function to write a batch of configuration-related
1021 * settings from a {@link Configuration} object.
1022 *
1023 * @param cr The ContentResolver to access.
1024 * @param config The settings to write.
1025 * @return true if the values were set, false on database errors
1026 */
1027 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
1028 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
1029 }
1030
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08001031 /** @hide */
1032 public static boolean hasInterestingConfigurationChanges(int changes) {
1033 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1034 }
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07001035
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001036 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1037 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
1038 }
1039
1040 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1041 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
1042 }
1043
1044 /**
1045 * The content:// style URL for this table
1046 */
1047 public static final Uri CONTENT_URI =
1048 Uri.parse("content://" + AUTHORITY + "/system");
1049
1050 /**
1051 * Whether we keep the device on while the device is plugged in.
1052 * Supported values are:
1053 * <ul>
1054 * <li>{@code 0} to never stay on while plugged in</li>
1055 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
1056 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
1057 * </ul>
1058 * These values can be OR-ed together.
1059 */
1060 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
1061
1062 /**
1063 * What happens when the user presses the end call button if they're not
1064 * on a call.<br/>
1065 * <b>Values:</b><br/>
1066 * 0 - The end button does nothing.<br/>
1067 * 1 - The end button goes to the home screen.<br/>
1068 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1069 * 3 - The end button goes to the home screen. If the user is already on the
1070 * home screen, it puts the device to sleep.
1071 */
1072 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1073
1074 /**
David Brown458e8062010-03-08 21:52:11 -08001075 * END_BUTTON_BEHAVIOR value for "go home".
1076 * @hide
1077 */
1078 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1079
1080 /**
1081 * END_BUTTON_BEHAVIOR value for "go to sleep".
1082 * @hide
1083 */
1084 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1085
1086 /**
1087 * END_BUTTON_BEHAVIOR default value.
1088 * @hide
1089 */
1090 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1091
1092 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001093 * Whether Airplane Mode is on.
1094 */
1095 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
1096
1097 /**
1098 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
1099 */
1100 public static final String RADIO_BLUETOOTH = "bluetooth";
1101
1102 /**
1103 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
1104 */
1105 public static final String RADIO_WIFI = "wifi";
1106
1107 /**
1108 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
1109 */
1110 public static final String RADIO_CELL = "cell";
1111
1112 /**
1113 * A comma separated list of radios that need to be disabled when airplane mode
1114 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
1115 * included in the comma separated list.
1116 */
1117 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
1118
1119 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -07001120 * A comma separated list of radios that should to be disabled when airplane mode
1121 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
1122 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
1123 * will be turned off when entering airplane mode, but the user will be able to reenable
1124 * Wifi in the Settings app.
1125 *
1126 * {@hide}
1127 */
1128 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
1129
1130 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001131 * The policy for deciding when Wi-Fi should go to sleep (which will in
1132 * turn switch to using the mobile data as an Internet connection).
1133 * <p>
1134 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
1135 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
1136 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001137 */
1138 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
1139
1140 /**
1141 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
1142 * policy, which is to sleep shortly after the turning off
1143 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001144 */
1145 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
1146
1147 /**
1148 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
1149 * the device is on battery, and never go to sleep when the device is
1150 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001151 */
1152 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001153
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001154 /**
1155 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001156 */
1157 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001158
Irfan Sheriff31b62322010-08-30 12:26:00 -07001159 //TODO: deprecate static IP constants
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001160 /**
1161 * Whether to use static IP and other static network attributes.
1162 * <p>
1163 * Set to 1 for true and 0 for false.
1164 */
1165 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1166
1167 /**
1168 * The static IP address.
1169 * <p>
1170 * Example: "192.168.1.51"
1171 */
1172 public static final String WIFI_STATIC_IP = "wifi_static_ip";
1173
1174 /**
1175 * If using static IP, the gateway's IP address.
1176 * <p>
1177 * Example: "192.168.1.1"
1178 */
1179 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
1180
1181 /**
1182 * If using static IP, the net mask.
1183 * <p>
1184 * Example: "255.255.255.0"
1185 */
1186 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
1187
1188 /**
1189 * If using static IP, the primary DNS's IP address.
1190 * <p>
1191 * Example: "192.168.1.1"
1192 */
1193 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1194
1195 /**
1196 * If using static IP, the secondary DNS's IP address.
1197 * <p>
1198 * Example: "192.168.1.2"
1199 */
1200 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1201
1202 /**
1203 * The number of radio channels that are allowed in the local
1204 * 802.11 regulatory domain.
1205 * @hide
1206 */
1207 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1208
1209 /**
1210 * Determines whether remote devices may discover and/or connect to
1211 * this device.
1212 * <P>Type: INT</P>
1213 * 2 -- discoverable and connectable
1214 * 1 -- connectable but not discoverable
1215 * 0 -- neither connectable nor discoverable
1216 */
1217 public static final String BLUETOOTH_DISCOVERABILITY =
1218 "bluetooth_discoverability";
1219
1220 /**
1221 * Bluetooth discoverability timeout. If this value is nonzero, then
1222 * Bluetooth becomes discoverable for a certain number of seconds,
1223 * after which is becomes simply connectable. The value is in seconds.
1224 */
1225 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1226 "bluetooth_discoverability_timeout";
1227
1228 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001229 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
1230 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001231 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001232 @Deprecated
1233 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001234
1235 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08001236 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
1237 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001238 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001239 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1241
1242 /**
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07001243 * @deprecated Use
Amith Yamasani156c4352010-03-05 17:10:03 -08001244 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
1245 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 */
Amith Yamasani156c4352010-03-05 17:10:03 -08001247 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001248 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1249 "lock_pattern_tactile_feedback_enabled";
1250
1251
1252 /**
1253 * A formatted string of the next alarm that is set, or the empty string
1254 * if there is no alarm set.
1255 */
1256 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1257
1258 /**
1259 * Scaling factor for fonts, float.
1260 */
1261 public static final String FONT_SCALE = "font_scale";
1262
1263 /**
1264 * Name of an application package to be debugged.
1265 */
1266 public static final String DEBUG_APP = "debug_app";
1267
1268 /**
1269 * If 1, when launching DEBUG_APP it will wait for the debugger before
1270 * starting user code. If 0, it will run normally.
1271 */
1272 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1273
1274 /**
1275 * Whether or not to dim the screen. 0=no 1=yes
1276 */
1277 public static final String DIM_SCREEN = "dim_screen";
1278
1279 /**
1280 * The timeout before the screen turns off.
1281 */
1282 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1283
1284 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001285 * If 0, the compatibility mode is off for all applications.
1286 * If 1, older applications run under compatibility mode.
1287 * TODO: remove this settings before code freeze (bug/1907571)
1288 * @hide
1289 */
1290 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1291
1292 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001293 * The screen backlight brightness between 0 and 255.
1294 */
1295 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1296
1297 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001298 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05001299 */
1300 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1301
1302 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001303 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001304 */
1305 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1306
1307 /**
1308 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001309 */
1310 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1311
1312 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001313 * Control whether the process CPU usage meter should be shown.
1314 */
1315 public static final String SHOW_PROCESSES = "show_processes";
1316
1317 /**
1318 * If 1, the activity manager will aggressively finish activities and
1319 * processes as soon as they are no longer needed. If 0, the normal
1320 * extended lifetime is used.
1321 */
1322 public static final String ALWAYS_FINISH_ACTIVITIES =
1323 "always_finish_activities";
1324
1325
1326 /**
1327 * Ringer mode. This is used internally, changing this value will not
1328 * change the ringer mode. See AudioManager.
1329 */
1330 public static final String MODE_RINGER = "mode_ringer";
1331
1332 /**
1333 * Determines which streams are affected by ringer mode changes. The
1334 * stream type's bit should be set to 1 if it should be muted when going
1335 * into an inaudible ringer mode.
1336 */
1337 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1338
1339 /**
1340 * Determines which streams are affected by mute. The
1341 * stream type's bit should be set to 1 if it should be muted when a mute request
1342 * is received.
1343 */
1344 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1345
1346 /**
1347 * Whether vibrate is on for different events. This is used internally,
1348 * changing this value will not change the vibrate. See AudioManager.
1349 */
1350 public static final String VIBRATE_ON = "vibrate_on";
1351
1352 /**
1353 * Ringer volume. This is used internally, changing this value will not
1354 * change the volume. See AudioManager.
1355 */
1356 public static final String VOLUME_RING = "volume_ring";
1357
1358 /**
1359 * System/notifications volume. This is used internally, changing this
1360 * value will not change the volume. See AudioManager.
1361 */
1362 public static final String VOLUME_SYSTEM = "volume_system";
1363
1364 /**
1365 * Voice call volume. This is used internally, changing this value will
1366 * not change the volume. See AudioManager.
1367 */
1368 public static final String VOLUME_VOICE = "volume_voice";
1369
1370 /**
1371 * Music/media/gaming volume. This is used internally, changing this
1372 * value will not change the volume. See AudioManager.
1373 */
1374 public static final String VOLUME_MUSIC = "volume_music";
1375
1376 /**
1377 * Alarm volume. This is used internally, changing this
1378 * value will not change the volume. See AudioManager.
1379 */
1380 public static final String VOLUME_ALARM = "volume_alarm";
1381
1382 /**
1383 * Notification volume. This is used internally, changing this
1384 * value will not change the volume. See AudioManager.
1385 */
1386 public static final String VOLUME_NOTIFICATION = "volume_notification";
1387
1388 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001389 * Bluetooth Headset volume. This is used internally, changing this value will
1390 * not change the volume. See AudioManager.
1391 */
1392 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1393
1394 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001395 * Whether the notifications should use the ring volume (value of 1) or
1396 * a separate notification volume (value of 0). In most cases, users
1397 * will have this enabled so the notification and ringer volumes will be
1398 * the same. However, power users can disable this and use the separate
1399 * notification volume control.
1400 * <p>
1401 * Note: This is a one-off setting that will be removed in the future
1402 * when there is profile support. For this reason, it is kept hidden
1403 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001404 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001405 * @hide
1406 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001407 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001408 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001409
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001410 /**
Daniel Sandler6329bf72010-02-26 15:17:44 -05001411 * Whether silent mode should allow vibration feedback. This is used
1412 * internally in AudioService and the Sound settings activity to
1413 * coordinate decoupling of vibrate and silent modes. This setting
1414 * will likely be removed in a future release with support for
1415 * audio/vibe feedback profiles.
1416 *
1417 * @hide
1418 */
1419 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
1420
1421 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001422 * The mapping of stream type (integer) to its setting.
1423 */
1424 public static final String[] VOLUME_SETTINGS = {
1425 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001426 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001427 };
1428
1429 /**
1430 * Appended to various volume related settings to record the previous
1431 * values before they the settings were affected by a silent/vibrate
1432 * ringer mode change.
1433 */
1434 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1435
1436 /**
1437 * Persistent store for the system-wide default ringtone URI.
1438 * <p>
1439 * If you need to play the default ringtone at any given time, it is recommended
1440 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1441 * to the set default ringtone at the time of playing.
1442 *
1443 * @see #DEFAULT_RINGTONE_URI
1444 */
1445 public static final String RINGTONE = "ringtone";
1446
1447 /**
1448 * A {@link Uri} that will point to the current default ringtone at any
1449 * given time.
1450 * <p>
1451 * If the current default ringtone is in the DRM provider and the caller
1452 * does not have permission, the exception will be a
1453 * FileNotFoundException.
1454 */
1455 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1456
1457 /**
1458 * Persistent store for the system-wide default notification sound.
1459 *
1460 * @see #RINGTONE
1461 * @see #DEFAULT_NOTIFICATION_URI
1462 */
1463 public static final String NOTIFICATION_SOUND = "notification_sound";
1464
1465 /**
1466 * A {@link Uri} that will point to the current default notification
1467 * sound at any given time.
1468 *
1469 * @see #DEFAULT_RINGTONE_URI
1470 */
1471 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1472
1473 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001474 * Persistent store for the system-wide default alarm alert.
1475 *
1476 * @see #RINGTONE
1477 * @see #DEFAULT_ALARM_ALERT_URI
1478 */
1479 public static final String ALARM_ALERT = "alarm_alert";
1480
1481 /**
1482 * A {@link Uri} that will point to the current default alarm alert at
1483 * any given time.
1484 *
1485 * @see #DEFAULT_ALARM_ALERT_URI
1486 */
1487 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1488
1489 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001490 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1491 */
1492 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1493
1494 /**
1495 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1496 */
1497 public static final String TEXT_AUTO_CAPS = "auto_caps";
1498
1499 /**
1500 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1501 * feature converts two spaces to a "." and space.
1502 */
1503 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001505 /**
1506 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1507 */
1508 public static final String TEXT_SHOW_PASSWORD = "show_password";
1509
1510 public static final String SHOW_GTALK_SERVICE_STATUS =
1511 "SHOW_GTALK_SERVICE_STATUS";
1512
1513 /**
1514 * Name of activity to use for wallpaper on the home screen.
1515 */
1516 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1517
1518 /**
1519 * Value to specify if the user prefers the date, time and time zone
1520 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1521 */
1522 public static final String AUTO_TIME = "auto_time";
1523
1524 /**
Amith Yamasaniad450be2010-09-16 16:47:00 -07001525 * Value to specify if the user prefers the time zone
1526 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1527 */
1528 public static final String AUTO_TIME_ZONE = "auto_time_zone";
1529
1530 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001531 * Display times as 12 or 24 hours
1532 * 12
1533 * 24
1534 */
1535 public static final String TIME_12_24 = "time_12_24";
1536
1537 /**
1538 * Date format string
1539 * mm/dd/yyyy
1540 * dd/mm/yyyy
1541 * yyyy/mm/dd
1542 */
1543 public static final String DATE_FORMAT = "date_format";
1544
1545 /**
1546 * Whether the setup wizard has been run before (on first boot), or if
1547 * it still needs to be run.
1548 *
1549 * nonzero = it has been run in the past
1550 * 0 = it has not been run in the past
1551 */
1552 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1553
1554 /**
1555 * Scaling factor for normal window animations. Setting to 0 will disable window
1556 * animations.
1557 */
1558 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1559
1560 /**
1561 * Scaling factor for activity transition animations. Setting to 0 will disable window
1562 * animations.
1563 */
1564 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1565
1566 /**
1567 * Scaling factor for normal window animations. Setting to 0 will disable window
1568 * animations.
1569 * @hide
1570 */
1571 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1572
1573 /**
1574 * Control whether the accelerometer will be used to change screen
1575 * orientation. If 0, it will not be used unless explicitly requested
1576 * by the application; if 1, it will be used by default unless explicitly
1577 * disabled by the application.
1578 */
1579 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1580
1581 /**
1582 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1583 * boolean (1 or 0).
1584 */
1585 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1586
1587 /**
David Kraused0f67152009-06-13 18:01:13 -05001588 * CDMA only settings
1589 * DTMF tone type played by the dialer when dialing.
1590 * 0 = Normal
1591 * 1 = Long
1592 * @hide
1593 */
1594 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1595
1596 /**
1597 * CDMA only settings
1598 * Emergency Tone 0 = Off
1599 * 1 = Alert
1600 * 2 = Vibrate
1601 * @hide
1602 */
1603 public static final String EMERGENCY_TONE = "emergency_tone";
1604
1605 /**
1606 * CDMA only settings
1607 * Whether the auto retry is enabled. The value is
1608 * boolean (1 or 0).
1609 * @hide
1610 */
1611 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1612
1613 /**
1614 * Whether the hearing aid is enabled. The value is
1615 * boolean (1 or 0).
1616 * @hide
1617 */
1618 public static final String HEARING_AID = "hearing_aid";
1619
1620 /**
1621 * CDMA only settings
1622 * TTY Mode
1623 * 0 = OFF
1624 * 1 = FULL
1625 * 2 = VCO
1626 * 3 = HCO
1627 * @hide
1628 */
1629 public static final String TTY_MODE = "tty_mode";
1630
1631 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001632 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1633 * boolean (1 or 0).
1634 */
1635 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001636
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001637 /**
1638 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1639 * boolean (1 or 0).
1640 */
1641 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001642
Mike LeBeau48603e72009-06-05 00:27:00 +01001643 /**
1644 * Whether live web suggestions while the user types into search dialogs are
1645 * enabled. Browsers and other search UIs should respect this, as it allows
1646 * a user to avoid sending partial queries to a search engine, if it poses
1647 * any privacy concern. The value is boolean (1 or 0).
1648 */
1649 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001650
-b master501eec92009-07-06 13:53:11 -07001651 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001652 * Whether the notification LED should repeatedly flash when a notification is
1653 * pending. The value is boolean (1 or 0).
1654 * @hide
1655 */
1656 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1657
1658 /**
Dianne Hackborn90d2db32010-02-11 22:19:06 -08001659 * Show pointer location on screen?
1660 * 0 = no
1661 * 1 = yes
1662 * @hide
1663 */
1664 public static final String POINTER_LOCATION = "pointer_location";
1665
1666 /**
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05001667 * Whether to play a sound for low-battery alerts.
1668 * @hide
1669 */
1670 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
1671
1672 /**
1673 * Whether to play a sound for dock events.
1674 * @hide
1675 */
1676 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
1677
1678 /**
1679 * Whether to play sounds when the keyguard is shown and dismissed.
1680 * @hide
1681 */
1682 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
1683
1684 /**
1685 * URI for the low battery sound file.
1686 * @hide
1687 */
1688 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
1689
1690 /**
1691 * URI for the desk dock "in" event sound.
1692 * @hide
1693 */
1694 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
1695
1696 /**
1697 * URI for the desk dock "out" event sound.
1698 * @hide
1699 */
1700 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
1701
1702 /**
1703 * URI for the car dock "in" event sound.
1704 * @hide
1705 */
1706 public static final String CAR_DOCK_SOUND = "car_dock_sound";
1707
1708 /**
1709 * URI for the car dock "out" event sound.
1710 * @hide
1711 */
1712 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
1713
1714 /**
1715 * URI for the "device locked" (keyguard shown) sound.
1716 * @hide
1717 */
1718 public static final String LOCK_SOUND = "lock_sound";
1719
1720 /**
1721 * URI for the "device unlocked" (keyguard dismissed) sound.
1722 * @hide
1723 */
1724 public static final String UNLOCK_SOUND = "unlock_sound";
1725
1726 /**
Mike Lockwoodeabe8bf2010-08-31 14:35:23 -04001727 * True if we should appear as a PTP device instead of MTP.
1728 * @hide
1729 */
1730 public static final String USE_PTP_INTERFACE = "use_ptp_interface";
1731
1732 /**
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08001733 * Receive incoming SIP calls?
1734 * 0 = no
1735 * 1 = yes
1736 * @hide
1737 */
1738 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
1739
1740 /**
1741 * Call Preference String.
1742 * "SIP_ALWAYS" : Always use SIP with network access
1743 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
1744 * "SIP_ASK_ME_EACH_TIME" : Always ask me each time
1745 * @hide
1746 */
1747 public static final String SIP_CALL_OPTIONS = "sip_call_options";
1748
1749 /**
1750 * One of the sip call options: Always use SIP with network access.
1751 * @hide
1752 */
1753 public static final String SIP_ALWAYS = "SIP_ALWAYS";
1754
1755 /**
1756 * One of the sip call options: Only if destination is a SIP address.
1757 * @hide
1758 */
1759 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
1760
1761 /**
1762 * One of the sip call options: Always ask me each time.
1763 * @hide
1764 */
1765 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
1766
1767 /**
-b master501eec92009-07-06 13:53:11 -07001768 * Settings to backup. This is here so that it's in the same place as the settings
1769 * keys and easy to update.
1770 * @hide
1771 */
1772 public static final String[] SETTINGS_TO_BACKUP = {
1773 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001774 WIFI_SLEEP_POLICY,
1775 WIFI_USE_STATIC_IP,
1776 WIFI_STATIC_IP,
1777 WIFI_STATIC_GATEWAY,
1778 WIFI_STATIC_NETMASK,
1779 WIFI_STATIC_DNS1,
1780 WIFI_STATIC_DNS2,
1781 BLUETOOTH_DISCOVERABILITY,
1782 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1783 DIM_SCREEN,
1784 SCREEN_OFF_TIMEOUT,
1785 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001786 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001787 VIBRATE_ON,
1788 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001789 MODE_RINGER,
1790 MODE_RINGER_STREAMS_AFFECTED,
1791 MUTE_STREAMS_AFFECTED,
1792 VOLUME_VOICE,
1793 VOLUME_SYSTEM,
1794 VOLUME_RING,
1795 VOLUME_MUSIC,
1796 VOLUME_ALARM,
1797 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001798 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001799 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1800 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1801 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1802 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1803 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1804 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001805 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
Daniel Sandler1c7fa482010-03-10 09:45:01 -05001806 VIBRATE_IN_SILENT,
-b master501eec92009-07-06 13:53:11 -07001807 TEXT_AUTO_REPLACE,
1808 TEXT_AUTO_CAPS,
1809 TEXT_AUTO_PUNCTUATE,
1810 TEXT_SHOW_PASSWORD,
1811 AUTO_TIME,
Amith Yamasaniad450be2010-09-16 16:47:00 -07001812 AUTO_TIME_ZONE,
-b master501eec92009-07-06 13:53:11 -07001813 TIME_12_24,
1814 DATE_FORMAT,
1815 ACCELEROMETER_ROTATION,
1816 DTMF_TONE_WHEN_DIALING,
1817 DTMF_TONE_TYPE_WHEN_DIALING,
1818 EMERGENCY_TONE,
1819 CALL_AUTO_RETRY,
1820 HEARING_AID,
1821 TTY_MODE,
1822 SOUND_EFFECTS_ENABLED,
1823 HAPTIC_FEEDBACK_ENABLED,
Christopher Tate14c2d792010-02-25 16:49:44 -08001824 POWER_SOUNDS_ENABLED,
1825 DOCK_SOUNDS_ENABLED,
1826 LOCKSCREEN_SOUNDS_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001827 SHOW_WEB_SUGGESTIONS,
Mike Lockwoodeabe8bf2010-08-31 14:35:23 -04001828 NOTIFICATION_LIGHT_PULSE,
1829 USE_PTP_INTERFACE,
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08001830 SIP_CALL_OPTIONS,
Nick Pelly038cabe2010-09-23 16:12:11 -07001831 SIP_RECEIVE_CALLS,
-b master501eec92009-07-06 13:53:11 -07001832 };
1833
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001834 // Settings moved to Settings.Secure
1835
1836 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001837 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001838 * instead
1839 */
1840 @Deprecated
1841 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1842
1843 /**
1844 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1845 */
1846 @Deprecated
1847 public static final String ANDROID_ID = Secure.ANDROID_ID;
1848
1849 /**
1850 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1851 */
1852 @Deprecated
1853 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1854
1855 /**
1856 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1857 */
1858 @Deprecated
1859 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1860
1861 /**
1862 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1863 */
1864 @Deprecated
1865 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1866
1867 /**
1868 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1869 */
1870 @Deprecated
1871 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1872
1873 /**
1874 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1875 */
1876 @Deprecated
1877 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001878
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001879 /**
1880 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1881 * instead
1882 */
1883 @Deprecated
1884 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1885
1886 /**
1887 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1888 */
1889 @Deprecated
1890 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001891
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001892 /**
1893 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1894 */
1895 @Deprecated
1896 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1897
1898 /**
1899 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1900 * instead
1901 */
1902 @Deprecated
1903 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1904
1905 /**
1906 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1907 * instead
1908 */
1909 @Deprecated
1910 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1911
1912 /**
1913 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1914 * instead
1915 */
1916 @Deprecated
1917 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1918 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1919
1920 /**
1921 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1922 */
1923 @Deprecated
1924 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1925
1926 /**
1927 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1928 */
1929 @Deprecated
1930 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001931
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001932 /**
1933 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1934 */
1935 @Deprecated
1936 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1937
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001938 /**
1939 * @deprecated Use
1940 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1941 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001942 @Deprecated
1943 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1944
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001945 /**
1946 * @deprecated Use
1947 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1948 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 @Deprecated
1950 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1951 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1952
1953 /**
1954 * @deprecated Use
1955 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1956 */
1957 @Deprecated
1958 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1959 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1960
1961 /**
1962 * @deprecated Use
1963 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1964 */
1965 @Deprecated
1966 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1967 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001968
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001969 /**
1970 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1971 * instead
1972 */
1973 @Deprecated
1974 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1975
1976 /**
1977 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1978 */
1979 @Deprecated
1980 public static final String WIFI_ON = Secure.WIFI_ON;
1981
1982 /**
1983 * @deprecated Use
1984 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1985 * instead
1986 */
1987 @Deprecated
1988 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1989 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1990
1991 /**
1992 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1993 */
1994 @Deprecated
1995 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1996
1997 /**
1998 * @deprecated Use
1999 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
2000 */
2001 @Deprecated
2002 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2003 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002004
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002005 /**
2006 * @deprecated Use
2007 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
2008 */
2009 @Deprecated
2010 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2011 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
2012
2013 /**
2014 * @deprecated Use
2015 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
2016 * instead
2017 */
2018 @Deprecated
2019 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2020 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
2021
2022 /**
2023 * @deprecated Use
2024 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
2025 */
2026 @Deprecated
2027 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2028 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
2029
2030 /**
2031 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
2032 * instead
2033 */
2034 @Deprecated
2035 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
2036
2037 /**
2038 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
2039 */
2040 @Deprecated
2041 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
2042
2043 /**
2044 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
2045 */
2046 @Deprecated
2047 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
2048
2049 /**
2050 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
2051 * instead
2052 */
2053 @Deprecated
2054 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
2055
2056 /**
2057 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
2058 * instead
2059 */
2060 @Deprecated
2061 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
2062 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
2063 }
2064
2065 /**
2066 * Secure system settings, containing system preferences that applications
2067 * can read but are not allowed to write. These are for preferences that
2068 * the user must explicitly modify through the system UI or specialized
2069 * APIs for those values, not modified directly by applications.
2070 */
2071 public static final class Secure extends NameValueTable {
2072 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
2073
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002074 // Populated lazily, guarded by class object:
2075 private static NameValueCache sNameValueCache = null;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076
2077 /**
2078 * Look up a name in the database.
2079 * @param resolver to access the database with
2080 * @param name to look up in the table
2081 * @return the corresponding value, or null if not present
2082 */
2083 public synchronized static String getString(ContentResolver resolver, String name) {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002084 if (sNameValueCache == null) {
2085 sNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI,
2086 CALL_METHOD_GET_SECURE);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002087 }
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08002088 return sNameValueCache.getString(resolver, name);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002089 }
2090
2091 /**
2092 * Store a name/value pair into the database.
2093 * @param resolver to access the database with
2094 * @param name to store
2095 * @param value to associate with the name
2096 * @return true if the value was set, false on database errors
2097 */
2098 public static boolean putString(ContentResolver resolver,
2099 String name, String value) {
2100 return putString(resolver, CONTENT_URI, name, value);
2101 }
2102
2103 /**
2104 * Construct the content URI for a particular name/value pair,
2105 * useful for monitoring changes with a ContentObserver.
2106 * @param name to look up in the table
2107 * @return the corresponding content URI, or null if not present
2108 */
2109 public static Uri getUriFor(String name) {
2110 return getUriFor(CONTENT_URI, name);
2111 }
2112
2113 /**
2114 * Convenience function for retrieving a single secure settings value
2115 * as an integer. Note that internally setting values are always
2116 * stored as strings; this function converts the string to an integer
2117 * for you. The default value will be returned if the setting is
2118 * not defined or not an integer.
2119 *
2120 * @param cr The ContentResolver to access.
2121 * @param name The name of the setting to retrieve.
2122 * @param def Value to return if the setting is not defined.
2123 *
2124 * @return The setting's current value, or 'def' if it is not defined
2125 * or not a valid integer.
2126 */
2127 public static int getInt(ContentResolver cr, String name, int def) {
2128 String v = getString(cr, name);
2129 try {
2130 return v != null ? Integer.parseInt(v) : def;
2131 } catch (NumberFormatException e) {
2132 return def;
2133 }
2134 }
2135
2136 /**
2137 * Convenience function for retrieving a single secure settings value
2138 * as an integer. Note that internally setting values are always
2139 * stored as strings; this function converts the string to an integer
2140 * for you.
2141 * <p>
2142 * This version does not take a default value. If the setting has not
2143 * been set, or the string value is not a number,
2144 * it throws {@link SettingNotFoundException}.
2145 *
2146 * @param cr The ContentResolver to access.
2147 * @param name The name of the setting to retrieve.
2148 *
2149 * @throws SettingNotFoundException Thrown if a setting by the given
2150 * name can't be found or the setting value is not an integer.
2151 *
2152 * @return The setting's current value.
2153 */
2154 public static int getInt(ContentResolver cr, String name)
2155 throws SettingNotFoundException {
2156 String v = getString(cr, name);
2157 try {
2158 return Integer.parseInt(v);
2159 } catch (NumberFormatException e) {
2160 throw new SettingNotFoundException(name);
2161 }
2162 }
2163
2164 /**
2165 * Convenience function for updating a single settings value as an
2166 * integer. This will either create a new entry in the table if the
2167 * given name does not exist, or modify the value of the existing row
2168 * with that name. Note that internally setting values are always
2169 * stored as strings, so this function converts the given value to a
2170 * string before storing it.
2171 *
2172 * @param cr The ContentResolver to access.
2173 * @param name The name of the setting to modify.
2174 * @param value The new value for the setting.
2175 * @return true if the value was set, false on database errors
2176 */
2177 public static boolean putInt(ContentResolver cr, String name, int value) {
2178 return putString(cr, name, Integer.toString(value));
2179 }
2180
2181 /**
2182 * Convenience function for retrieving a single secure settings value
2183 * as a {@code long}. Note that internally setting values are always
2184 * stored as strings; this function converts the string to a {@code long}
2185 * for you. The default value will be returned if the setting is
2186 * not defined or not a {@code long}.
2187 *
2188 * @param cr The ContentResolver to access.
2189 * @param name The name of the setting to retrieve.
2190 * @param def Value to return if the setting is not defined.
2191 *
2192 * @return The setting's current value, or 'def' if it is not defined
2193 * or not a valid {@code long}.
2194 */
2195 public static long getLong(ContentResolver cr, String name, long def) {
2196 String valString = getString(cr, name);
2197 long value;
2198 try {
2199 value = valString != null ? Long.parseLong(valString) : def;
2200 } catch (NumberFormatException e) {
2201 value = def;
2202 }
2203 return value;
2204 }
2205
2206 /**
2207 * Convenience function for retrieving a single secure settings value
2208 * as a {@code long}. Note that internally setting values are always
2209 * stored as strings; this function converts the string to a {@code long}
2210 * for you.
2211 * <p>
2212 * This version does not take a default value. If the setting has not
2213 * been set, or the string value is not a number,
2214 * it throws {@link SettingNotFoundException}.
2215 *
2216 * @param cr The ContentResolver to access.
2217 * @param name The name of the setting to retrieve.
2218 *
2219 * @return The setting's current value.
2220 * @throws SettingNotFoundException Thrown if a setting by the given
2221 * name can't be found or the setting value is not an integer.
2222 */
2223 public static long getLong(ContentResolver cr, String name)
2224 throws SettingNotFoundException {
2225 String valString = getString(cr, name);
2226 try {
2227 return Long.parseLong(valString);
2228 } catch (NumberFormatException e) {
2229 throw new SettingNotFoundException(name);
2230 }
2231 }
2232
2233 /**
2234 * Convenience function for updating a secure settings value as a long
2235 * integer. This will either create a new entry in the table if the
2236 * given name does not exist, or modify the value of the existing row
2237 * with that name. Note that internally setting values are always
2238 * stored as strings, so this function converts the given value to a
2239 * string before storing it.
2240 *
2241 * @param cr The ContentResolver to access.
2242 * @param name The name of the setting to modify.
2243 * @param value The new value for the setting.
2244 * @return true if the value was set, false on database errors
2245 */
2246 public static boolean putLong(ContentResolver cr, String name, long value) {
2247 return putString(cr, name, Long.toString(value));
2248 }
2249
2250 /**
2251 * Convenience function for retrieving a single secure settings value
2252 * as a floating point number. Note that internally setting values are
2253 * always stored as strings; this function converts the string to an
2254 * float for you. The default value will be returned if the setting
2255 * is not defined or not a valid float.
2256 *
2257 * @param cr The ContentResolver to access.
2258 * @param name The name of the setting to retrieve.
2259 * @param def Value to return if the setting is not defined.
2260 *
2261 * @return The setting's current value, or 'def' if it is not defined
2262 * or not a valid float.
2263 */
2264 public static float getFloat(ContentResolver cr, String name, float def) {
2265 String v = getString(cr, name);
2266 try {
2267 return v != null ? Float.parseFloat(v) : def;
2268 } catch (NumberFormatException e) {
2269 return def;
2270 }
2271 }
2272
2273 /**
2274 * Convenience function for retrieving a single secure settings value
2275 * as a float. Note that internally setting values are always
2276 * stored as strings; this function converts the string to a float
2277 * for you.
2278 * <p>
2279 * This version does not take a default value. If the setting has not
2280 * been set, or the string value is not a number,
2281 * it throws {@link SettingNotFoundException}.
2282 *
2283 * @param cr The ContentResolver to access.
2284 * @param name The name of the setting to retrieve.
2285 *
2286 * @throws SettingNotFoundException Thrown if a setting by the given
2287 * name can't be found or the setting value is not a float.
2288 *
2289 * @return The setting's current value.
2290 */
2291 public static float getFloat(ContentResolver cr, String name)
2292 throws SettingNotFoundException {
2293 String v = getString(cr, name);
2294 try {
2295 return Float.parseFloat(v);
2296 } catch (NumberFormatException e) {
2297 throw new SettingNotFoundException(name);
2298 }
2299 }
2300
2301 /**
2302 * Convenience function for updating a single settings value as a
2303 * floating point number. This will either create a new entry in the
2304 * table if the given name does not exist, or modify the value of the
2305 * existing row with that name. Note that internally setting values
2306 * are always stored as strings, so this function converts the given
2307 * value to a string before storing it.
2308 *
2309 * @param cr The ContentResolver to access.
2310 * @param name The name of the setting to modify.
2311 * @param value The new value for the setting.
2312 * @return true if the value was set, false on database errors
2313 */
2314 public static boolean putFloat(ContentResolver cr, String name, float value) {
2315 return putString(cr, name, Float.toString(value));
2316 }
2317
2318 /**
2319 * The content:// style URL for this table
2320 */
2321 public static final Uri CONTENT_URI =
2322 Uri.parse("content://" + AUTHORITY + "/secure");
2323
2324 /**
2325 * Whether ADB is enabled.
2326 */
2327 public static final String ADB_ENABLED = "adb_enabled";
2328
2329 /**
2330 * Setting to allow mock locations and location provider status to be injected into the
2331 * LocationManager service for testing purposes during application development. These
2332 * locations and status values override actual location and status information generated
2333 * by network, gps, or other location providers.
2334 */
2335 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2336
2337 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08002338 * A 64-bit number (as a hex string) that is randomly
2339 * generated on the device's first boot and should remain
2340 * constant for the lifetime of the device. (The value may
2341 * change if a factory reset is performed on the device.)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 */
2343 public static final String ANDROID_ID = "android_id";
2344
2345 /**
2346 * Whether bluetooth is enabled/disabled
2347 * 0=disabled. 1=enabled.
2348 */
2349 public static final String BLUETOOTH_ON = "bluetooth_on";
2350
2351 /**
2352 * Get the key that retrieves a bluetooth headset's priority.
2353 * @hide
2354 */
2355 public static final String getBluetoothHeadsetPriorityKey(String address) {
2356 return ("bluetooth_headset_priority_" + address.toUpperCase());
2357 }
2358
2359 /**
2360 * Get the key that retrieves a bluetooth a2dp sink's priority.
2361 * @hide
2362 */
2363 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2364 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2365 }
2366
2367 /**
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07002368 * Get the key that retrieves a bluetooth Input Device's priority.
2369 * @hide
2370 */
2371 public static final String getBluetoothInputDevicePriorityKey(String address) {
2372 return ("bluetooth_input_device_priority_" + address.toUpperCase());
2373 }
2374
2375 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002376 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2377 */
2378 public static final String DATA_ROAMING = "data_roaming";
2379
2380 /**
2381 * Setting to record the input method used by default, holding the ID
2382 * of the desired method.
2383 */
2384 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2385
2386 /**
satokab751aa2010-09-14 19:17:36 +09002387 * Setting to record the input method subtype used by default, holding the ID
2388 * of the desired method.
2389 */
2390 public static final String SELECTED_INPUT_METHOD_SUBTYPE =
2391 "selected_input_method_subtype";
2392
2393 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002394 * Whether the device has been provisioned (0 = false, 1 = true)
2395 */
2396 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002397
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002398 /**
2399 * List of input methods that are currently enabled. This is a string
2400 * containing the IDs of all enabled input methods, each ID separated
2401 * by ':'.
2402 */
2403 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002404
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002405 /**
Amith Yamasanie861ec12010-03-24 21:39:27 -07002406 * List of system input methods that are currently disabled. This is a string
2407 * containing the IDs of all disabled input methods, each ID separated
2408 * by ':'.
2409 * @hide
2410 */
2411 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
2412
2413 /**
Oscar Montemayor16fb7912010-08-02 09:38:48 -07002414 * Host name and port for global proxy.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002415 */
2416 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002417
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002418 /**
Oscar Montemayor16fb7912010-08-02 09:38:48 -07002419 * Exclusion list for global proxy. This string contains a list of comma-separated
2420 * domains where the global proxy does not apply. Domains should be listed in a comma-
2421 * separated list. Example of acceptable formats: ".domain1.com,my.domain2.com"
2422 * @hide
2423 */
2424 public static final String HTTP_PROXY_EXCLUSION_LIST = "http_proxy_exclusion_list";
2425
2426 /**
2427 * Enables the UI setting to allow the user to specify the global HTTP proxy
2428 * and associated exclusion list.
2429 * @hide
2430 */
2431 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
2432
2433 /**
Robert Greenwalte90aa5e2010-09-01 11:34:05 -07002434 * Setting for default DNS in case nobody suggests one
2435 * @hide
2436 */
2437 public static final String DEFAULT_DNS_SERVER = "default_dns_server";
2438
2439 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002440 * Whether the package installer should allow installation of apps downloaded from
2441 * sources other than the Android Market (vending machine).
2442 *
2443 * 1 = allow installing from other sources
2444 * 0 = only allow installing from the Android Market
2445 */
2446 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002447
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002448 /**
2449 * Comma-separated list of location providers that activities may access.
2450 */
2451 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002452
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002453 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08002454 * Whether autolock is enabled (0 = false, 1 = true)
2455 */
2456 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
2457
2458 /**
2459 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
2460 */
2461 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2462
2463 /**
2464 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
2465 */
2466 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2467 "lock_pattern_tactile_feedback_enabled";
2468
2469 /**
Jim Millerbc4603b2010-08-30 21:21:34 -07002470 * This preference allows the device to be locked given time after screen goes off,
2471 * subject to current DeviceAdmin policy limits.
2472 * @hide
2473 */
2474 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
2475
2476
2477 /**
Jim Miller253a5ef2010-10-13 20:57:29 -07002478 * This preference contains the string that shows for owner info on LockScren.
2479 * @hide
2480 */
2481 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
2482
2483 /**
2484 * This preference enables showing the owner info on LockScren.
2485 * @hide
2486 */
2487 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
2488 "lock_screen_owner_info_enabled";
2489
2490 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002491 * Whether assisted GPS should be enabled or not.
2492 * @hide
2493 */
2494 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2495
2496 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002497 * The Logging ID (a unique 64-bit value) as a hex string.
2498 * Used as a pseudonymous identifier for logging.
2499 * @deprecated This identifier is poorly initialized and has
2500 * many collisions. It should not be used.
2501 */
2502 @Deprecated
2503 public static final String LOGGING_ID = "logging_id";
2504
2505 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002506 * User preference for which network(s) should be used. Only the
2507 * connectivity service should touch this.
2508 */
2509 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002510
2511 /**
Robert Greenwalt2a091d72010-02-11 18:18:40 -08002512 * Used to disable Tethering on a device - defaults to true
2513 * @hide
2514 */
2515 public static final String TETHER_SUPPORTED = "tether_supported";
2516
2517 /**
Robert Greenwalt77b32dd2010-06-03 18:57:26 -07002518 * Used to require DUN APN on the device or not - defaults to a build config value
2519 * which defaults to false
2520 * @hide
2521 */
2522 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
2523
2524 /**
2525 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
2526 * corresponding build config values are set it will override the APN DB
2527 * values.
2528 * Consists of a comma seperated list of strings:
2529 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
2530 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
2531 * @hide
2532 */
2533 public static final String TETHER_DUN_APN = "tether_dun_apn";
2534
2535 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002536 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002537 */
2538 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002539
2540 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002541 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 */
2543 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002544
2545 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08002546 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002547 */
2548 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002549
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002550 /**
Sen Hubde75702010-05-28 01:54:03 -07002551 * A positive value indicates the frequency of SamplingProfiler
2552 * taking snapshots in hertz. Zero value means SamplingProfiler is disabled.
2553 *
2554 * @hide
2555 */
2556 public static final String SAMPLING_PROFILER_HZ = "sampling_profiler_hz";
2557
2558 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002559 * Settings classname to launch when Settings is clicked from All
2560 * Applications. Needed because of user testing between the old
2561 * and new Settings apps.
2562 */
2563 // TODO: 881807
2564 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002566 /**
2567 * USB Mass Storage Enabled
2568 */
2569 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002570
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002571 /**
2572 * If this setting is set (to anything), then all references
2573 * to Gmail on the device must change to Google Mail.
2574 */
2575 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002576
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002577 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002578 * If accessibility is enabled.
2579 */
2580 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2581
2582 /**
2583 * List of the enabled accessibility providers.
2584 */
2585 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2586 "enabled_accessibility_services";
2587
2588 /**
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07002589 * If injection of accessibility enhancing JavaScript scripts
2590 * is enabled.
2591 * <p>
2592 * Note: Accessibility injecting scripts are served by the
2593 * Google infrastructure and enable users with disabilities to
2594 * efficiantly navigate in and explore web content.
2595 * </p>
2596 * <p>
2597 * This property represents a boolean value.
2598 * </p>
2599 * @hide
2600 */
2601 public static final String ACCESSIBILITY_SCRIPT_INJECTION =
2602 "accessibility_script_injection";
2603
2604 /**
2605 * Key bindings for navigation in built-in accessibility support for web content.
2606 * <p>
2607 * Note: These key bindings are for the built-in accessibility navigation for
2608 * web content which is used as a fall back solution if JavaScript in a WebView
2609 * is not enabled or the user has not opted-in script injection from Google.
2610 * </p>
2611 * <p>
2612 * The bindings are separated by semi-colon. A binding is a mapping from
2613 * a key to a sequence of actions (for more details look at
2614 * android.webkit.AccessibilityInjector). A key is represented as the hexademical
2615 * string representation of an integer obtained from a meta state (optional) shifted
2616 * sixteen times left and bitwise ored with a key code. An action is represented
2617 * as a hexademical string representation of an integer where the first two digits
2618 * are navigation action index, the second, the third, and the fourth digit pairs
2619 * represent the action arguments. The separate actions in a binding are colon
2620 * separated. The key and the action sequence it maps to are separated by equals.
2621 * </p>
2622 * <p>
2623 * For example, the binding below maps the DPAD right button to traverse the
2624 * current navigation axis once without firing an accessibility event and to
2625 * perform the same traversal again but to fire an event:
2626 * <code>
2627 * 0x16=0x01000100:0x01000101;
2628 * </code>
2629 * </p>
2630 * <p>
2631 * The goal of this binding is to enable dynamic rebinding of keys to
2632 * navigation actions for web content without requiring a framework change.
2633 * </p>
2634 * <p>
2635 * This property represents a string value.
2636 * </p>
2637 * @hide
2638 */
2639 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
2640 "accessibility_web_content_key_bindings";
2641
2642 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002643 * Setting to always use the default text-to-speech settings regardless
2644 * of the application settings.
2645 * 1 = override application settings,
2646 * 0 = use application settings (if specified).
2647 */
2648 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2649
2650 /**
2651 * Default text-to-speech engine speech rate. 100 = 1x
2652 */
2653 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2654
2655 /**
2656 * Default text-to-speech engine pitch. 100 = 1x
2657 */
2658 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2659
2660 /**
2661 * Default text-to-speech engine.
2662 */
2663 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2664
2665 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002666 * Default text-to-speech language.
2667 */
2668 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2669
2670 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002671 * Default text-to-speech country.
2672 */
2673 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2674
2675 /**
2676 * Default text-to-speech locale variant.
2677 */
2678 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2679
2680 /**
Charles Chenceffa152010-03-16 21:18:10 -07002681 * Space delimited list of plugin packages that are enabled.
2682 */
2683 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
2684
2685 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002686 * Whether to notify the user of open networks.
2687 * <p>
2688 * If not connected and the scan results have an open network, we will
2689 * put this notification up. If we attempt to connect to a network or
2690 * the open network(s) disappear, we remove the notification. When we
2691 * show the notification, we will not show it again for
2692 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2693 */
2694 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2695 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002697 /**
2698 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2699 * Connecting to a network will reset the timer.
2700 */
2701 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2702 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002703
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002704 /**
2705 * The number of radio channels that are allowed in the local
2706 * 802.11 regulatory domain.
2707 * @hide
2708 */
2709 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002711 /**
2712 * When the number of open networks exceeds this number, the
2713 * least-recently-used excess networks will be removed.
2714 */
2715 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002716
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002717 /**
2718 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2719 */
2720 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002721
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002722 /**
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002723 * Used to save the Wifi_ON state prior to tethering.
2724 * This state will be checked to restore Wifi after
2725 * the user turns off tethering.
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002726 *
2727 * @hide
2728 */
Irfan Sheriffa3bd4092010-03-24 17:58:59 -07002729 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
Irfan Sheriff5321aef2010-02-12 12:35:59 -08002730
2731 /**
Irfan Sheriff9ab518ad2010-03-12 15:48:17 -08002732 * AP SSID
2733 *
2734 * @hide
2735 */
2736 public static final String WIFI_AP_SSID = "wifi_ap_ssid";
2737
2738 /**
2739 * AP security
2740 *
2741 * @hide
2742 */
2743 public static final String WIFI_AP_SECURITY = "wifi_ap_security";
2744
2745 /**
2746 * AP passphrase
2747 *
2748 * @hide
2749 */
2750 public static final String WIFI_AP_PASSWD = "wifi_ap_passwd";
2751
2752 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002753 * The acceptable packet loss percentage (range 0 - 100) before trying
2754 * another AP on the same network.
2755 */
2756 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2757 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002758
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002759 /**
2760 * The number of access points required for a network in order for the
2761 * watchdog to monitor it.
2762 */
2763 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 /**
2766 * The delay between background checks.
2767 */
2768 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2769 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002770
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002771 /**
2772 * Whether the Wi-Fi watchdog is enabled for background checking even
2773 * after it thinks the user has connected to a good access point.
2774 */
2775 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2776 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002777
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002778 /**
2779 * The timeout for a background ping
2780 */
2781 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2782 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002784 /**
2785 * The number of initial pings to perform that *may* be ignored if they
2786 * fail. Again, if these fail, they will *not* be used in packet loss
2787 * calculation. For example, one network always seemed to time out for
2788 * the first couple pings, so this is set to 3 by default.
2789 */
2790 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2791 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002792
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 /**
2794 * The maximum number of access points (per network) to attempt to test.
2795 * If this number is reached, the watchdog will no longer monitor the
2796 * initial connection state for the network. This is a safeguard for
2797 * networks containing multiple APs whose DNS does not respond to pings.
2798 */
2799 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002800
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002801 /**
2802 * Whether the Wi-Fi watchdog is enabled.
2803 */
2804 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2805
2806 /**
2807 * 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 -08002808 */
2809 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2810
2811 /**
2812 * The number of pings to test if an access point is a good connection.
2813 */
2814 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002815
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002816 /**
2817 * The delay between pings.
2818 */
2819 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002820
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002821 /**
2822 * The timeout per ping.
2823 */
2824 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002825
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002826 /**
2827 * The maximum number of times we will retry a connection to an access
2828 * point for which we have failed in acquiring an IP address from DHCP.
2829 * 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 -08002830 */
2831 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002832
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002833 /**
2834 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2835 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 */
2837 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2838 "wifi_mobile_data_transition_wakelock_timeout_ms";
2839
2840 /**
2841 * Whether background data usage is allowed by the user. See
2842 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002843 */
2844 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002845
2846 /**
Bjorn Bringert98bfa392010-03-24 10:59:48 +00002847 * Origins for which browsers should allow geolocation by default.
2848 * The value is a space-separated list of origins.
2849 */
2850 public static final String ALLOWED_GEOLOCATION_ORIGINS
2851 = "allowed_geolocation_origins";
2852
2853 /**
Robert Greenwaltc03fa502010-02-23 18:58:05 -08002854 * Whether mobile data connections are allowed by the user. See
2855 * ConnectivityManager for more info.
2856 * @hide
2857 */
2858 public static final String MOBILE_DATA = "mobile_data";
2859
2860 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002861 * The CDMA roaming mode 0 = Home Networks, CDMA default
2862 * 1 = Roaming on Affiliated networks
2863 * 2 = Roaming on any networks
2864 * @hide
2865 */
2866 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2867
2868 /**
2869 * The CDMA subscription mode 0 = RUIM/SIM (default)
2870 * 1 = NV
2871 * @hide
2872 */
2873 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2874
2875 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002876 * The preferred network mode 7 = Global
2877 * 6 = EvDo only
2878 * 5 = CDMA w/o EvDo
2879 * 4 = CDMA / EvDo auto
2880 * 3 = GSM / WCDMA auto
2881 * 2 = WCDMA only
2882 * 1 = GSM only
2883 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002884 * @hide
2885 */
2886 public static final String PREFERRED_NETWORK_MODE =
2887 "preferred_network_mode";
2888
2889 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002890 * The preferred TTY mode 0 = TTy Off, CDMA default
2891 * 1 = TTY Full
2892 * 2 = TTY HCO
2893 * 3 = TTY VCO
2894 * @hide
2895 */
2896 public static final String PREFERRED_TTY_MODE =
2897 "preferred_tty_mode";
2898
2899
2900 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002901 * CDMA Cell Broadcast SMS
2902 * 0 = CDMA Cell Broadcast SMS disabled
2903 * 1 = CDMA Cell Broadcast SMS enabled
2904 * @hide
2905 */
2906 public static final String CDMA_CELL_BROADCAST_SMS =
2907 "cdma_cell_broadcast_sms";
2908
2909 /**
2910 * The cdma subscription 0 = Subscription from RUIM, when available
2911 * 1 = Subscription from NV
2912 * @hide
2913 */
2914 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2915 "preferred_cdma_subscription";
2916
2917 /**
2918 * Whether the enhanced voice privacy mode is enabled.
2919 * 0 = normal voice privacy
2920 * 1 = enhanced voice privacy
2921 * @hide
2922 */
2923 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2924
2925 /**
2926 * Whether the TTY mode mode is enabled.
2927 * 0 = disabled
2928 * 1 = enabled
2929 * @hide
2930 */
2931 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002932
2933 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002934 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002935 * Type: int ( 0 = disabled, 1 = enabled )
2936 * @hide
2937 */
2938 public static final String BACKUP_ENABLED = "backup_enabled";
2939
2940 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08002941 * Controls whether application data is automatically restored from backup
2942 * at install time.
2943 * Type: int ( 0 = disabled, 1 = enabled )
2944 * @hide
2945 */
2946 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
2947
2948 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002949 * Indicates whether settings backup has been fully provisioned.
2950 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2951 * @hide
2952 */
2953 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2954
2955 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002956 * Component of the transport to use for backup/restore.
2957 * @hide
2958 */
2959 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002960
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002961 /**
2962 * Version for which the setup wizard was last shown. Bumped for
2963 * each release when there is new setup information to show.
2964 * @hide
2965 */
2966 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002967
2968 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08002969 * How frequently (in seconds) to check the memory status of the
2970 * device.
2971 * @hide
2972 */
2973 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2974
2975 /**
2976 * Max frequency (in seconds) to log memory check stats, in realtime
2977 * seconds. This allows for throttling of logs when the device is
2978 * running for large amounts of time.
2979 * @hide
2980 */
2981 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2982 "memcheck_log_realtime_interval";
2983
2984 /**
2985 * Boolean indicating whether rebooting due to system memory checks
2986 * is enabled.
2987 * @hide
2988 */
2989 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2990
2991 /**
2992 * How many bytes the system process must be below to avoid scheduling
2993 * a soft reboot. This reboot will happen when it is next determined
2994 * to be a good time.
2995 * @hide
2996 */
2997 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2998
2999 /**
3000 * How many bytes the system process must be below to avoid scheduling
3001 * a hard reboot. This reboot will happen immediately.
3002 * @hide
3003 */
3004 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
3005
3006 /**
3007 * How many bytes the phone process must be below to avoid scheduling
3008 * a soft restart. This restart will happen when it is next determined
3009 * to be a good time.
3010 * @hide
3011 */
3012 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
3013
3014 /**
3015 * How many bytes the phone process must be below to avoid scheduling
3016 * a hard restart. This restart will happen immediately.
3017 * @hide
3018 */
3019 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
3020
3021 /**
3022 * Boolean indicating whether restarting the phone process due to
3023 * memory checks is enabled.
3024 * @hide
3025 */
3026 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
3027
3028 /**
3029 * First time during the day it is okay to kill processes
3030 * or reboot the device due to low memory situations. This number is
3031 * in seconds since midnight.
3032 * @hide
3033 */
3034 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
3035
3036 /**
3037 * Last time during the day it is okay to kill processes
3038 * or reboot the device due to low memory situations. This number is
3039 * in seconds since midnight.
3040 * @hide
3041 */
3042 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
3043
3044 /**
3045 * How long the screen must have been off in order to kill processes
3046 * or reboot. This number is in seconds. A value of -1 means to
3047 * entirely disregard whether the screen is on.
3048 * @hide
3049 */
3050 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
3051
3052 /**
3053 * How much time there must be until the next alarm in order to kill processes
3054 * or reboot. This number is in seconds. Note: this value must be
3055 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
3056 * always see an alarm scheduled within its time.
3057 * @hide
3058 */
3059 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
3060
3061 /**
3062 * How frequently to check whether it is a good time to restart things,
3063 * if the device is in a bad state. This number is in seconds. Note:
3064 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
3065 * the alarm to schedule the recheck will always appear within the
3066 * minimum "do not execute now" time.
3067 * @hide
3068 */
3069 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
3070
3071 /**
3072 * How frequently (in DAYS) to reboot the device. If 0, no reboots
3073 * will occur.
3074 * @hide
3075 */
3076 public static final String REBOOT_INTERVAL = "reboot_interval";
3077
3078 /**
3079 * First time during the day it is okay to force a reboot of the
3080 * device (if REBOOT_INTERVAL is set). This number is
3081 * in seconds since midnight.
3082 * @hide
3083 */
3084 public static final String REBOOT_START_TIME = "reboot_start_time";
3085
3086 /**
3087 * The window of time (in seconds) after each REBOOT_INTERVAL in which
3088 * a reboot can be executed. If 0, a reboot will always be executed at
3089 * exactly the given time. Otherwise, it will only be executed if
3090 * the device is idle within the window.
3091 * @hide
3092 */
3093 public static final String REBOOT_WINDOW = "reboot_window";
3094
3095 /**
Doug Zongker43866e02010-01-07 12:09:54 -08003096 * Threshold values for the duration and level of a discharge cycle, under
3097 * which we log discharge cycle info.
3098 * @hide
3099 */
3100 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3101 "battery_discharge_duration_threshold";
3102 /** @hide */
3103 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3104
3105 /**
3106 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3107 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3108 * will never display the "Report" button.
3109 * Type: int ( 0 = disallow, 1 = allow )
3110 * @hide
3111 */
3112 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3113
3114 /**
3115 * Nonzero causes Log.wtf() to crash.
3116 * @hide
3117 */
3118 public static final String WTF_IS_FATAL = "wtf_is_fatal";
3119
3120 /**
Jake Hambybb371632010-08-23 18:16:48 -07003121 * Maximum age of entries kept by {@link com.android.internal.os.IDropBoxManagerService}.
Doug Zongker43866e02010-01-07 12:09:54 -08003122 * @hide
3123 */
3124 public static final String DROPBOX_AGE_SECONDS =
3125 "dropbox_age_seconds";
3126 /**
Jake Hambybb371632010-08-23 18:16:48 -07003127 * Maximum number of entry files which {@link com.android.internal.os.IDropBoxManagerService} will keep around.
Dan Egnor3a8b0c12010-03-24 17:48:20 -07003128 * @hide
3129 */
3130 public static final String DROPBOX_MAX_FILES =
3131 "dropbox_max_files";
3132 /**
Jake Hambybb371632010-08-23 18:16:48 -07003133 * Maximum amount of disk space used by {@link com.android.internal.os.IDropBoxManagerService} no matter what.
Doug Zongker43866e02010-01-07 12:09:54 -08003134 * @hide
3135 */
3136 public static final String DROPBOX_QUOTA_KB =
3137 "dropbox_quota_kb";
3138 /**
Jake Hambybb371632010-08-23 18:16:48 -07003139 * Percent of free disk (excluding reserve) which {@link com.android.internal.os.IDropBoxManagerService} will use.
Doug Zongker43866e02010-01-07 12:09:54 -08003140 * @hide
3141 */
3142 public static final String DROPBOX_QUOTA_PERCENT =
3143 "dropbox_quota_percent";
3144 /**
Jake Hambybb371632010-08-23 18:16:48 -07003145 * Percent of total disk which {@link com.android.internal.os.IDropBoxManagerService} will never dip into.
Doug Zongker43866e02010-01-07 12:09:54 -08003146 * @hide
3147 */
3148 public static final String DROPBOX_RESERVE_PERCENT =
3149 "dropbox_reserve_percent";
3150 /**
3151 * Prefix for per-tag dropbox disable/enable settings.
3152 * @hide
3153 */
3154 public static final String DROPBOX_TAG_PREFIX =
3155 "dropbox:";
Dan Egnora455d192010-03-12 08:52:28 -08003156 /**
3157 * Lines of logcat to include with system crash/ANR/etc. reports,
3158 * as a prefix of the dropbox tag of the report type.
3159 * For example, "logcat_for_system_server_anr" controls the lines
3160 * of logcat captured with system server ANR reports. 0 to disable.
3161 * @hide
3162 */
3163 public static final String ERROR_LOGCAT_PREFIX =
3164 "logcat_for_";
Doug Zongker43866e02010-01-07 12:09:54 -08003165
3166
3167 /**
3168 * Screen timeout in milliseconds corresponding to the
3169 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3170 * possible screen timeout behavior.)
3171 * @hide
3172 */
3173 public static final String SHORT_KEYLIGHT_DELAY_MS =
3174 "short_keylight_delay_ms";
3175
3176 /**
3177 * The interval in minutes after which the amount of free storage left on the
3178 * device is logged to the event log
3179 * @hide
3180 */
3181 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3182 "sys_free_storage_log_interval";
3183
3184 /**
3185 * Threshold for the amount of change in disk free space required to report the amount of
3186 * free space. Used to prevent spamming the logs when the disk free space isn't changing
3187 * frequently.
3188 * @hide
3189 */
3190 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3191 "disk_free_change_reporting_threshold";
3192
3193
3194 /**
3195 * Minimum percentage of free storage on the device that is used to determine if
3196 * the device is running low on storage.
3197 * Say this value is set to 10, the device is considered running low on storage
3198 * if 90% or more of the device storage is filled up.
3199 * @hide
3200 */
3201 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3202 "sys_storage_threshold_percentage";
3203
3204 /**
Jake Hambybb371632010-08-23 18:16:48 -07003205 * Minimum bytes of free storage on the device before the data
3206 * partition is considered full. By default, 1 MB is reserved
3207 * to avoid system-wide SQLite disk full exceptions.
3208 * @hide
3209 */
3210 public static final String SYS_STORAGE_FULL_THRESHOLD_BYTES =
3211 "sys_storage_full_threshold_bytes";
3212
3213 /**
Doug Zongker43866e02010-01-07 12:09:54 -08003214 * The interval in milliseconds after which Wi-Fi is considered idle.
3215 * When idle, it is possible for the device to be switched from Wi-Fi to
3216 * the mobile data network.
3217 * @hide
3218 */
3219 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3220
3221 /**
Irfan Sheriff4f5f7c92010-10-14 17:01:27 -07003222 * The interval in milliseconds to issue scans when the driver is
3223 * started. This is necessary to allow wifi to connect to an
3224 * access point when the driver is suspended.
3225 * @hide
3226 */
3227 public static final String WIFI_SCAN_INTERVAL_MS = "wifi_scan_interval_ms";
3228
3229 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08003230 * The interval in milliseconds at which to check packet counts on the
3231 * mobile data interface when screen is on, to detect possible data
3232 * connection problems.
3233 * @hide
3234 */
3235 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3236 "pdp_watchdog_poll_interval_ms";
3237
3238 /**
3239 * The interval in milliseconds at which to check packet counts on the
3240 * mobile data interface when screen is off, to detect possible data
3241 * connection problems.
3242 * @hide
3243 */
3244 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3245 "pdp_watchdog_long_poll_interval_ms";
3246
3247 /**
3248 * The interval in milliseconds at which to check packet counts on the
3249 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3250 * outgoing packets has been reached without incoming packets.
3251 * @hide
3252 */
3253 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3254 "pdp_watchdog_error_poll_interval_ms";
3255
3256 /**
3257 * The number of outgoing packets sent without seeing an incoming packet
3258 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3259 * device is logged to the event log
3260 * @hide
3261 */
3262 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3263 "pdp_watchdog_trigger_packet_count";
3264
3265 /**
3266 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3267 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3268 * attempting data connection recovery.
3269 * @hide
3270 */
3271 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3272 "pdp_watchdog_error_poll_count";
3273
3274 /**
3275 * The number of failed PDP reset attempts before moving to something more
3276 * drastic: re-registering to the network.
3277 * @hide
3278 */
3279 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3280 "pdp_watchdog_max_pdp_reset_fail_count";
3281
3282 /**
3283 * Address to ping as a last sanity check before attempting any recovery.
3284 * Unset or set to "0.0.0.0" to skip this check.
3285 * @hide
3286 */
3287 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3288
3289 /**
3290 * The "-w deadline" parameter for the ping, ie, the max time in
3291 * seconds to spend pinging.
3292 * @hide
3293 */
3294 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3295
3296 /**
3297 * The interval in milliseconds at which to check gprs registration
3298 * after the first registration mismatch of gprs and voice service,
3299 * to detect possible data network registration problems.
3300 *
3301 * @hide
3302 */
3303 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3304 "gprs_register_check_period_ms";
3305
3306 /**
3307 * The length of time in milli-seconds that automatic small adjustments to
3308 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3309 * @hide
3310 */
3311 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3312
3313 /**
3314 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3315 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3316 * exceeded.
3317 * @hide
3318 */
3319 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3320
3321 /**
3322 * The maximum reconnect delay for short network outages or when the network is suspended
3323 * due to phone use.
3324 * @hide
3325 */
3326 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3327 "sync_max_retry_delay_in_seconds";
3328
3329 /**
3330 * The interval in milliseconds at which to check the number of SMS sent
3331 * out without asking for use permit, to limit the un-authorized SMS
3332 * usage.
3333 * @hide
3334 */
3335 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3336 "sms_outgoing_check_interval_ms";
3337
3338 /**
3339 * The number of outgoing SMS sent without asking for user permit
3340 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3341 * @hide
3342 */
3343 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
3344 "sms_outgoing_check_max_count";
3345
3346 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003347 * The number of promoted sources in GlobalSearch.
3348 * @hide
3349 */
3350 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3351 /**
3352 * The maximum number of suggestions returned by GlobalSearch.
3353 * @hide
3354 */
3355 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3356 /**
3357 * The number of suggestions GlobalSearch will ask each non-web search source for.
3358 * @hide
3359 */
3360 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3361 /**
3362 * The number of suggestions the GlobalSearch will ask the web search source for.
3363 * @hide
3364 */
3365 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3366 "search_web_results_override_limit";
3367 /**
3368 * The number of milliseconds that GlobalSearch will wait for suggestions from
3369 * promoted sources before continuing with all other sources.
3370 * @hide
3371 */
3372 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3373 "search_promoted_source_deadline_millis";
3374 /**
3375 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3376 * @hide
3377 */
3378 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3379 /**
3380 * The maximum number of milliseconds that GlobalSearch shows the previous results
3381 * after receiving a new query.
3382 * @hide
3383 */
3384 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3385 /**
3386 * The maximum age of log data used for shortcuts in GlobalSearch.
3387 * @hide
3388 */
3389 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3390 /**
3391 * The maximum age of log data used for source ranking in GlobalSearch.
3392 * @hide
3393 */
3394 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3395 "search_max_source_event_age_millis";
3396 /**
3397 * The minimum number of impressions needed to rank a source in GlobalSearch.
3398 * @hide
3399 */
3400 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3401 "search_min_impressions_for_source_ranking";
3402 /**
3403 * The minimum number of clicks needed to rank a source in GlobalSearch.
3404 * @hide
3405 */
3406 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3407 "search_min_clicks_for_source_ranking";
3408 /**
3409 * The maximum number of shortcuts shown by GlobalSearch.
3410 * @hide
3411 */
3412 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3413 /**
3414 * The size of the core thread pool for suggestion queries in GlobalSearch.
3415 * @hide
3416 */
3417 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3418 "search_query_thread_core_pool_size";
3419 /**
3420 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3421 * @hide
3422 */
3423 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3424 "search_query_thread_max_pool_size";
3425 /**
3426 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3427 * @hide
3428 */
3429 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3430 "search_shortcut_refresh_core_pool_size";
3431 /**
3432 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3433 * @hide
3434 */
3435 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3436 "search_shortcut_refresh_max_pool_size";
3437 /**
3438 * The maximun time that excess threads in the GlobalSeach thread pools will
3439 * wait before terminating.
3440 * @hide
3441 */
3442 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3443 "search_thread_keepalive_seconds";
3444 /**
3445 * The maximum number of concurrent suggestion queries to each source.
3446 * @hide
3447 */
3448 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3449 "search_per_source_concurrent_query_limit";
3450
San Mehat87734d32010-01-08 12:53:06 -08003451 /**
3452 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
3453 * @hide
3454 */
3455 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
3456
3457 /**
3458 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
3459 * @hide
3460 */
3461 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
3462
3463 /**
3464 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
3465 * @hide
3466 */
3467 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
3468
3469 /**
3470 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
3471 * @hide
3472 */
3473 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003474
Dan Egnor42471dd2010-01-07 17:25:22 -08003475 /**
3476 * If nonzero, ANRs in invisible background processes bring up a dialog.
3477 * Otherwise, the process will be silently killed.
3478 * @hide
3479 */
3480 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
Erikeebc8e22010-02-18 13:27:19 -08003481
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003482 /**
3483 * The {@link ComponentName} string of the service to be used as the voice recognition
3484 * service.
Erikeebc8e22010-02-18 13:27:19 -08003485 *
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08003486 * @hide
3487 */
3488 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
Dan Egnor42471dd2010-01-07 17:25:22 -08003489
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08003490 /**
David Brown458e8062010-03-08 21:52:11 -08003491 * What happens when the user presses the Power button while in-call
3492 * and the screen is on.<br/>
3493 * <b>Values:</b><br/>
3494 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
3495 * 2 - The Power button hangs up the current call.<br/>
3496 *
3497 * @hide
3498 */
3499 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
3500
3501 /**
3502 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
3503 * @hide
3504 */
3505 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
3506
3507 /**
3508 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
3509 * @hide
3510 */
3511 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
3512
3513 /**
3514 * INCALL_POWER_BUTTON_BEHAVIOR default value.
3515 * @hide
3516 */
3517 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
3518 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
3519
3520 /**
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003521 * The current night mode that has been selected by the user. Owned
3522 * and controlled by UiModeManagerService. Constants are as per
3523 * UiModeManager.
3524 * @hide
3525 */
3526 public static final String UI_NIGHT_MODE = "ui_night_mode";
Suchi Amalapurapu40e47252010-04-07 16:15:50 -07003527
3528 /**
3529 * Let user pick default install location.
3530 * @hide
3531 */
3532 public static final String SET_INSTALL_LOCATION = "set_install_location";
3533
3534 /**
3535 * Default install location value.
3536 * 0 = auto, let system decide
3537 * 1 = internal
3538 * 2 = sdcard
3539 * @hide
3540 */
3541 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003542
3543 /**
3544 * The bandwidth throttle polling freqency in seconds
3545 * @hide
3546 */
3547 public static final String THROTTLE_POLLING_SEC = "throttle_polling_sec";
3548
3549 /**
3550 * The bandwidth throttle threshold (long)
3551 * @hide
3552 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003553 public static final String THROTTLE_THRESHOLD_BYTES = "throttle_threshold_bytes";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003554
3555 /**
3556 * The bandwidth throttle value (kbps)
3557 * @hide
3558 */
Robert Greenwaltd3bb93f2010-04-12 19:20:55 -07003559 public static final String THROTTLE_VALUE_KBITSPS = "throttle_value_kbitsps";
Robert Greenwalt9e696c22010-04-01 14:45:18 -07003560
3561 /**
3562 * The bandwidth throttle reset calendar day (1-28)
3563 * @hide
3564 */
3565 public static final String THROTTLE_RESET_DAY = "throttle_reset_day";
3566
3567 /**
3568 * The throttling notifications we should send
3569 * @hide
3570 */
3571 public static final String THROTTLE_NOTIFICATION_TYPE = "throttle_notification_type";
3572
3573 /**
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003574 * Help URI for data throttling policy
3575 * @hide
3576 */
3577 public static final String THROTTLE_HELP_URI = "throttle_help_uri";
3578
Robert Greenwaltd1055a22010-05-25 15:54:52 -07003579 /**
3580 * The length of time in Sec that we allow our notion of NTP time
3581 * to be cached before we refresh it
3582 * @hide
3583 */
3584 public static final String THROTTLE_MAX_NTP_CACHE_AGE_SEC =
3585 "throttle_max_ntp_cache_age_sec";
3586
Steve Howard9c4e33e2010-07-28 15:59:29 -07003587 /**
3588 * The maximum size, in bytes, of a download that the download manager will transfer over
3589 * a non-wifi connection.
3590 * @hide
3591 */
3592 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
3593 "download_manager_max_bytes_over_mobile";
3594
Robert Greenwaltd7085fc2010-09-08 15:24:47 -07003595 /**
Steve Howardf1766812010-09-17 16:46:19 -07003596 * The recommended maximum size, in bytes, of a download that the download manager should
3597 * transfer over a non-wifi connection. Over this size, the use will be warned, but will
3598 * have the option to start the download over the mobile connection anyway.
3599 * @hide
3600 */
3601 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
3602 "download_manager_recommended_max_bytes_over_mobile";
3603
3604 /**
Robert Greenwaltd7085fc2010-09-08 15:24:47 -07003605 * ms during which to consume extra events related to Inet connection condition
3606 * after a transtion to fully-connected
3607 * @hide
3608 */
3609 public static final String INET_CONDITION_DEBOUNCE_UP_DELAY =
3610 "inet_condition_debounce_up_delay";
3611
3612 /**
3613 * ms during which to consume extra events related to Inet connection condtion
3614 * after a transtion to partly-connected
3615 * @hide
3616 */
3617 public static final String INET_CONDITION_DEBOUNCE_DOWN_DELAY =
3618 "inet_condition_debounce_down_delay";
Irfan Sheriffc9b68512010-04-08 14:12:33 -07003619
3620 /**
-b master501eec92009-07-06 13:53:11 -07003621 * @hide
3622 */
3623 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07003624 ADB_ENABLED,
3625 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07003626 PARENTAL_CONTROL_ENABLED,
3627 PARENTAL_CONTROL_REDIRECT_URL,
3628 USB_MASS_STORAGE_ENABLED,
3629 ACCESSIBILITY_ENABLED,
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07003630 ACCESSIBILITY_SCRIPT_INJECTION,
Christopher Tate14c2d792010-02-25 16:49:44 -08003631 BACKUP_AUTO_RESTORE,
-b master501eec92009-07-06 13:53:11 -07003632 ENABLED_ACCESSIBILITY_SERVICES,
3633 TTS_USE_DEFAULTS,
3634 TTS_DEFAULT_RATE,
3635 TTS_DEFAULT_PITCH,
3636 TTS_DEFAULT_SYNTH,
3637 TTS_DEFAULT_LANG,
3638 TTS_DEFAULT_COUNTRY,
Charles Chenceffa152010-03-16 21:18:10 -07003639 TTS_ENABLED_PLUGINS,
-b master501eec92009-07-06 13:53:11 -07003640 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
3641 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
3642 WIFI_NUM_ALLOWED_CHANNELS,
3643 WIFI_NUM_OPEN_NETWORKS_KEPT,
San Mehat87734d32010-01-08 12:53:06 -08003644 MOUNT_PLAY_NOTIFICATION_SND,
3645 MOUNT_UMS_AUTOSTART,
3646 MOUNT_UMS_PROMPT,
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07003647 MOUNT_UMS_NOTIFY_ENABLED,
3648 UI_NIGHT_MODE
-b master501eec92009-07-06 13:53:11 -07003649 };
3650
3651 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003652 * Helper method for determining if a location provider is enabled.
3653 * @param cr the content resolver to use
3654 * @param provider the location provider to query
3655 * @return true if the provider is enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003656 */
3657 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
3658 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
Brad Fitzpatrick11fe1812010-09-10 16:07:52 -07003659 return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003660 }
3661
3662 /**
3663 * Thread-safe method for enabling or disabling a single location provider.
3664 * @param cr the content resolver to use
3665 * @param provider the location provider to enable or disable
3666 * @param enabled true if the provider should be enabled
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07003667 */
3668 public static final void setLocationProviderEnabled(ContentResolver cr,
3669 String provider, boolean enabled) {
3670 // to ensure thread safety, we write the provider name with a '+' or '-'
3671 // and let the SettingsProvider handle it rather than reading and modifying
3672 // the list of enabled providers.
3673 if (enabled) {
3674 provider = "+" + provider;
3675 } else {
3676 provider = "-" + provider;
3677 }
3678 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
3679 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003680 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003682 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003683 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3684 * Intent URL, allowing it to be either a web page or a particular
3685 * application activity.
3686 *
3687 * @hide
3688 */
3689 public static final class Bookmarks implements BaseColumns
3690 {
3691 private static final String TAG = "Bookmarks";
3692
3693 /**
3694 * The content:// style URL for this table
3695 */
3696 public static final Uri CONTENT_URI =
3697 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3698
3699 /**
3700 * The row ID.
3701 * <p>Type: INTEGER</p>
3702 */
3703 public static final String ID = "_id";
3704
3705 /**
3706 * Descriptive name of the bookmark that can be displayed to the user.
3707 * If this is empty, the title should be resolved at display time (use
3708 * {@link #getTitle(Context, Cursor)} any time you want to display the
3709 * title of a bookmark.)
3710 * <P>
3711 * Type: TEXT
3712 * </P>
3713 */
3714 public static final String TITLE = "title";
3715
3716 /**
3717 * Arbitrary string (displayed to the user) that allows bookmarks to be
3718 * organized into categories. There are some special names for
3719 * standard folders, which all start with '@'. The label displayed for
3720 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3721 * the folder name does not change so you can consistently query for
3722 * the folder regardless of the current locale.
3723 *
3724 * <P>Type: TEXT</P>
3725 *
3726 */
3727 public static final String FOLDER = "folder";
3728
3729 /**
3730 * The Intent URL of the bookmark, describing what it points to. This
3731 * value is given to {@link android.content.Intent#getIntent} to create
3732 * an Intent that can be launched.
3733 * <P>Type: TEXT</P>
3734 */
3735 public static final String INTENT = "intent";
3736
3737 /**
3738 * Optional shortcut character associated with this bookmark.
3739 * <P>Type: INTEGER</P>
3740 */
3741 public static final String SHORTCUT = "shortcut";
3742
3743 /**
3744 * The order in which the bookmark should be displayed
3745 * <P>Type: INTEGER</P>
3746 */
3747 public static final String ORDERING = "ordering";
3748
3749 private static final String[] sIntentProjection = { INTENT };
3750 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3751 private static final String sShortcutSelection = SHORTCUT + "=?";
3752
3753 /**
3754 * Convenience function to retrieve the bookmarked Intent for a
3755 * particular shortcut key.
3756 *
3757 * @param cr The ContentResolver to query.
3758 * @param shortcut The shortcut key.
3759 *
3760 * @return Intent The bookmarked URL, or null if there is no bookmark
3761 * matching the given shortcut.
3762 */
3763 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3764 {
3765 Intent intent = null;
3766
3767 Cursor c = cr.query(CONTENT_URI,
3768 sIntentProjection, sShortcutSelection,
3769 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3770 // Keep trying until we find a valid shortcut
3771 try {
3772 while (intent == null && c.moveToNext()) {
3773 try {
3774 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003775 intent = Intent.parseUri(intentURI, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003776 } catch (java.net.URISyntaxException e) {
3777 // The stored URL is bad... ignore it.
3778 } catch (IllegalArgumentException e) {
3779 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003780 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003781 }
3782 }
3783 } finally {
3784 if (c != null) c.close();
3785 }
3786
3787 return intent;
3788 }
3789
3790 /**
3791 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003792 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003793 * @param cr The ContentResolver to query.
3794 * @param intent The desired target of the bookmark.
3795 * @param title Bookmark title that is shown to the user; null if none
3796 * or it should be resolved to the intent's title.
3797 * @param folder Folder in which to place the bookmark; null if none.
3798 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3799 * this is non-zero and there is an existing bookmark entry
3800 * with this same shortcut, then that existing shortcut is
3801 * cleared (the bookmark is not removed).
3802 * @return The unique content URL for the new bookmark entry.
3803 */
3804 public static Uri add(ContentResolver cr,
3805 Intent intent,
3806 String title,
3807 String folder,
3808 char shortcut,
3809 int ordering)
3810 {
3811 // If a shortcut is supplied, and it is already defined for
3812 // another bookmark, then remove the old definition.
3813 if (shortcut != 0) {
Jeff Hamilton7cd51ef2010-05-12 17:30:27 -05003814 cr.delete(CONTENT_URI, sShortcutSelection,
3815 new String[] { String.valueOf((int) shortcut) });
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003816 }
3817
3818 ContentValues values = new ContentValues();
3819 if (title != null) values.put(TITLE, title);
3820 if (folder != null) values.put(FOLDER, folder);
Jean-Baptiste Queru3b9f0a32010-06-21 13:46:59 -07003821 values.put(INTENT, intent.toUri(0));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003822 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3823 values.put(ORDERING, ordering);
3824 return cr.insert(CONTENT_URI, values);
3825 }
3826
3827 /**
3828 * Return the folder name as it should be displayed to the user. This
3829 * takes care of localizing special folders.
3830 *
3831 * @param r Resources object for current locale; only need access to
3832 * system resources.
3833 * @param folder The value found in the {@link #FOLDER} column.
3834 *
3835 * @return CharSequence The label for this folder that should be shown
3836 * to the user.
3837 */
3838 public static CharSequence getLabelForFolder(Resources r, String folder) {
3839 return folder;
3840 }
3841
3842 /**
3843 * Return the title as it should be displayed to the user. This takes
3844 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003845 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003846 * @param context A context.
3847 * @param cursor A cursor pointing to the row whose title should be
3848 * returned. The cursor must contain at least the {@link #TITLE}
3849 * and {@link #INTENT} columns.
3850 * @return A title that is localized and can be displayed to the user,
3851 * or the empty string if one could not be found.
3852 */
3853 public static CharSequence getTitle(Context context, Cursor cursor) {
3854 int titleColumn = cursor.getColumnIndex(TITLE);
3855 int intentColumn = cursor.getColumnIndex(INTENT);
3856 if (titleColumn == -1 || intentColumn == -1) {
3857 throw new IllegalArgumentException(
3858 "The cursor must contain the TITLE and INTENT columns.");
3859 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003860
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003861 String title = cursor.getString(titleColumn);
3862 if (!TextUtils.isEmpty(title)) {
3863 return title;
3864 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003865
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003866 String intentUri = cursor.getString(intentColumn);
3867 if (TextUtils.isEmpty(intentUri)) {
3868 return "";
3869 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003870
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003871 Intent intent;
3872 try {
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02003873 intent = Intent.parseUri(intentUri, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003874 } catch (URISyntaxException e) {
3875 return "";
3876 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003877
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003878 PackageManager packageManager = context.getPackageManager();
3879 ResolveInfo info = packageManager.resolveActivity(intent, 0);
3880 return info != null ? info.loadLabel(packageManager) : "";
3881 }
3882 }
3883
3884 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003885 * Returns the device ID that we should use when connecting to the mobile gtalk server.
3886 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
3887 * from the GoogleLoginService.
3888 *
3889 * @param androidId The Android ID for this device.
3890 * @return The device ID that should be used when connecting to the mobile gtalk server.
3891 * @hide
3892 */
3893 public static String getGTalkDeviceId(long androidId) {
3894 return "android-" + Long.toHexString(androidId);
3895 }
3896}