blob: 9bbcc353d4ea6ce53b081176c342dceab08dd63b [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.provider;
18
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080019import android.annotation.SdkConstant;
20import android.annotation.SdkConstant.SdkConstantType;
Bryce Leecdfebd62015-02-02 08:19:11 -080021import android.annotation.SystemApi;
Adrian Roos7811d9f2015-07-27 15:10:13 -070022import android.app.ActivityThread;
Billy Lau6ad2d662015-07-18 00:26:58 +010023import android.app.AppOpsManager;
Adrian Roos7811d9f2015-07-27 15:10:13 -070024import android.app.Application;
Narayan Kamathee69ff42011-06-28 12:07:18 +010025import android.app.SearchManager;
Jeff Sharkey6e2bee72012-10-01 13:39:08 -070026import android.app.WallpaperManager;
Mike LeBeau5d34e9b2010-02-10 19:34:56 -080027import android.content.ComponentName;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028import android.content.ContentResolver;
29import android.content.ContentValues;
30import android.content.Context;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080031import android.content.IContentProvider;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032import android.content.Intent;
Dianne Hackbornb8b11a02010-03-10 15:53:11 -080033import android.content.pm.ActivityInfo;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034import android.content.pm.PackageManager;
35import android.content.pm.ResolveInfo;
36import android.content.res.Configuration;
37import android.content.res.Resources;
38import android.database.Cursor;
39import android.database.SQLException;
David Christie3f7b6522013-08-06 19:19:08 -070040import android.location.LocationManager;
Jeff Sharkey625239a2012-09-26 22:03:49 -070041import android.net.ConnectivityManager;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080042import android.net.Uri;
Irfan Sheriff36f74132010-11-04 16:57:37 -070043import android.net.wifi.WifiManager;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070044import android.os.BatteryManager;
Billy Lau6ad2d662015-07-18 00:26:58 +010045import android.os.Binder;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070046import android.os.Bundle;
Jeff Sharkey625239a2012-09-26 22:03:49 -070047import android.os.DropBoxManager;
Amith Yamasani52c489c2012-03-28 11:42:42 -070048import android.os.IBinder;
Amith Yamasani7ab8c4a2012-04-06 09:27:12 -070049import android.os.Process;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070050import android.os.RemoteException;
Amith Yamasani52c489c2012-03-28 11:42:42 -070051import android.os.ServiceManager;
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -070052import android.os.SystemProperties;
Dianne Hackbornf02b60a2012-08-16 10:48:27 -070053import android.os.UserHandle;
Jeff Sharkey625239a2012-09-26 22:03:49 -070054import android.os.Build.VERSION_CODES;
Narayan Kamath6d632962011-08-24 11:51:37 +010055import android.speech.tts.TextToSpeech;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080056import android.text.TextUtils;
57import android.util.AndroidException;
Svetoslav683914b2015-01-15 14:22:26 -080058import android.util.ArrayMap;
59import android.util.ArraySet;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060import android.util.Log;
61
Svetoslav683914b2015-01-15 14:22:26 -080062import com.android.internal.util.ArrayUtils;
Amith Yamasani52c489c2012-03-28 11:42:42 -070063import com.android.internal.widget.ILockSettings;
64
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065import java.net.URISyntaxException;
Svetoslav683914b2015-01-15 14:22:26 -080066import java.text.SimpleDateFormat;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067import java.util.HashMap;
68import java.util.HashSet;
Elliott Hughescb64d432013-08-02 10:00:44 -070069import java.util.Locale;
Svetoslav683914b2015-01-15 14:22:26 -080070import java.util.Map;
71import java.util.Set;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080073/**
74 * The Settings provider contains global system-level device preferences.
75 */
76public final class Settings {
77
78 // Intent actions for Settings
79
80 /**
81 * Activity Action: Show system settings.
82 * <p>
83 * Input: Nothing.
84 * <p>
Gilles Debunnee90bed12011-08-30 14:28:27 -070085 * Output: Nothing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086 */
87 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
88 public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
89
90 /**
91 * Activity Action: Show settings to allow configuration of APNs.
92 * <p>
93 * Input: Nothing.
94 * <p>
Gilles Debunnee90bed12011-08-30 14:28:27 -070095 * Output: Nothing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096 */
97 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
98 public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
99
100 /**
101 * Activity Action: Show settings to allow configuration of current location
102 * sources.
103 * <p>
104 * In some cases, a matching Activity may not exist, so ensure you
105 * safeguard against this.
106 * <p>
107 * Input: Nothing.
108 * <p>
109 * Output: Nothing.
110 */
111 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
112 public static final String ACTION_LOCATION_SOURCE_SETTINGS =
113 "android.settings.LOCATION_SOURCE_SETTINGS";
114
115 /**
116 * Activity Action: Show settings to allow configuration of wireless controls
117 * such as Wi-Fi, Bluetooth and Mobile networks.
118 * <p>
119 * In some cases, a matching Activity may not exist, so ensure you
120 * safeguard against this.
121 * <p>
122 * Input: Nothing.
123 * <p>
124 * Output: Nothing.
125 */
126 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
127 public static final String ACTION_WIRELESS_SETTINGS =
128 "android.settings.WIRELESS_SETTINGS";
129
130 /**
131 * Activity Action: Show settings to allow entering/exiting airplane mode.
132 * <p>
133 * In some cases, a matching Activity may not exist, so ensure you
134 * safeguard against this.
135 * <p>
136 * Input: Nothing.
137 * <p>
138 * Output: Nothing.
139 */
140 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
141 public static final String ACTION_AIRPLANE_MODE_SETTINGS =
142 "android.settings.AIRPLANE_MODE_SETTINGS";
143
144 /**
Barnaby Jamesb3006d32015-04-02 17:49:54 -0700145 * Activity Action: Modify Airplane mode settings using a voice command.
Barnaby James48f35522014-07-16 14:27:39 -0700146 * <p>
147 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
148 * <p>
149 * This intent MUST be started using
150 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
151 * startVoiceActivity}.
152 * <p>
Barnaby Jamesb3006d32015-04-02 17:49:54 -0700153 * Note: The activity implementing this intent MUST verify that
Barnaby James48f35522014-07-16 14:27:39 -0700154 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
155 * modifying the setting.
156 * <p>
Barnaby Jamesb3006d32015-04-02 17:49:54 -0700157 * Input: To tell which state airplane mode should be set to, add the
158 * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified.
159 * If the extra is not included, no changes will be made.
Barnaby James48f35522014-07-16 14:27:39 -0700160 * <p>
161 * Output: Nothing.
162 */
163 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
164 public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =
165 "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
166
167 /**
Dianne Hackborndd9b82c2009-09-03 00:18:47 -0700168 * Activity Action: Show settings for accessibility modules.
169 * <p>
170 * In some cases, a matching Activity may not exist, so ensure you
171 * safeguard against this.
172 * <p>
173 * Input: Nothing.
174 * <p>
175 * Output: Nothing.
176 */
177 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
178 public static final String ACTION_ACCESSIBILITY_SETTINGS =
179 "android.settings.ACCESSIBILITY_SETTINGS";
180
181 /**
Dianne Hackborna3fb40d2014-08-12 15:06:50 -0700182 * Activity Action: Show settings to control access to usage information.
183 * <p>
184 * In some cases, a matching Activity may not exist, so ensure you
185 * safeguard against this.
186 * <p>
187 * Input: Nothing.
188 * <p>
189 * Output: Nothing.
190 */
191 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
192 public static final String ACTION_USAGE_ACCESS_SETTINGS =
193 "android.settings.USAGE_ACCESS_SETTINGS";
194
195 /**
Jason Monk6f909782015-04-17 14:30:25 -0400196 * Activity Category: Show application settings related to usage access.
197 * <p>
198 * An activity that provides a user interface for adjusting usage access related
199 * preferences for its containing application. Optional but recommended for apps that
200 * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}.
201 * <p>
202 * The activity may define meta-data to describe what usage access is
203 * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which
204 * will be displayed in Settings.
205 * <p>
206 * Input: Nothing.
207 * <p>
208 * Output: Nothing.
209 */
210 @SdkConstant(SdkConstantType.INTENT_CATEGORY)
211 public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG =
212 "android.intent.category.USAGE_ACCESS_CONFIG";
213
214 /**
215 * Metadata key: Reason for needing usage access.
216 * <p>
217 * A key for metadata attached to an activity that receives action
218 * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the
219 * user as description of how the app uses usage access.
220 * <p>
221 */
222 public static final String METADATA_USAGE_ACCESS_REASON =
223 "android.settings.metadata.USAGE_ACCESS_REASON";
224
225 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800226 * Activity Action: Show settings to allow configuration of security and
227 * location privacy.
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_SECURITY_SETTINGS =
238 "android.settings.SECURITY_SETTINGS";
239
240 /**
Maggie Benthall0469f412013-09-05 15:30:26 -0400241 * Activity Action: Show trusted credentials settings, opening to the user tab,
242 * to allow management of installed credentials.
243 * <p>
244 * In some cases, a matching Activity may not exist, so ensure you
245 * safeguard against this.
246 * <p>
247 * Input: Nothing.
248 * <p>
249 * Output: Nothing.
250 * @hide
251 */
252 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
253 public static final String ACTION_TRUSTED_CREDENTIALS_USER =
254 "com.android.settings.TRUSTED_CREDENTIALS_USER";
255
256 /**
257 * Activity Action: Show dialog explaining that an installed CA cert may enable
258 * monitoring of encrypted network traffic.
259 * <p>
260 * In some cases, a matching Activity may not exist, so ensure you
261 * safeguard against this.
262 * <p>
263 * Input: Nothing.
264 * <p>
265 * Output: Nothing.
266 * @hide
267 */
268 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
269 public static final String ACTION_MONITORING_CERT_INFO =
270 "com.android.settings.MONITORING_CERT_INFO";
271
272 /**
Amith Yamasanic15255a2009-09-23 15:33:19 -0700273 * Activity Action: Show settings to allow configuration of privacy options.
274 * <p>
275 * In some cases, a matching Activity may not exist, so ensure you
276 * safeguard against this.
277 * <p>
278 * Input: Nothing.
279 * <p>
280 * Output: Nothing.
281 */
282 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
283 public static final String ACTION_PRIVACY_SETTINGS =
284 "android.settings.PRIVACY_SETTINGS";
285
286 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 * Activity Action: Show settings to allow configuration of Wi-Fi.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800288 * <p>
289 * In some cases, a matching Activity may not exist, so ensure you
290 * safeguard against this.
291 * <p>
292 * Input: Nothing.
293 * <p>
294 * Output: Nothing.
295
296 */
297 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
298 public static final String ACTION_WIFI_SETTINGS =
299 "android.settings.WIFI_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700300
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800301 /**
302 * Activity Action: Show settings to allow configuration of a static IP
303 * address for Wi-Fi.
304 * <p>
305 * In some cases, a matching Activity may not exist, so ensure you safeguard
306 * against this.
307 * <p>
308 * Input: Nothing.
309 * <p>
310 * Output: Nothing.
311 */
312 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
313 public static final String ACTION_WIFI_IP_SETTINGS =
314 "android.settings.WIFI_IP_SETTINGS";
315
316 /**
317 * Activity Action: Show settings to allow configuration of Bluetooth.
318 * <p>
319 * In some cases, a matching Activity may not exist, so ensure you
320 * safeguard against this.
321 * <p>
322 * Input: Nothing.
323 * <p>
324 * Output: Nothing.
325 */
326 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
327 public static final String ACTION_BLUETOOTH_SETTINGS =
328 "android.settings.BLUETOOTH_SETTINGS";
329
330 /**
Jeff Brownc05c1ae2015-05-05 13:46:30 -0700331 * Activity Action: Show settings to allow configuration of cast endpoints.
Jeff Brown1a937b02014-07-01 22:13:04 -0700332 * <p>
333 * In some cases, a matching Activity may not exist, so ensure you
334 * safeguard against this.
335 * <p>
336 * Input: Nothing.
337 * <p>
338 * Output: Nothing.
339 */
340 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
341 public static final String ACTION_CAST_SETTINGS =
342 "android.settings.CAST_SETTINGS";
343
344 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800345 * Activity Action: Show settings to allow configuration of date and time.
346 * <p>
347 * In some cases, a matching Activity may not exist, so ensure you
348 * safeguard against this.
349 * <p>
350 * Input: Nothing.
351 * <p>
352 * Output: Nothing.
353 */
354 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
355 public static final String ACTION_DATE_SETTINGS =
356 "android.settings.DATE_SETTINGS";
357
358 /**
359 * Activity Action: Show settings to allow configuration of sound and volume.
360 * <p>
361 * In some cases, a matching Activity may not exist, so ensure you
362 * safeguard against this.
363 * <p>
364 * Input: Nothing.
365 * <p>
366 * Output: Nothing.
367 */
368 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
369 public static final String ACTION_SOUND_SETTINGS =
370 "android.settings.SOUND_SETTINGS";
371
372 /**
373 * Activity Action: Show settings to allow configuration of display.
374 * <p>
375 * In some cases, a matching Activity may not exist, so ensure you
376 * safeguard against this.
377 * <p>
378 * Input: Nothing.
379 * <p>
380 * Output: Nothing.
381 */
382 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
383 public static final String ACTION_DISPLAY_SETTINGS =
384 "android.settings.DISPLAY_SETTINGS";
385
386 /**
387 * Activity Action: Show settings to allow configuration of locale.
388 * <p>
389 * In some cases, a matching Activity may not exist, so ensure you
390 * safeguard against this.
391 * <p>
392 * Input: Nothing.
393 * <p>
394 * Output: Nothing.
395 */
396 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
397 public static final String ACTION_LOCALE_SETTINGS =
398 "android.settings.LOCALE_SETTINGS";
399
400 /**
401 * Activity Action: Show settings to configure input methods, in particular
402 * allowing the user to enable input methods.
403 * <p>
404 * In some cases, a matching Activity may not exist, so ensure you
405 * safeguard against this.
406 * <p>
407 * Input: Nothing.
408 * <p>
409 * Output: Nothing.
410 */
411 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
Dianne Hackborna3fb40d2014-08-12 15:06:50 -0700412 public static final String ACTION_VOICE_INPUT_SETTINGS =
413 "android.settings.VOICE_INPUT_SETTINGS";
414
415 /**
416 * Activity Action: Show settings to configure input methods, in particular
417 * allowing the user to enable input methods.
418 * <p>
419 * In some cases, a matching Activity may not exist, so ensure you
420 * safeguard against this.
421 * <p>
422 * Input: Nothing.
423 * <p>
424 * Output: Nothing.
425 */
426 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800427 public static final String ACTION_INPUT_METHOD_SETTINGS =
428 "android.settings.INPUT_METHOD_SETTINGS";
429
430 /**
Tadashi G. Takaokaf49688f2011-01-20 17:56:13 +0900431 * Activity Action: Show settings to enable/disable input method subtypes.
satok86417ea2010-10-27 14:11:03 +0900432 * <p>
433 * In some cases, a matching Activity may not exist, so ensure you
434 * safeguard against this.
435 * <p>
Tadashi G. Takaoka25480202011-01-20 23:13:02 +0900436 * To tell which input method's subtypes are displayed in the settings, add
437 * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
438 * If there is no extra in this Intent, subtypes from all installed input methods
439 * will be displayed in the settings.
440 *
441 * @see android.view.inputmethod.InputMethodInfo#getId
442 * <p>
satok86417ea2010-10-27 14:11:03 +0900443 * Input: Nothing.
444 * <p>
445 * Output: Nothing.
446 */
447 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
Tadashi G. Takaokaf49688f2011-01-20 17:56:13 +0900448 public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
449 "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
satok86417ea2010-10-27 14:11:03 +0900450
451 /**
satok7cfc0ed2011-06-20 21:29:36 +0900452 * Activity Action: Show a dialog to select input method.
453 * <p>
454 * In some cases, a matching Activity may not exist, so ensure you
455 * safeguard against this.
456 * <p>
457 * Input: Nothing.
458 * <p>
459 * Output: Nothing.
460 * @hide
461 */
462 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
463 public static final String ACTION_SHOW_INPUT_METHOD_PICKER =
464 "android.settings.SHOW_INPUT_METHOD_PICKER";
465
466 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800467 * Activity Action: Show settings to manage the user input dictionary.
468 * <p>
Chet Haasee8222dd2013-09-05 07:44:18 -0700469 * Starting with {@link android.os.Build.VERSION_CODES#KITKAT},
Satoshi Kataoka2aa2bc52013-07-30 14:25:11 +0900470 * it is guaranteed there will always be an appropriate implementation for this Intent action.
471 * In prior releases of the platform this was optional, so ensure you safeguard against it.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800472 * <p>
473 * Input: Nothing.
474 * <p>
475 * Output: Nothing.
476 */
477 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
478 public static final String ACTION_USER_DICTIONARY_SETTINGS =
479 "android.settings.USER_DICTIONARY_SETTINGS";
480
481 /**
Gilles Debunnee90bed12011-08-30 14:28:27 -0700482 * Activity Action: Adds a word to the user dictionary.
483 * <p>
484 * In some cases, a matching Activity may not exist, so ensure you
485 * safeguard against this.
486 * <p>
487 * Input: An extra with key <code>word</code> that contains the word
488 * that should be added to the dictionary.
489 * <p>
490 * Output: Nothing.
491 *
492 * @hide
493 */
494 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
495 public static final String ACTION_USER_DICTIONARY_INSERT =
496 "com.android.settings.USER_DICTIONARY_INSERT";
497
498 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800499 * Activity Action: Show settings to allow configuration of application-related settings.
500 * <p>
501 * In some cases, a matching Activity may not exist, so ensure you
502 * safeguard against this.
503 * <p>
504 * Input: Nothing.
505 * <p>
506 * Output: Nothing.
507 */
508 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
509 public static final String ACTION_APPLICATION_SETTINGS =
510 "android.settings.APPLICATION_SETTINGS";
511
512 /**
513 * Activity Action: Show settings to allow configuration of application
Dianne Hackborn8d866e52012-10-10 18:39:45 -0700514 * development-related settings. As of
515 * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
516 * a required part of the platform.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800517 * <p>
518 * Input: Nothing.
519 * <p>
520 * Output: Nothing.
521 */
522 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
523 public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
524 "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
525
526 /**
527 * Activity Action: Show settings to allow configuration of quick launch shortcuts.
528 * <p>
529 * In some cases, a matching Activity may not exist, so ensure you
530 * safeguard against this.
531 * <p>
532 * Input: Nothing.
533 * <p>
534 * Output: Nothing.
535 */
536 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
537 public static final String ACTION_QUICK_LAUNCH_SETTINGS =
538 "android.settings.QUICK_LAUNCH_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700539
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800540 /**
541 * Activity Action: Show settings to manage installed applications.
542 * <p>
543 * In some cases, a matching Activity may not exist, so ensure you
544 * safeguard against this.
545 * <p>
546 * Input: Nothing.
547 * <p>
548 * Output: Nothing.
549 */
550 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
551 public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
552 "android.settings.MANAGE_APPLICATIONS_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700553
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800554 /**
Winson Chung44e8ff92010-09-27 14:36:52 -0700555 * Activity Action: Show settings to manage all applications.
556 * <p>
557 * In some cases, a matching Activity may not exist, so ensure you
558 * safeguard against this.
559 * <p>
560 * Input: Nothing.
561 * <p>
562 * Output: Nothing.
563 */
564 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
565 public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
566 "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
567
568 /**
Billy Lau6ad2d662015-07-18 00:26:58 +0100569 * Activity Action: Show screen for controlling which apps can draw on top of other apps.
Billy Laucbe540f2015-06-25 01:51:44 +0100570 * <p>
571 * In some cases, a matching Activity may not exist, so ensure you
572 * safeguard against this.
573 * <p>
Billy Lau6ad2d662015-07-18 00:26:58 +0100574 * Input: Optionally, the Intent's data URI can specify the application package name to
575 * directly invoke the management GUI specific to the package name. For example
576 * "package:com.my.app".
Billy Laucbe540f2015-06-25 01:51:44 +0100577 * <p>
578 * Output: Nothing.
579 */
580 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
581 public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
Billy Lau22b3f4c2015-07-08 00:31:01 +0100582 "android.settings.action.MANAGE_OVERLAY_PERMISSION";
583
584 /**
Billy Lau6ad2d662015-07-18 00:26:58 +0100585 * Activity Action: Show screen for controlling which apps are allowed to write/modify
586 * system settings.
Billy Lau22b3f4c2015-07-08 00:31:01 +0100587 * <p>
588 * In some cases, a matching Activity may not exist, so ensure you
589 * safeguard against this.
590 * <p>
Billy Lau6ad2d662015-07-18 00:26:58 +0100591 * Input: Optionally, the Intent's data URI can specify the application package name to
592 * directly invoke the management GUI specific to the package name. For example
593 * "package:com.my.app".
Billy Lau22b3f4c2015-07-08 00:31:01 +0100594 * <p>
595 * Output: Nothing.
596 */
597 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
598 public static final String ACTION_MANAGE_WRITE_SETTINGS =
599 "android.settings.action.MANAGE_WRITE_SETTINGS";
Billy Laucbe540f2015-06-25 01:51:44 +0100600
601 /**
Dianne Hackbornb7bb3b32010-06-06 22:47:50 -0700602 * Activity Action: Show screen of details about a particular application.
603 * <p>
604 * In some cases, a matching Activity may not exist, so ensure you
605 * safeguard against this.
606 * <p>
607 * Input: The Intent's data URI specifies the application package name
608 * to be shown, with the "package" scheme. That is "package:com.my.app".
609 * <p>
610 * Output: Nothing.
611 */
612 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
613 public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
614 "android.settings.APPLICATION_DETAILS_SETTINGS";
615
616 /**
Jason Monk287b8892015-06-10 10:39:23 -0400617 * Activity Action: Show screen for controlling which apps can ignore battery optimizations.
618 * <p>
Dianne Hackbornc7b57b12015-08-10 14:52:52 -0700619 * Input: Nothing.
620 * <p>
621 * Output: Nothing.
622 * <p>
623 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
624 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
625 * already ignoring optimizations. You can use
626 * {@link #ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} to ask the user to put you
627 * on this list.
628 */
629 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
630 public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS =
631 "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
632
633 /**
634 * Activity Action: Ask the user to allow an to ignore battery optimizations (that is,
635 * put them on the whitelist of apps shown by
636 * {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}). For an app to use this, it also
637 * must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}
638 * permission.
639 * <p><b>Note:</b> most applications should <em>not</em> use this; there are many facilities
640 * provided by the platform for applications to operate correctly in the various power
641 * saving mode. This is only for unusual applications that need to deeply control their own
642 * execution, at the potential expense of the user's battery life. Note that these applications
643 * greatly run the risk of showing to the user has how power consumers on their device.</p>
644 * <p>
645 * Input: The Intent's data URI must specify the application package name
Jason Monk287b8892015-06-10 10:39:23 -0400646 * to be shown, with the "package" scheme. That is "package:com.my.app".
647 * <p>
648 * Output: Nothing.
Dianne Hackborn1958e5e2015-06-12 18:11:41 -0700649 * <p>
650 * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
651 * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
652 * already ignoring optimizations.
Jason Monk287b8892015-06-10 10:39:23 -0400653 */
654 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
Dianne Hackbornc7b57b12015-08-10 14:52:52 -0700655 public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS =
656 "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
Jason Monk287b8892015-06-10 10:39:23 -0400657
658 /**
Dianne Hackborn35654b62013-01-14 17:38:02 -0800659 * @hide
660 * Activity Action: Show the "app ops" settings screen.
661 * <p>
662 * Input: Nothing.
663 * <p>
664 * Output: Nothing.
665 */
666 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
667 public static final String ACTION_APP_OPS_SETTINGS =
668 "android.settings.APP_OPS_SETTINGS";
669
670 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800671 * Activity Action: Show settings for system update functionality.
672 * <p>
673 * In some cases, a matching Activity may not exist, so ensure you
674 * safeguard against this.
675 * <p>
676 * Input: Nothing.
677 * <p>
678 * Output: Nothing.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700679 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 * @hide
681 */
682 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
683 public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
684 "android.settings.SYSTEM_UPDATE_SETTINGS";
685
686 /**
687 * Activity Action: Show settings to allow configuration of sync settings.
688 * <p>
689 * In some cases, a matching Activity may not exist, so ensure you
690 * safeguard against this.
691 * <p>
Erikeebc8e22010-02-18 13:27:19 -0800692 * The account types available to add via the add account button may be restricted by adding an
693 * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
694 * authorities. Only account types which can sync with that content provider will be offered to
695 * the user.
696 * <p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 * Input: Nothing.
698 * <p>
699 * Output: Nothing.
700 */
701 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
702 public static final String ACTION_SYNC_SETTINGS =
703 "android.settings.SYNC_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700704
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800705 /**
Erikeebc8e22010-02-18 13:27:19 -0800706 * Activity Action: Show add account screen for creating a new account.
707 * <p>
708 * In some cases, a matching Activity may not exist, so ensure you
709 * safeguard against this.
710 * <p>
711 * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
712 * extra to the Intent with one or more syncable content provider's authorities. Only account
713 * types which can sync with that content provider will be offered to the user.
714 * <p>
Alon Albert50359c22013-02-26 14:47:48 -0800715 * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
716 * Intent with one or more account types.
717 * <p>
Erikeebc8e22010-02-18 13:27:19 -0800718 * Input: Nothing.
719 * <p>
720 * Output: Nothing.
721 */
722 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
723 public static final String ACTION_ADD_ACCOUNT =
724 "android.settings.ADD_ACCOUNT_SETTINGS";
725
726 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800727 * Activity Action: Show settings for selecting the network operator.
728 * <p>
729 * In some cases, a matching Activity may not exist, so ensure you
730 * safeguard against this.
731 * <p>
732 * Input: Nothing.
733 * <p>
734 * Output: Nothing.
735 */
736 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
737 public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
738 "android.settings.NETWORK_OPERATOR_SETTINGS";
739
740 /**
741 * Activity Action: Show settings for selection of 2G/3G.
742 * <p>
743 * In some cases, a matching Activity may not exist, so ensure you
744 * safeguard against this.
745 * <p>
746 * Input: Nothing.
747 * <p>
748 * Output: Nothing.
749 */
750 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
751 public static final String ACTION_DATA_ROAMING_SETTINGS =
752 "android.settings.DATA_ROAMING_SETTINGS";
753
754 /**
755 * Activity Action: Show settings for internal storage.
756 * <p>
757 * In some cases, a matching Activity may not exist, so ensure you
758 * safeguard against this.
759 * <p>
760 * Input: Nothing.
761 * <p>
762 * Output: Nothing.
763 */
764 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
765 public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
766 "android.settings.INTERNAL_STORAGE_SETTINGS";
767 /**
768 * Activity Action: Show settings for memory card storage.
769 * <p>
770 * In some cases, a matching Activity may not exist, so ensure you
771 * safeguard against this.
772 * <p>
773 * Input: Nothing.
774 * <p>
775 * Output: Nothing.
776 */
777 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
778 public static final String ACTION_MEMORY_CARD_SETTINGS =
779 "android.settings.MEMORY_CARD_SETTINGS";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -0700780
Justin Mattsonef340352010-01-13 21:05:46 -0800781 /**
782 * Activity Action: Show settings for global search.
783 * <p>
784 * In some cases, a matching Activity may not exist, so ensure you
785 * safeguard against this.
786 * <p>
787 * Input: Nothing.
788 * <p>
789 * Output: Nothing
790 */
791 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
792 public static final String ACTION_SEARCH_SETTINGS =
793 "android.search.action.SEARCH_SETTINGS";
794
Daniel Sandler9d8b8762010-01-22 20:50:15 -0500795 /**
796 * Activity Action: Show general device information settings (serial
797 * number, software version, phone number, etc.).
798 * <p>
799 * In some cases, a matching Activity may not exist, so ensure you
800 * safeguard against this.
801 * <p>
802 * Input: Nothing.
803 * <p>
804 * Output: Nothing
805 */
806 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
807 public static final String ACTION_DEVICE_INFO_SETTINGS =
808 "android.settings.DEVICE_INFO_SETTINGS";
809
Martijn Coenen9b3c83f2011-07-28 11:21:39 -0500810 /**
Nick Pellycccf01d2011-10-31 14:49:40 -0700811 * Activity Action: Show NFC settings.
812 * <p>
813 * This shows UI that allows NFC to be turned on or off.
Martijn Coenen9b3c83f2011-07-28 11:21:39 -0500814 * <p>
815 * In some cases, a matching Activity may not exist, so ensure you
816 * safeguard against this.
817 * <p>
818 * Input: Nothing.
819 * <p>
820 * Output: Nothing
Nick Pellycccf01d2011-10-31 14:49:40 -0700821 * @see android.nfc.NfcAdapter#isEnabled()
822 */
823 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
824 public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
825
826 /**
827 * Activity Action: Show NFC Sharing settings.
828 * <p>
829 * This shows UI that allows NDEF Push (Android Beam) to be turned on or
830 * off.
831 * <p>
832 * In some cases, a matching Activity may not exist, so ensure you
833 * safeguard against this.
834 * <p>
835 * Input: Nothing.
836 * <p>
837 * Output: Nothing
838 * @see android.nfc.NfcAdapter#isNdefPushEnabled()
Martijn Coenen9b3c83f2011-07-28 11:21:39 -0500839 */
840 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
841 public static final String ACTION_NFCSHARING_SETTINGS =
842 "android.settings.NFCSHARING_SETTINGS";
843
Daniel Sandlerc08cd022012-11-27 22:47:37 -0500844 /**
Martijn Coenen62c196a2013-08-09 13:43:34 -0700845 * Activity Action: Show NFC Tap & Pay settings
846 * <p>
847 * This shows UI that allows the user to configure Tap&Pay
848 * settings.
849 * <p>
850 * In some cases, a matching Activity may not exist, so ensure you
851 * safeguard against this.
852 * <p>
853 * Input: Nothing.
854 * <p>
855 * Output: Nothing
856 */
857 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
858 public static final String ACTION_NFC_PAYMENT_SETTINGS =
859 "android.settings.NFC_PAYMENT_SETTINGS";
860
861 /**
Daniel Sandlerc08cd022012-11-27 22:47:37 -0500862 * Activity Action: Show Daydream settings.
863 * <p>
864 * In some cases, a matching Activity may not exist, so ensure you
865 * safeguard against this.
866 * <p>
867 * Input: Nothing.
868 * <p>
869 * Output: Nothing.
870 * @see android.service.dreams.DreamService
Daniel Sandlerc08cd022012-11-27 22:47:37 -0500871 */
872 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
873 public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
874
Daniel Sandler5feceeb2013-03-22 18:29:23 -0700875 /**
876 * Activity Action: Show Notification listener settings.
877 * <p>
878 * In some cases, a matching Activity may not exist, so ensure you
879 * safeguard against this.
880 * <p>
881 * Input: Nothing.
882 * <p>
883 * Output: Nothing.
884 * @see android.service.notification.NotificationListenerService
Daniel Sandler5feceeb2013-03-22 18:29:23 -0700885 */
886 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
887 public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
Chris Wren8326a8a2014-10-22 14:13:32 -0400888 = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
Daniel Sandler5feceeb2013-03-22 18:29:23 -0700889
Alan Viverette69ce69b2013-08-29 12:23:48 -0700890 /**
John Spurlock80774932015-05-07 17:38:50 -0400891 * Activity Action: Show Do Not Disturb access settings.
892 * <p>
John Spurlock7c74f782015-06-04 13:01:42 -0400893 * Users can grant and deny access to Do Not Disturb configuration from here.
894 * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more
895 * details.
John Spurlock80774932015-05-07 17:38:50 -0400896 * <p>
897 * Input: Nothing.
898 * <p>
899 * Output: Nothing.
900 */
901 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
John Spurlock7c74f782015-06-04 13:01:42 -0400902 public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS
903 = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
John Spurlock80774932015-05-07 17:38:50 -0400904
905 /**
John Spurlock7340fc82014-04-24 18:50:12 -0400906 * @hide
907 */
908 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
909 public static final String ACTION_CONDITION_PROVIDER_SETTINGS
910 = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
911
912 /**
Alan Viverette69ce69b2013-08-29 12:23:48 -0700913 * Activity Action: Show settings for video captioning.
914 * <p>
915 * In some cases, a matching Activity may not exist, so ensure you safeguard
916 * against this.
917 * <p>
918 * Input: Nothing.
919 * <p>
920 * Output: Nothing.
921 */
922 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
923 public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
924
Svetoslav773f54d2013-09-03 14:01:43 -0700925 /**
926 * Activity Action: Show the top level print settings.
927 * <p>
928 * In some cases, a matching Activity may not exist, so ensure you
929 * safeguard against this.
930 * <p>
931 * Input: Nothing.
932 * <p>
933 * Output: Nothing.
934 */
935 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
936 public static final String ACTION_PRINT_SETTINGS =
937 "android.settings.ACTION_PRINT_SETTINGS";
938
John Spurlockde547002014-02-28 17:50:39 -0500939 /**
940 * Activity Action: Show Zen Mode configuration settings.
941 *
942 * @hide
943 */
944 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
945 public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
946
Santos Cordona4c75242014-07-09 12:07:51 -0700947 /**
John Spurlockfc746f82015-04-03 13:47:14 -0400948 * Activity Action: Show Zen Mode priority configuration settings.
949 *
950 * @hide
951 */
952 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
953 public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS
954 = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
955
956 /**
John Spurlock7af10182015-04-03 15:10:31 -0400957 * Activity Action: Show Zen Mode automation configuration settings.
958 *
959 * @hide
960 */
961 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
962 public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS
963 = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS";
964
965 /**
Barnaby Jamesb3006d32015-04-02 17:49:54 -0700966 * Activity Action: Modify do not disturb mode settings.
967 * <p>
968 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
969 * <p>
970 * This intent MUST be started using
971 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
972 * startVoiceActivity}.
973 * <p>
974 * Note: The Activity implementing this intent MUST verify that
975 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}.
976 * returns true before modifying the setting.
977 * <p>
978 * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate
979 * how long the user wishes to avoid interruptions for. The optional
980 * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is
981 * enabling or disabling do not disturb mode. If either extra is not included, the
982 * user maybe asked to provide the value.
983 * <p>
984 * Output: Nothing.
985 */
986 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
987 public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE =
988 "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE";
989
990 /**
John Spurlockb2278d62015-04-07 12:47:12 -0400991 * Activity Action: Show Zen Mode schedule rule configuration settings.
992 *
993 * @hide
994 */
995 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
996 public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS
997 = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS";
998
999 /**
John Spurlockd60258f2015-04-30 09:30:52 -04001000 * Activity Action: Show Zen Mode event rule configuration settings.
1001 *
1002 * @hide
1003 */
1004 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1005 public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS
1006 = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS";
1007
1008 /**
John Spurlock39581cc2015-04-10 11:59:01 -04001009 * Activity Action: Show Zen Mode external rule configuration settings.
1010 *
1011 * @hide
1012 */
1013 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1014 public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS
1015 = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS";
1016
1017 /**
Santos Cordona4c75242014-07-09 12:07:51 -07001018 * Activity Action: Show the regulatory information screen for the device.
1019 * <p>
1020 * In some cases, a matching Activity may not exist, so ensure you safeguard
1021 * against this.
1022 * <p>
1023 * Input: Nothing.
1024 * <p>
1025 * Output: Nothing.
1026 */
Jeff Sharkeydd77fda2014-04-16 17:23:08 -07001027 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1028 public static final String
1029 ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
1030
Jerome Poichet7974cb32014-05-14 12:04:43 -07001031 /**
1032 * Activity Action: Show Device Name Settings.
1033 * <p>
1034 * In some cases, a matching Activity may not exist, so ensure you safeguard
Tim Kilbourn87cd0dc2014-04-14 15:37:51 -07001035 * against this.
Jerome Poichet7974cb32014-05-14 12:04:43 -07001036 *
1037 * @hide
1038 */
1039 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1040 public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
1041
Tim Kilbourn87cd0dc2014-04-14 15:37:51 -07001042 /**
1043 * Activity Action: Show pairing settings.
1044 * <p>
1045 * In some cases, a matching Activity may not exist, so ensure you safeguard
1046 * against this.
1047 *
1048 * @hide
1049 */
1050 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1051 public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
1052
John Spurlockf8f524c2014-06-10 14:47:29 -04001053 /**
1054 * Activity Action: Show battery saver settings.
John Spurlock73466662014-10-30 13:42:05 -04001055 * <p>
1056 * In some cases, a matching Activity may not exist, so ensure you safeguard
1057 * against this.
John Spurlockf8f524c2014-06-10 14:47:29 -04001058 */
1059 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1060 public static final String ACTION_BATTERY_SAVER_SETTINGS
1061 = "android.settings.BATTERY_SAVER_SETTINGS";
1062
Amith Yamasanieb7b94a2014-07-14 18:02:08 -07001063 /**
Barnaby Jamesb3006d32015-04-02 17:49:54 -07001064 * Activity Action: Modify Battery Saver mode setting using a voice command.
1065 * <p>
1066 * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
1067 * <p>
1068 * This intent MUST be started using
1069 * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
1070 * startVoiceActivity}.
1071 * <p>
1072 * Note: The activity implementing this intent MUST verify that
1073 * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
1074 * modifying the setting.
1075 * <p>
1076 * Input: To tell which state batter saver mode should be set to, add the
1077 * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified.
1078 * If the extra is not included, no changes will be made.
1079 * <p>
1080 * Output: Nothing.
1081 */
1082 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1083 public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE =
1084 "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE";
1085
1086 /**
Amith Yamasanieb7b94a2014-07-14 18:02:08 -07001087 * Activity Action: Show Home selection settings. If there are multiple activities
1088 * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you
1089 * to pick your preferred activity.
1090 */
1091 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1092 public static final String ACTION_HOME_SETTINGS
1093 = "android.settings.HOME_SETTINGS";
1094
Julia Reynolds7eba5932015-12-11 16:40:39 -05001095
1096
1097 /**
1098 * Activity Action: Show Default apps settings.
1099 * <p>
1100 * In some cases, a matching Activity may not exist, so ensure you
1101 * safeguard against this.
1102 * <p>
1103 * Input: Nothing.
1104 * <p>
1105 * Output: Nothing.
1106 */
1107 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1108 public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS
1109 = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
1110
John Spurlock2b0e09c2014-07-27 13:27:47 -04001111 /**
1112 * Activity Action: Show notification settings.
1113 *
1114 * @hide
1115 */
1116 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1117 public static final String ACTION_NOTIFICATION_SETTINGS
1118 = "android.settings.NOTIFICATION_SETTINGS";
1119
1120 /**
1121 * Activity Action: Show notification settings for a single app.
1122 *
1123 * @hide
1124 */
1125 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1126 public static final String ACTION_APP_NOTIFICATION_SETTINGS
1127 = "android.settings.APP_NOTIFICATION_SETTINGS";
1128
Chris Wrencd8f4f72014-08-27 18:48:13 -04001129 /**
1130 * Activity Action: Show notification redaction settings.
1131 *
1132 * @hide
1133 */
1134 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1135 public static final String ACTION_APP_NOTIFICATION_REDACTION
1136 = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
1137
John Spurlock2b0e09c2014-07-27 13:27:47 -04001138 /** @hide */ public static final String EXTRA_APP_UID = "app_uid";
1139 /** @hide */ public static final String EXTRA_APP_PACKAGE = "app_package";
1140
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001141 // End of Intent actions for Settings
1142
Erikeebc8e22010-02-18 13:27:19 -08001143 /**
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001144 * @hide - Private call() method on SettingsProvider to read from 'system' table.
1145 */
1146 public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
1147
1148 /**
1149 * @hide - Private call() method on SettingsProvider to read from 'secure' table.
1150 */
1151 public static final String CALL_METHOD_GET_SECURE = "GET_secure";
1152
1153 /**
Christopher Tate06efb532012-08-24 15:29:27 -07001154 * @hide - Private call() method on SettingsProvider to read from 'global' table.
1155 */
1156 public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
1157
1158 /**
1159 * @hide - User handle argument extra to the fast-path call()-based requests
1160 */
1161 public static final String CALL_METHOD_USER_KEY = "_user";
1162
1163 /** @hide - Private call() method to write to 'system' table */
1164 public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
1165
1166 /** @hide - Private call() method to write to 'secure' table */
1167 public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
1168
1169 /** @hide - Private call() method to write to 'global' table */
1170 public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
1171
1172 /**
Erikeebc8e22010-02-18 13:27:19 -08001173 * Activity Extra: Limit available options in launched activity based on the given authority.
1174 * <p>
1175 * This can be passed as an extra field in an Activity Intent with one or more syncable content
1176 * provider's authorities as a String[]. This field is used by some intents to alter the
1177 * behavior of the called activity.
1178 * <p>
1179 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
1180 * on the authority given.
1181 */
Alon Albert50359c22013-02-26 14:47:48 -08001182 public static final String EXTRA_AUTHORITIES = "authorities";
1183
Alon Albertd35bf1f2013-04-18 14:26:51 -07001184 /**
1185 * Activity Extra: Limit available options in launched activity based on the given account
1186 * types.
1187 * <p>
1188 * This can be passed as an extra field in an Activity Intent with one or more account types
1189 * as a String[]. This field is used by some intents to alter the behavior of the called
1190 * activity.
1191 * <p>
1192 * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
1193 * list.
1194 */
Alon Albert50359c22013-02-26 14:47:48 -08001195 public static final String EXTRA_ACCOUNT_TYPES = "account_types";
Erikeebc8e22010-02-18 13:27:19 -08001196
Tadashi G. Takaoka25480202011-01-20 23:13:02 +09001197 public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
1198
Barnaby James48f35522014-07-16 14:27:39 -07001199 /**
Michael Wrightc93fbd12014-09-22 20:07:59 -07001200 * Activity Extra: The device identifier to act upon.
1201 * <p>
1202 * This can be passed as an extra field in an Activity Intent with a single
1203 * InputDeviceIdentifier. This field is used by some activities to jump straight into the
1204 * settings for the given device.
1205 * <p>
Dianne Hackbornad6a99b2014-11-18 10:11:10 -08001206 * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout
1207 * dialog for the given device.
Michael Wrightc93fbd12014-09-22 20:07:59 -07001208 * @hide
1209 */
1210 public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
1211
1212 /**
Barnaby James48f35522014-07-16 14:27:39 -07001213 * Activity Extra: Enable or disable Airplane Mode.
1214 * <p>
1215 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE}
Barnaby Jamesb3006d32015-04-02 17:49:54 -07001216 * intent as a boolean to indicate if it should be enabled.
Barnaby James48f35522014-07-16 14:27:39 -07001217 */
1218 public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
1219
Barnaby Jamesb3006d32015-04-02 17:49:54 -07001220 /**
1221 * Activity Extra: Enable or disable Battery saver mode.
1222 * <p>
1223 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE}
1224 * intent as a boolean to indicate if it should be enabled.
1225 */
1226 public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED =
1227 "android.settings.extra.battery_saver_mode_enabled";
1228
1229 /**
1230 * Activity Extra: Enable or disable Do Not Disturb mode.
1231 * <p>
1232 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
1233 * intent as a boolean to indicate if it should be enabled.
1234 */
1235 public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED =
1236 "android.settings.extra.do_not_disturb_mode_enabled";
1237
1238 /**
1239 * Activity Extra: How many minutes to enable do not disturb mode for.
1240 * <p>
1241 * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
1242 * intent to indicate how long do not disturb mode should be enabled for.
1243 */
1244 public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES =
1245 "android.settings.extra.do_not_disturb_mode_minutes";
1246
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001247 private static final String JID_RESOURCE_PREFIX = "android";
1248
1249 public static final String AUTHORITY = "settings";
1250
1251 private static final String TAG = "Settings";
Christopher Tate06efb532012-08-24 15:29:27 -07001252 private static final boolean LOCAL_LOGV = false;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001253
David Christie3f7b6522013-08-06 19:19:08 -07001254 // Lock ensures that when enabling/disabling the master location switch, we don't end up
1255 // with a partial enable/disable state in multi-threaded situations.
1256 private static final Object mLocationSettingsLock = new Object();
1257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001258 public static class SettingNotFoundException extends AndroidException {
1259 public SettingNotFoundException(String msg) {
1260 super(msg);
1261 }
1262 }
1263
1264 /**
1265 * Common base for tables of name/value settings.
1266 */
1267 public static class NameValueTable implements BaseColumns {
1268 public static final String NAME = "name";
1269 public static final String VALUE = "value";
1270
1271 protected static boolean putString(ContentResolver resolver, Uri uri,
1272 String name, String value) {
1273 // The database will take care of replacing duplicates.
1274 try {
1275 ContentValues values = new ContentValues();
1276 values.put(NAME, name);
1277 values.put(VALUE, value);
1278 resolver.insert(uri, values);
1279 return true;
1280 } catch (SQLException e) {
Dianne Hackborna33e3f72009-09-29 17:28:24 -07001281 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001282 return false;
1283 }
1284 }
1285
1286 public static Uri getUriFor(Uri uri, String name) {
1287 return Uri.withAppendedPath(uri, name);
1288 }
1289 }
1290
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001291 // Thread-safe.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001292 private static class NameValueCache {
1293 private final String mVersionSystemProperty;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001294 private final Uri mUri;
1295
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001296 private static final String[] SELECT_VALUE =
1297 new String[] { Settings.NameValueTable.VALUE };
1298 private static final String NAME_EQ_PLACEHOLDER = "name=?";
1299
1300 // Must synchronize on 'this' to access mValues and mValuesVersion.
Dan Egnor799f7212009-11-24 16:24:44 -08001301 private final HashMap<String, String> mValues = new HashMap<String, String>();
1302 private long mValuesVersion = 0;
1303
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001304 // Initially null; set lazily and held forever. Synchronized on 'this'.
1305 private IContentProvider mContentProvider = null;
1306
1307 // The method we'll call (or null, to not use) on the provider
1308 // for the fast path of retrieving settings.
Christopher Tate06efb532012-08-24 15:29:27 -07001309 private final String mCallGetCommand;
1310 private final String mCallSetCommand;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001311
Christopher Tate06efb532012-08-24 15:29:27 -07001312 public NameValueCache(String versionSystemProperty, Uri uri,
1313 String getCommand, String setCommand) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001314 mVersionSystemProperty = versionSystemProperty;
1315 mUri = uri;
Christopher Tate06efb532012-08-24 15:29:27 -07001316 mCallGetCommand = getCommand;
1317 mCallSetCommand = setCommand;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001318 }
1319
Christopher Tate06efb532012-08-24 15:29:27 -07001320 private IContentProvider lazyGetProvider(ContentResolver cr) {
1321 IContentProvider cp = null;
1322 synchronized (this) {
1323 cp = mContentProvider;
1324 if (cp == null) {
1325 cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
1326 }
1327 }
1328 return cp;
1329 }
1330
1331 public boolean putStringForUser(ContentResolver cr, String name, String value,
1332 final int userHandle) {
1333 try {
1334 Bundle arg = new Bundle();
1335 arg.putString(Settings.NameValueTable.VALUE, value);
Christopher Tated5fe1472012-09-10 15:48:38 -07001336 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
Christopher Tate06efb532012-08-24 15:29:27 -07001337 IContentProvider cp = lazyGetProvider(cr);
Dianne Hackborn35654b62013-01-14 17:38:02 -08001338 cp.call(cr.getPackageName(), mCallSetCommand, name, arg);
Christopher Tate06efb532012-08-24 15:29:27 -07001339 } catch (RemoteException e) {
1340 Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
1341 return false;
1342 }
1343 return true;
1344 }
1345
Christopher Tate06efb532012-08-24 15:29:27 -07001346 public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
Christopher Tate78d2a662012-09-13 16:19:44 -07001347 final boolean isSelf = (userHandle == UserHandle.myUserId());
1348 if (isSelf) {
1349 long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
Dan Egnor799f7212009-11-24 16:24:44 -08001350
Christopher Tate78d2a662012-09-13 16:19:44 -07001351 // Our own user's settings data uses a client-side cache
1352 synchronized (this) {
1353 if (mValuesVersion != newValuesVersion) {
1354 if (LOCAL_LOGV || false) {
1355 Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current "
1356 + newValuesVersion + " != cached " + mValuesVersion);
1357 }
1358
1359 mValues.clear();
1360 mValuesVersion = newValuesVersion;
Dan Egnor799f7212009-11-24 16:24:44 -08001361 }
1362
Christopher Tate78d2a662012-09-13 16:19:44 -07001363 if (mValues.containsKey(name)) {
1364 return mValues.get(name); // Could be null, that's OK -- negative caching
1365 }
Dan Egnor799f7212009-11-24 16:24:44 -08001366 }
Christopher Tate78d2a662012-09-13 16:19:44 -07001367 } else {
1368 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
1369 + " by user " + UserHandle.myUserId() + " so skipping cache");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001370 }
Dan Egnor799f7212009-11-24 16:24:44 -08001371
Christopher Tate06efb532012-08-24 15:29:27 -07001372 IContentProvider cp = lazyGetProvider(cr);
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001373
1374 // Try the fast path first, not using query(). If this
1375 // fails (alternate Settings provider that doesn't support
1376 // this interface?) then we fall back to the query/table
1377 // interface.
Christopher Tate06efb532012-08-24 15:29:27 -07001378 if (mCallGetCommand != null) {
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001379 try {
Christopher Tate06efb532012-08-24 15:29:27 -07001380 Bundle args = null;
Christopher Tate5e08af02012-09-21 17:17:22 -07001381 if (!isSelf) {
Christopher Tate06efb532012-08-24 15:29:27 -07001382 args = new Bundle();
1383 args.putInt(CALL_METHOD_USER_KEY, userHandle);
1384 }
Dianne Hackborn35654b62013-01-14 17:38:02 -08001385 Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001386 if (b != null) {
1387 String value = b.getPairValue();
Christopher Tate78d2a662012-09-13 16:19:44 -07001388 // Don't update our cache for reads of other users' data
1389 if (isSelf) {
1390 synchronized (this) {
1391 mValues.put(name, value);
1392 }
1393 } else {
1394 if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
1395 + " by " + UserHandle.myUserId()
1396 + " so not updating cache");
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001397 }
1398 return value;
1399 }
1400 // If the response Bundle is null, we fall through
1401 // to the query interface below.
1402 } catch (RemoteException e) {
1403 // Not supported by the remote side? Fall through
1404 // to query().
1405 }
1406 }
1407
Dan Egnor799f7212009-11-24 16:24:44 -08001408 Cursor c = null;
1409 try {
Dianne Hackborn35654b62013-01-14 17:38:02 -08001410 c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
Jeff Brown75ea64f2012-01-25 19:37:13 -08001411 new String[]{name}, null, null);
Dan Egnor799f7212009-11-24 16:24:44 -08001412 if (c == null) {
1413 Log.w(TAG, "Can't get key " + name + " from " + mUri);
1414 return null;
1415 }
1416
1417 String value = c.moveToNext() ? c.getString(0) : null;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001418 synchronized (this) {
Dan Egnor799f7212009-11-24 16:24:44 -08001419 mValues.put(name, value);
1420 }
1421 if (LOCAL_LOGV) {
1422 Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
1423 name + " = " + (value == null ? "(null)" : value));
1424 }
1425 return value;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08001426 } catch (RemoteException e) {
Dan Egnor799f7212009-11-24 16:24:44 -08001427 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
1428 return null; // Return null, but don't cache it.
1429 } finally {
1430 if (c != null) c.close();
1431 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001432 }
1433 }
1434
1435 /**
Billy Lau6ad2d662015-07-18 00:26:58 +01001436 * An app can use this method to check if it is currently allowed to draw on top of other
1437 * apps. In order to be allowed to do so, an app must first declare the
1438 * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its manifest. If it
1439 * is currently disallowed, it can prompt the user to grant it this capability through a
1440 * management UI by sending an Intent with action
1441 * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}.
1442 *
1443 * @param context A context
1444 * @return true if the calling app can draw on top of other apps, false otherwise.
1445 */
1446 public static boolean canDrawOverlays(Context context) {
1447 int uid = Binder.getCallingUid();
1448 return Settings.isCallingPackageAllowedToDrawOverlays(context, uid, Settings
1449 .getPackageNameForUid(context, uid), false);
1450 }
1451
1452 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001453 * System settings, containing miscellaneous system preferences. This
1454 * table holds simple name/value pairs. There are convenience
1455 * functions for accessing individual settings entries.
1456 */
1457 public static final class System extends NameValueTable {
1458 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
1459
Svetoslav683914b2015-01-15 14:22:26 -08001460 /** @hide */
1461 public static interface Validator {
1462 public boolean validate(String value);
1463 }
1464
Dianne Hackborn139748f2012-09-24 11:36:57 -07001465 /**
1466 * The content:// style URL for this table
1467 */
1468 public static final Uri CONTENT_URI =
1469 Uri.parse("content://" + AUTHORITY + "/system");
1470
1471 private static final NameValueCache sNameValueCache = new NameValueCache(
1472 SYS_PROP_SETTING_VERSION,
1473 CONTENT_URI,
1474 CALL_METHOD_GET_SYSTEM,
1475 CALL_METHOD_PUT_SYSTEM);
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07001476
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001477 private static final HashSet<String> MOVED_TO_SECURE;
1478 static {
1479 MOVED_TO_SECURE = new HashSet<String>(30);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001480 MOVED_TO_SECURE.add(Secure.ANDROID_ID);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001481 MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001482 MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
Danielle Millett925a7d82012-03-19 18:02:20 -04001483 MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
Amith Yamasani156c4352010-03-05 17:10:03 -08001484 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
1485 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
1486 MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001487 MOVED_TO_SECURE.add(Secure.LOGGING_ID);
1488 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
1489 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
1490 MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
1491 MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001492 MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
1493 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
1494 MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
1495 MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
1496 MOVED_TO_SECURE.add(Secure.WIFI_ON);
1497 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
1498 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
1499 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
1500 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
1501 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
1502 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
1503 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
1504 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
1505 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
1506 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
1507 MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
Christopher Tateaa036a22014-05-19 16:33:27 -07001508
1509 // At one time in System, then Global, but now back in Secure
1510 MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001511 }
1512
Christopher Tate06efb532012-08-24 15:29:27 -07001513 private static final HashSet<String> MOVED_TO_GLOBAL;
Christopher Tate66488d62012-10-02 11:58:01 -07001514 private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
Christopher Tate06efb532012-08-24 15:29:27 -07001515 static {
1516 MOVED_TO_GLOBAL = new HashSet<String>();
Christopher Tate66488d62012-10-02 11:58:01 -07001517 MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>();
1518
Christopher Tate92198742012-09-07 12:00:13 -07001519 // these were originally in system but migrated to secure in the past,
1520 // so are duplicated in the Secure.* namespace
Christopher Tate66488d62012-10-02 11:58:01 -07001521 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
1522 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
1523 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
1524 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
Christopher Tate66488d62012-10-02 11:58:01 -07001525 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
1526 MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
Christopher Tate06efb532012-08-24 15:29:27 -07001527
Christopher Tate92198742012-09-07 12:00:13 -07001528 // these are moving directly from system to global
Christopher Tate06efb532012-08-24 15:29:27 -07001529 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
1530 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
1531 MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
1532 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
1533 MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
1534 MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
1535 MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
1536 MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
1537 MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
1538 MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
1539 MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
1540 MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
1541 MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
1542 MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
1543 MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
1544 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
Eric Laurentbc0fab1f2012-09-19 11:24:41 -07001545 MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07001546 MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
1547 MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
1548 MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
1549 MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
1550 MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
1551 MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
1552 MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
1553 MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
1554 MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
1555 MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES);
1556 MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
Geremy Condraa0735112013-03-26 21:49:26 -07001557 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
1558 MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
1559 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
1560 MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
1561 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
1562 MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
1563 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
1564 MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
Christopher Tate06efb532012-08-24 15:29:27 -07001565 }
1566
Svetoslav683914b2015-01-15 14:22:26 -08001567 private static final Validator sBooleanValidator =
1568 new DiscreteValueValidator(new String[] {"0", "1"});
1569
1570 private static final Validator sNonNegativeIntegerValidator = new Validator() {
1571 @Override
1572 public boolean validate(String value) {
1573 try {
1574 return Integer.parseInt(value) >= 0;
1575 } catch (NumberFormatException e) {
1576 return false;
1577 }
1578 }
1579 };
1580
Svetoslav683914b2015-01-15 14:22:26 -08001581 private static final Validator sUriValidator = new Validator() {
1582 @Override
1583 public boolean validate(String value) {
1584 try {
1585 Uri.decode(value);
1586 return true;
1587 } catch (IllegalArgumentException e) {
1588 return false;
1589 }
1590 }
1591 };
1592
1593 private static final Validator sLenientIpAddressValidator = new Validator() {
1594 private static final int MAX_IPV6_LENGTH = 45;
1595
1596 @Override
1597 public boolean validate(String value) {
1598 return value.length() <= MAX_IPV6_LENGTH;
1599 }
1600 };
1601
Christopher Tate66488d62012-10-02 11:58:01 -07001602 /** @hide */
Svetoslav683914b2015-01-15 14:22:26 -08001603 public static void getMovedToGlobalSettings(Set<String> outKeySet) {
Christopher Tate66488d62012-10-02 11:58:01 -07001604 outKeySet.addAll(MOVED_TO_GLOBAL);
1605 outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
1606 }
1607
1608 /** @hide */
Svetoslav683914b2015-01-15 14:22:26 -08001609 public static void getMovedToSecureSettings(Set<String> outKeySet) {
1610 outKeySet.addAll(MOVED_TO_SECURE);
1611 }
1612
1613 /** @hide */
Christopher Tate66488d62012-10-02 11:58:01 -07001614 public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
1615 outKeySet.addAll(MOVED_TO_GLOBAL);
1616 }
1617
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001618 /**
1619 * Look up a name in the database.
1620 * @param resolver to access the database with
1621 * @param name to look up in the table
1622 * @return the corresponding value, or null if not present
1623 */
Dianne Hackborn139748f2012-09-24 11:36:57 -07001624 public static String getString(ContentResolver resolver, String name) {
Christopher Tate06efb532012-08-24 15:29:27 -07001625 return getStringForUser(resolver, name, UserHandle.myUserId());
1626 }
1627
1628 /** @hide */
Dianne Hackborn139748f2012-09-24 11:36:57 -07001629 public static String getStringForUser(ContentResolver resolver, String name,
Christopher Tate06efb532012-08-24 15:29:27 -07001630 int userHandle) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001631 if (MOVED_TO_SECURE.contains(name)) {
1632 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1633 + " to android.provider.Settings.Secure, returning read-only value.");
Christopher Tate06efb532012-08-24 15:29:27 -07001634 return Secure.getStringForUser(resolver, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001635 }
Christopher Tate66488d62012-10-02 11:58:01 -07001636 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
Christopher Tate06efb532012-08-24 15:29:27 -07001637 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1638 + " to android.provider.Settings.Global, returning read-only value.");
1639 return Global.getStringForUser(resolver, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001640 }
Christopher Tate06efb532012-08-24 15:29:27 -07001641 return sNameValueCache.getStringForUser(resolver, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001642 }
1643
1644 /**
1645 * Store a name/value pair into the database.
1646 * @param resolver to access the database with
1647 * @param name to store
1648 * @param value to associate with the name
1649 * @return true if the value was set, false on database errors
1650 */
1651 public static boolean putString(ContentResolver resolver, String name, String value) {
Christopher Tate06efb532012-08-24 15:29:27 -07001652 return putStringForUser(resolver, name, value, UserHandle.myUserId());
1653 }
1654
1655 /** @hide */
1656 public static boolean putStringForUser(ContentResolver resolver, String name, String value,
1657 int userHandle) {
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001658 if (MOVED_TO_SECURE.contains(name)) {
1659 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1660 + " to android.provider.Settings.Secure, value is unchanged.");
1661 return false;
1662 }
Christopher Tate66488d62012-10-02 11:58:01 -07001663 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
Christopher Tate06efb532012-08-24 15:29:27 -07001664 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1665 + " to android.provider.Settings.Global, value is unchanged.");
1666 return false;
1667 }
Christopher Tate06efb532012-08-24 15:29:27 -07001668 return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001669 }
1670
1671 /**
1672 * Construct the content URI for a particular name/value pair,
1673 * useful for monitoring changes with a ContentObserver.
1674 * @param name to look up in the table
1675 * @return the corresponding content URI, or null if not present
1676 */
1677 public static Uri getUriFor(String name) {
1678 if (MOVED_TO_SECURE.contains(name)) {
1679 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1680 + " to android.provider.Settings.Secure, returning Secure URI.");
1681 return Secure.getUriFor(Secure.CONTENT_URI, name);
1682 }
Christopher Tate66488d62012-10-02 11:58:01 -07001683 if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
Christopher Tate06efb532012-08-24 15:29:27 -07001684 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1685 + " to android.provider.Settings.Global, returning read-only global URI.");
1686 return Global.getUriFor(Global.CONTENT_URI, name);
1687 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001688 return getUriFor(CONTENT_URI, name);
1689 }
1690
1691 /**
1692 * Convenience function for retrieving a single system settings value
1693 * as an integer. Note that internally setting values are always
1694 * stored as strings; this function converts the string to an integer
1695 * for you. The default value will be returned if the setting is
1696 * not defined or not an integer.
1697 *
1698 * @param cr The ContentResolver to access.
1699 * @param name The name of the setting to retrieve.
1700 * @param def Value to return if the setting is not defined.
1701 *
1702 * @return The setting's current value, or 'def' if it is not defined
1703 * or not a valid integer.
1704 */
1705 public static int getInt(ContentResolver cr, String name, int def) {
Christopher Tate06efb532012-08-24 15:29:27 -07001706 return getIntForUser(cr, name, def, UserHandle.myUserId());
1707 }
1708
1709 /** @hide */
1710 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
1711 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001712 try {
1713 return v != null ? Integer.parseInt(v) : def;
1714 } catch (NumberFormatException e) {
1715 return def;
1716 }
1717 }
1718
1719 /**
1720 * Convenience function for retrieving a single system settings value
1721 * as an integer. Note that internally setting values are always
1722 * stored as strings; this function converts the string to an integer
1723 * for you.
1724 * <p>
1725 * This version does not take a default value. If the setting has not
1726 * been set, or the string value is not a number,
1727 * it throws {@link SettingNotFoundException}.
1728 *
1729 * @param cr The ContentResolver to access.
1730 * @param name The name of the setting to retrieve.
1731 *
1732 * @throws SettingNotFoundException Thrown if a setting by the given
1733 * name can't be found or the setting value is not an integer.
1734 *
1735 * @return The setting's current value.
1736 */
1737 public static int getInt(ContentResolver cr, String name)
1738 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07001739 return getIntForUser(cr, name, UserHandle.myUserId());
1740 }
1741
1742 /** @hide */
1743 public static int getIntForUser(ContentResolver cr, String name, int userHandle)
1744 throws SettingNotFoundException {
1745 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001746 try {
1747 return Integer.parseInt(v);
1748 } catch (NumberFormatException e) {
1749 throw new SettingNotFoundException(name);
1750 }
1751 }
1752
1753 /**
1754 * Convenience function for updating a single settings value as an
1755 * integer. This will either create a new entry in the table if the
1756 * given name does not exist, or modify the value of the existing row
1757 * with that name. Note that internally setting values are always
1758 * stored as strings, so this function converts the given value to a
1759 * string before storing it.
1760 *
1761 * @param cr The ContentResolver to access.
1762 * @param name The name of the setting to modify.
1763 * @param value The new value for the setting.
1764 * @return true if the value was set, false on database errors
1765 */
1766 public static boolean putInt(ContentResolver cr, String name, int value) {
Christopher Tate06efb532012-08-24 15:29:27 -07001767 return putIntForUser(cr, name, value, UserHandle.myUserId());
1768 }
1769
1770 /** @hide */
1771 public static boolean putIntForUser(ContentResolver cr, String name, int value,
1772 int userHandle) {
1773 return putStringForUser(cr, name, Integer.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001774 }
1775
1776 /**
1777 * Convenience function for retrieving a single system settings value
1778 * as a {@code long}. Note that internally setting values are always
1779 * stored as strings; this function converts the string to a {@code long}
1780 * for you. The default value will be returned if the setting is
1781 * not defined or not a {@code long}.
1782 *
1783 * @param cr The ContentResolver to access.
1784 * @param name The name of the setting to retrieve.
1785 * @param def Value to return if the setting is not defined.
1786 *
1787 * @return The setting's current value, or 'def' if it is not defined
1788 * or not a valid {@code long}.
1789 */
1790 public static long getLong(ContentResolver cr, String name, long def) {
Christopher Tate06efb532012-08-24 15:29:27 -07001791 return getLongForUser(cr, name, def, UserHandle.myUserId());
1792 }
1793
1794 /** @hide */
1795 public static long getLongForUser(ContentResolver cr, String name, long def,
1796 int userHandle) {
1797 String valString = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001798 long value;
1799 try {
1800 value = valString != null ? Long.parseLong(valString) : def;
1801 } catch (NumberFormatException e) {
1802 value = def;
1803 }
1804 return value;
1805 }
1806
1807 /**
1808 * Convenience function for retrieving a single system settings value
1809 * as a {@code long}. Note that internally setting values are always
1810 * stored as strings; this function converts the string to a {@code long}
1811 * for you.
1812 * <p>
1813 * This version does not take a default value. If the setting has not
1814 * been set, or the string value is not a number,
1815 * it throws {@link SettingNotFoundException}.
1816 *
1817 * @param cr The ContentResolver to access.
1818 * @param name The name of the setting to retrieve.
1819 *
1820 * @return The setting's current value.
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 public static long getLong(ContentResolver cr, String name)
1825 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07001826 return getLongForUser(cr, name, UserHandle.myUserId());
1827 }
1828
1829 /** @hide */
1830 public static long getLongForUser(ContentResolver cr, String name, int userHandle)
1831 throws SettingNotFoundException {
1832 String valString = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001833 try {
1834 return Long.parseLong(valString);
1835 } catch (NumberFormatException e) {
1836 throw new SettingNotFoundException(name);
1837 }
1838 }
1839
1840 /**
1841 * Convenience function for updating a single settings value as a long
1842 * integer. This will either create a new entry in the table if the
1843 * given name does not exist, or modify the value of the existing row
1844 * with that name. Note that internally setting values are always
1845 * stored as strings, so this function converts the given value to a
1846 * string before storing it.
1847 *
1848 * @param cr The ContentResolver to access.
1849 * @param name The name of the setting to modify.
1850 * @param value The new value for the setting.
1851 * @return true if the value was set, false on database errors
1852 */
1853 public static boolean putLong(ContentResolver cr, String name, long value) {
Christopher Tate06efb532012-08-24 15:29:27 -07001854 return putLongForUser(cr, name, value, UserHandle.myUserId());
1855 }
1856
1857 /** @hide */
1858 public static boolean putLongForUser(ContentResolver cr, String name, long value,
1859 int userHandle) {
1860 return putStringForUser(cr, name, Long.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001861 }
1862
1863 /**
1864 * Convenience function for retrieving a single system settings value
1865 * as a floating point number. Note that internally setting values are
1866 * always stored as strings; this function converts the string to an
1867 * float for you. The default value will be returned if the setting
1868 * is not defined or not a valid float.
1869 *
1870 * @param cr The ContentResolver to access.
1871 * @param name The name of the setting to retrieve.
1872 * @param def Value to return if the setting is not defined.
1873 *
1874 * @return The setting's current value, or 'def' if it is not defined
1875 * or not a valid float.
1876 */
1877 public static float getFloat(ContentResolver cr, String name, float def) {
Christopher Tate06efb532012-08-24 15:29:27 -07001878 return getFloatForUser(cr, name, def, UserHandle.myUserId());
1879 }
1880
1881 /** @hide */
1882 public static float getFloatForUser(ContentResolver cr, String name, float def,
1883 int userHandle) {
1884 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001885 try {
1886 return v != null ? Float.parseFloat(v) : def;
1887 } catch (NumberFormatException e) {
1888 return def;
1889 }
1890 }
1891
1892 /**
1893 * Convenience function for retrieving a single system settings value
1894 * as a float. Note that internally setting values are always
1895 * stored as strings; this function converts the string to a float
1896 * for you.
1897 * <p>
1898 * This version does not take a default value. If the setting has not
1899 * been set, or the string value is not a number,
1900 * it throws {@link SettingNotFoundException}.
1901 *
1902 * @param cr The ContentResolver to access.
1903 * @param name The name of the setting to retrieve.
1904 *
1905 * @throws SettingNotFoundException Thrown if a setting by the given
1906 * name can't be found or the setting value is not a float.
1907 *
1908 * @return The setting's current value.
1909 */
1910 public static float getFloat(ContentResolver cr, String name)
1911 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07001912 return getFloatForUser(cr, name, UserHandle.myUserId());
1913 }
1914
1915 /** @hide */
1916 public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
1917 throws SettingNotFoundException {
1918 String v = getStringForUser(cr, name, userHandle);
Brian Muramatsue1d46982010-12-06 17:34:20 -08001919 if (v == null) {
1920 throw new SettingNotFoundException(name);
1921 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001922 try {
1923 return Float.parseFloat(v);
1924 } catch (NumberFormatException e) {
1925 throw new SettingNotFoundException(name);
1926 }
1927 }
1928
1929 /**
1930 * Convenience function for updating a single settings value as a
1931 * floating point number. This will either create a new entry in the
1932 * table if the given name does not exist, or modify the value of the
1933 * existing row with that name. Note that internally setting values
1934 * are always stored as strings, so this function converts the given
1935 * value to a string before storing it.
1936 *
1937 * @param cr The ContentResolver to access.
1938 * @param name The name of the setting to modify.
1939 * @param value The new value for the setting.
1940 * @return true if the value was set, false on database errors
1941 */
1942 public static boolean putFloat(ContentResolver cr, String name, float value) {
Christopher Tate06efb532012-08-24 15:29:27 -07001943 return putFloatForUser(cr, name, value, UserHandle.myUserId());
1944 }
1945
1946 /** @hide */
1947 public static boolean putFloatForUser(ContentResolver cr, String name, float value,
1948 int userHandle) {
1949 return putStringForUser(cr, name, Float.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001950 }
1951
1952 /**
1953 * Convenience function to read all of the current
1954 * configuration-related settings into a
1955 * {@link Configuration} object.
1956 *
1957 * @param cr The ContentResolver to access.
1958 * @param outConfig Where to place the configuration settings.
1959 */
1960 public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
Christopher Tate06efb532012-08-24 15:29:27 -07001961 getConfigurationForUser(cr, outConfig, UserHandle.myUserId());
1962 }
1963
1964 /** @hide */
1965 public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig,
1966 int userHandle) {
1967 outConfig.fontScale = Settings.System.getFloatForUser(
1968 cr, FONT_SCALE, outConfig.fontScale, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001969 if (outConfig.fontScale < 0) {
1970 outConfig.fontScale = 1;
1971 }
1972 }
1973
1974 /**
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001975 * @hide Erase the fields in the Configuration that should be applied
1976 * by the settings.
1977 */
1978 public static void clearConfiguration(Configuration inoutConfig) {
1979 inoutConfig.fontScale = 0;
1980 }
Narayan Kamath6d632962011-08-24 11:51:37 +01001981
Dianne Hackborn31ca8542011-07-19 14:58:28 -07001982 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001983 * Convenience function to write a batch of configuration-related
1984 * settings from a {@link Configuration} object.
1985 *
1986 * @param cr The ContentResolver to access.
1987 * @param config The settings to write.
1988 * @return true if the values were set, false on database errors
1989 */
1990 public static boolean putConfiguration(ContentResolver cr, Configuration config) {
Christopher Tate06efb532012-08-24 15:29:27 -07001991 return putConfigurationForUser(cr, config, UserHandle.myUserId());
1992 }
1993
1994 /** @hide */
1995 public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
1996 int userHandle) {
1997 return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001998 }
1999
Dianne Hackbornb8b11a02010-03-10 15:53:11 -08002000 /** @hide */
2001 public static boolean hasInterestingConfigurationChanges(int changes) {
2002 return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
2003 }
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07002004
Christopher Tate06efb532012-08-24 15:29:27 -07002005 /** @deprecated - Do not use */
2006 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002007 public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
Christopher Tate06efb532012-08-24 15:29:27 -07002008 return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId());
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002009 }
2010
Christopher Tate06efb532012-08-24 15:29:27 -07002011 /**
2012 * @hide
2013 * @deprecated - Do not use
2014 */
2015 public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
2016 int userHandle) {
2017 return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
2018 }
2019
2020 /** @deprecated - Do not use */
2021 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002022 public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
Christopher Tatec8c08382012-09-19 17:18:18 -07002023 setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId());
Christopher Tate06efb532012-08-24 15:29:27 -07002024 }
2025
2026 /**
2027 * @hide
2028 * @deprecated - Do not use
2029 */
2030 @Deprecated
2031 public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
2032 int userHandle) {
2033 putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002034 }
2035
Svetoslav683914b2015-01-15 14:22:26 -08002036 private static final class DiscreteValueValidator implements Validator {
2037 private final String[] mValues;
2038
2039 public DiscreteValueValidator(String[] values) {
2040 mValues = values;
2041 }
2042
Svetoslav1b71ea92015-02-17 18:20:29 -08002043 @Override
Svetoslav683914b2015-01-15 14:22:26 -08002044 public boolean validate(String value) {
2045 return ArrayUtils.contains(mValues, value);
2046 }
2047 }
2048
2049 private static final class InclusiveIntegerRangeValidator implements Validator {
2050 private final int mMin;
2051 private final int mMax;
2052
2053 public InclusiveIntegerRangeValidator(int min, int max) {
2054 mMin = min;
2055 mMax = max;
2056 }
2057
Svetoslav1b71ea92015-02-17 18:20:29 -08002058 @Override
Svetoslav683914b2015-01-15 14:22:26 -08002059 public boolean validate(String value) {
2060 try {
2061 final int intValue = Integer.parseInt(value);
2062 return intValue >= mMin && intValue <= mMax;
2063 } catch (NumberFormatException e) {
2064 return false;
2065 }
2066 }
2067 }
2068
2069 private static final class InclusiveFloatRangeValidator implements Validator {
2070 private final float mMin;
2071 private final float mMax;
2072
2073 public InclusiveFloatRangeValidator(float min, float max) {
2074 mMin = min;
2075 mMax = max;
2076 }
2077
Svetoslav1b71ea92015-02-17 18:20:29 -08002078 @Override
Svetoslav683914b2015-01-15 14:22:26 -08002079 public boolean validate(String value) {
2080 try {
2081 final float floatValue = Float.parseFloat(value);
2082 return floatValue >= mMin && floatValue <= mMax;
2083 } catch (NumberFormatException e) {
2084 return false;
2085 }
2086 }
2087 }
2088
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002089 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002090 * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002091 */
Christopher Tate06efb532012-08-24 15:29:27 -07002092 @Deprecated
2093 public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002094
2095 /**
2096 * What happens when the user presses the end call button if they're not
2097 * on a call.<br/>
2098 * <b>Values:</b><br/>
2099 * 0 - The end button does nothing.<br/>
2100 * 1 - The end button goes to the home screen.<br/>
2101 * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
2102 * 3 - The end button goes to the home screen. If the user is already on the
2103 * home screen, it puts the device to sleep.
2104 */
2105 public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
2106
Svetoslav683914b2015-01-15 14:22:26 -08002107 private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR =
2108 new InclusiveIntegerRangeValidator(0, 3);
2109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002110 /**
David Brown458e8062010-03-08 21:52:11 -08002111 * END_BUTTON_BEHAVIOR value for "go home".
2112 * @hide
2113 */
2114 public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
2115
2116 /**
2117 * END_BUTTON_BEHAVIOR value for "go to sleep".
2118 * @hide
2119 */
2120 public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
2121
2122 /**
2123 * END_BUTTON_BEHAVIOR default value.
2124 * @hide
2125 */
2126 public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
2127
2128 /**
Joe Onorato9cdffa12011-04-06 18:27:27 -07002129 * Is advanced settings mode turned on. 0 == no, 1 == yes
2130 * @hide
2131 */
2132 public static final String ADVANCED_SETTINGS = "advanced_settings";
2133
Svetoslav683914b2015-01-15 14:22:26 -08002134 private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator;
2135
Joe Onorato9cdffa12011-04-06 18:27:27 -07002136 /**
2137 * ADVANCED_SETTINGS default value.
2138 * @hide
2139 */
2140 public static final int ADVANCED_SETTINGS_DEFAULT = 0;
2141
2142 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002143 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002144 */
Christopher Tate06efb532012-08-24 15:29:27 -07002145 @Deprecated
2146 public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002147
2148 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002149 * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002150 */
Christopher Tate06efb532012-08-24 15:29:27 -07002151 @Deprecated
2152 public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002153
2154 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002155 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002156 */
Christopher Tate06efb532012-08-24 15:29:27 -07002157 @Deprecated
2158 public static final String RADIO_WIFI = Global.RADIO_WIFI;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002159
Robert Greenwalt8588e472011-11-08 10:12:25 -08002160 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002161 * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
Robert Greenwalt8588e472011-11-08 10:12:25 -08002162 * {@hide}
2163 */
Christopher Tate06efb532012-08-24 15:29:27 -07002164 @Deprecated
2165 public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002166
2167 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002168 * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
Nick Pelly8d32a012011-08-09 07:03:49 -07002169 */
Christopher Tate06efb532012-08-24 15:29:27 -07002170 @Deprecated
2171 public static final String RADIO_CELL = Global.RADIO_CELL;
Nick Pelly8d32a012011-08-09 07:03:49 -07002172
2173 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002174 * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002175 */
Christopher Tate06efb532012-08-24 15:29:27 -07002176 @Deprecated
2177 public static final String RADIO_NFC = Global.RADIO_NFC;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002178
2179 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002180 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
2181 */
2182 @Deprecated
2183 public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
2184
2185 /**
2186 * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -07002187 *
2188 * {@hide}
2189 */
Christopher Tate06efb532012-08-24 15:29:27 -07002190 @Deprecated
2191 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
2192 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
Mike Lockwoodbd5ddf02009-07-29 21:37:14 -07002193
2194 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002195 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002196 */
Christopher Tate06efb532012-08-24 15:29:27 -07002197 @Deprecated
2198 public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002199
2200 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002201 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002202 */
Christopher Tate06efb532012-08-24 15:29:27 -07002203 @Deprecated
2204 public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002205
2206 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002207 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002208 */
Christopher Tate06efb532012-08-24 15:29:27 -07002209 @Deprecated
2210 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
2211 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002212
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002213 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002214 * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002215 */
Christopher Tate06efb532012-08-24 15:29:27 -07002216 @Deprecated
2217 public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002218
Eric Laurentbc0fab1f2012-09-19 11:24:41 -07002219 /**
2220 * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
2221 */
2222 @Deprecated
2223 public static final String MODE_RINGER = Global.MODE_RINGER;
2224
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002225 /**
2226 * Whether to use static IP and other static network attributes.
2227 * <p>
2228 * Set to 1 for true and 0 for false.
Jeff Sharkey625239a2012-09-26 22:03:49 -07002229 *
2230 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002231 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002232 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002233 public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
2234
Svetoslav683914b2015-01-15 14:22:26 -08002235 private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator;
2236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002237 /**
2238 * The static IP address.
2239 * <p>
2240 * Example: "192.168.1.51"
Jeff Sharkey625239a2012-09-26 22:03:49 -07002241 *
2242 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002243 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002244 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002245 public static final String WIFI_STATIC_IP = "wifi_static_ip";
2246
Svetoslav683914b2015-01-15 14:22:26 -08002247 private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator;
2248
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002249 /**
2250 * If using static IP, the gateway's IP address.
2251 * <p>
2252 * Example: "192.168.1.1"
Jeff Sharkey625239a2012-09-26 22:03:49 -07002253 *
2254 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002255 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002256 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002257 public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
2258
Svetoslav683914b2015-01-15 14:22:26 -08002259 private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator;
2260
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002261 /**
2262 * If using static IP, the net mask.
2263 * <p>
2264 * Example: "255.255.255.0"
Jeff Sharkey625239a2012-09-26 22:03:49 -07002265 *
2266 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002267 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002268 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002269 public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
2270
Svetoslav683914b2015-01-15 14:22:26 -08002271 private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator;
2272
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002273 /**
2274 * If using static IP, the primary DNS's IP address.
2275 * <p>
2276 * Example: "192.168.1.1"
Jeff Sharkey625239a2012-09-26 22:03:49 -07002277 *
2278 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002279 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002280 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002281 public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
2282
Svetoslav683914b2015-01-15 14:22:26 -08002283 private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator;
2284
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002285 /**
2286 * If using static IP, the secondary DNS's IP address.
2287 * <p>
2288 * Example: "192.168.1.2"
Jeff Sharkey625239a2012-09-26 22:03:49 -07002289 *
2290 * @deprecated Use {@link WifiManager} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002291 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07002292 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002293 public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
2294
Svetoslav683914b2015-01-15 14:22:26 -08002295 private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002296
2297 /**
2298 * Determines whether remote devices may discover and/or connect to
2299 * this device.
2300 * <P>Type: INT</P>
2301 * 2 -- discoverable and connectable
2302 * 1 -- connectable but not discoverable
2303 * 0 -- neither connectable nor discoverable
2304 */
2305 public static final String BLUETOOTH_DISCOVERABILITY =
2306 "bluetooth_discoverability";
2307
Svetoslav683914b2015-01-15 14:22:26 -08002308 private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR =
2309 new InclusiveIntegerRangeValidator(0, 2);
2310
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002311 /**
2312 * Bluetooth discoverability timeout. If this value is nonzero, then
2313 * Bluetooth becomes discoverable for a certain number of seconds,
2314 * after which is becomes simply connectable. The value is in seconds.
2315 */
2316 public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
2317 "bluetooth_discoverability_timeout";
2318
Svetoslav683914b2015-01-15 14:22:26 -08002319 private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR =
2320 sNonNegativeIntegerValidator;
2321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002322 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08002323 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
2324 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002325 */
Amith Yamasani156c4352010-03-05 17:10:03 -08002326 @Deprecated
2327 public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002328
2329 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08002330 * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
2331 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002332 */
Amith Yamasani156c4352010-03-05 17:10:03 -08002333 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002334 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2335
2336 /**
Jaikumar Ganesh545e6702010-06-04 10:23:03 -07002337 * @deprecated Use
Amith Yamasani156c4352010-03-05 17:10:03 -08002338 * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
2339 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002340 */
Amith Yamasani156c4352010-03-05 17:10:03 -08002341 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002342 public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2343 "lock_pattern_tactile_feedback_enabled";
2344
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002345 /**
2346 * A formatted string of the next alarm that is set, or the empty string
2347 * if there is no alarm set.
Adrian Roosc42a1e12014-07-07 23:35:53 +02002348 *
2349 * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002350 */
Adrian Roosc42a1e12014-07-07 23:35:53 +02002351 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002352 public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
2353
Svetoslav683914b2015-01-15 14:22:26 -08002354 private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() {
2355 private static final int MAX_LENGTH = 1000;
Svetoslav1b71ea92015-02-17 18:20:29 -08002356
Svetoslav683914b2015-01-15 14:22:26 -08002357 @Override
2358 public boolean validate(String value) {
2359 // TODO: No idea what the correct format is.
Svetoslav64d6e9c2015-02-12 11:30:36 -08002360 return value == null || value.length() < MAX_LENGTH;
Svetoslav683914b2015-01-15 14:22:26 -08002361 }
2362 };
2363
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002364 /**
2365 * Scaling factor for fonts, float.
2366 */
2367 public static final String FONT_SCALE = "font_scale";
2368
Svetoslav683914b2015-01-15 14:22:26 -08002369 private static final Validator FONT_SCALE_VALIDATOR = new Validator() {
2370 @Override
2371 public boolean validate(String value) {
2372 try {
2373 return Float.parseFloat(value) >= 0;
2374 } catch (NumberFormatException e) {
2375 return false;
2376 }
2377 }
2378 };
2379
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002380 /**
2381 * Name of an application package to be debugged.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002382 *
2383 * @deprecated Use {@link Global#DEBUG_APP} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002384 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002385 @Deprecated
2386 public static final String DEBUG_APP = Global.DEBUG_APP;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002387
2388 /**
2389 * If 1, when launching DEBUG_APP it will wait for the debugger before
2390 * starting user code. If 0, it will run normally.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002391 *
2392 * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002393 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002394 @Deprecated
2395 public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002396
2397 /**
2398 * Whether or not to dim the screen. 0=no 1=yes
Jeff Brown96307042012-07-27 15:51:34 -07002399 * @deprecated This setting is no longer used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002400 */
Jeff Brown96307042012-07-27 15:51:34 -07002401 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002402 public static final String DIM_SCREEN = "dim_screen";
2403
Svetoslav683914b2015-01-15 14:22:26 -08002404 private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator;
2405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002406 /**
Jeff Brown05af6ad2014-09-30 20:54:30 -07002407 * The amount of time in milliseconds before the device goes to sleep or begins
2408 * to dream after a period of inactivity. This value is also known as the
2409 * user activity timeout period since the screen isn't necessarily turned off
2410 * when it expires.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002411 */
2412 public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
2413
Svetoslav683914b2015-01-15 14:22:26 -08002414 private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator;
2415
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002416 /**
2417 * The screen backlight brightness between 0 and 255.
2418 */
2419 public static final String SCREEN_BRIGHTNESS = "screen_brightness";
2420
Svetoslav683914b2015-01-15 14:22:26 -08002421 private static final Validator SCREEN_BRIGHTNESS_VALIDATOR =
2422 new InclusiveIntegerRangeValidator(0, 255);
2423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002424 /**
Dan Murphy951764b2009-08-27 14:59:03 -05002425 * Control whether to enable automatic brightness mode.
Dan Murphy951764b2009-08-27 14:59:03 -05002426 */
2427 public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
2428
Svetoslav683914b2015-01-15 14:22:26 -08002429 private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator;
2430
Dan Murphy951764b2009-08-27 14:59:03 -05002431 /**
Dianne Hackbornd9ea4682012-01-20 18:36:40 -08002432 * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
2433 * or less (<0.0 >-1.0) bright.
Dianne Hackborn518a3d82012-05-09 16:30:49 -07002434 * @hide
Dianne Hackbornd9ea4682012-01-20 18:36:40 -08002435 */
2436 public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
2437
Svetoslav683914b2015-01-15 14:22:26 -08002438 private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR =
2439 new InclusiveFloatRangeValidator(-1, 1);
2440
Dianne Hackbornd9ea4682012-01-20 18:36:40 -08002441 /**
Mike Lockwooddc3494e2009-10-14 21:17:09 -07002442 * SCREEN_BRIGHTNESS_MODE value for manual mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07002443 */
2444 public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
2445
2446 /**
Scott Main52bfc242012-02-09 10:09:14 -08002447 * SCREEN_BRIGHTNESS_MODE value for automatic mode.
Mike Lockwooddc3494e2009-10-14 21:17:09 -07002448 */
2449 public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
2450
2451 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002452 * Control whether the process CPU usage meter should be shown.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002453 *
2454 * @deprecated Use {@link Global#SHOW_PROCESSES} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002455 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002456 @Deprecated
2457 public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002458
2459 /**
2460 * If 1, the activity manager will aggressively finish activities and
2461 * processes as soon as they are no longer needed. If 0, the normal
2462 * extended lifetime is used.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002463 *
2464 * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002465 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002466 @Deprecated
2467 public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002468
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002469 /**
2470 * Determines which streams are affected by ringer mode changes. The
2471 * stream type's bit should be set to 1 if it should be muted when going
2472 * into an inaudible ringer mode.
2473 */
2474 public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
2475
Svetoslav683914b2015-01-15 14:22:26 -08002476 private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR =
2477 sNonNegativeIntegerValidator;
2478
2479 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002480 * Determines which streams are affected by mute. The
2481 * stream type's bit should be set to 1 if it should be muted when a mute request
2482 * is received.
2483 */
Svetoslav683914b2015-01-15 14:22:26 -08002484 public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
2485
2486 private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR =
2487 sNonNegativeIntegerValidator;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002488
2489 /**
2490 * Whether vibrate is on for different events. This is used internally,
2491 * changing this value will not change the vibrate. See AudioManager.
2492 */
2493 public static final String VIBRATE_ON = "vibrate_on";
2494
Svetoslav683914b2015-01-15 14:22:26 -08002495 private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator;
2496
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002497 /**
Jeff Brown7f6c2312012-04-13 20:38:38 -07002498 * If 1, redirects the system vibrator to all currently attached input devices
2499 * that support vibration. If there are no such input devices, then the system
2500 * vibrator is used instead.
2501 * If 0, does not register the system vibrator.
2502 *
2503 * This setting is mainly intended to provide a compatibility mechanism for
2504 * applications that only know about the system vibrator and do not use the
2505 * input device vibrator API.
2506 *
2507 * @hide
2508 */
2509 public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
2510
Svetoslav683914b2015-01-15 14:22:26 -08002511 private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator;
2512
Jeff Brown7f6c2312012-04-13 20:38:38 -07002513 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002514 * Ringer volume. This is used internally, changing this value will not
2515 * change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002516 *
2517 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002518 */
2519 public static final String VOLUME_RING = "volume_ring";
2520
2521 /**
2522 * System/notifications volume. This is used internally, changing this
2523 * value will not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002524 *
2525 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002526 */
2527 public static final String VOLUME_SYSTEM = "volume_system";
2528
2529 /**
2530 * Voice call volume. This is used internally, changing this value will
2531 * not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002532 *
2533 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002534 */
2535 public static final String VOLUME_VOICE = "volume_voice";
2536
2537 /**
2538 * Music/media/gaming volume. This is used internally, changing this
2539 * value will not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002540 *
2541 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002542 */
2543 public static final String VOLUME_MUSIC = "volume_music";
2544
2545 /**
2546 * Alarm volume. This is used internally, changing this
2547 * value will not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002548 *
2549 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002550 */
2551 public static final String VOLUME_ALARM = "volume_alarm";
2552
2553 /**
2554 * Notification volume. This is used internally, changing this
2555 * value will not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002556 *
2557 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002558 */
2559 public static final String VOLUME_NOTIFICATION = "volume_notification";
2560
2561 /**
Eric Laurent484d2882009-12-08 09:05:45 -08002562 * Bluetooth Headset volume. This is used internally, changing this value will
2563 * not change the volume. See AudioManager.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002564 *
2565 * @removed Not used by anything since API 2.
Eric Laurent484d2882009-12-08 09:05:45 -08002566 */
2567 public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
2568
2569 /**
Mike Lockwood8517e462011-10-25 14:47:19 -04002570 * Master volume (float in the range 0.0f to 1.0f).
Svetoslavdbbeeb32015-02-18 19:16:25 -08002571 *
Mike Lockwood8517e462011-10-25 14:47:19 -04002572 * @hide
2573 */
2574 public static final String VOLUME_MASTER = "volume_master";
2575
2576 /**
Justin Koh57978ed2012-04-03 17:37:58 -07002577 * Master volume mute (int 1 = mute, 0 = not muted).
2578 *
2579 * @hide
2580 */
2581 public static final String VOLUME_MASTER_MUTE = "volume_master_mute";
2582
Svetoslav683914b2015-01-15 14:22:26 -08002583 private static final Validator VOLUME_MASTER_MUTE_VALIDATOR = sBooleanValidator;
2584
Justin Koh57978ed2012-04-03 17:37:58 -07002585 /**
Julia Reynoldsb53453f2014-08-22 11:42:43 -04002586 * Microphone mute (int 1 = mute, 0 = not muted).
2587 *
2588 * @hide
2589 */
2590 public static final String MICROPHONE_MUTE = "microphone_mute";
2591
Svetoslav683914b2015-01-15 14:22:26 -08002592 private static final Validator MICROPHONE_MUTE_VALIDATOR = sBooleanValidator;
2593
Julia Reynoldsb53453f2014-08-22 11:42:43 -04002594 /**
Andy Hungf04b84d2015-12-18 17:33:27 -08002595 * Master mono (int 1 = mono, 0 = normal).
2596 *
2597 * @hide
2598 */
2599 public static final String MASTER_MONO = "master_mono";
2600
2601 private static final Validator MASTER_MONO_VALIDATOR = sBooleanValidator;
2602
2603 /**
Justin Koh57978ed2012-04-03 17:37:58 -07002604 * Whether the notifications should use the ring volume (value of 1) or
2605 * a separate notification volume (value of 0). In most cases, users
2606 * will have this enabled so the notification and ringer volumes will be
2607 * the same. However, power users can disable this and use the separate
2608 * notification volume control.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002609 * <p>
Justin Koh57978ed2012-04-03 17:37:58 -07002610 * Note: This is a one-off setting that will be removed in the future
2611 * when there is profile support. For this reason, it is kept hidden
2612 * from the public APIs.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002613 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002614 * @hide
Amith Yamasani42722bf2011-07-22 10:34:27 -07002615 * @deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002616 */
Gilles Debunnee90bed12011-08-30 14:28:27 -07002617 @Deprecated
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002618 public static final String NOTIFICATIONS_USE_RING_VOLUME =
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002619 "notifications_use_ring_volume";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002620
Svetoslav683914b2015-01-15 14:22:26 -08002621 private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator;
2622
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002623 /**
Daniel Sandler6329bf72010-02-26 15:17:44 -05002624 * Whether silent mode should allow vibration feedback. This is used
2625 * internally in AudioService and the Sound settings activity to
2626 * coordinate decoupling of vibrate and silent modes. This setting
2627 * will likely be removed in a future release with support for
2628 * audio/vibe feedback profiles.
2629 *
Eric Laurentbffc3d12012-05-07 17:43:49 -07002630 * Not used anymore. On devices with vibrator, the user explicitly selects
2631 * silent or vibrate mode.
2632 * Kept for use by legacy database upgrade code in DatabaseHelper.
Daniel Sandler6329bf72010-02-26 15:17:44 -05002633 * @hide
2634 */
2635 public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
2636
Svetoslav683914b2015-01-15 14:22:26 -08002637 private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator;
2638
Daniel Sandler6329bf72010-02-26 15:17:44 -05002639 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002640 * The mapping of stream type (integer) to its setting.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002641 *
2642 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002643 */
2644 public static final String[] VOLUME_SETTINGS = {
2645 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
Eric Laurent484d2882009-12-08 09:05:45 -08002646 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002647 };
2648
2649 /**
2650 * Appended to various volume related settings to record the previous
2651 * values before they the settings were affected by a silent/vibrate
2652 * ringer mode change.
Svetoslavdbbeeb32015-02-18 19:16:25 -08002653 *
2654 * @removed Not used by anything since API 2.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002655 */
2656 public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
2657
2658 /**
2659 * Persistent store for the system-wide default ringtone URI.
2660 * <p>
2661 * If you need to play the default ringtone at any given time, it is recommended
2662 * you give {@link #DEFAULT_RINGTONE_URI} to the media player. It will resolve
2663 * to the set default ringtone at the time of playing.
2664 *
2665 * @see #DEFAULT_RINGTONE_URI
2666 */
2667 public static final String RINGTONE = "ringtone";
2668
Svetoslav683914b2015-01-15 14:22:26 -08002669 private static final Validator RINGTONE_VALIDATOR = sUriValidator;
2670
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002671 /**
2672 * A {@link Uri} that will point to the current default ringtone at any
2673 * given time.
2674 * <p>
2675 * If the current default ringtone is in the DRM provider and the caller
2676 * does not have permission, the exception will be a
2677 * FileNotFoundException.
2678 */
2679 public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
2680
2681 /**
2682 * Persistent store for the system-wide default notification sound.
2683 *
2684 * @see #RINGTONE
2685 * @see #DEFAULT_NOTIFICATION_URI
2686 */
2687 public static final String NOTIFICATION_SOUND = "notification_sound";
2688
Svetoslav683914b2015-01-15 14:22:26 -08002689 private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator;
2690
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002691 /**
2692 * A {@link Uri} that will point to the current default notification
2693 * sound at any given time.
2694 *
2695 * @see #DEFAULT_RINGTONE_URI
2696 */
2697 public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
2698
2699 /**
Patrick Scott3156bb002009-04-13 09:57:38 -07002700 * Persistent store for the system-wide default alarm alert.
2701 *
2702 * @see #RINGTONE
2703 * @see #DEFAULT_ALARM_ALERT_URI
2704 */
2705 public static final String ALARM_ALERT = "alarm_alert";
2706
Svetoslav683914b2015-01-15 14:22:26 -08002707 private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator;
2708
Patrick Scott3156bb002009-04-13 09:57:38 -07002709 /**
2710 * A {@link Uri} that will point to the current default alarm alert at
2711 * any given time.
2712 *
2713 * @see #DEFAULT_ALARM_ALERT_URI
2714 */
2715 public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
2716
2717 /**
Jean-Michel Trivid589fea2011-04-15 11:28:10 -07002718 * Persistent store for the system default media button event receiver.
2719 *
2720 * @hide
2721 */
2722 public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
2723
Svetoslav683914b2015-01-15 14:22:26 -08002724 private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() {
2725 @Override
2726 public boolean validate(String value) {
2727 try {
2728 ComponentName.unflattenFromString(value);
2729 return true;
2730 } catch (NullPointerException e) {
2731 return false;
2732 }
2733 }
2734 };
2735
Jean-Michel Trivid589fea2011-04-15 11:28:10 -07002736 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002737 * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
2738 */
2739 public static final String TEXT_AUTO_REPLACE = "auto_replace";
2740
Svetoslav683914b2015-01-15 14:22:26 -08002741 private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator;
2742
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002743 /**
2744 * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
2745 */
2746 public static final String TEXT_AUTO_CAPS = "auto_caps";
2747
Svetoslav683914b2015-01-15 14:22:26 -08002748 private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator;
2749
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002750 /**
2751 * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
2752 * feature converts two spaces to a "." and space.
2753 */
2754 public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002755
Svetoslav683914b2015-01-15 14:22:26 -08002756 private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator;
2757
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002758 /**
2759 * Setting to showing password characters in text editors. 1 = On, 0 = Off
2760 */
2761 public static final String TEXT_SHOW_PASSWORD = "show_password";
2762
Svetoslav683914b2015-01-15 14:22:26 -08002763 private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator;
2764
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002765 public static final String SHOW_GTALK_SERVICE_STATUS =
2766 "SHOW_GTALK_SERVICE_STATUS";
2767
Svetoslav683914b2015-01-15 14:22:26 -08002768 private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator;
2769
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002770 /**
2771 * Name of activity to use for wallpaper on the home screen.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002772 *
2773 * @deprecated Use {@link WallpaperManager} instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002774 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002775 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002776 public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
2777
Svetoslav683914b2015-01-15 14:22:26 -08002778 private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() {
2779 private static final int MAX_LENGTH = 1000;
2780
2781 @Override
2782 public boolean validate(String value) {
2783 if (value != null && value.length() > MAX_LENGTH) {
2784 return false;
2785 }
2786 return ComponentName.unflattenFromString(value) != null;
2787 }
2788 };
2789
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002790 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002791 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
2792 * instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002793 */
Christopher Tate06efb532012-08-24 15:29:27 -07002794 @Deprecated
2795 public static final String AUTO_TIME = Global.AUTO_TIME;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002796
2797 /**
Christopher Tate06efb532012-08-24 15:29:27 -07002798 * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
2799 * instead
Amith Yamasaniad450be2010-09-16 16:47:00 -07002800 */
Christopher Tate06efb532012-08-24 15:29:27 -07002801 @Deprecated
2802 public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
Amith Yamasaniad450be2010-09-16 16:47:00 -07002803
2804 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002805 * Display times as 12 or 24 hours
2806 * 12
2807 * 24
2808 */
2809 public static final String TIME_12_24 = "time_12_24";
2810
Svetoslav683914b2015-01-15 14:22:26 -08002811 /** @hide */
2812 public static final Validator TIME_12_24_VALIDATOR =
2813 new DiscreteValueValidator(new String[] {"12", "24"});
2814
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002815 /**
2816 * Date format string
2817 * mm/dd/yyyy
2818 * dd/mm/yyyy
2819 * yyyy/mm/dd
2820 */
2821 public static final String DATE_FORMAT = "date_format";
2822
Svetoslav683914b2015-01-15 14:22:26 -08002823 /** @hide */
2824 public static final Validator DATE_FORMAT_VALIDATOR = new Validator() {
2825 @Override
2826 public boolean validate(String value) {
2827 try {
2828 new SimpleDateFormat(value);
2829 return true;
2830 } catch (IllegalArgumentException e) {
2831 return false;
2832 }
2833 }
2834 };
2835
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002836 /**
2837 * Whether the setup wizard has been run before (on first boot), or if
2838 * it still needs to be run.
2839 *
2840 * nonzero = it has been run in the past
2841 * 0 = it has not been run in the past
2842 */
2843 public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
2844
Svetoslav683914b2015-01-15 14:22:26 -08002845 /** @hide */
2846 public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator;
2847
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002848 /**
2849 * Scaling factor for normal window animations. Setting to 0 will disable window
2850 * animations.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002851 *
2852 * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002853 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002854 @Deprecated
2855 public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002856
2857 /**
2858 * Scaling factor for activity transition animations. Setting to 0 will disable window
2859 * animations.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002860 *
2861 * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002862 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002863 @Deprecated
2864 public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002865
2866 /**
Chet Haasec38fa1f2012-02-01 16:37:46 -08002867 * Scaling factor for Animator-based animations. This affects both the start delay and
2868 * duration of all such animations. Setting to 0 will cause animations to end immediately.
2869 * The default value is 1.
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002870 *
2871 * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
Chet Haasec38fa1f2012-02-01 16:37:46 -08002872 */
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07002873 @Deprecated
2874 public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002875
2876 /**
2877 * Control whether the accelerometer will be used to change screen
2878 * orientation. If 0, it will not be used unless explicitly requested
2879 * by the application; if 1, it will be used by default unless explicitly
2880 * disabled by the application.
2881 */
2882 public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
2883
Svetoslav683914b2015-01-15 14:22:26 -08002884 /** @hide */
2885 public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator;
2886
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002887 /**
Daniel Sandlerb73617d2010-08-17 00:41:00 -04002888 * Default screen rotation when no other policy applies.
2889 * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
2890 * preference, this rotation value will be used. Must be one of the
Brian Muramatsue1d46982010-12-06 17:34:20 -08002891 * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
Daniel Sandlerb73617d2010-08-17 00:41:00 -04002892 *
Dianne Hackborn16ec0802014-08-15 18:32:33 -07002893 * @see android.view.Display#getRotation
Daniel Sandlerb73617d2010-08-17 00:41:00 -04002894 */
2895 public static final String USER_ROTATION = "user_rotation";
2896
Svetoslav683914b2015-01-15 14:22:26 -08002897 /** @hide */
2898 public static final Validator USER_ROTATION_VALIDATOR =
2899 new InclusiveIntegerRangeValidator(0, 3);
2900
Daniel Sandlerb73617d2010-08-17 00:41:00 -04002901 /**
Jeff Brown207673cd2012-06-05 17:47:11 -07002902 * Control whether the rotation lock toggle in the System UI should be hidden.
2903 * Typically this is done for accessibility purposes to make it harder for
2904 * the user to accidentally toggle the rotation lock while the display rotation
2905 * has been locked for accessibility.
2906 *
2907 * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
2908 * unavailable for other reasons). If 1, then the rotation lock toggle is hidden.
2909 *
2910 * @hide
2911 */
2912 public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
2913 "hide_rotation_lock_toggle_for_accessibility";
2914
Svetoslav683914b2015-01-15 14:22:26 -08002915 /** @hide */
2916 public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR =
2917 sBooleanValidator;
2918
Jeff Brown207673cd2012-06-05 17:47:11 -07002919 /**
Daisuke Miyakawa3c60eeb2012-05-08 12:08:25 -07002920 * Whether the phone vibrates when it is ringing due to an incoming call. This will
2921 * be used by Phone and Setting apps; it shouldn't affect other apps.
2922 * The value is boolean (1 or 0).
2923 *
2924 * Note: this is not same as "vibrate on ring", which had been available until ICS.
2925 * It was about AudioManager's setting and thus affected all the applications which
2926 * relied on the setting, while this is purely about the vibration setting for incoming
2927 * calls.
Daisuke Miyakawa3c60eeb2012-05-08 12:08:25 -07002928 */
2929 public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
2930
Svetoslav683914b2015-01-15 14:22:26 -08002931 /** @hide */
2932 public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator;
2933
Daisuke Miyakawa3c60eeb2012-05-08 12:08:25 -07002934 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002935 * Whether the audible DTMF tones are played by the dialer when dialing. The value is
2936 * boolean (1 or 0).
2937 */
2938 public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
2939
Svetoslav683914b2015-01-15 14:22:26 -08002940 /** @hide */
2941 public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
2942
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002943 /**
David Kraused0f67152009-06-13 18:01:13 -05002944 * CDMA only settings
2945 * DTMF tone type played by the dialer when dialing.
2946 * 0 = Normal
2947 * 1 = Long
David Kraused0f67152009-06-13 18:01:13 -05002948 */
2949 public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
2950
Svetoslav683914b2015-01-15 14:22:26 -08002951 /** @hide */
2952 public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
2953
David Kraused0f67152009-06-13 18:01:13 -05002954 /**
David Kraused0f67152009-06-13 18:01:13 -05002955 * Whether the hearing aid is enabled. The value is
2956 * boolean (1 or 0).
2957 * @hide
2958 */
2959 public static final String HEARING_AID = "hearing_aid";
2960
Svetoslav683914b2015-01-15 14:22:26 -08002961 /** @hide */
2962 public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator;
2963
David Kraused0f67152009-06-13 18:01:13 -05002964 /**
2965 * CDMA only settings
2966 * TTY Mode
2967 * 0 = OFF
2968 * 1 = FULL
2969 * 2 = VCO
2970 * 3 = HCO
2971 * @hide
2972 */
2973 public static final String TTY_MODE = "tty_mode";
2974
Svetoslav683914b2015-01-15 14:22:26 -08002975 /** @hide */
2976 public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3);
2977
David Kraused0f67152009-06-13 18:01:13 -05002978 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002979 * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
2980 * boolean (1 or 0).
2981 */
2982 public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07002983
Svetoslav683914b2015-01-15 14:22:26 -08002984 /** @hide */
2985 public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator;
2986
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002987 /**
2988 * Whether the haptic feedback (long presses, ...) are enabled. The value is
2989 * boolean (1 or 0).
2990 */
2991 public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07002992
Svetoslav683914b2015-01-15 14:22:26 -08002993 /** @hide */
2994 public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator;
2995
Mike LeBeau48603e72009-06-05 00:27:00 +01002996 /**
Bjorn Bringert24abb662010-09-21 12:21:18 +01002997 * @deprecated Each application that shows web suggestions should have its own
2998 * setting for this.
Mike LeBeau48603e72009-06-05 00:27:00 +01002999 */
Bjorn Bringert24abb662010-09-21 12:21:18 +01003000 @Deprecated
Mike LeBeau48603e72009-06-05 00:27:00 +01003001 public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003002
Svetoslav683914b2015-01-15 14:22:26 -08003003 /** @hide */
3004 public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;
3005
-b master501eec92009-07-06 13:53:11 -07003006 /**
Amith Yamasaniae3ed702009-12-01 19:02:05 -08003007 * Whether the notification LED should repeatedly flash when a notification is
3008 * pending. The value is boolean (1 or 0).
3009 * @hide
3010 */
3011 public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
3012
Svetoslav683914b2015-01-15 14:22:26 -08003013 /** @hide */
3014 public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator;
3015
Amith Yamasaniae3ed702009-12-01 19:02:05 -08003016 /**
Dianne Hackborn90d2db32010-02-11 22:19:06 -08003017 * Show pointer location on screen?
3018 * 0 = no
3019 * 1 = yes
3020 * @hide
3021 */
3022 public static final String POINTER_LOCATION = "pointer_location";
3023
Svetoslav683914b2015-01-15 14:22:26 -08003024 /** @hide */
3025 public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator;
3026
Dianne Hackborn90d2db32010-02-11 22:19:06 -08003027 /**
Jeff Browndaf4a122011-08-26 17:14:14 -07003028 * Show touch positions on screen?
3029 * 0 = no
3030 * 1 = yes
3031 * @hide
3032 */
3033 public static final String SHOW_TOUCHES = "show_touches";
3034
Svetoslav683914b2015-01-15 14:22:26 -08003035 /** @hide */
3036 public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator;
3037
Jeff Browndaf4a122011-08-26 17:14:14 -07003038 /**
Dianne Hackborn16ec0802014-08-15 18:32:33 -07003039 * Log raw orientation data from
Jorim Jaggib10e33f2015-02-04 21:57:40 +01003040 * {@link com.android.server.policy.WindowOrientationListener} for use with the
Jeff Brown4519f072011-01-23 13:16:01 -08003041 * orientationplot.py tool.
3042 * 0 = no
3043 * 1 = yes
3044 * @hide
3045 */
3046 public static final String WINDOW_ORIENTATION_LISTENER_LOG =
3047 "window_orientation_listener_log";
3048
Svetoslav683914b2015-01-15 14:22:26 -08003049 /** @hide */
3050 public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator;
3051
Jeff Brown4519f072011-01-23 13:16:01 -08003052 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003053 * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
3054 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003055 * @hide
3056 */
Christopher Tate06efb532012-08-24 15:29:27 -07003057 @Deprecated
3058 public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003059
3060 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003061 * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
3062 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003063 * @hide
3064 */
Christopher Tate06efb532012-08-24 15:29:27 -07003065 @Deprecated
3066 public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003067
3068 /**
3069 * Whether to play sounds when the keyguard is shown and dismissed.
3070 * @hide
3071 */
3072 public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
3073
Svetoslav683914b2015-01-15 14:22:26 -08003074 /** @hide */
3075 public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator;
3076
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003077 /**
Mike Lockwood7bef7392011-10-20 16:51:53 -04003078 * Whether the lockscreen should be completely disabled.
3079 * @hide
3080 */
3081 public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
3082
Svetoslav683914b2015-01-15 14:22:26 -08003083 /** @hide */
3084 public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator;
3085
Mike Lockwood7bef7392011-10-20 16:51:53 -04003086 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003087 * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
3088 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003089 * @hide
3090 */
Christopher Tate06efb532012-08-24 15:29:27 -07003091 @Deprecated
3092 public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003093
3094 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003095 * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
3096 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003097 * @hide
3098 */
Christopher Tate06efb532012-08-24 15:29:27 -07003099 @Deprecated
3100 public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003101
3102 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003103 * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
3104 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003105 * @hide
3106 */
Christopher Tate06efb532012-08-24 15:29:27 -07003107 @Deprecated
3108 public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003109
3110 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003111 * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
3112 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003113 * @hide
3114 */
Christopher Tate06efb532012-08-24 15:29:27 -07003115 @Deprecated
3116 public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003117
3118 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003119 * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
3120 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003121 * @hide
3122 */
Christopher Tate06efb532012-08-24 15:29:27 -07003123 @Deprecated
3124 public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003125
3126 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003127 * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
3128 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003129 * @hide
3130 */
Christopher Tate06efb532012-08-24 15:29:27 -07003131 @Deprecated
3132 public static final String LOCK_SOUND = Global.LOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003133
3134 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003135 * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
3136 * instead
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003137 * @hide
3138 */
Christopher Tate06efb532012-08-24 15:29:27 -07003139 @Deprecated
3140 public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
Daniel Sandler0e9d2af2010-01-25 11:33:03 -05003141
3142 /**
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003143 * Receive incoming SIP calls?
3144 * 0 = no
3145 * 1 = yes
3146 * @hide
3147 */
3148 public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
3149
Svetoslav683914b2015-01-15 14:22:26 -08003150 /** @hide */
3151 public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator;
3152
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003153 /**
3154 * Call Preference String.
3155 * "SIP_ALWAYS" : Always use SIP with network access
3156 * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003157 * @hide
3158 */
3159 public static final String SIP_CALL_OPTIONS = "sip_call_options";
3160
Svetoslav683914b2015-01-15 14:22:26 -08003161 /** @hide */
3162 public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator(
3163 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"});
3164
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003165 /**
3166 * One of the sip call options: Always use SIP with network access.
3167 * @hide
3168 */
3169 public static final String SIP_ALWAYS = "SIP_ALWAYS";
3170
Svetoslav683914b2015-01-15 14:22:26 -08003171 /** @hide */
3172 public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator;
3173
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003174 /**
3175 * One of the sip call options: Only if destination is a SIP address.
3176 * @hide
3177 */
3178 public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
3179
Svetoslav683914b2015-01-15 14:22:26 -08003180 /** @hide */
3181 public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator;
3182
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003183 /**
Tyler Gunn2c830a22014-09-02 08:39:35 -07003184 * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead. Formerly used to indicate that
3185 * the user should be prompted each time a call is made whether it should be placed using
3186 * SIP. The {@link com.android.providers.settings.DatabaseHelper} replaces this with
3187 * SIP_ADDRESS_ONLY.
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003188 * @hide
3189 */
Tyler Gunn2c830a22014-09-02 08:39:35 -07003190 @Deprecated
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003191 public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
3192
Svetoslav683914b2015-01-15 14:22:26 -08003193 /** @hide */
3194 public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator;
3195
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003196 /**
Jeff Brown1a84fd12011-06-02 01:26:32 -07003197 * Pointer speed setting.
3198 * This is an integer value in a range between -7 and +7, so there are 15 possible values.
3199 * -7 = slowest
3200 * 0 = default speed
3201 * +7 = fastest
3202 * @hide
3203 */
3204 public static final String POINTER_SPEED = "pointer_speed";
3205
Svetoslav683914b2015-01-15 14:22:26 -08003206 /** @hide */
3207 public static final Validator POINTER_SPEED_VALIDATOR =
3208 new InclusiveFloatRangeValidator(-7, 7);
3209
Jeff Brown1a84fd12011-06-02 01:26:32 -07003210 /**
Jason Monk56e09b42014-07-18 10:29:14 -04003211 * Whether lock-to-app will be triggered by long-press on recents.
3212 * @hide
3213 */
3214 public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled";
3215
Svetoslav683914b2015-01-15 14:22:26 -08003216 /** @hide */
3217 public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator;
3218
Jason Monk56e09b42014-07-18 10:29:14 -04003219 /**
Daniel Sandler2fdb68b2013-10-03 00:12:11 -04003220 * I am the lolrus.
3221 * <p>
3222 * Nonzero values indicate that the user has a bukkit.
3223 * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>.
3224 * @hide
3225 */
3226 public static final String EGG_MODE = "egg_mode";
3227
Svetoslav683914b2015-01-15 14:22:26 -08003228 /** @hide */
Svet Ganovb1918a02015-05-15 09:32:55 -07003229 public static final Validator EGG_MODE_VALIDATOR = new Validator() {
3230 @Override
3231 public boolean validate(String value) {
3232 try {
3233 return Long.parseLong(value) >= 0;
3234 } catch (NumberFormatException e) {
3235 return false;
3236 }
3237 }
3238 };
Svetoslav683914b2015-01-15 14:22:26 -08003239
3240 /**
3241 * IMPORTANT: If you add a new public settings you also have to add it to
3242 * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
3243 * it to PRIVATE_SETTINGS below. Also add a validator that can validate
3244 * the setting value. See an example above.
3245 */
3246
Daniel Sandler2fdb68b2013-10-03 00:12:11 -04003247 /**
-b master501eec92009-07-06 13:53:11 -07003248 * Settings to backup. This is here so that it's in the same place as the settings
3249 * keys and easy to update.
Svetoslav Ganova571a582011-09-20 18:32:20 -07003250 *
3251 * NOTE: Settings are backed up and restored in the order they appear
3252 * in this array. If you have one setting depending on another,
3253 * make sure that they are ordered appropriately.
3254 *
-b master501eec92009-07-06 13:53:11 -07003255 * @hide
3256 */
3257 public static final String[] SETTINGS_TO_BACKUP = {
Christopher Tate66488d62012-10-02 11:58:01 -07003258 STAY_ON_WHILE_PLUGGED_IN, // moved to global
-b master501eec92009-07-06 13:53:11 -07003259 WIFI_USE_STATIC_IP,
3260 WIFI_STATIC_IP,
3261 WIFI_STATIC_GATEWAY,
3262 WIFI_STATIC_NETMASK,
3263 WIFI_STATIC_DNS1,
3264 WIFI_STATIC_DNS2,
3265 BLUETOOTH_DISCOVERABILITY,
3266 BLUETOOTH_DISCOVERABILITY_TIMEOUT,
3267 DIM_SCREEN,
3268 SCREEN_OFF_TIMEOUT,
3269 SCREEN_BRIGHTNESS,
Christopher Tate362aca62009-09-25 15:58:03 -07003270 SCREEN_BRIGHTNESS_MODE,
Dianne Hackbornd9ea4682012-01-20 18:36:40 -08003271 SCREEN_AUTO_BRIGHTNESS_ADJ,
Jeff Brown7f6c2312012-04-13 20:38:38 -07003272 VIBRATE_INPUT_DEVICES,
Amith Yamasani8823c0a82009-07-07 14:30:17 -07003273 MODE_RINGER_STREAMS_AFFECTED,
-b master501eec92009-07-06 13:53:11 -07003274 TEXT_AUTO_REPLACE,
3275 TEXT_AUTO_CAPS,
3276 TEXT_AUTO_PUNCTUATE,
3277 TEXT_SHOW_PASSWORD,
Christopher Tate66488d62012-10-02 11:58:01 -07003278 AUTO_TIME, // moved to global
3279 AUTO_TIME_ZONE, // moved to global
-b master501eec92009-07-06 13:53:11 -07003280 TIME_12_24,
3281 DATE_FORMAT,
-b master501eec92009-07-06 13:53:11 -07003282 DTMF_TONE_WHEN_DIALING,
3283 DTMF_TONE_TYPE_WHEN_DIALING,
-b master501eec92009-07-06 13:53:11 -07003284 HEARING_AID,
3285 TTY_MODE,
3286 SOUND_EFFECTS_ENABLED,
3287 HAPTIC_FEEDBACK_ENABLED,
Christopher Tate66488d62012-10-02 11:58:01 -07003288 POWER_SOUNDS_ENABLED, // moved to global
3289 DOCK_SOUNDS_ENABLED, // moved to global
Christopher Tate14c2d792010-02-25 16:49:44 -08003290 LOCKSCREEN_SOUNDS_ENABLED,
Amith Yamasaniae3ed702009-12-01 19:02:05 -08003291 SHOW_WEB_SUGGESTIONS,
Chung-yih Wang042e9bd2010-08-31 17:43:39 +08003292 SIP_CALL_OPTIONS,
Nick Pelly038cabe2010-09-23 16:12:11 -07003293 SIP_RECEIVE_CALLS,
Jeff Brown1a84fd12011-06-02 01:26:32 -07003294 POINTER_SPEED,
Amith Yamasani622bf2222013-09-06 13:54:28 -07003295 VIBRATE_WHEN_RINGING,
3296 RINGTONE,
Jason Monk94cfd9d2014-10-31 13:18:21 -04003297 LOCK_TO_APP_ENABLED,
Amith Yamasani622bf2222013-09-06 13:54:28 -07003298 NOTIFICATION_SOUND
-b master501eec92009-07-06 13:53:11 -07003299 };
3300
Sailesh Nepal1bd78762014-02-11 22:32:21 -08003301 /**
Amith Yamasanib0ff3222015-03-04 09:56:14 -08003302 * These are all public system settings
Svetoslav683914b2015-01-15 14:22:26 -08003303 *
Amith Yamasani4f7e2e32014-08-14 18:49:48 -07003304 * @hide
3305 */
Svetoslav683914b2015-01-15 14:22:26 -08003306 public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>();
3307 static {
3308 PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR);
3309 PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP);
3310 PUBLIC_SETTINGS.add(WIFI_STATIC_IP);
3311 PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY);
3312 PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK);
3313 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1);
3314 PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2);
3315 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY);
3316 PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT);
3317 PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED);
3318 PUBLIC_SETTINGS.add(FONT_SCALE);
3319 PUBLIC_SETTINGS.add(DIM_SCREEN);
3320 PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT);
3321 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS);
3322 PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE);
3323 PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED);
3324 PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED);
3325 PUBLIC_SETTINGS.add(VIBRATE_ON);
3326 PUBLIC_SETTINGS.add(VOLUME_RING);
3327 PUBLIC_SETTINGS.add(VOLUME_SYSTEM);
3328 PUBLIC_SETTINGS.add(VOLUME_VOICE);
3329 PUBLIC_SETTINGS.add(VOLUME_MUSIC);
3330 PUBLIC_SETTINGS.add(VOLUME_ALARM);
3331 PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION);
3332 PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO);
3333 PUBLIC_SETTINGS.add(RINGTONE);
3334 PUBLIC_SETTINGS.add(NOTIFICATION_SOUND);
3335 PUBLIC_SETTINGS.add(ALARM_ALERT);
3336 PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE);
3337 PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS);
3338 PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
3339 PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD);
3340 PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS);
3341 PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY);
3342 PUBLIC_SETTINGS.add(TIME_12_24);
3343 PUBLIC_SETTINGS.add(DATE_FORMAT);
3344 PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN);
3345 PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION);
3346 PUBLIC_SETTINGS.add(USER_ROTATION);
3347 PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING);
3348 PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED);
3349 PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
3350 PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS);
Svetoslav Ganovd2631632015-12-09 16:29:22 -08003351 PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING);
Svetoslav683914b2015-01-15 14:22:26 -08003352 }
3353
3354 /**
3355 * These are all hidden system settings.
3356 *
3357 * @hide
3358 */
3359 public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>();
3360 static {
3361 PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP);
3362 PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR);
3363 PRIVATE_SETTINGS.add(ADVANCED_SETTINGS);
3364 PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ);
3365 PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES);
3366 PRIVATE_SETTINGS.add(VOLUME_MASTER);
3367 PRIVATE_SETTINGS.add(VOLUME_MASTER_MUTE);
3368 PRIVATE_SETTINGS.add(MICROPHONE_MUTE);
Andy Hungf04b84d2015-12-18 17:33:27 -08003369 PRIVATE_SETTINGS.add(MASTER_MONO);
Svetoslav683914b2015-01-15 14:22:26 -08003370 PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME);
3371 PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT);
3372 PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER);
3373 PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY);
Svetoslav683914b2015-01-15 14:22:26 -08003374 PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING);
3375 PRIVATE_SETTINGS.add(HEARING_AID);
3376 PRIVATE_SETTINGS.add(TTY_MODE);
3377 PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
3378 PRIVATE_SETTINGS.add(POINTER_LOCATION);
3379 PRIVATE_SETTINGS.add(SHOW_TOUCHES);
3380 PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
3381 PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
3382 PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
3383 PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED);
3384 PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED);
3385 PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND);
3386 PRIVATE_SETTINGS.add(DESK_DOCK_SOUND);
3387 PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND);
3388 PRIVATE_SETTINGS.add(CAR_DOCK_SOUND);
3389 PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND);
3390 PRIVATE_SETTINGS.add(LOCK_SOUND);
3391 PRIVATE_SETTINGS.add(UNLOCK_SOUND);
3392 PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS);
3393 PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS);
3394 PRIVATE_SETTINGS.add(SIP_ALWAYS);
3395 PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY);
3396 PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME);
3397 PRIVATE_SETTINGS.add(POINTER_SPEED);
3398 PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED);
3399 PRIVATE_SETTINGS.add(EGG_MODE);
3400 }
3401
3402 /**
Amith Yamasanib0ff3222015-03-04 09:56:14 -08003403 * These are all public system settings
Svetoslav683914b2015-01-15 14:22:26 -08003404 *
3405 * @hide
3406 */
3407 public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
3408 static {
3409 VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR);
3410 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
3411 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR);
3412 VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT,
3413 BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR);
3414 VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR);
3415 VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
3416 VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
3417 VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
3418 VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR);
3419 VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
3420 VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
3421 VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR);
3422 VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR);
Svetoslav683914b2015-01-15 14:22:26 -08003423 VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR);
3424 VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR);
3425 VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR);
3426 VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR);
3427 VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR);
3428 VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR);
3429 VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR);
3430 VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR);
3431 VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR);
3432 VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR);
3433 VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR);
3434 VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR);
3435 VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR);
3436 VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR);
3437 VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR);
3438 VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR);
3439 VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR);
3440 VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR);
3441 VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
3442 VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
3443 VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR);
3444 VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR);
3445 VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR);
Svetoslav683914b2015-01-15 14:22:26 -08003446 VALIDATORS.put(VOLUME_MASTER_MUTE, VOLUME_MASTER_MUTE_VALIDATOR);
3447 VALIDATORS.put(MICROPHONE_MUTE, MICROPHONE_MUTE_VALIDATOR);
Andy Hungf04b84d2015-12-18 17:33:27 -08003448 VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR);
Svetoslav683914b2015-01-15 14:22:26 -08003449 VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR);
3450 VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR);
3451 VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR);
3452 VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
3453 HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR);
3454 VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR);
3455 VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR);
3456 VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR);
3457 VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR);
3458 VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR);
3459 VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR);
3460 VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR);
3461 VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG,
3462 WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR);
3463 VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR);
3464 VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR);
3465 VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR);
3466 VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR);
3467 VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR);
3468 VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR);
3469 VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR);
3470 VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR);
3471 VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR);
3472 VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR);
3473 VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR);
3474 VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR);
3475 VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR);
3476 VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
3477 VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
3478 }
3479
3480 /**
3481 * These entries are considered common between the personal and the managed profile,
3482 * since the managed profile doesn't get to change them.
3483 */
3484 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
3485 static {
3486 CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT);
3487 CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED);
3488 CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED);
3489 CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD);
3490 CLONE_TO_MANAGED_PROFILE.add(TIME_12_24);
3491 }
3492
3493 /** @hide */
3494 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
3495 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
3496 }
Amith Yamasani4f7e2e32014-08-14 18:49:48 -07003497
3498 /**
Sailesh Nepal1bd78762014-02-11 22:32:21 -08003499 * When to use Wi-Fi calling
3500 *
3501 * @see android.telephony.TelephonyManager.WifiCallingChoices
3502 * @hide
3503 */
3504 public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
3505
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003506 // Settings moved to Settings.Secure
3507
3508 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003509 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003510 * instead
3511 */
3512 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003513 public static final String ADB_ENABLED = Global.ADB_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003514
3515 /**
3516 * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
3517 */
3518 @Deprecated
3519 public static final String ANDROID_ID = Secure.ANDROID_ID;
3520
3521 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003522 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003523 */
3524 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003525 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003526
3527 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003528 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003529 */
3530 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003531 public static final String DATA_ROAMING = Global.DATA_ROAMING;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003532
3533 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003534 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003535 */
3536 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003537 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003538
3539 /**
Jeff Sharkey625239a2012-09-26 22:03:49 -07003540 * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003541 */
3542 @Deprecated
Jeff Sharkey625239a2012-09-26 22:03:49 -07003543 public static final String HTTP_PROXY = Global.HTTP_PROXY;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003544
3545 /**
Christopher Tateaa036a22014-05-19 16:33:27 -07003546 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003547 */
3548 @Deprecated
Christopher Tateaa036a22014-05-19 16:33:27 -07003549 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003550
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003551 /**
3552 * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
3553 * instead
3554 */
3555 @Deprecated
3556 public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
3557
3558 /**
3559 * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
3560 */
3561 @Deprecated
3562 public static final String LOGGING_ID = Secure.LOGGING_ID;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003563
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003564 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003565 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003566 */
3567 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003568 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003569
3570 /**
3571 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
3572 * instead
3573 */
3574 @Deprecated
3575 public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
3576
3577 /**
3578 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
3579 * instead
3580 */
3581 @Deprecated
3582 public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
3583
3584 /**
3585 * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
3586 * instead
3587 */
3588 @Deprecated
3589 public static final String PARENTAL_CONTROL_REDIRECT_URL =
3590 Secure.PARENTAL_CONTROL_REDIRECT_URL;
3591
3592 /**
3593 * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
3594 */
3595 @Deprecated
3596 public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
3597
3598 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003599 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003600 */
3601 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003602 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003603
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003604 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003605 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003606 */
3607 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003608 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003609
Dianne Hackborn4a51c202009-08-21 15:14:02 -07003610 /**
3611 * @deprecated Use
Christopher Tate06efb532012-08-24 15:29:27 -07003612 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
Dianne Hackborn4a51c202009-08-21 15:14:02 -07003613 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003614 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003615 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003616
Dianne Hackborn4a51c202009-08-21 15:14:02 -07003617 /**
3618 * @deprecated Use
Christopher Tate06efb532012-08-24 15:29:27 -07003619 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
Dianne Hackborn4a51c202009-08-21 15:14:02 -07003620 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003621 @Deprecated
3622 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
Christopher Tate06efb532012-08-24 15:29:27 -07003623 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003624
3625 /**
3626 * @deprecated Use
Christopher Tate06efb532012-08-24 15:29:27 -07003627 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003628 */
3629 @Deprecated
3630 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
Christopher Tate06efb532012-08-24 15:29:27 -07003631 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003632
3633 /**
3634 * @deprecated Use
Christopher Tate06efb532012-08-24 15:29:27 -07003635 * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003636 */
3637 @Deprecated
3638 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
Christopher Tate06efb532012-08-24 15:29:27 -07003639 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003640
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003641 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003642 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003643 * instead
3644 */
3645 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003646 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003647
3648 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003649 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003650 */
3651 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003652 public static final String WIFI_ON = Global.WIFI_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003653
3654 /**
3655 * @deprecated Use
3656 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
3657 * instead
3658 */
3659 @Deprecated
3660 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
3661 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
3662
3663 /**
3664 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
3665 */
3666 @Deprecated
3667 public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
3668
3669 /**
3670 * @deprecated Use
3671 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
3672 */
3673 @Deprecated
3674 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
3675 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07003676
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003677 /**
3678 * @deprecated Use
3679 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
3680 */
3681 @Deprecated
3682 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
3683 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
3684
3685 /**
3686 * @deprecated Use
3687 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
3688 * instead
3689 */
3690 @Deprecated
3691 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
3692 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
3693
3694 /**
3695 * @deprecated Use
3696 * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
3697 */
3698 @Deprecated
3699 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
3700 Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
3701
3702 /**
3703 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
3704 * instead
3705 */
3706 @Deprecated
3707 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
3708
3709 /**
Christopher Tate06efb532012-08-24 15:29:27 -07003710 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003711 */
3712 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07003713 public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003714
3715 /**
3716 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
3717 */
3718 @Deprecated
3719 public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
3720
3721 /**
3722 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
3723 * instead
3724 */
3725 @Deprecated
3726 public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
3727
3728 /**
3729 * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
3730 * instead
3731 */
3732 @Deprecated
3733 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
3734 Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
Billy Lau6ad2d662015-07-18 00:26:58 +01003735
3736 /**
3737 * An app can use this method to check if it is currently allowed to write or modify system
3738 * settings. In order to gain write access to the system settings, an app must declare the
3739 * {@link android.Manifest.permission#WRITE_SETTINGS} permission in its manifest. If it is
3740 * currently disallowed, it can prompt the user to grant it this capability through a
3741 * management UI by sending an Intent with action
3742 * {@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}.
3743 *
3744 * @param context A context
3745 * @return true if the calling app can write to system settings, false otherwise
3746 */
3747 public static boolean canWrite(Context context) {
3748 int uid = Binder.getCallingUid();
3749 return isCallingPackageAllowedToWriteSettings(context, uid, getPackageNameForUid(
3750 context, uid), false);
3751 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003752 }
3753
3754 /**
3755 * Secure system settings, containing system preferences that applications
3756 * can read but are not allowed to write. These are for preferences that
3757 * the user must explicitly modify through the system UI or specialized
3758 * APIs for those values, not modified directly by applications.
3759 */
3760 public static final class Secure extends NameValueTable {
3761 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
3762
Dianne Hackborn139748f2012-09-24 11:36:57 -07003763 /**
3764 * The content:// style URL for this table
3765 */
3766 public static final Uri CONTENT_URI =
3767 Uri.parse("content://" + AUTHORITY + "/secure");
3768
Brad Fitzpatrick1877d012010-03-04 17:48:13 -08003769 // Populated lazily, guarded by class object:
Dianne Hackborn139748f2012-09-24 11:36:57 -07003770 private static final NameValueCache sNameValueCache = new NameValueCache(
3771 SYS_PROP_SETTING_VERSION,
3772 CONTENT_URI,
3773 CALL_METHOD_GET_SECURE,
3774 CALL_METHOD_PUT_SECURE);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003775
Amith Yamasani52c489c2012-03-28 11:42:42 -07003776 private static ILockSettings sLockSettings = null;
3777
Amith Yamasani7ab8c4a2012-04-06 09:27:12 -07003778 private static boolean sIsSystemProcess;
Amith Yamasani52c489c2012-03-28 11:42:42 -07003779 private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
Christopher Tate06efb532012-08-24 15:29:27 -07003780 private static final HashSet<String> MOVED_TO_GLOBAL;
Amith Yamasani52c489c2012-03-28 11:42:42 -07003781 static {
3782 MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3);
3783 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
3784 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
3785 MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
Christopher Tate06efb532012-08-24 15:29:27 -07003786
3787 MOVED_TO_GLOBAL = new HashSet<String>();
3788 MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
3789 MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
3790 MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
Christopher Tate58f41ec2013-01-11 15:40:36 -08003791 MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
Christopher Tate06efb532012-08-24 15:29:27 -07003792 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
3793 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
3794 MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
3795 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
3796 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
3797 MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
3798 MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
3799 MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
3800 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED);
3801 MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
3802 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
3803 MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
Christopher Tate06efb532012-08-24 15:29:27 -07003804 MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
3805 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
3806 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
3807 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
3808 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
3809 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
3810 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
3811 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
Christopher Tate06efb532012-08-24 15:29:27 -07003812 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
3813 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
3814 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
3815 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
3816 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
3817 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
3818 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
3819 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
3820 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
3821 MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
3822 MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
3823 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
3824 MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
3825 MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
3826 MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
3827 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
3828 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
3829 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
3830 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
3831 MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
3832 MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
3833 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
3834 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
3835 MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
3836 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
3837 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
3838 MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
Christopher Tate06efb532012-08-24 15:29:27 -07003839 MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
3840 MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
Robert Greenwalt3ea0c992013-10-03 21:13:49 +00003841 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
Christopher Tate06efb532012-08-24 15:29:27 -07003842 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
3843 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
3844 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
3845 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
3846 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
3847 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
3848 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
3849 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
3850 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
3851 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
3852 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
3853 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
3854 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
vandwalle7c3606c2014-03-31 19:12:07 -07003855 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
3856 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
Christopher Tate06efb532012-08-24 15:29:27 -07003857 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
3858 MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
Christopher Tate06efb532012-08-24 15:29:27 -07003859 MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
Christopher Tatec868b642012-09-12 17:41:04 -07003860 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
3861 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
3862 MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
3863 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
3864 MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
3865 MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
Christopher Tate06efb532012-08-24 15:29:27 -07003866 MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
Jeff Sharkey625239a2012-09-26 22:03:49 -07003867 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
3868 MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
3869 MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
3870 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
3871 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
3872 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
3873 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
3874 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
3875 MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
3876 MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
3877 MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
3878 MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
3879 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
3880 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
3881 MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
3882 MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
3883 MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
3884 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
3885 MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
3886 MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
3887 MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
3888 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
3889 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
3890 MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
3891 MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
3892 MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
3893 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
3894 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
3895 MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
3896 MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
3897 MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07003898 MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
Hui Shu22671772014-10-01 21:41:07 +00003899 MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
Christopher Tate06efb532012-08-24 15:29:27 -07003900 }
3901
Christopher Tate66488d62012-10-02 11:58:01 -07003902 /** @hide */
Svetoslav683914b2015-01-15 14:22:26 -08003903 public static void getMovedToGlobalSettings(Set<String> outKeySet) {
Christopher Tate66488d62012-10-02 11:58:01 -07003904 outKeySet.addAll(MOVED_TO_GLOBAL);
3905 }
3906
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003907 /**
3908 * Look up a name in the database.
3909 * @param resolver to access the database with
3910 * @param name to look up in the table
3911 * @return the corresponding value, or null if not present
3912 */
Dianne Hackborn139748f2012-09-24 11:36:57 -07003913 public static String getString(ContentResolver resolver, String name) {
Christopher Tate06efb532012-08-24 15:29:27 -07003914 return getStringForUser(resolver, name, UserHandle.myUserId());
3915 }
3916
3917 /** @hide */
Dianne Hackborn139748f2012-09-24 11:36:57 -07003918 public static String getStringForUser(ContentResolver resolver, String name,
Christopher Tate06efb532012-08-24 15:29:27 -07003919 int userHandle) {
3920 if (MOVED_TO_GLOBAL.contains(name)) {
3921 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
3922 + " to android.provider.Settings.Global.");
3923 return Global.getStringForUser(resolver, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003924 }
Amith Yamasani52c489c2012-03-28 11:42:42 -07003925
Dianne Hackborn139748f2012-09-24 11:36:57 -07003926 if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
3927 synchronized (Secure.class) {
3928 if (sLockSettings == null) {
3929 sLockSettings = ILockSettings.Stub.asInterface(
3930 (IBinder) ServiceManager.getService("lock_settings"));
3931 sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
3932 }
3933 }
3934 if (sLockSettings != null && !sIsSystemProcess) {
Adrian Roos7811d9f2015-07-27 15:10:13 -07003935 // No context; use the ActivityThread's context as an approximation for
3936 // determining the target API level.
3937 Application application = ActivityThread.currentApplication();
3938
3939 boolean isPreMnc = application != null
3940 && application.getApplicationInfo() != null
3941 && application.getApplicationInfo().targetSdkVersion
3942 <= VERSION_CODES.LOLLIPOP_MR1;
3943 if (isPreMnc) {
3944 try {
3945 return sLockSettings.getString(name, "0", userHandle);
3946 } catch (RemoteException re) {
3947 // Fall through
3948 }
3949 } else {
3950 throw new SecurityException("Settings.Secure." + name
3951 + " is deprecated and no longer accessible."
3952 + " See API documentation for potential replacements.");
Dianne Hackborn139748f2012-09-24 11:36:57 -07003953 }
Amith Yamasani52c489c2012-03-28 11:42:42 -07003954 }
3955 }
3956
Christopher Tate06efb532012-08-24 15:29:27 -07003957 return sNameValueCache.getStringForUser(resolver, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003958 }
3959
3960 /**
3961 * Store a name/value pair into the database.
3962 * @param resolver to access the database with
3963 * @param name to store
3964 * @param value to associate with the name
3965 * @return true if the value was set, false on database errors
3966 */
Christopher Tate06efb532012-08-24 15:29:27 -07003967 public static boolean putString(ContentResolver resolver, String name, String value) {
3968 return putStringForUser(resolver, name, value, UserHandle.myUserId());
3969 }
3970
3971 /** @hide */
3972 public static boolean putStringForUser(ContentResolver resolver, String name, String value,
3973 int userHandle) {
Julia Reynolds82735bc2014-09-04 16:43:30 -04003974 if (LOCATION_MODE.equals(name)) {
3975 // HACK ALERT: temporary hack to work around b/10491283.
3976 // TODO: once b/10491283 fixed, remove this hack
3977 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
3978 }
Christopher Tate06efb532012-08-24 15:29:27 -07003979 if (MOVED_TO_GLOBAL.contains(name)) {
3980 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
3981 + " to android.provider.Settings.Global");
3982 return Global.putStringForUser(resolver, name, value, userHandle);
3983 }
Christopher Tate06efb532012-08-24 15:29:27 -07003984 return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003985 }
3986
3987 /**
3988 * Construct the content URI for a particular name/value pair,
3989 * useful for monitoring changes with a ContentObserver.
3990 * @param name to look up in the table
3991 * @return the corresponding content URI, or null if not present
3992 */
3993 public static Uri getUriFor(String name) {
Christopher Tate06efb532012-08-24 15:29:27 -07003994 if (MOVED_TO_GLOBAL.contains(name)) {
3995 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
3996 + " to android.provider.Settings.Global, returning global URI.");
3997 return Global.getUriFor(Global.CONTENT_URI, name);
3998 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003999 return getUriFor(CONTENT_URI, name);
4000 }
4001
4002 /**
4003 * Convenience function for retrieving a single secure settings value
4004 * as an integer. Note that internally setting values are always
4005 * stored as strings; this function converts the string to an integer
4006 * for you. The default value will be returned if the setting is
4007 * not defined or not an integer.
4008 *
4009 * @param cr The ContentResolver to access.
4010 * @param name The name of the setting to retrieve.
4011 * @param def Value to return if the setting is not defined.
4012 *
4013 * @return The setting's current value, or 'def' if it is not defined
4014 * or not a valid integer.
4015 */
4016 public static int getInt(ContentResolver cr, String name, int def) {
Christopher Tate06efb532012-08-24 15:29:27 -07004017 return getIntForUser(cr, name, def, UserHandle.myUserId());
4018 }
4019
4020 /** @hide */
4021 public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
Tom O'Neill7f6f4572013-08-27 10:53:15 -07004022 if (LOCATION_MODE.equals(name)) {
4023 // HACK ALERT: temporary hack to work around b/10491283.
4024 // TODO: once b/10491283 fixed, remove this hack
4025 return getLocationModeForUser(cr, userHandle);
4026 }
Christopher Tate06efb532012-08-24 15:29:27 -07004027 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004028 try {
4029 return v != null ? Integer.parseInt(v) : def;
4030 } catch (NumberFormatException e) {
4031 return def;
4032 }
4033 }
4034
4035 /**
4036 * Convenience function for retrieving a single secure settings value
4037 * as an integer. Note that internally setting values are always
4038 * stored as strings; this function converts the string to an integer
4039 * for you.
4040 * <p>
4041 * This version does not take a default value. If the setting has not
4042 * been set, or the string value is not a number,
4043 * it throws {@link SettingNotFoundException}.
4044 *
4045 * @param cr The ContentResolver to access.
4046 * @param name The name of the setting to retrieve.
4047 *
4048 * @throws SettingNotFoundException Thrown if a setting by the given
4049 * name can't be found or the setting value is not an integer.
4050 *
4051 * @return The setting's current value.
4052 */
4053 public static int getInt(ContentResolver cr, String name)
4054 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07004055 return getIntForUser(cr, name, UserHandle.myUserId());
4056 }
4057
4058 /** @hide */
4059 public static int getIntForUser(ContentResolver cr, String name, int userHandle)
4060 throws SettingNotFoundException {
Tom O'Neill7f6f4572013-08-27 10:53:15 -07004061 if (LOCATION_MODE.equals(name)) {
4062 // HACK ALERT: temporary hack to work around b/10491283.
4063 // TODO: once b/10491283 fixed, remove this hack
4064 return getLocationModeForUser(cr, userHandle);
4065 }
Christopher Tate06efb532012-08-24 15:29:27 -07004066 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004067 try {
4068 return Integer.parseInt(v);
4069 } catch (NumberFormatException e) {
4070 throw new SettingNotFoundException(name);
4071 }
4072 }
4073
4074 /**
4075 * Convenience function for updating a single settings value as an
4076 * integer. This will either create a new entry in the table if the
4077 * given name does not exist, or modify the value of the existing row
4078 * with that name. Note that internally setting values are always
4079 * stored as strings, so this function converts the given value to a
4080 * string before storing it.
4081 *
4082 * @param cr The ContentResolver to access.
4083 * @param name The name of the setting to modify.
4084 * @param value The new value for the setting.
4085 * @return true if the value was set, false on database errors
4086 */
4087 public static boolean putInt(ContentResolver cr, String name, int value) {
Christopher Tate06efb532012-08-24 15:29:27 -07004088 return putIntForUser(cr, name, value, UserHandle.myUserId());
4089 }
4090
4091 /** @hide */
4092 public static boolean putIntForUser(ContentResolver cr, String name, int value,
4093 int userHandle) {
4094 return putStringForUser(cr, name, Integer.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004095 }
4096
4097 /**
4098 * Convenience function for retrieving a single secure settings value
4099 * as a {@code long}. Note that internally setting values are always
4100 * stored as strings; this function converts the string to a {@code long}
4101 * for you. The default value will be returned if the setting is
4102 * not defined or not a {@code long}.
4103 *
4104 * @param cr The ContentResolver to access.
4105 * @param name The name of the setting to retrieve.
4106 * @param def Value to return if the setting is not defined.
4107 *
4108 * @return The setting's current value, or 'def' if it is not defined
4109 * or not a valid {@code long}.
4110 */
4111 public static long getLong(ContentResolver cr, String name, long def) {
Christopher Tate06efb532012-08-24 15:29:27 -07004112 return getLongForUser(cr, name, def, UserHandle.myUserId());
4113 }
4114
4115 /** @hide */
4116 public static long getLongForUser(ContentResolver cr, String name, long def,
4117 int userHandle) {
4118 String valString = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004119 long value;
4120 try {
4121 value = valString != null ? Long.parseLong(valString) : def;
4122 } catch (NumberFormatException e) {
4123 value = def;
4124 }
4125 return value;
4126 }
4127
4128 /**
4129 * Convenience function for retrieving a single secure settings value
4130 * as a {@code long}. Note that internally setting values are always
4131 * stored as strings; this function converts the string to a {@code long}
4132 * for you.
4133 * <p>
4134 * This version does not take a default value. If the setting has not
4135 * been set, or the string value is not a number,
4136 * it throws {@link SettingNotFoundException}.
4137 *
4138 * @param cr The ContentResolver to access.
4139 * @param name The name of the setting to retrieve.
4140 *
4141 * @return The setting's current value.
4142 * @throws SettingNotFoundException Thrown if a setting by the given
4143 * name can't be found or the setting value is not an integer.
4144 */
4145 public static long getLong(ContentResolver cr, String name)
4146 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07004147 return getLongForUser(cr, name, UserHandle.myUserId());
4148 }
4149
4150 /** @hide */
4151 public static long getLongForUser(ContentResolver cr, String name, int userHandle)
4152 throws SettingNotFoundException {
4153 String valString = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004154 try {
4155 return Long.parseLong(valString);
4156 } catch (NumberFormatException e) {
4157 throw new SettingNotFoundException(name);
4158 }
4159 }
4160
4161 /**
4162 * Convenience function for updating a secure settings value as a long
4163 * integer. This will either create a new entry in the table if the
4164 * given name does not exist, or modify the value of the existing row
4165 * with that name. Note that internally setting values are always
4166 * stored as strings, so this function converts the given value to a
4167 * string before storing it.
4168 *
4169 * @param cr The ContentResolver to access.
4170 * @param name The name of the setting to modify.
4171 * @param value The new value for the setting.
4172 * @return true if the value was set, false on database errors
4173 */
4174 public static boolean putLong(ContentResolver cr, String name, long value) {
Christopher Tate06efb532012-08-24 15:29:27 -07004175 return putLongForUser(cr, name, value, UserHandle.myUserId());
4176 }
4177
4178 /** @hide */
4179 public static boolean putLongForUser(ContentResolver cr, String name, long value,
4180 int userHandle) {
4181 return putStringForUser(cr, name, Long.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004182 }
4183
4184 /**
4185 * Convenience function for retrieving a single secure settings value
4186 * as a floating point number. Note that internally setting values are
4187 * always stored as strings; this function converts the string to an
4188 * float for you. The default value will be returned if the setting
4189 * is not defined or not a valid float.
4190 *
4191 * @param cr The ContentResolver to access.
4192 * @param name The name of the setting to retrieve.
4193 * @param def Value to return if the setting is not defined.
4194 *
4195 * @return The setting's current value, or 'def' if it is not defined
4196 * or not a valid float.
4197 */
4198 public static float getFloat(ContentResolver cr, String name, float def) {
Christopher Tate06efb532012-08-24 15:29:27 -07004199 return getFloatForUser(cr, name, def, UserHandle.myUserId());
4200 }
4201
4202 /** @hide */
4203 public static float getFloatForUser(ContentResolver cr, String name, float def,
4204 int userHandle) {
4205 String v = getStringForUser(cr, name, userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004206 try {
4207 return v != null ? Float.parseFloat(v) : def;
4208 } catch (NumberFormatException e) {
4209 return def;
4210 }
4211 }
4212
4213 /**
4214 * Convenience function for retrieving a single secure settings value
4215 * as a float. Note that internally setting values are always
4216 * stored as strings; this function converts the string to a float
4217 * for you.
4218 * <p>
4219 * This version does not take a default value. If the setting has not
4220 * been set, or the string value is not a number,
4221 * it throws {@link SettingNotFoundException}.
4222 *
4223 * @param cr The ContentResolver to access.
4224 * @param name The name of the setting to retrieve.
4225 *
4226 * @throws SettingNotFoundException Thrown if a setting by the given
4227 * name can't be found or the setting value is not a float.
4228 *
4229 * @return The setting's current value.
4230 */
4231 public static float getFloat(ContentResolver cr, String name)
4232 throws SettingNotFoundException {
Christopher Tate06efb532012-08-24 15:29:27 -07004233 return getFloatForUser(cr, name, UserHandle.myUserId());
4234 }
4235
4236 /** @hide */
4237 public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
4238 throws SettingNotFoundException {
4239 String v = getStringForUser(cr, name, userHandle);
Brian Muramatsue1d46982010-12-06 17:34:20 -08004240 if (v == null) {
4241 throw new SettingNotFoundException(name);
4242 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004243 try {
4244 return Float.parseFloat(v);
4245 } catch (NumberFormatException e) {
4246 throw new SettingNotFoundException(name);
4247 }
4248 }
4249
4250 /**
4251 * Convenience function for updating a single settings value as a
4252 * floating point number. This will either create a new entry in the
4253 * table if the given name does not exist, or modify the value of the
4254 * existing row with that name. Note that internally setting values
4255 * are always stored as strings, so this function converts the given
4256 * value to a string before storing it.
4257 *
4258 * @param cr The ContentResolver to access.
4259 * @param name The name of the setting to modify.
4260 * @param value The new value for the setting.
4261 * @return true if the value was set, false on database errors
4262 */
4263 public static boolean putFloat(ContentResolver cr, String name, float value) {
Christopher Tate06efb532012-08-24 15:29:27 -07004264 return putFloatForUser(cr, name, value, UserHandle.myUserId());
4265 }
4266
4267 /** @hide */
4268 public static boolean putFloatForUser(ContentResolver cr, String name, float value,
4269 int userHandle) {
4270 return putStringForUser(cr, name, Float.toString(value), userHandle);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004271 }
4272
4273 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004274 * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
4275 * instead
Dianne Hackborn895f99e2012-02-02 11:49:12 -08004276 */
Christopher Tate06efb532012-08-24 15:29:27 -07004277 @Deprecated
4278 public static final String DEVELOPMENT_SETTINGS_ENABLED =
4279 Global.DEVELOPMENT_SETTINGS_ENABLED;
Dianne Hackborn895f99e2012-02-02 11:49:12 -08004280
4281 /**
Dianne Hackborn5773bfdb2012-07-13 13:24:15 -07004282 * When the user has enable the option to have a "bug report" command
4283 * in the power menu.
Christopher Tate58f41ec2013-01-11 15:40:36 -08004284 * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
Dianne Hackborn5773bfdb2012-07-13 13:24:15 -07004285 * @hide
4286 */
Christopher Tate58f41ec2013-01-11 15:40:36 -08004287 @Deprecated
Dianne Hackborn5773bfdb2012-07-13 13:24:15 -07004288 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
4289
4290 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004291 * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004292 */
Christopher Tate06efb532012-08-24 15:29:27 -07004293 @Deprecated
4294 public static final String ADB_ENABLED = Global.ADB_ENABLED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004295
4296 /**
4297 * Setting to allow mock locations and location provider status to be injected into the
4298 * LocationManager service for testing purposes during application development. These
4299 * locations and status values override actual location and status information generated
4300 * by network, gps, or other location providers.
Svet Ganovf7e9cf42015-05-13 10:40:31 -07004301 *
4302 * @deprecated This settings is not used anymore.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004303 */
Svet Ganovf7e9cf42015-05-13 10:40:31 -07004304 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004305 public static final String ALLOW_MOCK_LOCATION = "mock_location";
4306
4307 /**
Doug Zongkerd8893db2010-01-26 12:29:44 -08004308 * A 64-bit number (as a hex string) that is randomly
Scott Main44895332013-11-12 09:23:13 -08004309 * generated when the user first sets up the device and should remain
4310 * constant for the lifetime of the user's device. The value may
4311 * change if a factory reset is performed on the device.
4312 * <p class="note"><strong>Note:</strong> When a device has <a
4313 * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a>
4314 * (available on certain devices running Android 4.2 or higher), each user appears as a
4315 * completely separate device, so the {@code ANDROID_ID} value is unique to each
4316 * user.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004317 */
4318 public static final String ANDROID_ID = "android_id";
4319
4320 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004321 * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004322 */
Christopher Tate06efb532012-08-24 15:29:27 -07004323 @Deprecated
4324 public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004325
4326 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004327 * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004328 */
Jeff Sharkeybdfce2e2012-09-26 15:54:06 -07004329 @Deprecated
Christopher Tate06efb532012-08-24 15:29:27 -07004330 public static final String DATA_ROAMING = Global.DATA_ROAMING;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004331
4332 /**
4333 * Setting to record the input method used by default, holding the ID
4334 * of the desired method.
4335 */
4336 public static final String DEFAULT_INPUT_METHOD = "default_input_method";
4337
4338 /**
satokab751aa2010-09-14 19:17:36 +09004339 * Setting to record the input method subtype used by default, holding the ID
4340 * of the desired method.
4341 */
4342 public static final String SELECTED_INPUT_METHOD_SUBTYPE =
4343 "selected_input_method_subtype";
4344
4345 /**
satok723a27e2010-11-11 14:58:11 +09004346 * Setting to record the history of input method subtype, holding the pair of ID of IME
4347 * and its last used subtype.
4348 * @hide
4349 */
4350 public static final String INPUT_METHODS_SUBTYPE_HISTORY =
4351 "input_methods_subtype_history";
4352
4353 /**
satok5c58dfc2010-12-14 21:54:47 +09004354 * Setting to record the visibility of input method selector
4355 */
4356 public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
4357 "input_method_selector_visibility";
4358
4359 /**
Dianne Hackborn91097de2014-04-04 18:02:06 -07004360 * The currently selected voice interaction service flattened ComponentName.
4361 * @hide
4362 */
4363 public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
4364
4365 /**
Zhihai Xuaf5971e2013-06-10 20:28:31 -07004366 * bluetooth HCI snoop log configuration
4367 * @hide
4368 */
4369 public static final String BLUETOOTH_HCI_LOG =
4370 "bluetooth_hci_log";
4371
4372 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004373 * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004374 */
Christopher Tate06efb532012-08-24 15:29:27 -07004375 @Deprecated
4376 public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004377
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004378 /**
Russell Brennerde6ae442012-09-26 20:53:10 -07004379 * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
4380 * @hide
4381 */
4382 public static final String USER_SETUP_COMPLETE = "user_setup_complete";
4383
4384 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004385 * List of input methods that are currently enabled. This is a string
4386 * containing the IDs of all enabled input methods, each ID separated
4387 * by ':'.
4388 */
4389 public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004390
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004391 /**
Amith Yamasanie861ec12010-03-24 21:39:27 -07004392 * List of system input methods that are currently disabled. This is a string
4393 * containing the IDs of all disabled input methods, each ID separated
4394 * by ':'.
4395 * @hide
4396 */
4397 public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
4398
4399 /**
Michael Wright7b5a96b2014-08-09 19:28:42 -07004400 * Whether to show the IME when a hard keyboard is connected. This is a boolean that
4401 * determines if the IME should be shown when a hard keyboard is attached.
4402 * @hide
4403 */
4404 public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
4405
4406 /**
Jeff Sharkey625239a2012-09-26 22:03:49 -07004407 * Host name and port for global http proxy. Uses ':' seperator for
4408 * between host and port.
4409 *
4410 * @deprecated Use {@link Global#HTTP_PROXY}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004411 */
Jeff Sharkey625239a2012-09-26 22:03:49 -07004412 @Deprecated
4413 public static final String HTTP_PROXY = Global.HTTP_PROXY;
Robert Greenwalte90aa5e2010-09-01 11:34:05 -07004414
4415 /**
Christopher Tateaa036a22014-05-19 16:33:27 -07004416 * Whether applications can be installed for this user via the system's
4417 * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
4418 *
4419 * <p>1 = permit app installation via the system package installer intent
4420 * <p>0 = do not allow use of the package installer
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004421 */
Christopher Tateaa036a22014-05-19 16:33:27 -07004422 public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004423
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004424 /**
Tom O'Neill923c0dc2014-03-03 11:07:55 -08004425 * Comma-separated list of location providers that activities may access. Do not rely on
4426 * this value being present in settings.db or on ContentObserver notifications on the
4427 * corresponding Uri.
Tom O'Neilla324ac72013-08-26 14:40:23 -07004428 *
Tom O'Neill923c0dc2014-03-03 11:07:55 -08004429 * @deprecated use {@link #LOCATION_MODE} and
4430 * {@link LocationManager#MODE_CHANGED_ACTION} (or
4431 * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004432 */
Tom O'Neilla324ac72013-08-26 14:40:23 -07004433 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004434 public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004435
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004436 /**
Tom O'Neill7f6f4572013-08-27 10:53:15 -07004437 * The degree of location access enabled by the user.
Tom O'Neill923c0dc2014-03-03 11:07:55 -08004438 * <p>
Tom O'Neill7f6f4572013-08-27 10:53:15 -07004439 * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
4440 * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
4441 * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
4442 * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
4443 * modes that might be added in the future.
Tom O'Neill923c0dc2014-03-03 11:07:55 -08004444 * <p>
4445 * Note: do not rely on this value being present in settings.db or on ContentObserver
4446 * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
4447 * to receive changes in this value.
Tom O'Neilla324ac72013-08-26 14:40:23 -07004448 */
4449 public static final String LOCATION_MODE = "location_mode";
Lifu Tangd1fa1d62015-11-25 21:42:44 -08004450 /**
4451 * Stores the previous location mode when {@link #LOCATION_MODE} is set to
4452 * {@link #LOCATION_MODE_OFF}
4453 * @hide
4454 */
4455 public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
Tom O'Neilla324ac72013-08-26 14:40:23 -07004456
4457 /**
Lifu Tangd1fa1d62015-11-25 21:42:44 -08004458 * Sets all location providers to the previous states before location was turned off.
4459 * @hide
4460 */
4461 public static final int LOCATION_MODE_PREVIOUS = -1;
4462 /**
Tom O'Neill7f6f4572013-08-27 10:53:15 -07004463 * Location access disabled.
Tom O'Neill1f48b782013-08-19 18:14:56 -07004464 */
4465 public static final int LOCATION_MODE_OFF = 0;
4466 /**
4467 * Network Location Provider disabled, but GPS and other sensors enabled.
4468 */
4469 public static final int LOCATION_MODE_SENSORS_ONLY = 1;
4470 /**
Tom O'Neilld5759432013-09-11 11:03:03 -07004471 * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
4472 * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
4473 * {@link android.location.Criteria#POWER_MEDIUM}.
Tom O'Neill1f48b782013-08-19 18:14:56 -07004474 */
4475 public static final int LOCATION_MODE_BATTERY_SAVING = 2;
4476 /**
4477 * Best-effort location computation allowed.
4478 */
4479 public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
4480
4481 /**
Danielle Millett925a7d82012-03-19 18:02:20 -04004482 * A flag containing settings used for biometric weak
4483 * @hide
4484 */
Adrian Roos230635e2015-01-07 20:50:29 +01004485 @Deprecated
Danielle Millett925a7d82012-03-19 18:02:20 -04004486 public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
4487 "lock_biometric_weak_flags";
4488
4489 /**
Jason Monk94cfd9d2014-10-31 13:18:21 -04004490 * Whether lock-to-app will lock the keyguard when exiting.
4491 * @hide
4492 */
4493 public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
4494
4495 /**
Amith Yamasani156c4352010-03-05 17:10:03 -08004496 * Whether autolock is enabled (0 = false, 1 = true)
Adrian Roos9dd16eb2015-01-08 16:20:49 +01004497 *
4498 * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
Adrian Roos7811d9f2015-07-27 15:10:13 -07004499 * level of the keyguard. Accessing this setting from an app that is targeting
Deepanshu Guptae836a222015-07-31 12:11:07 -07004500 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
Amith Yamasani156c4352010-03-05 17:10:03 -08004501 */
Adrian Roos9dd16eb2015-01-08 16:20:49 +01004502 @Deprecated
Amith Yamasani156c4352010-03-05 17:10:03 -08004503 public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
4504
4505 /**
4506 * Whether lock pattern is visible as user enters (0 = false, 1 = true)
Adrian Roos7811d9f2015-07-27 15:10:13 -07004507 *
4508 * @deprecated Accessing this setting from an app that is targeting
Deepanshu Guptae836a222015-07-31 12:11:07 -07004509 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
Amith Yamasani156c4352010-03-05 17:10:03 -08004510 */
Adrian Roos7811d9f2015-07-27 15:10:13 -07004511 @Deprecated
Amith Yamasani156c4352010-03-05 17:10:03 -08004512 public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
4513
4514 /**
Jeff Sharkey5ed9d682012-10-10 14:28:27 -07004515 * Whether lock pattern will vibrate as user enters (0 = false, 1 =
4516 * true)
4517 *
4518 * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
4519 * lockscreen uses
4520 * {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
Adrian Roos7811d9f2015-07-27 15:10:13 -07004521 * Accessing this setting from an app that is targeting
Deepanshu Guptae836a222015-07-31 12:11:07 -07004522 * {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
Amith Yamasani156c4352010-03-05 17:10:03 -08004523 */
Jeff Sharkey5ed9d682012-10-10 14:28:27 -07004524 @Deprecated
4525 public static final String
4526 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
Amith Yamasani156c4352010-03-05 17:10:03 -08004527
4528 /**
Jim Millerbc4603b2010-08-30 21:21:34 -07004529 * This preference allows the device to be locked given time after screen goes off,
4530 * subject to current DeviceAdmin policy limits.
4531 * @hide
4532 */
4533 public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
4534
4535
4536 /**
John Spurlock5f050e52012-10-27 10:44:19 -04004537 * This preference contains the string that shows for owner info on LockScreen.
Jim Miller253a5ef2010-10-13 20:57:29 -07004538 * @hide
Jim Miller187ec582013-04-15 18:27:54 -07004539 * @deprecated
Jim Miller253a5ef2010-10-13 20:57:29 -07004540 */
4541 public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
4542
4543 /**
John Spurlock5f050e52012-10-27 10:44:19 -04004544 * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
Jim Millerf229e4d2012-09-12 20:32:50 -07004545 * @hide
4546 */
Adrian Roos230635e2015-01-07 20:50:29 +01004547 @Deprecated
Michael Jurkaaa2859a2012-10-24 12:46:49 -07004548 public static final String LOCK_SCREEN_APPWIDGET_IDS =
4549 "lock_screen_appwidget_ids";
Jim Millerf229e4d2012-09-12 20:32:50 -07004550
4551 /**
Jim Miller51117262012-11-04 17:58:09 -08004552 * Id of the appwidget shown on the lock screen when appwidgets are disabled.
4553 * @hide
4554 */
Adrian Roos230635e2015-01-07 20:50:29 +01004555 @Deprecated
Jim Miller51117262012-11-04 17:58:09 -08004556 public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
4557 "lock_screen_fallback_appwidget_id";
4558
4559 /**
John Spurlock5f050e52012-10-27 10:44:19 -04004560 * Index of the lockscreen appwidget to restore, -1 if none.
4561 * @hide
4562 */
Adrian Roos230635e2015-01-07 20:50:29 +01004563 @Deprecated
John Spurlock5f050e52012-10-27 10:44:19 -04004564 public static final String LOCK_SCREEN_STICKY_APPWIDGET =
4565 "lock_screen_sticky_appwidget";
4566
4567 /**
4568 * This preference enables showing the owner info on LockScreen.
Jim Miller253a5ef2010-10-13 20:57:29 -07004569 * @hide
Jim Miller187ec582013-04-15 18:27:54 -07004570 * @deprecated
Jim Miller253a5ef2010-10-13 20:57:29 -07004571 */
4572 public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
4573 "lock_screen_owner_info_enabled";
4574
4575 /**
Dan Sandler5d7c3cc2014-02-18 17:35:15 -05004576 * When set by a user, allows notifications to be shown atop a securely locked screen
4577 * in their full "private" form (same as when the device is unlocked).
Dan Sandlerfd16d562014-02-13 18:43:31 -08004578 * @hide
4579 */
4580 public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
4581 "lock_screen_allow_private_notifications";
4582
4583 /**
Chris Wrencd8f4f72014-08-27 18:48:13 -04004584 * Set by the system to track if the user needs to see the call to action for
4585 * the lockscreen notification policy.
4586 * @hide
4587 */
4588 public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
4589 "show_note_about_notification_hiding";
4590
4591 /**
Adrian Roos3870d452014-09-05 18:22:28 +02004592 * Set to 1 by the system after trust agents have been initialized.
4593 * @hide
4594 */
4595 public static final String TRUST_AGENTS_INITIALIZED =
4596 "trust_agents_initialized";
4597
4598 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004599 * The Logging ID (a unique 64-bit value) as a hex string.
4600 * Used as a pseudonymous identifier for logging.
4601 * @deprecated This identifier is poorly initialized and has
4602 * many collisions. It should not be used.
4603 */
4604 @Deprecated
4605 public static final String LOGGING_ID = "logging_id";
4606
4607 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004608 * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004609 */
Christopher Tate06efb532012-08-24 15:29:27 -07004610 @Deprecated
4611 public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004612
4613 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08004614 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004615 */
4616 public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004617
4618 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08004619 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004620 */
4621 public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004622
4623 /**
Dan Egnor1c9131c2010-02-13 10:38:55 -08004624 * No longer supported.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004625 */
4626 public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004627
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004628 /**
4629 * Settings classname to launch when Settings is clicked from All
4630 * Applications. Needed because of user testing between the old
4631 * and new Settings apps.
4632 */
4633 // TODO: 881807
4634 public static final String SETTINGS_CLASSNAME = "settings_classname";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004635
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004636 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004637 * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004638 */
Christopher Tate06efb532012-08-24 15:29:27 -07004639 @Deprecated
4640 public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004642 /**
Christopher Tate06efb532012-08-24 15:29:27 -07004643 * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004644 */
Christopher Tate06efb532012-08-24 15:29:27 -07004645 @Deprecated
4646 public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07004647
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08004648 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07004649 * If accessibility is enabled.
4650 */
4651 public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
4652
4653 /**
Svetoslav Ganov00aabf72011-07-21 11:35:03 -07004654 * If touch exploration is enabled.
Svetoslav Ganov35bfede2011-07-14 17:57:06 -07004655 */
Svetoslav Ganov00aabf72011-07-21 11:35:03 -07004656 public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
Svetoslav Ganov35bfede2011-07-14 17:57:06 -07004657
4658 /**
svetoslavganov75986cf2009-05-14 22:28:01 -07004659 * List of the enabled accessibility providers.
4660 */
4661 public static final String ENABLED_ACCESSIBILITY_SERVICES =
4662 "enabled_accessibility_services";
4663
4664 /**
Svetoslav Ganov7befb7d2012-09-27 16:49:23 -07004665 * List of the accessibility services to which the user has granted
Svetoslav Ganov9a4c5cd2012-05-30 14:06:32 -07004666 * permission to put the device into touch exploration mode.
4667 *
4668 * @hide
4669 */
4670 public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
4671 "touch_exploration_granted_accessibility_services";
4672
4673 /**
Svetoslav Ganov55f937a2011-12-05 11:42:07 -08004674 * Whether to speak passwords while in accessibility mode.
4675 */
4676 public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
4677
4678 /**
Chris Craikcce47eb2014-07-16 15:12:15 -07004679 * Whether to draw text with high contrast while in accessibility mode.
4680 *
4681 * @hide
4682 */
4683 public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
4684 "high_text_contrast_enabled";
4685
4686 /**
Svetoslav Ganov3ca5a742011-12-06 15:24:37 -08004687 * If injection of accessibility enhancing JavaScript screen-reader
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07004688 * is enabled.
4689 * <p>
Svetoslav Ganov3ca5a742011-12-06 15:24:37 -08004690 * Note: The JavaScript based screen-reader is served by the
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07004691 * Google infrastructure and enable users with disabilities to
Svetoslav Ganov7befb7d2012-09-27 16:49:23 -07004692 * efficiently navigate in and explore web content.
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07004693 * </p>
4694 * <p>
4695 * This property represents a boolean value.
4696 * </p>
4697 * @hide
4698 */
4699 public static final String ACCESSIBILITY_SCRIPT_INJECTION =
4700 "accessibility_script_injection";
4701
4702 /**
Svetoslav Ganov3ca5a742011-12-06 15:24:37 -08004703 * The URL for the injected JavaScript based screen-reader used
Svetoslav Ganov7befb7d2012-09-27 16:49:23 -07004704 * for providing accessibility of content in WebView.
Svetoslav Ganov3ca5a742011-12-06 15:24:37 -08004705 * <p>
4706 * Note: The JavaScript based screen-reader is served by the
4707 * Google infrastructure and enable users with disabilities to
4708 * efficiently navigate in and explore web content.
4709 * </p>
4710 * <p>
4711 * This property represents a string value.
4712 * </p>
4713 * @hide
4714 */
4715 public static final String ACCESSIBILITY_SCREEN_READER_URL =
4716 "accessibility_script_injection_url";
4717
4718 /**
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07004719 * Key bindings for navigation in built-in accessibility support for web content.
4720 * <p>
4721 * Note: These key bindings are for the built-in accessibility navigation for
4722 * web content which is used as a fall back solution if JavaScript in a WebView
4723 * is not enabled or the user has not opted-in script injection from Google.
4724 * </p>
4725 * <p>
4726 * The bindings are separated by semi-colon. A binding is a mapping from
4727 * a key to a sequence of actions (for more details look at
4728 * android.webkit.AccessibilityInjector). A key is represented as the hexademical
4729 * string representation of an integer obtained from a meta state (optional) shifted
4730 * sixteen times left and bitwise ored with a key code. An action is represented
4731 * as a hexademical string representation of an integer where the first two digits
4732 * are navigation action index, the second, the third, and the fourth digit pairs
4733 * represent the action arguments. The separate actions in a binding are colon
4734 * separated. The key and the action sequence it maps to are separated by equals.
4735 * </p>
4736 * <p>
4737 * For example, the binding below maps the DPAD right button to traverse the
4738 * current navigation axis once without firing an accessibility event and to
4739 * perform the same traversal again but to fire an event:
4740 * <code>
4741 * 0x16=0x01000100:0x01000101;
4742 * </code>
4743 * </p>
4744 * <p>
4745 * The goal of this binding is to enable dynamic rebinding of keys to
4746 * navigation actions for web content without requiring a framework change.
4747 * </p>
4748 * <p>
4749 * This property represents a string value.
4750 * </p>
4751 * @hide
4752 */
4753 public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
4754 "accessibility_web_content_key_bindings";
4755
4756 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07004757 * Setting that specifies whether the display magnification is enabled.
4758 * Display magnifications allows the user to zoom in the display content
4759 * and is targeted to low vision users. The current magnification scale
4760 * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
4761 *
4762 * @hide
4763 */
4764 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
4765 "accessibility_display_magnification_enabled";
4766
4767 /**
4768 * Setting that specifies what the display magnification scale is.
4769 * Display magnifications allows the user to zoom in the display
4770 * content and is targeted to low vision users. Whether a display
4771 * magnification is performed is controlled by
4772 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
4773 *
4774 * @hide
4775 */
4776 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
4777 "accessibility_display_magnification_scale";
4778
4779 /**
4780 * Setting that specifies whether the display magnification should be
4781 * automatically updated. If this fearture is enabled the system will
4782 * exit magnification mode or pan the viewport when a context change
4783 * occurs. For example, on staring a new activity or rotating the screen,
4784 * the system may zoom out so the user can see the new context he is in.
4785 * Another example is on showing a window that is not visible in the
4786 * magnified viewport the system may pan the viewport to make the window
4787 * the has popped up so the user knows that the context has changed.
4788 * Whether a screen magnification is performed is controlled by
4789 * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
4790 *
4791 * @hide
4792 */
4793 public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
4794 "accessibility_display_magnification_auto_update";
4795
4796 /**
Alan Viveretteef793802013-07-23 14:15:28 -07004797 * Setting that specifies whether timed text (captions) should be
4798 * displayed in video content. Text display properties are controlled by
4799 * the following settings:
4800 * <ul>
4801 * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
4802 * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
4803 * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
4804 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
4805 * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
4806 * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
Alan Viverette69ce69b2013-08-29 12:23:48 -07004807 * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
Alan Viveretteef793802013-07-23 14:15:28 -07004808 * </ul>
4809 *
4810 * @hide
4811 */
4812 public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
4813 "accessibility_captioning_enabled";
4814
4815 /**
4816 * Setting that specifies the language for captions as a locale string,
4817 * e.g. en_US.
4818 *
4819 * @see java.util.Locale#toString
4820 * @hide
4821 */
4822 public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
4823 "accessibility_captioning_locale";
4824
4825 /**
Alan Viverette43a1e3d2013-08-02 16:45:03 -07004826 * Integer property that specifies the preset style for captions, one
4827 * of:
4828 * <ul>
Alan Viverette69ce69b2013-08-29 12:23:48 -07004829 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
4830 * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
Alan Viverette43a1e3d2013-08-02 16:45:03 -07004831 * </ul>
4832 *
4833 * @see java.util.Locale#toString
4834 * @hide
4835 */
4836 public static final String ACCESSIBILITY_CAPTIONING_PRESET =
4837 "accessibility_captioning_preset";
4838
4839 /**
Alan Viveretteef793802013-07-23 14:15:28 -07004840 * Integer property that specifes the background color for captions as a
4841 * packed 32-bit color.
4842 *
4843 * @see android.graphics.Color#argb
4844 * @hide
4845 */
4846 public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
4847 "accessibility_captioning_background_color";
4848
4849 /**
4850 * Integer property that specifes the foreground color for captions as a
4851 * packed 32-bit color.
4852 *
4853 * @see android.graphics.Color#argb
4854 * @hide
4855 */
4856 public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
4857 "accessibility_captioning_foreground_color";
4858
4859 /**
4860 * Integer property that specifes the edge type for captions, one of:
4861 * <ul>
Alan Viverette69ce69b2013-08-29 12:23:48 -07004862 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
4863 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
4864 * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
Alan Viveretteef793802013-07-23 14:15:28 -07004865 * </ul>
4866 *
4867 * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
4868 * @hide
4869 */
4870 public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
4871 "accessibility_captioning_edge_type";
4872
4873 /**
4874 * Integer property that specifes the edge color for captions as a
4875 * packed 32-bit color.
4876 *
4877 * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
4878 * @see android.graphics.Color#argb
4879 * @hide
4880 */
4881 public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
4882 "accessibility_captioning_edge_color";
4883
4884 /**
Alan Viverette55d70622013-12-11 15:22:14 -08004885 * Integer property that specifes the window color for captions as a
4886 * packed 32-bit color.
4887 *
4888 * @see android.graphics.Color#argb
4889 * @hide
4890 */
4891 public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
4892 "accessibility_captioning_window_color";
4893
4894 /**
Alan Viveretteef793802013-07-23 14:15:28 -07004895 * String property that specifies the typeface for captions, one of:
4896 * <ul>
4897 * <li>DEFAULT
4898 * <li>MONOSPACE
4899 * <li>SANS_SERIF
4900 * <li>SERIF
4901 * </ul>
4902 *
4903 * @see android.graphics.Typeface
4904 * @hide
4905 */
4906 public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
4907 "accessibility_captioning_typeface";
4908
4909 /**
Alan Viverette69ce69b2013-08-29 12:23:48 -07004910 * Floating point property that specifies font scaling for captions.
Alan Viveretteef793802013-07-23 14:15:28 -07004911 *
4912 * @hide
4913 */
Alan Viverette69ce69b2013-08-29 12:23:48 -07004914 public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
4915 "accessibility_captioning_font_scale";
Alan Viveretteef793802013-07-23 14:15:28 -07004916
4917 /**
Alan Viverette410d4e32013-09-30 15:37:38 -07004918 * Setting that specifies whether display color inversion is enabled.
Alan Viverette410d4e32013-09-30 15:37:38 -07004919 */
4920 public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
4921 "accessibility_display_inversion_enabled";
4922
4923 /**
Alan Viverette410d4e32013-09-30 15:37:38 -07004924 * Setting that specifies whether display color space adjustment is
4925 * enabled.
4926 *
4927 * @hide
4928 */
4929 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
4930 "accessibility_display_daltonizer_enabled";
4931
4932 /**
4933 * Integer property that specifies the type of color space adjustment to
4934 * perform. Valid values are defined in AccessibilityManager.
4935 *
4936 * @hide
4937 */
4938 public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
4939 "accessibility_display_daltonizer";
4940
4941 /**
Jason Monk08e7fa92015-12-07 20:05:08 -05004942 * Float list that specifies the color matrix to apply to
4943 * the display. Valid values are defined in AccessibilityManager.
4944 *
4945 * @hide
4946 */
4947 public static final String ACCESSIBILITY_DISPLAY_COLOR_MATRIX =
4948 "accessibility_display_color_matrix";
4949
4950 /**
Toni Barzic386f8342015-09-09 12:30:41 -07004951 * Setting that specifies whether automatic click when the mouse pointer stops moving is
4952 * enabled.
4953 *
4954 * @hide
4955 */
4956 public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
4957 "accessibility_autoclick_enabled";
4958
4959 /**
4960 * Integer setting specifying amount of time in ms the mouse pointer has to stay still
4961 * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
4962 *
4963 * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
4964 * @hide
4965 */
4966 public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
4967 "accessibility_autoclick_delay";
4968
4969 /**
Jun Mukai19a56012015-11-24 11:25:52 -08004970 * Whether or not larger size icons are used for the pointer of mouse/trackpad for
4971 * accessibility.
4972 * (0 = false, 1 = true)
4973 * @hide
4974 */
4975 public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
4976 "accessibility_large_pointer_icon";
4977
4978 /**
Toni Barzic386f8342015-09-09 12:30:41 -07004979 * The timeout for considering a press to be a long press in milliseconds.
Svetoslav Ganov54d068e2011-03-02 12:58:40 -08004980 * @hide
4981 */
4982 public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
4983
4984 /**
Svetoslav Ganov6bd20bc2013-09-02 15:24:45 -07004985 * List of the enabled print services.
Svetoslav Ganov4b9a4d12013-06-11 15:20:06 -07004986 * @hide
4987 */
4988 public static final String ENABLED_PRINT_SERVICES =
4989 "enabled_print_services";
4990
4991 /**
Svetoslav Ganov6bd20bc2013-09-02 15:24:45 -07004992 * List of the system print services we enabled on first boot. On
4993 * first boot we enable all system, i.e. bundled print services,
4994 * once, so they work out-of-the-box.
4995 * @hide
4996 */
4997 public static final String ENABLED_ON_FIRST_BOOT_SYSTEM_PRINT_SERVICES =
4998 "enabled_on_first_boot_system_print_services";
4999
5000 /**
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07005001 * Setting to always use the default text-to-speech settings regardless
5002 * of the application settings.
5003 * 1 = override application settings,
5004 * 0 = use application settings (if specified).
Narayan Kamath6d632962011-08-24 11:51:37 +01005005 *
5006 * @deprecated The value of this setting is no longer respected by
5007 * the framework text to speech APIs as of the Ice Cream Sandwich release.
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07005008 */
Narayan Kamath6d632962011-08-24 11:51:37 +01005009 @Deprecated
Jean-Michel Trivif62ba452009-06-04 14:55:24 -07005010 public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
5011
5012 /**
5013 * Default text-to-speech engine speech rate. 100 = 1x
5014 */
5015 public static final String TTS_DEFAULT_RATE = "tts_default_rate";
5016
5017 /**
5018 * Default text-to-speech engine pitch. 100 = 1x
5019 */
5020 public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
5021
5022 /**
5023 * Default text-to-speech engine.
5024 */
5025 public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
5026
5027 /**
Jean-Michel Trivif4782672009-06-09 16:22:48 -07005028 * Default text-to-speech language.
Narayan Kamath6d632962011-08-24 11:51:37 +01005029 *
5030 * @deprecated this setting is no longer in use, as of the Ice Cream
5031 * Sandwich release. Apps should never need to read this setting directly,
5032 * instead can query the TextToSpeech framework classes for the default
5033 * locale. {@link TextToSpeech#getLanguage()}.
Jean-Michel Trivif4782672009-06-09 16:22:48 -07005034 */
Narayan Kamath6d632962011-08-24 11:51:37 +01005035 @Deprecated
Jean-Michel Trivif4782672009-06-09 16:22:48 -07005036 public static final String TTS_DEFAULT_LANG = "tts_default_lang";
5037
5038 /**
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07005039 * Default text-to-speech country.
Narayan Kamath6d632962011-08-24 11:51:37 +01005040 *
5041 * @deprecated this setting is no longer in use, as of the Ice Cream
5042 * Sandwich release. Apps should never need to read this setting directly,
5043 * instead can query the TextToSpeech framework classes for the default
5044 * locale. {@link TextToSpeech#getLanguage()}.
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07005045 */
Narayan Kamath6d632962011-08-24 11:51:37 +01005046 @Deprecated
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07005047 public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
5048
5049 /**
5050 * Default text-to-speech locale variant.
Narayan Kamath6d632962011-08-24 11:51:37 +01005051 *
5052 * @deprecated this setting is no longer in use, as of the Ice Cream
5053 * Sandwich release. Apps should never need to read this setting directly,
5054 * instead can query the TextToSpeech framework classes for the
5055 * locale that is in use {@link TextToSpeech#getLanguage()}.
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07005056 */
Narayan Kamath6d632962011-08-24 11:51:37 +01005057 @Deprecated
Jean-Michel Trivia6fcc952009-06-19 14:06:01 -07005058 public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
5059
5060 /**
Narayan Kamathe5b8c4d2011-08-22 15:37:47 +01005061 * Stores the default tts locales on a per engine basis. Stored as
5062 * a comma seperated list of values, each value being of the form
5063 * {@code engine_name:locale} for example,
Narayan Kamath6d632962011-08-24 11:51:37 +01005064 * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
5065 * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
5066 * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
5067 * setting directly, and can query the TextToSpeech framework classes
5068 * for the locale that is in use.
Narayan Kamathe5b8c4d2011-08-22 15:37:47 +01005069 *
5070 * @hide
5071 */
5072 public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
5073
5074 /**
Charles Chenceffa152010-03-16 21:18:10 -07005075 * Space delimited list of plugin packages that are enabled.
5076 */
5077 public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
5078
5079 /**
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005080 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
5081 * instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005082 */
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005083 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005084 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005085 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005086
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005087 /**
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005088 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
5089 * instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005090 */
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005091 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005092 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005093 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005094
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005095 /**
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005096 * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
5097 * instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005098 */
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005099 @Deprecated
5100 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
5101 Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005102
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005103 /**
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005104 * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
5105 * instead.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005106 */
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005107 @Deprecated
5108 public static final String WIFI_ON = Global.WIFI_ON;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005110 /**
5111 * The acceptable packet loss percentage (range 0 - 100) before trying
5112 * another AP on the same network.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005113 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005114 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005115 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005116 public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
5117 "wifi_watchdog_acceptable_packet_loss_percentage";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005118
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005119 /**
5120 * The number of access points required for a network in order for the
5121 * watchdog to monitor it.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005122 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005123 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005124 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005125 public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005126
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005127 /**
5128 * The delay between background checks.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005129 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005130 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005131 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005132 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
5133 "wifi_watchdog_background_check_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005134
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005135 /**
5136 * Whether the Wi-Fi watchdog is enabled for background checking even
5137 * after it thinks the user has connected to a good access point.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005138 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005139 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005140 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005141 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
5142 "wifi_watchdog_background_check_enabled";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005143
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005144 /**
5145 * The timeout for a background ping
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005146 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005147 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005148 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005149 public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
5150 "wifi_watchdog_background_check_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005151
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005152 /**
5153 * The number of initial pings to perform that *may* be ignored if they
5154 * fail. Again, if these fail, they will *not* be used in packet loss
5155 * calculation. For example, one network always seemed to time out for
5156 * the first couple pings, so this is set to 3 by default.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005157 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005158 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005159 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005160 public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
5161 "wifi_watchdog_initial_ignored_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005162
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005163 /**
5164 * The maximum number of access points (per network) to attempt to test.
5165 * If this number is reached, the watchdog will no longer monitor the
5166 * initial connection state for the network. This is a safeguard for
5167 * networks containing multiple APs whose DNS does not respond to pings.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005168 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005169 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005170 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005171 public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005172
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005173 /**
Jeff Sharkeybdfce2e2012-09-26 15:54:06 -07005174 * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005175 */
Jeff Sharkeybdfce2e2012-09-26 15:54:06 -07005176 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005177 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
5178
5179 /**
5180 * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005181 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005182 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005183 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005184 public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
5185
5186 /**
5187 * The number of pings to test if an access point is a good connection.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005188 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005189 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005190 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005191 public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005192
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005193 /**
5194 * The delay between pings.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005195 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005196 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005197 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005198 public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005199
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005200 /**
5201 * The timeout per ping.
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005202 * @deprecated This setting is not used.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005203 */
Isaac Levyd7b3e6a2011-07-20 18:15:30 -07005204 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005205 public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005207 /**
Christopher Tate06efb532012-08-24 15:29:27 -07005208 * @deprecated Use
5209 * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005210 */
Christopher Tate06efb532012-08-24 15:29:27 -07005211 @Deprecated
5212 public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07005213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005214 /**
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005215 * @deprecated Use
5216 * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005217 */
Jeff Sharkeybdfce2e2012-09-26 15:54:06 -07005218 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005219 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005220 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005221
5222 /**
Jeremy Joslin79294842014-12-03 17:15:28 -08005223 * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
5224 * the receivers of the PendingIntent an opportunity to make a new network request before
5225 * the Network satisfying the request is potentially removed.
5226 *
5227 * @hide
5228 */
5229 public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
5230 "connectivity_release_pending_intent_delay_ms";
5231
5232 /**
Jeff Sharkey625239a2012-09-26 22:03:49 -07005233 * Whether background data usage is allowed.
5234 *
5235 * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
5236 * availability of background data depends on several
5237 * combined factors. When background data is unavailable,
5238 * {@link ConnectivityManager#getActiveNetworkInfo()} will
5239 * now appear disconnected.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005240 */
Jeff Sharkey3a844fc2011-08-16 14:37:57 -07005241 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08005242 public static final String BACKGROUND_DATA = "background_data";
Wink Saville04e71b32009-04-02 11:00:54 -07005243
5244 /**
Bjorn Bringert98bfa392010-03-24 10:59:48 +00005245 * Origins for which browsers should allow geolocation by default.
5246 * The value is a space-separated list of origins.
5247 */
5248 public static final String ALLOWED_GEOLOCATION_ORIGINS
5249 = "allowed_geolocation_origins";
5250
5251 /**
Wink Savillee9b06d72009-05-18 21:47:50 -07005252 * The preferred TTY mode 0 = TTy Off, CDMA default
5253 * 1 = TTY Full
5254 * 2 = TTY HCO
5255 * 3 = TTY VCO
5256 * @hide
5257 */
5258 public static final String PREFERRED_TTY_MODE =
5259 "preferred_tty_mode";
5260
Wink Saville04e71b32009-04-02 11:00:54 -07005261 /**
Wink Saville04e71b32009-04-02 11:00:54 -07005262 * Whether the enhanced voice privacy mode is enabled.
5263 * 0 = normal voice privacy
5264 * 1 = enhanced voice privacy
5265 * @hide
5266 */
5267 public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
5268
5269 /**
5270 * Whether the TTY mode mode is enabled.
5271 * 0 = disabled
5272 * 1 = enabled
5273 * @hide
5274 */
5275 public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005276
5277 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07005278 * Controls whether settings backup is enabled.
Dianne Hackborncf098292009-07-01 19:55:20 -07005279 * Type: int ( 0 = disabled, 1 = enabled )
5280 * @hide
5281 */
5282 public static final String BACKUP_ENABLED = "backup_enabled";
5283
5284 /**
Christopher Tatecce9da52010-02-03 15:11:15 -08005285 * Controls whether application data is automatically restored from backup
5286 * at install time.
5287 * Type: int ( 0 = disabled, 1 = enabled )
5288 * @hide
5289 */
5290 public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
5291
5292 /**
Christopher Tate8031a3d2009-07-06 16:36:05 -07005293 * Indicates whether settings backup has been fully provisioned.
5294 * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
5295 * @hide
5296 */
5297 public static final String BACKUP_PROVISIONED = "backup_provisioned";
5298
5299 /**
Dianne Hackborncf098292009-07-01 19:55:20 -07005300 * Component of the transport to use for backup/restore.
5301 * @hide
5302 */
5303 public static final String BACKUP_TRANSPORT = "backup_transport";
Sanjay Jeyakumar21bf2412009-07-09 13:31:48 -07005304
Dianne Hackbornd7cd29d2009-07-01 11:22:45 -07005305 /**
5306 * Version for which the setup wizard was last shown. Bumped for
5307 * each release when there is new setup information to show.
5308 * @hide
5309 */
5310 public static final String LAST_SETUP_SHOWN = "last_setup_shown";
Dianne Hackborncf098292009-07-01 19:55:20 -07005311
5312 /**
Doug Zongker43866e02010-01-07 12:09:54 -08005313 * The interval in milliseconds after which Wi-Fi is considered idle.
5314 * When idle, it is possible for the device to be switched from Wi-Fi to
5315 * the mobile data network.
5316 * @hide
Jeff Brownbf6f6f92012-09-25 15:03:20 -07005317 * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
5318 * instead.
Doug Zongker43866e02010-01-07 12:09:54 -08005319 */
Christopher Tate6f5a9a92012-09-14 17:24:28 -07005320 @Deprecated
5321 public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
Doug Zongker43866e02010-01-07 12:09:54 -08005322
5323 /**
Narayan Kamathee69ff42011-06-28 12:07:18 +01005324 * The global search provider chosen by the user (if multiple global
5325 * search providers are installed). This will be the provider returned
5326 * by {@link SearchManager#getGlobalSearchActivity()} if it's still
5327 * installed. This setting is stored as a flattened component name as
5328 * per {@link ComponentName#flattenToString()}.
5329 *
5330 * @hide
5331 */
5332 public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
5333 "search_global_search_activity";
5334
5335 /**
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08005336 * The number of promoted sources in GlobalSearch.
5337 * @hide
5338 */
5339 public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
5340 /**
5341 * The maximum number of suggestions returned by GlobalSearch.
5342 * @hide
5343 */
5344 public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
5345 /**
5346 * The number of suggestions GlobalSearch will ask each non-web search source for.
5347 * @hide
5348 */
5349 public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
5350 /**
5351 * The number of suggestions the GlobalSearch will ask the web search source for.
5352 * @hide
5353 */
5354 public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
5355 "search_web_results_override_limit";
5356 /**
5357 * The number of milliseconds that GlobalSearch will wait for suggestions from
5358 * promoted sources before continuing with all other sources.
5359 * @hide
5360 */
5361 public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
5362 "search_promoted_source_deadline_millis";
5363 /**
5364 * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
5365 * @hide
5366 */
5367 public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
5368 /**
5369 * The maximum number of milliseconds that GlobalSearch shows the previous results
5370 * after receiving a new query.
5371 * @hide
5372 */
5373 public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
5374 /**
5375 * The maximum age of log data used for shortcuts in GlobalSearch.
5376 * @hide
5377 */
5378 public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
5379 /**
5380 * The maximum age of log data used for source ranking in GlobalSearch.
5381 * @hide
5382 */
5383 public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
5384 "search_max_source_event_age_millis";
5385 /**
5386 * The minimum number of impressions needed to rank a source in GlobalSearch.
5387 * @hide
5388 */
5389 public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
5390 "search_min_impressions_for_source_ranking";
5391 /**
5392 * The minimum number of clicks needed to rank a source in GlobalSearch.
5393 * @hide
5394 */
5395 public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
5396 "search_min_clicks_for_source_ranking";
5397 /**
5398 * The maximum number of shortcuts shown by GlobalSearch.
5399 * @hide
5400 */
5401 public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
5402 /**
5403 * The size of the core thread pool for suggestion queries in GlobalSearch.
5404 * @hide
5405 */
5406 public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
5407 "search_query_thread_core_pool_size";
5408 /**
5409 * The maximum size of the thread pool for suggestion queries in GlobalSearch.
5410 * @hide
5411 */
5412 public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
5413 "search_query_thread_max_pool_size";
5414 /**
5415 * The size of the core thread pool for shortcut refreshing in GlobalSearch.
5416 * @hide
5417 */
5418 public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
5419 "search_shortcut_refresh_core_pool_size";
5420 /**
5421 * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
5422 * @hide
5423 */
5424 public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
5425 "search_shortcut_refresh_max_pool_size";
5426 /**
5427 * The maximun time that excess threads in the GlobalSeach thread pools will
5428 * wait before terminating.
5429 * @hide
5430 */
5431 public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
5432 "search_thread_keepalive_seconds";
5433 /**
5434 * The maximum number of concurrent suggestion queries to each source.
5435 * @hide
5436 */
5437 public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
5438 "search_per_source_concurrent_query_limit";
5439
San Mehat87734d32010-01-08 12:53:06 -08005440 /**
5441 * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
5442 * @hide
5443 */
5444 public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
5445
5446 /**
5447 * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
5448 * @hide
5449 */
5450 public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
5451
5452 /**
5453 * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
5454 * @hide
5455 */
5456 public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
5457
5458 /**
5459 * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
5460 * @hide
5461 */
5462 public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08005463
Dan Egnor42471dd2010-01-07 17:25:22 -08005464 /**
5465 * If nonzero, ANRs in invisible background processes bring up a dialog.
5466 * Otherwise, the process will be silently killed.
5467 * @hide
5468 */
5469 public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
Erikeebc8e22010-02-18 13:27:19 -08005470
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08005471 /**
5472 * The {@link ComponentName} string of the service to be used as the voice recognition
5473 * service.
Erikeebc8e22010-02-18 13:27:19 -08005474 *
Mike LeBeau5d34e9b2010-02-10 19:34:56 -08005475 * @hide
5476 */
5477 public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
Dan Egnor42471dd2010-01-07 17:25:22 -08005478
William Luh623a4282013-06-24 12:14:18 -07005479 /**
5480 * Stores whether an user has consented to have apps verified through PAM.
5481 * The value is boolean (1 or 0).
5482 *
5483 * @hide
5484 */
5485 public static final String PACKAGE_VERIFIER_USER_CONSENT =
5486 "package_verifier_user_consent";
satok988323c2011-06-22 16:38:13 +09005487
5488 /**
satokada8c4e2011-08-23 14:56:56 +09005489 * The {@link ComponentName} string of the selected spell checker service which is
5490 * one of the services managed by the text service manager.
5491 *
5492 * @hide
5493 */
5494 public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
5495
5496 /**
5497 * The {@link ComponentName} string of the selected subtype of the selected spell checker
satok988323c2011-06-22 16:38:13 +09005498 * service which is one of the services managed by the text service manager.
5499 *
5500 * @hide
5501 */
satokada8c4e2011-08-23 14:56:56 +09005502 public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
5503 "selected_spell_checker_subtype";
satok988323c2011-06-22 16:38:13 +09005504
Doug Zongkeraed8f8e2010-01-07 18:07:50 -08005505 /**
satoka33c4fc2011-08-25 16:50:11 +09005506 * The {@link ComponentName} string whether spell checker is enabled or not.
5507 *
5508 * @hide
5509 */
5510 public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
5511
5512 /**
David Brown458e8062010-03-08 21:52:11 -08005513 * What happens when the user presses the Power button while in-call
5514 * and the screen is on.<br/>
5515 * <b>Values:</b><br/>
5516 * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
5517 * 2 - The Power button hangs up the current call.<br/>
5518 *
5519 * @hide
5520 */
5521 public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
5522
5523 /**
5524 * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
5525 * @hide
5526 */
5527 public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
5528
5529 /**
5530 * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
5531 * @hide
5532 */
5533 public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
5534
5535 /**
5536 * INCALL_POWER_BUTTON_BEHAVIOR default value.
5537 * @hide
5538 */
5539 public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
5540 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
5541
5542 /**
Jeff Browna20dda42014-05-27 20:57:24 -07005543 * Whether the device should wake when the wake gesture sensor detects motion.
5544 * @hide
5545 */
5546 public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
5547
5548 /**
John Spurlocka4215ce2014-08-04 14:50:38 -04005549 * Whether the device should doze if configured.
5550 * @hide
5551 */
5552 public static final String DOZE_ENABLED = "doze_enabled";
5553
5554 /**
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07005555 * The current night mode that has been selected by the user. Owned
5556 * and controlled by UiModeManagerService. Constants are as per
5557 * UiModeManager.
5558 * @hide
5559 */
5560 public static final String UI_NIGHT_MODE = "ui_night_mode";
Suchi Amalapurapu40e47252010-04-07 16:15:50 -07005561
5562 /**
John Spurlock1a868b72012-08-22 09:56:51 -04005563 * Whether screensavers are enabled.
Daniel Sandler0601eb72011-04-13 01:01:32 -04005564 * @hide
5565 */
Daniel Sandler2d545362011-11-17 10:38:37 -08005566 public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
Daniel Sandler0601eb72011-04-13 01:01:32 -04005567
5568 /**
John Spurlock1a868b72012-08-22 09:56:51 -04005569 * The user's chosen screensaver components.
Daniel Sandler2d545362011-11-17 10:38:37 -08005570 *
John Spurlock1a868b72012-08-22 09:56:51 -04005571 * These will be launched by the PhoneWindowManager after a timeout when not on
Daniel Sandler2d545362011-11-17 10:38:37 -08005572 * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
Daniel Sandler0601eb72011-04-13 01:01:32 -04005573 * @hide
5574 */
John Spurlock1a868b72012-08-22 09:56:51 -04005575 public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
Daniel Sandler2d545362011-11-17 10:38:37 -08005576
5577 /**
John Spurlock1a868b72012-08-22 09:56:51 -04005578 * If screensavers are enabled, whether the screensaver should be automatically launched
5579 * when the device is inserted into a (desk) dock.
Daniel Sandler2d545362011-11-17 10:38:37 -08005580 * @hide
5581 */
5582 public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
Daniel Sandler0601eb72011-04-13 01:01:32 -04005583
John Spurlock1a868b72012-08-22 09:56:51 -04005584 /**
5585 * If screensavers are enabled, whether the screensaver should be automatically launched
5586 * when the screen times out when not on battery.
5587 * @hide
5588 */
5589 public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
5590
5591 /**
5592 * If screensavers are enabled, the default screensaver component.
5593 * @hide
5594 */
5595 public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
5596
Daniel Sandler0601eb72011-04-13 01:01:32 -04005597 /**
Martijn Coenena7397882013-07-30 20:07:47 -07005598 * The default NFC payment component
5599 * @hide
5600 */
5601 public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
5602
5603 /**
Martijn Coenen2f6f3a012014-04-25 17:00:21 -07005604 * Whether NFC payment is handled by the foreground application or a default.
5605 * @hide
5606 */
5607 public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
5608
5609 /**
David Braunf5d83192013-09-16 13:43:51 -07005610 * Specifies the package name currently configured to be the primary sms application
5611 * @hide
5612 */
5613 public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
5614
5615 /**
Yorke Lee014de022015-04-21 17:15:47 -07005616 * Specifies the package name currently configured to be the default dialer application
5617 * @hide
5618 */
5619 public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
5620
5621 /**
Adrian Roos943eb862015-03-26 12:31:16 -07005622 * Specifies the package name currently configured to be the emergency assistance application
5623 *
5624 * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
5625 *
5626 * @hide
5627 */
5628 public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
5629
5630 /**
Jorim Jaggi9d910832015-05-18 17:35:26 -07005631 * Specifies whether the current app context on scren (assist data) will be sent to the
5632 * assist application (active voice interaction service).
5633 *
5634 * @hide
5635 */
5636 public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
5637
5638 /**
Jorim Jaggia133f0b2015-06-26 16:40:00 -07005639 * Specifies whether a screenshot of the screen contents will be sent to the assist
5640 * application (active voice interaction service).
5641 *
5642 * @hide
5643 */
5644 public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
5645
5646 /**
Julia Reynolds7eba5932015-12-11 16:40:39 -05005647 * Names of the service component that the current user has explicitly allowed to
5648 * see and change the importance of all of the user's notifications.
5649 *
5650 * @hide
5651 */
5652 public static final String ENABLED_NOTIFICATION_ASSISTANT
5653 = "enabled_notification_assistant";
5654
5655 /**
John Spurlock7c74f782015-06-04 13:01:42 -04005656 * Names of the service components that the current user has explicitly allowed to
Chris Wren8326a8a2014-10-22 14:13:32 -04005657 * see all of the user's notifications, separated by ':'.
Daniel Sandler4b749ef2013-03-18 21:53:04 -04005658 *
5659 * @hide
5660 */
5661 public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
5662
John Spurlock7340fc82014-04-24 18:50:12 -04005663 /**
John Spurlock7c74f782015-06-04 13:01:42 -04005664 * Names of the packages that the current user has explicitly allowed to
5665 * manage notification policy configuration, separated by ':'.
John Spurlock7c74f782015-06-04 13:01:42 -04005666 */
5667 public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
5668 "enabled_notification_policy_access_packages";
5669
John Spurlock5c454122013-06-17 07:35:46 -04005670 /** @hide */
5671 public static final String BAR_SERVICE_COMPONENT = "bar_service_component";
5672
John Spurlockd67ec252013-09-05 11:31:54 -04005673 /** @hide */
John Spurlockcdb57ae2015-02-11 19:04:11 -05005674 public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT
5675 = "volume_controller_service_component";
5676
5677 /** @hide */
John Spurlockf1a36642013-10-12 17:50:42 -04005678 public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
John Spurlockd67ec252013-09-05 11:31:54 -04005679
Yorke Lee647f8f32013-05-07 10:49:44 -07005680 /**
Svetoslavf43e8512013-09-30 17:33:05 -07005681 * This is the query URI for finding a print service to install.
5682 *
5683 * @hide
5684 */
5685 public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
5686
5687 /**
5688 * This is the query URI for finding a NFC payment service to install.
5689 *
5690 * @hide
5691 */
5692 public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
5693
5694 /**
Amith Yamasani1e9c2182014-06-11 17:25:51 -07005695 * If enabled, apps should try to skip any introductory hints on first launch. This might
Amith Yamasani0c416392014-06-13 15:54:39 -07005696 * apply to users that are already familiar with the environment or temporary users.
Amith Yamasani1e9c2182014-06-11 17:25:51 -07005697 * <p>
5698 * Type : int (0 to show hints, 1 to skip showing hints)
Amith Yamasani1e9c2182014-06-11 17:25:51 -07005699 */
5700 public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
5701
5702 /**
John Spurlockaa5ee4d2014-07-25 13:05:12 -04005703 * Persisted playback time after a user confirmation of an unsafe volume level.
5704 *
5705 * @hide
5706 */
5707 public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
5708
5709 /**
Dan Sandler52e5701e2014-07-22 23:14:54 -04005710 * This preference enables notification display on the lockscreen.
5711 * @hide
5712 */
5713 public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
5714 "lock_screen_show_notifications";
5715
5716 /**
Dongwon Kang4d933a02014-08-07 22:51:47 -07005717 * List of TV inputs that are currently hidden. This is a string
Jaewan Kimf0e530e2014-08-22 00:43:31 +09005718 * containing the IDs of all hidden TV inputs. Each ID is encoded by
5719 * {@link android.net.Uri#encode(String)} and separated by ':'.
Dongwon Kang4d933a02014-08-07 22:51:47 -07005720 * @hide
5721 */
5722 public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
5723
5724 /**
5725 * List of custom TV input labels. This is a string containing <TV input id, custom name>
Jaewan Kimf0e530e2014-08-22 00:43:31 +09005726 * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
5727 * and separated by ','. Each pair is separated by ':'.
Dongwon Kang4d933a02014-08-07 22:51:47 -07005728 * @hide
5729 */
5730 public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
5731
5732 /**
Glenn Kasten34cc4db2014-08-13 10:56:38 -07005733 * Whether automatic routing of system audio to USB audio peripheral is disabled.
5734 * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
5735 * and 0 means automatic routing is enabled.
5736 *
5737 * @hide
5738 */
5739 public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
5740 "usb_audio_automatic_routing_disabled";
5741
5742 /**
Jeff Brown05af6ad2014-09-30 20:54:30 -07005743 * The timeout in milliseconds before the device fully goes to sleep after
5744 * a period of inactivity. This value sets an upper bound on how long the device
5745 * will stay awake or dreaming without user activity. It should generally
Dianne Hackbornad6a99b2014-11-18 10:11:10 -08005746 * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
Jeff Brown05af6ad2014-09-30 20:54:30 -07005747 * will sleep before it ever has a chance to dream.
5748 * <p>
5749 * Use -1 to disable this timeout.
5750 * </p>
5751 *
5752 * @hide
5753 */
5754 public static final String SLEEP_TIMEOUT = "sleep_timeout";
5755
5756 /**
Jason Monk27bbb2d2015-03-31 16:46:39 -04005757 * Controls whether double tap to wake is enabled.
5758 * @hide
5759 */
5760 public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
5761
5762 /**
Xiyuan Xiae6de8b92015-06-06 22:18:05 -07005763 * The current assistant component. It could be a voice interaction service,
5764 * or an activity that handles ACTION_ASSIST, or empty which means using the default
5765 * handling.
5766 *
5767 * @hide
5768 */
5769 public static final String ASSISTANT = "assistant";
5770
5771 /**
Jason Monk5a5e7d62015-08-04 11:20:25 -04005772 * Whether the camera launch gesture should be disabled.
5773 *
5774 * @hide
5775 */
5776 public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
5777
5778 /**
Adrian Roos5941c982015-09-03 15:59:49 -07005779 * Whether the camera launch gesture to double tap the power button when the screen is off
5780 * should be disabled.
5781 *
5782 * @hide
5783 */
5784 public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
5785 "camera_double_tap_power_gesture_disabled";
5786
5787 /**
Gustav Sennton6258dcd2015-10-30 19:25:37 +00005788 * Name of the package used as WebView provider (if unset the provider is instead determined
5789 * by the system).
5790 * @hide
5791 */
5792 public static final String WEBVIEW_PROVIDER = "webview_provider";
5793
5794 /**
Svetoslav Ganova571a582011-09-20 18:32:20 -07005795 * This are the settings to be backed up.
5796 *
5797 * NOTE: Settings are backed up and restored in the order they appear
5798 * in this array. If you have one setting depending on another,
5799 * make sure that they are ordered appropriately.
5800 *
-b master501eec92009-07-06 13:53:11 -07005801 * @hide
5802 */
5803 public static final String[] SETTINGS_TO_BACKUP = {
Christopher Tate58f41ec2013-01-11 15:40:36 -08005804 BUGREPORT_IN_POWER_MENU, // moved to global
Amith Yamasani8823c0a82009-07-07 14:30:17 -07005805 ALLOW_MOCK_LOCATION,
-b master501eec92009-07-06 13:53:11 -07005806 PARENTAL_CONTROL_ENABLED,
5807 PARENTAL_CONTROL_REDIRECT_URL,
Christopher Tate66488d62012-10-02 11:58:01 -07005808 USB_MASS_STORAGE_ENABLED, // moved to global
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -07005809 ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
5810 ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
5811 ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
Svetoslav Ganov585f13f8d2010-08-10 07:59:15 -07005812 ACCESSIBILITY_SCRIPT_INJECTION,
Christopher Tate14c2d792010-02-25 16:49:44 -08005813 BACKUP_AUTO_RESTORE,
-b master501eec92009-07-06 13:53:11 -07005814 ENABLED_ACCESSIBILITY_SERVICES,
Christopher Tate6597e342015-02-17 12:15:25 -08005815 ENABLED_NOTIFICATION_LISTENERS,
Christopher Tate7b9a28c2015-03-18 13:06:16 -07005816 ENABLED_INPUT_METHODS,
Svetoslav Ganov9a4c5cd2012-05-30 14:06:32 -07005817 TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
Svetoslav Ganova28a16d2011-07-28 11:24:21 -07005818 TOUCH_EXPLORATION_ENABLED,
Svetoslav Ganova571a582011-09-20 18:32:20 -07005819 ACCESSIBILITY_ENABLED,
Svetoslav Ganov55f937a2011-12-05 11:42:07 -08005820 ACCESSIBILITY_SPEAK_PASSWORD,
Chris Craikcce47eb2014-07-16 15:12:15 -07005821 ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
Alan Viveretteef793802013-07-23 14:15:28 -07005822 ACCESSIBILITY_CAPTIONING_ENABLED,
5823 ACCESSIBILITY_CAPTIONING_LOCALE,
5824 ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
5825 ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
5826 ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
5827 ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
5828 ACCESSIBILITY_CAPTIONING_TYPEFACE,
Alan Viverette69ce69b2013-08-29 12:23:48 -07005829 ACCESSIBILITY_CAPTIONING_FONT_SCALE,
-b master501eec92009-07-06 13:53:11 -07005830 TTS_USE_DEFAULTS,
5831 TTS_DEFAULT_RATE,
5832 TTS_DEFAULT_PITCH,
5833 TTS_DEFAULT_SYNTH,
5834 TTS_DEFAULT_LANG,
5835 TTS_DEFAULT_COUNTRY,
Charles Chenceffa152010-03-16 21:18:10 -07005836 TTS_ENABLED_PLUGINS,
Narayan Kamath6d632962011-08-24 11:51:37 +01005837 TTS_DEFAULT_LOCALE,
Christopher Tate66488d62012-10-02 11:58:01 -07005838 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, // moved to global
5839 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, // moved to global
5840 WIFI_NUM_OPEN_NETWORKS_KEPT, // moved to global
Christopher Tate06cbadd2015-03-16 18:29:42 -07005841 SELECTED_SPELL_CHECKER,
5842 SELECTED_SPELL_CHECKER_SUBTYPE,
5843 SPELL_CHECKER_ENABLED,
San Mehat87734d32010-01-08 12:53:06 -08005844 MOUNT_PLAY_NOTIFICATION_SND,
5845 MOUNT_UMS_AUTOSTART,
5846 MOUNT_UMS_PROMPT,
Dianne Hackborn2ccda4d2010-03-22 21:49:15 -07005847 MOUNT_UMS_NOTIFY_ENABLED,
Jeff Brown05af6ad2014-09-30 20:54:30 -07005848 UI_NIGHT_MODE,
Jason Monk27bbb2d2015-03-31 16:46:39 -04005849 SLEEP_TIMEOUT,
5850 DOUBLE_TAP_TO_WAKE,
Jason Monk5a5e7d62015-08-04 11:20:25 -04005851 CAMERA_GESTURE_DISABLED,
Toni Barzic386f8342015-09-09 12:30:41 -07005852 ACCESSIBILITY_AUTOCLICK_ENABLED,
5853 ACCESSIBILITY_AUTOCLICK_DELAY
-b master501eec92009-07-06 13:53:11 -07005854 };
5855
5856 /**
Amith Yamasani4f7e2e32014-08-14 18:49:48 -07005857 * These entries are considered common between the personal and the managed profile,
5858 * since the managed profile doesn't get to change them.
Amith Yamasani4f7e2e32014-08-14 18:49:48 -07005859 */
Svetoslav683914b2015-01-15 14:22:26 -08005860 private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
Amith Yamasanib0ff3222015-03-04 09:56:14 -08005861
Svetoslav683914b2015-01-15 14:22:26 -08005862 static {
5863 CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
5864 CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
5865 CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
5866 CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
5867 CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
5868 CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
5869 CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
Lifu Tangd1fa1d62015-11-25 21:42:44 -08005870 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
Svetoslav683914b2015-01-15 14:22:26 -08005871 CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
5872 CLONE_TO_MANAGED_PROFILE.add(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
5873 CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
5874 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
5875 CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
5876 }
5877
5878 /** @hide */
5879 public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
5880 outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
5881 }
Amith Yamasani4f7e2e32014-08-14 18:49:48 -07005882
5883 /**
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005884 * Helper method for determining if a location provider is enabled.
Tom O'Neilld5759432013-09-11 11:03:03 -07005885 *
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005886 * @param cr the content resolver to use
5887 * @param provider the location provider to query
5888 * @return true if the provider is enabled
Tom O'Neilld5759432013-09-11 11:03:03 -07005889 *
5890 * @deprecated use {@link #LOCATION_MODE} or
5891 * {@link LocationManager#isProviderEnabled(String)}
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005892 */
Tom O'Neill1f48b782013-08-19 18:14:56 -07005893 @Deprecated
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005894 public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
Victoria Leaseb711d572012-10-02 13:14:11 -07005895 return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
5896 }
5897
5898 /**
5899 * Helper method for determining if a location provider is enabled.
5900 * @param cr the content resolver to use
5901 * @param provider the location provider to query
5902 * @param userId the userId to query
5903 * @return true if the provider is enabled
Tom O'Neilld5759432013-09-11 11:03:03 -07005904 * @deprecated use {@link #LOCATION_MODE} or
5905 * {@link LocationManager#isProviderEnabled(String)}
Victoria Leaseb711d572012-10-02 13:14:11 -07005906 * @hide
5907 */
Tom O'Neill1f48b782013-08-19 18:14:56 -07005908 @Deprecated
Victoria Leaseb711d572012-10-02 13:14:11 -07005909 public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
5910 String allowedProviders = Settings.Secure.getStringForUser(cr,
5911 LOCATION_PROVIDERS_ALLOWED, userId);
Brad Fitzpatrick11fe1812010-09-10 16:07:52 -07005912 return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005913 }
5914
5915 /**
5916 * Thread-safe method for enabling or disabling a single location provider.
5917 * @param cr the content resolver to use
5918 * @param provider the location provider to enable or disable
5919 * @param enabled true if the provider should be enabled
Tom O'Neilla324ac72013-08-26 14:40:23 -07005920 * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005921 */
Tom O'Neill1f48b782013-08-19 18:14:56 -07005922 @Deprecated
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005923 public static final void setLocationProviderEnabled(ContentResolver cr,
5924 String provider, boolean enabled) {
Victoria Leaseb711d572012-10-02 13:14:11 -07005925 setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
5926 }
5927
5928 /**
5929 * Thread-safe method for enabling or disabling a single location provider.
Tom O'Neilla324ac72013-08-26 14:40:23 -07005930 *
Victoria Leaseb711d572012-10-02 13:14:11 -07005931 * @param cr the content resolver to use
5932 * @param provider the location provider to enable or disable
5933 * @param enabled true if the provider should be enabled
5934 * @param userId the userId for which to enable/disable providers
Tom O'Neilla324ac72013-08-26 14:40:23 -07005935 * @return true if the value was set, false on database errors
5936 * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
5937 * {@link #LOCATION_MODE}
Victoria Leaseb711d572012-10-02 13:14:11 -07005938 * @hide
5939 */
Tom O'Neill1f48b782013-08-19 18:14:56 -07005940 @Deprecated
Tom O'Neilla324ac72013-08-26 14:40:23 -07005941 public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
Victoria Leaseb711d572012-10-02 13:14:11 -07005942 String provider, boolean enabled, int userId) {
David Christie3f7b6522013-08-06 19:19:08 -07005943 synchronized (mLocationSettingsLock) {
5944 // to ensure thread safety, we write the provider name with a '+' or '-'
5945 // and let the SettingsProvider handle it rather than reading and modifying
5946 // the list of enabled providers.
5947 if (enabled) {
5948 provider = "+" + provider;
5949 } else {
5950 provider = "-" + provider;
5951 }
Tom O'Neilla324ac72013-08-26 14:40:23 -07005952 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
David Christie3f7b6522013-08-06 19:19:08 -07005953 userId);
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005954 }
Mike Lockwoodbd2a7122009-04-02 23:41:33 -07005955 }
Tom O'Neill1f48b782013-08-19 18:14:56 -07005956
5957 /**
Lifu Tangd1fa1d62015-11-25 21:42:44 -08005958 * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
5959 */
5960 private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
5961 final int mode = getLocationModeForUser(cr, userId);
5962 return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
5963 }
5964
5965 /**
5966 * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
5967 */
5968 private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
5969 int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
5970 LOCATION_MODE_HIGH_ACCURACY, userId);
5971 // Make sure that the previous mode is never "off". Otherwise the user won't be able to
5972 // turn on location any longer.
5973 if (mode == LOCATION_MODE_OFF) {
5974 mode = LOCATION_MODE_HIGH_ACCURACY;
5975 }
5976 return setLocationModeForUser(cr, mode, userId);
5977 }
5978
5979 /**
Tom O'Neill1f48b782013-08-19 18:14:56 -07005980 * Thread-safe method for setting the location mode to one of
5981 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
5982 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
5983 *
Tom O'Neill1f48b782013-08-19 18:14:56 -07005984 * @param cr the content resolver to use
5985 * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
5986 * @param userId the userId for which to change mode
Tom O'Neilla324ac72013-08-26 14:40:23 -07005987 * @return true if the value was set, false on database errors
Tom O'Neill1f48b782013-08-19 18:14:56 -07005988 *
5989 * @throws IllegalArgumentException if mode is not one of the supported values
5990 */
Tom O'Neill7f6f4572013-08-27 10:53:15 -07005991 private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
5992 int userId) {
Tom O'Neill1f48b782013-08-19 18:14:56 -07005993 synchronized (mLocationSettingsLock) {
5994 boolean gps = false;
5995 boolean network = false;
5996 switch (mode) {
Lifu Tangd1fa1d62015-11-25 21:42:44 -08005997 case LOCATION_MODE_PREVIOUS:
5998 // Retrieve the actual mode and set to that mode.
5999 return restoreLocationModeForUser(cr, userId);
Tom O'Neill1f48b782013-08-19 18:14:56 -07006000 case LOCATION_MODE_OFF:
Lifu Tangd1fa1d62015-11-25 21:42:44 -08006001 saveLocationModeForUser(cr, userId);
Tom O'Neill1f48b782013-08-19 18:14:56 -07006002 break;
6003 case LOCATION_MODE_SENSORS_ONLY:
6004 gps = true;
6005 break;
6006 case LOCATION_MODE_BATTERY_SAVING:
6007 network = true;
6008 break;
6009 case LOCATION_MODE_HIGH_ACCURACY:
6010 gps = true;
6011 network = true;
6012 break;
6013 default:
6014 throw new IllegalArgumentException("Invalid location mode: " + mode);
6015 }
Tom O'Neill7731a992014-10-09 11:30:49 -07006016 // Note it's important that we set the NLP mode first. The Google implementation
6017 // of NLP clears its NLP consent setting any time it receives a
6018 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
6019 // it shows an NLP consent dialog any time it receives the broadcast, NLP is
6020 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
6021 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
6022 // and 3) the receiver happened to complete before we enabled NLP, then the Google
6023 // NLP would detect the attempt to enable NLP and show a redundant NLP consent
6024 // dialog. Then the people who wrote the setup wizard would be sad.
Tom O'Neilla324ac72013-08-26 14:40:23 -07006025 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
Tom O'Neill1f48b782013-08-19 18:14:56 -07006026 cr, LocationManager.NETWORK_PROVIDER, network, userId);
Tom O'Neill7731a992014-10-09 11:30:49 -07006027 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
6028 cr, LocationManager.GPS_PROVIDER, gps, userId);
Tom O'Neilla324ac72013-08-26 14:40:23 -07006029 return gpsSuccess && nlpSuccess;
Tom O'Neill1f48b782013-08-19 18:14:56 -07006030 }
6031 }
6032
6033 /**
Tom O'Neill1f48b782013-08-19 18:14:56 -07006034 * Thread-safe method for reading the location mode, returns one of
6035 * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
6036 * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
6037 *
6038 * @param cr the content resolver to use
6039 * @param userId the userId for which to read the mode
6040 * @return the location mode
6041 */
Tom O'Neill7f6f4572013-08-27 10:53:15 -07006042 private static final int getLocationModeForUser(ContentResolver cr, int userId) {
Tom O'Neill1f48b782013-08-19 18:14:56 -07006043 synchronized (mLocationSettingsLock) {
6044 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6045 cr, LocationManager.GPS_PROVIDER, userId);
6046 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
6047 cr, LocationManager.NETWORK_PROVIDER, userId);
6048 if (gpsEnabled && networkEnabled) {
6049 return LOCATION_MODE_HIGH_ACCURACY;
6050 } else if (gpsEnabled) {
6051 return LOCATION_MODE_SENSORS_ONLY;
6052 } else if (networkEnabled) {
6053 return LOCATION_MODE_BATTERY_SAVING;
6054 } else {
6055 return LOCATION_MODE_OFF;
6056 }
6057 }
6058 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006059 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07006060
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006061 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006062 * Global system settings, containing preferences that always apply identically
6063 * to all defined users. Applications can read these but are not allowed to write;
6064 * like the "Secure" settings, these are for preferences that the user must
6065 * explicitly modify through the system UI or specialized APIs for those values.
6066 */
6067 public static final class Global extends NameValueTable {
6068 public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version";
6069
6070 /**
6071 * The content:// style URL for global secure settings items. Not public.
6072 */
6073 public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
6074
6075 /**
Amith Yamasani23a0f052014-07-25 12:26:53 -07006076 * Whether users are allowed to add more users or guest from lockscreen.
6077 * <p>
6078 * Type: int
6079 * @hide
6080 */
6081 public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
6082
6083 /**
Svetoslav Ganov7befb7d2012-09-27 16:49:23 -07006084 * Setting whether the global gesture for enabling accessibility is enabled.
6085 * If this gesture is enabled the user will be able to perfrom it to enable
6086 * the accessibility state without visiting the settings app.
6087 * @hide
6088 */
6089 public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
6090 "enable_accessibility_global_gesture_enabled";
6091
6092 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006093 * Whether Airplane Mode is on.
6094 */
6095 public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
6096
6097 /**
Bryce Lee584a4452014-10-21 15:55:55 -07006098 * Whether Theater Mode is on.
6099 * {@hide}
6100 */
Bryce Leecdfebd62015-02-02 08:19:11 -08006101 @SystemApi
Bryce Lee584a4452014-10-21 15:55:55 -07006102 public static final String THEATER_MODE_ON = "theater_mode_on";
6103
6104 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006105 * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
6106 */
6107 public static final String RADIO_BLUETOOTH = "bluetooth";
6108
6109 /**
6110 * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
6111 */
6112 public static final String RADIO_WIFI = "wifi";
6113
6114 /**
6115 * {@hide}
6116 */
6117 public static final String RADIO_WIMAX = "wimax";
6118 /**
6119 * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
6120 */
6121 public static final String RADIO_CELL = "cell";
6122
6123 /**
6124 * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
6125 */
6126 public static final String RADIO_NFC = "nfc";
6127
6128 /**
6129 * A comma separated list of radios that need to be disabled when airplane mode
6130 * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
6131 * included in the comma separated list.
6132 */
6133 public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
6134
6135 /**
6136 * A comma separated list of radios that should to be disabled when airplane mode
6137 * is on, but can be manually reenabled by the user. For example, if RADIO_WIFI is
6138 * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
6139 * will be turned off when entering airplane mode, but the user will be able to reenable
6140 * Wifi in the Settings app.
6141 *
6142 * {@hide}
6143 */
6144 public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
6145
6146 /**
Bryce Leeec85f342015-12-16 13:32:28 -08006147 * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
6148 * See {@link android.bluetooth.BluetoothProfile}.
6149 * {@hide}
6150 */
6151 public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
6152
6153 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006154 * The policy for deciding when Wi-Fi should go to sleep (which will in
6155 * turn switch to using the mobile data as an Internet connection).
6156 * <p>
6157 * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
6158 * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
6159 * {@link #WIFI_SLEEP_POLICY_NEVER}.
6160 */
6161 public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
6162
6163 /**
6164 * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
6165 * policy, which is to sleep shortly after the turning off
6166 * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
6167 */
6168 public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
6169
6170 /**
6171 * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
6172 * the device is on battery, and never go to sleep when the device is
6173 * plugged in.
6174 */
6175 public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
6176
6177 /**
6178 * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
6179 */
6180 public static final int WIFI_SLEEP_POLICY_NEVER = 2;
6181
6182 /**
6183 * Value to specify if the user prefers the date, time and time zone
6184 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6185 */
6186 public static final String AUTO_TIME = "auto_time";
6187
6188 /**
6189 * Value to specify if the user prefers the time zone
6190 * to be automatically fetched from the network (NITZ). 1=yes, 0=no
6191 */
6192 public static final String AUTO_TIME_ZONE = "auto_time_zone";
6193
6194 /**
6195 * URI for the car dock "in" event sound.
6196 * @hide
6197 */
6198 public static final String CAR_DOCK_SOUND = "car_dock_sound";
6199
6200 /**
6201 * URI for the car dock "out" event sound.
6202 * @hide
6203 */
6204 public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
6205
6206 /**
6207 * URI for the desk dock "in" event sound.
6208 * @hide
6209 */
6210 public static final String DESK_DOCK_SOUND = "desk_dock_sound";
6211
6212 /**
6213 * URI for the desk dock "out" event sound.
6214 * @hide
6215 */
6216 public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
6217
6218 /**
6219 * Whether to play a sound for dock events.
6220 * @hide
6221 */
6222 public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
6223
6224 /**
6225 * URI for the "device locked" (keyguard shown) sound.
6226 * @hide
6227 */
6228 public static final String LOCK_SOUND = "lock_sound";
6229
6230 /**
6231 * URI for the "device unlocked" sound.
6232 * @hide
6233 */
6234 public static final String UNLOCK_SOUND = "unlock_sound";
6235
6236 /**
Adrian Roos49e057d2014-08-13 17:14:51 +02006237 * URI for the "device is trusted" sound, which is played when the device enters the trusted
6238 * state without unlocking.
6239 * @hide
6240 */
6241 public static final String TRUSTED_SOUND = "trusted_sound";
6242
6243 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006244 * URI for the low battery sound file.
6245 * @hide
6246 */
6247 public static final String LOW_BATTERY_SOUND = "low_battery_sound";
6248
6249 /**
6250 * Whether to play a sound for low-battery alerts.
6251 * @hide
6252 */
6253 public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
6254
6255 /**
Jeff Brown84e27562012-12-07 13:56:34 -08006256 * URI for the "wireless charging started" sound.
6257 * @hide
6258 */
6259 public static final String WIRELESS_CHARGING_STARTED_SOUND =
6260 "wireless_charging_started_sound";
6261
6262 /**
John Spurlock51a871d2015-05-06 17:41:30 -04006263 * Whether to play a sound for charging events.
6264 * @hide
6265 */
6266 public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
6267
6268 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006269 * Whether we keep the device on while the device is plugged in.
6270 * Supported values are:
6271 * <ul>
6272 * <li>{@code 0} to never stay on while plugged in</li>
6273 * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
6274 * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
6275 * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
6276 * </ul>
6277 * These values can be OR-ed together.
6278 */
6279 public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
6280
6281 /**
Christopher Tate58f41ec2013-01-11 15:40:36 -08006282 * When the user has enable the option to have a "bug report" command
6283 * in the power menu.
6284 * @hide
6285 */
6286 public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
6287
6288 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006289 * Whether ADB is enabled.
6290 */
6291 public static final String ADB_ENABLED = "adb_enabled";
6292
6293 /**
Jon Miranda836c0a82014-08-11 12:32:26 -07006294 * Whether Views are allowed to save their attribute data.
6295 * @hide
6296 */
6297 public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
6298
6299 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006300 * Whether assisted GPS should be enabled or not.
6301 * @hide
6302 */
6303 public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
6304
6305 /**
6306 * Whether bluetooth is enabled/disabled
6307 * 0=disabled. 1=enabled.
6308 */
6309 public static final String BLUETOOTH_ON = "bluetooth_on";
6310
6311 /**
6312 * CDMA Cell Broadcast SMS
6313 * 0 = CDMA Cell Broadcast SMS disabled
6314 * 1 = CDMA Cell Broadcast SMS enabled
6315 * @hide
6316 */
6317 public static final String CDMA_CELL_BROADCAST_SMS =
6318 "cdma_cell_broadcast_sms";
6319
6320 /**
6321 * The CDMA roaming mode 0 = Home Networks, CDMA default
6322 * 1 = Roaming on Affiliated networks
6323 * 2 = Roaming on any networks
6324 * @hide
6325 */
6326 public static final String CDMA_ROAMING_MODE = "roaming_settings";
6327
6328 /**
6329 * The CDMA subscription mode 0 = RUIM/SIM (default)
6330 * 1 = NV
6331 * @hide
6332 */
6333 public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
6334
6335 /** Inactivity timeout to track mobile data activity.
6336 *
6337 * If set to a positive integer, it indicates the inactivity timeout value in seconds to
6338 * infer the data activity of mobile network. After a period of no activity on mobile
6339 * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
6340 * intent is fired to indicate a transition of network status from "active" to "idle". Any
6341 * subsequent activity on mobile networks triggers the firing of {@code
6342 * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
6343 *
6344 * Network activity refers to transmitting or receiving data on the network interfaces.
6345 *
6346 * Tracking is disabled if set to zero or negative value.
6347 *
6348 * @hide
6349 */
6350 public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
6351
6352 /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
6353 * but for Wifi network.
6354 * @hide
6355 */
6356 public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
6357
6358 /**
6359 * Whether or not data roaming is enabled. (0 = false, 1 = true)
6360 */
6361 public static final String DATA_ROAMING = "data_roaming";
6362
6363 /**
Wink Saville75c1e692013-03-20 17:06:50 -07006364 * The value passed to a Mobile DataConnection via bringUp which defines the
6365 * number of retries to preform when setting up the initial connection. The default
6366 * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
6367 * @hide
6368 */
6369 public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
6370
6371 /**
Todd Kennedyf39ca8f2015-08-07 14:15:07 -07006372 * Whether any package can be on external storage. When this is true, any
6373 * package, regardless of manifest values, is a candidate for installing
6374 * or moving onto external storage. (0 = false, 1 = true)
6375 * @hide
6376 */
6377 public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
6378
Jorim Jaggi8ccdf3a2015-10-22 12:50:31 +02006379 /**
6380 * Whether any activity can be resized. When this is true, any
6381 * activity, regardless of manifest values, can be resized for multi-window.
6382 * (0 = false, 1 = true)
6383 * @hide
6384 */
6385 public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
6386 = "force_resizable_activities";
6387
Todd Kennedyf39ca8f2015-08-07 14:15:07 -07006388 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006389 * Whether user has enabled development settings.
6390 */
6391 public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
6392
6393 /**
Amith Yamasanicb15d662015-11-10 11:11:15 -08006394 * Whether the device has been provisioned (0 = false, 1 = true).
6395 * <p>On a multiuser device with a separate system user, the screen may be locked
6396 * as soon as this is set to true and further activities cannot be launched on the
6397 * system user unless they are marked to show over keyguard.
Christopher Tate06efb532012-08-24 15:29:27 -07006398 */
6399 public static final String DEVICE_PROVISIONED = "device_provisioned";
6400
6401 /**
6402 * The saved value for WindowManagerService.setForcedDisplayDensity().
6403 * One integer in dpi. If unset, then use the real display density.
6404 * @hide
6405 */
6406 public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
6407
6408 /**
6409 * The saved value for WindowManagerService.setForcedDisplaySize().
6410 * Two integers separated by a comma. If unset, then use the real display size.
6411 * @hide
6412 */
6413 public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
6414
6415 /**
Jeff Brownd46747a2015-04-15 19:02:36 -07006416 * The saved value for WindowManagerService.setForcedDisplayScalingMode().
6417 * 0 or unset if scaling is automatic, 1 if scaling is disabled.
6418 * @hide
6419 */
6420 public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
6421
6422 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006423 * The maximum size, in bytes, of a download that the download manager will transfer over
6424 * a non-wifi connection.
6425 * @hide
6426 */
6427 public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
6428 "download_manager_max_bytes_over_mobile";
6429
6430 /**
6431 * The recommended maximum size, in bytes, of a download that the download manager should
6432 * transfer over a non-wifi connection. Over this size, the use will be warned, but will
6433 * have the option to start the download over the mobile connection anyway.
6434 * @hide
6435 */
6436 public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
6437 "download_manager_recommended_max_bytes_over_mobile";
6438
6439 /**
Christopher Tateaa036a22014-05-19 16:33:27 -07006440 * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
Christopher Tate06efb532012-08-24 15:29:27 -07006441 */
Christopher Tateaa036a22014-05-19 16:33:27 -07006442 @Deprecated
6443 public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
Christopher Tate06efb532012-08-24 15:29:27 -07006444
6445 /**
Jinsuk Kimb3d91772014-07-10 12:48:54 +09006446 * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
6447 * sent or processed. (0 = false, 1 = true)
6448 * @hide
6449 */
6450 public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
6451
6452 /**
6453 * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted,
6454 * and the output is redirected to AV Receiver connected via
6455 * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}.
6456 * @hide
6457 */
6458 public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled";
6459
6460 /**
Jinsuk Kimb3d91772014-07-10 12:48:54 +09006461 * Whether TV will automatically turn on upon reception of the CEC command
6462 * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
6463 * @hide
6464 */
6465 public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
6466 "hdmi_control_auto_wakeup_enabled";
6467
6468 /**
6469 * Whether TV will also turn off other CEC devices when it goes to standby mode.
6470 * (0 = false, 1 = true)
6471 * @hide
6472 */
6473 public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
6474 "hdmi_control_auto_device_off_enabled";
6475
6476 /**
Lorenzo Colitti06d7e532015-03-16 23:46:24 +09006477 * Whether to use the DHCP client from Lollipop and earlier instead of the newer Android DHCP
6478 * client.
6479 * (0 = false, 1 = true)
6480 * @hide
6481 */
6482 public static final String LEGACY_DHCP_CLIENT = "legacy_dhcp_client";
6483
6484 /**
Jinsuk Kimb3d91772014-07-10 12:48:54 +09006485 * Whether TV will switch to MHL port when a mobile device is plugged in.
6486 * (0 = false, 1 = true)
6487 * @hide
6488 */
6489 public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
6490
6491 /**
6492 * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
6493 * @hide
6494 */
6495 public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
6496
6497 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006498 * Whether mobile data connections are allowed by the user. See
6499 * ConnectivityManager for more info.
6500 * @hide
6501 */
6502 public static final String MOBILE_DATA = "mobile_data";
6503
Erik Klineda4bfa82015-04-30 12:58:40 +09006504 /**
6505 * Whether the mobile data connection should remain active even when higher
6506 * priority networks like WiFi are active, to help make network switching faster.
6507 *
6508 * See ConnectivityService for more info.
6509 *
6510 * (0 = disabled, 1 = enabled)
6511 * @hide
6512 */
6513 public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
6514
Christopher Tate06efb532012-08-24 15:29:27 -07006515 /** {@hide} */
6516 public static final String NETSTATS_ENABLED = "netstats_enabled";
6517 /** {@hide} */
6518 public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
6519 /** {@hide} */
6520 public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
6521 /** {@hide} */
6522 public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
6523 /** {@hide} */
6524 public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
Christopher Tate06efb532012-08-24 15:29:27 -07006525
6526 /** {@hide} */
6527 public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
6528 /** {@hide} */
6529 public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
6530 /** {@hide} */
6531 public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
6532 /** {@hide} */
6533 public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
6534
6535 /** {@hide} */
6536 public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
6537 /** {@hide} */
6538 public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
6539 /** {@hide} */
6540 public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
6541 /** {@hide} */
6542 public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
6543
6544 /** {@hide} */
6545 public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
6546 /** {@hide} */
6547 public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
6548 /** {@hide} */
6549 public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
6550 /** {@hide} */
6551 public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
6552
6553 /**
6554 * User preference for which network(s) should be used. Only the
6555 * connectivity service should touch this.
6556 */
6557 public static final String NETWORK_PREFERENCE = "network_preference";
6558
6559 /**
Jeff Davidsondd6fd1e2014-04-14 15:14:30 -07006560 * Which package name to use for network scoring. If null, or if the package is not a valid
6561 * scorer app, external network scores will neither be requested nor accepted.
6562 * @hide
6563 */
6564 public static final String NETWORK_SCORER_APP = "network_scorer_app";
6565
6566 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006567 * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
6568 * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
6569 * exceeded.
6570 * @hide
6571 */
6572 public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
6573
6574 /**
6575 * The length of time in milli-seconds that automatic small adjustments to
6576 * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
6577 * @hide
6578 */
6579 public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
6580
6581 /** Preferred NTP server. {@hide} */
6582 public static final String NTP_SERVER = "ntp_server";
6583 /** Timeout in milliseconds to wait for NTP server. {@hide} */
6584 public static final String NTP_TIMEOUT = "ntp_timeout";
6585
Jeff Sharkeye8a4b662015-06-27 15:43:45 -07006586 /** {@hide} */
6587 public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
6588
Christopher Tate06efb532012-08-24 15:29:27 -07006589 /**
rich cannings4d8fc792012-09-07 14:43:43 -07006590 * Whether the package manager should send package verification broadcasts for verifiers to
6591 * review apps prior to installation.
6592 * 1 = request apps to be verified prior to installation, if a verifier exists.
6593 * 0 = do not verify apps before installation
rich cannings4e5753f2012-09-19 16:03:56 -07006594 * @hide
rich cannings4d8fc792012-09-07 14:43:43 -07006595 */
6596 public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
6597
6598 /** Timeout for package verification.
rich cannings4e5753f2012-09-19 16:03:56 -07006599 * @hide */
rich cannings4d8fc792012-09-07 14:43:43 -07006600 public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
6601
6602 /** Default response code for package verification.
rich cannings4e5753f2012-09-19 16:03:56 -07006603 * @hide */
rich cannings4d8fc792012-09-07 14:43:43 -07006604 public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
6605
rich cannings4e5753f2012-09-19 16:03:56 -07006606 /**
6607 * Show package verification setting in the Settings app.
rich canningse6686b32012-09-16 14:02:20 -07006608 * 1 = show (default)
6609 * 0 = hide
rich cannings4e5753f2012-09-19 16:03:56 -07006610 * @hide
rich canningse6686b32012-09-16 14:02:20 -07006611 */
6612 public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
6613
rich cannings4d8fc792012-09-07 14:43:43 -07006614 /**
Fabrice Di Meglio1c1b4712014-11-19 17:12:32 -08006615 * Run package verification on apps installed through ADB/ADT/USB
rich cannings4e5753f2012-09-19 16:03:56 -07006616 * 1 = perform package verification on ADB installs (default)
6617 * 0 = bypass package verification on ADB installs
6618 * @hide
6619 */
6620 public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
6621
6622 /**
Christopher Tate7265abe2014-11-21 13:54:45 -08006623 * Time since last fstrim (milliseconds) after which we force one to happen
6624 * during device startup. If unset, the default is 3 days.
6625 * @hide
6626 */
6627 public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
6628
6629 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006630 * The interval in milliseconds at which to check packet counts on the
6631 * mobile data interface when screen is on, to detect possible data
6632 * connection problems.
6633 * @hide
6634 */
6635 public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
6636 "pdp_watchdog_poll_interval_ms";
6637
6638 /**
6639 * The interval in milliseconds at which to check packet counts on the
6640 * mobile data interface when screen is off, to detect possible data
6641 * connection problems.
6642 * @hide
6643 */
6644 public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
6645 "pdp_watchdog_long_poll_interval_ms";
6646
6647 /**
6648 * The interval in milliseconds at which to check packet counts on the
6649 * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
6650 * outgoing packets has been reached without incoming packets.
6651 * @hide
6652 */
6653 public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
6654 "pdp_watchdog_error_poll_interval_ms";
6655
6656 /**
6657 * The number of outgoing packets sent without seeing an incoming packet
6658 * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
6659 * device is logged to the event log
6660 * @hide
6661 */
6662 public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
6663 "pdp_watchdog_trigger_packet_count";
6664
6665 /**
6666 * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
6667 * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
6668 * attempting data connection recovery.
6669 * @hide
6670 */
6671 public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
6672 "pdp_watchdog_error_poll_count";
6673
6674 /**
6675 * The number of failed PDP reset attempts before moving to something more
6676 * drastic: re-registering to the network.
6677 * @hide
6678 */
6679 public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
6680 "pdp_watchdog_max_pdp_reset_fail_count";
6681
6682 /**
6683 * A positive value indicates how often the SamplingProfiler
6684 * should take snapshots. Zero value means SamplingProfiler
6685 * is disabled.
6686 *
6687 * @hide
6688 */
6689 public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
6690
6691 /**
6692 * URL to open browser on to allow user to manage a prepay account
6693 * @hide
6694 */
6695 public static final String SETUP_PREPAID_DATA_SERVICE_URL =
6696 "setup_prepaid_data_service_url";
6697
6698 /**
6699 * URL to attempt a GET on to see if this is a prepay device
6700 * @hide
6701 */
6702 public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
6703 "setup_prepaid_detection_target_url";
6704
6705 /**
6706 * Host to check for a redirect to after an attempt to GET
6707 * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
6708 * this is a prepaid device with zero balance.)
6709 * @hide
6710 */
6711 public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
6712 "setup_prepaid_detection_redir_host";
6713
6714 /**
Jake Hamby76a61422012-09-06 17:40:21 -07006715 * The interval in milliseconds at which to check the number of SMS sent out without asking
6716 * for use permit, to limit the un-authorized SMS usage.
6717 *
6718 * @hide
6719 */
6720 public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
6721 "sms_outgoing_check_interval_ms";
6722
6723 /**
6724 * The number of outgoing SMS sent without asking for user permit (of {@link
6725 * #SMS_OUTGOING_CHECK_INTERVAL_MS}
6726 *
6727 * @hide
6728 */
6729 public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
6730 "sms_outgoing_check_max_count";
6731
6732 /**
6733 * Used to disable SMS short code confirmation - defaults to true.
Robert Greenwalt026efcc2012-09-24 10:03:21 -07006734 * True indcates we will do the check, etc. Set to false to disable.
Jake Hamby76a61422012-09-06 17:40:21 -07006735 * @see com.android.internal.telephony.SmsUsageMonitor
6736 * @hide
6737 */
6738 public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
6739
Robert Greenwalt026efcc2012-09-24 10:03:21 -07006740 /**
6741 * Used to select which country we use to determine premium sms codes.
6742 * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
6743 * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
6744 * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
6745 * @hide
6746 */
6747 public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
6748
Jake Hamby76a61422012-09-06 17:40:21 -07006749 /**
JP Abgrall32d1ac4d2014-02-21 12:05:20 -08006750 * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
6751 * @hide
6752 */
6753 public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
6754
6755 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006756 * Used to disable Tethering on a device - defaults to true
6757 * @hide
6758 */
6759 public static final String TETHER_SUPPORTED = "tether_supported";
6760
6761 /**
6762 * Used to require DUN APN on the device or not - defaults to a build config value
6763 * which defaults to false
6764 * @hide
6765 */
6766 public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
6767
6768 /**
6769 * Used to hold a gservices-provisioned apn value for DUN. If set, or the
6770 * corresponding build config values are set it will override the APN DB
6771 * values.
6772 * Consists of a comma seperated list of strings:
6773 * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
6774 * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
6775 * @hide
6776 */
6777 public static final String TETHER_DUN_APN = "tether_dun_apn";
6778
6779 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006780 * USB Mass Storage Enabled
6781 */
6782 public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
6783
6784 /**
6785 * If this setting is set (to anything), then all references
6786 * to Gmail on the device must change to Google Mail.
6787 */
6788 public static final String USE_GOOGLE_MAIL = "use_google_mail";
6789
Hui Shu22671772014-10-01 21:41:07 +00006790 /**
6791 * Webview Data reduction proxy key.
6792 * @hide
6793 */
6794 public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
6795 "webview_data_reduction_proxy_key";
6796
Christopher Tate06efb532012-08-24 15:29:27 -07006797 /**
Jeff Brown89d55462012-09-19 11:33:42 -07006798 * Whether Wifi display is enabled/disabled
6799 * 0=disabled. 1=enabled.
6800 * @hide
6801 */
6802 public static final String WIFI_DISPLAY_ON = "wifi_display_on";
6803
6804 /**
Chong Zhang1f3ecaa2013-05-03 15:55:36 -07006805 * Whether Wifi display certification mode is enabled/disabled
6806 * 0=disabled. 1=enabled.
6807 * @hide
6808 */
6809 public static final String WIFI_DISPLAY_CERTIFICATION_ON =
6810 "wifi_display_certification_on";
6811
6812 /**
Chong Zhange38af812013-08-29 17:25:17 -07006813 * WPS Configuration method used by Wifi display, this setting only
6814 * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
6815 *
6816 * Possible values are:
6817 *
6818 * WpsInfo.INVALID: use default WPS method chosen by framework
6819 * WpsInfo.PBC : use Push button
6820 * WpsInfo.KEYPAD : use Keypad
6821 * WpsInfo.DISPLAY: use Display
6822 * @hide
6823 */
6824 public static final String WIFI_DISPLAY_WPS_CONFIG =
6825 "wifi_display_wps_config";
6826
6827 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006828 * Whether to notify the user of open networks.
6829 * <p>
6830 * If not connected and the scan results have an open network, we will
6831 * put this notification up. If we attempt to connect to a network or
6832 * the open network(s) disappear, we remove the notification. When we
6833 * show the notification, we will not show it again for
6834 * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
6835 */
6836 public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
6837 "wifi_networks_available_notification_on";
6838 /**
6839 * {@hide}
6840 */
6841 public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
6842 "wimax_networks_available_notification_on";
6843
6844 /**
6845 * Delay (in seconds) before repeating the Wi-Fi networks available notification.
6846 * Connecting to a network will reset the timer.
6847 */
6848 public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
6849 "wifi_networks_available_repeat_delay";
6850
6851 /**
Robert Greenwalt3ea0c992013-10-03 21:13:49 +00006852 * 802.11 country code in ISO 3166 format
6853 * @hide
6854 */
6855 public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
6856
6857 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006858 * The interval in milliseconds to issue wake up scans when wifi needs
6859 * to connect. This is necessary to connect to an access point when
6860 * device is on the move and the screen is off.
6861 * @hide
6862 */
6863 public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
6864 "wifi_framework_scan_interval_ms";
6865
6866 /**
6867 * The interval in milliseconds after which Wi-Fi is considered idle.
6868 * When idle, it is possible for the device to be switched from Wi-Fi to
6869 * the mobile data network.
6870 * @hide
6871 */
6872 public static final String WIFI_IDLE_MS = "wifi_idle_ms";
6873
6874 /**
6875 * When the number of open networks exceeds this number, the
6876 * least-recently-used excess networks will be removed.
6877 */
6878 public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
6879
6880 /**
6881 * Whether the Wi-Fi should be on. Only the Wi-Fi service should touch this.
6882 */
6883 public static final String WIFI_ON = "wifi_on";
6884
6885 /**
Irfan Sheriff11aefad2013-03-06 07:57:41 -08006886 * Setting to allow scans to be enabled even wifi is turned off for connectivity.
6887 * @hide
6888 */
6889 public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
6890 "wifi_scan_always_enabled";
6891
6892 /**
Wei Wangd91f1932015-03-19 15:09:56 -07006893 * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
6894 * connectivity.
6895 * @hide
6896 */
6897 public static final String BLE_SCAN_ALWAYS_AVAILABLE =
6898 "ble_scan_always_enabled";
6899
6900 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006901 * Used to save the Wifi_ON state prior to tethering.
6902 * This state will be checked to restore Wifi after
6903 * the user turns off tethering.
6904 *
6905 * @hide
6906 */
6907 public static final String WIFI_SAVED_STATE = "wifi_saved_state";
6908
6909 /**
6910 * The interval in milliseconds to scan as used by the wifi supplicant
6911 * @hide
6912 */
6913 public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
6914 "wifi_supplicant_scan_interval_ms";
6915
vandwalle7c3606c2014-03-31 19:12:07 -07006916 /**
6917 * whether frameworks handles wifi auto-join
6918 * @hide
6919 */
6920 public static final String WIFI_ENHANCED_AUTO_JOIN =
6921 "wifi_enhanced_auto_join";
6922
6923 /**
6924 * whether settings show RSSI
6925 * @hide
6926 */
6927 public static final String WIFI_NETWORK_SHOW_RSSI =
6928 "wifi_network_show_rssi";
6929
6930 /**
Irfan Sheriff3809f502012-09-17 16:04:57 -07006931 * The interval in milliseconds to scan at supplicant when p2p is connected
6932 * @hide
6933 */
6934 public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
6935 "wifi_scan_interval_p2p_connected_ms";
6936
6937 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006938 * Whether the Wi-Fi watchdog is enabled.
6939 */
6940 public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
6941
6942 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006943 * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
6944 * the setting needs to be set to 0 to disable it.
6945 * @hide
6946 */
6947 public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
6948 "wifi_watchdog_poor_network_test_enabled";
6949
6950 /**
6951 * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
6952 * needs to be set to 0 to disable it.
6953 * @hide
6954 */
6955 public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
6956 "wifi_suspend_optimizations_enabled";
6957
6958 /**
6959 * The maximum number of times we will retry a connection to an access
6960 * point for which we have failed in acquiring an IP address from DHCP.
6961 * A value of N means that we will make N+1 connection attempts in all.
6962 */
6963 public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
6964
6965 /**
6966 * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
6967 * data connectivity to be established after a disconnect from Wi-Fi.
6968 */
6969 public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
6970 "wifi_mobile_data_transition_wakelock_timeout_ms";
6971
6972 /**
Zoltan Szatmary-Ban4045d242015-05-27 12:42:39 +01006973 * This setting controls whether WiFi configurations created by a Device Owner app
6974 * should be locked down (that is, be editable or removable only by the Device Owner App,
6975 * not even by Settings app).
6976 * This setting takes integer values. Non-zero values mean DO created configurations
6977 * are locked down. Value of zero means they are not. Default value in the absence of
6978 * actual value to this setting is 0.
6979 */
6980 public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
6981 "wifi_device_owner_configs_lockdown";
6982
6983 /**
Christopher Tate06efb532012-08-24 15:29:27 -07006984 * The operational wifi frequency band
6985 * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
6986 * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
6987 * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
6988 *
6989 * @hide
6990 */
6991 public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
6992
6993 /**
6994 * The Wi-Fi peer-to-peer device name
6995 * @hide
6996 */
6997 public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
6998
6999 /**
Robert Greenwaltc12783a2013-05-16 12:48:20 -07007000 * The min time between wifi disable and wifi enable
7001 * @hide
7002 */
7003 public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
7004
7005 /**
Jeff Davidsona20ca67d2014-12-16 11:48:54 -08007006 * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
7007 * from an ephemeral network if there is no BSSID for that network with a non-null score that
7008 * has been seen in this time period.
7009 *
7010 * If this is less than or equal to zero, we use a more conservative behavior and only check
7011 * for a non-null score from the currently connected or target BSSID.
7012 * @hide
7013 */
7014 public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
7015 "wifi_ephemeral_out_of_range_timeout_ms";
7016
7017 /**
Christopher Tatec868b642012-09-12 17:41:04 -07007018 * The number of milliseconds to delay when checking for data stalls during
7019 * non-aggressive detection. (screen is turned off.)
7020 * @hide
7021 */
7022 public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
7023 "data_stall_alarm_non_aggressive_delay_in_ms";
7024
7025 /**
7026 * The number of milliseconds to delay when checking for data stalls during
7027 * aggressive detection. (screen on or suspected data stall)
7028 * @hide
7029 */
7030 public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
7031 "data_stall_alarm_aggressive_delay_in_ms";
7032
7033 /**
Wink Savillece1e3792013-09-03 16:41:44 -07007034 * The number of milliseconds to allow the provisioning apn to remain active
7035 * @hide
7036 */
7037 public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
7038 "provisioning_apn_alarm_delay_in_ms";
7039
7040 /**
Christopher Tatec868b642012-09-12 17:41:04 -07007041 * The interval in milliseconds at which to check gprs registration
7042 * after the first registration mismatch of gprs and voice service,
7043 * to detect possible data network registration problems.
7044 *
7045 * @hide
7046 */
7047 public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
7048 "gprs_register_check_period_ms";
7049
7050 /**
Christopher Tate06efb532012-08-24 15:29:27 -07007051 * Nonzero causes Log.wtf() to crash.
7052 * @hide
7053 */
7054 public static final String WTF_IS_FATAL = "wtf_is_fatal";
7055
Eric Laurentbc0fab1f2012-09-19 11:24:41 -07007056 /**
7057 * Ringer mode. This is used internally, changing this value will not
7058 * change the ringer mode. See AudioManager.
7059 */
7060 public static final String MODE_RINGER = "mode_ringer";
Christopher Tate06efb532012-08-24 15:29:27 -07007061
Jeff Brownd4935962012-09-25 13:27:20 -07007062 /**
7063 * Overlay display devices setting.
7064 * The associated value is a specially formatted string that describes the
7065 * size and density of simulated secondary display devices.
7066 * <p>
7067 * Format: {width}x{height}/{dpi};...
7068 * </p><p>
7069 * Example:
7070 * <ul>
7071 * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
7072 * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
7073 * at 1080p and the second at 720p.</li>
7074 * <li>If the value is empty, then no overlay display devices are created.</li>
7075 * </ul></p>
7076 *
7077 * @hide
7078 */
7079 public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
Christopher Tate06efb532012-08-24 15:29:27 -07007080
Jeff Sharkey625239a2012-09-26 22:03:49 -07007081 /**
7082 * Threshold values for the duration and level of a discharge cycle,
7083 * under which we log discharge cycle info.
7084 *
7085 * @hide
7086 */
7087 public static final String
7088 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
7089
7090 /** @hide */
7091 public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
7092
7093 /**
7094 * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
7095 * intents on application crashes and ANRs. If this is disabled, the
7096 * crash/ANR dialog will never display the "Report" button.
7097 * <p>
7098 * Type: int (0 = disallow, 1 = allow)
7099 *
7100 * @hide
7101 */
7102 public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
7103
7104 /**
7105 * Maximum age of entries kept by {@link DropBoxManager}.
7106 *
7107 * @hide
7108 */
7109 public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
7110
7111 /**
7112 * Maximum number of entry files which {@link DropBoxManager} will keep
7113 * around.
7114 *
7115 * @hide
7116 */
7117 public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
7118
7119 /**
7120 * Maximum amount of disk space used by {@link DropBoxManager} no matter
7121 * what.
7122 *
7123 * @hide
7124 */
7125 public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
7126
7127 /**
7128 * Percent of free disk (excluding reserve) which {@link DropBoxManager}
7129 * will use.
7130 *
7131 * @hide
7132 */
7133 public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
7134
7135 /**
7136 * Percent of total disk which {@link DropBoxManager} will never dip
7137 * into.
7138 *
7139 * @hide
7140 */
7141 public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
7142
7143 /**
7144 * Prefix for per-tag dropbox disable/enable settings.
7145 *
7146 * @hide
7147 */
7148 public static final String DROPBOX_TAG_PREFIX = "dropbox:";
7149
7150 /**
7151 * Lines of logcat to include with system crash/ANR/etc. reports, as a
7152 * prefix of the dropbox tag of the report type. For example,
7153 * "logcat_for_system_server_anr" controls the lines of logcat captured
7154 * with system server ANR reports. 0 to disable.
7155 *
7156 * @hide
7157 */
7158 public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
7159
7160 /**
7161 * The interval in minutes after which the amount of free storage left
7162 * on the device is logged to the event log
7163 *
7164 * @hide
7165 */
7166 public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
7167
7168 /**
7169 * Threshold for the amount of change in disk free space required to
7170 * report the amount of free space. Used to prevent spamming the logs
7171 * when the disk free space isn't changing frequently.
7172 *
7173 * @hide
7174 */
7175 public static final String
7176 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
7177
7178 /**
7179 * Minimum percentage of free storage on the device that is used to
7180 * determine if the device is running low on storage. The default is 10.
7181 * <p>
7182 * Say this value is set to 10, the device is considered running low on
7183 * storage if 90% or more of the device storage is filled up.
7184 *
7185 * @hide
7186 */
7187 public static final String
7188 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
7189
7190 /**
7191 * Maximum byte size of the low storage threshold. This is to ensure
7192 * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
7193 * overly large threshold for large storage devices. Currently this must
7194 * be less than 2GB. This default is 500MB.
7195 *
7196 * @hide
7197 */
7198 public static final String
7199 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
7200
7201 /**
7202 * Minimum bytes of free storage on the device before the data partition
7203 * is considered full. By default, 1 MB is reserved to avoid system-wide
7204 * SQLite disk full exceptions.
7205 *
7206 * @hide
7207 */
7208 public static final String
7209 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
7210
7211 /**
7212 * The maximum reconnect delay for short network outages or when the
7213 * network is suspended due to phone use.
7214 *
7215 * @hide
7216 */
7217 public static final String
7218 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
7219
7220 /**
7221 * The number of milliseconds to delay before sending out
Erik Kline8f29dcf2014-12-08 16:25:20 +09007222 * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
Jeff Sharkey625239a2012-09-26 22:03:49 -07007223 *
7224 * @hide
7225 */
7226 public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
7227
Vinit Deshapnde1f12cb52013-08-21 13:09:01 -07007228
7229 /**
7230 * Network sampling interval, in seconds. We'll generate link information
7231 * about bytes/packets sent and error rates based on data sampled in this interval
7232 *
7233 * @hide
7234 */
7235
7236 public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
7237 "connectivity_sampling_interval_in_seconds";
7238
Jeff Sharkey625239a2012-09-26 22:03:49 -07007239 /**
Jason Monk602b2322013-07-03 17:04:33 -04007240 * The series of successively longer delays used in retrying to download PAC file.
7241 * Last delay is used between successful PAC downloads.
7242 *
7243 * @hide
7244 */
7245 public static final String PAC_CHANGE_DELAY = "pac_change_delay";
7246
7247 /**
Jeff Sharkey625239a2012-09-26 22:03:49 -07007248 * Setting to turn off captive portal detection. Feature is enabled by
7249 * default and the setting needs to be set to 0 to disable it.
7250 *
7251 * @hide
7252 */
7253 public static final String
7254 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
7255
7256 /**
7257 * The server used for captive portal detection upon a new conection. A
7258 * 204 response code from the server is used for validation.
7259 *
7260 * @hide
7261 */
7262 public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
7263
7264 /**
7265 * Whether network service discovery is enabled.
7266 *
7267 * @hide
7268 */
7269 public static final String NSD_ON = "nsd_on";
7270
7271 /**
7272 * Let user pick default install location.
7273 *
7274 * @hide
7275 */
7276 public static final String SET_INSTALL_LOCATION = "set_install_location";
7277
7278 /**
7279 * Default install location value.
7280 * 0 = auto, let system decide
7281 * 1 = internal
7282 * 2 = sdcard
7283 * @hide
7284 */
7285 public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
7286
7287 /**
7288 * ms during which to consume extra events related to Inet connection
7289 * condition after a transtion to fully-connected
7290 *
7291 * @hide
7292 */
7293 public static final String
7294 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
7295
7296 /**
7297 * ms during which to consume extra events related to Inet connection
7298 * condtion after a transtion to partly-connected
7299 *
7300 * @hide
7301 */
7302 public static final String
7303 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
7304
7305 /** {@hide} */
7306 public static final String
7307 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
7308
7309 /**
7310 * Host name and port for global http proxy. Uses ':' seperator for
7311 * between host and port.
7312 */
7313 public static final String HTTP_PROXY = "http_proxy";
7314
7315 /**
7316 * Host name for global http proxy. Set via ConnectivityManager.
7317 *
7318 * @hide
7319 */
7320 public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
7321
7322 /**
7323 * Integer host port for global http proxy. Set via ConnectivityManager.
7324 *
7325 * @hide
7326 */
7327 public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
7328
7329 /**
7330 * Exclusion list for global proxy. This string contains a list of
7331 * comma-separated domains where the global proxy does not apply.
7332 * Domains should be listed in a comma- separated list. Example of
7333 * acceptable formats: ".domain1.com,my.domain2.com" Use
7334 * ConnectivityManager to set/get.
7335 *
7336 * @hide
7337 */
7338 public static final String
7339 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
7340
7341 /**
Jason Monk602b2322013-07-03 17:04:33 -04007342 * The location PAC File for the proxy.
7343 * @hide
7344 */
7345 public static final String
7346 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
7347
7348 /**
Jeff Sharkey625239a2012-09-26 22:03:49 -07007349 * Enables the UI setting to allow the user to specify the global HTTP
7350 * proxy and associated exclusion list.
7351 *
7352 * @hide
7353 */
7354 public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
7355
7356 /**
7357 * Setting for default DNS in case nobody suggests one
7358 *
7359 * @hide
7360 */
7361 public static final String DEFAULT_DNS_SERVER = "default_dns_server";
7362
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007363 /** {@hide} */
7364 public static final String
7365 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
7366 /** {@hide} */
7367 public static final String
7368 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
7369 /** {@hide} */
7370 public static final String
7371 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
Kim Schulz0d376052013-08-22 11:18:02 +02007372 /** {@hide} */
7373 public static final String
7374 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
Casper Bonde2a5f6082015-03-19 10:36:45 +01007375 /** {@hide} */
7376 public static final String
7377 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007378
7379 /**
Adam Lesinski31c05d12015-06-09 17:34:04 -07007380 * Device Idle (Doze) specific settings.
7381 * This is encoded as a key=value list, separated by commas. Ex:
7382 *
7383 * "inactive_timeout=60000,sensing_timeout=400000"
7384 *
7385 * The following keys are supported:
7386 *
7387 * <pre>
7388 * inactive_to (long)
7389 * sensing_to (long)
7390 * motion_inactive_to (long)
7391 * idle_after_inactive_to (long)
7392 * idle_pending_to (long)
7393 * max_idle_pending_to (long)
7394 * idle_pending_factor (float)
7395 * idle_to (long)
7396 * max_idle_to (long)
7397 * idle_factor (float)
7398 * min_time_to_alarm (long)
7399 * max_temp_app_whitelist_duration (long)
7400 * </pre>
7401 *
7402 * <p>
7403 * Type: string
7404 * @hide
7405 * @see com.android.server.DeviceIdleController.Constants
7406 */
7407 public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
7408
7409 /**
Adam Lesinskia6232df2015-06-11 18:16:41 -07007410 * App standby (app idle) specific settings.
7411 * This is encoded as a key=value list, separated by commas. Ex:
7412 *
7413 * "idle_duration=5000,parole_interval=4500"
7414 *
7415 * The following keys are supported:
7416 *
7417 * <pre>
7418 * idle_duration (long)
7419 * wallclock_threshold (long)
7420 * parole_interval (long)
7421 * parole_duration (long)
7422 * </pre>
7423 *
7424 * <p>
7425 * Type: string
7426 * @hide
7427 * @see com.android.server.usage.UsageStatsService.SettingsObserver
7428 */
7429 public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
7430
7431 /**
Dianne Hackborna750a632015-06-16 17:18:23 -07007432 * Alarm manager specific settings.
7433 * This is encoded as a key=value list, separated by commas. Ex:
7434 *
7435 * "min_futurity=5000,allow_while_idle_short_time=4500"
7436 *
7437 * The following keys are supported:
7438 *
7439 * <pre>
7440 * min_futurity (long)
7441 * min_interval (long)
7442 * allow_while_idle_short_time (long)
7443 * allow_while_idle_long_time (long)
7444 * allow_while_idle_whitelist_duration (long)
7445 * </pre>
7446 *
7447 * <p>
7448 * Type: string
7449 * @hide
7450 * @see com.android.server.AlarmManagerService.Constants
7451 */
7452 public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
7453
7454 /**
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007455 * Get the key that retrieves a bluetooth headset's priority.
7456 * @hide
7457 */
7458 public static final String getBluetoothHeadsetPriorityKey(String address) {
Elliott Hughescb64d432013-08-02 10:00:44 -07007459 return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007460 }
7461
7462 /**
7463 * Get the key that retrieves a bluetooth a2dp sink's priority.
7464 * @hide
7465 */
7466 public static final String getBluetoothA2dpSinkPriorityKey(String address) {
Elliott Hughescb64d432013-08-02 10:00:44 -07007467 return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007468 }
7469
7470 /**
7471 * Get the key that retrieves a bluetooth Input Device's priority.
7472 * @hide
7473 */
7474 public static final String getBluetoothInputDevicePriorityKey(String address) {
Elliott Hughescb64d432013-08-02 10:00:44 -07007475 return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
Jeff Sharkey0ac10282012-10-01 12:50:22 -07007476 }
7477
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007478 /**
Kim Schulz0d376052013-08-22 11:18:02 +02007479 * Get the key that retrieves a bluetooth map priority.
7480 * @hide
7481 */
7482 public static final String getBluetoothMapPriorityKey(String address) {
7483 return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
7484 }
Casper Bonde2a5f6082015-03-19 10:36:45 +01007485
7486 /**
7487 * Get the key that retrieves a bluetooth map priority.
7488 * @hide
7489 */
7490 public static final String getBluetoothSapPriorityKey(String address) {
7491 return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
7492 }
7493
Kim Schulz0d376052013-08-22 11:18:02 +02007494 /**
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007495 * Scaling factor for normal window animations. Setting to 0 will
7496 * disable window animations.
7497 */
7498 public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
7499
7500 /**
7501 * Scaling factor for activity transition animations. Setting to 0 will
7502 * disable window animations.
7503 */
7504 public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
7505
7506 /**
7507 * Scaling factor for Animator-based animations. This affects both the
7508 * start delay and duration of all such animations. Setting to 0 will
7509 * cause animations to end immediately. The default value is 1.
7510 */
7511 public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
7512
7513 /**
7514 * Scaling factor for normal window animations. Setting to 0 will
7515 * disable window animations.
7516 *
7517 * @hide
7518 */
7519 public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
7520
7521 /**
7522 * If 0, the compatibility mode is off for all applications.
7523 * If 1, older applications run under compatibility mode.
7524 * TODO: remove this settings before code freeze (bug/1907571)
7525 * @hide
7526 */
7527 public static final String COMPATIBILITY_MODE = "compatibility_mode";
7528
7529 /**
7530 * CDMA only settings
7531 * Emergency Tone 0 = Off
7532 * 1 = Alert
7533 * 2 = Vibrate
7534 * @hide
7535 */
7536 public static final String EMERGENCY_TONE = "emergency_tone";
7537
7538 /**
7539 * CDMA only settings
7540 * Whether the auto retry is enabled. The value is
7541 * boolean (1 or 0).
7542 * @hide
7543 */
7544 public static final String CALL_AUTO_RETRY = "call_auto_retry";
7545
7546 /**
Sungmin Choie099ab12014-06-09 14:45:51 +09007547 * See RIL_PreferredNetworkType in ril.h
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007548 * @hide
7549 */
7550 public static final String PREFERRED_NETWORK_MODE =
7551 "preferred_network_mode";
7552
7553 /**
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007554 * Name of an application package to be debugged.
7555 */
7556 public static final String DEBUG_APP = "debug_app";
7557
7558 /**
7559 * If 1, when launching DEBUG_APP it will wait for the debugger before
7560 * starting user code. If 0, it will run normally.
7561 */
7562 public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
7563
7564 /**
7565 * Control whether the process CPU usage meter should be shown.
7566 */
7567 public static final String SHOW_PROCESSES = "show_processes";
7568
7569 /**
Ruchi Kandoi62b8a492014-04-17 18:01:40 -07007570 * If 1 low power mode is enabled.
7571 * @hide
7572 */
7573 public static final String LOW_POWER_MODE = "low_power";
7574
John Spurlockf8f524c2014-06-10 14:47:29 -04007575 /**
7576 * Battery level [1-99] at which low power mode automatically turns on.
Dianne Hackborn14272302014-06-10 23:13:02 -07007577 * If 0, it will not automatically turn on.
John Spurlockf8f524c2014-06-10 14:47:29 -04007578 * @hide
7579 */
7580 public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
7581
Ruchi Kandoi62b8a492014-04-17 18:01:40 -07007582 /**
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007583 * If 1, the activity manager will aggressively finish activities and
7584 * processes as soon as they are no longer needed. If 0, the normal
7585 * extended lifetime is used.
7586 */
Dianne Hackborn89ad4562014-08-24 16:45:38 -07007587 public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
Jeff Sharkey6e2bee72012-10-01 13:39:08 -07007588
Christopher Tate66488d62012-10-02 11:58:01 -07007589 /**
Eric Laurent7ee1e4f2012-10-26 18:11:21 -07007590 * Use Dock audio output for media:
7591 * 0 = disabled
7592 * 1 = enabled
7593 * @hide
7594 */
7595 public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
7596
7597 /**
Eric Laurent05274f32012-11-29 12:48:18 -08007598 * Persisted safe headphone volume management state by AudioService
7599 * @hide
7600 */
7601 public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
7602
7603 /**
Geremy Condraa0735112013-03-26 21:49:26 -07007604 * URL for tzinfo (time zone) updates
7605 * @hide
7606 */
7607 public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
7608
7609 /**
7610 * URL for tzinfo (time zone) update metadata
7611 * @hide
7612 */
7613 public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
7614
7615 /**
7616 * URL for selinux (mandatory access control) updates
7617 * @hide
7618 */
7619 public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
7620
7621 /**
7622 * URL for selinux (mandatory access control) update metadata
7623 * @hide
7624 */
7625 public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
7626
7627 /**
7628 * URL for sms short code updates
7629 * @hide
7630 */
7631 public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
7632 "sms_short_codes_content_url";
7633
7634 /**
7635 * URL for sms short code update metadata
7636 * @hide
7637 */
7638 public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
7639 "sms_short_codes_metadata_url";
7640
7641 /**
Amit Mahajan9069fab2015-05-01 11:05:47 -07007642 * URL for apn_db updates
7643 * @hide
7644 */
7645 public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
7646
7647 /**
7648 * URL for apn_db update metadata
7649 * @hide
7650 */
7651 public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
7652
7653 /**
Geremy Condraa0735112013-03-26 21:49:26 -07007654 * URL for cert pinlist updates
7655 * @hide
7656 */
7657 public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
7658
7659 /**
7660 * URL for cert pinlist updates
7661 * @hide
7662 */
7663 public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
7664
Geremy Condra757ee522013-03-29 16:39:45 -07007665 /**
Ben Gruver633dc9b2013-04-04 12:05:49 -07007666 * URL for intent firewall updates
7667 * @hide
7668 */
7669 public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
7670 "intent_firewall_content_url";
7671
7672 /**
7673 * URL for intent firewall update metadata
7674 * @hide
7675 */
7676 public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
7677 "intent_firewall_metadata_url";
7678
7679 /**
Geremy Condra4e7f7e82013-03-26 21:09:01 -07007680 * SELinux enforcement status. If 0, permissive; if 1, enforcing.
7681 * @hide
7682 */
7683 public static final String SELINUX_STATUS = "selinux_status";
7684
Geremy Condraa0735112013-03-26 21:49:26 -07007685 /**
Amith Yamasanid8415f42013-08-07 20:15:10 -07007686 * Developer setting to force RTL layout.
7687 * @hide
7688 */
7689 public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
7690
7691 /**
Daniel Sandlerdea64622013-09-23 16:05:57 -04007692 * Milliseconds after screen-off after which low battery sounds will be silenced.
7693 *
7694 * If zero, battery sounds will always play.
7695 * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
7696 *
7697 * @hide
7698 */
7699 public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
7700
7701 /**
Evan Charltoncc7b0432014-01-14 14:47:11 -08007702 * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
Dianne Hackborna3fb40d2014-08-12 15:06:50 -07007703 * the caller is done with this, they should call {@link ContentResolver#delete} to
Evan Charltoncc7b0432014-01-14 14:47:11 -08007704 * clean up any value that they may have written.
7705 *
7706 * @hide
7707 */
7708 public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
7709
John Spurlockc6d1c602014-01-17 15:22:06 -05007710 /**
7711 * Defines global runtime overrides to window policy.
7712 *
Jorim Jaggib10e33f2015-02-04 21:57:40 +01007713 * See {@link com.android.server.policy.PolicyControl} for value format.
John Spurlockc6d1c602014-01-17 15:22:06 -05007714 *
7715 * @hide
7716 */
7717 public static final String POLICY_CONTROL = "policy_control";
Evan Charltoncc7b0432014-01-14 14:47:11 -08007718
7719 /**
John Spurlockae641c92014-06-30 18:11:40 -04007720 * Defines global zen mode. ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
7721 * or ZEN_MODE_NO_INTERRUPTIONS.
John Spurlocke677d712014-02-13 12:52:19 -05007722 *
7723 * @hide
7724 */
7725 public static final String ZEN_MODE = "zen_mode";
7726
7727 /** @hide */ public static final int ZEN_MODE_OFF = 0;
John Spurlockae641c92014-06-30 18:11:40 -04007728 /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
7729 /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
John Spurlock4f1163c2015-04-02 17:41:21 -04007730 /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
John Spurlocke677d712014-02-13 12:52:19 -05007731
7732 /** @hide */ public static String zenModeToString(int mode) {
John Spurlockae641c92014-06-30 18:11:40 -04007733 if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
John Spurlock4f1163c2015-04-02 17:41:21 -04007734 if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
John Spurlockae641c92014-06-30 18:11:40 -04007735 if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
7736 return "ZEN_MODE_OFF";
John Spurlocke677d712014-02-13 12:52:19 -05007737 }
7738
John Spurlockb2278d62015-04-07 12:47:12 -04007739 /** @hide */ public static boolean isValidZenMode(int value) {
7740 switch (value) {
7741 case Global.ZEN_MODE_OFF:
7742 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
7743 case Global.ZEN_MODE_ALARMS:
7744 case Global.ZEN_MODE_NO_INTERRUPTIONS:
7745 return true;
7746 default:
7747 return false;
7748 }
7749 }
7750
John Spurlocke677d712014-02-13 12:52:19 -05007751 /**
Julia Reynolds9b11fdb2015-07-31 09:49:55 -04007752 * Value of the ringer before entering zen mode.
7753 *
7754 * @hide
7755 */
7756 public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
7757
7758 /**
John Spurlock056c5192014-04-20 21:52:01 -04007759 * Opaque value, changes when persisted zen mode configuration changes.
7760 *
7761 * @hide
7762 */
7763 public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
7764
7765 /**
Chris Wren7bd241232014-02-28 16:25:05 -05007766 * Defines global heads up toggle. One of HEADS_UP_OFF, HEADS_UP_ON.
7767 *
7768 * @hide
7769 */
Chris Wren10d82df2014-03-01 10:34:51 -05007770 public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
7771 "heads_up_notifications_enabled";
Chris Wren7bd241232014-02-28 16:25:05 -05007772
7773 /** @hide */ public static final int HEADS_UP_OFF = 0;
7774 /** @hide */ public static final int HEADS_UP_ON = 1;
7775
7776 /**
Jerome Poichet147b4d72014-05-12 18:13:27 -07007777 * The name of the device
7778 *
7779 * @hide
7780 */
7781 public static final String DEVICE_NAME = "device_name";
7782
7783 /**
Jeff Davidson56f9f732014-08-14 16:47:23 -07007784 * Whether the NetworkScoringService has been first initialized.
7785 * <p>
7786 * Type: int (0 for false, 1 for true)
7787 * @hide
7788 */
7789 public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
7790
7791 /**
Jim Miller6848dc82014-10-13 18:51:53 -07007792 * Whether the user wants to be prompted for password to decrypt the device on boot.
7793 * This only matters if the storage is encrypted.
7794 * <p>
7795 * Type: int (0 for false, 1 for true)
7796 * @hide
7797 */
7798 public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
7799
7800 /**
Etan Cohen93bbf272015-05-04 18:01:47 -07007801 * Whether the Volte is enabled
Libin.Tang@motorola.com0499bb52014-10-10 14:55:57 -05007802 * <p>
7803 * Type: int (0 for false, 1 for true)
7804 * @hide
7805 */
Etan Cohene41a9cf2014-10-22 10:50:46 -07007806 public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
Libin.Tang@motorola.com0499bb52014-10-10 14:55:57 -05007807
7808 /**
Etan Cohen93bbf272015-05-04 18:01:47 -07007809 * Whether VT (Video Telephony over IMS) is enabled
7810 * <p>
7811 * Type: int (0 for false, 1 for true)
7812 *
7813 * @hide
7814 */
7815 public static final String VT_IMS_ENABLED = "vt_ims_enabled";
7816
7817 /**
Etan Cohen9c8f21b2014-12-23 15:02:19 -08007818 * Whether WFC is enabled
7819 * <p>
7820 * Type: int (0 for false, 1 for true)
7821 *
7822 * @hide
7823 */
7824 public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
7825
7826 /**
7827 * WFC Mode.
7828 * <p>
7829 * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
7830 *
7831 * @hide
7832 */
7833 public static final String WFC_IMS_MODE = "wfc_ims_mode";
7834
7835 /**
7836 * Whether WFC roaming is enabled
7837 * <p>
7838 * Type: int (0 for false, 1 for true)
7839 *
7840 * @hide
7841 */
7842 public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
7843
7844 /**
Amit Mahajan4fea0922014-11-18 12:56:28 -08007845 * Whether user can enable/disable LTE as a preferred network. A carrier might control
7846 * this via gservices, OMA-DM, carrier app, etc.
7847 * <p>
7848 * Type: int (0 for false, 1 for true)
7849 * @hide
7850 */
7851 public static final String LTE_SERVICE_FORCED = "lte_service_forced";
7852
7853 /**
Svet Ganov2acf0632015-11-24 19:10:59 -08007854 * Ephemeral app cookie max size in bytes.
7855 * <p>
7856 * Type: int
7857 * @hide
7858 */
7859 public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
7860 "ephemeral_cookie_max_size_bytes";
7861
7862 /**
7863 * The duration for caching uninstalled ephemeral apps.
7864 * <p>
7865 * Type: long
7866 * @hide
7867 */
7868 public static final String UNINSTALLED_EPHEMERAL_APP_CACHE_DURATION_MILLIS =
7869 "uninstalled_ephemeral_app_cache_duration_millis";
7870
7871 /**
Christopher Tate66488d62012-10-02 11:58:01 -07007872 * Settings to backup. This is here so that it's in the same place as the settings
7873 * keys and easy to update.
7874 *
7875 * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
7876 * and Secure as well. This is because those tables drive both backup and
7877 * restore, and restore needs to properly whitelist keys that used to live
7878 * in those namespaces. The keys will only actually be backed up / restored
7879 * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
7880 *
7881 * NOTE: Settings are backed up and restored in the order they appear
7882 * in this array. If you have one setting depending on another,
7883 * make sure that they are ordered appropriately.
7884 *
7885 * @hide
7886 */
7887 public static final String[] SETTINGS_TO_BACKUP = {
Christopher Tate58f41ec2013-01-11 15:40:36 -08007888 BUGREPORT_IN_POWER_MENU,
Christopher Tate66488d62012-10-02 11:58:01 -07007889 STAY_ON_WHILE_PLUGGED_IN,
Christopher Tate66488d62012-10-02 11:58:01 -07007890 AUTO_TIME,
7891 AUTO_TIME_ZONE,
7892 POWER_SOUNDS_ENABLED,
7893 DOCK_SOUNDS_ENABLED,
Ritesh Reddyf8f12132015-11-20 16:43:28 +00007894 CHARGING_SOUNDS_ENABLED,
Christopher Tate66488d62012-10-02 11:58:01 -07007895 USB_MASS_STORAGE_ENABLED,
7896 ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
7897 WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
7898 WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
Christopher Tate16eb7cd2012-10-09 15:26:30 -07007899 WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
Christopher Tate66488d62012-10-02 11:58:01 -07007900 WIFI_NUM_OPEN_NETWORKS_KEPT,
7901 EMERGENCY_TONE,
7902 CALL_AUTO_RETRY,
Amith Yamasani94005242014-10-31 11:35:13 -07007903 DOCK_AUDIO_MEDIA_ENABLED,
7904 LOW_POWER_MODE_TRIGGER_LEVEL
Christopher Tate66488d62012-10-02 11:58:01 -07007905 };
7906
Christopher Tate06efb532012-08-24 15:29:27 -07007907 // Populated lazily, guarded by class object:
Dianne Hackborn139748f2012-09-24 11:36:57 -07007908 private static NameValueCache sNameValueCache = new NameValueCache(
7909 SYS_PROP_SETTING_VERSION,
7910 CONTENT_URI,
7911 CALL_METHOD_GET_GLOBAL,
7912 CALL_METHOD_PUT_GLOBAL);
Christopher Tate06efb532012-08-24 15:29:27 -07007913
Christopher Tateaa036a22014-05-19 16:33:27 -07007914 // Certain settings have been moved from global to the per-user secure namespace
7915 private static final HashSet<String> MOVED_TO_SECURE;
7916 static {
7917 MOVED_TO_SECURE = new HashSet<String>(1);
7918 MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
7919 }
7920
Svetoslav683914b2015-01-15 14:22:26 -08007921 /** @hide */
7922 public static void getMovedToSecureSettings(Set<String> outKeySet) {
7923 outKeySet.addAll(MOVED_TO_SECURE);
7924 }
7925
Christopher Tate06efb532012-08-24 15:29:27 -07007926 /**
7927 * Look up a name in the database.
7928 * @param resolver to access the database with
7929 * @param name to look up in the table
7930 * @return the corresponding value, or null if not present
7931 */
Dianne Hackborn139748f2012-09-24 11:36:57 -07007932 public static String getString(ContentResolver resolver, String name) {
Christopher Tate06efb532012-08-24 15:29:27 -07007933 return getStringForUser(resolver, name, UserHandle.myUserId());
7934 }
7935
7936 /** @hide */
Dianne Hackborn139748f2012-09-24 11:36:57 -07007937 public static String getStringForUser(ContentResolver resolver, String name,
Christopher Tate06efb532012-08-24 15:29:27 -07007938 int userHandle) {
Christopher Tateaa036a22014-05-19 16:33:27 -07007939 if (MOVED_TO_SECURE.contains(name)) {
7940 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
7941 + " to android.provider.Settings.Secure, returning read-only value.");
7942 return Secure.getStringForUser(resolver, name, userHandle);
7943 }
Christopher Tate06efb532012-08-24 15:29:27 -07007944 return sNameValueCache.getStringForUser(resolver, name, userHandle);
7945 }
7946
7947 /**
7948 * Store a name/value pair into the database.
7949 * @param resolver to access the database with
7950 * @param name to store
7951 * @param value to associate with the name
7952 * @return true if the value was set, false on database errors
7953 */
7954 public static boolean putString(ContentResolver resolver,
7955 String name, String value) {
7956 return putStringForUser(resolver, name, value, UserHandle.myUserId());
7957 }
7958
7959 /** @hide */
7960 public static boolean putStringForUser(ContentResolver resolver,
7961 String name, String value, int userHandle) {
Christopher Tate06efb532012-08-24 15:29:27 -07007962 if (LOCAL_LOGV) {
7963 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
7964 + " for " + userHandle);
7965 }
Christopher Tateaa036a22014-05-19 16:33:27 -07007966 // Global and Secure have the same access policy so we can forward writes
7967 if (MOVED_TO_SECURE.contains(name)) {
7968 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
7969 + " to android.provider.Settings.Secure, value is unchanged.");
7970 return Secure.putStringForUser(resolver, name, value, userHandle);
7971 }
Christopher Tate06efb532012-08-24 15:29:27 -07007972 return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
7973 }
7974
7975 /**
7976 * Construct the content URI for a particular name/value pair,
7977 * useful for monitoring changes with a ContentObserver.
7978 * @param name to look up in the table
7979 * @return the corresponding content URI, or null if not present
7980 */
7981 public static Uri getUriFor(String name) {
7982 return getUriFor(CONTENT_URI, name);
7983 }
7984
7985 /**
7986 * Convenience function for retrieving a single secure settings value
7987 * as an integer. Note that internally setting values are always
7988 * stored as strings; this function converts the string to an integer
7989 * for you. The default value will be returned if the setting is
7990 * not defined or not an integer.
7991 *
7992 * @param cr The ContentResolver to access.
7993 * @param name The name of the setting to retrieve.
7994 * @param def Value to return if the setting is not defined.
7995 *
7996 * @return The setting's current value, or 'def' if it is not defined
7997 * or not a valid integer.
7998 */
7999 public static int getInt(ContentResolver cr, String name, int def) {
8000 String v = getString(cr, name);
8001 try {
8002 return v != null ? Integer.parseInt(v) : def;
8003 } catch (NumberFormatException e) {
8004 return def;
8005 }
8006 }
8007
8008 /**
8009 * Convenience function for retrieving a single secure settings value
8010 * as an integer. Note that internally setting values are always
8011 * stored as strings; this function converts the string to an integer
8012 * for you.
8013 * <p>
8014 * This version does not take a default value. If the setting has not
8015 * been set, or the string value is not a number,
8016 * it throws {@link SettingNotFoundException}.
8017 *
8018 * @param cr The ContentResolver to access.
8019 * @param name The name of the setting to retrieve.
8020 *
8021 * @throws SettingNotFoundException Thrown if a setting by the given
8022 * name can't be found or the setting value is not an integer.
8023 *
8024 * @return The setting's current value.
8025 */
8026 public static int getInt(ContentResolver cr, String name)
8027 throws SettingNotFoundException {
8028 String v = getString(cr, name);
8029 try {
8030 return Integer.parseInt(v);
8031 } catch (NumberFormatException e) {
8032 throw new SettingNotFoundException(name);
8033 }
8034 }
8035
8036 /**
8037 * Convenience function for updating a single settings value as an
8038 * integer. This will either create a new entry in the table if the
8039 * given name does not exist, or modify the value of the existing row
8040 * with that name. Note that internally setting values are always
8041 * stored as strings, so this function converts the given value to a
8042 * string before storing it.
8043 *
8044 * @param cr The ContentResolver to access.
8045 * @param name The name of the setting to modify.
8046 * @param value The new value for the setting.
8047 * @return true if the value was set, false on database errors
8048 */
8049 public static boolean putInt(ContentResolver cr, String name, int value) {
8050 return putString(cr, name, Integer.toString(value));
8051 }
8052
8053 /**
8054 * Convenience function for retrieving a single secure settings value
8055 * as a {@code long}. Note that internally setting values are always
8056 * stored as strings; this function converts the string to a {@code long}
8057 * for you. The default value will be returned if the setting is
8058 * not defined or not a {@code long}.
8059 *
8060 * @param cr The ContentResolver to access.
8061 * @param name The name of the setting to retrieve.
8062 * @param def Value to return if the setting is not defined.
8063 *
8064 * @return The setting's current value, or 'def' if it is not defined
8065 * or not a valid {@code long}.
8066 */
8067 public static long getLong(ContentResolver cr, String name, long def) {
8068 String valString = getString(cr, name);
8069 long value;
8070 try {
8071 value = valString != null ? Long.parseLong(valString) : def;
8072 } catch (NumberFormatException e) {
8073 value = def;
8074 }
8075 return value;
8076 }
8077
8078 /**
8079 * Convenience function for retrieving a single secure settings value
8080 * as a {@code long}. Note that internally setting values are always
8081 * stored as strings; this function converts the string to a {@code long}
8082 * for you.
8083 * <p>
8084 * This version does not take a default value. If the setting has not
8085 * been set, or the string value is not a number,
8086 * it throws {@link SettingNotFoundException}.
8087 *
8088 * @param cr The ContentResolver to access.
8089 * @param name The name of the setting to retrieve.
8090 *
8091 * @return The setting's current value.
8092 * @throws SettingNotFoundException Thrown if a setting by the given
8093 * name can't be found or the setting value is not an integer.
8094 */
8095 public static long getLong(ContentResolver cr, String name)
8096 throws SettingNotFoundException {
8097 String valString = getString(cr, name);
8098 try {
8099 return Long.parseLong(valString);
8100 } catch (NumberFormatException e) {
8101 throw new SettingNotFoundException(name);
8102 }
8103 }
8104
8105 /**
8106 * Convenience function for updating a secure settings value as a long
8107 * integer. This will either create a new entry in the table if the
8108 * given name does not exist, or modify the value of the existing row
8109 * with that name. Note that internally setting values are always
8110 * stored as strings, so this function converts the given value to a
8111 * string before storing it.
8112 *
8113 * @param cr The ContentResolver to access.
8114 * @param name The name of the setting to modify.
8115 * @param value The new value for the setting.
8116 * @return true if the value was set, false on database errors
8117 */
8118 public static boolean putLong(ContentResolver cr, String name, long value) {
8119 return putString(cr, name, Long.toString(value));
8120 }
8121
8122 /**
8123 * Convenience function for retrieving a single secure settings value
8124 * as a floating point number. Note that internally setting values are
8125 * always stored as strings; this function converts the string to an
8126 * float for you. The default value will be returned if the setting
8127 * is not defined or not a valid float.
8128 *
8129 * @param cr The ContentResolver to access.
8130 * @param name The name of the setting to retrieve.
8131 * @param def Value to return if the setting is not defined.
8132 *
8133 * @return The setting's current value, or 'def' if it is not defined
8134 * or not a valid float.
8135 */
8136 public static float getFloat(ContentResolver cr, String name, float def) {
8137 String v = getString(cr, name);
8138 try {
8139 return v != null ? Float.parseFloat(v) : def;
8140 } catch (NumberFormatException e) {
8141 return def;
8142 }
8143 }
8144
8145 /**
8146 * Convenience function for retrieving a single secure settings value
8147 * as a float. Note that internally setting values are always
8148 * stored as strings; this function converts the string to a float
8149 * for you.
8150 * <p>
8151 * This version does not take a default value. If the setting has not
8152 * been set, or the string value is not a number,
8153 * it throws {@link SettingNotFoundException}.
8154 *
8155 * @param cr The ContentResolver to access.
8156 * @param name The name of the setting to retrieve.
8157 *
8158 * @throws SettingNotFoundException Thrown if a setting by the given
8159 * name can't be found or the setting value is not a float.
8160 *
8161 * @return The setting's current value.
8162 */
8163 public static float getFloat(ContentResolver cr, String name)
8164 throws SettingNotFoundException {
8165 String v = getString(cr, name);
8166 if (v == null) {
8167 throw new SettingNotFoundException(name);
8168 }
8169 try {
8170 return Float.parseFloat(v);
8171 } catch (NumberFormatException e) {
8172 throw new SettingNotFoundException(name);
8173 }
8174 }
8175
8176 /**
8177 * Convenience function for updating a single settings value as a
8178 * floating point number. This will either create a new entry in the
8179 * table if the given name does not exist, or modify the value of the
8180 * existing row with that name. Note that internally setting values
8181 * are always stored as strings, so this function converts the given
8182 * value to a string before storing it.
8183 *
8184 * @param cr The ContentResolver to access.
8185 * @param name The name of the setting to modify.
8186 * @param value The new value for the setting.
8187 * @return true if the value was set, false on database errors
8188 */
8189 public static boolean putFloat(ContentResolver cr, String name, float value) {
8190 return putString(cr, name, Float.toString(value));
8191 }
Wink Savillefb40dd42014-06-12 17:02:31 -07008192
8193
8194 /**
8195 * Subscription to be used for voice call on a multi sim device. The supported values
8196 * are 0 = SUB1, 1 = SUB2 and etc.
8197 * @hide
8198 */
8199 public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
8200
8201 /**
8202 * Used to provide option to user to select subscription during dial.
8203 * The supported values are 0 = disable or 1 = enable prompt.
8204 * @hide
8205 */
8206 public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
8207
8208 /**
8209 * Subscription to be used for data call on a multi sim device. The supported values
8210 * are 0 = SUB1, 1 = SUB2 and etc.
8211 * @hide
8212 */
8213 public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
8214
8215 /**
8216 * Subscription to be used for SMS on a multi sim device. The supported values
8217 * are 0 = SUB1, 1 = SUB2 and etc.
8218 * @hide
8219 */
8220 public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
8221
8222 /**
8223 * Used to provide option to user to select subscription during send SMS.
8224 * The value 1 - enable, 0 - disable
8225 * @hide
8226 */
8227 public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
8228
8229
8230
8231 /** User preferred subscriptions setting.
8232 * This holds the details of the user selected subscription from the card and
8233 * the activation status. Each settings string have the coma separated values
8234 * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
8235 * @hide
8236 */
8237 public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
8238 "user_preferred_sub2","user_preferred_sub3"};
Zheng Fub218ff42015-04-13 16:31:16 -07008239
8240 /**
8241 * Whether to enable new contacts aggregator or not.
8242 * The value 1 - enable, 0 - disable
8243 * @hide
8244 */
8245 public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
Zheng Fu31ce78c2015-04-15 16:57:53 -07008246
8247 /**
8248 * Whether to enable contacts metadata syncing or not
8249 * The value 1 - enable, 0 - disable
8250 * @hide
8251 */
8252 public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
Wei Liua1817702015-08-11 21:21:12 -07008253
8254 /**
8255 * Whether to enable cellular on boot.
8256 * The value 1 - enable, 0 - disable
8257 * @hide
8258 */
8259 public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
Christopher Tate06efb532012-08-24 15:29:27 -07008260 }
8261
8262 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008263 * User-defined bookmarks and shortcuts. The target of each bookmark is an
8264 * Intent URL, allowing it to be either a web page or a particular
8265 * application activity.
8266 *
8267 * @hide
8268 */
8269 public static final class Bookmarks implements BaseColumns
8270 {
8271 private static final String TAG = "Bookmarks";
8272
8273 /**
8274 * The content:// style URL for this table
8275 */
8276 public static final Uri CONTENT_URI =
8277 Uri.parse("content://" + AUTHORITY + "/bookmarks");
8278
8279 /**
8280 * The row ID.
8281 * <p>Type: INTEGER</p>
8282 */
8283 public static final String ID = "_id";
8284
8285 /**
8286 * Descriptive name of the bookmark that can be displayed to the user.
8287 * If this is empty, the title should be resolved at display time (use
8288 * {@link #getTitle(Context, Cursor)} any time you want to display the
8289 * title of a bookmark.)
8290 * <P>
8291 * Type: TEXT
8292 * </P>
8293 */
8294 public static final String TITLE = "title";
8295
8296 /**
8297 * Arbitrary string (displayed to the user) that allows bookmarks to be
8298 * organized into categories. There are some special names for
8299 * standard folders, which all start with '@'. The label displayed for
8300 * the folder changes with the locale (via {@link #getLabelForFolder}) but
8301 * the folder name does not change so you can consistently query for
8302 * the folder regardless of the current locale.
8303 *
8304 * <P>Type: TEXT</P>
8305 *
8306 */
8307 public static final String FOLDER = "folder";
8308
8309 /**
8310 * The Intent URL of the bookmark, describing what it points to. This
8311 * value is given to {@link android.content.Intent#getIntent} to create
8312 * an Intent that can be launched.
8313 * <P>Type: TEXT</P>
8314 */
8315 public static final String INTENT = "intent";
8316
8317 /**
8318 * Optional shortcut character associated with this bookmark.
8319 * <P>Type: INTEGER</P>
8320 */
8321 public static final String SHORTCUT = "shortcut";
8322
8323 /**
8324 * The order in which the bookmark should be displayed
8325 * <P>Type: INTEGER</P>
8326 */
8327 public static final String ORDERING = "ordering";
8328
8329 private static final String[] sIntentProjection = { INTENT };
8330 private static final String[] sShortcutProjection = { ID, SHORTCUT };
8331 private static final String sShortcutSelection = SHORTCUT + "=?";
8332
8333 /**
8334 * Convenience function to retrieve the bookmarked Intent for a
8335 * particular shortcut key.
8336 *
8337 * @param cr The ContentResolver to query.
8338 * @param shortcut The shortcut key.
8339 *
8340 * @return Intent The bookmarked URL, or null if there is no bookmark
8341 * matching the given shortcut.
8342 */
8343 public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
8344 {
8345 Intent intent = null;
8346
8347 Cursor c = cr.query(CONTENT_URI,
8348 sIntentProjection, sShortcutSelection,
8349 new String[] { String.valueOf((int) shortcut) }, ORDERING);
8350 // Keep trying until we find a valid shortcut
8351 try {
8352 while (intent == null && c.moveToNext()) {
8353 try {
8354 String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02008355 intent = Intent.parseUri(intentURI, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008356 } catch (java.net.URISyntaxException e) {
8357 // The stored URL is bad... ignore it.
8358 } catch (IllegalArgumentException e) {
8359 // Column not found
Dianne Hackborna33e3f72009-09-29 17:28:24 -07008360 Log.w(TAG, "Intent column not found", e);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008361 }
8362 }
8363 } finally {
8364 if (c != null) c.close();
8365 }
8366
8367 return intent;
8368 }
8369
8370 /**
8371 * Add a new bookmark to the system.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008372 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008373 * @param cr The ContentResolver to query.
8374 * @param intent The desired target of the bookmark.
8375 * @param title Bookmark title that is shown to the user; null if none
8376 * or it should be resolved to the intent's title.
8377 * @param folder Folder in which to place the bookmark; null if none.
8378 * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
8379 * this is non-zero and there is an existing bookmark entry
8380 * with this same shortcut, then that existing shortcut is
8381 * cleared (the bookmark is not removed).
8382 * @return The unique content URL for the new bookmark entry.
8383 */
8384 public static Uri add(ContentResolver cr,
8385 Intent intent,
8386 String title,
8387 String folder,
8388 char shortcut,
8389 int ordering)
8390 {
8391 // If a shortcut is supplied, and it is already defined for
8392 // another bookmark, then remove the old definition.
8393 if (shortcut != 0) {
Jeff Hamilton7cd51ef2010-05-12 17:30:27 -05008394 cr.delete(CONTENT_URI, sShortcutSelection,
8395 new String[] { String.valueOf((int) shortcut) });
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008396 }
8397
8398 ContentValues values = new ContentValues();
8399 if (title != null) values.put(TITLE, title);
8400 if (folder != null) values.put(FOLDER, folder);
Jean-Baptiste Queru3b9f0a32010-06-21 13:46:59 -07008401 values.put(INTENT, intent.toUri(0));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008402 if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
8403 values.put(ORDERING, ordering);
8404 return cr.insert(CONTENT_URI, values);
8405 }
8406
8407 /**
8408 * Return the folder name as it should be displayed to the user. This
8409 * takes care of localizing special folders.
8410 *
8411 * @param r Resources object for current locale; only need access to
8412 * system resources.
8413 * @param folder The value found in the {@link #FOLDER} column.
8414 *
8415 * @return CharSequence The label for this folder that should be shown
8416 * to the user.
8417 */
8418 public static CharSequence getLabelForFolder(Resources r, String folder) {
8419 return folder;
8420 }
8421
8422 /**
8423 * Return the title as it should be displayed to the user. This takes
8424 * care of localizing bookmarks that point to activities.
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008425 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008426 * @param context A context.
8427 * @param cursor A cursor pointing to the row whose title should be
8428 * returned. The cursor must contain at least the {@link #TITLE}
8429 * and {@link #INTENT} columns.
8430 * @return A title that is localized and can be displayed to the user,
8431 * or the empty string if one could not be found.
8432 */
8433 public static CharSequence getTitle(Context context, Cursor cursor) {
8434 int titleColumn = cursor.getColumnIndex(TITLE);
8435 int intentColumn = cursor.getColumnIndex(INTENT);
8436 if (titleColumn == -1 || intentColumn == -1) {
8437 throw new IllegalArgumentException(
8438 "The cursor must contain the TITLE and INTENT columns.");
8439 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008440
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008441 String title = cursor.getString(titleColumn);
8442 if (!TextUtils.isEmpty(title)) {
8443 return title;
8444 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008445
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008446 String intentUri = cursor.getString(intentColumn);
8447 if (TextUtils.isEmpty(intentUri)) {
8448 return "";
8449 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008450
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008451 Intent intent;
8452 try {
Christian Mehlmauera34d2c92010-05-25 19:04:20 +02008453 intent = Intent.parseUri(intentUri, 0);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008454 } catch (URISyntaxException e) {
8455 return "";
8456 }
Jaikumar Ganesh9bfbfbd2009-05-15 12:05:56 -07008457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008458 PackageManager packageManager = context.getPackageManager();
8459 ResolveInfo info = packageManager.resolveActivity(intent, 0);
8460 return info != null ? info.loadLabel(packageManager) : "";
8461 }
8462 }
8463
8464 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008465 * Returns the device ID that we should use when connecting to the mobile gtalk server.
8466 * This is a string like "android-0x1242", where the hex string is the Android ID obtained
8467 * from the GoogleLoginService.
8468 *
8469 * @param androidId The Android ID for this device.
8470 * @return The device ID that should be used when connecting to the mobile gtalk server.
8471 * @hide
8472 */
8473 public static String getGTalkDeviceId(long androidId) {
8474 return "android-" + Long.toHexString(androidId);
8475 }
Billy Lau6ad2d662015-07-18 00:26:58 +01008476
Billy Laua7238a32015-08-01 12:45:02 +01008477 private static final String[] PM_WRITE_SETTINGS = {
8478 android.Manifest.permission.WRITE_SETTINGS
8479 };
8480 private static final String[] PM_CHANGE_NETWORK_STATE = {
8481 android.Manifest.permission.CHANGE_NETWORK_STATE,
8482 android.Manifest.permission.WRITE_SETTINGS
8483 };
8484 private static final String[] PM_SYSTEM_ALERT_WINDOW = {
8485 android.Manifest.permission.SYSTEM_ALERT_WINDOW
8486 };
8487
Billy Lau6ad2d662015-07-18 00:26:58 +01008488 /**
8489 * Performs a strict and comprehensive check of whether a calling package is allowed to
8490 * write/modify system settings, as the condition differs for pre-M, M+, and
8491 * privileged/preinstalled apps. If the provided uid does not match the
8492 * callingPackage, a negative result will be returned.
8493 * @hide
8494 */
8495 public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
8496 String callingPackage, boolean throwException) {
8497 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
8498 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
Billy Laua7238a32015-08-01 12:45:02 +01008499 PM_WRITE_SETTINGS, false);
Billy Lau6ad2d662015-07-18 00:26:58 +01008500 }
8501
8502 /**
8503 * Performs a strict and comprehensive check of whether a calling package is allowed to
8504 * write/modify system settings, as the condition differs for pre-M, M+, and
8505 * privileged/preinstalled apps. If the provided uid does not match the
Billy Laua7238a32015-08-01 12:45:02 +01008506 * callingPackage, a negative result will be returned. The caller is expected to have
Lorenzo Colittid5427052015-10-15 16:29:00 +09008507 * the WRITE_SETTINGS permission declared.
Billy Lau6ad2d662015-07-18 00:26:58 +01008508 *
8509 * Note: if the check is successful, the operation of this app will be updated to the
8510 * current time.
8511 * @hide
8512 */
8513 public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
8514 String callingPackage, boolean throwException) {
8515 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
8516 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
Billy Laua7238a32015-08-01 12:45:02 +01008517 PM_WRITE_SETTINGS, true);
8518 }
8519
8520 /**
8521 * Performs a strict and comprehensive check of whether a calling package is allowed to
8522 * change the state of network, as the condition differs for pre-M, M+, and
Lorenzo Colittid5427052015-10-15 16:29:00 +09008523 * privileged/preinstalled apps. The caller is expected to have either the
8524 * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
8525 * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
8526 * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
8527 * permission and cannot be revoked. See http://b/23597341
Billy Laua7238a32015-08-01 12:45:02 +01008528 *
Lorenzo Colittid5427052015-10-15 16:29:00 +09008529 * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
8530 * of this app will be updated to the current time.
Billy Laua7238a32015-08-01 12:45:02 +01008531 * @hide
8532 */
8533 public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
8534 String callingPackage, boolean throwException) {
Lorenzo Colittid5427052015-10-15 16:29:00 +09008535 if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
8536 == PackageManager.PERMISSION_GRANTED) {
8537 return true;
8538 }
Billy Laua7238a32015-08-01 12:45:02 +01008539 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
8540 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
8541 PM_CHANGE_NETWORK_STATE, true);
Billy Lau6ad2d662015-07-18 00:26:58 +01008542 }
8543
8544 /**
8545 * Performs a strict and comprehensive check of whether a calling package is allowed to
8546 * draw on top of other apps, as the conditions differs for pre-M, M+, and
8547 * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
8548 * a negative result will be returned.
8549 * @hide
8550 */
8551 public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
8552 String callingPackage, boolean throwException) {
8553 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
8554 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
Billy Laua7238a32015-08-01 12:45:02 +01008555 PM_SYSTEM_ALERT_WINDOW, false);
Billy Lau6ad2d662015-07-18 00:26:58 +01008556 }
8557
8558 /**
8559 * Performs a strict and comprehensive check of whether a calling package is allowed to
8560 * draw on top of other apps, as the conditions differs for pre-M, M+, and
8561 * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
8562 * a negative result will be returned.
8563 *
8564 * Note: if the check is successful, the operation of this app will be updated to the
8565 * current time.
8566 * @hide
8567 */
8568 public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
8569 callingPackage, boolean throwException) {
8570 return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
8571 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
Billy Laua7238a32015-08-01 12:45:02 +01008572 PM_SYSTEM_ALERT_WINDOW, true);
Billy Lau6ad2d662015-07-18 00:26:58 +01008573 }
8574
8575 /**
8576 * Helper method to perform a general and comprehensive check of whether an operation that is
8577 * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
8578 * OP_WRITE_SETTINGS
8579 * @hide
8580 */
8581 public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
Billy Laua7238a32015-08-01 12:45:02 +01008582 int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
8583 permissions, boolean makeNote) {
Billy Lau6ad2d662015-07-18 00:26:58 +01008584 if (callingPackage == null) {
8585 return false;
8586 }
8587
8588 AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
8589 int mode = AppOpsManager.MODE_DEFAULT;
8590 if (makeNote) {
8591 mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
8592 } else {
8593 mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
8594 }
8595
8596 switch (mode) {
8597 case AppOpsManager.MODE_ALLOWED:
8598 return true;
Billy Laua7238a32015-08-01 12:45:02 +01008599
Billy Lau6ad2d662015-07-18 00:26:58 +01008600 case AppOpsManager.MODE_DEFAULT:
8601 // this is the default operating mode after an app's installation
Billy Laua7238a32015-08-01 12:45:02 +01008602 // In this case we will check all associated static permission to see
8603 // if it is granted during install time.
8604 for (String permission : permissions) {
8605 if (context.checkCallingOrSelfPermission(permission) == PackageManager
8606 .PERMISSION_GRANTED) {
8607 // if either of the permissions are granted, we will allow it
8608 return true;
8609 }
Billy Lau6ad2d662015-07-18 00:26:58 +01008610 }
Billy Laua7238a32015-08-01 12:45:02 +01008611
Billy Lau6ad2d662015-07-18 00:26:58 +01008612 default:
8613 // this is for all other cases trickled down here...
8614 if (!throwException) {
8615 return false;
8616 }
8617 }
Billy Laua7238a32015-08-01 12:45:02 +01008618
8619 // prepare string to throw SecurityException
8620 StringBuilder exceptionMessage = new StringBuilder();
8621 exceptionMessage.append(callingPackage);
8622 exceptionMessage.append(" was not granted ");
8623 if (permissions.length > 1) {
8624 exceptionMessage.append(" either of these permissions: ");
8625 } else {
8626 exceptionMessage.append(" this permission: ");
8627 }
8628 for (int i = 0; i < permissions.length; i++) {
8629 exceptionMessage.append(permissions[i]);
8630 exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
8631 }
8632
8633 throw new SecurityException(exceptionMessage.toString());
Billy Lau6ad2d662015-07-18 00:26:58 +01008634 }
8635
8636 /**
8637 * Retrieves a correponding package name for a given uid. It will query all
8638 * packages that are associated with the given uid, but it will return only
8639 * the zeroth result.
8640 * Note: If package could not be found, a null is returned.
8641 * @hide
8642 */
8643 public static String getPackageNameForUid(Context context, int uid) {
8644 String[] packages = context.getPackageManager().getPackagesForUid(uid);
8645 if (packages == null) {
8646 return null;
8647 }
8648 return packages[0];
8649 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08008650}