blob: 4c6db42926c5e247012b9ad1d16979dba519cd6c [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.provider;
18
19import com.google.android.collect.Maps;
20
21import org.apache.commons.codec.binary.Base64;
22
23import android.annotation.SdkConstant;
24import android.annotation.SdkConstant.SdkConstantType;
25import android.content.ContentQueryMap;
26import android.content.ContentResolver;
27import android.content.ContentValues;
28import android.content.Context;
29import android.content.Intent;
30import 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;
37import android.os.*;
38import android.telephony.TelephonyManager;
39import android.text.TextUtils;
40import android.util.AndroidException;
Dan Egnor799f7212009-11-24 16:24:44 -080041import android.util.Config;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.util.Log;
43
44import java.net.URISyntaxException;
45import java.security.MessageDigest;
46import java.security.NoSuchAlgorithmException;
Vasu Nori272af002009-11-04 16:26:55 -080047import java.util.Collections;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080048import java.util.HashMap;
49import java.util.HashSet;
Vasu Nori272af002009-11-04 16:26:55 -080050import java.util.Map;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
52
53/**
54 * The Settings provider contains global system-level device preferences.
55 */
56public final class Settings {
57
58 // Intent actions for Settings
59
60 /**
61 * Activity Action: Show system settings.
62 * <p>
63 * Input: Nothing.
64 * <p>
65 * Output: nothing.
66 */
67 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
68 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
69
70 /**
71 * Activity Action: Show settings to allow configuration of APNs.
72 * <p>
73 * Input: Nothing.
74 * <p>
75 * Output: nothing.
76 */
77 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
78 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
79
80 /**
81 * Activity Action: Show settings to allow configuration of current location
82 * sources.
83 * <p>
84 * In some cases, a matching Activity may not exist, so ensure you
85 * safeguard against this.
86 * <p>
87 * Input: Nothing.
88 * <p>
89 * Output: Nothing.
90 */
91 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
92 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
93 "android.settings.LOCATION_SOURCE_SETTINGS";
94
95 /**
96 * Activity Action: Show settings to allow configuration of wireless controls
97 * such as Wi-Fi, Bluetooth and Mobile networks.
98 * <p>
99 * In some cases, a matching Activity may not exist, so ensure you
100 * safeguard against this.
101 * <p>
102 * Input: Nothing.
103 * <p>
104 * Output: Nothing.
105 */
106 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
107 public static final String ACTION_WIRELESS_SETTINGS =
108 "android.settings.WIRELESS_SETTINGS";
109
110 /**
111 * Activity Action: Show settings to allow entering/exiting airplane mode.
112 * <p>
113 * In some cases, a matching Activity may not exist, so ensure you
114 * safeguard against this.
115 * <p>
116 * Input: Nothing.
117 * <p>
118 * Output: Nothing.
119 */
120 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
121 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
122 "android.settings.AIRPLANE_MODE_SETTINGS";
123
124 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700125 * Activity Action: Show settings for accessibility modules.
126 * <p>
127 * In some cases, a matching Activity may not exist, so ensure you
128 * safeguard against this.
129 * <p>
130 * Input: Nothing.
131 * <p>
132 * Output: Nothing.
133 */
134 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
135 public static final String ACTION_ACCESSIBILITY_SETTINGS =
136 "android.settings.ACCESSIBILITY_SETTINGS";
137
138 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 * Activity Action: Show settings to allow configuration of security and
140 * location privacy.
141 * <p>
142 * In some cases, a matching Activity may not exist, so ensure you
143 * safeguard against this.
144 * <p>
145 * Input: Nothing.
146 * <p>
147 * Output: Nothing.
148 */
149 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
150 public static final String ACTION_SECURITY_SETTINGS =
151 "android.settings.SECURITY_SETTINGS";
152
153 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700154 * Activity Action: Show settings to allow configuration of privacy options.
155 * <p>
156 * In some cases, a matching Activity may not exist, so ensure you
157 * safeguard against this.
158 * <p>
159 * Input: Nothing.
160 * <p>
161 * Output: Nothing.
162 */
163 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
164 public static final String ACTION_PRIVACY_SETTINGS =
165 "android.settings.PRIVACY_SETTINGS";
166
167 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168 * Activity Action: Show settings to allow configuration of Wi-Fi.
169
170 * <p>
171 * In some cases, a matching Activity may not exist, so ensure you
172 * safeguard against this.
173 * <p>
174 * Input: Nothing.
175 * <p>
176 * Output: Nothing.
177
178 */
179 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
180 public static final String ACTION_WIFI_SETTINGS =
181 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700182
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 /**
184 * Activity Action: Show settings to allow configuration of a static IP
185 * address for Wi-Fi.
186 * <p>
187 * In some cases, a matching Activity may not exist, so ensure you safeguard
188 * against this.
189 * <p>
190 * Input: Nothing.
191 * <p>
192 * Output: Nothing.
193 */
194 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
195 public static final String ACTION_WIFI_IP_SETTINGS =
196 "android.settings.WIFI_IP_SETTINGS";
197
198 /**
199 * Activity Action: Show settings to allow configuration of Bluetooth.
200 * <p>
201 * In some cases, a matching Activity may not exist, so ensure you
202 * safeguard against this.
203 * <p>
204 * Input: Nothing.
205 * <p>
206 * Output: Nothing.
207 */
208 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
209 public static final String ACTION_BLUETOOTH_SETTINGS =
210 "android.settings.BLUETOOTH_SETTINGS";
211
212 /**
213 * Activity Action: Show settings to allow configuration of date and time.
214 * <p>
215 * In some cases, a matching Activity may not exist, so ensure you
216 * safeguard against this.
217 * <p>
218 * Input: Nothing.
219 * <p>
220 * Output: Nothing.
221 */
222 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
223 public static final String ACTION_DATE_SETTINGS =
224 "android.settings.DATE_SETTINGS";
225
226 /**
227 * Activity Action: Show settings to allow configuration of sound and volume.
228 * <p>
229 * In some cases, a matching Activity may not exist, so ensure you
230 * safeguard against this.
231 * <p>
232 * Input: Nothing.
233 * <p>
234 * Output: Nothing.
235 */
236 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
237 public static final String ACTION_SOUND_SETTINGS =
238 "android.settings.SOUND_SETTINGS";
239
240 /**
241 * Activity Action: Show settings to allow configuration of display.
242 * <p>
243 * In some cases, a matching Activity may not exist, so ensure you
244 * safeguard against this.
245 * <p>
246 * Input: Nothing.
247 * <p>
248 * Output: Nothing.
249 */
250 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
251 public static final String ACTION_DISPLAY_SETTINGS =
252 "android.settings.DISPLAY_SETTINGS";
253
254 /**
255 * Activity Action: Show settings to allow configuration of locale.
256 * <p>
257 * In some cases, a matching Activity may not exist, so ensure you
258 * safeguard against this.
259 * <p>
260 * Input: Nothing.
261 * <p>
262 * Output: Nothing.
263 */
264 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
265 public static final String ACTION_LOCALE_SETTINGS =
266 "android.settings.LOCALE_SETTINGS";
267
268 /**
269 * Activity Action: Show settings to configure input methods, in particular
270 * allowing the user to enable input methods.
271 * <p>
272 * In some cases, a matching Activity may not exist, so ensure you
273 * safeguard against this.
274 * <p>
275 * Input: Nothing.
276 * <p>
277 * Output: Nothing.
278 */
279 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
280 public static final String ACTION_INPUT_METHOD_SETTINGS =
281 "android.settings.INPUT_METHOD_SETTINGS";
282
283 /**
284 * Activity Action: Show settings to manage the user input dictionary.
285 * <p>
286 * In some cases, a matching Activity may not exist, so ensure you
287 * safeguard against this.
288 * <p>
289 * Input: Nothing.
290 * <p>
291 * Output: Nothing.
292 */
293 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
294 public static final String ACTION_USER_DICTIONARY_SETTINGS =
295 "android.settings.USER_DICTIONARY_SETTINGS";
296
297 /**
298 * Activity Action: Show settings to allow configuration of application-related settings.
299 * <p>
300 * In some cases, a matching Activity may not exist, so ensure you
301 * safeguard against this.
302 * <p>
303 * Input: Nothing.
304 * <p>
305 * Output: Nothing.
306 */
307 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
308 public static final String ACTION_APPLICATION_SETTINGS =
309 "android.settings.APPLICATION_SETTINGS";
310
311 /**
312 * Activity Action: Show settings to allow configuration of application
313 * development-related settings.
314 * <p>
315 * In some cases, a matching Activity may not exist, so ensure you safeguard
316 * against this.
317 * <p>
318 * Input: Nothing.
319 * <p>
320 * Output: Nothing.
321 */
322 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
323 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
324 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
325
326 /**
327 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
328 * <p>
329 * In some cases, a matching Activity may not exist, so ensure you
330 * safeguard against this.
331 * <p>
332 * Input: Nothing.
333 * <p>
334 * Output: Nothing.
335 */
336 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
337 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
338 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700339
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800340 /**
341 * Activity Action: Show settings to manage installed applications.
342 * <p>
343 * In some cases, a matching Activity may not exist, so ensure you
344 * safeguard against this.
345 * <p>
346 * Input: Nothing.
347 * <p>
348 * Output: Nothing.
349 */
350 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
351 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
352 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700353
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800354 /**
355 * Activity Action: Show settings for system update functionality.
356 * <p>
357 * In some cases, a matching Activity may not exist, so ensure you
358 * safeguard against this.
359 * <p>
360 * Input: Nothing.
361 * <p>
362 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700363 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800364 * @hide
365 */
366 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
367 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
368 "android.settings.SYSTEM_UPDATE_SETTINGS";
369
370 /**
371 * Activity Action: Show settings to allow configuration of sync settings.
372 * <p>
373 * In some cases, a matching Activity may not exist, so ensure you
374 * safeguard against this.
375 * <p>
376 * Input: Nothing.
377 * <p>
378 * Output: Nothing.
379 */
380 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
381 public static final String ACTION_SYNC_SETTINGS =
382 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700383
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 /**
385 * Activity Action: Show settings for selecting the network operator.
386 * <p>
387 * In some cases, a matching Activity may not exist, so ensure you
388 * safeguard against this.
389 * <p>
390 * Input: Nothing.
391 * <p>
392 * Output: Nothing.
393 */
394 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
395 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
396 "android.settings.NETWORK_OPERATOR_SETTINGS";
397
398 /**
399 * Activity Action: Show settings for selection of 2G/3G.
400 * <p>
401 * In some cases, a matching Activity may not exist, so ensure you
402 * safeguard against this.
403 * <p>
404 * Input: Nothing.
405 * <p>
406 * Output: Nothing.
407 */
408 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
409 public static final String ACTION_DATA_ROAMING_SETTINGS =
410 "android.settings.DATA_ROAMING_SETTINGS";
411
412 /**
413 * Activity Action: Show settings for internal storage.
414 * <p>
415 * In some cases, a matching Activity may not exist, so ensure you
416 * safeguard against this.
417 * <p>
418 * Input: Nothing.
419 * <p>
420 * Output: Nothing.
421 */
422 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
423 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
424 "android.settings.INTERNAL_STORAGE_SETTINGS";
425 /**
426 * Activity Action: Show settings for memory card storage.
427 * <p>
428 * In some cases, a matching Activity may not exist, so ensure you
429 * safeguard against this.
430 * <p>
431 * Input: Nothing.
432 * <p>
433 * Output: Nothing.
434 */
435 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
436 public static final String ACTION_MEMORY_CARD_SETTINGS =
437 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700438
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800439 // End of Intent actions for Settings
440
441 private static final String JID_RESOURCE_PREFIX = "android";
442
443 public static final String AUTHORITY = "settings";
444
445 private static final String TAG = "Settings";
Dan Egnor799f7212009-11-24 16:24:44 -0800446 private static final boolean LOCAL_LOGV = Config.LOGV || false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800447
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800448 public static class SettingNotFoundException extends AndroidException {
449 public SettingNotFoundException(String msg) {
450 super(msg);
451 }
452 }
453
454 /**
455 * Common base for tables of name/value settings.
456 */
457 public static class NameValueTable implements BaseColumns {
458 public static final String NAME = "name";
459 public static final String VALUE = "value";
460
461 protected static boolean putString(ContentResolver resolver, Uri uri,
462 String name, String value) {
463 // The database will take care of replacing duplicates.
464 try {
465 ContentValues values = new ContentValues();
466 values.put(NAME, name);
467 values.put(VALUE, value);
468 resolver.insert(uri, values);
469 return true;
470 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -0700471 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 return false;
473 }
474 }
475
476 public static Uri getUriFor(Uri uri, String name) {
477 return Uri.withAppendedPath(uri, name);
478 }
479 }
480
481 private static class NameValueCache {
482 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800483 private final Uri mUri;
484
Dan Egnor799f7212009-11-24 16:24:44 -0800485 // Must synchronize(mValues) to access mValues and mValuesVersion.
486 private final HashMap<String, String> mValues = new HashMap<String, String>();
487 private long mValuesVersion = 0;
488
489 public NameValueCache(String versionSystemProperty, Uri uri) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800490 mVersionSystemProperty = versionSystemProperty;
491 mUri = uri;
492 }
493
Dan Egnor799f7212009-11-24 16:24:44 -0800494 public String getString(ContentResolver cr, String name) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800495 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -0800496
497 synchronized (mValues) {
498 if (mValuesVersion != newValuesVersion) {
499 if (LOCAL_LOGV) {
500 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
501 newValuesVersion + " != cached " + mValuesVersion);
502 }
503
504 mValues.clear();
505 mValuesVersion = newValuesVersion;
506 }
507
508 if (mValues.containsKey(name)) {
509 return mValues.get(name); // Could be null, that's OK -- negative caching
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800510 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800511 }
Dan Egnor799f7212009-11-24 16:24:44 -0800512
513 Cursor c = null;
514 try {
515 c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE },
516 Settings.NameValueTable.NAME + "=?", new String[]{name}, null);
517 if (c == null) {
518 Log.w(TAG, "Can't get key " + name + " from " + mUri);
519 return null;
520 }
521
522 String value = c.moveToNext() ? c.getString(0) : null;
523 synchronized (mValues) {
524 mValues.put(name, value);
525 }
526 if (LOCAL_LOGV) {
527 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
528 name + " = " + (value == null ? "(null)" : value));
529 }
530 return value;
531 } catch (SQLException e) {
532 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
533 return null; // Return null, but don't cache it.
534 } finally {
535 if (c != null) c.close();
536 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800537 }
538 }
539
540 /**
541 * System settings, containing miscellaneous system preferences. This
542 * table holds simple name/value pairs. There are convenience
543 * functions for accessing individual settings entries.
544 */
545 public static final class System extends NameValueTable {
546 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
547
548 private static volatile NameValueCache mNameValueCache = null;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700549
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800550 private static final HashSet<String> MOVED_TO_SECURE;
551 static {
552 MOVED_TO_SECURE = new HashSet<String>(30);
553 MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
554 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
555 MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
556 MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
557 MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
558 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
559 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
560 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
561 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
562 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
563 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
564 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
565 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
566 MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
567 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
568 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
569 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
570 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
571 MOVED_TO_SECURE.add(Secure.WIFI_ON);
572 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
573 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
574 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
575 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
576 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
577 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
578 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
579 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
580 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
581 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
582 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
583 }
584
585 /**
586 * Look up a name in the database.
587 * @param resolver to access the database with
588 * @param name to look up in the table
589 * @return the corresponding value, or null if not present
590 */
591 public synchronized static String getString(ContentResolver resolver, String name) {
592 if (MOVED_TO_SECURE.contains(name)) {
593 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
594 + " to android.provider.Settings.Secure, returning read-only value.");
595 return Secure.getString(resolver, name);
596 }
597 if (mNameValueCache == null) {
598 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
599 }
600 return mNameValueCache.getString(resolver, name);
601 }
602
603 /**
604 * Store a name/value pair into the database.
605 * @param resolver to access the database with
606 * @param name to store
607 * @param value to associate with the name
608 * @return true if the value was set, false on database errors
609 */
610 public static boolean putString(ContentResolver resolver, String name, String value) {
611 if (MOVED_TO_SECURE.contains(name)) {
612 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
613 + " to android.provider.Settings.Secure, value is unchanged.");
614 return false;
615 }
616 return putString(resolver, CONTENT_URI, name, value);
617 }
618
619 /**
620 * Construct the content URI for a particular name/value pair,
621 * useful for monitoring changes with a ContentObserver.
622 * @param name to look up in the table
623 * @return the corresponding content URI, or null if not present
624 */
625 public static Uri getUriFor(String name) {
626 if (MOVED_TO_SECURE.contains(name)) {
627 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
628 + " to android.provider.Settings.Secure, returning Secure URI.");
629 return Secure.getUriFor(Secure.CONTENT_URI, name);
630 }
631 return getUriFor(CONTENT_URI, name);
632 }
633
634 /**
635 * Convenience function for retrieving a single system settings value
636 * as an integer. Note that internally setting values are always
637 * stored as strings; this function converts the string to an integer
638 * for you. The default value will be returned if the setting is
639 * not defined or not an integer.
640 *
641 * @param cr The ContentResolver to access.
642 * @param name The name of the setting to retrieve.
643 * @param def Value to return if the setting is not defined.
644 *
645 * @return The setting's current value, or 'def' if it is not defined
646 * or not a valid integer.
647 */
648 public static int getInt(ContentResolver cr, String name, int def) {
649 String v = getString(cr, name);
650 try {
651 return v != null ? Integer.parseInt(v) : def;
652 } catch (NumberFormatException e) {
653 return def;
654 }
655 }
656
657 /**
658 * Convenience function for retrieving a single system settings value
659 * as an integer. Note that internally setting values are always
660 * stored as strings; this function converts the string to an integer
661 * for you.
662 * <p>
663 * This version does not take a default value. If the setting has not
664 * been set, or the string value is not a number,
665 * it throws {@link SettingNotFoundException}.
666 *
667 * @param cr The ContentResolver to access.
668 * @param name The name of the setting to retrieve.
669 *
670 * @throws SettingNotFoundException Thrown if a setting by the given
671 * name can't be found or the setting value is not an integer.
672 *
673 * @return The setting's current value.
674 */
675 public static int getInt(ContentResolver cr, String name)
676 throws SettingNotFoundException {
677 String v = getString(cr, name);
678 try {
679 return Integer.parseInt(v);
680 } catch (NumberFormatException e) {
681 throw new SettingNotFoundException(name);
682 }
683 }
684
685 /**
686 * Convenience function for updating a single settings value as an
687 * integer. This will either create a new entry in the table if the
688 * given name does not exist, or modify the value of the existing row
689 * with that name. Note that internally setting values are always
690 * stored as strings, so this function converts the given value to a
691 * string before storing it.
692 *
693 * @param cr The ContentResolver to access.
694 * @param name The name of the setting to modify.
695 * @param value The new value for the setting.
696 * @return true if the value was set, false on database errors
697 */
698 public static boolean putInt(ContentResolver cr, String name, int value) {
699 return putString(cr, name, Integer.toString(value));
700 }
701
702 /**
703 * Convenience function for retrieving a single system settings value
704 * as a {@code long}. Note that internally setting values are always
705 * stored as strings; this function converts the string to a {@code long}
706 * for you. The default value will be returned if the setting is
707 * not defined or not a {@code long}.
708 *
709 * @param cr The ContentResolver to access.
710 * @param name The name of the setting to retrieve.
711 * @param def Value to return if the setting is not defined.
712 *
713 * @return The setting's current value, or 'def' if it is not defined
714 * or not a valid {@code long}.
715 */
716 public static long getLong(ContentResolver cr, String name, long def) {
717 String valString = getString(cr, name);
718 long value;
719 try {
720 value = valString != null ? Long.parseLong(valString) : def;
721 } catch (NumberFormatException e) {
722 value = def;
723 }
724 return value;
725 }
726
727 /**
728 * Convenience function for retrieving a single system settings value
729 * as a {@code long}. Note that internally setting values are always
730 * stored as strings; this function converts the string to a {@code long}
731 * for you.
732 * <p>
733 * This version does not take a default value. If the setting has not
734 * been set, or the string value is not a number,
735 * it throws {@link SettingNotFoundException}.
736 *
737 * @param cr The ContentResolver to access.
738 * @param name The name of the setting to retrieve.
739 *
740 * @return The setting's current value.
741 * @throws SettingNotFoundException Thrown if a setting by the given
742 * name can't be found or the setting value is not an integer.
743 */
744 public static long getLong(ContentResolver cr, String name)
745 throws SettingNotFoundException {
746 String valString = getString(cr, name);
747 try {
748 return Long.parseLong(valString);
749 } catch (NumberFormatException e) {
750 throw new SettingNotFoundException(name);
751 }
752 }
753
754 /**
755 * Convenience function for updating a single settings value as a long
756 * integer. This will either create a new entry in the table if the
757 * given name does not exist, or modify the value of the existing row
758 * with that name. Note that internally setting values are always
759 * stored as strings, so this function converts the given value to a
760 * string before storing it.
761 *
762 * @param cr The ContentResolver to access.
763 * @param name The name of the setting to modify.
764 * @param value The new value for the setting.
765 * @return true if the value was set, false on database errors
766 */
767 public static boolean putLong(ContentResolver cr, String name, long value) {
768 return putString(cr, name, Long.toString(value));
769 }
770
771 /**
772 * Convenience function for retrieving a single system settings value
773 * as a floating point number. Note that internally setting values are
774 * always stored as strings; this function converts the string to an
775 * float for you. The default value will be returned if the setting
776 * is not defined or not a valid float.
777 *
778 * @param cr The ContentResolver to access.
779 * @param name The name of the setting to retrieve.
780 * @param def Value to return if the setting is not defined.
781 *
782 * @return The setting's current value, or 'def' if it is not defined
783 * or not a valid float.
784 */
785 public static float getFloat(ContentResolver cr, String name, float def) {
786 String v = getString(cr, name);
787 try {
788 return v != null ? Float.parseFloat(v) : def;
789 } catch (NumberFormatException e) {
790 return def;
791 }
792 }
793
794 /**
795 * Convenience function for retrieving a single system settings value
796 * as a float. Note that internally setting values are always
797 * stored as strings; this function converts the string to a float
798 * for you.
799 * <p>
800 * This version does not take a default value. If the setting has not
801 * been set, or the string value is not a number,
802 * it throws {@link SettingNotFoundException}.
803 *
804 * @param cr The ContentResolver to access.
805 * @param name The name of the setting to retrieve.
806 *
807 * @throws SettingNotFoundException Thrown if a setting by the given
808 * name can't be found or the setting value is not a float.
809 *
810 * @return The setting's current value.
811 */
812 public static float getFloat(ContentResolver cr, String name)
813 throws SettingNotFoundException {
814 String v = getString(cr, name);
815 try {
816 return Float.parseFloat(v);
817 } catch (NumberFormatException e) {
818 throw new SettingNotFoundException(name);
819 }
820 }
821
822 /**
823 * Convenience function for updating a single settings value as a
824 * floating point number. This will either create a new entry in the
825 * table if the given name does not exist, or modify the value of the
826 * existing row with that name. Note that internally setting values
827 * are always stored as strings, so this function converts the given
828 * value to a string before storing it.
829 *
830 * @param cr The ContentResolver to access.
831 * @param name The name of the setting to modify.
832 * @param value The new value for the setting.
833 * @return true if the value was set, false on database errors
834 */
835 public static boolean putFloat(ContentResolver cr, String name, float value) {
836 return putString(cr, name, Float.toString(value));
837 }
838
839 /**
840 * Convenience function to read all of the current
841 * configuration-related settings into a
842 * {@link Configuration} object.
843 *
844 * @param cr The ContentResolver to access.
845 * @param outConfig Where to place the configuration settings.
846 */
847 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
848 outConfig.fontScale = Settings.System.getFloat(
849 cr, FONT_SCALE, outConfig.fontScale);
850 if (outConfig.fontScale < 0) {
851 outConfig.fontScale = 1;
852 }
853 }
854
855 /**
856 * Convenience function to write a batch of configuration-related
857 * settings from a {@link Configuration} object.
858 *
859 * @param cr The ContentResolver to access.
860 * @param config The settings to write.
861 * @return true if the values were set, false on database errors
862 */
863 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
864 return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
865 }
866
867 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
868 return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
869 }
870
871 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
872 putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
873 }
874
875 /**
876 * The content:// style URL for this table
877 */
878 public static final Uri CONTENT_URI =
879 Uri.parse("content://" + AUTHORITY + "/system");
880
881 /**
882 * Whether we keep the device on while the device is plugged in.
883 * Supported values are:
884 * <ul>
885 * <li>{@code 0} to never stay on while plugged in</li>
886 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
887 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
888 * </ul>
889 * These values can be OR-ed together.
890 */
891 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
892
893 /**
894 * What happens when the user presses the end call button if they're not
895 * on a call.<br/>
896 * <b>Values:</b><br/>
897 * 0 - The end button does nothing.<br/>
898 * 1 - The end button goes to the home screen.<br/>
899 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
900 * 3 - The end button goes to the home screen. If the user is already on the
901 * home screen, it puts the device to sleep.
902 */
903 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
904
905 /**
906 * Whether Airplane Mode is on.
907 */
908 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
909
910 /**
911 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
912 */
913 public static final String RADIO_BLUETOOTH = "bluetooth";
914
915 /**
916 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
917 */
918 public static final String RADIO_WIFI = "wifi";
919
920 /**
921 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
922 */
923 public static final String RADIO_CELL = "cell";
924
925 /**
926 * A comma separated list of radios that need to be disabled when airplane mode
927 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
928 * included in the comma separated list.
929 */
930 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
931
932 /**
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -0700933 * A comma separated list of radios that should to be disabled when airplane mode
934 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
935 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
936 * will be turned off when entering airplane mode, but the user will be able to reenable
937 * Wifi in the Settings app.
938 *
939 * {@hide}
940 */
941 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
942
943 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800944 * The policy for deciding when Wi-Fi should go to sleep (which will in
945 * turn switch to using the mobile data as an Internet connection).
946 * <p>
947 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
948 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
949 * {@link #WIFI_SLEEP_POLICY_NEVER}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800950 */
951 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
952
953 /**
954 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
955 * policy, which is to sleep shortly after the turning off
956 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800957 */
958 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
959
960 /**
961 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
962 * the device is on battery, and never go to sleep when the device is
963 * plugged in.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800964 */
965 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700966
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800967 /**
968 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800969 */
970 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700971
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800972 /**
973 * Whether to use static IP and other static network attributes.
974 * <p>
975 * Set to 1 for true and 0 for false.
976 */
977 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
978
979 /**
980 * The static IP address.
981 * <p>
982 * Example: "192.168.1.51"
983 */
984 public static final String WIFI_STATIC_IP = "wifi_static_ip";
985
986 /**
987 * If using static IP, the gateway's IP address.
988 * <p>
989 * Example: "192.168.1.1"
990 */
991 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
992
993 /**
994 * If using static IP, the net mask.
995 * <p>
996 * Example: "255.255.255.0"
997 */
998 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
999
1000 /**
1001 * If using static IP, the primary DNS's IP address.
1002 * <p>
1003 * Example: "192.168.1.1"
1004 */
1005 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1006
1007 /**
1008 * If using static IP, the secondary DNS's IP address.
1009 * <p>
1010 * Example: "192.168.1.2"
1011 */
1012 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1013
1014 /**
1015 * The number of radio channels that are allowed in the local
1016 * 802.11 regulatory domain.
1017 * @hide
1018 */
1019 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1020
1021 /**
1022 * Determines whether remote devices may discover and/or connect to
1023 * this device.
1024 * <P>Type: INT</P>
1025 * 2 -- discoverable and connectable
1026 * 1 -- connectable but not discoverable
1027 * 0 -- neither connectable nor discoverable
1028 */
1029 public static final String BLUETOOTH_DISCOVERABILITY =
1030 "bluetooth_discoverability";
1031
1032 /**
1033 * Bluetooth discoverability timeout. If this value is nonzero, then
1034 * Bluetooth becomes discoverable for a certain number of seconds,
1035 * after which is becomes simply connectable. The value is in seconds.
1036 */
1037 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1038 "bluetooth_discoverability_timeout";
1039
1040 /**
1041 * Whether autolock is enabled (0 = false, 1 = true)
1042 */
1043 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
1044
1045 /**
1046 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
1047 */
1048 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1049
1050 /**
1051 * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
1052 */
1053 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1054 "lock_pattern_tactile_feedback_enabled";
1055
1056
1057 /**
1058 * A formatted string of the next alarm that is set, or the empty string
1059 * if there is no alarm set.
1060 */
1061 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
1062
1063 /**
1064 * Scaling factor for fonts, float.
1065 */
1066 public static final String FONT_SCALE = "font_scale";
1067
1068 /**
1069 * Name of an application package to be debugged.
1070 */
1071 public static final String DEBUG_APP = "debug_app";
1072
1073 /**
1074 * If 1, when launching DEBUG_APP it will wait for the debugger before
1075 * starting user code. If 0, it will run normally.
1076 */
1077 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1078
1079 /**
1080 * Whether or not to dim the screen. 0=no 1=yes
1081 */
1082 public static final String DIM_SCREEN = "dim_screen";
1083
1084 /**
1085 * The timeout before the screen turns off.
1086 */
1087 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1088
1089 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001090 * If 0, the compatibility mode is off for all applications.
1091 * If 1, older applications run under compatibility mode.
1092 * TODO: remove this settings before code freeze (bug/1907571)
1093 * @hide
1094 */
1095 public static final String COMPATIBILITY_MODE = "compatibility_mode";
1096
1097 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001098 * The screen backlight brightness between 0 and 255.
1099 */
1100 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
1101
1102 /**
Dan Murphy951764b2009-08-27 14:59:03 -05001103 * Control whether to enable automatic brightness mode.
1104 * @hide
1105 */
1106 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
1107
1108 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07001109 * SCREEN_BRIGHTNESS_MODE value for manual mode.
1110 * @hide
1111 */
1112 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1113
1114 /**
1115 * SCREEN_BRIGHTNESS_MODE value for manual mode.
1116 * @hide
1117 */
1118 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
1119
1120 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001121 * Control whether the process CPU usage meter should be shown.
1122 */
1123 public static final String SHOW_PROCESSES = "show_processes";
1124
1125 /**
1126 * If 1, the activity manager will aggressively finish activities and
1127 * processes as soon as they are no longer needed. If 0, the normal
1128 * extended lifetime is used.
1129 */
1130 public static final String ALWAYS_FINISH_ACTIVITIES =
1131 "always_finish_activities";
1132
1133
1134 /**
1135 * Ringer mode. This is used internally, changing this value will not
1136 * change the ringer mode. See AudioManager.
1137 */
1138 public static final String MODE_RINGER = "mode_ringer";
1139
1140 /**
1141 * Determines which streams are affected by ringer mode changes. The
1142 * stream type's bit should be set to 1 if it should be muted when going
1143 * into an inaudible ringer mode.
1144 */
1145 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1146
1147 /**
1148 * Determines which streams are affected by mute. The
1149 * stream type's bit should be set to 1 if it should be muted when a mute request
1150 * is received.
1151 */
1152 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1153
1154 /**
1155 * Whether vibrate is on for different events. This is used internally,
1156 * changing this value will not change the vibrate. See AudioManager.
1157 */
1158 public static final String VIBRATE_ON = "vibrate_on";
1159
1160 /**
1161 * Ringer volume. This is used internally, changing this value will not
1162 * change the volume. See AudioManager.
1163 */
1164 public static final String VOLUME_RING = "volume_ring";
1165
1166 /**
1167 * System/notifications volume. This is used internally, changing this
1168 * value will not change the volume. See AudioManager.
1169 */
1170 public static final String VOLUME_SYSTEM = "volume_system";
1171
1172 /**
1173 * Voice call volume. This is used internally, changing this value will
1174 * not change the volume. See AudioManager.
1175 */
1176 public static final String VOLUME_VOICE = "volume_voice";
1177
1178 /**
1179 * Music/media/gaming volume. This is used internally, changing this
1180 * value will not change the volume. See AudioManager.
1181 */
1182 public static final String VOLUME_MUSIC = "volume_music";
1183
1184 /**
1185 * Alarm volume. This is used internally, changing this
1186 * value will not change the volume. See AudioManager.
1187 */
1188 public static final String VOLUME_ALARM = "volume_alarm";
1189
1190 /**
1191 * Notification volume. This is used internally, changing this
1192 * value will not change the volume. See AudioManager.
1193 */
1194 public static final String VOLUME_NOTIFICATION = "volume_notification";
1195
1196 /**
Eric Laurent484d2882009-12-08 09:05:45 -08001197 * Bluetooth Headset volume. This is used internally, changing this value will
1198 * not change the volume. See AudioManager.
1199 */
1200 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
1201
1202 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001203 * Whether the notifications should use the ring volume (value of 1) or
1204 * a separate notification volume (value of 0). In most cases, users
1205 * will have this enabled so the notification and ringer volumes will be
1206 * the same. However, power users can disable this and use the separate
1207 * notification volume control.
1208 * <p>
1209 * Note: This is a one-off setting that will be removed in the future
1210 * when there is profile support. For this reason, it is kept hidden
1211 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001212 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001213 * @hide
1214 */
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001215 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001216 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001217
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001218 /**
1219 * The mapping of stream type (integer) to its setting.
1220 */
1221 public static final String[] VOLUME_SETTINGS = {
1222 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08001223 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001224 };
1225
1226 /**
1227 * Appended to various volume related settings to record the previous
1228 * values before they the settings were affected by a silent/vibrate
1229 * ringer mode change.
1230 */
1231 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1232
1233 /**
1234 * Persistent store for the system-wide default ringtone URI.
1235 * <p>
1236 * If you need to play the default ringtone at any given time, it is recommended
1237 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
1238 * to the set default ringtone at the time of playing.
1239 *
1240 * @see #DEFAULT_RINGTONE_URI
1241 */
1242 public static final String RINGTONE = "ringtone";
1243
1244 /**
1245 * A {@link Uri} that will point to the current default ringtone at any
1246 * given time.
1247 * <p>
1248 * If the current default ringtone is in the DRM provider and the caller
1249 * does not have permission, the exception will be a
1250 * FileNotFoundException.
1251 */
1252 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
1253
1254 /**
1255 * Persistent store for the system-wide default notification sound.
1256 *
1257 * @see #RINGTONE
1258 * @see #DEFAULT_NOTIFICATION_URI
1259 */
1260 public static final String NOTIFICATION_SOUND = "notification_sound";
1261
1262 /**
1263 * A {@link Uri} that will point to the current default notification
1264 * sound at any given time.
1265 *
1266 * @see #DEFAULT_RINGTONE_URI
1267 */
1268 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1269
1270 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07001271 * Persistent store for the system-wide default alarm alert.
1272 *
1273 * @see #RINGTONE
1274 * @see #DEFAULT_ALARM_ALERT_URI
1275 */
1276 public static final String ALARM_ALERT = "alarm_alert";
1277
1278 /**
1279 * A {@link Uri} that will point to the current default alarm alert at
1280 * any given time.
1281 *
1282 * @see #DEFAULT_ALARM_ALERT_URI
1283 */
1284 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1285
1286 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001287 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1288 */
1289 public static final String TEXT_AUTO_REPLACE = "auto_replace";
1290
1291 /**
1292 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1293 */
1294 public static final String TEXT_AUTO_CAPS = "auto_caps";
1295
1296 /**
1297 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1298 * feature converts two spaces to a "." and space.
1299 */
1300 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001301
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 /**
1303 * Setting to showing password characters in text editors. 1 = On, 0 = Off
1304 */
1305 public static final String TEXT_SHOW_PASSWORD = "show_password";
1306
1307 public static final String SHOW_GTALK_SERVICE_STATUS =
1308 "SHOW_GTALK_SERVICE_STATUS";
1309
1310 /**
1311 * Name of activity to use for wallpaper on the home screen.
1312 */
1313 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1314
1315 /**
1316 * Value to specify if the user prefers the date, time and time zone
1317 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
1318 */
1319 public static final String AUTO_TIME = "auto_time";
1320
1321 /**
1322 * Display times as 12 or 24 hours
1323 * 12
1324 * 24
1325 */
1326 public static final String TIME_12_24 = "time_12_24";
1327
1328 /**
1329 * Date format string
1330 * mm/dd/yyyy
1331 * dd/mm/yyyy
1332 * yyyy/mm/dd
1333 */
1334 public static final String DATE_FORMAT = "date_format";
1335
1336 /**
1337 * Whether the setup wizard has been run before (on first boot), or if
1338 * it still needs to be run.
1339 *
1340 * nonzero = it has been run in the past
1341 * 0 = it has not been run in the past
1342 */
1343 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
1344
1345 /**
1346 * Scaling factor for normal window animations. Setting to 0 will disable window
1347 * animations.
1348 */
1349 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1350
1351 /**
1352 * Scaling factor for activity transition animations. Setting to 0 will disable window
1353 * animations.
1354 */
1355 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1356
1357 /**
1358 * Scaling factor for normal window animations. Setting to 0 will disable window
1359 * animations.
1360 * @hide
1361 */
1362 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
1363
1364 /**
1365 * Control whether the accelerometer will be used to change screen
1366 * orientation. If 0, it will not be used unless explicitly requested
1367 * by the application; if 1, it will be used by default unless explicitly
1368 * disabled by the application.
1369 */
1370 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1371
1372 /**
1373 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1374 * boolean (1 or 0).
1375 */
1376 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1377
1378 /**
David Kraused0f67152009-06-13 18:01:13 -05001379 * CDMA only settings
1380 * DTMF tone type played by the dialer when dialing.
1381 * 0 = Normal
1382 * 1 = Long
1383 * @hide
1384 */
1385 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
1386
1387 /**
1388 * CDMA only settings
1389 * Emergency Tone 0 = Off
1390 * 1 = Alert
1391 * 2 = Vibrate
1392 * @hide
1393 */
1394 public static final String EMERGENCY_TONE = "emergency_tone";
1395
1396 /**
1397 * CDMA only settings
1398 * Whether the auto retry is enabled. The value is
1399 * boolean (1 or 0).
1400 * @hide
1401 */
1402 public static final String CALL_AUTO_RETRY = "call_auto_retry";
1403
1404 /**
1405 * Whether the hearing aid is enabled. The value is
1406 * boolean (1 or 0).
1407 * @hide
1408 */
1409 public static final String HEARING_AID = "hearing_aid";
1410
1411 /**
1412 * CDMA only settings
1413 * TTY Mode
1414 * 0 = OFF
1415 * 1 = FULL
1416 * 2 = VCO
1417 * 3 = HCO
1418 * @hide
1419 */
1420 public static final String TTY_MODE = "tty_mode";
1421
1422 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001423 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1424 * boolean (1 or 0).
1425 */
1426 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001427
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001428 /**
1429 * Whether the haptic feedback (long presses, ...) are enabled. The value is
1430 * boolean (1 or 0).
1431 */
1432 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07001433
Mike LeBeau48603e72009-06-05 00:27:00 +01001434 /**
1435 * Whether live web suggestions while the user types into search dialogs are
1436 * enabled. Browsers and other search UIs should respect this, as it allows
1437 * a user to avoid sending partial queries to a search engine, if it poses
1438 * any privacy concern. The value is boolean (1 or 0).
1439 */
1440 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001441
-b master501eec92009-07-06 13:53:11 -07001442 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001443 * Whether the notification LED should repeatedly flash when a notification is
1444 * pending. The value is boolean (1 or 0).
1445 * @hide
1446 */
1447 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1448
1449 /**
-b master501eec92009-07-06 13:53:11 -07001450 * Settings to backup. This is here so that it's in the same place as the settings
1451 * keys and easy to update.
1452 * @hide
1453 */
1454 public static final String[] SETTINGS_TO_BACKUP = {
1455 STAY_ON_WHILE_PLUGGED_IN,
-b master501eec92009-07-06 13:53:11 -07001456 WIFI_SLEEP_POLICY,
1457 WIFI_USE_STATIC_IP,
1458 WIFI_STATIC_IP,
1459 WIFI_STATIC_GATEWAY,
1460 WIFI_STATIC_NETMASK,
1461 WIFI_STATIC_DNS1,
1462 WIFI_STATIC_DNS2,
1463 BLUETOOTH_DISCOVERABILITY,
1464 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1465 DIM_SCREEN,
1466 SCREEN_OFF_TIMEOUT,
1467 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07001468 SCREEN_BRIGHTNESS_MODE,
-b master501eec92009-07-06 13:53:11 -07001469 VIBRATE_ON,
1470 NOTIFICATIONS_USE_RING_VOLUME,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001471 MODE_RINGER,
1472 MODE_RINGER_STREAMS_AFFECTED,
1473 MUTE_STREAMS_AFFECTED,
1474 VOLUME_VOICE,
1475 VOLUME_SYSTEM,
1476 VOLUME_RING,
1477 VOLUME_MUSIC,
1478 VOLUME_ALARM,
1479 VOLUME_NOTIFICATION,
Eric Laurent484d2882009-12-08 09:05:45 -08001480 VOLUME_BLUETOOTH_SCO,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07001481 VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1482 VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1483 VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1484 VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1485 VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1486 VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
Eric Laurent484d2882009-12-08 09:05:45 -08001487 VOLUME_BLUETOOTH_SCO + APPEND_FOR_LAST_AUDIBLE,
-b master501eec92009-07-06 13:53:11 -07001488 TEXT_AUTO_REPLACE,
1489 TEXT_AUTO_CAPS,
1490 TEXT_AUTO_PUNCTUATE,
1491 TEXT_SHOW_PASSWORD,
1492 AUTO_TIME,
1493 TIME_12_24,
1494 DATE_FORMAT,
1495 ACCELEROMETER_ROTATION,
1496 DTMF_TONE_WHEN_DIALING,
1497 DTMF_TONE_TYPE_WHEN_DIALING,
1498 EMERGENCY_TONE,
1499 CALL_AUTO_RETRY,
1500 HEARING_AID,
1501 TTY_MODE,
1502 SOUND_EFFECTS_ENABLED,
1503 HAPTIC_FEEDBACK_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08001504 SHOW_WEB_SUGGESTIONS,
1505 NOTIFICATION_LIGHT_PULSE
-b master501eec92009-07-06 13:53:11 -07001506 };
1507
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001508 // Settings moved to Settings.Secure
1509
1510 /**
Mike Lockwood460ae0c2009-04-02 22:33:27 -07001511 * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001512 * instead
1513 */
1514 @Deprecated
1515 public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1516
1517 /**
1518 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1519 */
1520 @Deprecated
1521 public static final String ANDROID_ID = Secure.ANDROID_ID;
1522
1523 /**
1524 * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1525 */
1526 @Deprecated
1527 public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1528
1529 /**
1530 * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1531 */
1532 @Deprecated
1533 public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1534
1535 /**
1536 * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1537 */
1538 @Deprecated
1539 public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1540
1541 /**
1542 * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1543 */
1544 @Deprecated
1545 public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1546
1547 /**
1548 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1549 */
1550 @Deprecated
1551 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001552
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001553 /**
1554 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1555 * instead
1556 */
1557 @Deprecated
1558 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1559
1560 /**
1561 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1562 */
1563 @Deprecated
1564 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001565
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001566 /**
1567 * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1568 */
1569 @Deprecated
1570 public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1571
1572 /**
1573 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1574 * instead
1575 */
1576 @Deprecated
1577 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1578
1579 /**
1580 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1581 * instead
1582 */
1583 @Deprecated
1584 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1585
1586 /**
1587 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1588 * instead
1589 */
1590 @Deprecated
1591 public static final String PARENTAL_CONTROL_REDIRECT_URL =
1592 Secure.PARENTAL_CONTROL_REDIRECT_URL;
1593
1594 /**
1595 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1596 */
1597 @Deprecated
1598 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1599
1600 /**
1601 * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1602 */
1603 @Deprecated
1604 public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001605
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001606 /**
1607 * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1608 */
1609 @Deprecated
1610 public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1611
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001612 /**
1613 * @deprecated Use
1614 * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1615 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001616 @Deprecated
1617 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1618
Dianne Hackborn4a51c202009-08-21 15:14:02 -07001619 /**
1620 * @deprecated Use
1621 * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1622 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001623 @Deprecated
1624 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1625 Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1626
1627 /**
1628 * @deprecated Use
1629 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1630 */
1631 @Deprecated
1632 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1633 Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1634
1635 /**
1636 * @deprecated Use
1637 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1638 */
1639 @Deprecated
1640 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1641 Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001642
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001643 /**
1644 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1645 * instead
1646 */
1647 @Deprecated
1648 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1649
1650 /**
1651 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1652 */
1653 @Deprecated
1654 public static final String WIFI_ON = Secure.WIFI_ON;
1655
1656 /**
1657 * @deprecated Use
1658 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1659 * instead
1660 */
1661 @Deprecated
1662 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1663 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1664
1665 /**
1666 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1667 */
1668 @Deprecated
1669 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1670
1671 /**
1672 * @deprecated Use
1673 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1674 */
1675 @Deprecated
1676 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1677 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001678
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001679 /**
1680 * @deprecated Use
1681 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1682 */
1683 @Deprecated
1684 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1685 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1686
1687 /**
1688 * @deprecated Use
1689 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1690 * instead
1691 */
1692 @Deprecated
1693 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1694 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1695
1696 /**
1697 * @deprecated Use
1698 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1699 */
1700 @Deprecated
1701 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1702 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1703
1704 /**
1705 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1706 * instead
1707 */
1708 @Deprecated
1709 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1710
1711 /**
1712 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1713 */
1714 @Deprecated
1715 public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1716
1717 /**
1718 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1719 */
1720 @Deprecated
1721 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1722
1723 /**
1724 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1725 * instead
1726 */
1727 @Deprecated
1728 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1729
1730 /**
1731 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1732 * instead
1733 */
1734 @Deprecated
1735 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1736 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1737 }
1738
1739 /**
1740 * Secure system settings, containing system preferences that applications
1741 * can read but are not allowed to write. These are for preferences that
1742 * the user must explicitly modify through the system UI or specialized
1743 * APIs for those values, not modified directly by applications.
1744 */
1745 public static final class Secure extends NameValueTable {
1746 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1747
1748 private static volatile NameValueCache mNameValueCache = null;
1749
1750 /**
1751 * Look up a name in the database.
1752 * @param resolver to access the database with
1753 * @param name to look up in the table
1754 * @return the corresponding value, or null if not present
1755 */
1756 public synchronized static String getString(ContentResolver resolver, String name) {
1757 if (mNameValueCache == null) {
1758 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
1759 }
1760 return mNameValueCache.getString(resolver, name);
1761 }
1762
1763 /**
1764 * Store a name/value pair into the database.
1765 * @param resolver to access the database with
1766 * @param name to store
1767 * @param value to associate with the name
1768 * @return true if the value was set, false on database errors
1769 */
1770 public static boolean putString(ContentResolver resolver,
1771 String name, String value) {
1772 return putString(resolver, CONTENT_URI, name, value);
1773 }
1774
1775 /**
1776 * Construct the content URI for a particular name/value pair,
1777 * useful for monitoring changes with a ContentObserver.
1778 * @param name to look up in the table
1779 * @return the corresponding content URI, or null if not present
1780 */
1781 public static Uri getUriFor(String name) {
1782 return getUriFor(CONTENT_URI, name);
1783 }
1784
1785 /**
1786 * Convenience function for retrieving a single secure settings value
1787 * as an integer. Note that internally setting values are always
1788 * stored as strings; this function converts the string to an integer
1789 * for you. The default value will be returned if the setting is
1790 * not defined or not an integer.
1791 *
1792 * @param cr The ContentResolver to access.
1793 * @param name The name of the setting to retrieve.
1794 * @param def Value to return if the setting is not defined.
1795 *
1796 * @return The setting's current value, or 'def' if it is not defined
1797 * or not a valid integer.
1798 */
1799 public static int getInt(ContentResolver cr, String name, int def) {
1800 String v = getString(cr, name);
1801 try {
1802 return v != null ? Integer.parseInt(v) : def;
1803 } catch (NumberFormatException e) {
1804 return def;
1805 }
1806 }
1807
1808 /**
1809 * Convenience function for retrieving a single secure settings value
1810 * as an integer. Note that internally setting values are always
1811 * stored as strings; this function converts the string to an integer
1812 * for you.
1813 * <p>
1814 * This version does not take a default value. If the setting has not
1815 * been set, or the string value is not a number,
1816 * it throws {@link SettingNotFoundException}.
1817 *
1818 * @param cr The ContentResolver to access.
1819 * @param name The name of the setting to retrieve.
1820 *
1821 * @throws SettingNotFoundException Thrown if a setting by the given
1822 * name can't be found or the setting value is not an integer.
1823 *
1824 * @return The setting's current value.
1825 */
1826 public static int getInt(ContentResolver cr, String name)
1827 throws SettingNotFoundException {
1828 String v = getString(cr, name);
1829 try {
1830 return Integer.parseInt(v);
1831 } catch (NumberFormatException e) {
1832 throw new SettingNotFoundException(name);
1833 }
1834 }
1835
1836 /**
1837 * Convenience function for updating a single settings value as an
1838 * integer. This will either create a new entry in the table if the
1839 * given name does not exist, or modify the value of the existing row
1840 * with that name. Note that internally setting values are always
1841 * stored as strings, so this function converts the given value to a
1842 * string before storing it.
1843 *
1844 * @param cr The ContentResolver to access.
1845 * @param name The name of the setting to modify.
1846 * @param value The new value for the setting.
1847 * @return true if the value was set, false on database errors
1848 */
1849 public static boolean putInt(ContentResolver cr, String name, int value) {
1850 return putString(cr, name, Integer.toString(value));
1851 }
1852
1853 /**
1854 * Convenience function for retrieving a single secure settings value
1855 * as a {@code long}. Note that internally setting values are always
1856 * stored as strings; this function converts the string to a {@code long}
1857 * for you. The default value will be returned if the setting is
1858 * not defined or not a {@code long}.
1859 *
1860 * @param cr The ContentResolver to access.
1861 * @param name The name of the setting to retrieve.
1862 * @param def Value to return if the setting is not defined.
1863 *
1864 * @return The setting's current value, or 'def' if it is not defined
1865 * or not a valid {@code long}.
1866 */
1867 public static long getLong(ContentResolver cr, String name, long def) {
1868 String valString = getString(cr, name);
1869 long value;
1870 try {
1871 value = valString != null ? Long.parseLong(valString) : def;
1872 } catch (NumberFormatException e) {
1873 value = def;
1874 }
1875 return value;
1876 }
1877
1878 /**
1879 * Convenience function for retrieving a single secure settings value
1880 * as a {@code long}. Note that internally setting values are always
1881 * stored as strings; this function converts the string to a {@code long}
1882 * for you.
1883 * <p>
1884 * This version does not take a default value. If the setting has not
1885 * been set, or the string value is not a number,
1886 * it throws {@link SettingNotFoundException}.
1887 *
1888 * @param cr The ContentResolver to access.
1889 * @param name The name of the setting to retrieve.
1890 *
1891 * @return The setting's current value.
1892 * @throws SettingNotFoundException Thrown if a setting by the given
1893 * name can't be found or the setting value is not an integer.
1894 */
1895 public static long getLong(ContentResolver cr, String name)
1896 throws SettingNotFoundException {
1897 String valString = getString(cr, name);
1898 try {
1899 return Long.parseLong(valString);
1900 } catch (NumberFormatException e) {
1901 throw new SettingNotFoundException(name);
1902 }
1903 }
1904
1905 /**
1906 * Convenience function for updating a secure settings value as a long
1907 * integer. This will either create a new entry in the table if the
1908 * given name does not exist, or modify the value of the existing row
1909 * with that name. Note that internally setting values are always
1910 * stored as strings, so this function converts the given value to a
1911 * string before storing it.
1912 *
1913 * @param cr The ContentResolver to access.
1914 * @param name The name of the setting to modify.
1915 * @param value The new value for the setting.
1916 * @return true if the value was set, false on database errors
1917 */
1918 public static boolean putLong(ContentResolver cr, String name, long value) {
1919 return putString(cr, name, Long.toString(value));
1920 }
1921
1922 /**
1923 * Convenience function for retrieving a single secure settings value
1924 * as a floating point number. Note that internally setting values are
1925 * always stored as strings; this function converts the string to an
1926 * float for you. The default value will be returned if the setting
1927 * is not defined or not a valid float.
1928 *
1929 * @param cr The ContentResolver to access.
1930 * @param name The name of the setting to retrieve.
1931 * @param def Value to return if the setting is not defined.
1932 *
1933 * @return The setting's current value, or 'def' if it is not defined
1934 * or not a valid float.
1935 */
1936 public static float getFloat(ContentResolver cr, String name, float def) {
1937 String v = getString(cr, name);
1938 try {
1939 return v != null ? Float.parseFloat(v) : def;
1940 } catch (NumberFormatException e) {
1941 return def;
1942 }
1943 }
1944
1945 /**
1946 * Convenience function for retrieving a single secure settings value
1947 * as a float. Note that internally setting values are always
1948 * stored as strings; this function converts the string to a float
1949 * for you.
1950 * <p>
1951 * This version does not take a default value. If the setting has not
1952 * been set, or the string value is not a number,
1953 * it throws {@link SettingNotFoundException}.
1954 *
1955 * @param cr The ContentResolver to access.
1956 * @param name The name of the setting to retrieve.
1957 *
1958 * @throws SettingNotFoundException Thrown if a setting by the given
1959 * name can't be found or the setting value is not a float.
1960 *
1961 * @return The setting's current value.
1962 */
1963 public static float getFloat(ContentResolver cr, String name)
1964 throws SettingNotFoundException {
1965 String v = getString(cr, name);
1966 try {
1967 return Float.parseFloat(v);
1968 } catch (NumberFormatException e) {
1969 throw new SettingNotFoundException(name);
1970 }
1971 }
1972
1973 /**
1974 * Convenience function for updating a single settings value as a
1975 * floating point number. This will either create a new entry in the
1976 * table if the given name does not exist, or modify the value of the
1977 * existing row with that name. Note that internally setting values
1978 * are always stored as strings, so this function converts the given
1979 * value to a string before storing it.
1980 *
1981 * @param cr The ContentResolver to access.
1982 * @param name The name of the setting to modify.
1983 * @param value The new value for the setting.
1984 * @return true if the value was set, false on database errors
1985 */
1986 public static boolean putFloat(ContentResolver cr, String name, float value) {
1987 return putString(cr, name, Float.toString(value));
1988 }
1989
1990 /**
1991 * The content:// style URL for this table
1992 */
1993 public static final Uri CONTENT_URI =
1994 Uri.parse("content://" + AUTHORITY + "/secure");
1995
1996 /**
1997 * Whether ADB is enabled.
1998 */
1999 public static final String ADB_ENABLED = "adb_enabled";
2000
2001 /**
2002 * Setting to allow mock locations and location provider status to be injected into the
2003 * LocationManager service for testing purposes during application development. These
2004 * locations and status values override actual location and status information generated
2005 * by network, gps, or other location providers.
2006 */
2007 public static final String ALLOW_MOCK_LOCATION = "mock_location";
2008
2009 /**
2010 * The Android ID (a unique 64-bit value) as a hex string.
2011 * Identical to that obtained by calling
2012 * GoogleLoginService.getAndroidId(); it is also placed here
2013 * so you can get it without binding to a service.
2014 */
2015 public static final String ANDROID_ID = "android_id";
2016
2017 /**
2018 * Whether bluetooth is enabled/disabled
2019 * 0=disabled. 1=enabled.
2020 */
2021 public static final String BLUETOOTH_ON = "bluetooth_on";
2022
2023 /**
2024 * Get the key that retrieves a bluetooth headset's priority.
2025 * @hide
2026 */
2027 public static final String getBluetoothHeadsetPriorityKey(String address) {
2028 return ("bluetooth_headset_priority_" + address.toUpperCase());
2029 }
2030
2031 /**
2032 * Get the key that retrieves a bluetooth a2dp sink's priority.
2033 * @hide
2034 */
2035 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2036 return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2037 }
2038
2039 /**
2040 * Whether or not data roaming is enabled. (0 = false, 1 = true)
2041 */
2042 public static final String DATA_ROAMING = "data_roaming";
2043
2044 /**
2045 * Setting to record the input method used by default, holding the ID
2046 * of the desired method.
2047 */
2048 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2049
2050 /**
2051 * Whether the device has been provisioned (0 = false, 1 = true)
2052 */
2053 public static final String DEVICE_PROVISIONED = "device_provisioned";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002054
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002055 /**
2056 * List of input methods that are currently enabled. This is a string
2057 * containing the IDs of all enabled input methods, each ID separated
2058 * by ':'.
2059 */
2060 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002061
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002062 /**
2063 * Host name and port for a user-selected proxy.
2064 */
2065 public static final String HTTP_PROXY = "http_proxy";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002066
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002067 /**
2068 * Whether the package installer should allow installation of apps downloaded from
2069 * sources other than the Android Market (vending machine).
2070 *
2071 * 1 = allow installing from other sources
2072 * 0 = only allow installing from the Android Market
2073 */
2074 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002075
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002076 /**
2077 * Comma-separated list of location providers that activities may access.
2078 */
2079 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002080
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002081 /**
Mike Lockwoodbcab8df2009-06-25 16:39:09 -04002082 * Whether assisted GPS should be enabled or not.
2083 * @hide
2084 */
2085 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2086
2087 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002088 * The Logging ID (a unique 64-bit value) as a hex string.
2089 * Used as a pseudonymous identifier for logging.
2090 * @deprecated This identifier is poorly initialized and has
2091 * many collisions. It should not be used.
2092 */
2093 @Deprecated
2094 public static final String LOGGING_ID = "logging_id";
2095
2096 /**
2097 * The Logging ID (a unique 64-bit value) as a hex string.
2098 * Used as a pseudonymous identifier for logging.
2099 * @hide
2100 */
2101 public static final String LOGGING_ID2 = "logging_id2";
2102
2103 /**
2104 * User preference for which network(s) should be used. Only the
2105 * connectivity service should touch this.
2106 */
2107 public static final String NETWORK_PREFERENCE = "network_preference";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002108
2109 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002110 */
2111 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002112
2113 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002114 */
2115 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002116
2117 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002118 */
2119 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002120
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002121 /**
2122 * Settings classname to launch when Settings is clicked from All
2123 * Applications. Needed because of user testing between the old
2124 * and new Settings apps.
2125 */
2126 // TODO: 881807
2127 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002128
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002129 /**
2130 * USB Mass Storage Enabled
2131 */
2132 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002133
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002134 /**
2135 * If this setting is set (to anything), then all references
2136 * to Gmail on the device must change to Google Mail.
2137 */
2138 public static final String USE_GOOGLE_MAIL = "use_google_mail";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002139
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002140 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07002141 * If accessibility is enabled.
2142 */
2143 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2144
2145 /**
2146 * List of the enabled accessibility providers.
2147 */
2148 public static final String ENABLED_ACCESSIBILITY_SERVICES =
2149 "enabled_accessibility_services";
2150
2151 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07002152 * Setting to always use the default text-to-speech settings regardless
2153 * of the application settings.
2154 * 1 = override application settings,
2155 * 0 = use application settings (if specified).
2156 */
2157 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2158
2159 /**
2160 * Default text-to-speech engine speech rate. 100 = 1x
2161 */
2162 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2163
2164 /**
2165 * Default text-to-speech engine pitch. 100 = 1x
2166 */
2167 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2168
2169 /**
2170 * Default text-to-speech engine.
2171 */
2172 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2173
2174 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07002175 * Default text-to-speech language.
2176 */
2177 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2178
2179 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07002180 * Default text-to-speech country.
2181 */
2182 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2183
2184 /**
2185 * Default text-to-speech locale variant.
2186 */
2187 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2188
2189 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002190 * Whether to notify the user of open networks.
2191 * <p>
2192 * If not connected and the scan results have an open network, we will
2193 * put this notification up. If we attempt to connect to a network or
2194 * the open network(s) disappear, we remove the notification. When we
2195 * show the notification, we will not show it again for
2196 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2197 */
2198 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2199 "wifi_networks_available_notification_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002201 /**
2202 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2203 * Connecting to a network will reset the timer.
2204 */
2205 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2206 "wifi_networks_available_repeat_delay";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002207
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 /**
2209 * The number of radio channels that are allowed in the local
2210 * 802.11 regulatory domain.
2211 * @hide
2212 */
2213 public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002214
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 /**
2216 * When the number of open networks exceeds this number, the
2217 * least-recently-used excess networks will be removed.
2218 */
2219 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002220
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002221 /**
2222 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
2223 */
2224 public static final String WIFI_ON = "wifi_on";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002225
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002226 /**
2227 * The acceptable packet loss percentage (range 0 - 100) before trying
2228 * another AP on the same network.
2229 */
2230 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2231 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002233 /**
2234 * The number of access points required for a network in order for the
2235 * watchdog to monitor it.
2236 */
2237 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002238
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002239 /**
2240 * The delay between background checks.
2241 */
2242 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2243 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002244
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 /**
2246 * Whether the Wi-Fi watchdog is enabled for background checking even
2247 * after it thinks the user has connected to a good access point.
2248 */
2249 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2250 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002251
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002252 /**
2253 * The timeout for a background ping
2254 */
2255 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2256 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002258 /**
2259 * The number of initial pings to perform that *may* be ignored if they
2260 * fail. Again, if these fail, they will *not* be used in packet loss
2261 * calculation. For example, one network always seemed to time out for
2262 * the first couple pings, so this is set to 3 by default.
2263 */
2264 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2265 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002266
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002267 /**
2268 * The maximum number of access points (per network) to attempt to test.
2269 * If this number is reached, the watchdog will no longer monitor the
2270 * initial connection state for the network. This is a safeguard for
2271 * networks containing multiple APs whose DNS does not respond to pings.
2272 */
2273 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002275 /**
2276 * Whether the Wi-Fi watchdog is enabled.
2277 */
2278 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2279
2280 /**
2281 * 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 -08002282 */
2283 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2284
2285 /**
2286 * The number of pings to test if an access point is a good connection.
2287 */
2288 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002289
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002290 /**
2291 * The delay between pings.
2292 */
2293 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002294
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002295 /**
2296 * The timeout per ping.
2297 */
2298 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002300 /**
2301 * The maximum number of times we will retry a connection to an access
2302 * point for which we have failed in acquiring an IP address from DHCP.
2303 * 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 -08002304 */
2305 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002306
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002307 /**
2308 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2309 * data connectivity to be established after a disconnect from Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002310 */
2311 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2312 "wifi_mobile_data_transition_wakelock_timeout_ms";
2313
2314 /**
2315 * Whether background data usage is allowed by the user. See
2316 * ConnectivityManager for more info.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002317 */
2318 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07002319
2320 /**
Christian Sonntag62d95ea2009-09-02 09:28:37 -07002321 * The time in msec, when the LAST_KMSG file was send to the checkin server.
2322 * We will only send the LAST_KMSG file if it was modified after this time.
2323 *
2324 * @hide
2325 */
2326 public static final String CHECKIN_SEND_LAST_KMSG_TIME = "checkin_kmsg_time";
2327
2328 /**
2329 * The time in msec, when the apanic_console file was send to the checkin server.
2330 * We will only send the apanic_console file if it was modified after this time.
2331 *
2332 * @hide
2333 */
2334 public static final String CHECKIN_SEND_APANIC_CONSOLE_TIME =
2335 "checkin_apanic_console_time";
2336
2337 /**
2338 * The time in msec, when the apanic_thread file was send to the checkin server.
2339 * We will only send the apanic_thread file if it was modified after this time.
2340 *
2341 * @hide
2342 */
2343 public static final String CHECKIN_SEND_APANIC_THREAD_TIME =
2344 "checkin_apanic_thread_time";
2345
2346 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002347 * The CDMA roaming mode 0 = Home Networks, CDMA default
2348 * 1 = Roaming on Affiliated networks
2349 * 2 = Roaming on any networks
2350 * @hide
2351 */
2352 public static final String CDMA_ROAMING_MODE = "roaming_settings";
2353
2354 /**
2355 * The CDMA subscription mode 0 = RUIM/SIM (default)
2356 * 1 = NV
2357 * @hide
2358 */
2359 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2360
2361 /**
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002362 * The preferred network mode 7 = Global
2363 * 6 = EvDo only
2364 * 5 = CDMA w/o EvDo
2365 * 4 = CDMA / EvDo auto
2366 * 3 = GSM / WCDMA auto
2367 * 2 = WCDMA only
2368 * 1 = GSM only
2369 * 0 = GSM / WCDMA preferred
Wink Saville04e71b32009-04-02 11:00:54 -07002370 * @hide
2371 */
2372 public static final String PREFERRED_NETWORK_MODE =
2373 "preferred_network_mode";
2374
2375 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07002376 * The preferred TTY mode 0 = TTy Off, CDMA default
2377 * 1 = TTY Full
2378 * 2 = TTY HCO
2379 * 3 = TTY VCO
2380 * @hide
2381 */
2382 public static final String PREFERRED_TTY_MODE =
2383 "preferred_tty_mode";
2384
2385
2386 /**
Wink Saville04e71b32009-04-02 11:00:54 -07002387 * CDMA Cell Broadcast SMS
2388 * 0 = CDMA Cell Broadcast SMS disabled
2389 * 1 = CDMA Cell Broadcast SMS enabled
2390 * @hide
2391 */
2392 public static final String CDMA_CELL_BROADCAST_SMS =
2393 "cdma_cell_broadcast_sms";
2394
2395 /**
2396 * The cdma subscription 0 = Subscription from RUIM, when available
2397 * 1 = Subscription from NV
2398 * @hide
2399 */
2400 public static final String PREFERRED_CDMA_SUBSCRIPTION =
2401 "preferred_cdma_subscription";
2402
2403 /**
2404 * Whether the enhanced voice privacy mode is enabled.
2405 * 0 = normal voice privacy
2406 * 1 = enhanced voice privacy
2407 * @hide
2408 */
2409 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2410
2411 /**
2412 * Whether the TTY mode mode is enabled.
2413 * 0 = disabled
2414 * 1 = enabled
2415 * @hide
2416 */
2417 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002418
2419 /**
Amith Yamasani630cd062009-06-19 12:07:02 -07002420 * Flag for allowing service provider to use location information to improve products and
2421 * services.
2422 * Type: int ( 0 = disallow, 1 = allow )
2423 * @hide
2424 */
2425 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
2426
2427 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002428 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07002429 * Type: int ( 0 = disabled, 1 = enabled )
2430 * @hide
2431 */
2432 public static final String BACKUP_ENABLED = "backup_enabled";
2433
2434 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07002435 * Indicates whether settings backup has been fully provisioned.
2436 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2437 * @hide
2438 */
2439 public static final String BACKUP_PROVISIONED = "backup_provisioned";
2440
2441 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07002442 * Component of the transport to use for backup/restore.
2443 * @hide
2444 */
2445 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002446
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07002447 /**
2448 * Version for which the setup wizard was last shown. Bumped for
2449 * each release when there is new setup information to show.
2450 * @hide
2451 */
2452 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07002453
2454 /**
Doug Zongkerf6888892010-01-06 16:38:14 -08002455 * How frequently (in seconds) to check the memory status of the
2456 * device.
2457 * @hide
2458 */
2459 public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2460
2461 /**
2462 * Max frequency (in seconds) to log memory check stats, in realtime
2463 * seconds. This allows for throttling of logs when the device is
2464 * running for large amounts of time.
2465 * @hide
2466 */
2467 public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2468 "memcheck_log_realtime_interval";
2469
2470 /**
2471 * Boolean indicating whether rebooting due to system memory checks
2472 * is enabled.
2473 * @hide
2474 */
2475 public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2476
2477 /**
2478 * How many bytes the system process must be below to avoid scheduling
2479 * a soft reboot. This reboot will happen when it is next determined
2480 * to be a good time.
2481 * @hide
2482 */
2483 public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2484
2485 /**
2486 * How many bytes the system process must be below to avoid scheduling
2487 * a hard reboot. This reboot will happen immediately.
2488 * @hide
2489 */
2490 public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2491
2492 /**
2493 * How many bytes the phone process must be below to avoid scheduling
2494 * a soft restart. This restart will happen when it is next determined
2495 * to be a good time.
2496 * @hide
2497 */
2498 public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2499
2500 /**
2501 * How many bytes the phone process must be below to avoid scheduling
2502 * a hard restart. This restart will happen immediately.
2503 * @hide
2504 */
2505 public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2506
2507 /**
2508 * Boolean indicating whether restarting the phone process due to
2509 * memory checks is enabled.
2510 * @hide
2511 */
2512 public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2513
2514 /**
2515 * First time during the day it is okay to kill processes
2516 * or reboot the device due to low memory situations. This number is
2517 * in seconds since midnight.
2518 * @hide
2519 */
2520 public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2521
2522 /**
2523 * Last time during the day it is okay to kill processes
2524 * or reboot the device due to low memory situations. This number is
2525 * in seconds since midnight.
2526 * @hide
2527 */
2528 public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2529
2530 /**
2531 * How long the screen must have been off in order to kill processes
2532 * or reboot. This number is in seconds. A value of -1 means to
2533 * entirely disregard whether the screen is on.
2534 * @hide
2535 */
2536 public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2537
2538 /**
2539 * How much time there must be until the next alarm in order to kill processes
2540 * or reboot. This number is in seconds. Note: this value must be
2541 * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2542 * always see an alarm scheduled within its time.
2543 * @hide
2544 */
2545 public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2546
2547 /**
2548 * How frequently to check whether it is a good time to restart things,
2549 * if the device is in a bad state. This number is in seconds. Note:
2550 * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2551 * the alarm to schedule the recheck will always appear within the
2552 * minimum "do not execute now" time.
2553 * @hide
2554 */
2555 public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2556
2557 /**
2558 * How frequently (in DAYS) to reboot the device. If 0, no reboots
2559 * will occur.
2560 * @hide
2561 */
2562 public static final String REBOOT_INTERVAL = "reboot_interval";
2563
2564 /**
2565 * First time during the day it is okay to force a reboot of the
2566 * device (if REBOOT_INTERVAL is set). This number is
2567 * in seconds since midnight.
2568 * @hide
2569 */
2570 public static final String REBOOT_START_TIME = "reboot_start_time";
2571
2572 /**
2573 * The window of time (in seconds) after each REBOOT_INTERVAL in which
2574 * a reboot can be executed. If 0, a reboot will always be executed at
2575 * exactly the given time. Otherwise, it will only be executed if
2576 * the device is idle within the window.
2577 * @hide
2578 */
2579 public static final String REBOOT_WINDOW = "reboot_window";
2580
2581 /**
Doug Zongker43866e02010-01-07 12:09:54 -08002582 * Threshold values for the duration and level of a discharge cycle, under
2583 * which we log discharge cycle info.
2584 * @hide
2585 */
2586 public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
2587 "battery_discharge_duration_threshold";
2588 /** @hide */
2589 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
2590
2591 /**
2592 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
2593 * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
2594 * will never display the "Report" button.
2595 * Type: int ( 0 = disallow, 1 = allow )
2596 * @hide
2597 */
2598 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
2599
2600 /**
2601 * Nonzero causes Log.wtf() to crash.
2602 * @hide
2603 */
2604 public static final String WTF_IS_FATAL = "wtf_is_fatal";
2605
2606 /**
2607 * Maximum age of entries kept by {@link android.os.IDropBox}.
2608 * @hide
2609 */
2610 public static final String DROPBOX_AGE_SECONDS =
2611 "dropbox_age_seconds";
2612 /**
2613 * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
2614 * @hide
2615 */
2616 public static final String DROPBOX_QUOTA_KB =
2617 "dropbox_quota_kb";
2618 /**
2619 * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
2620 * @hide
2621 */
2622 public static final String DROPBOX_QUOTA_PERCENT =
2623 "dropbox_quota_percent";
2624 /**
2625 * Percent of total disk which {@link android.os.IDropBox} will never dip into.
2626 * @hide
2627 */
2628 public static final String DROPBOX_RESERVE_PERCENT =
2629 "dropbox_reserve_percent";
2630 /**
2631 * Prefix for per-tag dropbox disable/enable settings.
2632 * @hide
2633 */
2634 public static final String DROPBOX_TAG_PREFIX =
2635 "dropbox:";
2636
2637
2638 /**
2639 * Screen timeout in milliseconds corresponding to the
2640 * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
2641 * possible screen timeout behavior.)
2642 * @hide
2643 */
2644 public static final String SHORT_KEYLIGHT_DELAY_MS =
2645 "short_keylight_delay_ms";
2646
2647 /**
2648 * The interval in minutes after which the amount of free storage left on the
2649 * device is logged to the event log
2650 * @hide
2651 */
2652 public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
2653 "sys_free_storage_log_interval";
2654
2655 /**
2656 * Threshold for the amount of change in disk free space required to report the amount of
2657 * free space. Used to prevent spamming the logs when the disk free space isn't changing
2658 * frequently.
2659 * @hide
2660 */
2661 public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
2662 "disk_free_change_reporting_threshold";
2663
2664
2665 /**
2666 * Minimum percentage of free storage on the device that is used to determine if
2667 * the device is running low on storage.
2668 * Say this value is set to 10, the device is considered running low on storage
2669 * if 90% or more of the device storage is filled up.
2670 * @hide
2671 */
2672 public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
2673 "sys_storage_threshold_percentage";
2674
2675 /**
2676 * The interval in milliseconds after which Wi-Fi is considered idle.
2677 * When idle, it is possible for the device to be switched from Wi-Fi to
2678 * the mobile data network.
2679 * @hide
2680 */
2681 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
2682
2683 /**
Doug Zongkeredc51892010-01-07 13:51:16 -08002684 * The interval in milliseconds at which to check packet counts on the
2685 * mobile data interface when screen is on, to detect possible data
2686 * connection problems.
2687 * @hide
2688 */
2689 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
2690 "pdp_watchdog_poll_interval_ms";
2691
2692 /**
2693 * The interval in milliseconds at which to check packet counts on the
2694 * mobile data interface when screen is off, to detect possible data
2695 * connection problems.
2696 * @hide
2697 */
2698 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
2699 "pdp_watchdog_long_poll_interval_ms";
2700
2701 /**
2702 * The interval in milliseconds at which to check packet counts on the
2703 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
2704 * outgoing packets has been reached without incoming packets.
2705 * @hide
2706 */
2707 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
2708 "pdp_watchdog_error_poll_interval_ms";
2709
2710 /**
2711 * The number of outgoing packets sent without seeing an incoming packet
2712 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
2713 * device is logged to the event log
2714 * @hide
2715 */
2716 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
2717 "pdp_watchdog_trigger_packet_count";
2718
2719 /**
2720 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
2721 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
2722 * attempting data connection recovery.
2723 * @hide
2724 */
2725 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
2726 "pdp_watchdog_error_poll_count";
2727
2728 /**
2729 * The number of failed PDP reset attempts before moving to something more
2730 * drastic: re-registering to the network.
2731 * @hide
2732 */
2733 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
2734 "pdp_watchdog_max_pdp_reset_fail_count";
2735
2736 /**
2737 * Address to ping as a last sanity check before attempting any recovery.
2738 * Unset or set to "0.0.0.0" to skip this check.
2739 * @hide
2740 */
2741 public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
2742
2743 /**
2744 * The "-w deadline" parameter for the ping, ie, the max time in
2745 * seconds to spend pinging.
2746 * @hide
2747 */
2748 public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
2749
2750 /**
2751 * The interval in milliseconds at which to check gprs registration
2752 * after the first registration mismatch of gprs and voice service,
2753 * to detect possible data network registration problems.
2754 *
2755 * @hide
2756 */
2757 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
2758 "gprs_register_check_period_ms";
2759
2760 /**
2761 * The length of time in milli-seconds that automatic small adjustments to
2762 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
2763 * @hide
2764 */
2765 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
2766
2767 /**
2768 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
2769 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
2770 * exceeded.
2771 * @hide
2772 */
2773 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
2774
2775 /**
2776 * The maximum reconnect delay for short network outages or when the network is suspended
2777 * due to phone use.
2778 * @hide
2779 */
2780 public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
2781 "sync_max_retry_delay_in_seconds";
2782
2783 /**
2784 * The interval in milliseconds at which to check the number of SMS sent
2785 * out without asking for use permit, to limit the un-authorized SMS
2786 * usage.
2787 * @hide
2788 */
2789 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
2790 "sms_outgoing_check_interval_ms";
2791
2792 /**
2793 * The number of outgoing SMS sent without asking for user permit
2794 * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
2795 * @hide
2796 */
2797 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
2798 "sms_outgoing_check_max_count";
2799
2800 /**
2801 * Enable use of ssl session caching.
2802 * 'db' - save each session in a (per process) database
2803 * 'file' - save each session in a (per process) file
2804 * not set or any other value - normal java in-memory caching
2805 * @hide
2806 */
2807 public static final String SSL_SESSION_CACHE = "ssl_session_cache";
2808
2809 /**
2810 * How many bytes long a message has to be, in order to be gzipped.
2811 * @hide
2812 */
2813 public static final String SYNC_MIN_GZIP_BYTES =
2814 "sync_min_gzip_bytes";
2815
2816 /**
-b master501eec92009-07-06 13:53:11 -07002817 * @hide
2818 */
2819 public static final String[] SETTINGS_TO_BACKUP = {
Amith Yamasani8823c0a82009-07-07 14:30:17 -07002820 ADB_ENABLED,
2821 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07002822 PARENTAL_CONTROL_ENABLED,
2823 PARENTAL_CONTROL_REDIRECT_URL,
2824 USB_MASS_STORAGE_ENABLED,
2825 ACCESSIBILITY_ENABLED,
2826 ENABLED_ACCESSIBILITY_SERVICES,
2827 TTS_USE_DEFAULTS,
2828 TTS_DEFAULT_RATE,
2829 TTS_DEFAULT_PITCH,
2830 TTS_DEFAULT_SYNTH,
2831 TTS_DEFAULT_LANG,
2832 TTS_DEFAULT_COUNTRY,
2833 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
2834 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
2835 WIFI_NUM_ALLOWED_CHANNELS,
2836 WIFI_NUM_OPEN_NETWORKS_KEPT,
-b master501eec92009-07-06 13:53:11 -07002837 };
2838
2839 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002840 * Helper method for determining if a location provider is enabled.
2841 * @param cr the content resolver to use
2842 * @param provider the location provider to query
2843 * @return true if the provider is enabled
2844 *
2845 * @hide
2846 */
2847 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
2848 String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
2849 if (allowedProviders != null) {
2850 return (allowedProviders.equals(provider) ||
2851 allowedProviders.contains("," + provider + ",") ||
2852 allowedProviders.startsWith(provider + ",") ||
2853 allowedProviders.endsWith("," + provider));
2854 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002855 return false;
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07002856 }
2857
2858 /**
2859 * Thread-safe method for enabling or disabling a single location provider.
2860 * @param cr the content resolver to use
2861 * @param provider the location provider to enable or disable
2862 * @param enabled true if the provider should be enabled
2863 *
2864 * @hide
2865 */
2866 public static final void setLocationProviderEnabled(ContentResolver cr,
2867 String provider, boolean enabled) {
2868 // to ensure thread safety, we write the provider name with a '+' or '-'
2869 // and let the SettingsProvider handle it rather than reading and modifying
2870 // the list of enabled providers.
2871 if (enabled) {
2872 provider = "+" + provider;
2873 } else {
2874 provider = "-" + provider;
2875 }
2876 putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
2877 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002878 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002879
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002880 /**
2881 * Gservices settings, containing the network names for Google's
2882 * various services. This table holds simple name/addr pairs.
2883 * Addresses can be accessed through the getString() method.
2884 *
2885 * TODO: This should move to partner/google/... somewhere.
2886 *
2887 * @hide
2888 */
2889 public static final class Gservices extends NameValueTable {
2890 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_gservices_version";
2891
2892 /**
2893 * Intent action broadcast when the Gservices table is updated by the server.
2894 * This is broadcast once after settings change (so many values may have been updated).
2895 */
2896 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2897 public static final String CHANGED_ACTION =
2898 "com.google.gservices.intent.action.GSERVICES_CHANGED";
2899
Dan Egnorabc25e32009-05-13 19:22:08 -07002900 /**
2901 * Intent action to override Gservices for testing. (Requires WRITE_GSERVICES permission.)
2902 */
2903 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2904 public static final String OVERRIDE_ACTION =
2905 "com.google.gservices.intent.action.GSERVICES_OVERRIDE";
2906
Dan Egnor2effb212009-11-05 20:08:22 -08002907 /**
2908 * Intent action to set Gservices with new values. (Requires WRITE_GSERVICES permission.)
2909 */
2910 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2911 public static final String UPDATE_ACTION =
2912 "com.google.gservices.intent.action.GSERVICES_UPDATE";
2913
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002914 private static volatile NameValueCache mNameValueCache = null;
2915 private static final Object mNameValueCacheLock = new Object();
2916
2917 /**
2918 * Look up a name in the database.
2919 * @param resolver to access the database with
2920 * @param name to look up in the table
2921 * @return the corresponding value, or null if not present
2922 */
2923 public static String getString(ContentResolver resolver, String name) {
2924 synchronized (mNameValueCacheLock) {
2925 if (mNameValueCache == null) {
2926 mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
2927 }
2928 return mNameValueCache.getString(resolver, name);
2929 }
2930 }
2931
2932 /**
2933 * Store a name/value pair into the database.
2934 * @param resolver to access the database with
2935 * @param name to store
2936 * @param value to associate with the name
2937 * @return true if the value was set, false on database errors
2938 */
2939 public static boolean putString(ContentResolver resolver,
2940 String name, String value) {
2941 return putString(resolver, CONTENT_URI, name, value);
2942 }
2943
2944 /**
2945 * Look up the value for name in the database, convert it to an int using Integer.parseInt
2946 * and return it. If it is null or if a NumberFormatException is caught during the
2947 * conversion then return defValue.
2948 */
2949 public static int getInt(ContentResolver resolver, String name, int defValue) {
2950 String valString = getString(resolver, name);
2951 int value;
2952 try {
2953 value = valString != null ? Integer.parseInt(valString) : defValue;
2954 } catch (NumberFormatException e) {
2955 value = defValue;
2956 }
2957 return value;
2958 }
2959
2960 /**
2961 * Look up the value for name in the database, convert it to a long using Long.parseLong
2962 * and return it. If it is null or if a NumberFormatException is caught during the
2963 * conversion then return defValue.
2964 */
2965 public static long getLong(ContentResolver resolver, String name, long defValue) {
2966 String valString = getString(resolver, name);
2967 long value;
2968 try {
2969 value = valString != null ? Long.parseLong(valString) : defValue;
2970 } catch (NumberFormatException e) {
2971 value = defValue;
2972 }
2973 return value;
2974 }
2975
2976 /**
2977 * Construct the content URI for a particular name/value pair,
2978 * useful for monitoring changes with a ContentObserver.
2979 * @param name to look up in the table
2980 * @return the corresponding content URI, or null if not present
2981 */
2982 public static Uri getUriFor(String name) {
2983 return getUriFor(CONTENT_URI, name);
2984 }
2985
2986 /**
2987 * The content:// style URL for this table
2988 */
2989 public static final Uri CONTENT_URI =
2990 Uri.parse("content://" + AUTHORITY + "/gservices");
2991
2992 /**
2993 * MMS - URL to use for HTTP "x-wap-profile" header
2994 */
2995 public static final String MMS_X_WAP_PROFILE_URL
2996 = "mms_x_wap_profile_url";
2997
2998 /**
2999 * YouTube - the flag to indicate whether to use proxy
3000 */
3001 public static final String YOUTUBE_USE_PROXY
3002 = "youtube_use_proxy";
3003
3004 /**
3005 * MMS - maximum message size in bytes for a MMS message.
3006 */
3007 public static final String MMS_MAXIMUM_MESSAGE_SIZE
3008 = "mms_maximum_message_size";
3009
3010 /**
3011 * Event tags from the kernel event log to upload during checkin.
3012 */
3013 public static final String CHECKIN_EVENTS = "checkin_events";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003014
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003015 /**
Dianne Hackborn9fdbf6a2009-07-19 14:18:51 -07003016 * Comma-separated list of service names to dump and upload during checkin.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003017 */
3018 public static final String CHECKIN_DUMPSYS_LIST = "checkin_dumpsys_list";
3019
3020 /**
Dianne Hackborn9fdbf6a2009-07-19 14:18:51 -07003021 * Comma-separated list of packages to specify for each service that is
3022 * dumped (currently only meaningful for user activity).
3023 */
3024 public static final String CHECKIN_PACKAGE_LIST = "checkin_package_list";
3025
3026 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003027 * The interval (in seconds) between periodic checkin attempts.
3028 */
3029 public static final String CHECKIN_INTERVAL = "checkin_interval";
3030
3031 /**
Dan Egnor6139bf62009-11-11 15:45:59 -08003032 * The interval (in seconds) between event log aggregation runs.
3033 */
3034 public static final String AGGREGATION_INTERVAL_SECONDS = "aggregation_interval_seconds";
3035
3036 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003037 * Boolean indicating if the market app should force market only checkins on
3038 * install/uninstall. Any non-0 value is considered true.
3039 */
3040 public static final String MARKET_FORCE_CHECKIN = "market_force_checkin";
3041
3042 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003043 * The minimum version of the server that is required in order for the device to accept
3044 * the server's recommendations about the initial sync settings to use. When this is unset,
3045 * blank or can't be interpreted as an integer then we will not ask the server for a
3046 * recommendation.
3047 */
3048 public static final String GMAIL_CONFIG_INFO_MIN_SERVER_VERSION =
3049 "gmail_config_info_min_server_version";
3050
3051 /**
3052 * Controls whether Gmail offers a preview button for images.
3053 */
3054 public static final String GMAIL_DISALLOW_IMAGE_PREVIEWS = "gmail_disallow_image_previews";
3055
3056 /**
Cedric Beustafb6c8e2009-03-24 22:35:42 -07003057 * The maximal size in bytes allowed for attachments when composing messages in Gmail
3058 */
3059 public static final String GMAIL_MAX_ATTACHMENT_SIZE = "gmail_max_attachment_size_bytes";
3060
3061 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003062 * The timeout in milliseconds that Gmail uses when opening a connection and reading
3063 * from it. A missing value or a value of -1 instructs Gmail to use the defaults provided
3064 * by GoogleHttpClient.
3065 */
3066 public static final String GMAIL_TIMEOUT_MS = "gmail_timeout_ms";
3067
3068 /**
3069 * Controls whether Gmail will request an expedited sync when a message is sent. Value must
3070 * be an integer where non-zero means true. Defaults to 1.
3071 */
3072 public static final String GMAIL_SEND_IMMEDIATELY = "gmail_send_immediately";
3073
3074 /**
3075 * Controls whether gmail buffers server responses. Possible values are "memory", for a
3076 * memory-based buffer, or "file", for a temp-file-based buffer. All other values
3077 * (including not set) disable buffering.
3078 */
3079 public static final String GMAIL_BUFFER_SERVER_RESPONSE = "gmail_buffer_server_response";
3080
3081 /**
Cynthia Wong85427f712009-06-10 14:42:42 -07003082 * The maximum size in bytes allowed for the provider to gzip a protocol buffer uploaded to
3083 * the server.
3084 */
3085 public static final String GMAIL_MAX_GZIP_SIZE = "gmail_max_gzip_size_bytes";
3086
3087 /**
Cynthia Wong44e4aaf2009-04-08 13:32:09 -07003088 * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
Cynthia Wongcac13822009-09-16 10:47:42 -07003089 * an integer where non-zero means true. Defaults to 1. This flag controls Donut devices.
Cynthia Wong44e4aaf2009-04-08 13:32:09 -07003090 */
3091 public static final String GMAIL_DISCARD_ERROR_UPHILL_OP = "gmail_discard_error_uphill_op";
3092
3093 /**
Cynthia Wongcac13822009-09-16 10:47:42 -07003094 * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
3095 * an integer where non-zero means true. Defaults to 1. This flag controls Eclair and
3096 * future devices.
3097 */
3098 public static final String GMAIL_DISCARD_ERROR_UPHILL_OP_NEW =
3099 "gmail_discard_error_uphill_op_new";
3100
3101 /**
Cynthia Wong04f0b052009-07-07 11:14:21 -07003102 * Controls how many attempts Gmail will try to upload an uphill operations before it
3103 * abandons the operation. Defaults to 20.
3104 */
Cynthia Wong0d54b022009-08-10 16:39:36 -07003105 public static final String GMAIL_NUM_RETRY_UPHILL_OP = "gmail_num_retry_uphill_op";
3106
3107 /**
3108 * How much time in seconds Gmail will try to upload an uphill operations before it
3109 * abandons the operation. Defaults to 36400 (one day).
3110 */
3111 public static final String GMAIL_WAIT_TIME_RETRY_UPHILL_OP =
3112 "gmail_wait_time_retry_uphill_op";
Cynthia Wong04f0b052009-07-07 11:14:21 -07003113
3114 /**
Cynthia Wong4ff96002009-11-09 09:42:14 -08003115 * Controls if Gmail should delay sending operations that have previously failed.
3116 */
3117 public static final String GMAIL_DELAY_BAD_OP = "gmail_delay_bad_op";
3118
3119 /**
Cynthia Wong278a8022009-07-10 13:27:03 -07003120 * Controls if the protocol buffer version of the protocol will use a multipart request for
3121 * attachment uploads. Value must be an integer where non-zero means true. Defaults to 0.
3122 */
3123 public static final String GMAIL_USE_MULTIPART_PROTOBUF = "gmail_use_multipart_protobuf";
3124
3125 /**
Wei Huangceca25f2009-06-19 13:08:39 -07003126 * the transcoder URL for mobile devices.
3127 */
3128 public static final String TRANSCODER_URL = "mobile_transcoder_url";
3129
3130 /**
3131 * URL that points to the privacy terms of the Google Talk service.
3132 */
Tom Taylor2c0a01a2009-06-22 15:17:59 -07003133 public static final String GTALK_TERMS_OF_SERVICE_URL = "gtalk_terms_of_service_url";
Wei Huangceca25f2009-06-19 13:08:39 -07003134
3135 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003136 * Hostname of the GTalk server.
3137 */
3138 public static final String GTALK_SERVICE_HOSTNAME = "gtalk_hostname";
3139
3140 /**
3141 * Secure port of the GTalk server.
3142 */
3143 public static final String GTALK_SERVICE_SECURE_PORT = "gtalk_secure_port";
3144
3145 /**
3146 * The server configurable RMQ acking interval
3147 */
3148 public static final String GTALK_SERVICE_RMQ_ACK_INTERVAL = "gtalk_rmq_ack_interval";
3149
3150 /**
3151 * The minimum reconnect delay for short network outages or when the network is suspended
3152 * due to phone use.
3153 */
3154 public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT =
3155 "gtalk_min_reconnect_delay_short";
3156
3157 /**
3158 * The reconnect variant range for short network outages or when the network is suspended
3159 * due to phone use. A random number between 0 and this constant is computed and
3160 * added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT} to form the initial reconnect
3161 * delay.
3162 */
3163 public static final String GTALK_SERVICE_RECONNECT_VARIANT_SHORT =
3164 "gtalk_reconnect_variant_short";
3165
3166 /**
3167 * The minimum reconnect delay for long network outages
3168 */
3169 public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG =
3170 "gtalk_min_reconnect_delay_long";
3171
3172 /**
3173 * The reconnect variant range for long network outages. A random number between 0 and this
3174 * constant is computed and added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG} to
3175 * form the initial reconnect delay.
3176 */
3177 public static final String GTALK_SERVICE_RECONNECT_VARIANT_LONG =
3178 "gtalk_reconnect_variant_long";
3179
3180 /**
3181 * The maximum reconnect delay time, in milliseconds.
3182 */
3183 public static final String GTALK_SERVICE_MAX_RECONNECT_DELAY =
3184 "gtalk_max_reconnect_delay";
3185
3186 /**
3187 * The network downtime that is considered "short" for the above calculations,
3188 * in milliseconds.
3189 */
3190 public static final String GTALK_SERVICE_SHORT_NETWORK_DOWNTIME =
3191 "gtalk_short_network_downtime";
3192
3193 /**
3194 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
3195 * will reset the heartbeat timer. The away heartbeat should be used when the user is
3196 * logged into the GTalk app, but not actively using it.
3197 */
3198 public static final String GTALK_SERVICE_AWAY_HEARTBEAT_INTERVAL_MS =
3199 "gtalk_heartbeat_ping_interval_ms"; // keep the string backward compatible
3200
3201 /**
3202 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
3203 * will reset the heartbeat timer. The active heartbeat should be used when the user is
3204 * actively using the GTalk app.
3205 */
3206 public static final String GTALK_SERVICE_ACTIVE_HEARTBEAT_INTERVAL_MS =
3207 "gtalk_active_heartbeat_ping_interval_ms";
3208
3209 /**
3210 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
3211 * will reset the heartbeat timer. The sync heartbeat should be used when the user isn't
3212 * logged into the GTalk app, but auto-sync is enabled.
3213 */
3214 public static final String GTALK_SERVICE_SYNC_HEARTBEAT_INTERVAL_MS =
3215 "gtalk_sync_heartbeat_ping_interval_ms";
3216
3217 /**
3218 * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
3219 * will reset the heartbeat timer. The no sync heartbeat should be used when the user isn't
3220 * logged into the GTalk app, and auto-sync is not enabled.
3221 */
3222 public static final String GTALK_SERVICE_NOSYNC_HEARTBEAT_INTERVAL_MS =
3223 "gtalk_nosync_heartbeat_ping_interval_ms";
3224
3225 /**
Tom Taylor2debd562009-07-14 11:27:20 -07003226 * The maximum heartbeat interval used while on the WIFI network.
Wei Huange87b2f02009-06-02 15:16:04 -07003227 */
3228 public static final String GTALK_SERVICE_WIFI_MAX_HEARTBEAT_INTERVAL_MS =
3229 "gtalk_wifi_max_heartbeat_ping_interval_ms";
3230
3231 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003232 * How long we wait to receive a heartbeat ping acknowledgement (or another packet)
3233 * from the GTalk server, before deeming the connection dead.
3234 */
3235 public static final String GTALK_SERVICE_HEARTBEAT_ACK_TIMEOUT_MS =
3236 "gtalk_heartbeat_ack_timeout_ms";
3237
3238 /**
3239 * How long after screen is turned off before we consider the user to be idle.
3240 */
3241 public static final String GTALK_SERVICE_IDLE_TIMEOUT_MS =
3242 "gtalk_idle_timeout_ms";
3243
3244 /**
3245 * By default, GTalkService will always connect to the server regardless of the auto-sync
3246 * setting. However, if this parameter is true, then GTalkService will only connect
3247 * if auto-sync is enabled. Using the GTalk app will trigger the connection too.
3248 */
3249 public static final String GTALK_SERVICE_CONNECT_ON_AUTO_SYNC =
3250 "gtalk_connect_on_auto_sync";
3251
3252 /**
3253 * GTalkService holds a wakelock while broadcasting the intent for data message received.
3254 * It then automatically release the wakelock after a timeout. This setting controls what
3255 * the timeout should be.
3256 */
3257 public static final String GTALK_DATA_MESSAGE_WAKELOCK_MS =
3258 "gtalk_data_message_wakelock_ms";
3259
3260 /**
3261 * The socket read timeout used to control how long ssl handshake wait for reads before
3262 * timing out. This is needed so the ssl handshake doesn't hang for a long time in some
3263 * circumstances.
3264 */
3265 public static final String GTALK_SSL_HANDSHAKE_TIMEOUT_MS =
3266 "gtalk_ssl_handshake_timeout_ms";
3267
3268 /**
Costin Manolachef967afd2009-04-17 17:37:29 -07003269 * Compress the gtalk stream.
3270 */
3271 public static final String GTALK_COMPRESS = "gtalk_compress";
3272
3273 /**
Wei Huang58eef7e2009-05-22 13:30:03 -07003274 * This is the timeout for which Google Talk will send the message using bareJID. In a
3275 * established chat between two XMPP endpoints, Google Talk uses fullJID in the format
3276 * of user@domain/resource in order to send the message to the specific client. However,
3277 * if Google Talk hasn't received a message from that client after some time, it would
3278 * fall back to use the bareJID, which would broadcast the message to all clients for
3279 * the other user.
3280 */
3281 public static final String GTALK_USE_BARE_JID_TIMEOUT_MS = "gtalk_use_barejid_timeout_ms";
3282
3283 /**
Ye Wen44c6e3e2009-06-19 12:48:16 -07003284 * This is the threshold of retry number when there is an authentication expired failure
3285 * for Google Talk. In some situation, e.g. when a Google Apps account is disabled chat
3286 * service, the connection keeps failing. This threshold controls when we should stop
3287 * the retrying.
3288 */
3289 public static final String GTALK_MAX_RETRIES_FOR_AUTH_EXPIRED =
Wei Huang1e4807a2009-07-29 18:50:00 -07003290 "gtalk_max_retries_for_auth_expired";
3291
3292 /**
3293 * a boolean setting indicating whether the GTalkService should use RMQ2 protocol or not.
3294 */
3295 public static final String GTALK_USE_RMQ2_PROTOCOL =
3296 "gtalk_use_rmq2";
3297
3298 /**
3299 * a boolean setting indicating whether the GTalkService should support both RMQ and
3300 * RMQ2 protocols. This setting is true for the transitional period when we need to
3301 * support both protocols.
3302 */
3303 public static final String GTALK_SUPPORT_RMQ_AND_RMQ2_PROTOCOLS =
3304 "gtalk_support_rmq_and_rmq2";
3305
3306 /**
3307 * a boolean setting controlling whether the rmq2 protocol will include stream ids in
3308 * the protobufs. This is used for debugging.
3309 */
3310 public static final String GTALK_RMQ2_INCLUDE_STREAM_ID =
3311 "gtalk_rmq2_include_stream_id";
3312
3313 /**
Wei Huang1abf4982009-08-21 07:56:36 -07003314 * when receiving a chat message from the server, the message could be an older message
3315 * whose "time sent" is x seconds from now. If x is significant enough, we want to flag
3316 * it so the UI can give it some special treatment when displaying the "time sent" for
3317 * it. This setting is to control what x is.
3318 */
Wei Huangcc6bd5a2009-08-24 14:29:44 -07003319 public static final String GTALK_OLD_CHAT_MESSAGE_THRESHOLD_IN_SEC =
3320 "gtalk_old_chat_msg_threshold_in_sec";
Wei Huang1abf4982009-08-21 07:56:36 -07003321
3322 /**
3323 * a setting to control the max connection history record GTalkService stores.
3324 */
3325 public static final String GTALK_MAX_CONNECTION_HISTORY_RECORDS =
3326 "gtalk_max_conn_history_records";
3327
3328 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003329 * This is gdata url to lookup album and picture info from picasa web. It also controls
3330 * whether url scraping for picasa is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003331 */
3332 public static final String GTALK_PICASA_ALBUM_URL =
3333 "gtalk_picasa_album_url";
3334
3335 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003336 * This is the url to lookup picture info from flickr. It also controls
3337 * whether url scraping for flickr is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003338 */
3339 public static final String GTALK_FLICKR_PHOTO_INFO_URL =
3340 "gtalk_flickr_photo_info_url";
3341
3342 /**
3343 * This is the url to lookup an actual picture from flickr.
3344 */
3345 public static final String GTALK_FLICKR_PHOTO_URL =
3346 "gtalk_flickr_photo_url";
3347
3348 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003349 * This is the gdata url to lookup info on a youtube video. It also controls
3350 * whether url scraping for youtube is enabled (NULL to disable).
Wei Huang1e4807a2009-07-29 18:50:00 -07003351 */
3352 public static final String GTALK_YOUTUBE_VIDEO_URL =
3353 "gtalk_youtube_video_url";
Ye Wen44c6e3e2009-06-19 12:48:16 -07003354
3355 /**
Ye Wen0b98c942009-09-04 23:43:47 -07003356 * Enable/disable GTalk URL scraping for JPG images ("true" to enable).
3357 */
3358 public static final String GTALK_URL_SCRAPING_FOR_JPG =
3359 "gtalk_url_scraping_for_jpg";
3360
3361 /**
Ye Wen48f886e2009-08-26 12:21:08 -07003362 * Chat message lifetime (for pruning old chat messages).
3363 */
3364 public static final String GTALK_CHAT_MESSAGE_LIFETIME =
3365 "gtalk_chat_message_lifetime";
3366
3367 /**
3368 * OTR message lifetime (for pruning old otr messages).
3369 */
3370 public static final String GTALK_OTR_MESSAGE_LIFETIME =
3371 "gtalk_otr_message_lifetime";
3372
3373 /**
3374 * Chat expiration time, i.e., time since last message in the chat (for pruning old chats).
3375 */
3376 public static final String GTALK_CHAT_EXPIRATION_TIME =
3377 "gtalk_chat_expiration_time";
3378
3379 /**
Wei Huang1c5e4032009-07-09 10:39:12 -07003380 * This is the url for getting the app token for server-to-device push messaging.
Wei Huang8ad22462009-06-24 18:32:45 -07003381 */
Wei Huang1c5e4032009-07-09 10:39:12 -07003382 public static final String PUSH_MESSAGING_REGISTRATION_URL =
3383 "push_messaging_registration_url";
Tom Taylor2debd562009-07-14 11:27:20 -07003384
Ye Wen48f886e2009-08-26 12:21:08 -07003385 /**
3386 * Use android://&lt;it&gt; routing infos for Google Sync Server subcriptions.
3387 */
3388 public static final String GSYNC_USE_RMQ2_ROUTING_INFO = "gsync_use_rmq2_routing_info";
Debajit Ghoshc030a482009-08-10 21:59:25 -07003389
Wei Huang8ad22462009-06-24 18:32:45 -07003390 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003391 * The hash value of the current provisioning settings
3392 */
3393 public static final String PROVISIONING_DIGEST = "digest";
3394
3395 /**
3396 * Provisioning keys to block from server update
3397 */
3398 public static final String PROVISIONING_OVERRIDE = "override";
3399
3400 /**
3401 * "Generic" service name for authentication requests.
3402 */
3403 public static final String GOOGLE_LOGIN_GENERIC_AUTH_SERVICE
3404 = "google_login_generic_auth_service";
3405
3406 /**
Christian Sonntag647ae752009-10-14 15:26:08 -07003407 * Duration in milliseconds after setup at which market does not reconcile applications
3408 * which are installed during restore.
3409 */
3410 public static final String VENDING_RESTORE_WINDOW_MS = "vending_restore_window_ms";
3411
3412
3413 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003414 * Frequency in milliseconds at which we should sync the locally installed Vending Machine
3415 * content with the server.
3416 */
3417 public static final String VENDING_SYNC_FREQUENCY_MS = "vending_sync_frequency_ms";
3418
3419 /**
3420 * Support URL that is opened in a browser when user clicks on 'Help and Info' in Vending
3421 * Machine.
3422 */
3423 public static final String VENDING_SUPPORT_URL = "vending_support_url";
3424
3425 /**
3426 * Indicates if Vending Machine requires a SIM to be in the phone to allow a purchase.
3427 *
3428 * true = SIM is required
3429 * false = SIM is not required
3430 */
3431 public static final String VENDING_REQUIRE_SIM_FOR_PURCHASE =
3432 "vending_require_sim_for_purchase";
3433
3434 /**
Christian Sonntag058779c2009-08-07 10:50:06 -07003435 * Indicates the Vending Machine backup state. It is set if the
3436 * Vending application has been backed up at least once.
3437 */
3438 public static final String VENDING_BACKUP_STATE = "vending_backup_state";
3439
3440 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003441 * The current version id of the Vending Machine terms of service.
3442 */
3443 public static final String VENDING_TOS_VERSION = "vending_tos_version";
3444
3445 /**
3446 * URL that points to the terms of service for Vending Machine.
3447 */
3448 public static final String VENDING_TOS_URL = "vending_tos_url";
3449
3450 /**
lknguyenf965d162009-07-22 18:12:56 -07003451 * URL to navigate to in browser (not Market) when the terms of service
3452 * for Vending Machine could not be accessed due to bad network
3453 * connection.
3454 */
3455 public static final String VENDING_TOS_MISSING_URL = "vending_tos_missing_url";
3456
3457 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003458 * Whether to use sierraqa instead of sierra tokens for the purchase flow in
3459 * Vending Machine.
3460 *
3461 * true = use sierraqa
3462 * false = use sierra (default)
3463 */
3464 public static final String VENDING_USE_CHECKOUT_QA_SERVICE =
3465 "vending_use_checkout_qa_service";
3466
3467 /**
Mark Womack78ef4562009-03-25 16:10:13 -07003468 * Default value to use for all/free/priced filter in Market.
3469 * Valid values: ALL, FREE, PAID (case insensitive)
3470 */
3471 public static final String VENDING_DEFAULT_FILTER = "vending_default_filter";
3472 /**
3473 * Ranking type value to use for the first category tab (currently popular)
3474 */
3475 public static final String VENDING_TAB_1_RANKING_TYPE = "vending_tab_1_ranking_type";
3476
3477 /**
3478 * Title string to use for first category tab.
3479 */
3480 public static final String VENDING_TAB_1_TITLE = "vending_tab_1_title";
3481
3482 /**
3483 * Ranking type value to use for the second category tab (currently newest)
3484 */
3485 public static final String VENDING_TAB_2_RANKING_TYPE = "vending_tab_2_ranking_type";
3486
3487 /**
3488 * Title string to use for second category tab.
3489 */
3490 public static final String VENDING_TAB_2_TITLE = "vending_tab_2_title";
3491
3492 /**
Linda Nguyenabd7eba2009-06-18 18:52:59 -07003493 * Frequency in milliseconds at which we should request MCS heartbeats
3494 * from the Vending Machine client.
3495 */
3496 public static final String VENDING_HEARTBEAT_FREQUENCY_MS =
3497 "vending_heartbeat_frequency_ms";
3498
3499 /**
lknguyenb0cba432009-06-29 20:50:25 -07003500 * Frequency in milliseconds at which we should resend pending download
3501 * requests to the API Server from the Vending Machine client.
3502 */
3503 public static final String VENDING_PENDING_DOWNLOAD_RESEND_FREQUENCY_MS =
lknguyen09b33732009-06-30 13:52:45 -07003504 "vending_pd_resend_frequency_ms";
lknguyenb0cba432009-06-29 20:50:25 -07003505
3506 /**
lknguyenf602c512009-09-28 20:22:45 -07003507 * Time before an asset in the 'DOWNLOADING' state is considered ready
3508 * for an install kick on the client.
3509 */
3510 public static final String VENDING_DOWNLOADING_KICK_TIMEOUT_MS =
3511 "vending_downloading_kick_ms";
3512
3513 /**
Jasperlnb95277e2009-08-17 13:29:11 -07003514 * Size of buffer in bytes for Vending to use when reading cache files.
3515 */
3516 public static final String VENDING_DISK_INPUT_BUFFER_BYTES =
3517 "vending_disk_input_buffer_bytes";
3518
3519 /**
3520 * Size of buffer in bytes for Vending to use when writing cache files.
3521 */
3522 public static final String VENDING_DISK_OUTPUT_BUFFER_BYTES =
3523 "vending_disk_output_buffer_bytes";
3524
3525 /**
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07003526 * Frequency in milliseconds at which we should cycle through the promoted applications
3527 * on the home screen or the categories page.
3528 */
3529 public static final String VENDING_PROMO_REFRESH_FREQUENCY_MS =
3530 "vending_promo_refresh_freq_ms";
3531
3532 /**
Sanjay Jeyakumarebd84162009-08-26 16:01:08 -07003533 * Frequency in milliseconds when we should refresh the provisioning information from
3534 * the carrier backend.
3535 */
3536 public static final String VENDING_CARRIER_PROVISIONING_REFRESH_FREQUENCY_MS =
3537 "vending_carrier_ref_freq_ms";
3538
3539 /**
Sanjay Jeyakumar8cbaa832009-09-17 13:50:30 -07003540 * Interval in milliseconds after which a failed provisioning request should be retried.
3541 */
3542 public static final String VENDING_CARRIER_PROVISIONING_RETRY_MS =
3543 "vending_carrier_prov_retry_ms";
3544
3545 /**
3546 * Buffer in milliseconds for carrier credentials to be considered valid.
3547 */
3548 public static final String VENDING_CARRIER_CREDENTIALS_BUFFER_MS =
3549 "vending_carrier_cred_buf_ms";
3550
3551 /**
lknguyen194f0802009-11-18 16:12:51 -08003552 * Whether to turn on performance logging in the Market client.
3553 */
3554 public static final String VENDING_LOG_PERFORMANCE =
3555 "vending_log_perf";
3556
3557 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003558 * URL that points to the legal terms of service to display in Settings.
3559 * <p>
3560 * This should be a https URL. For a pretty user-friendly URL, use
3561 * {@link #SETTINGS_TOS_PRETTY_URL}.
3562 */
3563 public static final String SETTINGS_TOS_URL = "settings_tos_url";
3564
3565 /**
3566 * URL that points to the legal terms of service to display in Settings.
3567 * <p>
3568 * This should be a pretty http URL. For the URL the device will access
3569 * via Settings, use {@link #SETTINGS_TOS_URL}.
3570 */
3571 public static final String SETTINGS_TOS_PRETTY_URL = "settings_tos_pretty_url";
3572
3573 /**
3574 * URL that points to the contributors to display in Settings.
3575 * <p>
3576 * This should be a https URL. For a pretty user-friendly URL, use
3577 * {@link #SETTINGS_CONTRIBUTORS_PRETTY_URL}.
3578 */
3579 public static final String SETTINGS_CONTRIBUTORS_URL = "settings_contributors_url";
3580
3581 /**
3582 * URL that points to the contributors to display in Settings.
3583 * <p>
3584 * This should be a pretty http URL. For the URL the device will access
3585 * via Settings, use {@link #SETTINGS_CONTRIBUTORS_URL}.
3586 */
3587 public static final String SETTINGS_CONTRIBUTORS_PRETTY_URL =
3588 "settings_contributors_pretty_url";
3589
3590 /**
3591 * URL that points to the Terms Of Service for the device.
3592 * <p>
3593 * This should be a pretty http URL.
3594 */
3595 public static final String SETUP_GOOGLE_TOS_URL = "setup_google_tos_url";
3596
3597 /**
3598 * URL that points to the Android privacy policy for the device.
3599 * <p>
3600 * This should be a pretty http URL.
3601 */
3602 public static final String SETUP_ANDROID_PRIVACY_URL = "setup_android_privacy_url";
3603
3604 /**
3605 * URL that points to the Google privacy policy for the device.
3606 * <p>
3607 * This should be a pretty http URL.
3608 */
3609 public static final String SETUP_GOOGLE_PRIVACY_URL = "setup_google_privacy_url";
3610
3611 /**
3612 * Request an MSISDN token for various Google services.
3613 */
3614 public static final String USE_MSISDN_TOKEN = "use_msisdn_token";
3615
3616 /**
3617 * RSA public key used to encrypt passwords stored in the database.
3618 */
3619 public static final String GLS_PUBLIC_KEY = "google_login_public_key";
3620
3621 /**
3622 * Only check parental control status if this is set to "true".
3623 */
3624 public static final String PARENTAL_CONTROL_CHECK_ENABLED =
3625 "parental_control_check_enabled";
3626
3627 /**
3628 * The list of applications we need to block if parental control is
3629 * enabled.
3630 */
3631 public static final String PARENTAL_CONTROL_APPS_LIST =
3632 "parental_control_apps_list";
3633
3634 /**
3635 * Duration in which parental control status is valid.
3636 */
3637 public static final String PARENTAL_CONTROL_TIMEOUT_IN_MS =
3638 "parental_control_timeout_in_ms";
3639
3640 /**
3641 * When parental control is off, we expect to get this string from the
3642 * litmus url.
3643 */
3644 public static final String PARENTAL_CONTROL_EXPECTED_RESPONSE =
3645 "parental_control_expected_response";
3646
3647 /**
3648 * When the litmus url returns a 302, declare parental control to be on
3649 * only if the redirect url matches this regular expression.
3650 */
3651 public static final String PARENTAL_CONTROL_REDIRECT_REGEX =
3652 "parental_control_redirect_regex";
3653
3654 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003655 * Prefix for new Google services published by the checkin
3656 * server.
3657 */
3658 public static final String GOOGLE_SERVICES_PREFIX
3659 = "google_services:";
3660
3661 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003662 * List of test suites (local disk filename) for the automatic instrumentation test runner.
3663 * The file format is similar to automated_suites.xml, see AutoTesterService.
3664 * If this setting is missing or empty, the automatic test runner will not start.
3665 */
3666 public static final String AUTOTEST_SUITES_FILE = "autotest_suites_file";
3667
3668 /**
3669 * Interval between synchronous checkins forced by the automatic test runner.
3670 * If you set this to a value smaller than CHECKIN_INTERVAL, then the test runner's
3671 * frequent checkins will prevent asynchronous background checkins from interfering
3672 * with any performance measurements.
3673 */
3674 public static final String AUTOTEST_CHECKIN_SECONDS = "autotest_checkin_seconds";
3675
3676 /**
3677 * Interval between reboots forced by the automatic test runner.
3678 */
3679 public static final String AUTOTEST_REBOOT_SECONDS = "autotest_reboot_seconds";
3680
3681
3682 /**
The Android Open Source Project4df24232009-03-05 14:34:35 -08003683 * An email address that anr bugreports should be sent to.
3684 */
3685 public static final String ANR_BUGREPORT_RECIPIENT = "anr_bugreport_recipient";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003686
3687 /**
Amith Yamasani430555ac2009-06-11 22:35:39 -07003688 * Flag for allowing service provider to use location information to improve products and
3689 * services.
3690 * Type: int ( 0 = disallow, 1 = allow )
Amith Yamasani630cd062009-06-19 12:07:02 -07003691 * @deprecated
Amith Yamasani430555ac2009-06-11 22:35:39 -07003692 */
3693 public static final String USE_LOCATION_FOR_SERVICES = "use_location";
3694
3695 /**
Bjorn Bringert96f86132009-09-04 12:01:53 +01003696 * The number of promoted sources in GlobalSearch.
3697 */
3698 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3699 /**
3700 * The maximum number of suggestions returned by GlobalSearch.
3701 */
3702 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3703 /**
3704 * The number of suggestions GlobalSearch will ask each non-web search source for.
3705 */
3706 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3707 /**
3708 * The number of suggestions the GlobalSearch will ask the web search source for.
3709 */
3710 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3711 "search_web_results_override_limit";
3712 /**
3713 * The number of milliseconds that GlobalSearch will wait for suggestions from
3714 * promoted sources before continuing with all other sources.
3715 */
3716 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3717 "search_promoted_source_deadline_millis";
3718 /**
3719 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3720 */
3721 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3722 /**
3723 * The maximum number of milliseconds that GlobalSearch shows the previous results
3724 * after receiving a new query.
3725 */
3726 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3727 /**
3728 * The maximum age of log data used for shortcuts in GlobalSearch.
3729 */
3730 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3731 /**
3732 * The maximum age of log data used for source ranking in GlobalSearch.
3733 */
3734 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3735 "search_max_source_event_age_millis";
3736 /**
3737 * The minimum number of impressions needed to rank a source in GlobalSearch.
3738 */
3739 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3740 "search_min_impressions_for_source_ranking";
3741 /**
3742 * The minimum number of clicks needed to rank a source in GlobalSearch.
3743 */
3744 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3745 "search_min_clicks_for_source_ranking";
3746 /**
3747 * The maximum number of shortcuts shown by GlobalSearch.
3748 */
3749 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3750 /**
3751 * The size of the core thread pool for suggestion queries in GlobalSearch.
3752 */
3753 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3754 "search_query_thread_core_pool_size";
3755 /**
3756 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3757 */
3758 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3759 "search_query_thread_max_pool_size";
3760 /**
3761 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3762 */
3763 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3764 "search_shortcut_refresh_core_pool_size";
3765 /**
3766 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3767 */
3768 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3769 "search_shortcut_refresh_max_pool_size";
3770 /**
3771 * The maximun time that excess threads in the GlobalSeach thread pools will
3772 * wait before terminating.
3773 */
3774 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3775 "search_thread_keepalive_seconds";
3776 /**
3777 * The maximum number of concurrent suggestion queries to each source.
3778 */
3779 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3780 "search_per_source_concurrent_query_limit";
Jacek Surazskia2339432009-09-18 15:01:26 +02003781
3782 /**
Dan Egnoree649a82009-10-08 19:51:51 -07003783 * Maximum size of /proc/last_kmsg content to upload after reboot.
3784 */
3785 public static final String LAST_KMSG_KB = "last_kmsg_kb";
3786
3787 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003788 * @deprecated
3789 * @hide
3790 */
3791 @Deprecated // Obviated by NameValueCache: just fetch the value directly.
3792 public static class QueryMap extends ContentQueryMap {
3793
3794 public QueryMap(ContentResolver contentResolver, Cursor cursor, boolean keepUpdated,
3795 Handler handlerForUpdateNotifications) {
3796 super(cursor, NAME, keepUpdated, handlerForUpdateNotifications);
3797 }
3798
3799 public QueryMap(ContentResolver contentResolver, boolean keepUpdated,
3800 Handler handlerForUpdateNotifications) {
3801 this(contentResolver,
3802 contentResolver.query(CONTENT_URI, null, null, null, null),
3803 keepUpdated, handlerForUpdateNotifications);
3804 }
3805
3806 public String getString(String name) {
3807 ContentValues cv = getValues(name);
3808 if (cv == null) return null;
3809 return cv.getAsString(VALUE);
3810 }
3811 }
3812
3813 }
3814
3815 /**
3816 * User-defined bookmarks and shortcuts. The target of each bookmark is an
3817 * Intent URL, allowing it to be either a web page or a particular
3818 * application activity.
3819 *
3820 * @hide
3821 */
3822 public static final class Bookmarks implements BaseColumns
3823 {
3824 private static final String TAG = "Bookmarks";
3825
3826 /**
3827 * The content:// style URL for this table
3828 */
3829 public static final Uri CONTENT_URI =
3830 Uri.parse("content://" + AUTHORITY + "/bookmarks");
3831
3832 /**
3833 * The row ID.
3834 * <p>Type: INTEGER</p>
3835 */
3836 public static final String ID = "_id";
3837
3838 /**
3839 * Descriptive name of the bookmark that can be displayed to the user.
3840 * If this is empty, the title should be resolved at display time (use
3841 * {@link #getTitle(Context, Cursor)} any time you want to display the
3842 * title of a bookmark.)
3843 * <P>
3844 * Type: TEXT
3845 * </P>
3846 */
3847 public static final String TITLE = "title";
3848
3849 /**
3850 * Arbitrary string (displayed to the user) that allows bookmarks to be
3851 * organized into categories. There are some special names for
3852 * standard folders, which all start with '@'. The label displayed for
3853 * the folder changes with the locale (via {@link #getLabelForFolder}) but
3854 * the folder name does not change so you can consistently query for
3855 * the folder regardless of the current locale.
3856 *
3857 * <P>Type: TEXT</P>
3858 *
3859 */
3860 public static final String FOLDER = "folder";
3861
3862 /**
3863 * The Intent URL of the bookmark, describing what it points to. This
3864 * value is given to {@link android.content.Intent#getIntent} to create
3865 * an Intent that can be launched.
3866 * <P>Type: TEXT</P>
3867 */
3868 public static final String INTENT = "intent";
3869
3870 /**
3871 * Optional shortcut character associated with this bookmark.
3872 * <P>Type: INTEGER</P>
3873 */
3874 public static final String SHORTCUT = "shortcut";
3875
3876 /**
3877 * The order in which the bookmark should be displayed
3878 * <P>Type: INTEGER</P>
3879 */
3880 public static final String ORDERING = "ordering";
3881
3882 private static final String[] sIntentProjection = { INTENT };
3883 private static final String[] sShortcutProjection = { ID, SHORTCUT };
3884 private static final String sShortcutSelection = SHORTCUT + "=?";
3885
3886 /**
3887 * Convenience function to retrieve the bookmarked Intent for a
3888 * particular shortcut key.
3889 *
3890 * @param cr The ContentResolver to query.
3891 * @param shortcut The shortcut key.
3892 *
3893 * @return Intent The bookmarked URL, or null if there is no bookmark
3894 * matching the given shortcut.
3895 */
3896 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3897 {
3898 Intent intent = null;
3899
3900 Cursor c = cr.query(CONTENT_URI,
3901 sIntentProjection, sShortcutSelection,
3902 new String[] { String.valueOf((int) shortcut) }, ORDERING);
3903 // Keep trying until we find a valid shortcut
3904 try {
3905 while (intent == null && c.moveToNext()) {
3906 try {
3907 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3908 intent = Intent.getIntent(intentURI);
3909 } catch (java.net.URISyntaxException e) {
3910 // The stored URL is bad... ignore it.
3911 } catch (IllegalArgumentException e) {
3912 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07003913 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003914 }
3915 }
3916 } finally {
3917 if (c != null) c.close();
3918 }
3919
3920 return intent;
3921 }
3922
3923 /**
3924 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003925 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003926 * @param cr The ContentResolver to query.
3927 * @param intent The desired target of the bookmark.
3928 * @param title Bookmark title that is shown to the user; null if none
3929 * or it should be resolved to the intent's title.
3930 * @param folder Folder in which to place the bookmark; null if none.
3931 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3932 * this is non-zero and there is an existing bookmark entry
3933 * with this same shortcut, then that existing shortcut is
3934 * cleared (the bookmark is not removed).
3935 * @return The unique content URL for the new bookmark entry.
3936 */
3937 public static Uri add(ContentResolver cr,
3938 Intent intent,
3939 String title,
3940 String folder,
3941 char shortcut,
3942 int ordering)
3943 {
3944 // If a shortcut is supplied, and it is already defined for
3945 // another bookmark, then remove the old definition.
3946 if (shortcut != 0) {
3947 Cursor c = cr.query(CONTENT_URI,
3948 sShortcutProjection, sShortcutSelection,
3949 new String[] { String.valueOf((int) shortcut) }, null);
3950 try {
3951 if (c.moveToFirst()) {
3952 while (c.getCount() > 0) {
3953 if (!c.deleteRow()) {
3954 Log.w(TAG, "Could not delete existing shortcut row");
3955 }
3956 }
3957 }
3958 } finally {
3959 if (c != null) c.close();
3960 }
3961 }
3962
3963 ContentValues values = new ContentValues();
3964 if (title != null) values.put(TITLE, title);
3965 if (folder != null) values.put(FOLDER, folder);
3966 values.put(INTENT, intent.toURI());
3967 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3968 values.put(ORDERING, ordering);
3969 return cr.insert(CONTENT_URI, values);
3970 }
3971
3972 /**
3973 * Return the folder name as it should be displayed to the user. This
3974 * takes care of localizing special folders.
3975 *
3976 * @param r Resources object for current locale; only need access to
3977 * system resources.
3978 * @param folder The value found in the {@link #FOLDER} column.
3979 *
3980 * @return CharSequence The label for this folder that should be shown
3981 * to the user.
3982 */
3983 public static CharSequence getLabelForFolder(Resources r, String folder) {
3984 return folder;
3985 }
3986
3987 /**
3988 * Return the title as it should be displayed to the user. This takes
3989 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003990 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003991 * @param context A context.
3992 * @param cursor A cursor pointing to the row whose title should be
3993 * returned. The cursor must contain at least the {@link #TITLE}
3994 * and {@link #INTENT} columns.
3995 * @return A title that is localized and can be displayed to the user,
3996 * or the empty string if one could not be found.
3997 */
3998 public static CharSequence getTitle(Context context, Cursor cursor) {
3999 int titleColumn = cursor.getColumnIndex(TITLE);
4000 int intentColumn = cursor.getColumnIndex(INTENT);
4001 if (titleColumn == -1 || intentColumn == -1) {
4002 throw new IllegalArgumentException(
4003 "The cursor must contain the TITLE and INTENT columns.");
4004 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004005
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004006 String title = cursor.getString(titleColumn);
4007 if (!TextUtils.isEmpty(title)) {
4008 return title;
4009 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004010
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004011 String intentUri = cursor.getString(intentColumn);
4012 if (TextUtils.isEmpty(intentUri)) {
4013 return "";
4014 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004015
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004016 Intent intent;
4017 try {
4018 intent = Intent.getIntent(intentUri);
4019 } catch (URISyntaxException e) {
4020 return "";
4021 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004022
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004023 PackageManager packageManager = context.getPackageManager();
4024 ResolveInfo info = packageManager.resolveActivity(intent, 0);
4025 return info != null ? info.loadLabel(packageManager) : "";
4026 }
4027 }
4028
4029 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004030 * Returns the device ID that we should use when connecting to the mobile gtalk server.
4031 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
4032 * from the GoogleLoginService.
4033 *
4034 * @param androidId The Android ID for this device.
4035 * @return The device ID that should be used when connecting to the mobile gtalk server.
4036 * @hide
4037 */
4038 public static String getGTalkDeviceId(long androidId) {
4039 return "android-" + Long.toHexString(androidId);
4040 }
4041}