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