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