Home | History | Annotate | Download | only in provider
      1 /*
      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 
     17 package android.provider;
     18 
     19 import android.Manifest;
     20 import android.annotation.IntDef;
     21 import android.annotation.IntRange;
     22 import android.annotation.NonNull;
     23 import android.annotation.Nullable;
     24 import android.annotation.RequiresPermission;
     25 import android.annotation.SdkConstant;
     26 import android.annotation.SdkConstant.SdkConstantType;
     27 import android.annotation.SystemApi;
     28 import android.annotation.TestApi;
     29 import android.annotation.UserIdInt;
     30 import android.app.ActivityThread;
     31 import android.app.AppOpsManager;
     32 import android.app.Application;
     33 import android.app.NotificationChannel;
     34 import android.app.SearchManager;
     35 import android.app.WallpaperManager;
     36 import android.content.ComponentName;
     37 import android.content.ContentResolver;
     38 import android.content.ContentValues;
     39 import android.content.Context;
     40 import android.content.IContentProvider;
     41 import android.content.Intent;
     42 import android.content.pm.ActivityInfo;
     43 import android.content.pm.PackageManager;
     44 import android.content.pm.ResolveInfo;
     45 import android.content.res.Configuration;
     46 import android.content.res.Resources;
     47 import android.database.Cursor;
     48 import android.database.SQLException;
     49 import android.location.LocationManager;
     50 import android.net.ConnectivityManager;
     51 import android.net.NetworkScoreManager;
     52 import android.net.Uri;
     53 import android.net.wifi.WifiManager;
     54 import android.os.BatteryManager;
     55 import android.os.Binder;
     56 import android.os.Build.VERSION_CODES;
     57 import android.os.Bundle;
     58 import android.os.DropBoxManager;
     59 import android.os.IBinder;
     60 import android.os.LocaleList;
     61 import android.os.Process;
     62 import android.os.RemoteException;
     63 import android.os.ResultReceiver;
     64 import android.os.ServiceManager;
     65 import android.os.UserHandle;
     66 import android.speech.tts.TextToSpeech;
     67 import android.text.TextUtils;
     68 import android.util.AndroidException;
     69 import android.util.ArrayMap;
     70 import android.util.ArraySet;
     71 import android.util.Log;
     72 import android.util.MemoryIntArray;
     73 
     74 import com.android.internal.annotations.GuardedBy;
     75 import com.android.internal.util.ArrayUtils;
     76 import com.android.internal.widget.ILockSettings;
     77 
     78 import java.io.IOException;
     79 import java.lang.annotation.Retention;
     80 import java.lang.annotation.RetentionPolicy;
     81 import java.net.URISyntaxException;
     82 import java.text.SimpleDateFormat;
     83 import java.util.HashMap;
     84 import java.util.HashSet;
     85 import java.util.Locale;
     86 import java.util.Map;
     87 import java.util.Set;
     88 
     89 /**
     90  * The Settings provider contains global system-level device preferences.
     91  */
     92 public final class Settings {
     93 
     94     // Intent actions for Settings
     95 
     96     /**
     97      * Activity Action: Show system settings.
     98      * <p>
     99      * Input: Nothing.
    100      * <p>
    101      * Output: Nothing.
    102      */
    103     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    104     public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
    105 
    106     /**
    107      * Activity Action: Show settings to allow configuration of APNs.
    108      * <p>
    109      * Input: Nothing.
    110      * <p>
    111      * Output: Nothing.
    112      */
    113     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    114     public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
    115 
    116     /**
    117      * Activity Action: Show settings to allow configuration of current location
    118      * sources.
    119      * <p>
    120      * In some cases, a matching Activity may not exist, so ensure you
    121      * safeguard against this.
    122      * <p>
    123      * Input: Nothing.
    124      * <p>
    125      * Output: Nothing.
    126      */
    127     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    128     public static final String ACTION_LOCATION_SOURCE_SETTINGS =
    129             "android.settings.LOCATION_SOURCE_SETTINGS";
    130 
    131     /**
    132      * Activity Action: Show settings to allow configuration of users.
    133      * <p>
    134      * In some cases, a matching Activity may not exist, so ensure you
    135      * safeguard against this.
    136      * <p>
    137      * Input: Nothing.
    138      * <p>
    139      * Output: Nothing.
    140      * @hide
    141      */
    142     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    143     public static final String ACTION_USER_SETTINGS =
    144             "android.settings.USER_SETTINGS";
    145 
    146     /**
    147      * Activity Action: Show settings to allow configuration of wireless controls
    148      * such as Wi-Fi, Bluetooth and Mobile networks.
    149      * <p>
    150      * In some cases, a matching Activity may not exist, so ensure you
    151      * safeguard against this.
    152      * <p>
    153      * Input: Nothing.
    154      * <p>
    155      * Output: Nothing.
    156      */
    157     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    158     public static final String ACTION_WIRELESS_SETTINGS =
    159             "android.settings.WIRELESS_SETTINGS";
    160 
    161     /**
    162      * Activity Action: Show tether provisioning activity.
    163      *
    164      * <p>
    165      * In some cases, a matching Activity may not exist, so ensure you
    166      * safeguard against this.
    167      * <p>
    168      * Input: {@link ConnectivityManager#EXTRA_TETHER_TYPE} should be included to specify which type
    169      * of tethering should be checked. {@link ConnectivityManager#EXTRA_PROVISION_CALLBACK} should
    170      * contain a {@link ResultReceiver} which will be called back with a tether result code.
    171      * <p>
    172      * Output: The result of the provisioning check.
    173      * {@link ConnectivityManager#TETHER_ERROR_NO_ERROR} if successful,
    174      * {@link ConnectivityManager#TETHER_ERROR_PROVISION_FAILED} for failure.
    175      *
    176      * @hide
    177      */
    178     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    179     public static final String ACTION_TETHER_PROVISIONING =
    180             "android.settings.TETHER_PROVISIONING_UI";
    181 
    182     /**
    183      * Activity Action: Show settings to allow entering/exiting airplane mode.
    184      * <p>
    185      * In some cases, a matching Activity may not exist, so ensure you
    186      * safeguard against this.
    187      * <p>
    188      * Input: Nothing.
    189      * <p>
    190      * Output: Nothing.
    191      */
    192     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    193     public static final String ACTION_AIRPLANE_MODE_SETTINGS =
    194             "android.settings.AIRPLANE_MODE_SETTINGS";
    195 
    196     /**
    197      * Activity Action: Modify Airplane mode settings using a voice command.
    198      * <p>
    199      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
    200      * <p>
    201      * This intent MUST be started using
    202      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
    203      * startVoiceActivity}.
    204      * <p>
    205      * Note: The activity implementing this intent MUST verify that
    206      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
    207      * modifying the setting.
    208      * <p>
    209      * Input: To tell which state airplane mode should be set to, add the
    210      * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified.
    211      * If the extra is not included, no changes will be made.
    212      * <p>
    213      * Output: Nothing.
    214      */
    215     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    216     public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =
    217             "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
    218 
    219     /**
    220      * Activity Action: Show settings for accessibility modules.
    221      * <p>
    222      * In some cases, a matching Activity may not exist, so ensure you
    223      * safeguard against this.
    224      * <p>
    225      * Input: Nothing.
    226      * <p>
    227      * Output: Nothing.
    228      */
    229     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    230     public static final String ACTION_ACCESSIBILITY_SETTINGS =
    231             "android.settings.ACCESSIBILITY_SETTINGS";
    232 
    233     /**
    234      * Activity Action: Show settings to control access to usage information.
    235      * <p>
    236      * In some cases, a matching Activity may not exist, so ensure you
    237      * safeguard against this.
    238      * <p>
    239      * Input: Nothing.
    240      * <p>
    241      * Output: Nothing.
    242      */
    243     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    244     public static final String ACTION_USAGE_ACCESS_SETTINGS =
    245             "android.settings.USAGE_ACCESS_SETTINGS";
    246 
    247     /**
    248      * Activity Category: Show application settings related to usage access.
    249      * <p>
    250      * An activity that provides a user interface for adjusting usage access related
    251      * preferences for its containing application. Optional but recommended for apps that
    252      * use {@link android.Manifest.permission#PACKAGE_USAGE_STATS}.
    253      * <p>
    254      * The activity may define meta-data to describe what usage access is
    255      * used for within their app with {@link #METADATA_USAGE_ACCESS_REASON}, which
    256      * will be displayed in Settings.
    257      * <p>
    258      * Input: Nothing.
    259      * <p>
    260      * Output: Nothing.
    261      */
    262     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
    263     public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG =
    264             "android.intent.category.USAGE_ACCESS_CONFIG";
    265 
    266     /**
    267      * Metadata key: Reason for needing usage access.
    268      * <p>
    269      * A key for metadata attached to an activity that receives action
    270      * {@link #INTENT_CATEGORY_USAGE_ACCESS_CONFIG}, shown to the
    271      * user as description of how the app uses usage access.
    272      * <p>
    273      */
    274     public static final String METADATA_USAGE_ACCESS_REASON =
    275             "android.settings.metadata.USAGE_ACCESS_REASON";
    276 
    277     /**
    278      * Activity Action: Show settings to allow configuration of security and
    279      * location privacy.
    280      * <p>
    281      * In some cases, a matching Activity may not exist, so ensure you
    282      * safeguard against this.
    283      * <p>
    284      * Input: Nothing.
    285      * <p>
    286      * Output: Nothing.
    287      */
    288     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    289     public static final String ACTION_SECURITY_SETTINGS =
    290             "android.settings.SECURITY_SETTINGS";
    291 
    292     /**
    293      * Activity Action: Show settings to allow configuration of trusted external sources
    294      * <p>
    295      * In some cases, a matching Activity may not exist, so ensure you
    296      * safeguard against this.
    297      * <p>
    298      * Input: Optionally, the Intent's data URI can specify the application package name to
    299      * directly invoke the management GUI specific to the package name. For example
    300      * "package:com.my.app".
    301      * <p>
    302      * Output: Nothing.
    303      */
    304     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    305     public static final String ACTION_MANAGE_UNKNOWN_APP_SOURCES =
    306             "android.settings.MANAGE_UNKNOWN_APP_SOURCES";
    307 
    308     /**
    309      * Activity Action: Show trusted credentials settings, opening to the user tab,
    310      * to allow management of installed credentials.
    311      * <p>
    312      * In some cases, a matching Activity may not exist, so ensure you
    313      * safeguard against this.
    314      * <p>
    315      * Input: Nothing.
    316      * <p>
    317      * Output: Nothing.
    318      * @hide
    319      */
    320     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    321     public static final String ACTION_TRUSTED_CREDENTIALS_USER =
    322             "com.android.settings.TRUSTED_CREDENTIALS_USER";
    323 
    324     /**
    325      * Activity Action: Show dialog explaining that an installed CA cert may enable
    326      * monitoring of encrypted network traffic.
    327      * <p>
    328      * In some cases, a matching Activity may not exist, so ensure you
    329      * safeguard against this. Add {@link #EXTRA_NUMBER_OF_CERTIFICATES} extra to indicate the
    330      * number of certificates.
    331      * <p>
    332      * Input: Nothing.
    333      * <p>
    334      * Output: Nothing.
    335      * @hide
    336      */
    337     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    338     public static final String ACTION_MONITORING_CERT_INFO =
    339             "com.android.settings.MONITORING_CERT_INFO";
    340 
    341     /**
    342      * Activity Action: Show settings to allow configuration of privacy options.
    343      * <p>
    344      * In some cases, a matching Activity may not exist, so ensure you
    345      * safeguard against this.
    346      * <p>
    347      * Input: Nothing.
    348      * <p>
    349      * Output: Nothing.
    350      */
    351     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    352     public static final String ACTION_PRIVACY_SETTINGS =
    353             "android.settings.PRIVACY_SETTINGS";
    354 
    355     /**
    356      * Activity Action: Show settings to allow configuration of VPN.
    357      * <p>
    358      * In some cases, a matching Activity may not exist, so ensure you
    359      * safeguard against this.
    360      * <p>
    361      * Input: Nothing.
    362      * <p>
    363      * Output: Nothing.
    364      */
    365     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    366     public static final String ACTION_VPN_SETTINGS =
    367             "android.settings.VPN_SETTINGS";
    368 
    369     /**
    370      * Activity Action: Show settings to allow configuration of Wi-Fi.
    371      * <p>
    372      * In some cases, a matching Activity may not exist, so ensure you
    373      * safeguard against this.
    374      * <p>
    375      * Input: Nothing.
    376      * <p>
    377      * Output: Nothing.
    378      */
    379     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    380     public static final String ACTION_WIFI_SETTINGS =
    381             "android.settings.WIFI_SETTINGS";
    382 
    383     /**
    384      * Activity Action: Show settings to allow configuration of a static IP
    385      * address for Wi-Fi.
    386      * <p>
    387      * In some cases, a matching Activity may not exist, so ensure you safeguard
    388      * against this.
    389      * <p>
    390      * Input: Nothing.
    391      * <p>
    392      * Output: Nothing.
    393      */
    394     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    395     public static final String ACTION_WIFI_IP_SETTINGS =
    396             "android.settings.WIFI_IP_SETTINGS";
    397 
    398     /**
    399      * Activity Action: Show settings to allow configuration of Bluetooth.
    400      * <p>
    401      * In some cases, a matching Activity may not exist, so ensure you
    402      * safeguard against this.
    403      * <p>
    404      * Input: Nothing.
    405      * <p>
    406      * Output: Nothing.
    407      */
    408     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    409     public static final String ACTION_BLUETOOTH_SETTINGS =
    410             "android.settings.BLUETOOTH_SETTINGS";
    411 
    412     /**
    413      * Activity Action: Show settings to allow configuration of cast endpoints.
    414      * <p>
    415      * In some cases, a matching Activity may not exist, so ensure you
    416      * safeguard against this.
    417      * <p>
    418      * Input: Nothing.
    419      * <p>
    420      * Output: Nothing.
    421      */
    422     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    423     public static final String ACTION_CAST_SETTINGS =
    424             "android.settings.CAST_SETTINGS";
    425 
    426     /**
    427      * Activity Action: Show settings to allow configuration of date and time.
    428      * <p>
    429      * In some cases, a matching Activity may not exist, so ensure you
    430      * safeguard against this.
    431      * <p>
    432      * Input: Nothing.
    433      * <p>
    434      * Output: Nothing.
    435      */
    436     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    437     public static final String ACTION_DATE_SETTINGS =
    438             "android.settings.DATE_SETTINGS";
    439 
    440     /**
    441      * Activity Action: Show settings to allow configuration of sound and volume.
    442      * <p>
    443      * In some cases, a matching Activity may not exist, so ensure you
    444      * safeguard against this.
    445      * <p>
    446      * Input: Nothing.
    447      * <p>
    448      * Output: Nothing.
    449      */
    450     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    451     public static final String ACTION_SOUND_SETTINGS =
    452             "android.settings.SOUND_SETTINGS";
    453 
    454     /**
    455      * Activity Action: Show settings to allow configuration of display.
    456      * <p>
    457      * In some cases, a matching Activity may not exist, so ensure you
    458      * safeguard against this.
    459      * <p>
    460      * Input: Nothing.
    461      * <p>
    462      * Output: Nothing.
    463      */
    464     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    465     public static final String ACTION_DISPLAY_SETTINGS =
    466             "android.settings.DISPLAY_SETTINGS";
    467 
    468     /**
    469      * Activity Action: Show settings to allow configuration of Night display.
    470      * <p>
    471      * In some cases, a matching Activity may not exist, so ensure you
    472      * safeguard against this.
    473      * <p>
    474      * Input: Nothing.
    475      * <p>
    476      * Output: Nothing.
    477      */
    478     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    479     public static final String ACTION_NIGHT_DISPLAY_SETTINGS =
    480             "android.settings.NIGHT_DISPLAY_SETTINGS";
    481 
    482     /**
    483      * Activity Action: Show settings to allow configuration of locale.
    484      * <p>
    485      * In some cases, a matching Activity may not exist, so ensure you
    486      * safeguard against this.
    487      * <p>
    488      * Input: Nothing.
    489      * <p>
    490      * Output: Nothing.
    491      */
    492     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    493     public static final String ACTION_LOCALE_SETTINGS =
    494             "android.settings.LOCALE_SETTINGS";
    495 
    496     /**
    497      * Activity Action: Show settings to configure input methods, in particular
    498      * allowing the user to enable input methods.
    499      * <p>
    500      * In some cases, a matching Activity may not exist, so ensure you
    501      * safeguard against this.
    502      * <p>
    503      * Input: Nothing.
    504      * <p>
    505      * Output: Nothing.
    506      */
    507     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    508     public static final String ACTION_VOICE_INPUT_SETTINGS =
    509             "android.settings.VOICE_INPUT_SETTINGS";
    510 
    511     /**
    512      * Activity Action: Show settings to configure input methods, in particular
    513      * allowing the user to enable input methods.
    514      * <p>
    515      * In some cases, a matching Activity may not exist, so ensure you
    516      * safeguard against this.
    517      * <p>
    518      * Input: Nothing.
    519      * <p>
    520      * Output: Nothing.
    521      */
    522     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    523     public static final String ACTION_INPUT_METHOD_SETTINGS =
    524             "android.settings.INPUT_METHOD_SETTINGS";
    525 
    526     /**
    527      * Activity Action: Show settings to enable/disable input method subtypes.
    528      * <p>
    529      * In some cases, a matching Activity may not exist, so ensure you
    530      * safeguard against this.
    531      * <p>
    532      * To tell which input method's subtypes are displayed in the settings, add
    533      * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
    534      * If there is no extra in this Intent, subtypes from all installed input methods
    535      * will be displayed in the settings.
    536      *
    537      * @see android.view.inputmethod.InputMethodInfo#getId
    538      * <p>
    539      * Input: Nothing.
    540      * <p>
    541      * Output: Nothing.
    542      */
    543     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    544     public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
    545             "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
    546 
    547     /**
    548      * Activity Action: Show a dialog to select input method.
    549      * <p>
    550      * In some cases, a matching Activity may not exist, so ensure you
    551      * safeguard against this.
    552      * <p>
    553      * Input: Nothing.
    554      * <p>
    555      * Output: Nothing.
    556      * @hide
    557      */
    558     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    559     public static final String ACTION_SHOW_INPUT_METHOD_PICKER =
    560             "android.settings.SHOW_INPUT_METHOD_PICKER";
    561 
    562     /**
    563      * Activity Action: Show settings to manage the user input dictionary.
    564      * <p>
    565      * Starting with {@link android.os.Build.VERSION_CODES#KITKAT},
    566      * it is guaranteed there will always be an appropriate implementation for this Intent action.
    567      * In prior releases of the platform this was optional, so ensure you safeguard against it.
    568      * <p>
    569      * Input: Nothing.
    570      * <p>
    571      * Output: Nothing.
    572      */
    573     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    574     public static final String ACTION_USER_DICTIONARY_SETTINGS =
    575             "android.settings.USER_DICTIONARY_SETTINGS";
    576 
    577     /**
    578      * Activity Action: Show settings to configure the hardware keyboard.
    579      * <p>
    580      * In some cases, a matching Activity may not exist, so ensure you
    581      * safeguard against this.
    582      * <p>
    583      * Input: Nothing.
    584      * <p>
    585      * Output: Nothing.
    586      */
    587     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    588     public static final String ACTION_HARD_KEYBOARD_SETTINGS =
    589             "android.settings.HARD_KEYBOARD_SETTINGS";
    590 
    591     /**
    592      * Activity Action: Adds a word to the user dictionary.
    593      * <p>
    594      * In some cases, a matching Activity may not exist, so ensure you
    595      * safeguard against this.
    596      * <p>
    597      * Input: An extra with key <code>word</code> that contains the word
    598      * that should be added to the dictionary.
    599      * <p>
    600      * Output: Nothing.
    601      *
    602      * @hide
    603      */
    604     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    605     public static final String ACTION_USER_DICTIONARY_INSERT =
    606             "com.android.settings.USER_DICTIONARY_INSERT";
    607 
    608     /**
    609      * Activity Action: Show settings to allow configuration of application-related settings.
    610      * <p>
    611      * In some cases, a matching Activity may not exist, so ensure you
    612      * safeguard against this.
    613      * <p>
    614      * Input: Nothing.
    615      * <p>
    616      * Output: Nothing.
    617      */
    618     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    619     public static final String ACTION_APPLICATION_SETTINGS =
    620             "android.settings.APPLICATION_SETTINGS";
    621 
    622     /**
    623      * Activity Action: Show settings to allow configuration of application
    624      * development-related settings.  As of
    625      * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
    626      * a required part of the platform.
    627      * <p>
    628      * Input: Nothing.
    629      * <p>
    630      * Output: Nothing.
    631      */
    632     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    633     public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
    634             "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
    635 
    636     /**
    637      * Activity Action: Show settings to allow configuration of quick launch shortcuts.
    638      * <p>
    639      * In some cases, a matching Activity may not exist, so ensure you
    640      * safeguard against this.
    641      * <p>
    642      * Input: Nothing.
    643      * <p>
    644      * Output: Nothing.
    645      */
    646     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    647     public static final String ACTION_QUICK_LAUNCH_SETTINGS =
    648             "android.settings.QUICK_LAUNCH_SETTINGS";
    649 
    650     /**
    651      * Activity Action: Show settings to manage installed applications.
    652      * <p>
    653      * In some cases, a matching Activity may not exist, so ensure you
    654      * safeguard against this.
    655      * <p>
    656      * Input: Nothing.
    657      * <p>
    658      * Output: Nothing.
    659      */
    660     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    661     public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
    662             "android.settings.MANAGE_APPLICATIONS_SETTINGS";
    663 
    664     /**
    665      * Activity Action: Show settings to manage all applications.
    666      * <p>
    667      * In some cases, a matching Activity may not exist, so ensure you
    668      * safeguard against this.
    669      * <p>
    670      * Input: Nothing.
    671      * <p>
    672      * Output: Nothing.
    673      */
    674     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    675     public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
    676             "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
    677 
    678     /**
    679      * Activity Action: Show screen for controlling which apps can draw on top of other apps.
    680      * <p>
    681      * In some cases, a matching Activity may not exist, so ensure you
    682      * safeguard against this.
    683      * <p>
    684      * Input: Optionally, the Intent's data URI can specify the application package name to
    685      * directly invoke the management GUI specific to the package name. For example
    686      * "package:com.my.app".
    687      * <p>
    688      * Output: Nothing.
    689      */
    690     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    691     public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
    692             "android.settings.action.MANAGE_OVERLAY_PERMISSION";
    693 
    694     /**
    695      * Activity Action: Show screen for controlling which apps are allowed to write/modify
    696      * system settings.
    697      * <p>
    698      * In some cases, a matching Activity may not exist, so ensure you
    699      * safeguard against this.
    700      * <p>
    701      * Input: Optionally, the Intent's data URI can specify the application package name to
    702      * directly invoke the management GUI specific to the package name. For example
    703      * "package:com.my.app".
    704      * <p>
    705      * Output: Nothing.
    706      */
    707     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    708     public static final String ACTION_MANAGE_WRITE_SETTINGS =
    709             "android.settings.action.MANAGE_WRITE_SETTINGS";
    710 
    711     /**
    712      * Activity Action: Show screen of details about a particular application.
    713      * <p>
    714      * In some cases, a matching Activity may not exist, so ensure you
    715      * safeguard against this.
    716      * <p>
    717      * Input: The Intent's data URI specifies the application package name
    718      * to be shown, with the "package" scheme.  That is "package:com.my.app".
    719      * <p>
    720      * Output: Nothing.
    721      */
    722     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    723     public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
    724             "android.settings.APPLICATION_DETAILS_SETTINGS";
    725 
    726     /**
    727      * Activity Action: Show list of applications that have been running
    728      * foreground services (to the user "running in the background").
    729      * <p>
    730      * Input: Extras "packages" is a string array of package names.
    731      * <p>
    732      * Output: Nothing.
    733      * @hide
    734      */
    735     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    736     public static final String ACTION_FOREGROUND_SERVICES_SETTINGS =
    737             "android.settings.FOREGROUND_SERVICES_SETTINGS";
    738 
    739     /**
    740      * Activity Action: Show screen for controlling which apps can ignore battery optimizations.
    741      * <p>
    742      * Input: Nothing.
    743      * <p>
    744      * Output: Nothing.
    745      * <p>
    746      * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
    747      * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
    748      * already ignoring optimizations.  You can use
    749      * {@link #ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS} to ask the user to put you
    750      * on this list.
    751      */
    752     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    753     public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS =
    754             "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
    755 
    756     /**
    757      * Activity Action: Ask the user to allow an app to ignore battery optimizations (that is,
    758      * put them on the whitelist of apps shown by
    759      * {@link #ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS}).  For an app to use this, it also
    760      * must hold the {@link android.Manifest.permission#REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}
    761      * permission.
    762      * <p><b>Note:</b> most applications should <em>not</em> use this; there are many facilities
    763      * provided by the platform for applications to operate correctly in the various power
    764      * saving modes.  This is only for unusual applications that need to deeply control their own
    765      * execution, at the potential expense of the user's battery life.  Note that these applications
    766      * greatly run the risk of showing to the user as high power consumers on their device.</p>
    767      * <p>
    768      * Input: The Intent's data URI must specify the application package name
    769      * to be shown, with the "package" scheme.  That is "package:com.my.app".
    770      * <p>
    771      * Output: Nothing.
    772      * <p>
    773      * You can use {@link android.os.PowerManager#isIgnoringBatteryOptimizations
    774      * PowerManager.isIgnoringBatteryOptimizations()} to determine if an application is
    775      * already ignoring optimizations.
    776      */
    777     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    778     public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS =
    779             "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
    780 
    781     /**
    782      * Activity Action: Show screen for controlling background data
    783      * restrictions for a particular application.
    784      * <p>
    785      * Input: Intent's data URI set with an application name, using the
    786      * "package" schema (like "package:com.my.app").
    787      *
    788      * <p>
    789      * Output: Nothing.
    790      * <p>
    791      * Applications can also use {@link android.net.ConnectivityManager#getRestrictBackgroundStatus
    792      * ConnectivityManager#getRestrictBackgroundStatus()} to determine the
    793      * status of the background data restrictions for them.
    794      */
    795     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    796     public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS =
    797             "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS";
    798 
    799     /**
    800      * @hide
    801      * Activity Action: Show the "app ops" settings screen.
    802      * <p>
    803      * Input: Nothing.
    804      * <p>
    805      * Output: Nothing.
    806      */
    807     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    808     public static final String ACTION_APP_OPS_SETTINGS =
    809             "android.settings.APP_OPS_SETTINGS";
    810 
    811     /**
    812      * Activity Action: Show settings for system update functionality.
    813      * <p>
    814      * In some cases, a matching Activity may not exist, so ensure you
    815      * safeguard against this.
    816      * <p>
    817      * Input: Nothing.
    818      * <p>
    819      * Output: Nothing.
    820      *
    821      * @hide
    822      */
    823     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    824     public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
    825             "android.settings.SYSTEM_UPDATE_SETTINGS";
    826 
    827     /**
    828      * Activity Action: Show settings for managed profile settings.
    829      * <p>
    830      * In some cases, a matching Activity may not exist, so ensure you
    831      * safeguard against this.
    832      * <p>
    833      * Input: Nothing.
    834      * <p>
    835      * Output: Nothing.
    836      *
    837      * @hide
    838      */
    839     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    840     public static final String ACTION_MANAGED_PROFILE_SETTINGS =
    841             "android.settings.MANAGED_PROFILE_SETTINGS";
    842 
    843     /**
    844      * Activity Action: Show settings to allow configuration of sync settings.
    845      * <p>
    846      * In some cases, a matching Activity may not exist, so ensure you
    847      * safeguard against this.
    848      * <p>
    849      * The account types available to add via the add account button may be restricted by adding an
    850      * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
    851      * authorities. Only account types which can sync with that content provider will be offered to
    852      * the user.
    853      * <p>
    854      * Input: Nothing.
    855      * <p>
    856      * Output: Nothing.
    857      */
    858     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    859     public static final String ACTION_SYNC_SETTINGS =
    860             "android.settings.SYNC_SETTINGS";
    861 
    862     /**
    863      * Activity Action: Show add account screen for creating a new account.
    864      * <p>
    865      * In some cases, a matching Activity may not exist, so ensure you
    866      * safeguard against this.
    867      * <p>
    868      * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
    869      * extra to the Intent with one or more syncable content provider's authorities.  Only account
    870      * types which can sync with that content provider will be offered to the user.
    871      * <p>
    872      * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
    873      * Intent with one or more account types.
    874      * <p>
    875      * Input: Nothing.
    876      * <p>
    877      * Output: Nothing.
    878      */
    879     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    880     public static final String ACTION_ADD_ACCOUNT =
    881             "android.settings.ADD_ACCOUNT_SETTINGS";
    882 
    883     /**
    884      * Activity Action: Show settings for selecting the network operator.
    885      * <p>
    886      * In some cases, a matching Activity may not exist, so ensure you
    887      * safeguard against this.
    888      * <p>
    889      * Input: Nothing.
    890      * <p>
    891      * Output: Nothing.
    892      */
    893     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    894     public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
    895             "android.settings.NETWORK_OPERATOR_SETTINGS";
    896 
    897     /**
    898      * Activity Action: Show settings for selection of 2G/3G.
    899      * <p>
    900      * In some cases, a matching Activity may not exist, so ensure you
    901      * safeguard against this.
    902      * <p>
    903      * Input: Nothing.
    904      * <p>
    905      * Output: Nothing.
    906      */
    907     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    908     public static final String ACTION_DATA_ROAMING_SETTINGS =
    909             "android.settings.DATA_ROAMING_SETTINGS";
    910 
    911     /**
    912      * Activity Action: Show settings for internal storage.
    913      * <p>
    914      * In some cases, a matching Activity may not exist, so ensure you
    915      * safeguard against this.
    916      * <p>
    917      * Input: Nothing.
    918      * <p>
    919      * Output: Nothing.
    920      */
    921     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    922     public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
    923             "android.settings.INTERNAL_STORAGE_SETTINGS";
    924     /**
    925      * Activity Action: Show settings for memory card storage.
    926      * <p>
    927      * In some cases, a matching Activity may not exist, so ensure you
    928      * safeguard against this.
    929      * <p>
    930      * Input: Nothing.
    931      * <p>
    932      * Output: Nothing.
    933      */
    934     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    935     public static final String ACTION_MEMORY_CARD_SETTINGS =
    936             "android.settings.MEMORY_CARD_SETTINGS";
    937 
    938     /**
    939      * Activity Action: Show settings for global search.
    940      * <p>
    941      * In some cases, a matching Activity may not exist, so ensure you
    942      * safeguard against this.
    943      * <p>
    944      * Input: Nothing.
    945      * <p>
    946      * Output: Nothing
    947      */
    948     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    949     public static final String ACTION_SEARCH_SETTINGS =
    950         "android.search.action.SEARCH_SETTINGS";
    951 
    952     /**
    953      * Activity Action: Show general device information settings (serial
    954      * number, software version, phone number, etc.).
    955      * <p>
    956      * In some cases, a matching Activity may not exist, so ensure you
    957      * safeguard against this.
    958      * <p>
    959      * Input: Nothing.
    960      * <p>
    961      * Output: Nothing
    962      */
    963     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    964     public static final String ACTION_DEVICE_INFO_SETTINGS =
    965         "android.settings.DEVICE_INFO_SETTINGS";
    966 
    967     /**
    968      * Activity Action: Show NFC settings.
    969      * <p>
    970      * This shows UI that allows NFC to be turned on or off.
    971      * <p>
    972      * In some cases, a matching Activity may not exist, so ensure you
    973      * safeguard against this.
    974      * <p>
    975      * Input: Nothing.
    976      * <p>
    977      * Output: Nothing
    978      * @see android.nfc.NfcAdapter#isEnabled()
    979      */
    980     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    981     public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
    982 
    983     /**
    984      * Activity Action: Show NFC Sharing settings.
    985      * <p>
    986      * This shows UI that allows NDEF Push (Android Beam) to be turned on or
    987      * off.
    988      * <p>
    989      * In some cases, a matching Activity may not exist, so ensure you
    990      * safeguard against this.
    991      * <p>
    992      * Input: Nothing.
    993      * <p>
    994      * Output: Nothing
    995      * @see android.nfc.NfcAdapter#isNdefPushEnabled()
    996      */
    997     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    998     public static final String ACTION_NFCSHARING_SETTINGS =
    999         "android.settings.NFCSHARING_SETTINGS";
   1000 
   1001     /**
   1002      * Activity Action: Show NFC Tap & Pay settings
   1003      * <p>
   1004      * This shows UI that allows the user to configure Tap&Pay
   1005      * settings.
   1006      * <p>
   1007      * In some cases, a matching Activity may not exist, so ensure you
   1008      * safeguard against this.
   1009      * <p>
   1010      * Input: Nothing.
   1011      * <p>
   1012      * Output: Nothing
   1013      */
   1014     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1015     public static final String ACTION_NFC_PAYMENT_SETTINGS =
   1016         "android.settings.NFC_PAYMENT_SETTINGS";
   1017 
   1018     /**
   1019      * Activity Action: Show Daydream settings.
   1020      * <p>
   1021      * In some cases, a matching Activity may not exist, so ensure you
   1022      * safeguard against this.
   1023      * <p>
   1024      * Input: Nothing.
   1025      * <p>
   1026      * Output: Nothing.
   1027      * @see android.service.dreams.DreamService
   1028      */
   1029     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1030     public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
   1031 
   1032     /**
   1033      * Activity Action: Show Notification listener settings.
   1034      * <p>
   1035      * In some cases, a matching Activity may not exist, so ensure you
   1036      * safeguard against this.
   1037      * <p>
   1038      * Input: Nothing.
   1039      * <p>
   1040      * Output: Nothing.
   1041      * @see android.service.notification.NotificationListenerService
   1042      */
   1043     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1044     public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
   1045             = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
   1046 
   1047     /**
   1048      * Activity Action: Show Do Not Disturb access settings.
   1049      * <p>
   1050      * Users can grant and deny access to Do Not Disturb configuration from here.
   1051      * See {@link android.app.NotificationManager#isNotificationPolicyAccessGranted()} for more
   1052      * details.
   1053      * <p>
   1054      * Input: Nothing.
   1055      * <p>
   1056      * Output: Nothing.
   1057      */
   1058     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1059     public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS
   1060             = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
   1061 
   1062     /**
   1063      * @hide
   1064      */
   1065     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1066     public static final String ACTION_CONDITION_PROVIDER_SETTINGS
   1067             = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
   1068 
   1069     /**
   1070      * Activity Action: Show settings for video captioning.
   1071      * <p>
   1072      * In some cases, a matching Activity may not exist, so ensure you safeguard
   1073      * against this.
   1074      * <p>
   1075      * Input: Nothing.
   1076      * <p>
   1077      * Output: Nothing.
   1078      */
   1079     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1080     public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
   1081 
   1082     /**
   1083      * Activity Action: Show the top level print settings.
   1084      * <p>
   1085      * In some cases, a matching Activity may not exist, so ensure you
   1086      * safeguard against this.
   1087      * <p>
   1088      * Input: Nothing.
   1089      * <p>
   1090      * Output: Nothing.
   1091      */
   1092     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1093     public static final String ACTION_PRINT_SETTINGS =
   1094             "android.settings.ACTION_PRINT_SETTINGS";
   1095 
   1096     /**
   1097      * Activity Action: Show Zen Mode configuration settings.
   1098      *
   1099      * @hide
   1100      */
   1101     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1102     public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
   1103 
   1104     /**
   1105      * Activity Action: Show Zen Mode (aka Do Not Disturb) priority configuration settings.
   1106      */
   1107     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1108     public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS
   1109             = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
   1110 
   1111     /**
   1112      * Activity Action: Show Zen Mode automation configuration settings.
   1113      *
   1114      * @hide
   1115      */
   1116     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1117     public static final String ACTION_ZEN_MODE_AUTOMATION_SETTINGS
   1118             = "android.settings.ZEN_MODE_AUTOMATION_SETTINGS";
   1119 
   1120     /**
   1121      * Activity Action: Modify do not disturb mode settings.
   1122      * <p>
   1123      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
   1124      * <p>
   1125      * This intent MUST be started using
   1126      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
   1127      * startVoiceActivity}.
   1128      * <p>
   1129      * Note: The Activity implementing this intent MUST verify that
   1130      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction}.
   1131      * returns true before modifying the setting.
   1132      * <p>
   1133      * Input: The optional {@link #EXTRA_DO_NOT_DISTURB_MODE_MINUTES} extra can be used to indicate
   1134      * how long the user wishes to avoid interruptions for. The optional
   1135      * {@link #EXTRA_DO_NOT_DISTURB_MODE_ENABLED} extra can be to indicate if the user is
   1136      * enabling or disabling do not disturb mode. If either extra is not included, the
   1137      * user maybe asked to provide the value.
   1138      * <p>
   1139      * Output: Nothing.
   1140      */
   1141     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1142     public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE =
   1143             "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE";
   1144 
   1145     /**
   1146      * Activity Action: Show Zen Mode schedule rule configuration settings.
   1147      *
   1148      * @hide
   1149      */
   1150     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1151     public static final String ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS
   1152             = "android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS";
   1153 
   1154     /**
   1155      * Activity Action: Show Zen Mode event rule configuration settings.
   1156      *
   1157      * @hide
   1158      */
   1159     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1160     public static final String ACTION_ZEN_MODE_EVENT_RULE_SETTINGS
   1161             = "android.settings.ZEN_MODE_EVENT_RULE_SETTINGS";
   1162 
   1163     /**
   1164      * Activity Action: Show Zen Mode external rule configuration settings.
   1165      *
   1166      * @hide
   1167      */
   1168     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1169     public static final String ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS
   1170             = "android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS";
   1171 
   1172     /**
   1173      * Activity Action: Show the regulatory information screen for the device.
   1174      * <p>
   1175      * In some cases, a matching Activity may not exist, so ensure you safeguard
   1176      * against this.
   1177      * <p>
   1178      * Input: Nothing.
   1179      * <p>
   1180      * Output: Nothing.
   1181      */
   1182     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1183     public static final String
   1184             ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
   1185 
   1186     /**
   1187      * Activity Action: Show Device Name Settings.
   1188      * <p>
   1189      * In some cases, a matching Activity may not exist, so ensure you safeguard
   1190      * against this.
   1191      *
   1192      * @hide
   1193      */
   1194     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1195     public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
   1196 
   1197     /**
   1198      * Activity Action: Show pairing settings.
   1199      * <p>
   1200      * In some cases, a matching Activity may not exist, so ensure you safeguard
   1201      * against this.
   1202      *
   1203      * @hide
   1204      */
   1205     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1206     public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
   1207 
   1208     /**
   1209      * Activity Action: Show battery saver settings.
   1210      * <p>
   1211      * In some cases, a matching Activity may not exist, so ensure you safeguard
   1212      * against this.
   1213      */
   1214     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1215     public static final String ACTION_BATTERY_SAVER_SETTINGS
   1216             = "android.settings.BATTERY_SAVER_SETTINGS";
   1217 
   1218     /**
   1219      * Activity Action: Modify Battery Saver mode setting using a voice command.
   1220      * <p>
   1221      * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
   1222      * <p>
   1223      * This intent MUST be started using
   1224      * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
   1225      * startVoiceActivity}.
   1226      * <p>
   1227      * Note: The activity implementing this intent MUST verify that
   1228      * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
   1229      * modifying the setting.
   1230      * <p>
   1231      * Input: To tell which state batter saver mode should be set to, add the
   1232      * {@link #EXTRA_BATTERY_SAVER_MODE_ENABLED} extra to this Intent with the state specified.
   1233      * If the extra is not included, no changes will be made.
   1234      * <p>
   1235      * Output: Nothing.
   1236      */
   1237     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1238     public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE =
   1239             "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE";
   1240 
   1241     /**
   1242      * Activity Action: Show Home selection settings. If there are multiple activities
   1243      * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you
   1244      * to pick your preferred activity.
   1245      */
   1246     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1247     public static final String ACTION_HOME_SETTINGS
   1248             = "android.settings.HOME_SETTINGS";
   1249 
   1250     /**
   1251      * Activity Action: Show Default apps settings.
   1252      * <p>
   1253      * In some cases, a matching Activity may not exist, so ensure you
   1254      * safeguard against this.
   1255      * <p>
   1256      * Input: Nothing.
   1257      * <p>
   1258      * Output: Nothing.
   1259      */
   1260     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1261     public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS
   1262             = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
   1263 
   1264     /**
   1265      * Activity Action: Show notification settings.
   1266      *
   1267      * @hide
   1268      */
   1269     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1270     public static final String ACTION_NOTIFICATION_SETTINGS
   1271             = "android.settings.NOTIFICATION_SETTINGS";
   1272 
   1273     /**
   1274      * Activity Action: Show notification settings for a single app.
   1275      * <p>
   1276      *     Input: {@link #EXTRA_APP_PACKAGE}, the package containing the channel to display.
   1277      *     Input: Optionally, {@link #EXTRA_CHANNEL_ID}, to highlight that channel.
   1278      * <p>
   1279      * Output: Nothing.
   1280      */
   1281     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1282     public static final String ACTION_APP_NOTIFICATION_SETTINGS
   1283             = "android.settings.APP_NOTIFICATION_SETTINGS";
   1284 
   1285     /**
   1286      * Activity Action: Show notification settings for a single {@link NotificationChannel}.
   1287      * <p>
   1288      *     Input: {@link #EXTRA_APP_PACKAGE}, the package containing the channel to display.
   1289      *     Input: {@link #EXTRA_CHANNEL_ID}, the id of the channel to display.
   1290      * <p>
   1291      * Output: Nothing.
   1292      */
   1293     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1294     public static final String ACTION_CHANNEL_NOTIFICATION_SETTINGS
   1295             = "android.settings.CHANNEL_NOTIFICATION_SETTINGS";
   1296 
   1297     /**
   1298      * Activity Extra: The package owner of the notification channel settings to display.
   1299      * <p>
   1300      * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
   1301      */
   1302     public static final String EXTRA_APP_PACKAGE = "android.provider.extra.APP_PACKAGE";
   1303 
   1304     /**
   1305      * Activity Extra: The {@link NotificationChannel#getId()} of the notification channel settings
   1306      * to display.
   1307      * <p>
   1308      * This must be passed as an extra field to the {@link #ACTION_CHANNEL_NOTIFICATION_SETTINGS}.
   1309      */
   1310     public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
   1311 
   1312     /**
   1313      * Activity Action: Show notification redaction settings.
   1314      *
   1315      * @hide
   1316      */
   1317     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1318     public static final String ACTION_APP_NOTIFICATION_REDACTION
   1319             = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
   1320 
   1321     /** @hide */ public static final String EXTRA_APP_UID = "app_uid";
   1322 
   1323     /**
   1324      * Activity Action: Show a dialog with disabled by policy message.
   1325      * <p> If an user action is disabled by policy, this dialog can be triggered to let
   1326      * the user know about this.
   1327      * <p>
   1328      * Input: Nothing.
   1329      * <p>
   1330      * Output: Nothing.
   1331      *
   1332      * @hide
   1333      */
   1334     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1335     public static final String ACTION_SHOW_ADMIN_SUPPORT_DETAILS
   1336             = "android.settings.SHOW_ADMIN_SUPPORT_DETAILS";
   1337 
   1338     /**
   1339      * Activity Action: Show a dialog for remote bugreport flow.
   1340      * <p>
   1341      * Input: Nothing.
   1342      * <p>
   1343      * Output: Nothing.
   1344      *
   1345      * @hide
   1346      */
   1347     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1348     public static final String ACTION_SHOW_REMOTE_BUGREPORT_DIALOG
   1349             = "android.settings.SHOW_REMOTE_BUGREPORT_DIALOG";
   1350 
   1351     /**
   1352      * Activity Action: Show VR listener settings.
   1353      * <p>
   1354      * Input: Nothing.
   1355      * <p>
   1356      * Output: Nothing.
   1357      *
   1358      * @see android.service.vr.VrListenerService
   1359      */
   1360     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1361     public static final String ACTION_VR_LISTENER_SETTINGS
   1362             = "android.settings.VR_LISTENER_SETTINGS";
   1363 
   1364     /**
   1365      * Activity Action: Show Picture-in-picture settings.
   1366      * <p>
   1367      * Input: Nothing.
   1368      * <p>
   1369      * Output: Nothing.
   1370      *
   1371      * @hide
   1372      */
   1373     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1374     public static final String ACTION_PICTURE_IN_PICTURE_SETTINGS
   1375             = "android.settings.PICTURE_IN_PICTURE_SETTINGS";
   1376 
   1377     /**
   1378      * Activity Action: Show Storage Manager settings.
   1379      * <p>
   1380      * Input: Nothing.
   1381      * <p>
   1382      * Output: Nothing.
   1383      *
   1384      * @hide
   1385      */
   1386     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1387     public static final String ACTION_STORAGE_MANAGER_SETTINGS
   1388             = "android.settings.STORAGE_MANAGER_SETTINGS";
   1389 
   1390     /**
   1391      * Activity Action: Allows user to select current webview implementation.
   1392      * <p>
   1393      * Input: Nothing.
   1394      * <p>
   1395      * Output: Nothing.
   1396      */
   1397     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1398     public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
   1399 
   1400     /**
   1401      * Activity Action: Show enterprise privacy section.
   1402      * <p>
   1403      * Input: Nothing.
   1404      * <p>
   1405      * Output: Nothing.
   1406      * @hide
   1407      */
   1408     @SystemApi
   1409     @TestApi
   1410     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1411     public static final String ACTION_ENTERPRISE_PRIVACY_SETTINGS
   1412             = "android.settings.ENTERPRISE_PRIVACY_SETTINGS";
   1413 
   1414     /**
   1415      * Activity Action: Show screen that let user select its Autofill Service.
   1416      * <p>
   1417      * Input: Intent's data URI set with an application name, using the
   1418      * "package" schema (like "package:com.my.app").
   1419      *
   1420      * <p>
   1421      * Output: {@link android.app.Activity#RESULT_OK} if user selected an Autofill Service belonging
   1422      * to the caller package.
   1423      *
   1424      * <p>
   1425      * <b>NOTE: </b> applications should call
   1426      * {@link android.view.autofill.AutofillManager#hasEnabledAutofillServices()} and
   1427      * {@link android.view.autofill.AutofillManager#isAutofillSupported()} first, and only
   1428      * broadcast this intent if they return {@code false} and {@code true} respectively.
   1429      */
   1430     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
   1431     public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE =
   1432             "android.settings.REQUEST_SET_AUTOFILL_SERVICE";
   1433 
   1434     // End of Intent actions for Settings
   1435 
   1436     /**
   1437      * @hide - Private call() method on SettingsProvider to read from 'system' table.
   1438      */
   1439     public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
   1440 
   1441     /**
   1442      * @hide - Private call() method on SettingsProvider to read from 'secure' table.
   1443      */
   1444     public static final String CALL_METHOD_GET_SECURE = "GET_secure";
   1445 
   1446     /**
   1447      * @hide - Private call() method on SettingsProvider to read from 'global' table.
   1448      */
   1449     public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
   1450 
   1451     /**
   1452      * @hide - Specifies that the caller of the fast-path call()-based flow tracks
   1453      * the settings generation in order to cache values locally. If this key is
   1454      * mapped to a <code>null</code> string extra in the request bundle, the response
   1455      * bundle will contain the same key mapped to a parcelable extra which would be
   1456      * an {@link android.util.MemoryIntArray}. The response will also contain an
   1457      * integer mapped to the {@link #CALL_METHOD_GENERATION_INDEX_KEY} which is the
   1458      * index in the array clients should use to lookup the generation. For efficiency
   1459      * the caller should request the generation tracking memory array only if it
   1460      * doesn't already have it.
   1461      *
   1462      * @see #CALL_METHOD_GENERATION_INDEX_KEY
   1463      */
   1464     public static final String CALL_METHOD_TRACK_GENERATION_KEY = "_track_generation";
   1465 
   1466     /**
   1467      * @hide Key with the location in the {@link android.util.MemoryIntArray} where
   1468      * to look up the generation id of the backing table. The value is an integer.
   1469      *
   1470      * @see #CALL_METHOD_TRACK_GENERATION_KEY
   1471      */
   1472     public static final String CALL_METHOD_GENERATION_INDEX_KEY = "_generation_index";
   1473 
   1474     /**
   1475      * @hide Key with the settings table generation. The value is an integer.
   1476      *
   1477      * @see #CALL_METHOD_TRACK_GENERATION_KEY
   1478      */
   1479     public static final String CALL_METHOD_GENERATION_KEY = "_generation";
   1480 
   1481     /**
   1482      * @hide - User handle argument extra to the fast-path call()-based requests
   1483      */
   1484     public static final String CALL_METHOD_USER_KEY = "_user";
   1485 
   1486     /**
   1487      * @hide - Boolean argument extra to the fast-path call()-based requests
   1488      */
   1489     public static final String CALL_METHOD_MAKE_DEFAULT_KEY = "_make_default";
   1490 
   1491     /**
   1492      * @hide - User handle argument extra to the fast-path call()-based requests
   1493      */
   1494     public static final String CALL_METHOD_RESET_MODE_KEY = "_reset_mode";
   1495 
   1496     /**
   1497      * @hide - String argument extra to the fast-path call()-based requests
   1498      */
   1499     public static final String CALL_METHOD_TAG_KEY = "_tag";
   1500 
   1501     /** @hide - Private call() method to write to 'system' table */
   1502     public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
   1503 
   1504     /** @hide - Private call() method to write to 'secure' table */
   1505     public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
   1506 
   1507     /** @hide - Private call() method to write to 'global' table */
   1508     public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
   1509 
   1510     /** @hide - Private call() method to reset to defaults the 'global' table */
   1511     public static final String CALL_METHOD_RESET_GLOBAL = "RESET_global";
   1512 
   1513     /** @hide - Private call() method to reset to defaults the 'secure' table */
   1514     public static final String CALL_METHOD_RESET_SECURE = "RESET_secure";
   1515 
   1516     /**
   1517      * Activity Extra: Limit available options in launched activity based on the given authority.
   1518      * <p>
   1519      * This can be passed as an extra field in an Activity Intent with one or more syncable content
   1520      * provider's authorities as a String[]. This field is used by some intents to alter the
   1521      * behavior of the called activity.
   1522      * <p>
   1523      * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
   1524      * on the authority given.
   1525      */
   1526     public static final String EXTRA_AUTHORITIES = "authorities";
   1527 
   1528     /**
   1529      * Activity Extra: Limit available options in launched activity based on the given account
   1530      * types.
   1531      * <p>
   1532      * This can be passed as an extra field in an Activity Intent with one or more account types
   1533      * as a String[]. This field is used by some intents to alter the behavior of the called
   1534      * activity.
   1535      * <p>
   1536      * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
   1537      * list.
   1538      */
   1539     public static final String EXTRA_ACCOUNT_TYPES = "account_types";
   1540 
   1541     public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
   1542 
   1543     /**
   1544      * Activity Extra: The device identifier to act upon.
   1545      * <p>
   1546      * This can be passed as an extra field in an Activity Intent with a single
   1547      * InputDeviceIdentifier. This field is used by some activities to jump straight into the
   1548      * settings for the given device.
   1549      * <p>
   1550      * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout
   1551      * dialog for the given device.
   1552      * @hide
   1553      */
   1554     public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
   1555 
   1556     /**
   1557      * Activity Extra: Enable or disable Airplane Mode.
   1558      * <p>
   1559      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE}
   1560      * intent as a boolean to indicate if it should be enabled.
   1561      */
   1562     public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
   1563 
   1564     /**
   1565      * Activity Extra: Enable or disable Battery saver mode.
   1566      * <p>
   1567      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE}
   1568      * intent as a boolean to indicate if it should be enabled.
   1569      */
   1570     public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED =
   1571             "android.settings.extra.battery_saver_mode_enabled";
   1572 
   1573     /**
   1574      * Activity Extra: Enable or disable Do Not Disturb mode.
   1575      * <p>
   1576      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
   1577      * intent as a boolean to indicate if it should be enabled.
   1578      */
   1579     public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED =
   1580             "android.settings.extra.do_not_disturb_mode_enabled";
   1581 
   1582     /**
   1583      * Activity Extra: How many minutes to enable do not disturb mode for.
   1584      * <p>
   1585      * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE}
   1586      * intent to indicate how long do not disturb mode should be enabled for.
   1587      */
   1588     public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES =
   1589             "android.settings.extra.do_not_disturb_mode_minutes";
   1590 
   1591     /**
   1592      * Reset mode: reset to defaults only settings changed by the
   1593      * calling package. If there is a default set the setting
   1594      * will be set to it, otherwise the setting will be deleted.
   1595      * This is the only type of reset available to non-system clients.
   1596      * @hide
   1597      */
   1598     public static final int RESET_MODE_PACKAGE_DEFAULTS = 1;
   1599 
   1600     /**
   1601      * Reset mode: reset all settings set by untrusted packages, which is
   1602      * packages that aren't a part of the system, to the current defaults.
   1603      * If there is a default set the setting will be set to it, otherwise
   1604      * the setting will be deleted. This mode is only available to the system.
   1605      * @hide
   1606      */
   1607     public static final int RESET_MODE_UNTRUSTED_DEFAULTS = 2;
   1608 
   1609     /**
   1610      * Reset mode: delete all settings set by untrusted packages, which is
   1611      * packages that aren't a part of the system. If a setting is set by an
   1612      * untrusted package it will be deleted if its default is not provided
   1613      * by the system, otherwise the setting will be set to its default.
   1614      * This mode is only available to the system.
   1615      * @hide
   1616      */
   1617     public static final int RESET_MODE_UNTRUSTED_CHANGES = 3;
   1618 
   1619     /**
   1620      * Reset mode: reset all settings to defaults specified by trusted
   1621      * packages, which is packages that are a part of the system, and
   1622      * delete all settings set by untrusted packages. If a setting has
   1623      * a default set by a system package it will be set to the default,
   1624      * otherwise the setting will be deleted. This mode is only available
   1625      * to the system.
   1626      * @hide
   1627      */
   1628     public static final int RESET_MODE_TRUSTED_DEFAULTS = 4;
   1629 
   1630     /** @hide */
   1631     @Retention(RetentionPolicy.SOURCE)
   1632     @IntDef({
   1633             RESET_MODE_PACKAGE_DEFAULTS,
   1634             RESET_MODE_UNTRUSTED_DEFAULTS,
   1635             RESET_MODE_UNTRUSTED_CHANGES,
   1636             RESET_MODE_TRUSTED_DEFAULTS
   1637     })
   1638     public @interface ResetMode{}
   1639 
   1640     /**
   1641      * Activity Extra: Number of certificates
   1642      * <p>
   1643      * This can be passed as an extra field to the {@link #ACTION_MONITORING_CERT_INFO}
   1644      * intent to indicate the number of certificates
   1645      * @hide
   1646      */
   1647     public static final String EXTRA_NUMBER_OF_CERTIFICATES =
   1648             "android.settings.extra.number_of_certificates";
   1649 
   1650     private static final String JID_RESOURCE_PREFIX = "android";
   1651 
   1652     public static final String AUTHORITY = "settings";
   1653 
   1654     private static final String TAG = "Settings";
   1655     private static final boolean LOCAL_LOGV = false;
   1656 
   1657     // Lock ensures that when enabling/disabling the master location switch, we don't end up
   1658     // with a partial enable/disable state in multi-threaded situations.
   1659     private static final Object mLocationSettingsLock = new Object();
   1660 
   1661     // Used in system server calling uid workaround in call()
   1662     private static boolean sInSystemServer = false;
   1663     private static final Object sInSystemServerLock = new Object();
   1664 
   1665     /** @hide */
   1666     public static void setInSystemServer() {
   1667         synchronized (sInSystemServerLock) {
   1668             sInSystemServer = true;
   1669         }
   1670     }
   1671 
   1672     /** @hide */
   1673     public static boolean isInSystemServer() {
   1674         synchronized (sInSystemServerLock) {
   1675             return sInSystemServer;
   1676         }
   1677     }
   1678 
   1679     public static class SettingNotFoundException extends AndroidException {
   1680         public SettingNotFoundException(String msg) {
   1681             super(msg);
   1682         }
   1683     }
   1684 
   1685     /**
   1686      * Common base for tables of name/value settings.
   1687      */
   1688     public static class NameValueTable implements BaseColumns {
   1689         public static final String NAME = "name";
   1690         public static final String VALUE = "value";
   1691 
   1692         protected static boolean putString(ContentResolver resolver, Uri uri,
   1693                 String name, String value) {
   1694             // The database will take care of replacing duplicates.
   1695             try {
   1696                 ContentValues values = new ContentValues();
   1697                 values.put(NAME, name);
   1698                 values.put(VALUE, value);
   1699                 resolver.insert(uri, values);
   1700                 return true;
   1701             } catch (SQLException e) {
   1702                 Log.w(TAG, "Can't set key " + name + " in " + uri, e);
   1703                 return false;
   1704             }
   1705         }
   1706 
   1707         public static Uri getUriFor(Uri uri, String name) {
   1708             return Uri.withAppendedPath(uri, name);
   1709         }
   1710     }
   1711 
   1712     private static final class GenerationTracker {
   1713         private final MemoryIntArray mArray;
   1714         private final Runnable mErrorHandler;
   1715         private final int mIndex;
   1716         private int mCurrentGeneration;
   1717 
   1718         public GenerationTracker(@NonNull MemoryIntArray array, int index,
   1719                 int generation, Runnable errorHandler) {
   1720             mArray = array;
   1721             mIndex = index;
   1722             mErrorHandler = errorHandler;
   1723             mCurrentGeneration = generation;
   1724         }
   1725 
   1726         public boolean isGenerationChanged() {
   1727             final int currentGeneration = readCurrentGeneration();
   1728             if (currentGeneration >= 0) {
   1729                 if (currentGeneration == mCurrentGeneration) {
   1730                     return false;
   1731                 }
   1732                 mCurrentGeneration = currentGeneration;
   1733             }
   1734             return true;
   1735         }
   1736 
   1737         private int readCurrentGeneration() {
   1738             try {
   1739                 return mArray.get(mIndex);
   1740             } catch (IOException e) {
   1741                 Log.e(TAG, "Error getting current generation", e);
   1742                 if (mErrorHandler != null) {
   1743                     mErrorHandler.run();
   1744                 }
   1745             }
   1746             return -1;
   1747         }
   1748 
   1749         public void destroy() {
   1750             try {
   1751                 mArray.close();
   1752             } catch (IOException e) {
   1753                 Log.e(TAG, "Error closing backing array", e);
   1754                 if (mErrorHandler != null) {
   1755                     mErrorHandler.run();
   1756                 }
   1757             }
   1758         }
   1759     }
   1760 
   1761     private static final class ContentProviderHolder {
   1762         private final Object mLock = new Object();
   1763 
   1764         @GuardedBy("mLock")
   1765         private final Uri mUri;
   1766         @GuardedBy("mLock")
   1767         private IContentProvider mContentProvider;
   1768 
   1769         public ContentProviderHolder(Uri uri) {
   1770             mUri = uri;
   1771         }
   1772 
   1773         public IContentProvider getProvider(ContentResolver contentResolver) {
   1774             synchronized (mLock) {
   1775                 if (mContentProvider == null) {
   1776                     mContentProvider = contentResolver
   1777                             .acquireProvider(mUri.getAuthority());
   1778                 }
   1779                 return mContentProvider;
   1780             }
   1781         }
   1782     }
   1783 
   1784     // Thread-safe.
   1785     private static class NameValueCache {
   1786         private static final boolean DEBUG = false;
   1787 
   1788         private static final String[] SELECT_VALUE_PROJECTION = new String[] {
   1789                 Settings.NameValueTable.VALUE
   1790         };
   1791 
   1792         private static final String NAME_EQ_PLACEHOLDER = "name=?";
   1793 
   1794         // Must synchronize on 'this' to access mValues and mValuesVersion.
   1795         private final HashMap<String, String> mValues = new HashMap<>();
   1796 
   1797         private final Uri mUri;
   1798         private final ContentProviderHolder mProviderHolder;
   1799 
   1800         // The method we'll call (or null, to not use) on the provider
   1801         // for the fast path of retrieving settings.
   1802         private final String mCallGetCommand;
   1803         private final String mCallSetCommand;
   1804 
   1805         @GuardedBy("this")
   1806         private GenerationTracker mGenerationTracker;
   1807 
   1808         public NameValueCache(Uri uri, String getCommand, String setCommand,
   1809                 ContentProviderHolder providerHolder) {
   1810             mUri = uri;
   1811             mCallGetCommand = getCommand;
   1812             mCallSetCommand = setCommand;
   1813             mProviderHolder = providerHolder;
   1814         }
   1815 
   1816         public boolean putStringForUser(ContentResolver cr, String name, String value,
   1817                 String tag, boolean makeDefault, final int userHandle) {
   1818             try {
   1819                 Bundle arg = new Bundle();
   1820                 arg.putString(Settings.NameValueTable.VALUE, value);
   1821                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
   1822                 if (tag != null) {
   1823                     arg.putString(CALL_METHOD_TAG_KEY, tag);
   1824                 }
   1825                 if (makeDefault) {
   1826                     arg.putBoolean(CALL_METHOD_MAKE_DEFAULT_KEY, true);
   1827                 }
   1828                 IContentProvider cp = mProviderHolder.getProvider(cr);
   1829                 cp.call(cr.getPackageName(), mCallSetCommand, name, arg);
   1830             } catch (RemoteException e) {
   1831                 Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
   1832                 return false;
   1833             }
   1834             return true;
   1835         }
   1836 
   1837         public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
   1838             final boolean isSelf = (userHandle == UserHandle.myUserId());
   1839             if (isSelf) {
   1840                 synchronized (NameValueCache.this) {
   1841                     if (mGenerationTracker != null) {
   1842                         if (mGenerationTracker.isGenerationChanged()) {
   1843                             if (DEBUG) {
   1844                                 Log.i(TAG, "Generation changed for type:"
   1845                                         + mUri.getPath() + " in package:"
   1846                                         + cr.getPackageName() +" and user:" + userHandle);
   1847                             }
   1848                             mValues.clear();
   1849                         } else if (mValues.containsKey(name)) {
   1850                             return mValues.get(name);
   1851                         }
   1852                     }
   1853                 }
   1854             } else {
   1855                 if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
   1856                         + " by user " + UserHandle.myUserId() + " so skipping cache");
   1857             }
   1858 
   1859             IContentProvider cp = mProviderHolder.getProvider(cr);
   1860 
   1861             // Try the fast path first, not using query().  If this
   1862             // fails (alternate Settings provider that doesn't support
   1863             // this interface?) then we fall back to the query/table
   1864             // interface.
   1865             if (mCallGetCommand != null) {
   1866                 try {
   1867                     Bundle args = null;
   1868                     if (!isSelf) {
   1869                         args = new Bundle();
   1870                         args.putInt(CALL_METHOD_USER_KEY, userHandle);
   1871                     }
   1872                     boolean needsGenerationTracker = false;
   1873                     synchronized (NameValueCache.this) {
   1874                         if (isSelf && mGenerationTracker == null) {
   1875                             needsGenerationTracker = true;
   1876                             if (args == null) {
   1877                                 args = new Bundle();
   1878                             }
   1879                             args.putString(CALL_METHOD_TRACK_GENERATION_KEY, null);
   1880                             if (DEBUG) {
   1881                                 Log.i(TAG, "Requested generation tracker for type: "+ mUri.getPath()
   1882                                         + " in package:" + cr.getPackageName() +" and user:"
   1883                                         + userHandle);
   1884                             }
   1885                         }
   1886                     }
   1887                     Bundle b;
   1888                     // If we're in system server and in a binder transaction we need to clear the
   1889                     // calling uid. This works around code in system server that did not call
   1890                     // clearCallingIdentity, previously this wasn't needed because reading settings
   1891                     // did not do permission checking but thats no longer the case.
   1892                     // Long term this should be removed and callers should properly call
   1893                     // clearCallingIdentity or use a ContentResolver from the caller as needed.
   1894                     if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
   1895                         final long token = Binder.clearCallingIdentity();
   1896                         try {
   1897                             b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
   1898                         } finally {
   1899                             Binder.restoreCallingIdentity(token);
   1900                         }
   1901                     } else {
   1902                         b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
   1903                     }
   1904                     if (b != null) {
   1905                         String value = b.getString(Settings.NameValueTable.VALUE);
   1906                         // Don't update our cache for reads of other users' data
   1907                         if (isSelf) {
   1908                             synchronized (NameValueCache.this) {
   1909                                 if (needsGenerationTracker) {
   1910                                     MemoryIntArray array = b.getParcelable(
   1911                                             CALL_METHOD_TRACK_GENERATION_KEY);
   1912                                     final int index = b.getInt(
   1913                                             CALL_METHOD_GENERATION_INDEX_KEY, -1);
   1914                                     if (array != null && index >= 0) {
   1915                                         final int generation = b.getInt(
   1916                                                 CALL_METHOD_GENERATION_KEY, 0);
   1917                                         if (DEBUG) {
   1918                                             Log.i(TAG, "Received generation tracker for type:"
   1919                                                     + mUri.getPath() + " in package:"
   1920                                                     + cr.getPackageName() + " and user:"
   1921                                                     + userHandle + " with index:" + index);
   1922                                         }
   1923                                         if (mGenerationTracker != null) {
   1924                                             mGenerationTracker.destroy();
   1925                                         }
   1926                                         mGenerationTracker = new GenerationTracker(array, index,
   1927                                                 generation, () -> {
   1928                                             synchronized (NameValueCache.this) {
   1929                                                 Log.e(TAG, "Error accessing generation"
   1930                                                         + " tracker - removing");
   1931                                                 if (mGenerationTracker != null) {
   1932                                                     GenerationTracker generationTracker =
   1933                                                             mGenerationTracker;
   1934                                                     mGenerationTracker = null;
   1935                                                     generationTracker.destroy();
   1936                                                     mValues.clear();
   1937                                                 }
   1938                                             }
   1939                                         });
   1940                                     }
   1941                                 }
   1942                                 mValues.put(name, value);
   1943                             }
   1944                         } else {
   1945                             if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
   1946                                     + " by " + UserHandle.myUserId()
   1947                                     + " so not updating cache");
   1948                         }
   1949                         return value;
   1950                     }
   1951                     // If the response Bundle is null, we fall through
   1952                     // to the query interface below.
   1953                 } catch (RemoteException e) {
   1954                     // Not supported by the remote side?  Fall through
   1955                     // to query().
   1956                 }
   1957             }
   1958 
   1959             Cursor c = null;
   1960             try {
   1961                 Bundle queryArgs = ContentResolver.createSqlQueryBundle(
   1962                         NAME_EQ_PLACEHOLDER, new String[]{name}, null);
   1963                 // Same workaround as above.
   1964                 if (Settings.isInSystemServer() && Binder.getCallingUid() != Process.myUid()) {
   1965                     final long token = Binder.clearCallingIdentity();
   1966                     try {
   1967                         c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
   1968                                 null);
   1969                     } finally {
   1970                         Binder.restoreCallingIdentity(token);
   1971                     }
   1972                 } else {
   1973                     c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE_PROJECTION, queryArgs,
   1974                             null);
   1975                 }
   1976                 if (c == null) {
   1977                     Log.w(TAG, "Can't get key " + name + " from " + mUri);
   1978                     return null;
   1979                 }
   1980 
   1981                 String value = c.moveToNext() ? c.getString(0) : null;
   1982                 synchronized (NameValueCache.this) {
   1983                     mValues.put(name, value);
   1984                 }
   1985                 if (LOCAL_LOGV) {
   1986                     Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
   1987                             name + " = " + (value == null ? "(null)" : value));
   1988                 }
   1989                 return value;
   1990             } catch (RemoteException e) {
   1991                 Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
   1992                 return null;  // Return null, but don't cache it.
   1993             } finally {
   1994                 if (c != null) c.close();
   1995             }
   1996         }
   1997     }
   1998 
   1999     /**
   2000      * Checks if the specified context can draw on top of other apps. As of API
   2001      * level 23, an app cannot draw on top of other apps unless it declares the
   2002      * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its
   2003      * manifest, <em>and</em> the user specifically grants the app this
   2004      * capability. To prompt the user to grant this approval, the app must send an
   2005      * intent with the action
   2006      * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which
   2007      * causes the system to display a permission management screen.
   2008      *
   2009      * @param context App context.
   2010      * @return true if the specified context can draw on top of other apps, false otherwise
   2011      */
   2012     public static boolean canDrawOverlays(Context context) {
   2013         return Settings.isCallingPackageAllowedToDrawOverlays(context, Process.myUid(),
   2014                 context.getOpPackageName(), false);
   2015     }
   2016 
   2017     /**
   2018      * System settings, containing miscellaneous system preferences.  This
   2019      * table holds simple name/value pairs.  There are convenience
   2020      * functions for accessing individual settings entries.
   2021      */
   2022     public static final class System extends NameValueTable {
   2023         private static final float DEFAULT_FONT_SCALE = 1.0f;
   2024 
   2025         /** @hide */
   2026         public static interface Validator {
   2027             public boolean validate(String value);
   2028         }
   2029 
   2030         /**
   2031          * The content:// style URL for this table
   2032          */
   2033         public static final Uri CONTENT_URI =
   2034             Uri.parse("content://" + AUTHORITY + "/system");
   2035 
   2036         private static final ContentProviderHolder sProviderHolder =
   2037                 new ContentProviderHolder(CONTENT_URI);
   2038 
   2039         private static final NameValueCache sNameValueCache = new NameValueCache(
   2040                 CONTENT_URI,
   2041                 CALL_METHOD_GET_SYSTEM,
   2042                 CALL_METHOD_PUT_SYSTEM,
   2043                 sProviderHolder);
   2044 
   2045         private static final HashSet<String> MOVED_TO_SECURE;
   2046         static {
   2047             MOVED_TO_SECURE = new HashSet<>(30);
   2048             MOVED_TO_SECURE.add(Secure.ANDROID_ID);
   2049             MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
   2050             MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
   2051             MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
   2052             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
   2053             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
   2054             MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
   2055             MOVED_TO_SECURE.add(Secure.LOGGING_ID);
   2056             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
   2057             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
   2058             MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
   2059             MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
   2060             MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
   2061             MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
   2062             MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
   2063             MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
   2064             MOVED_TO_SECURE.add(Secure.WIFI_ON);
   2065             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
   2066             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
   2067             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
   2068             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
   2069             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
   2070             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
   2071             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
   2072             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
   2073             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
   2074             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
   2075             MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
   2076 
   2077             // At one time in System, then Global, but now back in Secure
   2078             MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
   2079         }
   2080 
   2081         private static final HashSet<String> MOVED_TO_GLOBAL;
   2082         private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
   2083         static {
   2084             MOVED_TO_GLOBAL = new HashSet<>();
   2085             MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<>();
   2086 
   2087             // these were originally in system but migrated to secure in the past,
   2088             // so are duplicated in the Secure.* namespace
   2089             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
   2090             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
   2091             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
   2092             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
   2093             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
   2094             MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
   2095 
   2096             // these are moving directly from system to global
   2097             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
   2098             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
   2099             MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
   2100             MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
   2101             MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
   2102             MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
   2103             MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
   2104             MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
   2105             MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
   2106             MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
   2107             MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
   2108             MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
   2109             MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
   2110             MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
   2111             MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
   2112             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
   2113             MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
   2114             MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
   2115             MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
   2116             MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
   2117             MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
   2118             MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
   2119             MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
   2120             MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
   2121             MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
   2122             MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
   2123             MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
   2124             MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
   2125             MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
   2126             MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
   2127             MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
   2128             MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
   2129             MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
   2130             MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
   2131             MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
   2132         }
   2133 
   2134         private static final Validator sBooleanValidator =
   2135                 new DiscreteValueValidator(new String[] {"0", "1"});
   2136 
   2137         private static final Validator sNonNegativeIntegerValidator = new Validator() {
   2138             @Override
   2139             public boolean validate(String value) {
   2140                 try {
   2141                     return Integer.parseInt(value) >= 0;
   2142                 } catch (NumberFormatException e) {
   2143                     return false;
   2144                 }
   2145             }
   2146         };
   2147 
   2148         private static final Validator sUriValidator = new Validator() {
   2149             @Override
   2150             public boolean validate(String value) {
   2151                 try {
   2152                     Uri.decode(value);
   2153                     return true;
   2154                 } catch (IllegalArgumentException e) {
   2155                     return false;
   2156                 }
   2157             }
   2158         };
   2159 
   2160         private static final Validator sLenientIpAddressValidator = new Validator() {
   2161             private static final int MAX_IPV6_LENGTH = 45;
   2162 
   2163             @Override
   2164             public boolean validate(String value) {
   2165                 return value.length() <= MAX_IPV6_LENGTH;
   2166             }
   2167         };
   2168 
   2169         /** @hide */
   2170         public static void getMovedToGlobalSettings(Set<String> outKeySet) {
   2171             outKeySet.addAll(MOVED_TO_GLOBAL);
   2172             outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
   2173         }
   2174 
   2175         /** @hide */
   2176         public static void getMovedToSecureSettings(Set<String> outKeySet) {
   2177             outKeySet.addAll(MOVED_TO_SECURE);
   2178         }
   2179 
   2180         /** @hide */
   2181         public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
   2182             outKeySet.addAll(MOVED_TO_GLOBAL);
   2183         }
   2184 
   2185         /**
   2186          * Look up a name in the database.
   2187          * @param resolver to access the database with
   2188          * @param name to look up in the table
   2189          * @return the corresponding value, or null if not present
   2190          */
   2191         public static String getString(ContentResolver resolver, String name) {
   2192             return getStringForUser(resolver, name, UserHandle.myUserId());
   2193         }
   2194 
   2195         /** @hide */
   2196         public static String getStringForUser(ContentResolver resolver, String name,
   2197                 int userHandle) {
   2198             if (MOVED_TO_SECURE.contains(name)) {
   2199                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2200                         + " to android.provider.Settings.Secure, returning read-only value.");
   2201                 return Secure.getStringForUser(resolver, name, userHandle);
   2202             }
   2203             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
   2204                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2205                         + " to android.provider.Settings.Global, returning read-only value.");
   2206                 return Global.getStringForUser(resolver, name, userHandle);
   2207             }
   2208             return sNameValueCache.getStringForUser(resolver, name, userHandle);
   2209         }
   2210 
   2211         /**
   2212          * Store a name/value pair into the database.
   2213          * @param resolver to access the database with
   2214          * @param name to store
   2215          * @param value to associate with the name
   2216          * @return true if the value was set, false on database errors
   2217          */
   2218         public static boolean putString(ContentResolver resolver, String name, String value) {
   2219             return putStringForUser(resolver, name, value, UserHandle.myUserId());
   2220         }
   2221 
   2222         /** @hide */
   2223         public static boolean putStringForUser(ContentResolver resolver, String name, String value,
   2224                 int userHandle) {
   2225             if (MOVED_TO_SECURE.contains(name)) {
   2226                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2227                         + " to android.provider.Settings.Secure, value is unchanged.");
   2228                 return false;
   2229             }
   2230             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
   2231                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2232                         + " to android.provider.Settings.Global, value is unchanged.");
   2233                 return false;
   2234             }
   2235             return sNameValueCache.putStringForUser(resolver, name, value, null, false, userHandle);
   2236         }
   2237 
   2238         /**
   2239          * Construct the content URI for a particular name/value pair,
   2240          * useful for monitoring changes with a ContentObserver.
   2241          * @param name to look up in the table
   2242          * @return the corresponding content URI, or null if not present
   2243          */
   2244         public static Uri getUriFor(String name) {
   2245             if (MOVED_TO_SECURE.contains(name)) {
   2246                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2247                     + " to android.provider.Settings.Secure, returning Secure URI.");
   2248                 return Secure.getUriFor(Secure.CONTENT_URI, name);
   2249             }
   2250             if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
   2251                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
   2252                         + " to android.provider.Settings.Global, returning read-only global URI.");
   2253                 return Global.getUriFor(Global.CONTENT_URI, name);
   2254             }
   2255             return getUriFor(CONTENT_URI, name);
   2256         }
   2257 
   2258         /**
   2259          * Convenience function for retrieving a single system settings value
   2260          * as an integer.  Note that internally setting values are always
   2261          * stored as strings; this function converts the string to an integer
   2262          * for you.  The default value will be returned if the setting is
   2263          * not defined or not an integer.
   2264          *
   2265          * @param cr The ContentResolver to access.
   2266          * @param name The name of the setting to retrieve.
   2267          * @param def Value to return if the setting is not defined.
   2268          *
   2269          * @return The setting's current value, or 'def' if it is not defined
   2270          * or not a valid integer.
   2271          */
   2272         public static int getInt(ContentResolver cr, String name, int def) {
   2273             return getIntForUser(cr, name, def, UserHandle.myUserId());
   2274         }
   2275 
   2276         /** @hide */
   2277         public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
   2278             String v = getStringForUser(cr, name, userHandle);
   2279             try {
   2280                 return v != null ? Integer.parseInt(v) : def;
   2281             } catch (NumberFormatException e) {
   2282                 return def;
   2283             }
   2284         }
   2285 
   2286         /**
   2287          * Convenience function for retrieving a single system settings value
   2288          * as an integer.  Note that internally setting values are always
   2289          * stored as strings; this function converts the string to an integer
   2290          * for you.
   2291          * <p>
   2292          * This version does not take a default value.  If the setting has not
   2293          * been set, or the string value is not a number,
   2294          * it throws {@link SettingNotFoundException}.
   2295          *
   2296          * @param cr The ContentResolver to access.
   2297          * @param name The name of the setting to retrieve.
   2298          *
   2299          * @throws SettingNotFoundException Thrown if a setting by the given
   2300          * name can't be found or the setting value is not an integer.
   2301          *
   2302          * @return The setting's current value.
   2303          */
   2304         public static int getInt(ContentResolver cr, String name)
   2305                 throws SettingNotFoundException {
   2306             return getIntForUser(cr, name, UserHandle.myUserId());
   2307         }
   2308 
   2309         /** @hide */
   2310         public static int getIntForUser(ContentResolver cr, String name, int userHandle)
   2311                 throws SettingNotFoundException {
   2312             String v = getStringForUser(cr, name, userHandle);
   2313             try {
   2314                 return Integer.parseInt(v);
   2315             } catch (NumberFormatException e) {
   2316                 throw new SettingNotFoundException(name);
   2317             }
   2318         }
   2319 
   2320         /**
   2321          * Convenience function for updating a single settings value as an
   2322          * integer. This will either create a new entry in the table if the
   2323          * given name does not exist, or modify the value of the existing row
   2324          * with that name.  Note that internally setting values are always
   2325          * stored as strings, so this function converts the given value to a
   2326          * string before storing it.
   2327          *
   2328          * @param cr The ContentResolver to access.
   2329          * @param name The name of the setting to modify.
   2330          * @param value The new value for the setting.
   2331          * @return true if the value was set, false on database errors
   2332          */
   2333         public static boolean putInt(ContentResolver cr, String name, int value) {
   2334             return putIntForUser(cr, name, value, UserHandle.myUserId());
   2335         }
   2336 
   2337         /** @hide */
   2338         public static boolean putIntForUser(ContentResolver cr, String name, int value,
   2339                 int userHandle) {
   2340             return putStringForUser(cr, name, Integer.toString(value), userHandle);
   2341         }
   2342 
   2343         /**
   2344          * Convenience function for retrieving a single system settings value
   2345          * as a {@code long}.  Note that internally setting values are always
   2346          * stored as strings; this function converts the string to a {@code long}
   2347          * for you.  The default value will be returned if the setting is
   2348          * not defined or not a {@code long}.
   2349          *
   2350          * @param cr The ContentResolver to access.
   2351          * @param name The name of the setting to retrieve.
   2352          * @param def Value to return if the setting is not defined.
   2353          *
   2354          * @return The setting's current value, or 'def' if it is not defined
   2355          * or not a valid {@code long}.
   2356          */
   2357         public static long getLong(ContentResolver cr, String name, long def) {
   2358             return getLongForUser(cr, name, def, UserHandle.myUserId());
   2359         }
   2360 
   2361         /** @hide */
   2362         public static long getLongForUser(ContentResolver cr, String name, long def,
   2363                 int userHandle) {
   2364             String valString = getStringForUser(cr, name, userHandle);
   2365             long value;
   2366             try {
   2367                 value = valString != null ? Long.parseLong(valString) : def;
   2368             } catch (NumberFormatException e) {
   2369                 value = def;
   2370             }
   2371             return value;
   2372         }
   2373 
   2374         /**
   2375          * Convenience function for retrieving a single system settings value
   2376          * as a {@code long}.  Note that internally setting values are always
   2377          * stored as strings; this function converts the string to a {@code long}
   2378          * for you.
   2379          * <p>
   2380          * This version does not take a default value.  If the setting has not
   2381          * been set, or the string value is not a number,
   2382          * it throws {@link SettingNotFoundException}.
   2383          *
   2384          * @param cr The ContentResolver to access.
   2385          * @param name The name of the setting to retrieve.
   2386          *
   2387          * @return The setting's current value.
   2388          * @throws SettingNotFoundException Thrown if a setting by the given
   2389          * name can't be found or the setting value is not an integer.
   2390          */
   2391         public static long getLong(ContentResolver cr, String name)
   2392                 throws SettingNotFoundException {
   2393             return getLongForUser(cr, name, UserHandle.myUserId());
   2394         }
   2395 
   2396         /** @hide */
   2397         public static long getLongForUser(ContentResolver cr, String name, int userHandle)
   2398                 throws SettingNotFoundException {
   2399             String valString = getStringForUser(cr, name, userHandle);
   2400             try {
   2401                 return Long.parseLong(valString);
   2402             } catch (NumberFormatException e) {
   2403                 throw new SettingNotFoundException(name);
   2404             }
   2405         }
   2406 
   2407         /**
   2408          * Convenience function for updating a single settings value as a long
   2409          * integer. This will either create a new entry in the table if the
   2410          * given name does not exist, or modify the value of the existing row
   2411          * with that name.  Note that internally setting values are always
   2412          * stored as strings, so this function converts the given value to a
   2413          * string before storing it.
   2414          *
   2415          * @param cr The ContentResolver to access.
   2416          * @param name The name of the setting to modify.
   2417          * @param value The new value for the setting.
   2418          * @return true if the value was set, false on database errors
   2419          */
   2420         public static boolean putLong(ContentResolver cr, String name, long value) {
   2421             return putLongForUser(cr, name, value, UserHandle.myUserId());
   2422         }
   2423 
   2424         /** @hide */
   2425         public static boolean putLongForUser(ContentResolver cr, String name, long value,
   2426                 int userHandle) {
   2427             return putStringForUser(cr, name, Long.toString(value), userHandle);
   2428         }
   2429 
   2430         /**
   2431          * Convenience function for retrieving a single system settings value
   2432          * as a floating point number.  Note that internally setting values are
   2433          * always stored as strings; this function converts the string to an
   2434          * float for you. The default value will be returned if the setting
   2435          * is not defined or not a valid float.
   2436          *
   2437          * @param cr The ContentResolver to access.
   2438          * @param name The name of the setting to retrieve.
   2439          * @param def Value to return if the setting is not defined.
   2440          *
   2441          * @return The setting's current value, or 'def' if it is not defined
   2442          * or not a valid float.
   2443          */
   2444         public static float getFloat(ContentResolver cr, String name, float def) {
   2445             return getFloatForUser(cr, name, def, UserHandle.myUserId());
   2446         }
   2447 
   2448         /** @hide */
   2449         public static float getFloatForUser(ContentResolver cr, String name, float def,
   2450                 int userHandle) {
   2451             String v = getStringForUser(cr, name, userHandle);
   2452             try {
   2453                 return v != null ? Float.parseFloat(v) : def;
   2454             } catch (NumberFormatException e) {
   2455                 return def;
   2456             }
   2457         }
   2458 
   2459         /**
   2460          * Convenience function for retrieving a single system settings value
   2461          * as a float.  Note that internally setting values are always
   2462          * stored as strings; this function converts the string to a float
   2463          * for you.
   2464          * <p>
   2465          * This version does not take a default value.  If the setting has not
   2466          * been set, or the string value is not a number,
   2467          * it throws {@link SettingNotFoundException}.
   2468          *
   2469          * @param cr The ContentResolver to access.
   2470          * @param name The name of the setting to retrieve.
   2471          *
   2472          * @throws SettingNotFoundException Thrown if a setting by the given
   2473          * name can't be found or the setting value is not a float.
   2474          *
   2475          * @return The setting's current value.
   2476          */
   2477         public static float getFloat(ContentResolver cr, String name)
   2478                 throws SettingNotFoundException {
   2479             return getFloatForUser(cr, name, UserHandle.myUserId());
   2480         }
   2481 
   2482         /** @hide */
   2483         public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
   2484                 throws SettingNotFoundException {
   2485             String v = getStringForUser(cr, name, userHandle);
   2486             if (v == null) {
   2487                 throw new SettingNotFoundException(name);
   2488             }
   2489             try {
   2490                 return Float.parseFloat(v);
   2491             } catch (NumberFormatException e) {
   2492                 throw new SettingNotFoundException(name);
   2493             }
   2494         }
   2495 
   2496         /**
   2497          * Convenience function for updating a single settings value as a
   2498          * floating point number. This will either create a new entry in the
   2499          * table if the given name does not exist, or modify the value of the
   2500          * existing row with that name.  Note that internally setting values
   2501          * are always stored as strings, so this function converts the given
   2502          * value to a string before storing it.
   2503          *
   2504          * @param cr The ContentResolver to access.
   2505          * @param name The name of the setting to modify.
   2506          * @param value The new value for the setting.
   2507          * @return true if the value was set, false on database errors
   2508          */
   2509         public static boolean putFloat(ContentResolver cr, String name, float value) {
   2510             return putFloatForUser(cr, name, value, UserHandle.myUserId());
   2511         }
   2512 
   2513         /** @hide */
   2514         public static boolean putFloatForUser(ContentResolver cr, String name, float value,
   2515                 int userHandle) {
   2516             return putStringForUser(cr, name, Float.toString(value), userHandle);
   2517         }
   2518 
   2519         /**
   2520          * Convenience function to read all of the current
   2521          * configuration-related settings into a
   2522          * {@link Configuration} object.
   2523          *
   2524          * @param cr The ContentResolver to access.
   2525          * @param outConfig Where to place the configuration settings.
   2526          */
   2527         public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
   2528             adjustConfigurationForUser(cr, outConfig, UserHandle.myUserId(),
   2529                     false /* updateSettingsIfEmpty */);
   2530         }
   2531 
   2532         /** @hide */
   2533         public static void adjustConfigurationForUser(ContentResolver cr, Configuration outConfig,
   2534                 int userHandle, boolean updateSettingsIfEmpty) {
   2535             outConfig.fontScale = Settings.System.getFloatForUser(
   2536                     cr, FONT_SCALE, DEFAULT_FONT_SCALE, userHandle);
   2537             if (outConfig.fontScale < 0) {
   2538                 outConfig.fontScale = DEFAULT_FONT_SCALE;
   2539             }
   2540 
   2541             final String localeValue =
   2542                     Settings.System.getStringForUser(cr, SYSTEM_LOCALES, userHandle);
   2543             if (localeValue != null) {
   2544                 outConfig.setLocales(LocaleList.forLanguageTags(localeValue));
   2545             } else {
   2546                 // Do not update configuration with emtpy settings since we need to take over the
   2547                 // locale list of previous user if the settings value is empty. This happens when a
   2548                 // new user is created.
   2549 
   2550                 if (updateSettingsIfEmpty) {
   2551                     // Make current configuration persistent. This is necessary the first time a
   2552                     // user log in. At the first login, the configuration settings are empty, so we
   2553                     // need to store the adjusted configuration as the initial settings.
   2554                     Settings.System.putStringForUser(
   2555                             cr, SYSTEM_LOCALES, outConfig.getLocales().toLanguageTags(),
   2556                             userHandle);
   2557                 }
   2558             }
   2559         }
   2560 
   2561         /**
   2562          * @hide Erase the fields in the Configuration that should be applied
   2563          * by the settings.
   2564          */
   2565         public static void clearConfiguration(Configuration inoutConfig) {
   2566             inoutConfig.fontScale = 0;
   2567             if (!inoutConfig.userSetLocale && !inoutConfig.getLocales().isEmpty()) {
   2568                 inoutConfig.clearLocales();
   2569             }
   2570         }
   2571 
   2572         /**
   2573          * Convenience function to write a batch of configuration-related
   2574          * settings from a {@link Configuration} object.
   2575          *
   2576          * @param cr The ContentResolver to access.
   2577          * @param config The settings to write.
   2578          * @return true if the values were set, false on database errors
   2579          */
   2580         public static boolean putConfiguration(ContentResolver cr, Configuration config) {
   2581             return putConfigurationForUser(cr, config, UserHandle.myUserId());
   2582         }
   2583 
   2584         /** @hide */
   2585         public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
   2586                 int userHandle) {
   2587             return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle) &&
   2588                     Settings.System.putStringForUser(
   2589                             cr, SYSTEM_LOCALES, config.getLocales().toLanguageTags(), userHandle);
   2590         }
   2591 
   2592         /** @hide */
   2593         public static boolean hasInterestingConfigurationChanges(int changes) {
   2594             return (changes & ActivityInfo.CONFIG_FONT_SCALE) != 0 ||
   2595                     (changes & ActivityInfo.CONFIG_LOCALE) != 0;
   2596         }
   2597 
   2598         /** @deprecated - Do not use */
   2599         @Deprecated
   2600         public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
   2601             return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId());
   2602         }
   2603 
   2604         /**
   2605          * @hide
   2606          * @deprecated - Do not use
   2607          */
   2608         @Deprecated
   2609         public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
   2610                 int userHandle) {
   2611             return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
   2612         }
   2613 
   2614         /** @deprecated - Do not use */
   2615         @Deprecated
   2616         public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
   2617             setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId());
   2618         }
   2619 
   2620         /**
   2621          * @hide
   2622          * @deprecated - Do not use
   2623          */
   2624         @Deprecated
   2625         public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
   2626                 int userHandle) {
   2627             putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
   2628         }
   2629 
   2630         private static final class DiscreteValueValidator implements Validator {
   2631             private final String[] mValues;
   2632 
   2633             public DiscreteValueValidator(String[] values) {
   2634                 mValues = values;
   2635             }
   2636 
   2637             @Override
   2638             public boolean validate(String value) {
   2639                 return ArrayUtils.contains(mValues, value);
   2640             }
   2641         }
   2642 
   2643         private static final class InclusiveIntegerRangeValidator implements Validator {
   2644             private final int mMin;
   2645             private final int mMax;
   2646 
   2647             public InclusiveIntegerRangeValidator(int min, int max) {
   2648                 mMin = min;
   2649                 mMax = max;
   2650             }
   2651 
   2652             @Override
   2653             public boolean validate(String value) {
   2654                 try {
   2655                     final int intValue = Integer.parseInt(value);
   2656                     return intValue >= mMin && intValue <= mMax;
   2657                 } catch (NumberFormatException e) {
   2658                     return false;
   2659                 }
   2660             }
   2661         }
   2662 
   2663         private static final class InclusiveFloatRangeValidator implements Validator {
   2664             private final float mMin;
   2665             private final float mMax;
   2666 
   2667             public InclusiveFloatRangeValidator(float min, float max) {
   2668                 mMin = min;
   2669                 mMax = max;
   2670             }
   2671 
   2672             @Override
   2673             public boolean validate(String value) {
   2674                 try {
   2675                     final float floatValue = Float.parseFloat(value);
   2676                     return floatValue >= mMin && floatValue <= mMax;
   2677                 } catch (NumberFormatException e) {
   2678                     return false;
   2679                 }
   2680             }
   2681         }
   2682 
   2683         /**
   2684          * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
   2685          */
   2686         @Deprecated
   2687         public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
   2688 
   2689         /**
   2690          * What happens when the user presses the end call button if they're not
   2691          * on a call.<br/>
   2692          * <b>Values:</b><br/>
   2693          * 0 - The end button does nothing.<br/>
   2694          * 1 - The end button goes to the home screen.<br/>
   2695          * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
   2696          * 3 - The end button goes to the home screen.  If the user is already on the
   2697          * home screen, it puts the device to sleep.
   2698          */
   2699         public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
   2700 
   2701         private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR =
   2702                 new InclusiveIntegerRangeValidator(0, 3);
   2703 
   2704         /**
   2705          * END_BUTTON_BEHAVIOR value for "go home".
   2706          * @hide
   2707          */
   2708         public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
   2709 
   2710         /**
   2711          * END_BUTTON_BEHAVIOR value for "go to sleep".
   2712          * @hide
   2713          */
   2714         public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
   2715 
   2716         /**
   2717          * END_BUTTON_BEHAVIOR default value.
   2718          * @hide
   2719          */
   2720         public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
   2721 
   2722         /**
   2723          * Is advanced settings mode turned on. 0 == no, 1 == yes
   2724          * @hide
   2725          */
   2726         public static final String ADVANCED_SETTINGS = "advanced_settings";
   2727 
   2728         private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator;
   2729 
   2730         /**
   2731          * ADVANCED_SETTINGS default value.
   2732          * @hide
   2733          */
   2734         public static final int ADVANCED_SETTINGS_DEFAULT = 0;
   2735 
   2736         /**
   2737          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
   2738          */
   2739         @Deprecated
   2740         public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
   2741 
   2742         /**
   2743          * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
   2744          */
   2745         @Deprecated
   2746         public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
   2747 
   2748         /**
   2749          * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
   2750          */
   2751         @Deprecated
   2752         public static final String RADIO_WIFI = Global.RADIO_WIFI;
   2753 
   2754         /**
   2755          * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
   2756          * {@hide}
   2757          */
   2758         @Deprecated
   2759         public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
   2760 
   2761         /**
   2762          * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
   2763          */
   2764         @Deprecated
   2765         public static final String RADIO_CELL = Global.RADIO_CELL;
   2766 
   2767         /**
   2768          * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
   2769          */
   2770         @Deprecated
   2771         public static final String RADIO_NFC = Global.RADIO_NFC;
   2772 
   2773         /**
   2774          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
   2775          */
   2776         @Deprecated
   2777         public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
   2778 
   2779         /**
   2780          * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
   2781          *
   2782          * {@hide}
   2783          */
   2784         @Deprecated
   2785         public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
   2786                 Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
   2787 
   2788         /**
   2789          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
   2790          */
   2791         @Deprecated
   2792         public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
   2793 
   2794         /**
   2795          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
   2796          */
   2797         @Deprecated
   2798         public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
   2799 
   2800         /**
   2801          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
   2802          */
   2803         @Deprecated
   2804         public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
   2805                 Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
   2806 
   2807         /**
   2808          * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
   2809          */
   2810         @Deprecated
   2811         public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
   2812 
   2813         /**
   2814          * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
   2815          */
   2816         @Deprecated
   2817         public static final String MODE_RINGER = Global.MODE_RINGER;
   2818 
   2819         /**
   2820          * Whether to use static IP and other static network attributes.
   2821          * <p>
   2822          * Set to 1 for true and 0 for false.
   2823          *
   2824          * @deprecated Use {@link WifiManager} instead
   2825          */
   2826         @Deprecated
   2827         public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
   2828 
   2829         private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator;
   2830 
   2831         /**
   2832          * The static IP address.
   2833          * <p>
   2834          * Example: "192.168.1.51"
   2835          *
   2836          * @deprecated Use {@link WifiManager} instead
   2837          */
   2838         @Deprecated
   2839         public static final String WIFI_STATIC_IP = "wifi_static_ip";
   2840 
   2841         private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator;
   2842 
   2843         /**
   2844          * If using static IP, the gateway's IP address.
   2845          * <p>
   2846          * Example: "192.168.1.1"
   2847          *
   2848          * @deprecated Use {@link WifiManager} instead
   2849          */
   2850         @Deprecated
   2851         public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
   2852 
   2853         private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator;
   2854 
   2855         /**
   2856          * If using static IP, the net mask.
   2857          * <p>
   2858          * Example: "255.255.255.0"
   2859          *
   2860          * @deprecated Use {@link WifiManager} instead
   2861          */
   2862         @Deprecated
   2863         public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
   2864 
   2865         private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator;
   2866 
   2867         /**
   2868          * If using static IP, the primary DNS's IP address.
   2869          * <p>
   2870          * Example: "192.168.1.1"
   2871          *
   2872          * @deprecated Use {@link WifiManager} instead
   2873          */
   2874         @Deprecated
   2875         public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
   2876 
   2877         private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator;
   2878 
   2879         /**
   2880          * If using static IP, the secondary DNS's IP address.
   2881          * <p>
   2882          * Example: "192.168.1.2"
   2883          *
   2884          * @deprecated Use {@link WifiManager} instead
   2885          */
   2886         @Deprecated
   2887         public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
   2888 
   2889         private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator;
   2890 
   2891         /**
   2892          * Determines whether remote devices may discover and/or connect to
   2893          * this device.
   2894          * <P>Type: INT</P>
   2895          * 2 -- discoverable and connectable
   2896          * 1 -- connectable but not discoverable
   2897          * 0 -- neither connectable nor discoverable
   2898          */
   2899         public static final String BLUETOOTH_DISCOVERABILITY =
   2900             "bluetooth_discoverability";
   2901 
   2902         private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR =
   2903                 new InclusiveIntegerRangeValidator(0, 2);
   2904 
   2905         /**
   2906          * Bluetooth discoverability timeout.  If this value is nonzero, then
   2907          * Bluetooth becomes discoverable for a certain number of seconds,
   2908          * after which is becomes simply connectable.  The value is in seconds.
   2909          */
   2910         public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
   2911             "bluetooth_discoverability_timeout";
   2912 
   2913         private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR =
   2914                 sNonNegativeIntegerValidator;
   2915 
   2916         /**
   2917          * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
   2918          * instead
   2919          */
   2920         @Deprecated
   2921         public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
   2922 
   2923         /**
   2924          * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
   2925          * instead
   2926          */
   2927         @Deprecated
   2928         public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
   2929 
   2930         /**
   2931          * @deprecated Use
   2932          * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
   2933          * instead
   2934          */
   2935         @Deprecated
   2936         public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
   2937             "lock_pattern_tactile_feedback_enabled";
   2938 
   2939         /**
   2940          * A formatted string of the next alarm that is set, or the empty string
   2941          * if there is no alarm set.
   2942          *
   2943          * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}.
   2944          */
   2945         @Deprecated
   2946         public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
   2947 
   2948         private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() {
   2949             private static final int MAX_LENGTH = 1000;
   2950 
   2951             @Override
   2952             public boolean validate(String value) {
   2953                 // TODO: No idea what the correct format is.
   2954                 return value == null || value.length() < MAX_LENGTH;
   2955             }
   2956         };
   2957 
   2958         /**
   2959          * Scaling factor for fonts, float.
   2960          */
   2961         public static final String FONT_SCALE = "font_scale";
   2962 
   2963         private static final Validator FONT_SCALE_VALIDATOR = new Validator() {
   2964             @Override
   2965             public boolean validate(String value) {
   2966                 try {
   2967                     return Float.parseFloat(value) >= 0;
   2968                 } catch (NumberFormatException e) {
   2969                     return false;
   2970                 }
   2971             }
   2972         };
   2973 
   2974         /**
   2975          * The serialized system locale value.
   2976          *
   2977          * Do not use this value directory.
   2978          * To get system locale, use {@link LocaleList#getDefault} instead.
   2979          * To update system locale, use {@link com.android.internal.app.LocalePicker#updateLocales}
   2980          * instead.
   2981          * @hide
   2982          */
   2983         public static final String SYSTEM_LOCALES = "system_locales";
   2984 
   2985 
   2986         /**
   2987          * Name of an application package to be debugged.
   2988          *
   2989          * @deprecated Use {@link Global#DEBUG_APP} instead
   2990          */
   2991         @Deprecated
   2992         public static final String DEBUG_APP = Global.DEBUG_APP;
   2993 
   2994         /**
   2995          * If 1, when launching DEBUG_APP it will wait for the debugger before
   2996          * starting user code.  If 0, it will run normally.
   2997          *
   2998          * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
   2999          */
   3000         @Deprecated
   3001         public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
   3002 
   3003         /**
   3004          * Whether or not to dim the screen. 0=no  1=yes
   3005          * @deprecated This setting is no longer used.
   3006          */
   3007         @Deprecated
   3008         public static final String DIM_SCREEN = "dim_screen";
   3009 
   3010         private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator;
   3011 
   3012         /**
   3013          * The amount of time in milliseconds before the device goes to sleep or begins
   3014          * to dream after a period of inactivity.  This value is also known as the
   3015          * user activity timeout period since the screen isn't necessarily turned off
   3016          * when it expires.
   3017          */
   3018         public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
   3019 
   3020         private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator;
   3021 
   3022         /**
   3023          * The screen backlight brightness between 0 and 255.
   3024          */
   3025         public static final String SCREEN_BRIGHTNESS = "screen_brightness";
   3026 
   3027         private static final Validator SCREEN_BRIGHTNESS_VALIDATOR =
   3028                 new InclusiveIntegerRangeValidator(0, 255);
   3029 
   3030         /**
   3031          * The screen backlight brightness between 0 and 255.
   3032          * @hide
   3033          */
   3034         public static final String SCREEN_BRIGHTNESS_FOR_VR = "screen_brightness_for_vr";
   3035 
   3036         private static final Validator SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR =
   3037                 new InclusiveIntegerRangeValidator(0, 255);
   3038 
   3039         /**
   3040          * Control whether to enable automatic brightness mode.
   3041          */
   3042         public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
   3043 
   3044         private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator;
   3045 
   3046         /**
   3047          * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
   3048          * or less (<0.0 >-1.0) bright.
   3049          * @hide
   3050          */
   3051         public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
   3052 
   3053         private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR =
   3054                 new InclusiveFloatRangeValidator(-1, 1);
   3055 
   3056         /**
   3057          * SCREEN_BRIGHTNESS_MODE value for manual mode.
   3058          */
   3059         public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
   3060 
   3061         /**
   3062          * SCREEN_BRIGHTNESS_MODE value for automatic mode.
   3063          */
   3064         public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
   3065 
   3066         /**
   3067          * Control whether the process CPU usage meter should be shown.
   3068          *
   3069          * @deprecated This functionality is no longer available as of
   3070          * {@link android.os.Build.VERSION_CODES#N_MR1}.
   3071          */
   3072         @Deprecated
   3073         public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
   3074 
   3075         /**
   3076          * If 1, the activity manager will aggressively finish activities and
   3077          * processes as soon as they are no longer needed.  If 0, the normal
   3078          * extended lifetime is used.
   3079          *
   3080          * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
   3081          */
   3082         @Deprecated
   3083         public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
   3084 
   3085         /**
   3086          * Determines which streams are affected by ringer mode changes. The
   3087          * stream type's bit should be set to 1 if it should be muted when going
   3088          * into an inaudible ringer mode.
   3089          */
   3090         public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
   3091 
   3092         private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR =
   3093                 sNonNegativeIntegerValidator;
   3094 
   3095         /**
   3096           * Determines which streams are affected by mute. The
   3097           * stream type's bit should be set to 1 if it should be muted when a mute request
   3098           * is received.
   3099           */
   3100         public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
   3101 
   3102         private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR =
   3103                 sNonNegativeIntegerValidator;
   3104 
   3105         /**
   3106          * Whether vibrate is on for different events. This is used internally,
   3107          * changing this value will not change the vibrate. See AudioManager.
   3108          */
   3109         public static final String VIBRATE_ON = "vibrate_on";
   3110 
   3111         private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator;
   3112 
   3113         /**
   3114          * If 1, redirects the system vibrator to all currently attached input devices
   3115          * that support vibration.  If there are no such input devices, then the system
   3116          * vibrator is used instead.
   3117          * If 0, does not register the system vibrator.
   3118          *
   3119          * This setting is mainly intended to provide a compatibility mechanism for
   3120          * applications that only know about the system vibrator and do not use the
   3121          * input device vibrator API.
   3122          *
   3123          * @hide
   3124          */
   3125         public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
   3126 
   3127         private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator;
   3128 
   3129         /**
   3130          * Ringer volume. This is used internally, changing this value will not
   3131          * change the volume. See AudioManager.
   3132          *
   3133          * @removed Not used by anything since API 2.
   3134          */
   3135         public static final String VOLUME_RING = "volume_ring";
   3136 
   3137         /**
   3138          * System/notifications volume. This is used internally, changing this
   3139          * value will not change the volume. See AudioManager.
   3140          *
   3141          * @removed Not used by anything since API 2.
   3142          */
   3143         public static final String VOLUME_SYSTEM = "volume_system";
   3144 
   3145         /**
   3146          * Voice call volume. This is used internally, changing this value will
   3147          * not change the volume. See AudioManager.
   3148          *
   3149          * @removed Not used by anything since API 2.
   3150          */
   3151         public static final String VOLUME_VOICE = "volume_voice";
   3152 
   3153         /**
   3154          * Music/media/gaming volume. This is used internally, changing this
   3155          * value will not change the volume. See AudioManager.
   3156          *
   3157          * @removed Not used by anything since API 2.
   3158          */
   3159         public static final String VOLUME_MUSIC = "volume_music";
   3160 
   3161         /**
   3162          * Alarm volume. This is used internally, changing this
   3163          * value will not change the volume. See AudioManager.
   3164          *
   3165          * @removed Not used by anything since API 2.
   3166          */
   3167         public static final String VOLUME_ALARM = "volume_alarm";
   3168 
   3169         /**
   3170          * Notification volume. This is used internally, changing this
   3171          * value will not change the volume. See AudioManager.
   3172          *
   3173          * @removed Not used by anything since API 2.
   3174          */
   3175         public static final String VOLUME_NOTIFICATION = "volume_notification";
   3176 
   3177         /**
   3178          * Bluetooth Headset volume. This is used internally, changing this value will
   3179          * not change the volume. See AudioManager.
   3180          *
   3181          * @removed Not used by anything since API 2.
   3182          */
   3183         public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
   3184 
   3185         /**
   3186          * @hide
   3187          * Acessibility volume. This is used internally, changing this
   3188          * value will not change the volume.
   3189          */
   3190         public static final String VOLUME_ACCESSIBILITY = "volume_a11y";
   3191 
   3192         /**
   3193          * Master volume (float in the range 0.0f to 1.0f).
   3194          *
   3195          * @hide
   3196          */
   3197         public static final String VOLUME_MASTER = "volume_master";
   3198 
   3199         /**
   3200          * Master mono (int 1 = mono, 0 = normal).
   3201          *
   3202          * @hide
   3203          */
   3204         public static final String MASTER_MONO = "master_mono";
   3205 
   3206         private static final Validator MASTER_MONO_VALIDATOR = sBooleanValidator;
   3207 
   3208         /**
   3209          * Whether the notifications should use the ring volume (value of 1) or
   3210          * a separate notification volume (value of 0). In most cases, users
   3211          * will have this enabled so the notification and ringer volumes will be
   3212          * the same. However, power users can disable this and use the separate
   3213          * notification volume control.
   3214          * <p>
   3215          * Note: This is a one-off setting that will be removed in the future
   3216          * when there is profile support. For this reason, it is kept hidden
   3217          * from the public APIs.
   3218          *
   3219          * @hide
   3220          * @deprecated
   3221          */
   3222         @Deprecated
   3223         public static final String NOTIFICATIONS_USE_RING_VOLUME =
   3224             "notifications_use_ring_volume";
   3225 
   3226         private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator;
   3227 
   3228         /**
   3229          * Whether silent mode should allow vibration feedback. This is used
   3230          * internally in AudioService and the Sound settings activity to
   3231          * coordinate decoupling of vibrate and silent modes. This setting
   3232          * will likely be removed in a future release with support for
   3233          * audio/vibe feedback profiles.
   3234          *
   3235          * Not used anymore. On devices with vibrator, the user explicitly selects
   3236          * silent or vibrate mode.
   3237          * Kept for use by legacy database upgrade code in DatabaseHelper.
   3238          * @hide
   3239          */
   3240         public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
   3241 
   3242         private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator;
   3243 
   3244         /**
   3245          * The mapping of stream type (integer) to its setting.
   3246          *
   3247          * @removed  Not used by anything since API 2.
   3248          */
   3249         public static final String[] VOLUME_SETTINGS = {
   3250             VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
   3251             VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
   3252         };
   3253 
   3254         /**
   3255          * @hide
   3256          * The mapping of stream type (integer) to its setting.
   3257          * Unlike the VOLUME_SETTINGS array, this one contains as many entries as
   3258          * AudioSystem.NUM_STREAM_TYPES, and has empty strings for stream types whose volumes
   3259          * are never persisted.
   3260          */
   3261         public static final String[] VOLUME_SETTINGS_INT = {
   3262                 VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
   3263                 VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO,
   3264                 "" /*STREAM_SYSTEM_ENFORCED, no setting for this stream*/,
   3265                 "" /*STREAM_DTMF, no setting for this stream*/,
   3266                 "" /*STREAM_TTS, no setting for this stream*/,
   3267                 VOLUME_ACCESSIBILITY
   3268             };
   3269 
   3270         /**
   3271          * Appended to various volume related settings to record the previous
   3272          * values before they the settings were affected by a silent/vibrate
   3273          * ringer mode change.
   3274          *
   3275          * @removed  Not used by anything since API 2.
   3276          */
   3277         public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
   3278 
   3279         /**
   3280          * Persistent store for the system-wide default ringtone URI.
   3281          * <p>
   3282          * If you need to play the default ringtone at any given time, it is recommended
   3283          * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
   3284          * to the set default ringtone at the time of playing.
   3285          *
   3286          * @see #DEFAULT_RINGTONE_URI
   3287          */
   3288         public static final String RINGTONE = "ringtone";
   3289 
   3290         private static final Validator RINGTONE_VALIDATOR = sUriValidator;
   3291 
   3292         /**
   3293          * A {@link Uri} that will point to the current default ringtone at any
   3294          * given time.
   3295          * <p>
   3296          * If the current default ringtone is in the DRM provider and the caller
   3297          * does not have permission, the exception will be a
   3298          * FileNotFoundException.
   3299          */
   3300         public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
   3301 
   3302         /** {@hide} */
   3303         public static final String RINGTONE_CACHE = "ringtone_cache";
   3304         /** {@hide} */
   3305         public static final Uri RINGTONE_CACHE_URI = getUriFor(RINGTONE_CACHE);
   3306 
   3307         /**
   3308          * Persistent store for the system-wide default notification sound.
   3309          *
   3310          * @see #RINGTONE
   3311          * @see #DEFAULT_NOTIFICATION_URI
   3312          */
   3313         public static final String NOTIFICATION_SOUND = "notification_sound";
   3314 
   3315         private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator;
   3316 
   3317         /**
   3318          * A {@link Uri} that will point to the current default notification
   3319          * sound at any given time.
   3320          *
   3321          * @see #DEFAULT_RINGTONE_URI
   3322          */
   3323         public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
   3324 
   3325         /** {@hide} */
   3326         public static final String NOTIFICATION_SOUND_CACHE = "notification_sound_cache";
   3327         /** {@hide} */
   3328         public static final Uri NOTIFICATION_SOUND_CACHE_URI = getUriFor(NOTIFICATION_SOUND_CACHE);
   3329 
   3330         /**
   3331          * Persistent store for the system-wide default alarm alert.
   3332          *
   3333          * @see #RINGTONE
   3334          * @see #DEFAULT_ALARM_ALERT_URI
   3335          */
   3336         public static final String ALARM_ALERT = "alarm_alert";
   3337 
   3338         private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator;
   3339 
   3340         /**
   3341          * A {@link Uri} that will point to the current default alarm alert at
   3342          * any given time.
   3343          *
   3344          * @see #DEFAULT_ALARM_ALERT_URI
   3345          */
   3346         public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
   3347 
   3348         /** {@hide} */
   3349         public static final String ALARM_ALERT_CACHE = "alarm_alert_cache";
   3350         /** {@hide} */
   3351         public static final Uri ALARM_ALERT_CACHE_URI = getUriFor(ALARM_ALERT_CACHE);
   3352 
   3353         /**
   3354          * Persistent store for the system default media button event receiver.
   3355          *
   3356          * @hide
   3357          */
   3358         public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
   3359 
   3360         private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() {
   3361             @Override
   3362             public boolean validate(String value) {
   3363                 try {
   3364                     ComponentName.unflattenFromString(value);
   3365                     return true;
   3366                 } catch (NullPointerException e) {
   3367                     return false;
   3368                 }
   3369             }
   3370         };
   3371 
   3372         /**
   3373          * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
   3374          */
   3375         public static final String TEXT_AUTO_REPLACE = "auto_replace";
   3376 
   3377         private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator;
   3378 
   3379         /**
   3380          * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
   3381          */
   3382         public static final String TEXT_AUTO_CAPS = "auto_caps";
   3383 
   3384         private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator;
   3385 
   3386         /**
   3387          * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
   3388          * feature converts two spaces to a "." and space.
   3389          */
   3390         public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
   3391 
   3392         private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator;
   3393 
   3394         /**
   3395          * Setting to showing password characters in text editors. 1 = On, 0 = Off
   3396          */
   3397         public static final String TEXT_SHOW_PASSWORD = "show_password";
   3398 
   3399         private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator;
   3400 
   3401         public static final String SHOW_GTALK_SERVICE_STATUS =
   3402                 "SHOW_GTALK_SERVICE_STATUS";
   3403 
   3404         private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator;
   3405 
   3406         /**
   3407          * Name of activity to use for wallpaper on the home screen.
   3408          *
   3409          * @deprecated Use {@link WallpaperManager} instead.
   3410          */
   3411         @Deprecated
   3412         public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
   3413 
   3414         private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() {
   3415             private static final int MAX_LENGTH = 1000;
   3416 
   3417             @Override
   3418             public boolean validate(String value) {
   3419                 if (value != null && value.length() > MAX_LENGTH) {
   3420                     return false;
   3421                 }
   3422                 return ComponentName.unflattenFromString(value) != null;
   3423             }
   3424         };
   3425 
   3426         /**
   3427          * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
   3428          * instead
   3429          */
   3430         @Deprecated
   3431         public static final String AUTO_TIME = Global.AUTO_TIME;
   3432 
   3433         /**
   3434          * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
   3435          * instead
   3436          */
   3437         @Deprecated
   3438         public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
   3439 
   3440         /**
   3441          * Display times as 12 or 24 hours
   3442          *   12
   3443          *   24
   3444          */
   3445         public static final String TIME_12_24 = "time_12_24";
   3446 
   3447         /** @hide */
   3448         public static final Validator TIME_12_24_VALIDATOR =
   3449                 new DiscreteValueValidator(new String[] {"12", "24"});
   3450 
   3451         /**
   3452          * Date format string
   3453          *   mm/dd/yyyy
   3454          *   dd/mm/yyyy
   3455          *   yyyy/mm/dd
   3456          */
   3457         public static final String DATE_FORMAT = "date_format";
   3458 
   3459         /** @hide */
   3460         public static final Validator DATE_FORMAT_VALIDATOR = new Validator() {
   3461             @Override
   3462             public boolean validate(String value) {
   3463                 try {
   3464                     new SimpleDateFormat(value);
   3465                     return true;
   3466                 } catch (IllegalArgumentException e) {
   3467                     return false;
   3468                 }
   3469             }
   3470         };
   3471 
   3472         /**
   3473          * Whether the setup wizard has been run before (on first boot), or if
   3474          * it still needs to be run.
   3475          *
   3476          * nonzero = it has been run in the past
   3477          * 0 = it has not been run in the past
   3478          */
   3479         public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
   3480 
   3481         /** @hide */
   3482         public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator;
   3483 
   3484         /**
   3485          * Scaling factor for normal window animations. Setting to 0 will disable window
   3486          * animations.
   3487          *
   3488          * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
   3489          */
   3490         @Deprecated
   3491         public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
   3492 
   3493         /**
   3494          * Scaling factor for activity transition animations. Setting to 0 will disable window
   3495          * animations.
   3496          *
   3497          * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
   3498          */
   3499         @Deprecated
   3500         public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
   3501 
   3502         /**
   3503          * Scaling factor for Animator-based animations. This affects both the start delay and
   3504          * duration of all such animations. Setting to 0 will cause animations to end immediately.
   3505          * The default value is 1.
   3506          *
   3507          * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
   3508          */
   3509         @Deprecated
   3510         public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
   3511 
   3512         /**
   3513          * Control whether the accelerometer will be used to change screen
   3514          * orientation.  If 0, it will not be used unless explicitly requested
   3515          * by the application; if 1, it will be used by default unless explicitly
   3516          * disabled by the application.
   3517          */
   3518         public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
   3519 
   3520         /** @hide */
   3521         public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator;
   3522 
   3523         /**
   3524          * Default screen rotation when no other policy applies.
   3525          * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
   3526          * preference, this rotation value will be used. Must be one of the
   3527          * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
   3528          *
   3529          * @see android.view.Display#getRotation
   3530          */
   3531         public static final String USER_ROTATION = "user_rotation";
   3532 
   3533         /** @hide */
   3534         public static final Validator USER_ROTATION_VALIDATOR =
   3535                 new InclusiveIntegerRangeValidator(0, 3);
   3536 
   3537         /**
   3538          * Control whether the rotation lock toggle in the System UI should be hidden.
   3539          * Typically this is done for accessibility purposes to make it harder for
   3540          * the user to accidentally toggle the rotation lock while the display rotation
   3541          * has been locked for accessibility.
   3542          *
   3543          * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
   3544          * unavailable for other reasons).  If 1, then the rotation lock toggle is hidden.
   3545          *
   3546          * @hide
   3547          */
   3548         public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
   3549                 "hide_rotation_lock_toggle_for_accessibility";
   3550 
   3551         /** @hide */
   3552         public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR =
   3553                 sBooleanValidator;
   3554 
   3555         /**
   3556          * Whether the phone vibrates when it is ringing due to an incoming call. This will
   3557          * be used by Phone and Setting apps; it shouldn't affect other apps.
   3558          * The value is boolean (1 or 0).
   3559          *
   3560          * Note: this is not same as "vibrate on ring", which had been available until ICS.
   3561          * It was about AudioManager's setting and thus affected all the applications which
   3562          * relied on the setting, while this is purely about the vibration setting for incoming
   3563          * calls.
   3564          */
   3565         public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
   3566 
   3567         /** @hide */
   3568         public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator;
   3569 
   3570         /**
   3571          * Whether the audible DTMF tones are played by the dialer when dialing. The value is
   3572          * boolean (1 or 0).
   3573          */
   3574         public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
   3575 
   3576         /** @hide */
   3577         public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
   3578 
   3579         /**
   3580          * CDMA only settings
   3581          * DTMF tone type played by the dialer when dialing.
   3582          *                 0 = Normal
   3583          *                 1 = Long
   3584          */
   3585         public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
   3586 
   3587         /** @hide */
   3588         public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
   3589 
   3590         /**
   3591          * Whether the hearing aid is enabled. The value is
   3592          * boolean (1 or 0).
   3593          * @hide
   3594          */
   3595         public static final String HEARING_AID = "hearing_aid";
   3596 
   3597         /** @hide */
   3598         public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator;
   3599 
   3600         /**
   3601          * CDMA only settings
   3602          * TTY Mode
   3603          * 0 = OFF
   3604          * 1 = FULL
   3605          * 2 = VCO
   3606          * 3 = HCO
   3607          * @hide
   3608          */
   3609         public static final String TTY_MODE = "tty_mode";
   3610 
   3611         /** @hide */
   3612         public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3);
   3613 
   3614         /**
   3615          * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
   3616          * boolean (1 or 0).
   3617          */
   3618         public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
   3619 
   3620         /** @hide */
   3621         public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator;
   3622 
   3623         /**
   3624          * Whether the haptic feedback (long presses, ...) are enabled. The value is
   3625          * boolean (1 or 0).
   3626          */
   3627         public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
   3628 
   3629         /** @hide */
   3630         public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator;
   3631 
   3632         /**
   3633          * @deprecated Each application that shows web suggestions should have its own
   3634          * setting for this.
   3635          */
   3636         @Deprecated
   3637         public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
   3638 
   3639         /** @hide */
   3640         public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;
   3641 
   3642         /**
   3643          * Whether the notification LED should repeatedly flash when a notification is
   3644          * pending. The value is boolean (1 or 0).
   3645          * @hide
   3646          */
   3647         public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
   3648 
   3649         /** @hide */
   3650         public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator;
   3651 
   3652         /**
   3653          * Show pointer location on screen?
   3654          * 0 = no
   3655          * 1 = yes
   3656          * @hide
   3657          */
   3658         public static final String POINTER_LOCATION = "pointer_location";
   3659 
   3660         /** @hide */
   3661         public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator;
   3662 
   3663         /**
   3664          * Show touch positions on screen?
   3665          * 0 = no
   3666          * 1 = yes
   3667          * @hide
   3668          */
   3669         public static final String SHOW_TOUCHES = "show_touches";
   3670 
   3671         /** @hide */
   3672         public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator;
   3673 
   3674         /**
   3675          * Log raw orientation data from
   3676          * {@link com.android.server.policy.WindowOrientationListener} for use with the
   3677          * orientationplot.py tool.
   3678          * 0 = no
   3679          * 1 = yes
   3680          * @hide
   3681          */
   3682         public static final String WINDOW_ORIENTATION_LISTENER_LOG =
   3683                 "window_orientation_listener_log";
   3684 
   3685         /** @hide */
   3686         public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator;
   3687 
   3688         /**
   3689          * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
   3690          * instead
   3691          * @hide
   3692          */
   3693         @Deprecated
   3694         public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
   3695 
   3696         /**
   3697          * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
   3698          * instead
   3699          * @hide
   3700          */
   3701         @Deprecated
   3702         public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
   3703 
   3704         /**
   3705          * Whether to play sounds when the keyguard is shown and dismissed.
   3706          * @hide
   3707          */
   3708         public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
   3709 
   3710         /** @hide */
   3711         public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator;
   3712 
   3713         /**
   3714          * Whether the lockscreen should be completely disabled.
   3715          * @hide
   3716          */
   3717         public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
   3718 
   3719         /** @hide */
   3720         public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator;
   3721 
   3722         /**
   3723          * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
   3724          * instead
   3725          * @hide
   3726          */
   3727         @Deprecated
   3728         public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
   3729 
   3730         /**
   3731          * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
   3732          * instead
   3733          * @hide
   3734          */
   3735         @Deprecated
   3736         public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
   3737 
   3738         /**
   3739          * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
   3740          * instead
   3741          * @hide
   3742          */
   3743         @Deprecated
   3744         public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
   3745 
   3746         /**
   3747          * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
   3748          * instead
   3749          * @hide
   3750          */
   3751         @Deprecated
   3752         public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
   3753 
   3754         /**
   3755          * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
   3756          * instead
   3757          * @hide
   3758          */
   3759         @Deprecated
   3760         public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
   3761 
   3762         /**
   3763          * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
   3764          * instead
   3765          * @hide
   3766          */
   3767         @Deprecated
   3768         public static final String LOCK_SOUND = Global.LOCK_SOUND;
   3769 
   3770         /**
   3771          * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
   3772          * instead
   3773          * @hide
   3774          */
   3775         @Deprecated
   3776         public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
   3777 
   3778         /**
   3779          * Receive incoming SIP calls?
   3780          * 0 = no
   3781          * 1 = yes
   3782          * @hide
   3783          */
   3784         public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
   3785 
   3786         /** @hide */
   3787         public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator;
   3788 
   3789         /**
   3790          * Call Preference String.
   3791          * "SIP_ALWAYS" : Always use SIP with network access
   3792          * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
   3793          * @hide
   3794          */
   3795         public static final String SIP_CALL_OPTIONS = "sip_call_options";
   3796 
   3797         /** @hide */
   3798         public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator(
   3799                 new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"});
   3800 
   3801         /**
   3802          * One of the sip call options: Always use SIP with network access.
   3803          * @hide
   3804          */
   3805         public static final String SIP_ALWAYS = "SIP_ALWAYS";
   3806 
   3807         /** @hide */
   3808         public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator;
   3809 
   3810         /**
   3811          * One of the sip call options: Only if destination is a SIP address.
   3812          * @hide
   3813          */
   3814         public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
   3815 
   3816         /** @hide */
   3817         public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator;
   3818 
   3819         /**
   3820          * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead.  Formerly used to indicate that
   3821          * the user should be prompted each time a call is made whether it should be placed using
   3822          * SIP.  The {@link com.android.providers.settings.DatabaseHelper} replaces this with
   3823          * SIP_ADDRESS_ONLY.
   3824          * @hide
   3825          */
   3826         @Deprecated
   3827         public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
   3828 
   3829         /** @hide */
   3830         public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator;
   3831 
   3832         /**
   3833          * Pointer speed setting.
   3834          * This is an integer value in a range between -7 and +7, so there are 15 possible values.
   3835          *   -7 = slowest
   3836          *    0 = default speed
   3837          *   +7 = fastest
   3838          * @hide
   3839          */
   3840         public static final String POINTER_SPEED = "pointer_speed";
   3841 
   3842         /** @hide */
   3843         public static final Validator POINTER_SPEED_VALIDATOR =
   3844                 new InclusiveFloatRangeValidator(-7, 7);
   3845 
   3846         /**
   3847          * Whether lock-to-app will be triggered by long-press on recents.
   3848          * @hide
   3849          */
   3850         public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled";
   3851 
   3852         /** @hide */
   3853         public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator;
   3854 
   3855         /**
   3856          * I am the lolrus.
   3857          * <p>
   3858          * Nonzero values indicate that the user has a bukkit.
   3859          * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>.
   3860          * @hide
   3861          */
   3862         public static final String EGG_MODE = "egg_mode";
   3863 
   3864         /** @hide */
   3865         public static final Validator EGG_MODE_VALIDATOR = new Validator() {
   3866             @Override
   3867             public boolean validate(String value) {
   3868                 try {
   3869                     return Long.parseLong(value) >= 0;
   3870                 } catch (NumberFormatException e) {
   3871                     return false;
   3872                 }
   3873             }
   3874         };
   3875 
   3876         /**
   3877          * Setting to determine whether or not to show the battery percentage in the status bar.
   3878          *    0 - Don't show percentage
   3879          *    1 - Show percentage
   3880          * @hide
   3881          */
   3882         public static final String SHOW_BATTERY_PERCENT = "status_bar_show_battery_percent";
   3883 
   3884         /** @hide */
   3885         private static final Validator SHOW_BATTERY_PERCENT_VALIDATOR = sBooleanValidator;
   3886 
   3887         /**
   3888          * IMPORTANT: If you add a new public settings you also have to add it to
   3889          * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
   3890          * it to PRIVATE_SETTINGS below. Also add a validator that can validate
   3891          * the setting value. See an example above.
   3892          */
   3893 
   3894         /**
   3895          * Settings to backup. This is here so that it's in the same place as the settings
   3896          * keys and easy to update.
   3897          *
   3898          * NOTE: Settings are backed up and restored in the order they appear
   3899          *       in this array. If you have one setting depending on another,
   3900          *       make sure that they are ordered appropriately.
   3901          *
   3902          * @hide
   3903          */
   3904         public static final String[] SETTINGS_TO_BACKUP = {
   3905             STAY_ON_WHILE_PLUGGED_IN,   // moved to global
   3906             WIFI_USE_STATIC_IP,
   3907             WIFI_STATIC_IP,
   3908             WIFI_STATIC_GATEWAY,
   3909             WIFI_STATIC_NETMASK,
   3910             WIFI_STATIC_DNS1,
   3911             WIFI_STATIC_DNS2,
   3912             BLUETOOTH_DISCOVERABILITY,
   3913             BLUETOOTH_DISCOVERABILITY_TIMEOUT,
   3914             FONT_SCALE,
   3915             DIM_SCREEN,
   3916             SCREEN_OFF_TIMEOUT,
   3917             SCREEN_BRIGHTNESS,
   3918             SCREEN_BRIGHTNESS_MODE,
   3919             SCREEN_AUTO_BRIGHTNESS_ADJ,
   3920             SCREEN_BRIGHTNESS_FOR_VR,
   3921             VIBRATE_INPUT_DEVICES,
   3922             MODE_RINGER_STREAMS_AFFECTED,
   3923             TEXT_AUTO_REPLACE,
   3924             TEXT_AUTO_CAPS,
   3925             TEXT_AUTO_PUNCTUATE,
   3926             TEXT_SHOW_PASSWORD,
   3927             AUTO_TIME,                  // moved to global
   3928             AUTO_TIME_ZONE,             // moved to global
   3929             TIME_12_24,
   3930             DATE_FORMAT,
   3931             DTMF_TONE_WHEN_DIALING,
   3932             DTMF_TONE_TYPE_WHEN_DIALING,
   3933             HEARING_AID,
   3934             TTY_MODE,
   3935             MASTER_MONO,
   3936             SOUND_EFFECTS_ENABLED,
   3937             HAPTIC_FEEDBACK_ENABLED,
   3938             POWER_SOUNDS_ENABLED,       // moved to global
   3939             DOCK_SOUNDS_ENABLED,        // moved to global
   3940             LOCKSCREEN_SOUNDS_ENABLED,
   3941             SHOW_WEB_SUGGESTIONS,
   3942             SIP_CALL_OPTIONS,
   3943             SIP_RECEIVE_CALLS,
   3944             POINTER_SPEED,
   3945             VIBRATE_WHEN_RINGING,
   3946             RINGTONE,
   3947             LOCK_TO_APP_ENABLED,
   3948             NOTIFICATION_SOUND,
   3949             ACCELEROMETER_ROTATION,
   3950             SHOW_BATTERY_PERCENT
   3951         };
   3952 
   3953         /**
   3954          * These are all public system settings
   3955          *
   3956          * @hide
   3957          */
   3958         public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>();
   3959         static {
   3960             PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR);
   3961             PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP);
   3962             PUBLIC_SETTINGS.add(WIFI_STATIC_IP);
   3963             PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY);
   3964             PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK);
   3965             PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1);
   3966             PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2);
   3967             PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY);
   3968             PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT);
   3969             PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED);
   3970             PUBLIC_SETTINGS.add(FONT_SCALE);
   3971             PUBLIC_SETTINGS.add(DIM_SCREEN);
   3972             PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT);
   3973             PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS);
   3974             PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE);
   3975             PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED);
   3976             PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED);
   3977             PUBLIC_SETTINGS.add(VIBRATE_ON);
   3978             PUBLIC_SETTINGS.add(VOLUME_RING);
   3979             PUBLIC_SETTINGS.add(VOLUME_SYSTEM);
   3980             PUBLIC_SETTINGS.add(VOLUME_VOICE);
   3981             PUBLIC_SETTINGS.add(VOLUME_MUSIC);
   3982             PUBLIC_SETTINGS.add(VOLUME_ALARM);
   3983             PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION);
   3984             PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO);
   3985             PUBLIC_SETTINGS.add(RINGTONE);
   3986             PUBLIC_SETTINGS.add(NOTIFICATION_SOUND);
   3987             PUBLIC_SETTINGS.add(ALARM_ALERT);
   3988             PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE);
   3989             PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS);
   3990             PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
   3991             PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD);
   3992             PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS);
   3993             PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY);
   3994             PUBLIC_SETTINGS.add(TIME_12_24);
   3995             PUBLIC_SETTINGS.add(DATE_FORMAT);
   3996             PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN);
   3997             PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION);
   3998             PUBLIC_SETTINGS.add(USER_ROTATION);
   3999             PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING);
   4000             PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED);
   4001             PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
   4002             PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS);
   4003             PUBLIC_SETTINGS.add(VIBRATE_WHEN_RINGING);
   4004         }
   4005 
   4006         /**
   4007          * These are all hidden system settings.
   4008          *
   4009          * @hide
   4010          */
   4011         public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>();
   4012         static {
   4013             PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP);
   4014             PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR);
   4015             PRIVATE_SETTINGS.add(ADVANCED_SETTINGS);
   4016             PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ);
   4017             PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES);
   4018             PRIVATE_SETTINGS.add(VOLUME_MASTER);
   4019             PRIVATE_SETTINGS.add(MASTER_MONO);
   4020             PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME);
   4021             PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT);
   4022             PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER);
   4023             PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY);
   4024             PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING);
   4025             PRIVATE_SETTINGS.add(HEARING_AID);
   4026             PRIVATE_SETTINGS.add(TTY_MODE);
   4027             PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
   4028             PRIVATE_SETTINGS.add(POINTER_LOCATION);
   4029             PRIVATE_SETTINGS.add(SHOW_TOUCHES);
   4030             PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
   4031             PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
   4032             PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
   4033             PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED);
   4034             PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED);
   4035             PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND);
   4036             PRIVATE_SETTINGS.add(DESK_DOCK_SOUND);
   4037             PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND);
   4038             PRIVATE_SETTINGS.add(CAR_DOCK_SOUND);
   4039             PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND);
   4040             PRIVATE_SETTINGS.add(LOCK_SOUND);
   4041             PRIVATE_SETTINGS.add(UNLOCK_SOUND);
   4042             PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS);
   4043             PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS);
   4044             PRIVATE_SETTINGS.add(SIP_ALWAYS);
   4045             PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY);
   4046             PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME);
   4047             PRIVATE_SETTINGS.add(POINTER_SPEED);
   4048             PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED);
   4049             PRIVATE_SETTINGS.add(EGG_MODE);
   4050             PRIVATE_SETTINGS.add(SHOW_BATTERY_PERCENT);
   4051         }
   4052 
   4053         /**
   4054          * These are all public system settings
   4055          *
   4056          * @hide
   4057          */
   4058         public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
   4059         static {
   4060             VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR);
   4061             VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
   4062             VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR);
   4063             VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT,
   4064                     BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR);
   4065             VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR);
   4066             VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
   4067             VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
   4068             VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
   4069             VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR);
   4070             VALIDATORS.put(SCREEN_BRIGHTNESS_FOR_VR, SCREEN_BRIGHTNESS_FOR_VR_VALIDATOR);
   4071             VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
   4072             VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
   4073             VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR);
   4074             VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR);
   4075             VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR);
   4076             VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR);
   4077             VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR);
   4078             VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR);
   4079             VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR);
   4080             VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR);
   4081             VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR);
   4082             VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR);
   4083             VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR);
   4084             VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR);
   4085             VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR);
   4086             VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR);
   4087             VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR);
   4088             VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR);
   4089             VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR);
   4090             VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR);
   4091             VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR);
   4092             VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR);
   4093             VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
   4094             VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
   4095             VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR);
   4096             VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR);
   4097             VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR);
   4098             VALIDATORS.put(MASTER_MONO, MASTER_MONO_VALIDATOR);
   4099             VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR);
   4100             VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR);
   4101             VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR);
   4102             VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
   4103                     HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR);
   4104             VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR);
   4105             VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR);
   4106             VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR);
   4107             VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR);
   4108             VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR);
   4109             VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR);
   4110             VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR);
   4111             VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG,
   4112                     WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR);
   4113             VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR);
   4114             VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR);
   4115             VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR);
   4116             VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR);
   4117             VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR);
   4118             VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR);
   4119             VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR);
   4120             VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR);
   4121             VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR);
   4122             VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR);
   4123             VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR);
   4124             VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR);
   4125             VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR);
   4126             VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
   4127             VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
   4128             VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
   4129         }
   4130 
   4131         /**
   4132          * These entries are considered common between the personal and the managed profile,
   4133          * since the managed profile doesn't get to change them.
   4134          */
   4135         private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
   4136         static {
   4137             CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT);
   4138             CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED);
   4139             CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED);
   4140             CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD);
   4141             CLONE_TO_MANAGED_PROFILE.add(TIME_12_24);
   4142         }
   4143 
   4144         /** @hide */
   4145         public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
   4146             outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
   4147         }
   4148 
   4149         /**
   4150          * These entries should be cloned from this profile's parent only if the dependency's
   4151          * value is true ("1")
   4152          *
   4153          * Note: the dependencies must be Secure settings
   4154          *
   4155          * @hide
   4156          */
   4157         public static final Map<String, String> CLONE_FROM_PARENT_ON_VALUE = new ArrayMap<>();
   4158         static {
   4159             CLONE_FROM_PARENT_ON_VALUE.put(RINGTONE, Secure.SYNC_PARENT_SOUNDS);
   4160             CLONE_FROM_PARENT_ON_VALUE.put(NOTIFICATION_SOUND, Secure.SYNC_PARENT_SOUNDS);
   4161             CLONE_FROM_PARENT_ON_VALUE.put(ALARM_ALERT, Secure.SYNC_PARENT_SOUNDS);
   4162         }
   4163 
   4164         /** @hide */
   4165         public static void getCloneFromParentOnValueSettings(Map<String, String> outMap) {
   4166             outMap.putAll(CLONE_FROM_PARENT_ON_VALUE);
   4167         }
   4168 
   4169         /**
   4170          * System settings which can be accessed by instant apps.
   4171          * @hide
   4172          */
   4173         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
   4174         static {
   4175             INSTANT_APP_SETTINGS.add(TEXT_AUTO_REPLACE);
   4176             INSTANT_APP_SETTINGS.add(TEXT_AUTO_CAPS);
   4177             INSTANT_APP_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
   4178             INSTANT_APP_SETTINGS.add(TEXT_SHOW_PASSWORD);
   4179             INSTANT_APP_SETTINGS.add(DATE_FORMAT);
   4180             INSTANT_APP_SETTINGS.add(FONT_SCALE);
   4181             INSTANT_APP_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
   4182             INSTANT_APP_SETTINGS.add(TIME_12_24);
   4183             INSTANT_APP_SETTINGS.add(SOUND_EFFECTS_ENABLED);
   4184             INSTANT_APP_SETTINGS.add(ACCELEROMETER_ROTATION);
   4185         }
   4186 
   4187         /**
   4188          * When to use Wi-Fi calling
   4189          *
   4190          * @see android.telephony.TelephonyManager.WifiCallingChoices
   4191          * @hide
   4192          */
   4193         public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
   4194 
   4195         // Settings moved to Settings.Secure
   4196 
   4197         /**
   4198          * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
   4199          * instead
   4200          */
   4201         @Deprecated
   4202         public static final String ADB_ENABLED = Global.ADB_ENABLED;
   4203 
   4204         /**
   4205          * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
   4206          */
   4207         @Deprecated
   4208         public static final String ANDROID_ID = Secure.ANDROID_ID;
   4209 
   4210         /**
   4211          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
   4212          */
   4213         @Deprecated
   4214         public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
   4215 
   4216         /**
   4217          * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
   4218          */
   4219         @Deprecated
   4220         public static final String DATA_ROAMING = Global.DATA_ROAMING;
   4221 
   4222         /**
   4223          * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
   4224          */
   4225         @Deprecated
   4226         public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
   4227 
   4228         /**
   4229          * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
   4230          */
   4231         @Deprecated
   4232         public static final String HTTP_PROXY = Global.HTTP_PROXY;
   4233 
   4234         /**
   4235          * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
   4236          */
   4237         @Deprecated
   4238         public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
   4239 
   4240         /**
   4241          * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
   4242          * instead
   4243          */
   4244         @Deprecated
   4245         public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
   4246 
   4247         /**
   4248          * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
   4249          */
   4250         @Deprecated
   4251         public static final String LOGGING_ID = Secure.LOGGING_ID;
   4252 
   4253         /**
   4254          * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
   4255          */
   4256         @Deprecated
   4257         public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
   4258 
   4259         /**
   4260          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
   4261          * instead
   4262          */
   4263         @Deprecated
   4264         public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
   4265 
   4266         /**
   4267          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
   4268          * instead
   4269          */
   4270         @Deprecated
   4271         public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
   4272 
   4273         /**
   4274          * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
   4275          * instead
   4276          */
   4277         @Deprecated
   4278         public static final String PARENTAL_CONTROL_REDIRECT_URL =
   4279             Secure.PARENTAL_CONTROL_REDIRECT_URL;
   4280 
   4281         /**
   4282          * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
   4283          */
   4284         @Deprecated
   4285         public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
   4286 
   4287         /**
   4288          * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
   4289          */
   4290         @Deprecated
   4291         public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
   4292 
   4293         /**
   4294          * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
   4295          */
   4296         @Deprecated
   4297         public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
   4298 
   4299        /**
   4300          * @deprecated Use
   4301          * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
   4302          */
   4303         @Deprecated
   4304         public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
   4305 
   4306         /**
   4307          * @deprecated Use
   4308          * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
   4309          */
   4310         @Deprecated
   4311         public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
   4312                 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
   4313 
   4314         /**
   4315          * @deprecated Use
   4316          * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
   4317          */
   4318         @Deprecated
   4319         public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
   4320                 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
   4321 
   4322         /**
   4323          * @deprecated Use
   4324          * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
   4325          */
   4326         @Deprecated
   4327         public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
   4328                 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
   4329 
   4330         /**
   4331          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
   4332          * instead
   4333          */
   4334         @Deprecated
   4335         public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
   4336 
   4337         /**
   4338          * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
   4339          */
   4340         @Deprecated
   4341         public static final String WIFI_ON = Global.WIFI_ON;
   4342 
   4343         /**
   4344          * @deprecated Use
   4345          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
   4346          * instead
   4347          */
   4348         @Deprecated
   4349         public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
   4350                 Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
   4351 
   4352         /**
   4353          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
   4354          */
   4355         @Deprecated
   4356         public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
   4357 
   4358         /**
   4359          * @deprecated Use
   4360          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
   4361          */
   4362         @Deprecated
   4363         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
   4364                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
   4365 
   4366         /**
   4367          * @deprecated Use
   4368          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
   4369          */
   4370         @Deprecated
   4371         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
   4372                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
   4373 
   4374         /**
   4375          * @deprecated Use
   4376          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
   4377          * instead
   4378          */
   4379         @Deprecated
   4380         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
   4381                 Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
   4382 
   4383         /**
   4384          * @deprecated Use
   4385          * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
   4386          */
   4387         @Deprecated
   4388         public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
   4389             Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
   4390 
   4391         /**
   4392          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
   4393          * instead
   4394          */
   4395         @Deprecated
   4396         public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
   4397 
   4398         /**
   4399          * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
   4400          */
   4401         @Deprecated
   4402         public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
   4403 
   4404         /**
   4405          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
   4406          */
   4407         @Deprecated
   4408         public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
   4409 
   4410         /**
   4411          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
   4412          * instead
   4413          */
   4414         @Deprecated
   4415         public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
   4416 
   4417         /**
   4418          * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
   4419          * instead
   4420          */
   4421         @Deprecated
   4422         public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
   4423             Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
   4424 
   4425         /**
   4426          * Checks if the specified app can modify system settings. As of API
   4427          * level 23, an app cannot modify system settings unless it declares the
   4428          * {@link android.Manifest.permission#WRITE_SETTINGS}
   4429          * permission in its manifest, <em>and</em> the user specifically grants
   4430          * the app this capability. To prompt the user to grant this approval,
   4431          * the app must send an intent with the action {@link
   4432          * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
   4433          * the system to display a permission management screen.
   4434          *
   4435          * @param context App context.
   4436          * @return true if the calling app can write to system settings, false otherwise
   4437          */
   4438         public static boolean canWrite(Context context) {
   4439             return isCallingPackageAllowedToWriteSettings(context, Process.myUid(),
   4440                     context.getOpPackageName(), false);
   4441         }
   4442     }
   4443 
   4444     /**
   4445      * Secure system settings, containing system preferences that applications
   4446      * can read but are not allowed to write.  These are for preferences that
   4447      * the user must explicitly modify through the system UI or specialized
   4448      * APIs for those values, not modified directly by applications.
   4449      */
   4450     public static final class Secure extends NameValueTable {
   4451         /**
   4452          * The content:// style URL for this table
   4453          */
   4454         public static final Uri CONTENT_URI =
   4455             Uri.parse("content://" + AUTHORITY + "/secure");
   4456 
   4457         private static final ContentProviderHolder sProviderHolder =
   4458                 new ContentProviderHolder(CONTENT_URI);
   4459 
   4460         // Populated lazily, guarded by class object:
   4461         private static final NameValueCache sNameValueCache = new NameValueCache(
   4462                 CONTENT_URI,
   4463                 CALL_METHOD_GET_SECURE,
   4464                 CALL_METHOD_PUT_SECURE,
   4465                 sProviderHolder);
   4466 
   4467         private static ILockSettings sLockSettings = null;
   4468 
   4469         private static boolean sIsSystemProcess;
   4470         private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
   4471         private static final HashSet<String> MOVED_TO_GLOBAL;
   4472         static {
   4473             MOVED_TO_LOCK_SETTINGS = new HashSet<>(3);
   4474             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
   4475             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
   4476             MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
   4477 
   4478             MOVED_TO_GLOBAL = new HashSet<>();
   4479             MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
   4480             MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
   4481             MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
   4482             MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
   4483             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
   4484             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
   4485             MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
   4486             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
   4487             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
   4488             MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
   4489             MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
   4490             MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
   4491             MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
   4492             MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
   4493             MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
   4494             MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
   4495             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
   4496             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
   4497             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
   4498             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
   4499             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
   4500             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
   4501             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
   4502             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
   4503             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
   4504             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
   4505             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
   4506             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
   4507             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
   4508             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
   4509             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
   4510             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
   4511             MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
   4512             MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
   4513             MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
   4514             MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
   4515             MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
   4516             MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
   4517             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
   4518             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
   4519             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
   4520             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
   4521             MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
   4522             MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
   4523             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
   4524             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
   4525             MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
   4526             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
   4527             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
   4528             MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
   4529             MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
   4530             MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
   4531             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
   4532             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
   4533             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
   4534             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
   4535             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
   4536             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
   4537             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
   4538             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
   4539             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
   4540             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
   4541             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
   4542             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
   4543             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
   4544             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
   4545             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_VERBOSE_LOGGING_ENABLED);
   4546             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
   4547             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
   4548             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
   4549             MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
   4550             MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
   4551             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
   4552             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
   4553             MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
   4554             MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
   4555             MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
   4556             MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
   4557             MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
   4558             MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
   4559             MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
   4560             MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
   4561             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
   4562             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
   4563             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
   4564             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
   4565             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
   4566             MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
   4567             MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
   4568             MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
   4569             MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
   4570             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
   4571             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
   4572             MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
   4573             MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
   4574             MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
   4575             MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
   4576             MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
   4577             MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
   4578             MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
   4579             MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
   4580             MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
   4581             MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
   4582             MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
   4583             MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
   4584             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
   4585             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
   4586             MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
   4587             MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
   4588             MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
   4589             MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
   4590             MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
   4591         }
   4592 
   4593         /** @hide */
   4594         public static void getMovedToGlobalSettings(Set<String> outKeySet) {
   4595             outKeySet.addAll(MOVED_TO_GLOBAL);
   4596         }
   4597 
   4598         /**
   4599          * Look up a name in the database.
   4600          * @param resolver to access the database with
   4601          * @param name to look up in the table
   4602          * @return the corresponding value, or null if not present
   4603          */
   4604         public static String getString(ContentResolver resolver, String name) {
   4605             return getStringForUser(resolver, name, UserHandle.myUserId());
   4606         }
   4607 
   4608         /** @hide */
   4609         public static String getStringForUser(ContentResolver resolver, String name,
   4610                 int userHandle) {
   4611             if (MOVED_TO_GLOBAL.contains(name)) {
   4612                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
   4613                         + " to android.provider.Settings.Global.");
   4614                 return Global.getStringForUser(resolver, name, userHandle);
   4615             }
   4616 
   4617             if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
   4618                 synchronized (Secure.class) {
   4619                     if (sLockSettings == null) {
   4620                         sLockSettings = ILockSettings.Stub.asInterface(
   4621                                 (IBinder) ServiceManager.getService("lock_settings"));
   4622                         sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
   4623                     }
   4624                 }
   4625                 if (sLockSettings != null && !sIsSystemProcess) {
   4626                     // No context; use the ActivityThread's context as an approximation for
   4627                     // determining the target API level.
   4628                     Application application = ActivityThread.currentApplication();
   4629 
   4630                     boolean isPreMnc = application != null
   4631                             && application.getApplicationInfo() != null
   4632                             && application.getApplicationInfo().targetSdkVersion
   4633                             <= VERSION_CODES.LOLLIPOP_MR1;
   4634                     if (isPreMnc) {
   4635                         try {
   4636                             return sLockSettings.getString(name, "0", userHandle);
   4637                         } catch (RemoteException re) {
   4638                             // Fall through
   4639                         }
   4640                     } else {
   4641                         throw new SecurityException("Settings.Secure." + name
   4642                                 + " is deprecated and no longer accessible."
   4643                                 + " See API documentation for potential replacements.");
   4644                     }
   4645                 }
   4646             }
   4647 
   4648             return sNameValueCache.getStringForUser(resolver, name, userHandle);
   4649         }
   4650 
   4651         /**
   4652          * Store a name/value pair into the database.
   4653          * @param resolver to access the database with
   4654          * @param name to store
   4655          * @param value to associate with the name
   4656          * @return true if the value was set, false on database errors
   4657          */
   4658         public static boolean putString(ContentResolver resolver, String name, String value) {
   4659             return putStringForUser(resolver, name, value, UserHandle.myUserId());
   4660         }
   4661 
   4662         /** @hide */
   4663         public static boolean putStringForUser(ContentResolver resolver, String name, String value,
   4664                 int userHandle) {
   4665             return putStringForUser(resolver, name, value, null, false, userHandle);
   4666         }
   4667 
   4668         /** @hide */
   4669         public static boolean putStringForUser(@NonNull ContentResolver resolver,
   4670                 @NonNull String name, @Nullable String value, @Nullable String tag,
   4671                 boolean makeDefault, @UserIdInt int userHandle) {
   4672             if (LOCATION_MODE.equals(name)) {
   4673                 // Map LOCATION_MODE to underlying location provider storage API
   4674                 return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
   4675             }
   4676             if (MOVED_TO_GLOBAL.contains(name)) {
   4677                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
   4678                         + " to android.provider.Settings.Global");
   4679                 return Global.putStringForUser(resolver, name, value,
   4680                         tag, makeDefault, userHandle);
   4681             }
   4682             return sNameValueCache.putStringForUser(resolver, name, value, tag,
   4683                     makeDefault, userHandle);
   4684         }
   4685 
   4686         /**
   4687          * Store a name/value pair into the database.
   4688          * <p>
   4689          * The method takes an optional tag to associate with the setting
   4690          * which can be used to clear only settings made by your package and
   4691          * associated with this tag by passing the tag to {@link
   4692          * #resetToDefaults(ContentResolver, String)}. Anyone can override
   4693          * the current tag. Also if another package changes the setting
   4694          * then the tag will be set to the one specified in the set call
   4695          * which can be null. Also any of the settings setters that do not
   4696          * take a tag as an argument effectively clears the tag.
   4697          * </p><p>
   4698          * For example, if you set settings A and B with tags T1 and T2 and
   4699          * another app changes setting A (potentially to the same value), it
   4700          * can assign to it a tag T3 (note that now the package that changed
   4701          * the setting is not yours). Now if you reset your changes for T1 and
   4702          * T2 only setting B will be reset and A not (as it was changed by
   4703          * another package) but since A did not change you are in the desired
   4704          * initial state. Now if the other app changes the value of A (assuming
   4705          * you registered an observer in the beginning) you would detect that
   4706          * the setting was changed by another app and handle this appropriately
   4707          * (ignore, set back to some value, etc).
   4708          * </p><p>
   4709          * Also the method takes an argument whether to make the value the
   4710          * default for this setting. If the system already specified a default
   4711          * value, then the one passed in here will <strong>not</strong>
   4712          * be set as the default.
   4713          * </p>
   4714          *
   4715          * @param resolver to access the database with.
   4716          * @param name to store.
   4717          * @param value to associate with the name.
   4718          * @param tag to associate with the setting.
   4719          * @param makeDefault whether to make the value the default one.
   4720          * @return true if the value was set, false on database errors.
   4721          *
   4722          * @see #resetToDefaults(ContentResolver, String)
   4723          *
   4724          * @hide
   4725          */
   4726         @SystemApi
   4727         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
   4728         public static boolean putString(@NonNull ContentResolver resolver,
   4729                 @NonNull String name, @Nullable String value, @Nullable String tag,
   4730                 boolean makeDefault) {
   4731             return putStringForUser(resolver, name, value, tag, makeDefault,
   4732                     UserHandle.myUserId());
   4733         }
   4734 
   4735         /**
   4736          * Reset the settings to their defaults. This would reset <strong>only</strong>
   4737          * settings set by the caller's package. Think of it of a way to undo your own
   4738          * changes to the global settings. Passing in the optional tag will reset only
   4739          * settings changed by your package and associated with this tag.
   4740          *
   4741          * @param resolver Handle to the content resolver.
   4742          * @param tag Optional tag which should be associated with the settings to reset.
   4743          *
   4744          * @see #putString(ContentResolver, String, String, String, boolean)
   4745          *
   4746          * @hide
   4747          */
   4748         @SystemApi
   4749         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
   4750         public static void resetToDefaults(@NonNull ContentResolver resolver,
   4751                 @Nullable String tag) {
   4752             resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
   4753                     UserHandle.myUserId());
   4754         }
   4755 
   4756         /**
   4757          *
   4758          * Reset the settings to their defaults for a given user with a specific mode. The
   4759          * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
   4760          * allowing resetting the settings made by a package and associated with the tag.
   4761          *
   4762          * @param resolver Handle to the content resolver.
   4763          * @param tag Optional tag which should be associated with the settings to reset.
   4764          * @param mode The reset mode.
   4765          * @param userHandle The user for which to reset to defaults.
   4766          *
   4767          * @see #RESET_MODE_PACKAGE_DEFAULTS
   4768          * @see #RESET_MODE_UNTRUSTED_DEFAULTS
   4769          * @see #RESET_MODE_UNTRUSTED_CHANGES
   4770          * @see #RESET_MODE_TRUSTED_DEFAULTS
   4771          *
   4772          * @hide
   4773          */
   4774         public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
   4775                 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
   4776             try {
   4777                 Bundle arg = new Bundle();
   4778                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
   4779                 if (tag != null) {
   4780                     arg.putString(CALL_METHOD_TAG_KEY, tag);
   4781                 }
   4782                 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
   4783                 IContentProvider cp = sProviderHolder.getProvider(resolver);
   4784                 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_SECURE, null, arg);
   4785             } catch (RemoteException e) {
   4786                 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
   4787             }
   4788         }
   4789 
   4790         /**
   4791          * Construct the content URI for a particular name/value pair,
   4792          * useful for monitoring changes with a ContentObserver.
   4793          * @param name to look up in the table
   4794          * @return the corresponding content URI, or null if not present
   4795          */
   4796         public static Uri getUriFor(String name) {
   4797             if (MOVED_TO_GLOBAL.contains(name)) {
   4798                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
   4799                         + " to android.provider.Settings.Global, returning global URI.");
   4800                 return Global.getUriFor(Global.CONTENT_URI, name);
   4801             }
   4802             return getUriFor(CONTENT_URI, name);
   4803         }
   4804 
   4805         /**
   4806          * Convenience function for retrieving a single secure settings value
   4807          * as an integer.  Note that internally setting values are always
   4808          * stored as strings; this function converts the string to an integer
   4809          * for you.  The default value will be returned if the setting is
   4810          * not defined or not an integer.
   4811          *
   4812          * @param cr The ContentResolver to access.
   4813          * @param name The name of the setting to retrieve.
   4814          * @param def Value to return if the setting is not defined.
   4815          *
   4816          * @return The setting's current value, or 'def' if it is not defined
   4817          * or not a valid integer.
   4818          */
   4819         public static int getInt(ContentResolver cr, String name, int def) {
   4820             return getIntForUser(cr, name, def, UserHandle.myUserId());
   4821         }
   4822 
   4823         /** @hide */
   4824         public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
   4825             if (LOCATION_MODE.equals(name)) {
   4826                 // Map from to underlying location provider storage API to location mode
   4827                 return getLocationModeForUser(cr, userHandle);
   4828             }
   4829             String v = getStringForUser(cr, name, userHandle);
   4830             try {
   4831                 return v != null ? Integer.parseInt(v) : def;
   4832             } catch (NumberFormatException e) {
   4833                 return def;
   4834             }
   4835         }
   4836 
   4837         /**
   4838          * Convenience function for retrieving a single secure settings value
   4839          * as an integer.  Note that internally setting values are always
   4840          * stored as strings; this function converts the string to an integer
   4841          * for you.
   4842          * <p>
   4843          * This version does not take a default value.  If the setting has not
   4844          * been set, or the string value is not a number,
   4845          * it throws {@link SettingNotFoundException}.
   4846          *
   4847          * @param cr The ContentResolver to access.
   4848          * @param name The name of the setting to retrieve.
   4849          *
   4850          * @throws SettingNotFoundException Thrown if a setting by the given
   4851          * name can't be found or the setting value is not an integer.
   4852          *
   4853          * @return The setting's current value.
   4854          */
   4855         public static int getInt(ContentResolver cr, String name)
   4856                 throws SettingNotFoundException {
   4857             return getIntForUser(cr, name, UserHandle.myUserId());
   4858         }
   4859 
   4860         /** @hide */
   4861         public static int getIntForUser(ContentResolver cr, String name, int userHandle)
   4862                 throws SettingNotFoundException {
   4863             if (LOCATION_MODE.equals(name)) {
   4864                 // Map from to underlying location provider storage API to location mode
   4865                 return getLocationModeForUser(cr, userHandle);
   4866             }
   4867             String v = getStringForUser(cr, name, userHandle);
   4868             try {
   4869                 return Integer.parseInt(v);
   4870             } catch (NumberFormatException e) {
   4871                 throw new SettingNotFoundException(name);
   4872             }
   4873         }
   4874 
   4875         /**
   4876          * Convenience function for updating a single settings value as an
   4877          * integer. This will either create a new entry in the table if the
   4878          * given name does not exist, or modify the value of the existing row
   4879          * with that name.  Note that internally setting values are always
   4880          * stored as strings, so this function converts the given value to a
   4881          * string before storing it.
   4882          *
   4883          * @param cr The ContentResolver to access.
   4884          * @param name The name of the setting to modify.
   4885          * @param value The new value for the setting.
   4886          * @return true if the value was set, false on database errors
   4887          */
   4888         public static boolean putInt(ContentResolver cr, String name, int value) {
   4889             return putIntForUser(cr, name, value, UserHandle.myUserId());
   4890         }
   4891 
   4892         /** @hide */
   4893         public static boolean putIntForUser(ContentResolver cr, String name, int value,
   4894                 int userHandle) {
   4895             return putStringForUser(cr, name, Integer.toString(value), userHandle);
   4896         }
   4897 
   4898         /**
   4899          * Convenience function for retrieving a single secure settings value
   4900          * as a {@code long}.  Note that internally setting values are always
   4901          * stored as strings; this function converts the string to a {@code long}
   4902          * for you.  The default value will be returned if the setting is
   4903          * not defined or not a {@code long}.
   4904          *
   4905          * @param cr The ContentResolver to access.
   4906          * @param name The name of the setting to retrieve.
   4907          * @param def Value to return if the setting is not defined.
   4908          *
   4909          * @return The setting's current value, or 'def' if it is not defined
   4910          * or not a valid {@code long}.
   4911          */
   4912         public static long getLong(ContentResolver cr, String name, long def) {
   4913             return getLongForUser(cr, name, def, UserHandle.myUserId());
   4914         }
   4915 
   4916         /** @hide */
   4917         public static long getLongForUser(ContentResolver cr, String name, long def,
   4918                 int userHandle) {
   4919             String valString = getStringForUser(cr, name, userHandle);
   4920             long value;
   4921             try {
   4922                 value = valString != null ? Long.parseLong(valString) : def;
   4923             } catch (NumberFormatException e) {
   4924                 value = def;
   4925             }
   4926             return value;
   4927         }
   4928 
   4929         /**
   4930          * Convenience function for retrieving a single secure settings value
   4931          * as a {@code long}.  Note that internally setting values are always
   4932          * stored as strings; this function converts the string to a {@code long}
   4933          * for you.
   4934          * <p>
   4935          * This version does not take a default value.  If the setting has not
   4936          * been set, or the string value is not a number,
   4937          * it throws {@link SettingNotFoundException}.
   4938          *
   4939          * @param cr The ContentResolver to access.
   4940          * @param name The name of the setting to retrieve.
   4941          *
   4942          * @return The setting's current value.
   4943          * @throws SettingNotFoundException Thrown if a setting by the given
   4944          * name can't be found or the setting value is not an integer.
   4945          */
   4946         public static long getLong(ContentResolver cr, String name)
   4947                 throws SettingNotFoundException {
   4948             return getLongForUser(cr, name, UserHandle.myUserId());
   4949         }
   4950 
   4951         /** @hide */
   4952         public static long getLongForUser(ContentResolver cr, String name, int userHandle)
   4953                 throws SettingNotFoundException {
   4954             String valString = getStringForUser(cr, name, userHandle);
   4955             try {
   4956                 return Long.parseLong(valString);
   4957             } catch (NumberFormatException e) {
   4958                 throw new SettingNotFoundException(name);
   4959             }
   4960         }
   4961 
   4962         /**
   4963          * Convenience function for updating a secure settings value as a long
   4964          * integer. This will either create a new entry in the table if the
   4965          * given name does not exist, or modify the value of the existing row
   4966          * with that name.  Note that internally setting values are always
   4967          * stored as strings, so this function converts the given value to a
   4968          * string before storing it.
   4969          *
   4970          * @param cr The ContentResolver to access.
   4971          * @param name The name of the setting to modify.
   4972          * @param value The new value for the setting.
   4973          * @return true if the value was set, false on database errors
   4974          */
   4975         public static boolean putLong(ContentResolver cr, String name, long value) {
   4976             return putLongForUser(cr, name, value, UserHandle.myUserId());
   4977         }
   4978 
   4979         /** @hide */
   4980         public static boolean putLongForUser(ContentResolver cr, String name, long value,
   4981                 int userHandle) {
   4982             return putStringForUser(cr, name, Long.toString(value), userHandle);
   4983         }
   4984 
   4985         /**
   4986          * Convenience function for retrieving a single secure settings value
   4987          * as a floating point number.  Note that internally setting values are
   4988          * always stored as strings; this function converts the string to an
   4989          * float for you. The default value will be returned if the setting
   4990          * is not defined or not a valid float.
   4991          *
   4992          * @param cr The ContentResolver to access.
   4993          * @param name The name of the setting to retrieve.
   4994          * @param def Value to return if the setting is not defined.
   4995          *
   4996          * @return The setting's current value, or 'def' if it is not defined
   4997          * or not a valid float.
   4998          */
   4999         public static float getFloat(ContentResolver cr, String name, float def) {
   5000             return getFloatForUser(cr, name, def, UserHandle.myUserId());
   5001         }
   5002 
   5003         /** @hide */
   5004         public static float getFloatForUser(ContentResolver cr, String name, float def,
   5005                 int userHandle) {
   5006             String v = getStringForUser(cr, name, userHandle);
   5007             try {
   5008                 return v != null ? Float.parseFloat(v) : def;
   5009             } catch (NumberFormatException e) {
   5010                 return def;
   5011             }
   5012         }
   5013 
   5014         /**
   5015          * Convenience function for retrieving a single secure settings value
   5016          * as a float.  Note that internally setting values are always
   5017          * stored as strings; this function converts the string to a float
   5018          * for you.
   5019          * <p>
   5020          * This version does not take a default value.  If the setting has not
   5021          * been set, or the string value is not a number,
   5022          * it throws {@link SettingNotFoundException}.
   5023          *
   5024          * @param cr The ContentResolver to access.
   5025          * @param name The name of the setting to retrieve.
   5026          *
   5027          * @throws SettingNotFoundException Thrown if a setting by the given
   5028          * name can't be found or the setting value is not a float.
   5029          *
   5030          * @return The setting's current value.
   5031          */
   5032         public static float getFloat(ContentResolver cr, String name)
   5033                 throws SettingNotFoundException {
   5034             return getFloatForUser(cr, name, UserHandle.myUserId());
   5035         }
   5036 
   5037         /** @hide */
   5038         public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
   5039                 throws SettingNotFoundException {
   5040             String v = getStringForUser(cr, name, userHandle);
   5041             if (v == null) {
   5042                 throw new SettingNotFoundException(name);
   5043             }
   5044             try {
   5045                 return Float.parseFloat(v);
   5046             } catch (NumberFormatException e) {
   5047                 throw new SettingNotFoundException(name);
   5048             }
   5049         }
   5050 
   5051         /**
   5052          * Convenience function for updating a single settings value as a
   5053          * floating point number. This will either create a new entry in the
   5054          * table if the given name does not exist, or modify the value of the
   5055          * existing row with that name.  Note that internally setting values
   5056          * are always stored as strings, so this function converts the given
   5057          * value to a string before storing it.
   5058          *
   5059          * @param cr The ContentResolver to access.
   5060          * @param name The name of the setting to modify.
   5061          * @param value The new value for the setting.
   5062          * @return true if the value was set, false on database errors
   5063          */
   5064         public static boolean putFloat(ContentResolver cr, String name, float value) {
   5065             return putFloatForUser(cr, name, value, UserHandle.myUserId());
   5066         }
   5067 
   5068         /** @hide */
   5069         public static boolean putFloatForUser(ContentResolver cr, String name, float value,
   5070                 int userHandle) {
   5071             return putStringForUser(cr, name, Float.toString(value), userHandle);
   5072         }
   5073 
   5074         /**
   5075          * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
   5076          * instead
   5077          */
   5078         @Deprecated
   5079         public static final String DEVELOPMENT_SETTINGS_ENABLED =
   5080                 Global.DEVELOPMENT_SETTINGS_ENABLED;
   5081 
   5082         /**
   5083          * When the user has enable the option to have a "bug report" command
   5084          * in the power menu.
   5085          * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
   5086          * @hide
   5087          */
   5088         @Deprecated
   5089         public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
   5090 
   5091         /**
   5092          * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
   5093          */
   5094         @Deprecated
   5095         public static final String ADB_ENABLED = Global.ADB_ENABLED;
   5096 
   5097         /**
   5098          * Setting to allow mock locations and location provider status to be injected into the
   5099          * LocationManager service for testing purposes during application development.  These
   5100          * locations and status values  override actual location and status information generated
   5101          * by network, gps, or other location providers.
   5102          *
   5103          * @deprecated This settings is not used anymore.
   5104          */
   5105         @Deprecated
   5106         public static final String ALLOW_MOCK_LOCATION = "mock_location";
   5107 
   5108         /**
   5109          * A 64-bit number (as a hex string) that is randomly
   5110          * generated when the user first sets up the device and should remain
   5111          * constant for the lifetime of the user's device. The value may
   5112          * change if a factory reset is performed on the device.
   5113          * <p class="note"><strong>Note:</strong> When a device has <a
   5114          * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a>
   5115          * (available on certain devices running Android 4.2 or higher), each user appears as a
   5116          * completely separate device, so the {@code ANDROID_ID} value is unique to each
   5117          * user.</p>
   5118          *
   5119          * <p class="note"><strong>Note:</strong> If the caller is an Instant App the id is scoped
   5120          * to the Instant App, it is generated when the Instant App is first installed and reset if
   5121          * the user clears the Instant App.
   5122          */
   5123         public static final String ANDROID_ID = "android_id";
   5124 
   5125         /**
   5126          * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
   5127          */
   5128         @Deprecated
   5129         public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
   5130 
   5131         /**
   5132          * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
   5133          */
   5134         @Deprecated
   5135         public static final String DATA_ROAMING = Global.DATA_ROAMING;
   5136 
   5137         /**
   5138          * Setting to record the input method used by default, holding the ID
   5139          * of the desired method.
   5140          */
   5141         public static final String DEFAULT_INPUT_METHOD = "default_input_method";
   5142 
   5143         /**
   5144          * Setting to record the input method subtype used by default, holding the ID
   5145          * of the desired method.
   5146          */
   5147         public static final String SELECTED_INPUT_METHOD_SUBTYPE =
   5148                 "selected_input_method_subtype";
   5149 
   5150         /**
   5151          * Setting to record the history of input method subtype, holding the pair of ID of IME
   5152          * and its last used subtype.
   5153          * @hide
   5154          */
   5155         public static final String INPUT_METHODS_SUBTYPE_HISTORY =
   5156                 "input_methods_subtype_history";
   5157 
   5158         /**
   5159          * Setting to record the visibility of input method selector
   5160          */
   5161         public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
   5162                 "input_method_selector_visibility";
   5163 
   5164         /**
   5165          * The currently selected voice interaction service flattened ComponentName.
   5166          * @hide
   5167          */
   5168         @TestApi
   5169         public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
   5170 
   5171         /**
   5172          * The currently selected autofill service flattened ComponentName.
   5173          * @hide
   5174          */
   5175         @TestApi
   5176         public static final String AUTOFILL_SERVICE = "autofill_service";
   5177 
   5178         /**
   5179          * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
   5180          */
   5181         @Deprecated
   5182         public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
   5183 
   5184         /**
   5185          * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
   5186          * @hide
   5187          */
   5188         public static final String USER_SETUP_COMPLETE = "user_setup_complete";
   5189 
   5190         /**
   5191          * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
   5192          * This value differs from USER_SETUP_COMPLETE in that it can be reset back to 0
   5193          * in case SetupWizard has been re-enabled on TV devices.
   5194          *
   5195          * @hide
   5196          */
   5197         public static final String TV_USER_SETUP_COMPLETE = "tv_user_setup_complete";
   5198 
   5199         /**
   5200          * Prefix for category name that marks whether a suggested action from that category was
   5201          * completed.
   5202          * @hide
   5203          */
   5204         public static final String COMPLETED_CATEGORY_PREFIX = "suggested.completed_category.";
   5205 
   5206         /**
   5207          * List of input methods that are currently enabled.  This is a string
   5208          * containing the IDs of all enabled input methods, each ID separated
   5209          * by ':'.
   5210          */
   5211         public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
   5212 
   5213         /**
   5214          * List of system input methods that are currently disabled.  This is a string
   5215          * containing the IDs of all disabled input methods, each ID separated
   5216          * by ':'.
   5217          * @hide
   5218          */
   5219         public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
   5220 
   5221         /**
   5222          * Whether to show the IME when a hard keyboard is connected. This is a boolean that
   5223          * determines if the IME should be shown when a hard keyboard is attached.
   5224          * @hide
   5225          */
   5226         public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
   5227 
   5228         /**
   5229          * Host name and port for global http proxy. Uses ':' seperator for
   5230          * between host and port.
   5231          *
   5232          * @deprecated Use {@link Global#HTTP_PROXY}
   5233          */
   5234         @Deprecated
   5235         public static final String HTTP_PROXY = Global.HTTP_PROXY;
   5236 
   5237         /**
   5238          * Package designated as always-on VPN provider.
   5239          *
   5240          * @hide
   5241          */
   5242         public static final String ALWAYS_ON_VPN_APP = "always_on_vpn_app";
   5243 
   5244         /**
   5245          * Whether to block networking outside of VPN connections while always-on is set.
   5246          * @see #ALWAYS_ON_VPN_APP
   5247          *
   5248          * @hide
   5249          */
   5250         public static final String ALWAYS_ON_VPN_LOCKDOWN = "always_on_vpn_lockdown";
   5251 
   5252         /**
   5253          * Whether applications can be installed for this user via the system's
   5254          * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
   5255          *
   5256          * <p>1 = permit app installation via the system package installer intent
   5257          * <p>0 = do not allow use of the package installer
   5258          * @deprecated Starting from {@link android.os.Build.VERSION_CODES#O}, apps should use
   5259          * {@link PackageManager#canRequestPackageInstalls()}
   5260          * @see PackageManager#canRequestPackageInstalls()
   5261          */
   5262         public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
   5263 
   5264         /**
   5265          * A flag to tell {@link com.android.server.devicepolicy.DevicePolicyManagerService} that
   5266          * the default for {@link #INSTALL_NON_MARKET_APPS} is reversed for this user on OTA. So it
   5267          * can set the restriction {@link android.os.UserManager#DISALLOW_INSTALL_UNKNOWN_SOURCES}
   5268          * on behalf of the profile owner if needed to make the change transparent for profile
   5269          * owners.
   5270          *
   5271          * @hide
   5272          */
   5273         public static final String UNKNOWN_SOURCES_DEFAULT_REVERSED =
   5274                 "unknown_sources_default_reversed";
   5275 
   5276         /**
   5277          * Comma-separated list of location providers that activities may access. Do not rely on
   5278          * this value being present in settings.db or on ContentObserver notifications on the
   5279          * corresponding Uri.
   5280          *
   5281          * @deprecated use {@link #LOCATION_MODE} and
   5282          * {@link LocationManager#MODE_CHANGED_ACTION} (or
   5283          * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
   5284          */
   5285         @Deprecated
   5286         public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
   5287 
   5288         /**
   5289          * The degree of location access enabled by the user.
   5290          * <p>
   5291          * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
   5292          * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
   5293          * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
   5294          * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
   5295          * modes that might be added in the future.
   5296          * <p>
   5297          * Note: do not rely on this value being present in settings.db or on ContentObserver
   5298          * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
   5299          * to receive changes in this value.
   5300          */
   5301         public static final String LOCATION_MODE = "location_mode";
   5302         /**
   5303          * Stores the previous location mode when {@link #LOCATION_MODE} is set to
   5304          * {@link #LOCATION_MODE_OFF}
   5305          * @hide
   5306          */
   5307         public static final String LOCATION_PREVIOUS_MODE = "location_previous_mode";
   5308 
   5309         /**
   5310          * Sets all location providers to the previous states before location was turned off.
   5311          * @hide
   5312          */
   5313         public static final int LOCATION_MODE_PREVIOUS = -1;
   5314         /**
   5315          * Location access disabled.
   5316          */
   5317         public static final int LOCATION_MODE_OFF = 0;
   5318         /**
   5319          * Network Location Provider disabled, but GPS and other sensors enabled.
   5320          */
   5321         public static final int LOCATION_MODE_SENSORS_ONLY = 1;
   5322         /**
   5323          * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
   5324          * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
   5325          * {@link android.location.Criteria#POWER_MEDIUM}.
   5326          */
   5327         public static final int LOCATION_MODE_BATTERY_SAVING = 2;
   5328         /**
   5329          * Best-effort location computation allowed.
   5330          */
   5331         public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
   5332 
   5333         /**
   5334          * A flag containing settings used for biometric weak
   5335          * @hide
   5336          */
   5337         @Deprecated
   5338         public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
   5339                 "lock_biometric_weak_flags";
   5340 
   5341         /**
   5342          * Whether lock-to-app will lock the keyguard when exiting.
   5343          * @hide
   5344          */
   5345         public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
   5346 
   5347         /**
   5348          * Whether autolock is enabled (0 = false, 1 = true)
   5349          *
   5350          * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
   5351          *             level of the keyguard. Accessing this setting from an app that is targeting
   5352          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
   5353          */
   5354         @Deprecated
   5355         public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
   5356 
   5357         /**
   5358          * Whether lock pattern is visible as user enters (0 = false, 1 = true)
   5359          *
   5360          * @deprecated Accessing this setting from an app that is targeting
   5361          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
   5362          */
   5363         @Deprecated
   5364         public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
   5365 
   5366         /**
   5367          * Whether lock pattern will vibrate as user enters (0 = false, 1 =
   5368          * true)
   5369          *
   5370          * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
   5371          *             lockscreen uses
   5372          *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
   5373          *             Accessing this setting from an app that is targeting
   5374          *             {@link VERSION_CODES#M} or later throws a {@code SecurityException}.
   5375          */
   5376         @Deprecated
   5377         public static final String
   5378                 LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
   5379 
   5380         /**
   5381          * This preference allows the device to be locked given time after screen goes off,
   5382          * subject to current DeviceAdmin policy limits.
   5383          * @hide
   5384          */
   5385         public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
   5386 
   5387 
   5388         /**
   5389          * This preference contains the string that shows for owner info on LockScreen.
   5390          * @hide
   5391          * @deprecated
   5392          */
   5393         @Deprecated
   5394         public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
   5395 
   5396         /**
   5397          * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
   5398          * @hide
   5399          */
   5400         @Deprecated
   5401         public static final String LOCK_SCREEN_APPWIDGET_IDS =
   5402             "lock_screen_appwidget_ids";
   5403 
   5404         /**
   5405          * Id of the appwidget shown on the lock screen when appwidgets are disabled.
   5406          * @hide
   5407          */
   5408         @Deprecated
   5409         public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
   5410             "lock_screen_fallback_appwidget_id";
   5411 
   5412         /**
   5413          * Index of the lockscreen appwidget to restore, -1 if none.
   5414          * @hide
   5415          */
   5416         @Deprecated
   5417         public static final String LOCK_SCREEN_STICKY_APPWIDGET =
   5418             "lock_screen_sticky_appwidget";
   5419 
   5420         /**
   5421          * This preference enables showing the owner info on LockScreen.
   5422          * @hide
   5423          * @deprecated
   5424          */
   5425         @Deprecated
   5426         public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
   5427             "lock_screen_owner_info_enabled";
   5428 
   5429         /**
   5430          * When set by a user, allows notifications to be shown atop a securely locked screen
   5431          * in their full "private" form (same as when the device is unlocked).
   5432          * @hide
   5433          */
   5434         public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
   5435                 "lock_screen_allow_private_notifications";
   5436 
   5437         /**
   5438          * When set by a user, allows notification remote input atop a securely locked screen
   5439          * without having to unlock
   5440          * @hide
   5441          */
   5442         public static final String LOCK_SCREEN_ALLOW_REMOTE_INPUT =
   5443                 "lock_screen_allow_remote_input";
   5444 
   5445         /**
   5446          * Set by the system to track if the user needs to see the call to action for
   5447          * the lockscreen notification policy.
   5448          * @hide
   5449          */
   5450         public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
   5451                 "show_note_about_notification_hiding";
   5452 
   5453         /**
   5454          * Set to 1 by the system after trust agents have been initialized.
   5455          * @hide
   5456          */
   5457         public static final String TRUST_AGENTS_INITIALIZED =
   5458                 "trust_agents_initialized";
   5459 
   5460         /**
   5461          * The Logging ID (a unique 64-bit value) as a hex string.
   5462          * Used as a pseudonymous identifier for logging.
   5463          * @deprecated This identifier is poorly initialized and has
   5464          * many collisions.  It should not be used.
   5465          */
   5466         @Deprecated
   5467         public static final String LOGGING_ID = "logging_id";
   5468 
   5469         /**
   5470          * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
   5471          */
   5472         @Deprecated
   5473         public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
   5474 
   5475         /**
   5476          * No longer supported.
   5477          */
   5478         public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
   5479 
   5480         /**
   5481          * No longer supported.
   5482          */
   5483         public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
   5484 
   5485         /**
   5486          * No longer supported.
   5487          */
   5488         public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
   5489 
   5490         /**
   5491          * Settings classname to launch when Settings is clicked from All
   5492          * Applications.  Needed because of user testing between the old
   5493          * and new Settings apps.
   5494          */
   5495         // TODO: 881807
   5496         public static final String SETTINGS_CLASSNAME = "settings_classname";
   5497 
   5498         /**
   5499          * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
   5500          */
   5501         @Deprecated
   5502         public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
   5503 
   5504         /**
   5505          * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
   5506          */
   5507         @Deprecated
   5508         public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
   5509 
   5510         /**
   5511          * If accessibility is enabled.
   5512          */
   5513         public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
   5514 
   5515         /**
   5516          * Setting specifying if the accessibility shortcut is enabled.
   5517          * @hide
   5518          */
   5519         public static final String ACCESSIBILITY_SHORTCUT_ENABLED =
   5520                 "accessibility_shortcut_enabled";
   5521 
   5522         /**
   5523          * Setting specifying if the accessibility shortcut is enabled.
   5524          * @hide
   5525          */
   5526         public static final String ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN =
   5527                 "accessibility_shortcut_on_lock_screen";
   5528 
   5529         /**
   5530          * Setting specifying if the accessibility shortcut dialog has been shown to this user.
   5531          * @hide
   5532          */
   5533         public static final String ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN =
   5534                 "accessibility_shortcut_dialog_shown";
   5535 
   5536         /**
   5537          * Setting specifying the accessibility service to be toggled via the accessibility
   5538          * shortcut. Must be its flattened {@link ComponentName}.
   5539          * @hide
   5540          */
   5541         public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE =
   5542                 "accessibility_shortcut_target_service";
   5543 
   5544         /**
   5545          * Setting specifying the accessibility service or feature to be toggled via the
   5546          * accessibility button in the navigation bar. This is either a flattened
   5547          * {@link ComponentName} or the class name of a system class implementing a supported
   5548          * accessibility feature.
   5549          * @hide
   5550          */
   5551         public static final String ACCESSIBILITY_BUTTON_TARGET_COMPONENT =
   5552                 "accessibility_button_target_component";
   5553 
   5554         /**
   5555          * If touch exploration is enabled.
   5556          */
   5557         public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
   5558 
   5559         /**
   5560          * List of the enabled accessibility providers.
   5561          */
   5562         public static final String ENABLED_ACCESSIBILITY_SERVICES =
   5563             "enabled_accessibility_services";
   5564 
   5565         /**
   5566          * List of the accessibility services to which the user has granted
   5567          * permission to put the device into touch exploration mode.
   5568          *
   5569          * @hide
   5570          */
   5571         public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
   5572             "touch_exploration_granted_accessibility_services";
   5573 
   5574         /**
   5575          * Whether to speak passwords while in accessibility mode.
   5576          *
   5577          * @deprecated The speaking of passwords is controlled by individual accessibility services.
   5578          * Apps should ignore this setting and provide complete information to accessibility
   5579          * at all times, which was the behavior when this value was {@code true}.
   5580          */
   5581         @Deprecated
   5582         public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
   5583 
   5584         /**
   5585          * Whether to draw text with high contrast while in accessibility mode.
   5586          *
   5587          * @hide
   5588          */
   5589         public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
   5590                 "high_text_contrast_enabled";
   5591 
   5592         /**
   5593          * Setting that specifies whether the display magnification is enabled via a system-wide
   5594          * triple tap gesture. Display magnifications allows the user to zoom in the display content
   5595          * and is targeted to low vision users. The current magnification scale is controlled by
   5596          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
   5597          *
   5598          * @hide
   5599          */
   5600         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
   5601                 "accessibility_display_magnification_enabled";
   5602 
   5603         /**
   5604          * Setting that specifies whether the display magnification is enabled via a shortcut
   5605          * affordance within the system's navigation area. Display magnifications allows the user to
   5606          * zoom in the display content and is targeted to low vision users. The current
   5607          * magnification scale is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
   5608          *
   5609          * @hide
   5610          */
   5611         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED =
   5612                 "accessibility_display_magnification_navbar_enabled";
   5613 
   5614         /**
   5615          * Setting that specifies what the display magnification scale is.
   5616          * Display magnifications allows the user to zoom in the display
   5617          * content and is targeted to low vision users. Whether a display
   5618          * magnification is performed is controlled by
   5619          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED} and
   5620          * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED}
   5621          *
   5622          * @hide
   5623          */
   5624         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
   5625                 "accessibility_display_magnification_scale";
   5626 
   5627         /**
   5628          * Unused mangnification setting
   5629          *
   5630          * @hide
   5631          * @deprecated
   5632          */
   5633         @Deprecated
   5634         public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
   5635                 "accessibility_display_magnification_auto_update";
   5636 
   5637         /**
   5638          * Setting that specifies what mode the soft keyboard is in (default or hidden). Can be
   5639          * modified from an AccessibilityService using the SoftKeyboardController.
   5640          *
   5641          * @hide
   5642          */
   5643         public static final String ACCESSIBILITY_SOFT_KEYBOARD_MODE =
   5644                 "accessibility_soft_keyboard_mode";
   5645 
   5646         /**
   5647          * Default soft keyboard behavior.
   5648          *
   5649          * @hide
   5650          */
   5651         public static final int SHOW_MODE_AUTO = 0;
   5652 
   5653         /**
   5654          * Soft keyboard is never shown.
   5655          *
   5656          * @hide
   5657          */
   5658         public static final int SHOW_MODE_HIDDEN = 1;
   5659 
   5660         /**
   5661          * Setting that specifies whether timed text (captions) should be
   5662          * displayed in video content. Text display properties are controlled by
   5663          * the following settings:
   5664          * <ul>
   5665          * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
   5666          * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
   5667          * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
   5668          * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
   5669          * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
   5670          * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
   5671          * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
   5672          * </ul>
   5673          *
   5674          * @hide
   5675          */
   5676         public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
   5677                 "accessibility_captioning_enabled";
   5678 
   5679         /**
   5680          * Setting that specifies the language for captions as a locale string,
   5681          * e.g. en_US.
   5682          *
   5683          * @see java.util.Locale#toString
   5684          * @hide
   5685          */
   5686         public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
   5687                 "accessibility_captioning_locale";
   5688 
   5689         /**
   5690          * Integer property that specifies the preset style for captions, one
   5691          * of:
   5692          * <ul>
   5693          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
   5694          * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
   5695          * </ul>
   5696          *
   5697          * @see java.util.Locale#toString
   5698          * @hide
   5699          */
   5700         public static final String ACCESSIBILITY_CAPTIONING_PRESET =
   5701                 "accessibility_captioning_preset";
   5702 
   5703         /**
   5704          * Integer property that specifes the background color for captions as a
   5705          * packed 32-bit color.
   5706          *
   5707          * @see android.graphics.Color#argb
   5708          * @hide
   5709          */
   5710         public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
   5711                 "accessibility_captioning_background_color";
   5712 
   5713         /**
   5714          * Integer property that specifes the foreground color for captions as a
   5715          * packed 32-bit color.
   5716          *
   5717          * @see android.graphics.Color#argb
   5718          * @hide
   5719          */
   5720         public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
   5721                 "accessibility_captioning_foreground_color";
   5722 
   5723         /**
   5724          * Integer property that specifes the edge type for captions, one of:
   5725          * <ul>
   5726          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
   5727          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
   5728          * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
   5729          * </ul>
   5730          *
   5731          * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
   5732          * @hide
   5733          */
   5734         public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
   5735                 "accessibility_captioning_edge_type";
   5736 
   5737         /**
   5738          * Integer property that specifes the edge color for captions as a
   5739          * packed 32-bit color.
   5740          *
   5741          * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
   5742          * @see android.graphics.Color#argb
   5743          * @hide
   5744          */
   5745         public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
   5746                 "accessibility_captioning_edge_color";
   5747 
   5748         /**
   5749          * Integer property that specifes the window color for captions as a
   5750          * packed 32-bit color.
   5751          *
   5752          * @see android.graphics.Color#argb
   5753          * @hide
   5754          */
   5755         public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
   5756                 "accessibility_captioning_window_color";
   5757 
   5758         /**
   5759          * String property that specifies the typeface for captions, one of:
   5760          * <ul>
   5761          * <li>DEFAULT
   5762          * <li>MONOSPACE
   5763          * <li>SANS_SERIF
   5764          * <li>SERIF
   5765          * </ul>
   5766          *
   5767          * @see android.graphics.Typeface
   5768          * @hide
   5769          */
   5770         public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
   5771                 "accessibility_captioning_typeface";
   5772 
   5773         /**
   5774          * Floating point property that specifies font scaling for captions.
   5775          *
   5776          * @hide
   5777          */
   5778         public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
   5779                 "accessibility_captioning_font_scale";
   5780 
   5781         /**
   5782          * Setting that specifies whether display color inversion is enabled.
   5783          */
   5784         public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
   5785                 "accessibility_display_inversion_enabled";
   5786 
   5787         /**
   5788          * Setting that specifies whether display color space adjustment is
   5789          * enabled.
   5790          *
   5791          * @hide
   5792          */
   5793         public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
   5794                 "accessibility_display_daltonizer_enabled";
   5795 
   5796         /**
   5797          * Integer property that specifies the type of color space adjustment to
   5798          * perform. Valid values are defined in AccessibilityManager.
   5799          *
   5800          * @hide
   5801          */
   5802         public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
   5803                 "accessibility_display_daltonizer";
   5804 
   5805         /**
   5806          * Setting that specifies whether automatic click when the mouse pointer stops moving is
   5807          * enabled.
   5808          *
   5809          * @hide
   5810          */
   5811         public static final String ACCESSIBILITY_AUTOCLICK_ENABLED =
   5812                 "accessibility_autoclick_enabled";
   5813 
   5814         /**
   5815          * Integer setting specifying amount of time in ms the mouse pointer has to stay still
   5816          * before performing click when {@link #ACCESSIBILITY_AUTOCLICK_ENABLED} is set.
   5817          *
   5818          * @see #ACCESSIBILITY_AUTOCLICK_ENABLED
   5819          * @hide
   5820          */
   5821         public static final String ACCESSIBILITY_AUTOCLICK_DELAY =
   5822                 "accessibility_autoclick_delay";
   5823 
   5824         /**
   5825          * Whether or not larger size icons are used for the pointer of mouse/trackpad for
   5826          * accessibility.
   5827          * (0 = false, 1 = true)
   5828          * @hide
   5829          */
   5830         public static final String ACCESSIBILITY_LARGE_POINTER_ICON =
   5831                 "accessibility_large_pointer_icon";
   5832 
   5833         /**
   5834          * The timeout for considering a press to be a long press in milliseconds.
   5835          * @hide
   5836          */
   5837         public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
   5838 
   5839         /**
   5840          * The duration in milliseconds between the first tap's up event and the second tap's
   5841          * down event for an interaction to be considered part of the same multi-press.
   5842          * @hide
   5843          */
   5844         public static final String MULTI_PRESS_TIMEOUT = "multi_press_timeout";
   5845 
   5846         /**
   5847          * List of the enabled print services.
   5848          *
   5849          * N and beyond uses {@link #DISABLED_PRINT_SERVICES}. But this might be used in an upgrade
   5850          * from pre-N.
   5851          *
   5852          * @hide
   5853          */
   5854         public static final String ENABLED_PRINT_SERVICES =
   5855             "enabled_print_services";
   5856 
   5857         /**
   5858          * List of the disabled print services.
   5859          *
   5860          * @hide
   5861          */
   5862         @TestApi
   5863         public static final String DISABLED_PRINT_SERVICES =
   5864             "disabled_print_services";
   5865 
   5866         /**
   5867          * The saved value for WindowManagerService.setForcedDisplayDensity()
   5868          * formatted as a single integer representing DPI. If unset, then use
   5869          * the real display density.
   5870          *
   5871          * @hide
   5872          */
   5873         public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
   5874 
   5875         /**
   5876          * Setting to always use the default text-to-speech settings regardless
   5877          * of the application settings.
   5878          * 1 = override application settings,
   5879          * 0 = use application settings (if specified).
   5880          *
   5881          * @deprecated  The value of this setting is no longer respected by
   5882          * the framework text to speech APIs as of the Ice Cream Sandwich release.
   5883          */
   5884         @Deprecated
   5885         public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
   5886 
   5887         /**
   5888          * Default text-to-speech engine speech rate. 100 = 1x
   5889          */
   5890         public static final String TTS_DEFAULT_RATE = "tts_default_rate";
   5891 
   5892         /**
   5893          * Default text-to-speech engine pitch. 100 = 1x
   5894          */
   5895         public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
   5896 
   5897         /**
   5898          * Default text-to-speech engine.
   5899          */
   5900         public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
   5901 
   5902         /**
   5903          * Default text-to-speech language.
   5904          *
   5905          * @deprecated this setting is no longer in use, as of the Ice Cream
   5906          * Sandwich release. Apps should never need to read this setting directly,
   5907          * instead can query the TextToSpeech framework classes for the default
   5908          * locale. {@link TextToSpeech#getLanguage()}.
   5909          */
   5910         @Deprecated
   5911         public static final String TTS_DEFAULT_LANG = "tts_default_lang";
   5912 
   5913         /**
   5914          * Default text-to-speech country.
   5915          *
   5916          * @deprecated this setting is no longer in use, as of the Ice Cream
   5917          * Sandwich release. Apps should never need to read this setting directly,
   5918          * instead can query the TextToSpeech framework classes for the default
   5919          * locale. {@link TextToSpeech#getLanguage()}.
   5920          */
   5921         @Deprecated
   5922         public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
   5923 
   5924         /**
   5925          * Default text-to-speech locale variant.
   5926          *
   5927          * @deprecated this setting is no longer in use, as of the Ice Cream
   5928          * Sandwich release. Apps should never need to read this setting directly,
   5929          * instead can query the TextToSpeech framework classes for the
   5930          * locale that is in use {@link TextToSpeech#getLanguage()}.
   5931          */
   5932         @Deprecated
   5933         public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
   5934 
   5935         /**
   5936          * Stores the default tts locales on a per engine basis. Stored as
   5937          * a comma seperated list of values, each value being of the form
   5938          * {@code engine_name:locale} for example,
   5939          * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
   5940          * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
   5941          * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
   5942          * setting directly, and can query the TextToSpeech framework classes
   5943          * for the locale that is in use.
   5944          *
   5945          * @hide
   5946          */
   5947         public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
   5948 
   5949         /**
   5950          * Space delimited list of plugin packages that are enabled.
   5951          */
   5952         public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
   5953 
   5954         /**
   5955          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
   5956          * instead.
   5957          */
   5958         @Deprecated
   5959         public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
   5960                 Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
   5961 
   5962         /**
   5963          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
   5964          * instead.
   5965          */
   5966         @Deprecated
   5967         public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
   5968                 Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
   5969 
   5970         /**
   5971          * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
   5972          * instead.
   5973          */
   5974         @Deprecated
   5975         public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
   5976                 Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
   5977 
   5978         /**
   5979          * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
   5980          * instead.
   5981          */
   5982         @Deprecated
   5983         public static final String WIFI_ON = Global.WIFI_ON;
   5984 
   5985         /**
   5986          * The acceptable packet loss percentage (range 0 - 100) before trying
   5987          * another AP on the same network.
   5988          * @deprecated This setting is not used.
   5989          */
   5990         @Deprecated
   5991         public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
   5992                 "wifi_watchdog_acceptable_packet_loss_percentage";
   5993 
   5994         /**
   5995          * The number of access points required for a network in order for the
   5996          * watchdog to monitor it.
   5997          * @deprecated This setting is not used.
   5998          */
   5999         @Deprecated
   6000         public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
   6001 
   6002         /**
   6003          * The delay between background checks.
   6004          * @deprecated This setting is not used.
   6005          */
   6006         @Deprecated
   6007         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
   6008                 "wifi_watchdog_background_check_delay_ms";
   6009 
   6010         /**
   6011          * Whether the Wi-Fi watchdog is enabled for background checking even
   6012          * after it thinks the user has connected to a good access point.
   6013          * @deprecated This setting is not used.
   6014          */
   6015         @Deprecated
   6016         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
   6017                 "wifi_watchdog_background_check_enabled";
   6018 
   6019         /**
   6020          * The timeout for a background ping
   6021          * @deprecated This setting is not used.
   6022          */
   6023         @Deprecated
   6024         public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
   6025                 "wifi_watchdog_background_check_timeout_ms";
   6026 
   6027         /**
   6028          * The number of initial pings to perform that *may* be ignored if they
   6029          * fail. Again, if these fail, they will *not* be used in packet loss
   6030          * calculation. For example, one network always seemed to time out for
   6031          * the first couple pings, so this is set to 3 by default.
   6032          * @deprecated This setting is not used.
   6033          */
   6034         @Deprecated
   6035         public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
   6036             "wifi_watchdog_initial_ignored_ping_count";
   6037 
   6038         /**
   6039          * The maximum number of access points (per network) to attempt to test.
   6040          * If this number is reached, the watchdog will no longer monitor the
   6041          * initial connection state for the network. This is a safeguard for
   6042          * networks containing multiple APs whose DNS does not respond to pings.
   6043          * @deprecated This setting is not used.
   6044          */
   6045         @Deprecated
   6046         public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
   6047 
   6048         /**
   6049          * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
   6050          */
   6051         @Deprecated
   6052         public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
   6053 
   6054         /**
   6055          * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
   6056          * @deprecated This setting is not used.
   6057          */
   6058         @Deprecated
   6059         public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
   6060 
   6061         /**
   6062          * The number of pings to test if an access point is a good connection.
   6063          * @deprecated This setting is not used.
   6064          */
   6065         @Deprecated
   6066         public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
   6067 
   6068         /**
   6069          * The delay between pings.
   6070          * @deprecated This setting is not used.
   6071          */
   6072         @Deprecated
   6073         public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
   6074 
   6075         /**
   6076          * The timeout per ping.
   6077          * @deprecated This setting is not used.
   6078          */
   6079         @Deprecated
   6080         public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
   6081 
   6082         /**
   6083          * @deprecated Use
   6084          * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
   6085          */
   6086         @Deprecated
   6087         public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
   6088 
   6089         /**
   6090          * @deprecated Use
   6091          * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
   6092          */
   6093         @Deprecated
   6094         public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
   6095                 Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
   6096 
   6097         /**
   6098          * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
   6099          * the receivers of the PendingIntent an opportunity to make a new network request before
   6100          * the Network satisfying the request is potentially removed.
   6101          *
   6102          * @hide
   6103          */
   6104         public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
   6105                 "connectivity_release_pending_intent_delay_ms";
   6106 
   6107         /**
   6108          * Whether background data usage is allowed.
   6109          *
   6110          * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
   6111          *             availability of background data depends on several
   6112          *             combined factors. When background data is unavailable,
   6113          *             {@link ConnectivityManager#getActiveNetworkInfo()} will
   6114          *             now appear disconnected.
   6115          */
   6116         @Deprecated
   6117         public static final String BACKGROUND_DATA = "background_data";
   6118 
   6119         /**
   6120          * Origins for which browsers should allow geolocation by default.
   6121          * The value is a space-separated list of origins.
   6122          */
   6123         public static final String ALLOWED_GEOLOCATION_ORIGINS
   6124                 = "allowed_geolocation_origins";
   6125 
   6126         /**
   6127          * The preferred TTY mode     0 = TTy Off, CDMA default
   6128          *                            1 = TTY Full
   6129          *                            2 = TTY HCO
   6130          *                            3 = TTY VCO
   6131          * @hide
   6132          */
   6133         public static final String PREFERRED_TTY_MODE =
   6134                 "preferred_tty_mode";
   6135 
   6136         /**
   6137          * Whether the enhanced voice privacy mode is enabled.
   6138          * 0 = normal voice privacy
   6139          * 1 = enhanced voice privacy
   6140          * @hide
   6141          */
   6142         public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
   6143 
   6144         /**
   6145          * Whether the TTY mode mode is enabled.
   6146          * 0 = disabled
   6147          * 1 = enabled
   6148          * @hide
   6149          */
   6150         public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
   6151 
   6152         /**
   6153          * Controls whether settings backup is enabled.
   6154          * Type: int ( 0 = disabled, 1 = enabled )
   6155          * @hide
   6156          */
   6157         public static final String BACKUP_ENABLED = "backup_enabled";
   6158 
   6159         /**
   6160          * Controls whether application data is automatically restored from backup
   6161          * at install time.
   6162          * Type: int ( 0 = disabled, 1 = enabled )
   6163          * @hide
   6164          */
   6165         public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
   6166 
   6167         /**
   6168          * Indicates whether settings backup has been fully provisioned.
   6169          * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
   6170          * @hide
   6171          */
   6172         public static final String BACKUP_PROVISIONED = "backup_provisioned";
   6173 
   6174         /**
   6175          * Component of the transport to use for backup/restore.
   6176          * @hide
   6177          */
   6178         public static final String BACKUP_TRANSPORT = "backup_transport";
   6179 
   6180         /**
   6181          * Version for which the setup wizard was last shown.  Bumped for
   6182          * each release when there is new setup information to show.
   6183          * @hide
   6184          */
   6185         public static final String LAST_SETUP_SHOWN = "last_setup_shown";
   6186 
   6187         /**
   6188          * The interval in milliseconds after which Wi-Fi is considered idle.
   6189          * When idle, it is possible for the device to be switched from Wi-Fi to
   6190          * the mobile data network.
   6191          * @hide
   6192          * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
   6193          * instead.
   6194          */
   6195         @Deprecated
   6196         public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
   6197 
   6198         /**
   6199          * The global search provider chosen by the user (if multiple global
   6200          * search providers are installed). This will be the provider returned
   6201          * by {@link SearchManager#getGlobalSearchActivity()} if it's still
   6202          * installed. This setting is stored as a flattened component name as
   6203          * per {@link ComponentName#flattenToString()}.
   6204          *
   6205          * @hide
   6206          */
   6207         public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
   6208                 "search_global_search_activity";
   6209 
   6210         /**
   6211          * The number of promoted sources in GlobalSearch.
   6212          * @hide
   6213          */
   6214         public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
   6215         /**
   6216          * The maximum number of suggestions returned by GlobalSearch.
   6217          * @hide
   6218          */
   6219         public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
   6220         /**
   6221          * The number of suggestions GlobalSearch will ask each non-web search source for.
   6222          * @hide
   6223          */
   6224         public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
   6225         /**
   6226          * The number of suggestions the GlobalSearch will ask the web search source for.
   6227          * @hide
   6228          */
   6229         public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
   6230                 "search_web_results_override_limit";
   6231         /**
   6232          * The number of milliseconds that GlobalSearch will wait for suggestions from
   6233          * promoted sources before continuing with all other sources.
   6234          * @hide
   6235          */
   6236         public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
   6237                 "search_promoted_source_deadline_millis";
   6238         /**
   6239          * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
   6240          * @hide
   6241          */
   6242         public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
   6243         /**
   6244          * The maximum number of milliseconds that GlobalSearch shows the previous results
   6245          * after receiving a new query.
   6246          * @hide
   6247          */
   6248         public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
   6249         /**
   6250          * The maximum age of log data used for shortcuts in GlobalSearch.
   6251          * @hide
   6252          */
   6253         public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
   6254         /**
   6255          * The maximum age of log data used for source ranking in GlobalSearch.
   6256          * @hide
   6257          */
   6258         public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
   6259                 "search_max_source_event_age_millis";
   6260         /**
   6261          * The minimum number of impressions needed to rank a source in GlobalSearch.
   6262          * @hide
   6263          */
   6264         public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
   6265                 "search_min_impressions_for_source_ranking";
   6266         /**
   6267          * The minimum number of clicks needed to rank a source in GlobalSearch.
   6268          * @hide
   6269          */
   6270         public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
   6271                 "search_min_clicks_for_source_ranking";
   6272         /**
   6273          * The maximum number of shortcuts shown by GlobalSearch.
   6274          * @hide
   6275          */
   6276         public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
   6277         /**
   6278          * The size of the core thread pool for suggestion queries in GlobalSearch.
   6279          * @hide
   6280          */
   6281         public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
   6282                 "search_query_thread_core_pool_size";
   6283         /**
   6284          * The maximum size of the thread pool for suggestion queries in GlobalSearch.
   6285          * @hide
   6286          */
   6287         public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
   6288                 "search_query_thread_max_pool_size";
   6289         /**
   6290          * The size of the core thread pool for shortcut refreshing in GlobalSearch.
   6291          * @hide
   6292          */
   6293         public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
   6294                 "search_shortcut_refresh_core_pool_size";
   6295         /**
   6296          * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
   6297          * @hide
   6298          */
   6299         public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
   6300                 "search_shortcut_refresh_max_pool_size";
   6301         /**
   6302          * The maximun time that excess threads in the GlobalSeach thread pools will
   6303          * wait before terminating.
   6304          * @hide
   6305          */
   6306         public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
   6307                 "search_thread_keepalive_seconds";
   6308         /**
   6309          * The maximum number of concurrent suggestion queries to each source.
   6310          * @hide
   6311          */
   6312         public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
   6313                 "search_per_source_concurrent_query_limit";
   6314 
   6315         /**
   6316          * Whether or not alert sounds are played on StorageManagerService events.
   6317          * (0 = false, 1 = true)
   6318          * @hide
   6319          */
   6320         public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
   6321 
   6322         /**
   6323          * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
   6324          * @hide
   6325          */
   6326         public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
   6327 
   6328         /**
   6329          * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
   6330          * @hide
   6331          */
   6332         public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
   6333 
   6334         /**
   6335          * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
   6336          * @hide
   6337          */
   6338         public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
   6339 
   6340         /**
   6341          * If nonzero, ANRs in invisible background processes bring up a dialog.
   6342          * Otherwise, the process will be silently killed.
   6343          *
   6344          * Also prevents ANRs and crash dialogs from being suppressed.
   6345          * @hide
   6346          */
   6347         public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
   6348 
   6349         /**
   6350          * The {@link ComponentName} string of the service to be used as the voice recognition
   6351          * service.
   6352          *
   6353          * @hide
   6354          */
   6355         public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
   6356 
   6357         /**
   6358          * Stores whether an user has consented to have apps verified through PAM.
   6359          * The value is boolean (1 or 0).
   6360          *
   6361          * @hide
   6362          */
   6363         public static final String PACKAGE_VERIFIER_USER_CONSENT =
   6364             "package_verifier_user_consent";
   6365 
   6366         /**
   6367          * The {@link ComponentName} string of the selected spell checker service which is
   6368          * one of the services managed by the text service manager.
   6369          *
   6370          * @hide
   6371          */
   6372         public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
   6373 
   6374         /**
   6375          * The {@link ComponentName} string of the selected subtype of the selected spell checker
   6376          * service which is one of the services managed by the text service manager.
   6377          *
   6378          * @hide
   6379          */
   6380         public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
   6381                 "selected_spell_checker_subtype";
   6382 
   6383         /**
   6384          * The {@link ComponentName} string whether spell checker is enabled or not.
   6385          *
   6386          * @hide
   6387          */
   6388         public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
   6389 
   6390         /**
   6391          * What happens when the user presses the Power button while in-call
   6392          * and the screen is on.<br/>
   6393          * <b>Values:</b><br/>
   6394          * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
   6395          * 2 - The Power button hangs up the current call.<br/>
   6396          *
   6397          * @hide
   6398          */
   6399         public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
   6400 
   6401         /**
   6402          * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
   6403          * @hide
   6404          */
   6405         public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
   6406 
   6407         /**
   6408          * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
   6409          * @hide
   6410          */
   6411         public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
   6412 
   6413         /**
   6414          * INCALL_POWER_BUTTON_BEHAVIOR default value.
   6415          * @hide
   6416          */
   6417         public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
   6418                 INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
   6419 
   6420         /**
   6421          * What happens when the user presses the Back button while in-call
   6422          * and the screen is on.<br/>
   6423          * <b>Values:</b><br/>
   6424          * 0 - The Back buttons does nothing different.<br/>
   6425          * 1 - The Back button hangs up the current call.<br/>
   6426          *
   6427          * @hide
   6428          */
   6429         public static final String INCALL_BACK_BUTTON_BEHAVIOR = "incall_back_button_behavior";
   6430 
   6431         /**
   6432          * INCALL_BACK_BUTTON_BEHAVIOR value for no action.
   6433          * @hide
   6434          */
   6435         public static final int INCALL_BACK_BUTTON_BEHAVIOR_NONE = 0x0;
   6436 
   6437         /**
   6438          * INCALL_BACK_BUTTON_BEHAVIOR value for "hang up".
   6439          * @hide
   6440          */
   6441         public static final int INCALL_BACK_BUTTON_BEHAVIOR_HANGUP = 0x1;
   6442 
   6443         /**
   6444          * INCALL_POWER_BUTTON_BEHAVIOR default value.
   6445          * @hide
   6446          */
   6447         public static final int INCALL_BACK_BUTTON_BEHAVIOR_DEFAULT =
   6448                 INCALL_BACK_BUTTON_BEHAVIOR_NONE;
   6449 
   6450         /**
   6451          * Whether the device should wake when the wake gesture sensor detects motion.
   6452          * @hide
   6453          */
   6454         public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
   6455 
   6456         /**
   6457          * Whether the device should doze if configured.
   6458          * @hide
   6459          */
   6460         public static final String DOZE_ENABLED = "doze_enabled";
   6461 
   6462         /**
   6463          * Whether doze should be always on.
   6464          * @hide
   6465          */
   6466         public static final String DOZE_ALWAYS_ON = "doze_always_on";
   6467 
   6468         /**
   6469          * Whether the device should pulse on pick up gesture.
   6470          * @hide
   6471          */
   6472         public static final String DOZE_PULSE_ON_PICK_UP = "doze_pulse_on_pick_up";
   6473 
   6474         /**
   6475          * Whether the device should pulse on double tap gesture.
   6476          * @hide
   6477          */
   6478         public static final String DOZE_PULSE_ON_DOUBLE_TAP = "doze_pulse_on_double_tap";
   6479 
   6480         /**
   6481          * The current night mode that has been selected by the user.  Owned
   6482          * and controlled by UiModeManagerService.  Constants are as per
   6483          * UiModeManager.
   6484          * @hide
   6485          */
   6486         public static final String UI_NIGHT_MODE = "ui_night_mode";
   6487 
   6488         /**
   6489          * Whether screensavers are enabled.
   6490          * @hide
   6491          */
   6492         public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
   6493 
   6494         /**
   6495          * The user's chosen screensaver components.
   6496          *
   6497          * These will be launched by the PhoneWindowManager after a timeout when not on
   6498          * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
   6499          * @hide
   6500          */
   6501         public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
   6502 
   6503         /**
   6504          * If screensavers are enabled, whether the screensaver should be automatically launched
   6505          * when the device is inserted into a (desk) dock.
   6506          * @hide
   6507          */
   6508         public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
   6509 
   6510         /**
   6511          * If screensavers are enabled, whether the screensaver should be automatically launched
   6512          * when the screen times out when not on battery.
   6513          * @hide
   6514          */
   6515         public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
   6516 
   6517         /**
   6518          * If screensavers are enabled, the default screensaver component.
   6519          * @hide
   6520          */
   6521         public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
   6522 
   6523         /**
   6524          * The default NFC payment component
   6525          * @hide
   6526          */
   6527         public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
   6528 
   6529         /**
   6530          * Whether NFC payment is handled by the foreground application or a default.
   6531          * @hide
   6532          */
   6533         public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
   6534 
   6535         /**
   6536          * Specifies the package name currently configured to be the primary sms application
   6537          * @hide
   6538          */
   6539         public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
   6540 
   6541         /**
   6542          * Specifies the package name currently configured to be the default dialer application
   6543          * @hide
   6544          */
   6545         public static final String DIALER_DEFAULT_APPLICATION = "dialer_default_application";
   6546 
   6547         /**
   6548          * Specifies the package name currently configured to be the emergency assistance application
   6549          *
   6550          * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
   6551          *
   6552          * @hide
   6553          */
   6554         public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
   6555 
   6556         /**
   6557          * Specifies whether the current app context on scren (assist data) will be sent to the
   6558          * assist application (active voice interaction service).
   6559          *
   6560          * @hide
   6561          */
   6562         public static final String ASSIST_STRUCTURE_ENABLED = "assist_structure_enabled";
   6563 
   6564         /**
   6565          * Specifies whether a screenshot of the screen contents will be sent to the assist
   6566          * application (active voice interaction service).
   6567          *
   6568          * @hide
   6569          */
   6570         public static final String ASSIST_SCREENSHOT_ENABLED = "assist_screenshot_enabled";
   6571 
   6572         /**
   6573          * Specifies whether the screen will show an animation if screen contents are sent to the
   6574          * assist application (active voice interaction service).
   6575          *
   6576          * Note that the disclosure will be forced for third-party assistants or if the device
   6577          * does not support disabling it.
   6578          *
   6579          * @hide
   6580          */
   6581         public static final String ASSIST_DISCLOSURE_ENABLED = "assist_disclosure_enabled";
   6582 
   6583         /**
   6584          * Name of the service components that the current user has explicitly allowed to
   6585          * see and assist with all of the user's notifications.
   6586          *
   6587          * @hide
   6588          */
   6589         public static final String ENABLED_NOTIFICATION_ASSISTANT =
   6590                 "enabled_notification_assistant";
   6591 
   6592         /**
   6593          * Names of the service components that the current user has explicitly allowed to
   6594          * see all of the user's notifications, separated by ':'.
   6595          *
   6596          * @hide
   6597          */
   6598         public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
   6599 
   6600         /**
   6601          * Names of the packages that the current user has explicitly allowed to
   6602          * manage notification policy configuration, separated by ':'.
   6603          *
   6604          * @hide
   6605          */
   6606         @TestApi
   6607         public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES =
   6608                 "enabled_notification_policy_access_packages";
   6609 
   6610         /**
   6611          * Defines whether managed profile ringtones should be synced from it's parent profile
   6612          * <p>
   6613          * 0 = ringtones are not synced
   6614          * 1 = ringtones are synced from the profile's parent (default)
   6615          * <p>
   6616          * This value is only used for managed profiles.
   6617          * @hide
   6618          */
   6619         @TestApi
   6620         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
   6621         public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
   6622 
   6623         /** @hide */
   6624         public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
   6625 
   6626         /**
   6627          * This is the query URI for finding a print service to install.
   6628          *
   6629          * @hide
   6630          */
   6631         public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
   6632 
   6633         /**
   6634          * This is the query URI for finding a NFC payment service to install.
   6635          *
   6636          * @hide
   6637          */
   6638         public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
   6639 
   6640         /**
   6641          * This is the query URI for finding a auto fill service to install.
   6642          *
   6643          * @hide
   6644          */
   6645         public static final String AUTOFILL_SERVICE_SEARCH_URI = "autofill_service_search_uri";
   6646 
   6647         /**
   6648          * If enabled, apps should try to skip any introductory hints on first launch. This might
   6649          * apply to users that are already familiar with the environment or temporary users.
   6650          * <p>
   6651          * Type : int (0 to show hints, 1 to skip showing hints)
   6652          */
   6653         public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
   6654 
   6655         /**
   6656          * Persisted playback time after a user confirmation of an unsafe volume level.
   6657          *
   6658          * @hide
   6659          */
   6660         public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
   6661 
   6662         /**
   6663          * This preference enables notification display on the lockscreen.
   6664          * @hide
   6665          */
   6666         public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
   6667                 "lock_screen_show_notifications";
   6668 
   6669         /**
   6670          * This preference stores the last stack active task time for each user, which affects what
   6671          * tasks will be visible in Overview.
   6672          * @hide
   6673          */
   6674         public static final String OVERVIEW_LAST_STACK_ACTIVE_TIME =
   6675                 "overview_last_stack_active_time";
   6676 
   6677         /**
   6678          * List of TV inputs that are currently hidden. This is a string
   6679          * containing the IDs of all hidden TV inputs. Each ID is encoded by
   6680          * {@link android.net.Uri#encode(String)} and separated by ':'.
   6681          * @hide
   6682          */
   6683         public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
   6684 
   6685         /**
   6686          * List of custom TV input labels. This is a string containing <TV input id, custom name>
   6687          * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
   6688          * and separated by ','. Each pair is separated by ':'.
   6689          * @hide
   6690          */
   6691         public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
   6692 
   6693         /**
   6694          * Whether automatic routing of system audio to USB audio peripheral is disabled.
   6695          * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
   6696          * and 0 means automatic routing is enabled.
   6697          *
   6698          * @hide
   6699          */
   6700         public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
   6701                 "usb_audio_automatic_routing_disabled";
   6702 
   6703         /**
   6704          * The timeout in milliseconds before the device fully goes to sleep after
   6705          * a period of inactivity.  This value sets an upper bound on how long the device
   6706          * will stay awake or dreaming without user activity.  It should generally
   6707          * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
   6708          * will sleep before it ever has a chance to dream.
   6709          * <p>
   6710          * Use -1 to disable this timeout.
   6711          * </p>
   6712          *
   6713          * @hide
   6714          */
   6715         public static final String SLEEP_TIMEOUT = "sleep_timeout";
   6716 
   6717         /**
   6718          * Controls whether double tap to wake is enabled.
   6719          * @hide
   6720          */
   6721         public static final String DOUBLE_TAP_TO_WAKE = "double_tap_to_wake";
   6722 
   6723         /**
   6724          * The current assistant component. It could be a voice interaction service,
   6725          * or an activity that handles ACTION_ASSIST, or empty which means using the default
   6726          * handling.
   6727          *
   6728          * @hide
   6729          */
   6730         public static final String ASSISTANT = "assistant";
   6731 
   6732         /**
   6733          * Whether the camera launch gesture should be disabled.
   6734          *
   6735          * @hide
   6736          */
   6737         public static final String CAMERA_GESTURE_DISABLED = "camera_gesture_disabled";
   6738 
   6739         /**
   6740          * Whether the camera launch gesture to double tap the power button when the screen is off
   6741          * should be disabled.
   6742          *
   6743          * @hide
   6744          */
   6745         public static final String CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED =
   6746                 "camera_double_tap_power_gesture_disabled";
   6747 
   6748         /**
   6749          * Whether the camera double twist gesture to flip between front and back mode should be
   6750          * enabled.
   6751          *
   6752          * @hide
   6753          */
   6754         public static final String CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED =
   6755                 "camera_double_twist_to_flip_enabled";
   6756 
   6757         /**
   6758          * Whether the assist gesture should be enabled.
   6759          *
   6760          * @hide
   6761          */
   6762         public static final String ASSIST_GESTURE_ENABLED = "assist_gesture_enabled";
   6763 
   6764         /**
   6765          * Sensitivity control for the assist gesture.
   6766          *
   6767          * @hide
   6768          */
   6769         public static final String ASSIST_GESTURE_SENSITIVITY = "assist_gesture_sensitivity";
   6770 
   6771         /**
   6772          * Control whether Night display is currently activated.
   6773          * @hide
   6774          */
   6775         public static final String NIGHT_DISPLAY_ACTIVATED = "night_display_activated";
   6776 
   6777         /**
   6778          * Control whether Night display will automatically activate/deactivate.
   6779          * @hide
   6780          */
   6781         public static final String NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode";
   6782 
   6783         /**
   6784          * Control the color temperature of Night Display, represented in Kelvin.
   6785          * @hide
   6786          */
   6787         public static final String NIGHT_DISPLAY_COLOR_TEMPERATURE =
   6788                 "night_display_color_temperature";
   6789 
   6790         /**
   6791          * Custom time when Night display is scheduled to activate.
   6792          * Represented as milliseconds from midnight (e.g. 79200000 == 10pm).
   6793          * @hide
   6794          */
   6795         public static final String NIGHT_DISPLAY_CUSTOM_START_TIME =
   6796                 "night_display_custom_start_time";
   6797 
   6798         /**
   6799          * Custom time when Night display is scheduled to deactivate.
   6800          * Represented as milliseconds from midnight (e.g. 21600000 == 6am).
   6801          * @hide
   6802          */
   6803         public static final String NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time";
   6804 
   6805         /**
   6806          * Time in milliseconds (since epoch) when Night display was last activated. Use to decide
   6807          * whether to apply the current activated state after a reboot or user change.
   6808          * @hide
   6809          */
   6810         public static final String NIGHT_DISPLAY_LAST_ACTIVATED_TIME =
   6811                 "night_display_last_activated_time";
   6812 
   6813         /**
   6814          * Names of the service components that the current user has explicitly allowed to
   6815          * be a VR mode listener, separated by ':'.
   6816          *
   6817          * @hide
   6818          */
   6819         public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
   6820 
   6821         /**
   6822          * Behavior of the display while in VR mode.
   6823          *
   6824          * One of {@link #VR_DISPLAY_MODE_LOW_PERSISTENCE} or {@link #VR_DISPLAY_MODE_OFF}.
   6825          *
   6826          * @hide
   6827          */
   6828         public static final String VR_DISPLAY_MODE = "vr_display_mode";
   6829 
   6830         /**
   6831          * Lower the display persistence while the system is in VR mode.
   6832          *
   6833          * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
   6834          *
   6835          * @hide.
   6836          */
   6837         public static final int VR_DISPLAY_MODE_LOW_PERSISTENCE = 0;
   6838 
   6839         /**
   6840          * Do not alter the display persistence while the system is in VR mode.
   6841          *
   6842          * @see PackageManager#FEATURE_VR_MODE_HIGH_PERFORMANCE
   6843          *
   6844          * @hide.
   6845          */
   6846         public static final int VR_DISPLAY_MODE_OFF = 1;
   6847 
   6848         /**
   6849          * Whether CarrierAppUtils#disableCarrierAppsUntilPrivileged has been executed at least
   6850          * once.
   6851          *
   6852          * <p>This is used to ensure that we only take one pass which will disable apps that are not
   6853          * privileged (if any). From then on, we only want to enable apps (when a matching SIM is
   6854          * inserted), to avoid disabling an app that the user might actively be using.
   6855          *
   6856          * <p>Will be set to 1 once executed.
   6857          *
   6858          * @hide
   6859          */
   6860         public static final String CARRIER_APPS_HANDLED = "carrier_apps_handled";
   6861 
   6862         /**
   6863          * Whether parent user can access remote contact in managed profile.
   6864          *
   6865          * @hide
   6866          */
   6867         public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
   6868                 "managed_profile_contact_remote_search";
   6869 
   6870         /**
   6871          * Whether or not the automatic storage manager is enabled and should run on the device.
   6872          *
   6873          * @hide
   6874          */
   6875         public static final String AUTOMATIC_STORAGE_MANAGER_ENABLED =
   6876                 "automatic_storage_manager_enabled";
   6877 
   6878         /**
   6879          * How many days of information for the automatic storage manager to retain on the device.
   6880          *
   6881          * @hide
   6882          */
   6883         public static final String AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN =
   6884                 "automatic_storage_manager_days_to_retain";
   6885 
   6886         /**
   6887          * Default number of days of information for the automatic storage manager to retain.
   6888          *
   6889          * @hide
   6890          */
   6891         public static final int AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT = 90;
   6892 
   6893         /**
   6894          * How many bytes the automatic storage manager has cleared out.
   6895          *
   6896          * @hide
   6897          */
   6898         public static final String AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED =
   6899                 "automatic_storage_manager_bytes_cleared";
   6900 
   6901 
   6902         /**
   6903          * Last run time for the automatic storage manager.
   6904          *
   6905          * @hide
   6906          */
   6907         public static final String AUTOMATIC_STORAGE_MANAGER_LAST_RUN =
   6908                 "automatic_storage_manager_last_run";
   6909 
   6910         /**
   6911          * Whether SystemUI navigation keys is enabled.
   6912          * @hide
   6913          */
   6914         public static final String SYSTEM_NAVIGATION_KEYS_ENABLED =
   6915                 "system_navigation_keys_enabled";
   6916 
   6917         /**
   6918          * Holds comma separated list of ordering of QS tiles.
   6919          * @hide
   6920          */
   6921         public static final String QS_TILES = "sysui_qs_tiles";
   6922 
   6923         /**
   6924          * Whether preloaded APKs have been installed for the user.
   6925          * @hide
   6926          */
   6927         public static final String DEMO_USER_SETUP_COMPLETE
   6928                 = "demo_user_setup_complete";
   6929 
   6930         /**
   6931          * Specifies whether the web action API is enabled.
   6932          *
   6933          * @hide
   6934          */
   6935         @SystemApi
   6936         public static final String INSTANT_APPS_ENABLED = "instant_apps_enabled";
   6937 
   6938         /**
   6939          * Has this pairable device been paired or upgraded from a previously paired system.
   6940          * @hide
   6941          */
   6942         public static final String DEVICE_PAIRED = "device_paired";
   6943 
   6944         /**
   6945          * Integer state indicating whether package verifier is enabled.
   6946          * TODO(b/34259924): Remove this setting.
   6947          *
   6948          * @hide
   6949          */
   6950         public static final String PACKAGE_VERIFIER_STATE = "package_verifier_state";
   6951 
   6952         /**
   6953          * Specifies additional package name for broadcasting the CMAS messages.
   6954          * @hide
   6955          */
   6956         public static final String CMAS_ADDITIONAL_BROADCAST_PKG = "cmas_additional_broadcast_pkg";
   6957 
   6958         /**
   6959          * Whether the launcher should show any notification badges.
   6960          * The value is boolean (1 or 0).
   6961          * @hide
   6962          */
   6963         public static final String NOTIFICATION_BADGING = "notification_badging";
   6964 
   6965         /**
   6966          * This are the settings to be backed up.
   6967          *
   6968          * NOTE: Settings are backed up and restored in the order they appear
   6969          *       in this array. If you have one setting depending on another,
   6970          *       make sure that they are ordered appropriately.
   6971          *
   6972          * @hide
   6973          */
   6974         public static final String[] SETTINGS_TO_BACKUP = {
   6975             BUGREPORT_IN_POWER_MENU,                            // moved to global
   6976             ALLOW_MOCK_LOCATION,
   6977             PARENTAL_CONTROL_ENABLED,
   6978             PARENTAL_CONTROL_REDIRECT_URL,
   6979             USB_MASS_STORAGE_ENABLED,                           // moved to global
   6980             ACCESSIBILITY_DISPLAY_INVERSION_ENABLED,
   6981             ACCESSIBILITY_DISPLAY_DALTONIZER,
   6982             ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
   6983             ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
   6984             ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED,
   6985             AUTOFILL_SERVICE,
   6986             ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
   6987             ENABLED_ACCESSIBILITY_SERVICES,
   6988             ENABLED_NOTIFICATION_LISTENERS,
   6989             ENABLED_VR_LISTENERS,
   6990             ENABLED_INPUT_METHODS,
   6991             TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
   6992             TOUCH_EXPLORATION_ENABLED,
   6993             ACCESSIBILITY_ENABLED,
   6994             ACCESSIBILITY_SHORTCUT_TARGET_SERVICE,
   6995             ACCESSIBILITY_BUTTON_TARGET_COMPONENT,
   6996             ACCESSIBILITY_SHORTCUT_DIALOG_SHOWN,
   6997             ACCESSIBILITY_SHORTCUT_ENABLED,
   6998             ACCESSIBILITY_SHORTCUT_ON_LOCK_SCREEN,
   6999             ACCESSIBILITY_SPEAK_PASSWORD,
   7000             ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
   7001             ACCESSIBILITY_CAPTIONING_PRESET,
   7002             ACCESSIBILITY_CAPTIONING_ENABLED,
   7003             ACCESSIBILITY_CAPTIONING_LOCALE,
   7004             ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
   7005             ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
   7006             ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
   7007             ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
   7008             ACCESSIBILITY_CAPTIONING_TYPEFACE,
   7009             ACCESSIBILITY_CAPTIONING_FONT_SCALE,
   7010             ACCESSIBILITY_CAPTIONING_WINDOW_COLOR,
   7011             TTS_USE_DEFAULTS,
   7012             TTS_DEFAULT_RATE,
   7013             TTS_DEFAULT_PITCH,
   7014             TTS_DEFAULT_SYNTH,
   7015             TTS_DEFAULT_LANG,
   7016             TTS_DEFAULT_COUNTRY,
   7017             TTS_ENABLED_PLUGINS,
   7018             TTS_DEFAULT_LOCALE,
   7019             SHOW_IME_WITH_HARD_KEYBOARD,
   7020             WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
   7021             WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
   7022             WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
   7023             SELECTED_SPELL_CHECKER,
   7024             SELECTED_SPELL_CHECKER_SUBTYPE,
   7025             SPELL_CHECKER_ENABLED,
   7026             MOUNT_PLAY_NOTIFICATION_SND,
   7027             MOUNT_UMS_AUTOSTART,
   7028             MOUNT_UMS_PROMPT,
   7029             MOUNT_UMS_NOTIFY_ENABLED,
   7030             SLEEP_TIMEOUT,
   7031             DOUBLE_TAP_TO_WAKE,
   7032             WAKE_GESTURE_ENABLED,
   7033             LONG_PRESS_TIMEOUT,
   7034             CAMERA_GESTURE_DISABLED,
   7035             ACCESSIBILITY_AUTOCLICK_ENABLED,
   7036             ACCESSIBILITY_AUTOCLICK_DELAY,
   7037             ACCESSIBILITY_LARGE_POINTER_ICON,
   7038             PREFERRED_TTY_MODE,
   7039             ENHANCED_VOICE_PRIVACY_ENABLED,
   7040             TTY_MODE_ENABLED,
   7041             INCALL_POWER_BUTTON_BEHAVIOR,
   7042             NIGHT_DISPLAY_CUSTOM_START_TIME,
   7043             NIGHT_DISPLAY_CUSTOM_END_TIME,
   7044             NIGHT_DISPLAY_COLOR_TEMPERATURE,
   7045             NIGHT_DISPLAY_AUTO_MODE,
   7046             NIGHT_DISPLAY_LAST_ACTIVATED_TIME,
   7047             NIGHT_DISPLAY_ACTIVATED,
   7048             SYNC_PARENT_SOUNDS,
   7049             CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED,
   7050             CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED,
   7051             SYSTEM_NAVIGATION_KEYS_ENABLED,
   7052             QS_TILES,
   7053             DOZE_ENABLED,
   7054             DOZE_PULSE_ON_PICK_UP,
   7055             DOZE_PULSE_ON_DOUBLE_TAP,
   7056             NFC_PAYMENT_DEFAULT_COMPONENT,
   7057             AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
   7058             ASSIST_GESTURE_ENABLED,
   7059             ASSIST_GESTURE_SENSITIVITY,
   7060             VR_DISPLAY_MODE,
   7061             NOTIFICATION_BADGING
   7062         };
   7063 
   7064         /**
   7065          * These entries are considered common between the personal and the managed profile,
   7066          * since the managed profile doesn't get to change them.
   7067          */
   7068         private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
   7069 
   7070         static {
   7071             CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
   7072             CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
   7073             CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
   7074             CLONE_TO_MANAGED_PROFILE.add(AUTOFILL_SERVICE);
   7075             CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
   7076             CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
   7077             CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
   7078             CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
   7079             CLONE_TO_MANAGED_PROFILE.add(LOCATION_PREVIOUS_MODE);
   7080             CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
   7081             CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
   7082             CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
   7083             CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
   7084         }
   7085 
   7086         /** @hide */
   7087         public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
   7088             outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
   7089         }
   7090 
   7091         /**
   7092          * Secure settings which can be accessed by instant apps.
   7093          * @hide
   7094          */
   7095         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
   7096         static {
   7097             INSTANT_APP_SETTINGS.add(ENABLED_ACCESSIBILITY_SERVICES);
   7098             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_SPEAK_PASSWORD);
   7099             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
   7100             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_ENABLED);
   7101             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_PRESET);
   7102             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_TYPE);
   7103             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_EDGE_COLOR);
   7104             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_LOCALE);
   7105             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR);
   7106             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR);
   7107             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_TYPEFACE);
   7108             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_FONT_SCALE);
   7109             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_CAPTIONING_WINDOW_COLOR);
   7110             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
   7111             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_DISPLAY_DALTONIZER);
   7112             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_DELAY);
   7113             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_AUTOCLICK_ENABLED);
   7114             INSTANT_APP_SETTINGS.add(ACCESSIBILITY_LARGE_POINTER_ICON);
   7115 
   7116             INSTANT_APP_SETTINGS.add(DEFAULT_INPUT_METHOD);
   7117             INSTANT_APP_SETTINGS.add(ENABLED_INPUT_METHODS);
   7118 
   7119             INSTANT_APP_SETTINGS.add(ANDROID_ID);
   7120 
   7121             INSTANT_APP_SETTINGS.add(PACKAGE_VERIFIER_USER_CONSENT);
   7122             INSTANT_APP_SETTINGS.add(ALLOW_MOCK_LOCATION);
   7123         }
   7124 
   7125         /**
   7126          * Helper method for determining if a location provider is enabled.
   7127          *
   7128          * @param cr the content resolver to use
   7129          * @param provider the location provider to query
   7130          * @return true if the provider is enabled
   7131          *
   7132          * @deprecated use {@link #LOCATION_MODE} or
   7133          *             {@link LocationManager#isProviderEnabled(String)}
   7134          */
   7135         @Deprecated
   7136         public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
   7137             return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
   7138         }
   7139 
   7140         /**
   7141          * Helper method for determining if a location provider is enabled.
   7142          * @param cr the content resolver to use
   7143          * @param provider the location provider to query
   7144          * @param userId the userId to query
   7145          * @return true if the provider is enabled
   7146          * @deprecated use {@link #LOCATION_MODE} or
   7147          *             {@link LocationManager#isProviderEnabled(String)}
   7148          * @hide
   7149          */
   7150         @Deprecated
   7151         public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
   7152             String allowedProviders = Settings.Secure.getStringForUser(cr,
   7153                     LOCATION_PROVIDERS_ALLOWED, userId);
   7154             return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
   7155         }
   7156 
   7157         /**
   7158          * Thread-safe method for enabling or disabling a single location provider.
   7159          * @param cr the content resolver to use
   7160          * @param provider the location provider to enable or disable
   7161          * @param enabled true if the provider should be enabled
   7162          * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
   7163          */
   7164         @Deprecated
   7165         public static final void setLocationProviderEnabled(ContentResolver cr,
   7166                 String provider, boolean enabled) {
   7167             setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
   7168         }
   7169 
   7170         /**
   7171          * Thread-safe method for enabling or disabling a single location provider.
   7172          *
   7173          * @param cr the content resolver to use
   7174          * @param provider the location provider to enable or disable
   7175          * @param enabled true if the provider should be enabled
   7176          * @param userId the userId for which to enable/disable providers
   7177          * @return true if the value was set, false on database errors
   7178          * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
   7179          *             {@link #LOCATION_MODE}
   7180          * @hide
   7181          */
   7182         @Deprecated
   7183         public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
   7184                 String provider, boolean enabled, int userId) {
   7185             synchronized (mLocationSettingsLock) {
   7186                 // to ensure thread safety, we write the provider name with a '+' or '-'
   7187                 // and let the SettingsProvider handle it rather than reading and modifying
   7188                 // the list of enabled providers.
   7189                 if (enabled) {
   7190                     provider = "+" + provider;
   7191                 } else {
   7192                     provider = "-" + provider;
   7193                 }
   7194                 return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
   7195                         userId);
   7196             }
   7197         }
   7198 
   7199         /**
   7200          * Saves the current location mode into {@link #LOCATION_PREVIOUS_MODE}.
   7201          */
   7202         private static final boolean saveLocationModeForUser(ContentResolver cr, int userId) {
   7203             final int mode = getLocationModeForUser(cr, userId);
   7204             return putIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE, mode, userId);
   7205         }
   7206 
   7207         /**
   7208          * Restores the current location mode from {@link #LOCATION_PREVIOUS_MODE}.
   7209          */
   7210         private static final boolean restoreLocationModeForUser(ContentResolver cr, int userId) {
   7211             int mode = getIntForUser(cr, Settings.Secure.LOCATION_PREVIOUS_MODE,
   7212                     LOCATION_MODE_HIGH_ACCURACY, userId);
   7213             // Make sure that the previous mode is never "off". Otherwise the user won't be able to
   7214             // turn on location any longer.
   7215             if (mode == LOCATION_MODE_OFF) {
   7216                 mode = LOCATION_MODE_HIGH_ACCURACY;
   7217             }
   7218             return setLocationModeForUser(cr, mode, userId);
   7219         }
   7220 
   7221         /**
   7222          * Thread-safe method for setting the location mode to one of
   7223          * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
   7224          * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
   7225          * Necessary because the mode is a composite of the underlying location provider
   7226          * settings.
   7227          *
   7228          * @param cr the content resolver to use
   7229          * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
   7230          * @param userId the userId for which to change mode
   7231          * @return true if the value was set, false on database errors
   7232          *
   7233          * @throws IllegalArgumentException if mode is not one of the supported values
   7234          */
   7235         private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
   7236                 int userId) {
   7237             synchronized (mLocationSettingsLock) {
   7238                 boolean gps = false;
   7239                 boolean network = false;
   7240                 switch (mode) {
   7241                     case LOCATION_MODE_PREVIOUS:
   7242                         // Retrieve the actual mode and set to that mode.
   7243                         return restoreLocationModeForUser(cr, userId);
   7244                     case LOCATION_MODE_OFF:
   7245                         saveLocationModeForUser(cr, userId);
   7246                         break;
   7247                     case LOCATION_MODE_SENSORS_ONLY:
   7248                         gps = true;
   7249                         break;
   7250                     case LOCATION_MODE_BATTERY_SAVING:
   7251                         network = true;
   7252                         break;
   7253                     case LOCATION_MODE_HIGH_ACCURACY:
   7254                         gps = true;
   7255                         network = true;
   7256                         break;
   7257                     default:
   7258                         throw new IllegalArgumentException("Invalid location mode: " + mode);
   7259                 }
   7260                 // Note it's important that we set the NLP mode first. The Google implementation
   7261                 // of NLP clears its NLP consent setting any time it receives a
   7262                 // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
   7263                 // it shows an NLP consent dialog any time it receives the broadcast, NLP is
   7264                 // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
   7265                 // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
   7266                 // and 3) the receiver happened to complete before we enabled NLP, then the Google
   7267                 // NLP would detect the attempt to enable NLP and show a redundant NLP consent
   7268                 // dialog. Then the people who wrote the setup wizard would be sad.
   7269                 boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
   7270                         cr, LocationManager.NETWORK_PROVIDER, network, userId);
   7271                 boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
   7272                         cr, LocationManager.GPS_PROVIDER, gps, userId);
   7273                 return gpsSuccess && nlpSuccess;
   7274             }
   7275         }
   7276 
   7277         /**
   7278          * Thread-safe method for reading the location mode, returns one of
   7279          * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
   7280          * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary
   7281          * because the mode is a composite of the underlying location provider settings.
   7282          *
   7283          * @param cr the content resolver to use
   7284          * @param userId the userId for which to read the mode
   7285          * @return the location mode
   7286          */
   7287         private static final int getLocationModeForUser(ContentResolver cr, int userId) {
   7288             synchronized (mLocationSettingsLock) {
   7289                 boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
   7290                         cr, LocationManager.GPS_PROVIDER, userId);
   7291                 boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
   7292                         cr, LocationManager.NETWORK_PROVIDER, userId);
   7293                 if (gpsEnabled && networkEnabled) {
   7294                     return LOCATION_MODE_HIGH_ACCURACY;
   7295                 } else if (gpsEnabled) {
   7296                     return LOCATION_MODE_SENSORS_ONLY;
   7297                 } else if (networkEnabled) {
   7298                     return LOCATION_MODE_BATTERY_SAVING;
   7299                 } else {
   7300                     return LOCATION_MODE_OFF;
   7301                 }
   7302             }
   7303         }
   7304     }
   7305 
   7306     /**
   7307      * Global system settings, containing preferences that always apply identically
   7308      * to all defined users.  Applications can read these but are not allowed to write;
   7309      * like the "Secure" settings, these are for preferences that the user must
   7310      * explicitly modify through the system UI or specialized APIs for those values.
   7311      */
   7312     public static final class Global extends NameValueTable {
   7313         /**
   7314          * The content:// style URL for global secure settings items.  Not public.
   7315          */
   7316         public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
   7317 
   7318         /**
   7319          * Whether users are allowed to add more users or guest from lockscreen.
   7320          * <p>
   7321          * Type: int
   7322          * @hide
   7323          */
   7324         public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
   7325 
   7326         /**
   7327          * Setting whether the global gesture for enabling accessibility is enabled.
   7328          * If this gesture is enabled the user will be able to perfrom it to enable
   7329          * the accessibility state without visiting the settings app.
   7330          *
   7331          * @hide
   7332          * No longer used. Should be removed once all dependencies have been updated.
   7333          */
   7334         public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
   7335                 "enable_accessibility_global_gesture_enabled";
   7336 
   7337         /**
   7338          * Whether Airplane Mode is on.
   7339          */
   7340         public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
   7341 
   7342         /**
   7343          * Whether Theater Mode is on.
   7344          * {@hide}
   7345          */
   7346         @SystemApi
   7347         public static final String THEATER_MODE_ON = "theater_mode_on";
   7348 
   7349         /**
   7350          * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
   7351          */
   7352         public static final String RADIO_BLUETOOTH = "bluetooth";
   7353 
   7354         /**
   7355          * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
   7356          */
   7357         public static final String RADIO_WIFI = "wifi";
   7358 
   7359         /**
   7360          * {@hide}
   7361          */
   7362         public static final String RADIO_WIMAX = "wimax";
   7363         /**
   7364          * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
   7365          */
   7366         public static final String RADIO_CELL = "cell";
   7367 
   7368         /**
   7369          * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
   7370          */
   7371         public static final String RADIO_NFC = "nfc";
   7372 
   7373         /**
   7374          * A comma separated list of radios that need to be disabled when airplane mode
   7375          * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
   7376          * included in the comma separated list.
   7377          */
   7378         public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
   7379 
   7380         /**
   7381          * A comma separated list of radios that should to be disabled when airplane mode
   7382          * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
   7383          * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
   7384          * will be turned off when entering airplane mode, but the user will be able to reenable
   7385          * Wifi in the Settings app.
   7386          *
   7387          * {@hide}
   7388          */
   7389         public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
   7390 
   7391         /**
   7392          * A Long representing a bitmap of profiles that should be disabled when bluetooth starts.
   7393          * See {@link android.bluetooth.BluetoothProfile}.
   7394          * {@hide}
   7395          */
   7396         public static final String BLUETOOTH_DISABLED_PROFILES = "bluetooth_disabled_profiles";
   7397 
   7398         /**
   7399          * A semi-colon separated list of Bluetooth interoperability workarounds.
   7400          * Each entry is a partial Bluetooth device address string and an integer representing
   7401          * the feature to be disabled, separated by a comma. The integer must correspond
   7402          * to a interoperability feature as defined in "interop.h" in /system/bt.
   7403          * <p>
   7404          * Example: <br/>
   7405          *   "00:11:22,0;01:02:03:04,2"
   7406          * @hide
   7407          */
   7408        public static final String BLUETOOTH_INTEROPERABILITY_LIST = "bluetooth_interoperability_list";
   7409 
   7410         /**
   7411          * The policy for deciding when Wi-Fi should go to sleep (which will in
   7412          * turn switch to using the mobile data as an Internet connection).
   7413          * <p>
   7414          * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
   7415          * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
   7416          * {@link #WIFI_SLEEP_POLICY_NEVER}.
   7417          */
   7418         public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
   7419 
   7420         /**
   7421          * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
   7422          * policy, which is to sleep shortly after the turning off
   7423          * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
   7424          */
   7425         public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
   7426 
   7427         /**
   7428          * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
   7429          * the device is on battery, and never go to sleep when the device is
   7430          * plugged in.
   7431          */
   7432         public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
   7433 
   7434         /**
   7435          * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
   7436          */
   7437         public static final int WIFI_SLEEP_POLICY_NEVER = 2;
   7438 
   7439         /**
   7440          * Value to specify if the user prefers the date, time and time zone
   7441          * to be automatically fetched from the network (NITZ). 1=yes, 0=no
   7442          */
   7443         public static final String AUTO_TIME = "auto_time";
   7444 
   7445         /**
   7446          * Value to specify if the user prefers the time zone
   7447          * to be automatically fetched from the network (NITZ). 1=yes, 0=no
   7448          */
   7449         public static final String AUTO_TIME_ZONE = "auto_time_zone";
   7450 
   7451         /**
   7452          * URI for the car dock "in" event sound.
   7453          * @hide
   7454          */
   7455         public static final String CAR_DOCK_SOUND = "car_dock_sound";
   7456 
   7457         /**
   7458          * URI for the car dock "out" event sound.
   7459          * @hide
   7460          */
   7461         public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
   7462 
   7463         /**
   7464          * URI for the desk dock "in" event sound.
   7465          * @hide
   7466          */
   7467         public static final String DESK_DOCK_SOUND = "desk_dock_sound";
   7468 
   7469         /**
   7470          * URI for the desk dock "out" event sound.
   7471          * @hide
   7472          */
   7473         public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
   7474 
   7475         /**
   7476          * Whether to play a sound for dock events.
   7477          * @hide
   7478          */
   7479         public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
   7480 
   7481         /**
   7482          * Whether to play a sound for dock events, only when an accessibility service is on.
   7483          * @hide
   7484          */
   7485         public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";
   7486 
   7487         /**
   7488          * URI for the "device locked" (keyguard shown) sound.
   7489          * @hide
   7490          */
   7491         public static final String LOCK_SOUND = "lock_sound";
   7492 
   7493         /**
   7494          * URI for the "device unlocked" sound.
   7495          * @hide
   7496          */
   7497         public static final String UNLOCK_SOUND = "unlock_sound";
   7498 
   7499         /**
   7500          * URI for the "device is trusted" sound, which is played when the device enters the trusted
   7501          * state without unlocking.
   7502          * @hide
   7503          */
   7504         public static final String TRUSTED_SOUND = "trusted_sound";
   7505 
   7506         /**
   7507          * URI for the low battery sound file.
   7508          * @hide
   7509          */
   7510         public static final String LOW_BATTERY_SOUND = "low_battery_sound";
   7511 
   7512         /**
   7513          * Whether to play a sound for low-battery alerts.
   7514          * @hide
   7515          */
   7516         public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
   7517 
   7518         /**
   7519          * URI for the "wireless charging started" sound.
   7520          * @hide
   7521          */
   7522         public static final String WIRELESS_CHARGING_STARTED_SOUND =
   7523                 "wireless_charging_started_sound";
   7524 
   7525         /**
   7526          * Whether to play a sound for charging events.
   7527          * @hide
   7528          */
   7529         public static final String CHARGING_SOUNDS_ENABLED = "charging_sounds_enabled";
   7530 
   7531         /**
   7532          * Whether we keep the device on while the device is plugged in.
   7533          * Supported values are:
   7534          * <ul>
   7535          * <li>{@code 0} to never stay on while plugged in</li>
   7536          * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
   7537          * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
   7538          * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
   7539          * </ul>
   7540          * These values can be OR-ed together.
   7541          */
   7542         public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
   7543 
   7544         /**
   7545          * When the user has enable the option to have a "bug report" command
   7546          * in the power menu.
   7547          * @hide
   7548          */
   7549         public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
   7550 
   7551         /**
   7552          * Whether ADB is enabled.
   7553          */
   7554         public static final String ADB_ENABLED = "adb_enabled";
   7555 
   7556         /**
   7557          * Whether Views are allowed to save their attribute data.
   7558          * @hide
   7559          */
   7560         public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
   7561 
   7562         /**
   7563          * Whether assisted GPS should be enabled or not.
   7564          * @hide
   7565          */
   7566         public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
   7567 
   7568         /**
   7569          * Whether bluetooth is enabled/disabled
   7570          * 0=disabled. 1=enabled.
   7571          */
   7572         public static final String BLUETOOTH_ON = "bluetooth_on";
   7573 
   7574         /**
   7575          * CDMA Cell Broadcast SMS
   7576          *                            0 = CDMA Cell Broadcast SMS disabled
   7577          *                            1 = CDMA Cell Broadcast SMS enabled
   7578          * @hide
   7579          */
   7580         public static final String CDMA_CELL_BROADCAST_SMS =
   7581                 "cdma_cell_broadcast_sms";
   7582 
   7583         /**
   7584          * The CDMA roaming mode 0 = Home Networks, CDMA default
   7585          *                       1 = Roaming on Affiliated networks
   7586          *                       2 = Roaming on any networks
   7587          * @hide
   7588          */
   7589         public static final String CDMA_ROAMING_MODE = "roaming_settings";
   7590 
   7591         /**
   7592          * The CDMA subscription mode 0 = RUIM/SIM (default)
   7593          *                                1 = NV
   7594          * @hide
   7595          */
   7596         public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
   7597 
   7598         /** Inactivity timeout to track mobile data activity.
   7599         *
   7600         * If set to a positive integer, it indicates the inactivity timeout value in seconds to
   7601         * infer the data activity of mobile network. After a period of no activity on mobile
   7602         * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
   7603         * intent is fired to indicate a transition of network status from "active" to "idle". Any
   7604         * subsequent activity on mobile networks triggers the firing of {@code
   7605         * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
   7606         *
   7607         * Network activity refers to transmitting or receiving data on the network interfaces.
   7608         *
   7609         * Tracking is disabled if set to zero or negative value.
   7610         *
   7611         * @hide
   7612         */
   7613        public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
   7614 
   7615        /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
   7616         * but for Wifi network.
   7617         * @hide
   7618         */
   7619        public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
   7620 
   7621        /**
   7622         * Whether or not data roaming is enabled. (0 = false, 1 = true)
   7623         */
   7624        public static final String DATA_ROAMING = "data_roaming";
   7625 
   7626        /**
   7627         * The value passed to a Mobile DataConnection via bringUp which defines the
   7628         * number of retries to preform when setting up the initial connection. The default
   7629         * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
   7630         * @hide
   7631         */
   7632        public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
   7633 
   7634        /**
   7635         * Whether any package can be on external storage. When this is true, any
   7636         * package, regardless of manifest values, is a candidate for installing
   7637         * or moving onto external storage. (0 = false, 1 = true)
   7638         * @hide
   7639         */
   7640        public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";
   7641 
   7642         /**
   7643          * Whether any activity can be resized. When this is true, any
   7644          * activity, regardless of manifest values, can be resized for multi-window.
   7645          * (0 = false, 1 = true)
   7646          * @hide
   7647          */
   7648         public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
   7649                 = "force_resizable_activities";
   7650 
   7651         /**
   7652          * Whether to enable experimental freeform support for windows.
   7653          * @hide
   7654          */
   7655         public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
   7656                 = "enable_freeform_support";
   7657 
   7658        /**
   7659         * Whether user has enabled development settings.
   7660         */
   7661        public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
   7662 
   7663        /**
   7664         * Whether the device has been provisioned (0 = false, 1 = true).
   7665         * <p>On a multiuser device with a separate system user, the screen may be locked
   7666         * as soon as this is set to true and further activities cannot be launched on the
   7667         * system user unless they are marked to show over keyguard.
   7668         */
   7669        public static final String DEVICE_PROVISIONED = "device_provisioned";
   7670 
   7671        /**
   7672         * Whether mobile data should be allowed while the device is being provisioned.
   7673         * This allows the provisioning process to turn off mobile data before the user
   7674         * has an opportunity to set things up, preventing other processes from burning
   7675         * precious bytes before wifi is setup.
   7676         * (0 = false, 1 = true)
   7677         * @hide
   7678         */
   7679        public static final String DEVICE_PROVISIONING_MOBILE_DATA_ENABLED =
   7680                "device_provisioning_mobile_data";
   7681 
   7682        /**
   7683         * The saved value for WindowManagerService.setForcedDisplaySize().
   7684         * Two integers separated by a comma.  If unset, then use the real display size.
   7685         * @hide
   7686         */
   7687        public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
   7688 
   7689        /**
   7690         * The saved value for WindowManagerService.setForcedDisplayScalingMode().
   7691         * 0 or unset if scaling is automatic, 1 if scaling is disabled.
   7692         * @hide
   7693         */
   7694        public static final String DISPLAY_SCALING_FORCE = "display_scaling_force";
   7695 
   7696        /**
   7697         * The maximum size, in bytes, of a download that the download manager will transfer over
   7698         * a non-wifi connection.
   7699         * @hide
   7700         */
   7701        public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
   7702                "download_manager_max_bytes_over_mobile";
   7703 
   7704        /**
   7705         * The recommended maximum size, in bytes, of a download that the download manager should
   7706         * transfer over a non-wifi connection. Over this size, the use will be warned, but will
   7707         * have the option to start the download over the mobile connection anyway.
   7708         * @hide
   7709         */
   7710        public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
   7711                "download_manager_recommended_max_bytes_over_mobile";
   7712 
   7713        /**
   7714         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
   7715         */
   7716        @Deprecated
   7717        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
   7718 
   7719        /**
   7720         * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
   7721         * sent or processed. (0 = false, 1 = true)
   7722         * @hide
   7723         */
   7724        public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
   7725 
   7726        /**
   7727         * Whether HDMI System Audio Control feature is enabled. If enabled, TV will try to turn on
   7728         * system audio mode if there's a connected CEC-enabled AV Receiver. Then audio stream will
   7729         * be played on AVR instead of TV spaeker. If disabled, the system audio mode will never be
   7730         * activated.
   7731         * @hide
   7732         */
   7733         public static final String HDMI_SYSTEM_AUDIO_CONTROL_ENABLED =
   7734                 "hdmi_system_audio_control_enabled";
   7735 
   7736        /**
   7737         * Whether TV will automatically turn on upon reception of the CEC command
   7738         * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
   7739         * @hide
   7740         */
   7741        public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
   7742                "hdmi_control_auto_wakeup_enabled";
   7743 
   7744        /**
   7745         * Whether TV will also turn off other CEC devices when it goes to standby mode.
   7746         * (0 = false, 1 = true)
   7747         * @hide
   7748         */
   7749        public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
   7750                "hdmi_control_auto_device_off_enabled";
   7751 
   7752        /**
   7753         * The interval in milliseconds at which location requests will be throttled when they are
   7754         * coming from the background.
   7755         * @hide
   7756         */
   7757        public static final String LOCATION_BACKGROUND_THROTTLE_INTERVAL_MS =
   7758                 "location_background_throttle_interval_ms";
   7759 
   7760         /**
   7761          * Most frequent location update interval in milliseconds that proximity alert is allowed
   7762          * to request.
   7763          * @hide
   7764          */
   7765         public static final String LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS =
   7766                 "location_background_throttle_proximity_alert_interval_ms";
   7767 
   7768         /**
   7769          * Packages that are whitelisted for background throttling (throttling will not be applied).
   7770          * @hide
   7771          */
   7772         public static final String LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
   7773             "location_background_throttle_package_whitelist";
   7774 
   7775         /**
   7776          * The interval in milliseconds at which wifi scan requests will be throttled when they are
   7777          * coming from the background.
   7778          * @hide
   7779          */
   7780         public static final String WIFI_SCAN_BACKGROUND_THROTTLE_INTERVAL_MS =
   7781                 "wifi_scan_background_throttle_interval_ms";
   7782 
   7783         /**
   7784          * Packages that are whitelisted to be exempt for wifi background throttling.
   7785          * @hide
   7786          */
   7787         public static final String WIFI_SCAN_BACKGROUND_THROTTLE_PACKAGE_WHITELIST =
   7788                 "wifi_scan_background_throttle_package_whitelist";
   7789 
   7790         /**
   7791         * Whether TV will switch to MHL port when a mobile device is plugged in.
   7792         * (0 = false, 1 = true)
   7793         * @hide
   7794         */
   7795        public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
   7796 
   7797        /**
   7798         * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
   7799         * @hide
   7800         */
   7801        public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
   7802 
   7803        /**
   7804         * Whether mobile data connections are allowed by the user.  See
   7805         * ConnectivityManager for more info.
   7806         * @hide
   7807         */
   7808        public static final String MOBILE_DATA = "mobile_data";
   7809 
   7810        /**
   7811         * Whether the mobile data connection should remain active even when higher
   7812         * priority networks like WiFi are active, to help make network switching faster.
   7813         *
   7814         * See ConnectivityService for more info.
   7815         *
   7816         * (0 = disabled, 1 = enabled)
   7817         * @hide
   7818         */
   7819        public static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
   7820 
   7821         /**
   7822          * Size of the event buffer for IP connectivity metrics.
   7823          * @hide
   7824          */
   7825         public static final String CONNECTIVITY_METRICS_BUFFER_SIZE =
   7826               "connectivity_metrics_buffer_size";
   7827 
   7828        /** {@hide} */
   7829        public static final String NETSTATS_ENABLED = "netstats_enabled";
   7830        /** {@hide} */
   7831        public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
   7832        /** {@hide} */
   7833        public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
   7834        /** {@hide} */
   7835        public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
   7836        /** {@hide} */
   7837        public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
   7838 
   7839        /** {@hide} */
   7840        public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
   7841        /** {@hide} */
   7842        public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
   7843        /** {@hide} */
   7844        public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
   7845        /** {@hide} */
   7846        public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
   7847 
   7848        /** {@hide} */
   7849        public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
   7850        /** {@hide} */
   7851        public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
   7852        /** {@hide} */
   7853        public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
   7854        /** {@hide} */
   7855        public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
   7856 
   7857        /** {@hide} */
   7858        public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
   7859        /** {@hide} */
   7860        public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
   7861        /** {@hide} */
   7862        public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
   7863        /** {@hide} */
   7864        public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
   7865 
   7866        /**
   7867         * User preference for which network(s) should be used. Only the
   7868         * connectivity service should touch this.
   7869         */
   7870        public static final String NETWORK_PREFERENCE = "network_preference";
   7871 
   7872        /**
   7873         * Which package name to use for network scoring. If null, or if the package is not a valid
   7874         * scorer app, external network scores will neither be requested nor accepted.
   7875         * @hide
   7876         */
   7877        public static final String NETWORK_SCORER_APP = "network_scorer_app";
   7878 
   7879        /**
   7880         * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
   7881         * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
   7882         * exceeded.
   7883         * @hide
   7884         */
   7885        public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
   7886 
   7887        /**
   7888         * The length of time in milli-seconds that automatic small adjustments to
   7889         * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
   7890         * @hide
   7891         */
   7892        public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
   7893 
   7894        /** Preferred NTP server. {@hide} */
   7895        public static final String NTP_SERVER = "ntp_server";
   7896        /** Timeout in milliseconds to wait for NTP server. {@hide} */
   7897        public static final String NTP_TIMEOUT = "ntp_timeout";
   7898 
   7899        /** {@hide} */
   7900        public static final String STORAGE_BENCHMARK_INTERVAL = "storage_benchmark_interval";
   7901 
   7902        /**
   7903         * Sample validity in seconds to configure for the system DNS resolver.
   7904         * {@hide}
   7905         */
   7906        public static final String DNS_RESOLVER_SAMPLE_VALIDITY_SECONDS =
   7907                "dns_resolver_sample_validity_seconds";
   7908 
   7909        /**
   7910         * Success threshold in percent for use with the system DNS resolver.
   7911         * {@hide}
   7912         */
   7913        public static final String DNS_RESOLVER_SUCCESS_THRESHOLD_PERCENT =
   7914                 "dns_resolver_success_threshold_percent";
   7915 
   7916        /**
   7917         * Minimum number of samples needed for statistics to be considered meaningful in the
   7918         * system DNS resolver.
   7919         * {@hide}
   7920         */
   7921        public static final String DNS_RESOLVER_MIN_SAMPLES = "dns_resolver_min_samples";
   7922 
   7923        /**
   7924         * Maximum number taken into account for statistics purposes in the system DNS resolver.
   7925         * {@hide}
   7926         */
   7927        public static final String DNS_RESOLVER_MAX_SAMPLES = "dns_resolver_max_samples";
   7928 
   7929        /**
   7930         * Whether to disable the automatic scheduling of system updates.
   7931         * 1 = system updates won't be automatically scheduled (will always
   7932         * present notification instead).
   7933         * 0 = system updates will be automatically scheduled. (default)
   7934         * @hide
   7935         */
   7936        @SystemApi
   7937        public static final String OTA_DISABLE_AUTOMATIC_UPDATE = "ota_disable_automatic_update";
   7938 
   7939        /**
   7940         * Whether the package manager should send package verification broadcasts for verifiers to
   7941         * review apps prior to installation.
   7942         * 1 = request apps to be verified prior to installation, if a verifier exists.
   7943         * 0 = do not verify apps before installation
   7944         * @hide
   7945         */
   7946        public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
   7947 
   7948        /** Timeout for package verification.
   7949         * @hide */
   7950        public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
   7951 
   7952        /** Default response code for package verification.
   7953         * @hide */
   7954        public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
   7955 
   7956        /**
   7957         * Show package verification setting in the Settings app.
   7958         * 1 = show (default)
   7959         * 0 = hide
   7960         * @hide
   7961         */
   7962        public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
   7963 
   7964        /**
   7965         * Run package verification on apps installed through ADB/ADT/USB
   7966         * 1 = perform package verification on ADB installs (default)
   7967         * 0 = bypass package verification on ADB installs
   7968         * @hide
   7969         */
   7970        public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
   7971 
   7972        /**
   7973         * Time since last fstrim (milliseconds) after which we force one to happen
   7974         * during device startup.  If unset, the default is 3 days.
   7975         * @hide
   7976         */
   7977        public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
   7978 
   7979        /**
   7980         * The interval in milliseconds at which to check packet counts on the
   7981         * mobile data interface when screen is on, to detect possible data
   7982         * connection problems.
   7983         * @hide
   7984         */
   7985        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
   7986                "pdp_watchdog_poll_interval_ms";
   7987 
   7988        /**
   7989         * The interval in milliseconds at which to check packet counts on the
   7990         * mobile data interface when screen is off, to detect possible data
   7991         * connection problems.
   7992         * @hide
   7993         */
   7994        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
   7995                "pdp_watchdog_long_poll_interval_ms";
   7996 
   7997        /**
   7998         * The interval in milliseconds at which to check packet counts on the
   7999         * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
   8000         * outgoing packets has been reached without incoming packets.
   8001         * @hide
   8002         */
   8003        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
   8004                "pdp_watchdog_error_poll_interval_ms";
   8005 
   8006        /**
   8007         * The number of outgoing packets sent without seeing an incoming packet
   8008         * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
   8009         * device is logged to the event log
   8010         * @hide
   8011         */
   8012        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
   8013                "pdp_watchdog_trigger_packet_count";
   8014 
   8015        /**
   8016         * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
   8017         * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
   8018         * attempting data connection recovery.
   8019         * @hide
   8020         */
   8021        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
   8022                "pdp_watchdog_error_poll_count";
   8023 
   8024        /**
   8025         * The number of failed PDP reset attempts before moving to something more
   8026         * drastic: re-registering to the network.
   8027         * @hide
   8028         */
   8029        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
   8030                "pdp_watchdog_max_pdp_reset_fail_count";
   8031 
   8032        /**
   8033         * A positive value indicates how often the SamplingProfiler
   8034         * should take snapshots. Zero value means SamplingProfiler
   8035         * is disabled.
   8036         *
   8037         * @hide
   8038         */
   8039        public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
   8040 
   8041        /**
   8042         * URL to open browser on to allow user to manage a prepay account
   8043         * @hide
   8044         */
   8045        public static final String SETUP_PREPAID_DATA_SERVICE_URL =
   8046                "setup_prepaid_data_service_url";
   8047 
   8048        /**
   8049         * URL to attempt a GET on to see if this is a prepay device
   8050         * @hide
   8051         */
   8052        public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
   8053                "setup_prepaid_detection_target_url";
   8054 
   8055        /**
   8056         * Host to check for a redirect to after an attempt to GET
   8057         * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
   8058         * this is a prepaid device with zero balance.)
   8059         * @hide
   8060         */
   8061        public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
   8062                "setup_prepaid_detection_redir_host";
   8063 
   8064        /**
   8065         * The interval in milliseconds at which to check the number of SMS sent out without asking
   8066         * for use permit, to limit the un-authorized SMS usage.
   8067         *
   8068         * @hide
   8069         */
   8070        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
   8071                "sms_outgoing_check_interval_ms";
   8072 
   8073        /**
   8074         * The number of outgoing SMS sent without asking for user permit (of {@link
   8075         * #SMS_OUTGOING_CHECK_INTERVAL_MS}
   8076         *
   8077         * @hide
   8078         */
   8079        public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
   8080                "sms_outgoing_check_max_count";
   8081 
   8082        /**
   8083         * Used to disable SMS short code confirmation - defaults to true.
   8084         * True indcates we will do the check, etc.  Set to false to disable.
   8085         * @see com.android.internal.telephony.SmsUsageMonitor
   8086         * @hide
   8087         */
   8088        public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
   8089 
   8090         /**
   8091          * Used to select which country we use to determine premium sms codes.
   8092          * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
   8093          * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
   8094          * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
   8095          * @hide
   8096          */
   8097         public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
   8098 
   8099        /**
   8100         * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
   8101         * @hide
   8102         */
   8103        public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
   8104 
   8105        /**
   8106         * Used to disable Tethering on a device - defaults to true
   8107         * @hide
   8108         */
   8109        public static final String TETHER_SUPPORTED = "tether_supported";
   8110 
   8111        /**
   8112         * Used to require DUN APN on the device or not - defaults to a build config value
   8113         * which defaults to false
   8114         * @hide
   8115         */
   8116        public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
   8117 
   8118        /**
   8119         * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
   8120         * corresponding build config values are set it will override the APN DB
   8121         * values.
   8122         * Consists of a comma seperated list of strings:
   8123         * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
   8124         * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
   8125         * @hide
   8126         */
   8127        public static final String TETHER_DUN_APN = "tether_dun_apn";
   8128 
   8129        /**
   8130         * List of carrier apps which are whitelisted to prompt the user for install when
   8131         * a sim card with matching uicc carrier privilege rules is inserted.
   8132         *
   8133         * The value is "package1;package2;..."
   8134         * @hide
   8135         */
   8136        public static final String CARRIER_APP_WHITELIST = "carrier_app_whitelist";
   8137 
   8138        /**
   8139         * USB Mass Storage Enabled
   8140         */
   8141        public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
   8142 
   8143        /**
   8144         * If this setting is set (to anything), then all references
   8145         * to Gmail on the device must change to Google Mail.
   8146         */
   8147        public static final String USE_GOOGLE_MAIL = "use_google_mail";
   8148 
   8149         /**
   8150          * Webview Data reduction proxy key.
   8151          * @hide
   8152          */
   8153         public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
   8154                 "webview_data_reduction_proxy_key";
   8155 
   8156        /**
   8157         * Whether or not the WebView fallback mechanism should be enabled.
   8158         * 0=disabled, 1=enabled.
   8159         * @hide
   8160         */
   8161        public static final String WEBVIEW_FALLBACK_LOGIC_ENABLED =
   8162                "webview_fallback_logic_enabled";
   8163 
   8164        /**
   8165         * Name of the package used as WebView provider (if unset the provider is instead determined
   8166         * by the system).
   8167         * @hide
   8168         */
   8169        public static final String WEBVIEW_PROVIDER = "webview_provider";
   8170 
   8171        /**
   8172         * Developer setting to enable WebView multiprocess rendering.
   8173         * @hide
   8174         */
   8175        @SystemApi
   8176        public static final String WEBVIEW_MULTIPROCESS = "webview_multiprocess";
   8177 
   8178        /**
   8179         * The maximum number of notifications shown in 24 hours when switching networks.
   8180         * @hide
   8181         */
   8182        public static final String NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT =
   8183               "network_switch_notification_daily_limit";
   8184 
   8185        /**
   8186         * The minimum time in milliseconds between notifications when switching networks.
   8187         * @hide
   8188         */
   8189        public static final String NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS =
   8190               "network_switch_notification_rate_limit_millis";
   8191 
   8192        /**
   8193         * Whether to automatically switch away from wifi networks that lose Internet access.
   8194         * Only meaningful if config_networkAvoidBadWifi is set to 0, otherwise the system always
   8195         * avoids such networks. Valid values are:
   8196         *
   8197         * 0: Don't avoid bad wifi, don't prompt the user. Get stuck on bad wifi like it's 2013.
   8198         * null: Ask the user whether to switch away from bad wifi.
   8199         * 1: Avoid bad wifi.
   8200         *
   8201         * @hide
   8202         */
   8203        public static final String NETWORK_AVOID_BAD_WIFI = "network_avoid_bad_wifi";
   8204 
   8205        /**
   8206         * User setting for ConnectivityManager.getMeteredMultipathPreference(). This value may be
   8207         * overridden by the system based on device or application state. If null, the value
   8208         * specified by config_networkMeteredMultipathPreference is used.
   8209         *
   8210         * @hide
   8211         */
   8212        public static final String NETWORK_METERED_MULTIPATH_PREFERENCE =
   8213                "network_metered_multipath_preference";
   8214 
   8215        /**
   8216         * The thresholds of the wifi throughput badging (SD, HD etc.) as a comma-delimited list of
   8217         * colon-delimited key-value pairs. The key is the badging enum value defined in
   8218         * android.net.ScoredNetwork and the value is the minimum sustained network throughput in
   8219         * kbps required for the badge. For example: "10:3000,20:5000,30:25000"
   8220         *
   8221         * @hide
   8222         */
   8223        @SystemApi
   8224        public static final String WIFI_BADGING_THRESHOLDS = "wifi_badging_thresholds";
   8225 
   8226        /**
   8227         * Whether Wifi display is enabled/disabled
   8228         * 0=disabled. 1=enabled.
   8229         * @hide
   8230         */
   8231        public static final String WIFI_DISPLAY_ON = "wifi_display_on";
   8232 
   8233        /**
   8234         * Whether Wifi display certification mode is enabled/disabled
   8235         * 0=disabled. 1=enabled.
   8236         * @hide
   8237         */
   8238        public static final String WIFI_DISPLAY_CERTIFICATION_ON =
   8239                "wifi_display_certification_on";
   8240 
   8241        /**
   8242         * WPS Configuration method used by Wifi display, this setting only
   8243         * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
   8244         *
   8245         * Possible values are:
   8246         *
   8247         * WpsInfo.INVALID: use default WPS method chosen by framework
   8248         * WpsInfo.PBC    : use Push button
   8249         * WpsInfo.KEYPAD : use Keypad
   8250         * WpsInfo.DISPLAY: use Display
   8251         * @hide
   8252         */
   8253        public static final String WIFI_DISPLAY_WPS_CONFIG =
   8254            "wifi_display_wps_config";
   8255 
   8256        /**
   8257         * Whether to notify the user of open networks.
   8258         * <p>
   8259         * If not connected and the scan results have an open network, we will
   8260         * put this notification up. If we attempt to connect to a network or
   8261         * the open network(s) disappear, we remove the notification. When we
   8262         * show the notification, we will not show it again for
   8263         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
   8264         *
   8265         * @deprecated This feature is no longer controlled by this setting in
   8266         * {@link android.os.Build.VERSION_CODES#O}.
   8267         */
   8268        @Deprecated
   8269        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
   8270                "wifi_networks_available_notification_on";
   8271 
   8272        /**
   8273         * {@hide}
   8274         */
   8275        public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
   8276                "wimax_networks_available_notification_on";
   8277 
   8278        /**
   8279         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
   8280         * Connecting to a network will reset the timer.
   8281         */
   8282        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
   8283                "wifi_networks_available_repeat_delay";
   8284 
   8285        /**
   8286         * 802.11 country code in ISO 3166 format
   8287         * @hide
   8288         */
   8289        public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
   8290 
   8291        /**
   8292         * The interval in milliseconds to issue wake up scans when wifi needs
   8293         * to connect. This is necessary to connect to an access point when
   8294         * device is on the move and the screen is off.
   8295         * @hide
   8296         */
   8297        public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
   8298                "wifi_framework_scan_interval_ms";
   8299 
   8300        /**
   8301         * The interval in milliseconds after which Wi-Fi is considered idle.
   8302         * When idle, it is possible for the device to be switched from Wi-Fi to
   8303         * the mobile data network.
   8304         * @hide
   8305         */
   8306        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
   8307 
   8308        /**
   8309         * When the number of open networks exceeds this number, the
   8310         * least-recently-used excess networks will be removed.
   8311         */
   8312        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
   8313 
   8314        /**
   8315         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
   8316         */
   8317        public static final String WIFI_ON = "wifi_on";
   8318 
   8319        /**
   8320         * Setting to allow scans to be enabled even wifi is turned off for connectivity.
   8321         * @hide
   8322         */
   8323        public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
   8324                 "wifi_scan_always_enabled";
   8325 
   8326         /**
   8327          * Value to specify if Wi-Fi Wakeup feature is enabled.
   8328          *
   8329          * Type: int (0 for false, 1 for true)
   8330          * @hide
   8331          */
   8332         @SystemApi
   8333         public static final String WIFI_WAKEUP_ENABLED = "wifi_wakeup_enabled";
   8334 
   8335         /**
   8336          * Value to specify if Wi-Fi Wakeup is available.
   8337          *
   8338          * Wi-Fi Wakeup will only operate if it's available
   8339          * and {@link #WIFI_WAKEUP_ENABLED} is true.
   8340          *
   8341          * Type: int (0 for false, 1 for true)
   8342          * @hide
   8343          */
   8344         public static final String WIFI_WAKEUP_AVAILABLE = "wifi_wakeup_available";
   8345 
   8346         /**
   8347          * Value to specify whether network quality scores and badging should be shown in the UI.
   8348          *
   8349          * Type: int (0 for false, 1 for true)
   8350          * @hide
   8351          */
   8352         public static final String NETWORK_SCORING_UI_ENABLED = "network_scoring_ui_enabled";
   8353 
   8354         /**
   8355          * Value to specify if network recommendations from
   8356          * {@link com.android.server.NetworkScoreService} are enabled.
   8357          *
   8358          * Type: int
   8359          * Valid values:
   8360          *   -1 = Forced off
   8361          *    0 = Disabled
   8362          *    1 = Enabled
   8363          *
   8364          * Most readers of this setting should simply check if value == 1 to determined the
   8365          * enabled state.
   8366          * @hide
   8367          */
   8368         public static final String NETWORK_RECOMMENDATIONS_ENABLED =
   8369                 "network_recommendations_enabled";
   8370 
   8371         /**
   8372          * Which package name to use for network recommendations. If null, network recommendations
   8373          * will neither be requested nor accepted.
   8374          *
   8375          * Use {@link NetworkScoreManager#getActiveScorerPackage()} to read this value and
   8376          * {@link NetworkScoreManager#setActiveScorer(String)} to write it.
   8377          *
   8378          * Type: string - package name
   8379          * @hide
   8380          */
   8381         public static final String NETWORK_RECOMMENDATIONS_PACKAGE =
   8382                 "network_recommendations_package";
   8383 
   8384         /**
   8385          * The package name of the application that connect and secures high quality open wifi
   8386          * networks automatically.
   8387          *
   8388          * Type: string package name or null if the feature is either not provided or disabled.
   8389          * @hide
   8390          */
   8391         public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
   8392 
   8393         /**
   8394          * The number of milliseconds the {@link com.android.server.NetworkScoreService}
   8395          * will give a recommendation request to complete before returning a default response.
   8396          *
   8397          * Type: long
   8398          * @hide
   8399          * @deprecated to be removed
   8400          */
   8401         public static final String NETWORK_RECOMMENDATION_REQUEST_TIMEOUT_MS =
   8402                 "network_recommendation_request_timeout_ms";
   8403 
   8404         /**
   8405          * The expiration time in milliseconds for the {@link android.net.WifiKey} request cache in
   8406          * {@link com.android.server.wifi.RecommendedNetworkEvaluator}.
   8407          *
   8408          * Type: long
   8409          * @hide
   8410          */
   8411         public static final String RECOMMENDED_NETWORK_EVALUATOR_CACHE_EXPIRY_MS =
   8412                 "recommended_network_evaluator_cache_expiry_ms";
   8413 
   8414        /**
   8415         * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
   8416         * connectivity.
   8417         * @hide
   8418         */
   8419        public static final String BLE_SCAN_ALWAYS_AVAILABLE =
   8420                "ble_scan_always_enabled";
   8421 
   8422        /**
   8423         * Used to save the Wifi_ON state prior to tethering.
   8424         * This state will be checked to restore Wifi after
   8425         * the user turns off tethering.
   8426         *
   8427         * @hide
   8428         */
   8429        public static final String WIFI_SAVED_STATE = "wifi_saved_state";
   8430 
   8431        /**
   8432         * The interval in milliseconds to scan as used by the wifi supplicant
   8433         * @hide
   8434         */
   8435        public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
   8436                "wifi_supplicant_scan_interval_ms";
   8437 
   8438         /**
   8439          * whether frameworks handles wifi auto-join
   8440          * @hide
   8441          */
   8442        public static final String WIFI_ENHANCED_AUTO_JOIN =
   8443                 "wifi_enhanced_auto_join";
   8444 
   8445         /**
   8446          * whether settings show RSSI
   8447          * @hide
   8448          */
   8449         public static final String WIFI_NETWORK_SHOW_RSSI =
   8450                 "wifi_network_show_rssi";
   8451 
   8452         /**
   8453         * The interval in milliseconds to scan at supplicant when p2p is connected
   8454         * @hide
   8455         */
   8456        public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
   8457                "wifi_scan_interval_p2p_connected_ms";
   8458 
   8459        /**
   8460         * Whether the Wi-Fi watchdog is enabled.
   8461         */
   8462        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
   8463 
   8464        /**
   8465         * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
   8466         * the setting needs to be set to 0 to disable it.
   8467         * @hide
   8468         */
   8469        public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
   8470                "wifi_watchdog_poor_network_test_enabled";
   8471 
   8472        /**
   8473         * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
   8474         * needs to be set to 0 to disable it.
   8475         * @hide
   8476         */
   8477        public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
   8478                "wifi_suspend_optimizations_enabled";
   8479 
   8480        /**
   8481         * Setting to enable verbose logging in Wi-Fi; disabled by default, and setting to 1
   8482         * will enable it. In the future, additional values may be supported.
   8483         * @hide
   8484         */
   8485        public static final String WIFI_VERBOSE_LOGGING_ENABLED =
   8486                "wifi_verbose_logging_enabled";
   8487 
   8488        /**
   8489         * The maximum number of times we will retry a connection to an access
   8490         * point for which we have failed in acquiring an IP address from DHCP.
   8491         * A value of N means that we will make N+1 connection attempts in all.
   8492         */
   8493        public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
   8494 
   8495        /**
   8496         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
   8497         * data connectivity to be established after a disconnect from Wi-Fi.
   8498         */
   8499        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
   8500            "wifi_mobile_data_transition_wakelock_timeout_ms";
   8501 
   8502        /**
   8503         * This setting controls whether WiFi configurations created by a Device Owner app
   8504         * should be locked down (that is, be editable or removable only by the Device Owner App,
   8505         * not even by Settings app).
   8506         * This setting takes integer values. Non-zero values mean DO created configurations
   8507         * are locked down. Value of zero means they are not. Default value in the absence of
   8508         * actual value to this setting is 0.
   8509         */
   8510        public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN =
   8511                "wifi_device_owner_configs_lockdown";
   8512 
   8513        /**
   8514         * The operational wifi frequency band
   8515         * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
   8516         * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
   8517         * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
   8518         *
   8519         * @hide
   8520         */
   8521        public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
   8522 
   8523        /**
   8524         * The Wi-Fi peer-to-peer device name
   8525         * @hide
   8526         */
   8527        public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
   8528 
   8529        /**
   8530         * The min time between wifi disable and wifi enable
   8531         * @hide
   8532         */
   8533        public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
   8534 
   8535        /**
   8536         * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
   8537         * from an ephemeral network if there is no BSSID for that network with a non-null score that
   8538         * has been seen in this time period.
   8539         *
   8540         * If this is less than or equal to zero, we use a more conservative behavior and only check
   8541         * for a non-null score from the currently connected or target BSSID.
   8542         * @hide
   8543         */
   8544        public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
   8545                "wifi_ephemeral_out_of_range_timeout_ms";
   8546 
   8547        /**
   8548         * The number of milliseconds to delay when checking for data stalls during
   8549         * non-aggressive detection. (screen is turned off.)
   8550         * @hide
   8551         */
   8552        public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
   8553                "data_stall_alarm_non_aggressive_delay_in_ms";
   8554 
   8555        /**
   8556         * The number of milliseconds to delay when checking for data stalls during
   8557         * aggressive detection. (screen on or suspected data stall)
   8558         * @hide
   8559         */
   8560        public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
   8561                "data_stall_alarm_aggressive_delay_in_ms";
   8562 
   8563        /**
   8564         * The number of milliseconds to allow the provisioning apn to remain active
   8565         * @hide
   8566         */
   8567        public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
   8568                "provisioning_apn_alarm_delay_in_ms";
   8569 
   8570        /**
   8571         * The interval in milliseconds at which to check gprs registration
   8572         * after the first registration mismatch of gprs and voice service,
   8573         * to detect possible data network registration problems.
   8574         *
   8575         * @hide
   8576         */
   8577        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
   8578                "gprs_register_check_period_ms";
   8579 
   8580        /**
   8581         * Nonzero causes Log.wtf() to crash.
   8582         * @hide
   8583         */
   8584        public static final String WTF_IS_FATAL = "wtf_is_fatal";
   8585 
   8586        /**
   8587         * Ringer mode. This is used internally, changing this value will not
   8588         * change the ringer mode. See AudioManager.
   8589         */
   8590        public static final String MODE_RINGER = "mode_ringer";
   8591 
   8592        /**
   8593         * Overlay display devices setting.
   8594         * The associated value is a specially formatted string that describes the
   8595         * size and density of simulated secondary display devices.
   8596         * <p>
   8597         * Format: {width}x{height}/{dpi};...
   8598         * </p><p>
   8599         * Example:
   8600         * <ul>
   8601         * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
   8602         * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
   8603         * at 1080p and the second at 720p.</li>
   8604         * <li>If the value is empty, then no overlay display devices are created.</li>
   8605         * </ul></p>
   8606         *
   8607         * @hide
   8608         */
   8609        public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
   8610 
   8611         /**
   8612          * Threshold values for the duration and level of a discharge cycle,
   8613          * under which we log discharge cycle info.
   8614          *
   8615          * @hide
   8616          */
   8617         public static final String
   8618                 BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
   8619 
   8620         /** @hide */
   8621         public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
   8622 
   8623         /**
   8624          * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
   8625          * intents on application crashes and ANRs. If this is disabled, the
   8626          * crash/ANR dialog will never display the "Report" button.
   8627          * <p>
   8628          * Type: int (0 = disallow, 1 = allow)
   8629          *
   8630          * @hide
   8631          */
   8632         public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
   8633 
   8634         /**
   8635          * Maximum age of entries kept by {@link DropBoxManager}.
   8636          *
   8637          * @hide
   8638          */
   8639         public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
   8640 
   8641         /**
   8642          * Maximum number of entry files which {@link DropBoxManager} will keep
   8643          * around.
   8644          *
   8645          * @hide
   8646          */
   8647         public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
   8648 
   8649         /**
   8650          * Maximum amount of disk space used by {@link DropBoxManager} no matter
   8651          * what.
   8652          *
   8653          * @hide
   8654          */
   8655         public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
   8656 
   8657         /**
   8658          * Percent of free disk (excluding reserve) which {@link DropBoxManager}
   8659          * will use.
   8660          *
   8661          * @hide
   8662          */
   8663         public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
   8664 
   8665         /**
   8666          * Percent of total disk which {@link DropBoxManager} will never dip
   8667          * into.
   8668          *
   8669          * @hide
   8670          */
   8671         public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
   8672 
   8673         /**
   8674          * Prefix for per-tag dropbox disable/enable settings.
   8675          *
   8676          * @hide
   8677          */
   8678         public static final String DROPBOX_TAG_PREFIX = "dropbox:";
   8679 
   8680         /**
   8681          * Lines of logcat to include with system crash/ANR/etc. reports, as a
   8682          * prefix of the dropbox tag of the report type. For example,
   8683          * "logcat_for_system_server_anr" controls the lines of logcat captured
   8684          * with system server ANR reports. 0 to disable.
   8685          *
   8686          * @hide
   8687          */
   8688         public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
   8689 
   8690         /**
   8691          * The interval in minutes after which the amount of free storage left
   8692          * on the device is logged to the event log
   8693          *
   8694          * @hide
   8695          */
   8696         public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
   8697 
   8698         /**
   8699          * Threshold for the amount of change in disk free space required to
   8700          * report the amount of free space. Used to prevent spamming the logs
   8701          * when the disk free space isn't changing frequently.
   8702          *
   8703          * @hide
   8704          */
   8705         public static final String
   8706                 DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
   8707 
   8708         /**
   8709          * Minimum percentage of free storage on the device that is used to
   8710          * determine if the device is running low on storage. The default is 10.
   8711          * <p>
   8712          * Say this value is set to 10, the device is considered running low on
   8713          * storage if 90% or more of the device storage is filled up.
   8714          *
   8715          * @hide
   8716          */
   8717         public static final String
   8718                 SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
   8719 
   8720         /**
   8721          * Maximum byte size of the low storage threshold. This is to ensure
   8722          * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
   8723          * overly large threshold for large storage devices. Currently this must
   8724          * be less than 2GB. This default is 500MB.
   8725          *
   8726          * @hide
   8727          */
   8728         public static final String
   8729                 SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
   8730 
   8731         /**
   8732          * Minimum bytes of free storage on the device before the data partition
   8733          * is considered full. By default, 1 MB is reserved to avoid system-wide
   8734          * SQLite disk full exceptions.
   8735          *
   8736          * @hide
   8737          */
   8738         public static final String
   8739                 SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
   8740 
   8741         /**
   8742          * Minimum percentage of storage on the device that is reserved for
   8743          * cached data.
   8744          *
   8745          * @hide
   8746          */
   8747         public static final String
   8748                 SYS_STORAGE_CACHE_PERCENTAGE = "sys_storage_cache_percentage";
   8749 
   8750         /**
   8751          * Maximum bytes of storage on the device that is reserved for cached
   8752          * data.
   8753          *
   8754          * @hide
   8755          */
   8756         public static final String
   8757                 SYS_STORAGE_CACHE_MAX_BYTES = "sys_storage_cache_max_bytes";
   8758 
   8759         /**
   8760          * The maximum reconnect delay for short network outages or when the
   8761          * network is suspended due to phone use.
   8762          *
   8763          * @hide
   8764          */
   8765         public static final String
   8766                 SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
   8767 
   8768         /**
   8769          * The number of milliseconds to delay before sending out
   8770          * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
   8771          *
   8772          * @hide
   8773          */
   8774         public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
   8775 
   8776 
   8777         /**
   8778          * Network sampling interval, in seconds. We'll generate link information
   8779          * about bytes/packets sent and error rates based on data sampled in this interval
   8780          *
   8781          * @hide
   8782          */
   8783 
   8784         public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
   8785                 "connectivity_sampling_interval_in_seconds";
   8786 
   8787         /**
   8788          * The series of successively longer delays used in retrying to download PAC file.
   8789          * Last delay is used between successful PAC downloads.
   8790          *
   8791          * @hide
   8792          */
   8793         public static final String PAC_CHANGE_DELAY = "pac_change_delay";
   8794 
   8795         /**
   8796          * Don't attempt to detect captive portals.
   8797          *
   8798          * @hide
   8799          */
   8800         public static final int CAPTIVE_PORTAL_MODE_IGNORE = 0;
   8801 
   8802         /**
   8803          * When detecting a captive portal, display a notification that
   8804          * prompts the user to sign in.
   8805          *
   8806          * @hide
   8807          */
   8808         public static final int CAPTIVE_PORTAL_MODE_PROMPT = 1;
   8809 
   8810         /**
   8811          * When detecting a captive portal, immediately disconnect from the
   8812          * network and do not reconnect to that network in the future.
   8813          *
   8814          * @hide
   8815          */
   8816         public static final int CAPTIVE_PORTAL_MODE_AVOID = 2;
   8817 
   8818         /**
   8819          * What to do when connecting a network that presents a captive portal.
   8820          * Must be one of the CAPTIVE_PORTAL_MODE_* constants above.
   8821          *
   8822          * The default for this setting is CAPTIVE_PORTAL_MODE_PROMPT.
   8823          * @hide
   8824          */
   8825         public static final String CAPTIVE_PORTAL_MODE = "captive_portal_mode";
   8826 
   8827         /**
   8828          * Setting to turn off captive portal detection. Feature is enabled by
   8829          * default and the setting needs to be set to 0 to disable it.
   8830          *
   8831          * @deprecated use CAPTIVE_PORTAL_MODE_IGNORE to disable captive portal detection
   8832          * @hide
   8833          */
   8834         @Deprecated
   8835         public static final String
   8836                 CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
   8837 
   8838         /**
   8839          * The server used for captive portal detection upon a new conection. A
   8840          * 204 response code from the server is used for validation.
   8841          * TODO: remove this deprecated symbol.
   8842          *
   8843          * @hide
   8844          */
   8845         public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
   8846 
   8847         /**
   8848          * The URL used for HTTPS captive portal detection upon a new connection.
   8849          * A 204 response code from the server is used for validation.
   8850          *
   8851          * @hide
   8852          */
   8853         public static final String CAPTIVE_PORTAL_HTTPS_URL = "captive_portal_https_url";
   8854 
   8855         /**
   8856          * The URL used for HTTP captive portal detection upon a new connection.
   8857          * A 204 response code from the server is used for validation.
   8858          *
   8859          * @hide
   8860          */
   8861         public static final String CAPTIVE_PORTAL_HTTP_URL = "captive_portal_http_url";
   8862 
   8863         /**
   8864          * The URL used for fallback HTTP captive portal detection when previous HTTP
   8865          * and HTTPS captive portal detection attemps did not return a conclusive answer.
   8866          *
   8867          * @hide
   8868          */
   8869         public static final String CAPTIVE_PORTAL_FALLBACK_URL = "captive_portal_fallback_url";
   8870 
   8871         /**
   8872          * A comma separated list of URLs used for captive portal detection in addition to the
   8873          * fallback HTTP url associated with the CAPTIVE_PORTAL_FALLBACK_URL settings.
   8874          *
   8875          * @hide
   8876          */
   8877         public static final String CAPTIVE_PORTAL_OTHER_FALLBACK_URLS =
   8878                 "captive_portal_other_fallback_urls";
   8879 
   8880         /**
   8881          * Whether to use HTTPS for network validation. This is enabled by default and the setting
   8882          * needs to be set to 0 to disable it. This setting is a misnomer because captive portals
   8883          * don't actually use HTTPS, but it's consistent with the other settings.
   8884          *
   8885          * @hide
   8886          */
   8887         public static final String CAPTIVE_PORTAL_USE_HTTPS = "captive_portal_use_https";
   8888 
   8889         /**
   8890          * Which User-Agent string to use in the header of the captive portal detection probes.
   8891          * The User-Agent field is unset when this setting has no value (HttpUrlConnection default).
   8892          *
   8893          * @hide
   8894          */
   8895         public static final String CAPTIVE_PORTAL_USER_AGENT = "captive_portal_user_agent";
   8896 
   8897         /**
   8898          * Whether network service discovery is enabled.
   8899          *
   8900          * @hide
   8901          */
   8902         public static final String NSD_ON = "nsd_on";
   8903 
   8904         /**
   8905          * Let user pick default install location.
   8906          *
   8907          * @hide
   8908          */
   8909         public static final String SET_INSTALL_LOCATION = "set_install_location";
   8910 
   8911         /**
   8912          * Default install location value.
   8913          * 0 = auto, let system decide
   8914          * 1 = internal
   8915          * 2 = sdcard
   8916          * @hide
   8917          */
   8918         public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
   8919 
   8920         /**
   8921          * ms during which to consume extra events related to Inet connection
   8922          * condition after a transtion to fully-connected
   8923          *
   8924          * @hide
   8925          */
   8926         public static final String
   8927                 INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
   8928 
   8929         /**
   8930          * ms during which to consume extra events related to Inet connection
   8931          * condtion after a transtion to partly-connected
   8932          *
   8933          * @hide
   8934          */
   8935         public static final String
   8936                 INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
   8937 
   8938         /** {@hide} */
   8939         public static final String
   8940                 READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
   8941 
   8942         /**
   8943          * Host name and port for global http proxy. Uses ':' seperator for
   8944          * between host and port.
   8945          */
   8946         public static final String HTTP_PROXY = "http_proxy";
   8947 
   8948         /**
   8949          * Host name for global http proxy. Set via ConnectivityManager.
   8950          *
   8951          * @hide
   8952          */
   8953         public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
   8954 
   8955         /**
   8956          * Integer host port for global http proxy. Set via ConnectivityManager.
   8957          *
   8958          * @hide
   8959          */
   8960         public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
   8961 
   8962         /**
   8963          * Exclusion list for global proxy. This string contains a list of
   8964          * comma-separated domains where the global proxy does not apply.
   8965          * Domains should be listed in a comma- separated list. Example of
   8966          * acceptable formats: ".domain1.com,my.domain2.com" Use
   8967          * ConnectivityManager to set/get.
   8968          *
   8969          * @hide
   8970          */
   8971         public static final String
   8972                 GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
   8973 
   8974         /**
   8975          * The location PAC File for the proxy.
   8976          * @hide
   8977          */
   8978         public static final String
   8979                 GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
   8980 
   8981         /**
   8982          * Enables the UI setting to allow the user to specify the global HTTP
   8983          * proxy and associated exclusion list.
   8984          *
   8985          * @hide
   8986          */
   8987         public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
   8988 
   8989         /**
   8990          * Setting for default DNS in case nobody suggests one
   8991          *
   8992          * @hide
   8993          */
   8994         public static final String DEFAULT_DNS_SERVER = "default_dns_server";
   8995 
   8996         /** {@hide} */
   8997         public static final String
   8998                 BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
   8999         /** {@hide} */
   9000         public static final String
   9001                 BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
   9002         /** {@hide} */
   9003         public static final String
   9004                 BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX = "bluetooth_a2dp_src_priority_";
   9005         /** {@hide} */
   9006         public static final String BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX =
   9007                 "bluetooth_a2dp_supports_optional_codecs_";
   9008         /** {@hide} */
   9009         public static final String BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX =
   9010                 "bluetooth_a2dp_optional_codecs_enabled_";
   9011         /** {@hide} */
   9012         public static final String
   9013                 BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
   9014         /** {@hide} */
   9015         public static final String
   9016                 BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
   9017         /** {@hide} */
   9018         public static final String
   9019                 BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX = "bluetooth_map_client_priority_";
   9020         /** {@hide} */
   9021         public static final String
   9022                 BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX = "bluetooth_pbap_client_priority_";
   9023         /** {@hide} */
   9024         public static final String
   9025                 BLUETOOTH_SAP_PRIORITY_PREFIX = "bluetooth_sap_priority_";
   9026         /** {@hide} */
   9027         public static final String
   9028                 BLUETOOTH_PAN_PRIORITY_PREFIX = "bluetooth_pan_priority_";
   9029 
   9030         /**
   9031          * Activity manager specific settings.
   9032          * This is encoded as a key=value list, separated by commas. Ex:
   9033          *
   9034          * "gc_timeout=5000,max_cached_processes=24"
   9035          *
   9036          * The following keys are supported:
   9037          *
   9038          * <pre>
   9039          * max_cached_processes                 (int)
   9040          * background_settle_time               (long)
   9041          * fgservice_min_shown_time             (long)
   9042          * fgservice_min_report_time            (long)
   9043          * fgservice_screen_on_before_time      (long)
   9044          * fgservice_screen_on_after_time       (long)
   9045          * content_provider_retain_time         (long)
   9046          * gc_timeout                           (long)
   9047          * gc_min_interval                      (long)
   9048          * full_pss_min_interval                (long)
   9049          * full_pss_lowered_interval            (long)
   9050          * power_check_delay                    (long)
   9051          * wake_lock_min_check_duration         (long)
   9052          * cpu_min_check_duration               (long)
   9053          * service_usage_interaction_time       (long)
   9054          * usage_stats_interaction_interval     (long)
   9055          * service_restart_duration             (long)
   9056          * service_reset_run_duration           (long)
   9057          * service_restart_duration_factor      (int)
   9058          * service_min_restart_time_between     (long)
   9059          * service_max_inactivity               (long)
   9060          * service_bg_start_timeout             (long)
   9061          * </pre>
   9062          *
   9063          * <p>
   9064          * Type: string
   9065          * @hide
   9066          * @see com.android.server.am.ActivityManagerConstants
   9067          */
   9068         public static final String ACTIVITY_MANAGER_CONSTANTS = "activity_manager_constants";
   9069 
   9070         /**
   9071          * Device Idle (Doze) specific settings.
   9072          * This is encoded as a key=value list, separated by commas. Ex:
   9073          *
   9074          * "inactive_to=60000,sensing_to=400000"
   9075          *
   9076          * The following keys are supported:
   9077          *
   9078          * <pre>
   9079          * inactive_to                      (long)
   9080          * sensing_to                       (long)
   9081          * motion_inactive_to               (long)
   9082          * idle_after_inactive_to           (long)
   9083          * idle_pending_to                  (long)
   9084          * max_idle_pending_to              (long)
   9085          * idle_pending_factor              (float)
   9086          * idle_to                          (long)
   9087          * max_idle_to                      (long)
   9088          * idle_factor                      (float)
   9089          * min_time_to_alarm                (long)
   9090          * max_temp_app_whitelist_duration  (long)
   9091          * notification_whitelist_duration  (long)
   9092          * </pre>
   9093          *
   9094          * <p>
   9095          * Type: string
   9096          * @hide
   9097          * @see com.android.server.DeviceIdleController.Constants
   9098          */
   9099         public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";
   9100 
   9101         /**
   9102          * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
   9103          *
   9104          * <p>
   9105          * Type: string
   9106          * @hide
   9107          * @see com.android.server.DeviceIdleController.Constants
   9108          */
   9109         public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";
   9110 
   9111         /**
   9112          * Battery Saver specific settings
   9113          * This is encoded as a key=value list, separated by commas. Ex:
   9114          *
   9115          * "vibration_disabled=true,adjust_brightness_factor=0.5"
   9116          *
   9117          * The following keys are supported:
   9118          *
   9119          * <pre>
   9120          * vibration_disabled                (boolean)
   9121          * animation_disabled                (boolean)
   9122          * soundtrigger_disabled             (boolean)
   9123          * fullbackup_deferred               (boolean)
   9124          * keyvaluebackup_deferred           (boolean)
   9125          * firewall_disabled                 (boolean)
   9126          * gps_mode                          (int)
   9127          * adjust_brightness_disabled        (boolean)
   9128          * adjust_brightness_factor          (float)
   9129          * </pre>
   9130          * @hide
   9131          * @see com.android.server.power.BatterySaverPolicy
   9132          */
   9133         public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
   9134 
   9135         /**
   9136          * App standby (app idle) specific settings.
   9137          * This is encoded as a key=value list, separated by commas. Ex:
   9138          *
   9139          * "idle_duration=5000,parole_interval=4500"
   9140          *
   9141          * The following keys are supported:
   9142          *
   9143          * <pre>
   9144          * idle_duration2       (long)
   9145          * wallclock_threshold  (long)
   9146          * parole_interval      (long)
   9147          * parole_duration      (long)
   9148          *
   9149          * idle_duration        (long) // This is deprecated and used to circumvent b/26355386.
   9150          * </pre>
   9151          *
   9152          * <p>
   9153          * Type: string
   9154          * @hide
   9155          * @see com.android.server.usage.UsageStatsService.SettingsObserver
   9156          */
   9157         public static final String APP_IDLE_CONSTANTS = "app_idle_constants";
   9158 
   9159         /**
   9160          * Power manager specific settings.
   9161          * This is encoded as a key=value list, separated by commas. Ex:
   9162          *
   9163          * "no_cached_wake_locks=1"
   9164          *
   9165          * The following keys are supported:
   9166          *
   9167          * <pre>
   9168          * no_cached_wake_locks                 (boolean)
   9169          * </pre>
   9170          *
   9171          * <p>
   9172          * Type: string
   9173          * @hide
   9174          * @see com.android.server.power.PowerManagerConstants
   9175          */
   9176         public static final String POWER_MANAGER_CONSTANTS = "power_manager_constants";
   9177 
   9178         /**
   9179          * Alarm manager specific settings.
   9180          * This is encoded as a key=value list, separated by commas. Ex:
   9181          *
   9182          * "min_futurity=5000,allow_while_idle_short_time=4500"
   9183          *
   9184          * The following keys are supported:
   9185          *
   9186          * <pre>
   9187          * min_futurity                         (long)
   9188          * min_interval                         (long)
   9189          * allow_while_idle_short_time          (long)
   9190          * allow_while_idle_long_time           (long)
   9191          * allow_while_idle_whitelist_duration  (long)
   9192          * </pre>
   9193          *
   9194          * <p>
   9195          * Type: string
   9196          * @hide
   9197          * @see com.android.server.AlarmManagerService.Constants
   9198          */
   9199         public static final String ALARM_MANAGER_CONSTANTS = "alarm_manager_constants";
   9200 
   9201         /**
   9202          * Job scheduler specific settings.
   9203          * This is encoded as a key=value list, separated by commas. Ex:
   9204          *
   9205          * "min_ready_jobs_count=2,moderate_use_factor=.5"
   9206          *
   9207          * The following keys are supported:
   9208          *
   9209          * <pre>
   9210          * min_idle_count                       (int)
   9211          * min_charging_count                   (int)
   9212          * min_connectivity_count               (int)
   9213          * min_content_count                    (int)
   9214          * min_ready_jobs_count                 (int)
   9215          * heavy_use_factor                     (float)
   9216          * moderate_use_factor                  (float)
   9217          * fg_job_count                         (int)
   9218          * bg_normal_job_count                  (int)
   9219          * bg_moderate_job_count                (int)
   9220          * bg_low_job_count                     (int)
   9221          * bg_critical_job_count                (int)
   9222          * </pre>
   9223          *
   9224          * <p>
   9225          * Type: string
   9226          * @hide
   9227          * @see com.android.server.job.JobSchedulerService.Constants
   9228          */
   9229         public static final String JOB_SCHEDULER_CONSTANTS = "job_scheduler_constants";
   9230 
   9231         /**
   9232          * ShortcutManager specific settings.
   9233          * This is encoded as a key=value list, separated by commas. Ex:
   9234          *
   9235          * "reset_interval_sec=86400,max_updates_per_interval=1"
   9236          *
   9237          * The following keys are supported:
   9238          *
   9239          * <pre>
   9240          * reset_interval_sec              (long)
   9241          * max_updates_per_interval        (int)
   9242          * max_icon_dimension_dp           (int, DP)
   9243          * max_icon_dimension_dp_lowram    (int, DP)
   9244          * max_shortcuts                   (int)
   9245          * icon_quality                    (int, 0-100)
   9246          * icon_format                     (String)
   9247          * </pre>
   9248          *
   9249          * <p>
   9250          * Type: string
   9251          * @hide
   9252          * @see com.android.server.pm.ShortcutService.ConfigConstants
   9253          */
   9254         public static final String SHORTCUT_MANAGER_CONSTANTS = "shortcut_manager_constants";
   9255 
   9256         /**
   9257          * DevicePolicyManager specific settings.
   9258          * This is encoded as a key=value list, separated by commas. Ex:
   9259          *
   9260          * <pre>
   9261          * das_died_service_reconnect_backoff_sec       (long)
   9262          * das_died_service_reconnect_backoff_increase  (float)
   9263          * das_died_service_reconnect_max_backoff_sec   (long)
   9264          * </pre>
   9265          *
   9266          * <p>
   9267          * Type: string
   9268          * @hide
   9269          * see also com.android.server.devicepolicy.DevicePolicyConstants
   9270          */
   9271         public static final String DEVICE_POLICY_CONSTANTS = "device_policy_constants";
   9272 
   9273         /**
   9274          * Get the key that retrieves a bluetooth headset's priority.
   9275          * @hide
   9276          */
   9277         public static final String getBluetoothHeadsetPriorityKey(String address) {
   9278             return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9279         }
   9280 
   9281         /**
   9282          * Get the key that retrieves a bluetooth a2dp sink's priority.
   9283          * @hide
   9284          */
   9285         public static final String getBluetoothA2dpSinkPriorityKey(String address) {
   9286             return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9287         }
   9288 
   9289         /**
   9290          * Get the key that retrieves a bluetooth a2dp src's priority.
   9291          * @hide
   9292          */
   9293         public static final String getBluetoothA2dpSrcPriorityKey(String address) {
   9294             return BLUETOOTH_A2DP_SRC_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9295         }
   9296 
   9297         /**
   9298          * Get the key that retrieves a bluetooth a2dp device's ability to support optional codecs.
   9299          * @hide
   9300          */
   9301         public static final String getBluetoothA2dpSupportsOptionalCodecsKey(String address) {
   9302             return BLUETOOTH_A2DP_SUPPORTS_OPTIONAL_CODECS_PREFIX +
   9303                     address.toUpperCase(Locale.ROOT);
   9304         }
   9305 
   9306         /**
   9307          * Get the key that retrieves whether a bluetooth a2dp device should have optional codecs
   9308          * enabled.
   9309          * @hide
   9310          */
   9311         public static final String getBluetoothA2dpOptionalCodecsEnabledKey(String address) {
   9312             return BLUETOOTH_A2DP_OPTIONAL_CODECS_ENABLED_PREFIX +
   9313                     address.toUpperCase(Locale.ROOT);
   9314         }
   9315 
   9316         /**
   9317          * Get the key that retrieves a bluetooth Input Device's priority.
   9318          * @hide
   9319          */
   9320         public static final String getBluetoothInputDevicePriorityKey(String address) {
   9321             return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9322         }
   9323 
   9324         /**
   9325          * Get the key that retrieves a bluetooth pan client priority.
   9326          * @hide
   9327          */
   9328         public static final String getBluetoothPanPriorityKey(String address) {
   9329             return BLUETOOTH_PAN_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9330         }
   9331 
   9332         /**
   9333          * Get the key that retrieves a bluetooth map priority.
   9334          * @hide
   9335          */
   9336         public static final String getBluetoothMapPriorityKey(String address) {
   9337             return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9338         }
   9339 
   9340         /**
   9341          * Get the key that retrieves a bluetooth map client priority.
   9342          * @hide
   9343          */
   9344         public static final String getBluetoothMapClientPriorityKey(String address) {
   9345             return BLUETOOTH_MAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9346         }
   9347 
   9348         /**
   9349          * Get the key that retrieves a bluetooth pbap client priority.
   9350          * @hide
   9351          */
   9352         public static final String getBluetoothPbapClientPriorityKey(String address) {
   9353             return BLUETOOTH_PBAP_CLIENT_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9354         }
   9355 
   9356         /**
   9357          * Get the key that retrieves a bluetooth sap priority.
   9358          * @hide
   9359          */
   9360         public static final String getBluetoothSapPriorityKey(String address) {
   9361             return BLUETOOTH_SAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
   9362         }
   9363 
   9364         /**
   9365          * Scaling factor for normal window animations. Setting to 0 will
   9366          * disable window animations.
   9367          */
   9368         public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
   9369 
   9370         /**
   9371          * Scaling factor for activity transition animations. Setting to 0 will
   9372          * disable window animations.
   9373          */
   9374         public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
   9375 
   9376         /**
   9377          * Scaling factor for Animator-based animations. This affects both the
   9378          * start delay and duration of all such animations. Setting to 0 will
   9379          * cause animations to end immediately. The default value is 1.
   9380          */
   9381         public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
   9382 
   9383         /**
   9384          * Scaling factor for normal window animations. Setting to 0 will
   9385          * disable window animations.
   9386          *
   9387          * @hide
   9388          */
   9389         public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
   9390 
   9391         /**
   9392          * If 0, the compatibility mode is off for all applications.
   9393          * If 1, older applications run under compatibility mode.
   9394          * TODO: remove this settings before code freeze (bug/1907571)
   9395          * @hide
   9396          */
   9397         public static final String COMPATIBILITY_MODE = "compatibility_mode";
   9398 
   9399         /**
   9400          * CDMA only settings
   9401          * Emergency Tone  0 = Off
   9402          *                 1 = Alert
   9403          *                 2 = Vibrate
   9404          * @hide
   9405          */
   9406         public static final String EMERGENCY_TONE = "emergency_tone";
   9407 
   9408         /**
   9409          * CDMA only settings
   9410          * Whether the auto retry is enabled. The value is
   9411          * boolean (1 or 0).
   9412          * @hide
   9413          */
   9414         public static final String CALL_AUTO_RETRY = "call_auto_retry";
   9415 
   9416         /**
   9417          * A setting that can be read whether the emergency affordance is currently needed.
   9418          * The value is a boolean (1 or 0).
   9419          * @hide
   9420          */
   9421         public static final String EMERGENCY_AFFORDANCE_NEEDED = "emergency_affordance_needed";
   9422 
   9423         /**
   9424          * See RIL_PreferredNetworkType in ril.h
   9425          * @hide
   9426          */
   9427         public static final String PREFERRED_NETWORK_MODE =
   9428                 "preferred_network_mode";
   9429 
   9430         /**
   9431          * Name of an application package to be debugged.
   9432          */
   9433         public static final String DEBUG_APP = "debug_app";
   9434 
   9435         /**
   9436          * If 1, when launching DEBUG_APP it will wait for the debugger before
   9437          * starting user code.  If 0, it will run normally.
   9438          */
   9439         public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
   9440 
   9441         /**
   9442          * Control whether the process CPU usage meter should be shown.
   9443          *
   9444          * @deprecated This functionality is no longer available as of
   9445          * {@link android.os.Build.VERSION_CODES#N_MR1}.
   9446          */
   9447         @Deprecated
   9448         public static final String SHOW_PROCESSES = "show_processes";
   9449 
   9450         /**
   9451          * If 1 low power mode is enabled.
   9452          * @hide
   9453          */
   9454         public static final String LOW_POWER_MODE = "low_power";
   9455 
   9456         /**
   9457          * Battery level [1-99] at which low power mode automatically turns on.
   9458          * If 0, it will not automatically turn on.
   9459          * @hide
   9460          */
   9461         public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
   9462 
   9463          /**
   9464          * If not 0, the activity manager will aggressively finish activities and
   9465          * processes as soon as they are no longer needed.  If 0, the normal
   9466          * extended lifetime is used.
   9467          */
   9468         public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
   9469 
   9470         /**
   9471          * Use Dock audio output for media:
   9472          *      0 = disabled
   9473          *      1 = enabled
   9474          * @hide
   9475          */
   9476         public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
   9477 
   9478         /**
   9479          * The surround sound formats AC3, DTS or IEC61937 are
   9480          * available for use if they are detected.
   9481          * This is the default mode.
   9482          *
   9483          * Note that AUTO is equivalent to ALWAYS for Android TVs and other
   9484          * devices that have an S/PDIF output. This is because S/PDIF
   9485          * is unidirectional and the TV cannot know if a decoder is
   9486          * connected. So it assumes they are always available.
   9487          * @hide
   9488          */
   9489          public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0;
   9490 
   9491         /**
   9492          * AC3, DTS or IEC61937 are NEVER available, even if they
   9493          * are detected by the hardware. Those formats will not be
   9494          * reported.
   9495          *
   9496          * An example use case would be an AVR reports that it is capable of
   9497          * surround sound decoding but is broken. If NEVER is chosen
   9498          * then apps must use PCM output instead of encoded output.
   9499          * @hide
   9500          */
   9501          public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1;
   9502 
   9503         /**
   9504          * AC3, DTS or IEC61937 are ALWAYS available, even if they
   9505          * are not detected by the hardware. Those formats will be
   9506          * reported as part of the HDMI output capability. Applications
   9507          * are then free to use either PCM or encoded output.
   9508          *
   9509          * An example use case would be a when TV was connected over
   9510          * TOS-link to an AVR. But the TV could not see it because TOS-link
   9511          * is unidirectional.
   9512          * @hide
   9513          */
   9514          public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2;
   9515 
   9516         /**
   9517          * Set to ENCODED_SURROUND_OUTPUT_AUTO,
   9518          * ENCODED_SURROUND_OUTPUT_NEVER or
   9519          * ENCODED_SURROUND_OUTPUT_ALWAYS
   9520          * @hide
   9521          */
   9522         public static final String ENCODED_SURROUND_OUTPUT = "encoded_surround_output";
   9523 
   9524         /**
   9525          * Persisted safe headphone volume management state by AudioService
   9526          * @hide
   9527          */
   9528         public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
   9529 
   9530         /**
   9531          * URL for tzinfo (time zone) updates
   9532          * @hide
   9533          */
   9534         public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
   9535 
   9536         /**
   9537          * URL for tzinfo (time zone) update metadata
   9538          * @hide
   9539          */
   9540         public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
   9541 
   9542         /**
   9543          * URL for selinux (mandatory access control) updates
   9544          * @hide
   9545          */
   9546         public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
   9547 
   9548         /**
   9549          * URL for selinux (mandatory access control) update metadata
   9550          * @hide
   9551          */
   9552         public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
   9553 
   9554         /**
   9555          * URL for sms short code updates
   9556          * @hide
   9557          */
   9558         public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
   9559                 "sms_short_codes_content_url";
   9560 
   9561         /**
   9562          * URL for sms short code update metadata
   9563          * @hide
   9564          */
   9565         public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
   9566                 "sms_short_codes_metadata_url";
   9567 
   9568         /**
   9569          * URL for apn_db updates
   9570          * @hide
   9571          */
   9572         public static final String APN_DB_UPDATE_CONTENT_URL = "apn_db_content_url";
   9573 
   9574         /**
   9575          * URL for apn_db update metadata
   9576          * @hide
   9577          */
   9578         public static final String APN_DB_UPDATE_METADATA_URL = "apn_db_metadata_url";
   9579 
   9580         /**
   9581          * URL for cert pinlist updates
   9582          * @hide
   9583          */
   9584         public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
   9585 
   9586         /**
   9587          * URL for cert pinlist updates
   9588          * @hide
   9589          */
   9590         public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
   9591 
   9592         /**
   9593          * URL for intent firewall updates
   9594          * @hide
   9595          */
   9596         public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
   9597                 "intent_firewall_content_url";
   9598 
   9599         /**
   9600          * URL for intent firewall update metadata
   9601          * @hide
   9602          */
   9603         public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
   9604                 "intent_firewall_metadata_url";
   9605 
   9606         /**
   9607          * URL for lang id model updates
   9608          * @hide
   9609          */
   9610         public static final String LANG_ID_UPDATE_CONTENT_URL = "lang_id_content_url";
   9611 
   9612         /**
   9613          * URL for lang id model update metadata
   9614          * @hide
   9615          */
   9616         public static final String LANG_ID_UPDATE_METADATA_URL = "lang_id_metadata_url";
   9617 
   9618         /**
   9619          * URL for smart selection model updates
   9620          * @hide
   9621          */
   9622         public static final String SMART_SELECTION_UPDATE_CONTENT_URL =
   9623                 "smart_selection_content_url";
   9624 
   9625         /**
   9626          * URL for smart selection model update metadata
   9627          * @hide
   9628          */
   9629         public static final String SMART_SELECTION_UPDATE_METADATA_URL =
   9630                 "smart_selection_metadata_url";
   9631 
   9632         /**
   9633          * SELinux enforcement status. If 0, permissive; if 1, enforcing.
   9634          * @hide
   9635          */
   9636         public static final String SELINUX_STATUS = "selinux_status";
   9637 
   9638         /**
   9639          * Developer setting to force RTL layout.
   9640          * @hide
   9641          */
   9642         public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
   9643 
   9644         /**
   9645          * Milliseconds after screen-off after which low battery sounds will be silenced.
   9646          *
   9647          * If zero, battery sounds will always play.
   9648          * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
   9649          *
   9650          * @hide
   9651          */
   9652         public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
   9653 
   9654         /**
   9655          * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
   9656          * the caller is done with this, they should call {@link ContentResolver#delete} to
   9657          * clean up any value that they may have written.
   9658          *
   9659          * @hide
   9660          */
   9661         public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
   9662 
   9663         /**
   9664          * Defines global runtime overrides to window policy.
   9665          *
   9666          * See {@link com.android.server.policy.PolicyControl} for value format.
   9667          *
   9668          * @hide
   9669          */
   9670         public static final String POLICY_CONTROL = "policy_control";
   9671 
   9672         /**
   9673          * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
   9674          * or ZEN_MODE_NO_INTERRUPTIONS.
   9675          *
   9676          * @hide
   9677          */
   9678         public static final String ZEN_MODE = "zen_mode";
   9679 
   9680         /** @hide */ public static final int ZEN_MODE_OFF = 0;
   9681         /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
   9682         /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
   9683         /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
   9684 
   9685         /** @hide */ public static String zenModeToString(int mode) {
   9686             if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
   9687             if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
   9688             if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
   9689             return "ZEN_MODE_OFF";
   9690         }
   9691 
   9692         /** @hide */ public static boolean isValidZenMode(int value) {
   9693             switch (value) {
   9694                 case Global.ZEN_MODE_OFF:
   9695                 case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
   9696                 case Global.ZEN_MODE_ALARMS:
   9697                 case Global.ZEN_MODE_NO_INTERRUPTIONS:
   9698                     return true;
   9699                 default:
   9700                     return false;
   9701             }
   9702         }
   9703 
   9704         /**
   9705          * Value of the ringer before entering zen mode.
   9706          *
   9707          * @hide
   9708          */
   9709         public static final String ZEN_MODE_RINGER_LEVEL = "zen_mode_ringer_level";
   9710 
   9711         /**
   9712          * Opaque value, changes when persisted zen mode configuration changes.
   9713          *
   9714          * @hide
   9715          */
   9716         public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
   9717 
   9718         /**
   9719          * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
   9720          *
   9721          * @hide
   9722          */
   9723         public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
   9724                 "heads_up_notifications_enabled";
   9725 
   9726         /** @hide */ public static final int HEADS_UP_OFF = 0;
   9727         /** @hide */ public static final int HEADS_UP_ON = 1;
   9728 
   9729         /**
   9730          * The name of the device
   9731          */
   9732         public static final String DEVICE_NAME = "device_name";
   9733 
   9734         /**
   9735          * Whether the NetworkScoringService has been first initialized.
   9736          * <p>
   9737          * Type: int (0 for false, 1 for true)
   9738          * @hide
   9739          */
   9740         public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
   9741 
   9742         /**
   9743          * Whether the user wants to be prompted for password to decrypt the device on boot.
   9744          * This only matters if the storage is encrypted.
   9745          * <p>
   9746          * Type: int (0 for false, 1 for true)
   9747          * @hide
   9748          */
   9749         public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
   9750 
   9751         /**
   9752          * Whether the Volte is enabled
   9753          * <p>
   9754          * Type: int (0 for false, 1 for true)
   9755          * @hide
   9756          */
   9757         public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
   9758 
   9759         /**
   9760          * Whether VT (Video Telephony over IMS) is enabled
   9761          * <p>
   9762          * Type: int (0 for false, 1 for true)
   9763          *
   9764          * @hide
   9765          */
   9766         public static final String VT_IMS_ENABLED = "vt_ims_enabled";
   9767 
   9768         /**
   9769          * Whether WFC is enabled
   9770          * <p>
   9771          * Type: int (0 for false, 1 for true)
   9772          *
   9773          * @hide
   9774          */
   9775         public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
   9776 
   9777         /**
   9778          * WFC mode on home/non-roaming network.
   9779          * <p>
   9780          * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
   9781          *
   9782          * @hide
   9783          */
   9784         public static final String WFC_IMS_MODE = "wfc_ims_mode";
   9785 
   9786         /**
   9787          * WFC mode on roaming network.
   9788          * <p>
   9789          * Type: int - see {@link #WFC_IMS_MODE} for values
   9790          *
   9791          * @hide
   9792          */
   9793         public static final String WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode";
   9794 
   9795         /**
   9796          * Whether WFC roaming is enabled
   9797          * <p>
   9798          * Type: int (0 for false, 1 for true)
   9799          *
   9800          * @hide
   9801          */
   9802         public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
   9803 
   9804         /**
   9805          * Whether user can enable/disable LTE as a preferred network. A carrier might control
   9806          * this via gservices, OMA-DM, carrier app, etc.
   9807          * <p>
   9808          * Type: int (0 for false, 1 for true)
   9809          * @hide
   9810          */
   9811         public static final String LTE_SERVICE_FORCED = "lte_service_forced";
   9812 
   9813         /**
   9814          * Ephemeral app cookie max size in bytes.
   9815          * <p>
   9816          * Type: int
   9817          * @hide
   9818          */
   9819         public static final String EPHEMERAL_COOKIE_MAX_SIZE_BYTES =
   9820                 "ephemeral_cookie_max_size_bytes";
   9821 
   9822         /**
   9823          * Toggle to enable/disable the entire ephemeral feature. By default, ephemeral is
   9824          * enabled. Set to zero to disable.
   9825          * <p>
   9826          * Type: int (0 for false, 1 for true)
   9827          *
   9828          * @hide
   9829          */
   9830         public static final String ENABLE_EPHEMERAL_FEATURE = "enable_ephemeral_feature";
   9831 
   9832         /**
   9833          * Toggle to enable/disable dexopt for instant applications. The default is for dexopt
   9834          * to be disabled.
   9835          * <p>
   9836          * Type: int (0 to disable, 1 to enable)
   9837          *
   9838          * @hide
   9839          */
   9840         public static final String INSTANT_APP_DEXOPT_ENABLED = "instant_app_dexopt_enabled";
   9841 
   9842         /**
   9843          * The min period for caching installed instant apps in milliseconds.
   9844          * <p>
   9845          * Type: long
   9846          * @hide
   9847          */
   9848         public static final String INSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
   9849                 "installed_instant_app_min_cache_period";
   9850 
   9851         /**
   9852          * The max period for caching installed instant apps in milliseconds.
   9853          * <p>
   9854          * Type: long
   9855          * @hide
   9856          */
   9857         public static final String INSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
   9858                 "installed_instant_app_max_cache_period";
   9859 
   9860         /**
   9861          * The min period for caching uninstalled instant apps in milliseconds.
   9862          * <p>
   9863          * Type: long
   9864          * @hide
   9865          */
   9866         public static final String UNINSTALLED_INSTANT_APP_MIN_CACHE_PERIOD =
   9867                 "uninstalled_instant_app_min_cache_period";
   9868 
   9869         /**
   9870          * The max period for caching uninstalled instant apps in milliseconds.
   9871          * <p>
   9872          * Type: long
   9873          * @hide
   9874          */
   9875         public static final String UNINSTALLED_INSTANT_APP_MAX_CACHE_PERIOD =
   9876                 "uninstalled_instant_app_max_cache_period";
   9877 
   9878         /**
   9879          * The min period for caching unused static shared libs in milliseconds.
   9880          * <p>
   9881          * Type: long
   9882          * @hide
   9883          */
   9884         public static final String UNUSED_STATIC_SHARED_LIB_MIN_CACHE_PERIOD =
   9885                 "unused_static_shared_lib_min_cache_period";
   9886 
   9887         /**
   9888          * Allows switching users when system user is locked.
   9889          * <p>
   9890          * Type: int
   9891          * @hide
   9892          */
   9893         public static final String ALLOW_USER_SWITCHING_WHEN_SYSTEM_USER_LOCKED =
   9894                 "allow_user_switching_when_system_user_locked";
   9895 
   9896         /**
   9897          * Boot count since the device starts running APK level 24.
   9898          * <p>
   9899          * Type: int
   9900          */
   9901         public static final String BOOT_COUNT = "boot_count";
   9902 
   9903         /**
   9904          * Whether the safe boot is disallowed.
   9905          *
   9906          * <p>This setting should have the identical value as the corresponding user restriction.
   9907          * The purpose of the setting is to make the restriction available in early boot stages
   9908          * before the user restrictions are loaded.
   9909          * @hide
   9910          */
   9911         public static final String SAFE_BOOT_DISALLOWED = "safe_boot_disallowed";
   9912 
   9913         /**
   9914          * Whether this device is currently in retail demo mode. If true, device
   9915          * usage is severely limited.
   9916          * <p>
   9917          * Type: int (0 for false, 1 for true)
   9918          * @hide
   9919          */
   9920         public static final String DEVICE_DEMO_MODE = "device_demo_mode";
   9921 
   9922         /**
   9923          * Retail mode specific settings. This is encoded as a key=value list, separated by commas.
   9924          * Ex: "user_inactivity_timeout_ms=30000,warning_dialog_timeout_ms=10000". The following
   9925          * keys are supported:
   9926          *
   9927          * <pre>
   9928          * user_inactivity_timeout_ms  (long)
   9929          * warning_dialog_timeout_ms   (long)
   9930          * </pre>
   9931          * <p>
   9932          * Type: string
   9933          *
   9934          * @hide
   9935          */
   9936         public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants";
   9937 
   9938         /**
   9939          * Indicates the maximum time that an app is blocked for the network rules to get updated.
   9940          *
   9941          * Type: long
   9942          *
   9943          * @hide
   9944          */
   9945         public static final String NETWORK_ACCESS_TIMEOUT_MS = "network_access_timeout_ms";
   9946 
   9947         /**
   9948          * The reason for the settings database being downgraded. This is only for
   9949          * troubleshooting purposes and its value should not be interpreted in any way.
   9950          *
   9951          * Type: string
   9952          *
   9953          * @hide
   9954          */
   9955         public static final String DATABASE_DOWNGRADE_REASON = "database_downgrade_reason";
   9956 
   9957         /**
   9958          * The build id of when the settings database was first created (or re-created due it
   9959          * being missing).
   9960          *
   9961          * Type: string
   9962          *
   9963          * @hide
   9964          */
   9965         public static final String DATABASE_CREATION_BUILDID = "database_creation_buildid";
   9966 
   9967         /**
   9968          * Flag to toggle journal mode WAL on or off for the contacts database. WAL is enabled by
   9969          * default. Set to 0 to disable.
   9970          *
   9971          * @hide
   9972          */
   9973         public static final String CONTACTS_DATABASE_WAL_ENABLED = "contacts_database_wal_enabled";
   9974 
   9975         /**
   9976          * Flag to enable the link to location permissions in location setting. Set to 0 to disable.
   9977          *
   9978          * @hide
   9979          */
   9980         public static final String LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED =
   9981                 "location_settings_link_to_permissions_enabled";
   9982 
   9983         /**
   9984          * Settings to backup. This is here so that it's in the same place as the settings
   9985          * keys and easy to update.
   9986          *
   9987          * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
   9988          * and Secure as well.  This is because those tables drive both backup and
   9989          * restore, and restore needs to properly whitelist keys that used to live
   9990          * in those namespaces.  The keys will only actually be backed up / restored
   9991          * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
   9992          *
   9993          * NOTE: Settings are backed up and restored in the order they appear
   9994          *       in this array. If you have one setting depending on another,
   9995          *       make sure that they are ordered appropriately.
   9996          *
   9997          * @hide
   9998          */
   9999         public static final String[] SETTINGS_TO_BACKUP = {
   10000             BUGREPORT_IN_POWER_MENU,
   10001             STAY_ON_WHILE_PLUGGED_IN,
   10002             AUTO_TIME,
   10003             AUTO_TIME_ZONE,
   10004             POWER_SOUNDS_ENABLED,
   10005             DOCK_SOUNDS_ENABLED,
   10006             CHARGING_SOUNDS_ENABLED,
   10007             USB_MASS_STORAGE_ENABLED,
   10008             NETWORK_RECOMMENDATIONS_ENABLED,
   10009             WIFI_WAKEUP_ENABLED,
   10010             WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
   10011             USE_OPEN_WIFI_PACKAGE,
   10012             WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
   10013             EMERGENCY_TONE,
   10014             CALL_AUTO_RETRY,
   10015             DOCK_AUDIO_MEDIA_ENABLED,
   10016             ENCODED_SURROUND_OUTPUT,
   10017             LOW_POWER_MODE_TRIGGER_LEVEL,
   10018             BLUETOOTH_ON
   10019         };
   10020 
   10021         private static final ContentProviderHolder sProviderHolder =
   10022                 new ContentProviderHolder(CONTENT_URI);
   10023 
   10024         // Populated lazily, guarded by class object:
   10025         private static final NameValueCache sNameValueCache = new NameValueCache(
   10026                     CONTENT_URI,
   10027                     CALL_METHOD_GET_GLOBAL,
   10028                     CALL_METHOD_PUT_GLOBAL,
   10029                     sProviderHolder);
   10030 
   10031         // Certain settings have been moved from global to the per-user secure namespace
   10032         private static final HashSet<String> MOVED_TO_SECURE;
   10033         static {
   10034             MOVED_TO_SECURE = new HashSet<>(1);
   10035             MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
   10036         }
   10037 
   10038         /** @hide */
   10039         public static void getMovedToSecureSettings(Set<String> outKeySet) {
   10040             outKeySet.addAll(MOVED_TO_SECURE);
   10041         }
   10042 
   10043         /**
   10044          * Look up a name in the database.
   10045          * @param resolver to access the database with
   10046          * @param name to look up in the table
   10047          * @return the corresponding value, or null if not present
   10048          */
   10049         public static String getString(ContentResolver resolver, String name) {
   10050             return getStringForUser(resolver, name, UserHandle.myUserId());
   10051         }
   10052 
   10053         /** @hide */
   10054         public static String getStringForUser(ContentResolver resolver, String name,
   10055                 int userHandle) {
   10056             if (MOVED_TO_SECURE.contains(name)) {
   10057                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
   10058                         + " to android.provider.Settings.Secure, returning read-only value.");
   10059                 return Secure.getStringForUser(resolver, name, userHandle);
   10060             }
   10061             return sNameValueCache.getStringForUser(resolver, name, userHandle);
   10062         }
   10063 
   10064         /**
   10065          * Store a name/value pair into the database.
   10066          * @param resolver to access the database with
   10067          * @param name to store
   10068          * @param value to associate with the name
   10069          * @return true if the value was set, false on database errors
   10070          */
   10071         public static boolean putString(ContentResolver resolver,
   10072                 String name, String value) {
   10073             return putStringForUser(resolver, name, value, null, false, UserHandle.myUserId());
   10074         }
   10075 
   10076         /**
   10077          * Store a name/value pair into the database.
   10078          * <p>
   10079          * The method takes an optional tag to associate with the setting
   10080          * which can be used to clear only settings made by your package and
   10081          * associated with this tag by passing the tag to {@link
   10082          * #resetToDefaults(ContentResolver, String)}. Anyone can override
   10083          * the current tag. Also if another package changes the setting
   10084          * then the tag will be set to the one specified in the set call
   10085          * which can be null. Also any of the settings setters that do not
   10086          * take a tag as an argument effectively clears the tag.
   10087          * </p><p>
   10088          * For example, if you set settings A and B with tags T1 and T2 and
   10089          * another app changes setting A (potentially to the same value), it
   10090          * can assign to it a tag T3 (note that now the package that changed
   10091          * the setting is not yours). Now if you reset your changes for T1 and
   10092          * T2 only setting B will be reset and A not (as it was changed by
   10093          * another package) but since A did not change you are in the desired
   10094          * initial state. Now if the other app changes the value of A (assuming
   10095          * you registered an observer in the beginning) you would detect that
   10096          * the setting was changed by another app and handle this appropriately
   10097          * (ignore, set back to some value, etc).
   10098          * </p><p>
   10099          * Also the method takes an argument whether to make the value the
   10100          * default for this setting. If the system already specified a default
   10101          * value, then the one passed in here will <strong>not</strong>
   10102          * be set as the default.
   10103          * </p>
   10104          *
   10105          * @param resolver to access the database with.
   10106          * @param name to store.
   10107          * @param value to associate with the name.
   10108          * @param tag to associated with the setting.
   10109          * @param makeDefault whether to make the value the default one.
   10110          * @return true if the value was set, false on database errors.
   10111          *
   10112          * @see #resetToDefaults(ContentResolver, String)
   10113          *
   10114          * @hide
   10115          */
   10116         @SystemApi
   10117         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
   10118         public static boolean putString(@NonNull ContentResolver resolver,
   10119                 @NonNull String name, @Nullable String value, @Nullable String tag,
   10120                 boolean makeDefault) {
   10121             return putStringForUser(resolver, name, value, tag, makeDefault,
   10122                     UserHandle.myUserId());
   10123         }
   10124 
   10125         /**
   10126          * Reset the settings to their defaults. This would reset <strong>only</strong>
   10127          * settings set by the caller's package. Think of it of a way to undo your own
   10128          * changes to the secure settings. Passing in the optional tag will reset only
   10129          * settings changed by your package and associated with this tag.
   10130          *
   10131          * @param resolver Handle to the content resolver.
   10132          * @param tag Optional tag which should be associated with the settings to reset.
   10133          *
   10134          * @see #putString(ContentResolver, String, String, String, boolean)
   10135          *
   10136          * @hide
   10137          */
   10138         @SystemApi
   10139         @RequiresPermission(Manifest.permission.WRITE_SECURE_SETTINGS)
   10140         public static void resetToDefaults(@NonNull ContentResolver resolver,
   10141                 @Nullable String tag) {
   10142             resetToDefaultsAsUser(resolver, tag, RESET_MODE_PACKAGE_DEFAULTS,
   10143                     UserHandle.myUserId());
   10144         }
   10145 
   10146         /**
   10147          * Reset the settings to their defaults for a given user with a specific mode. The
   10148          * optional tag argument is valid only for {@link #RESET_MODE_PACKAGE_DEFAULTS}
   10149          * allowing resetting the settings made by a package and associated with the tag.
   10150          *
   10151          * @param resolver Handle to the content resolver.
   10152          * @param tag Optional tag which should be associated with the settings to reset.
   10153          * @param mode The reset mode.
   10154          * @param userHandle The user for which to reset to defaults.
   10155          *
   10156          * @see #RESET_MODE_PACKAGE_DEFAULTS
   10157          * @see #RESET_MODE_UNTRUSTED_DEFAULTS
   10158          * @see #RESET_MODE_UNTRUSTED_CHANGES
   10159          * @see #RESET_MODE_TRUSTED_DEFAULTS
   10160          *
   10161          * @hide
   10162          */
   10163         public static void resetToDefaultsAsUser(@NonNull ContentResolver resolver,
   10164                 @Nullable String tag, @ResetMode int mode, @IntRange(from = 0) int userHandle) {
   10165             try {
   10166                 Bundle arg = new Bundle();
   10167                 arg.putInt(CALL_METHOD_USER_KEY, userHandle);
   10168                 if (tag != null) {
   10169                     arg.putString(CALL_METHOD_TAG_KEY, tag);
   10170                 }
   10171                 arg.putInt(CALL_METHOD_RESET_MODE_KEY, mode);
   10172                 IContentProvider cp = sProviderHolder.getProvider(resolver);
   10173                 cp.call(resolver.getPackageName(), CALL_METHOD_RESET_GLOBAL, null, arg);
   10174             } catch (RemoteException e) {
   10175                 Log.w(TAG, "Can't reset do defaults for " + CONTENT_URI, e);
   10176             }
   10177         }
   10178 
   10179         /** @hide */
   10180         public static boolean putStringForUser(ContentResolver resolver,
   10181                 String name, String value, int userHandle) {
   10182             return putStringForUser(resolver, name, value, null, false, userHandle);
   10183         }
   10184 
   10185         /** @hide */
   10186         public static boolean putStringForUser(@NonNull ContentResolver resolver,
   10187                 @NonNull String name, @Nullable String value, @Nullable String tag,
   10188                 boolean makeDefault, @UserIdInt int userHandle) {
   10189             if (LOCAL_LOGV) {
   10190                 Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
   10191                         + " for " + userHandle);
   10192             }
   10193             // Global and Secure have the same access policy so we can forward writes
   10194             if (MOVED_TO_SECURE.contains(name)) {
   10195                 Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
   10196                         + " to android.provider.Settings.Secure, value is unchanged.");
   10197                 return Secure.putStringForUser(resolver, name, value, tag,
   10198                         makeDefault, userHandle);
   10199             }
   10200             return sNameValueCache.putStringForUser(resolver, name, value, tag,
   10201                     makeDefault, userHandle);
   10202         }
   10203 
   10204         /**
   10205          * Construct the content URI for a particular name/value pair,
   10206          * useful for monitoring changes with a ContentObserver.
   10207          * @param name to look up in the table
   10208          * @return the corresponding content URI, or null if not present
   10209          */
   10210         public static Uri getUriFor(String name) {
   10211             return getUriFor(CONTENT_URI, name);
   10212         }
   10213 
   10214         /**
   10215          * Convenience function for retrieving a single secure settings value
   10216          * as an integer.  Note that internally setting values are always
   10217          * stored as strings; this function converts the string to an integer
   10218          * for you.  The default value will be returned if the setting is
   10219          * not defined or not an integer.
   10220          *
   10221          * @param cr The ContentResolver to access.
   10222          * @param name The name of the setting to retrieve.
   10223          * @param def Value to return if the setting is not defined.
   10224          *
   10225          * @return The setting's current value, or 'def' if it is not defined
   10226          * or not a valid integer.
   10227          */
   10228         public static int getInt(ContentResolver cr, String name, int def) {
   10229             String v = getString(cr, name);
   10230             try {
   10231                 return v != null ? Integer.parseInt(v) : def;
   10232             } catch (NumberFormatException e) {
   10233                 return def;
   10234             }
   10235         }
   10236 
   10237         /**
   10238          * Convenience function for retrieving a single secure settings value
   10239          * as an integer.  Note that internally setting values are always
   10240          * stored as strings; this function converts the string to an integer
   10241          * for you.
   10242          * <p>
   10243          * This version does not take a default value.  If the setting has not
   10244          * been set, or the string value is not a number,
   10245          * it throws {@link SettingNotFoundException}.
   10246          *
   10247          * @param cr The ContentResolver to access.
   10248          * @param name The name of the setting to retrieve.
   10249          *
   10250          * @throws SettingNotFoundException Thrown if a setting by the given
   10251          * name can't be found or the setting value is not an integer.
   10252          *
   10253          * @return The setting's current value.
   10254          */
   10255         public static int getInt(ContentResolver cr, String name)
   10256                 throws SettingNotFoundException {
   10257             String v = getString(cr, name);
   10258             try {
   10259                 return Integer.parseInt(v);
   10260             } catch (NumberFormatException e) {
   10261                 throw new SettingNotFoundException(name);
   10262             }
   10263         }
   10264 
   10265         /**
   10266          * Convenience function for updating a single settings value as an
   10267          * integer. This will either create a new entry in the table if the
   10268          * given name does not exist, or modify the value of the existing row
   10269          * with that name.  Note that internally setting values are always
   10270          * stored as strings, so this function converts the given value to a
   10271          * string before storing it.
   10272          *
   10273          * @param cr The ContentResolver to access.
   10274          * @param name The name of the setting to modify.
   10275          * @param value The new value for the setting.
   10276          * @return true if the value was set, false on database errors
   10277          */
   10278         public static boolean putInt(ContentResolver cr, String name, int value) {
   10279             return putString(cr, name, Integer.toString(value));
   10280         }
   10281 
   10282         /**
   10283          * Convenience function for retrieving a single secure settings value
   10284          * as a {@code long}.  Note that internally setting values are always
   10285          * stored as strings; this function converts the string to a {@code long}
   10286          * for you.  The default value will be returned if the setting is
   10287          * not defined or not a {@code long}.
   10288          *
   10289          * @param cr The ContentResolver to access.
   10290          * @param name The name of the setting to retrieve.
   10291          * @param def Value to return if the setting is not defined.
   10292          *
   10293          * @return The setting's current value, or 'def' if it is not defined
   10294          * or not a valid {@code long}.
   10295          */
   10296         public static long getLong(ContentResolver cr, String name, long def) {
   10297             String valString = getString(cr, name);
   10298             long value;
   10299             try {
   10300                 value = valString != null ? Long.parseLong(valString) : def;
   10301             } catch (NumberFormatException e) {
   10302                 value = def;
   10303             }
   10304             return value;
   10305         }
   10306 
   10307         /**
   10308          * Convenience function for retrieving a single secure settings value
   10309          * as a {@code long}.  Note that internally setting values are always
   10310          * stored as strings; this function converts the string to a {@code long}
   10311          * for you.
   10312          * <p>
   10313          * This version does not take a default value.  If the setting has not
   10314          * been set, or the string value is not a number,
   10315          * it throws {@link SettingNotFoundException}.
   10316          *
   10317          * @param cr The ContentResolver to access.
   10318          * @param name The name of the setting to retrieve.
   10319          *
   10320          * @return The setting's current value.
   10321          * @throws SettingNotFoundException Thrown if a setting by the given
   10322          * name can't be found or the setting value is not an integer.
   10323          */
   10324         public static long getLong(ContentResolver cr, String name)
   10325                 throws SettingNotFoundException {
   10326             String valString = getString(cr, name);
   10327             try {
   10328                 return Long.parseLong(valString);
   10329             } catch (NumberFormatException e) {
   10330                 throw new SettingNotFoundException(name);
   10331             }
   10332         }
   10333 
   10334         /**
   10335          * Convenience function for updating a secure settings value as a long
   10336          * integer. This will either create a new entry in the table if the
   10337          * given name does not exist, or modify the value of the existing row
   10338          * with that name.  Note that internally setting values are always
   10339          * stored as strings, so this function converts the given value to a
   10340          * string before storing it.
   10341          *
   10342          * @param cr The ContentResolver to access.
   10343          * @param name The name of the setting to modify.
   10344          * @param value The new value for the setting.
   10345          * @return true if the value was set, false on database errors
   10346          */
   10347         public static boolean putLong(ContentResolver cr, String name, long value) {
   10348             return putString(cr, name, Long.toString(value));
   10349         }
   10350 
   10351         /**
   10352          * Convenience function for retrieving a single secure settings value
   10353          * as a floating point number.  Note that internally setting values are
   10354          * always stored as strings; this function converts the string to an
   10355          * float for you. The default value will be returned if the setting
   10356          * is not defined or not a valid float.
   10357          *
   10358          * @param cr The ContentResolver to access.
   10359          * @param name The name of the setting to retrieve.
   10360          * @param def Value to return if the setting is not defined.
   10361          *
   10362          * @return The setting's current value, or 'def' if it is not defined
   10363          * or not a valid float.
   10364          */
   10365         public static float getFloat(ContentResolver cr, String name, float def) {
   10366             String v = getString(cr, name);
   10367             try {
   10368                 return v != null ? Float.parseFloat(v) : def;
   10369             } catch (NumberFormatException e) {
   10370                 return def;
   10371             }
   10372         }
   10373 
   10374         /**
   10375          * Convenience function for retrieving a single secure settings value
   10376          * as a float.  Note that internally setting values are always
   10377          * stored as strings; this function converts the string to a float
   10378          * for you.
   10379          * <p>
   10380          * This version does not take a default value.  If the setting has not
   10381          * been set, or the string value is not a number,
   10382          * it throws {@link SettingNotFoundException}.
   10383          *
   10384          * @param cr The ContentResolver to access.
   10385          * @param name The name of the setting to retrieve.
   10386          *
   10387          * @throws SettingNotFoundException Thrown if a setting by the given
   10388          * name can't be found or the setting value is not a float.
   10389          *
   10390          * @return The setting's current value.
   10391          */
   10392         public static float getFloat(ContentResolver cr, String name)
   10393                 throws SettingNotFoundException {
   10394             String v = getString(cr, name);
   10395             if (v == null) {
   10396                 throw new SettingNotFoundException(name);
   10397             }
   10398             try {
   10399                 return Float.parseFloat(v);
   10400             } catch (NumberFormatException e) {
   10401                 throw new SettingNotFoundException(name);
   10402             }
   10403         }
   10404 
   10405         /**
   10406          * Convenience function for updating a single settings value as a
   10407          * floating point number. This will either create a new entry in the
   10408          * table if the given name does not exist, or modify the value of the
   10409          * existing row with that name.  Note that internally setting values
   10410          * are always stored as strings, so this function converts the given
   10411          * value to a string before storing it.
   10412          *
   10413          * @param cr The ContentResolver to access.
   10414          * @param name The name of the setting to modify.
   10415          * @param value The new value for the setting.
   10416          * @return true if the value was set, false on database errors
   10417          */
   10418         public static boolean putFloat(ContentResolver cr, String name, float value) {
   10419             return putString(cr, name, Float.toString(value));
   10420         }
   10421 
   10422         /**
   10423           * Subscription to be used for voice call on a multi sim device. The supported values
   10424           * are 0 = SUB1, 1 = SUB2 and etc.
   10425           * @hide
   10426           */
   10427         public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
   10428 
   10429         /**
   10430           * Used to provide option to user to select subscription during dial.
   10431           * The supported values are 0 = disable or 1 = enable prompt.
   10432           * @hide
   10433           */
   10434         public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
   10435 
   10436         /**
   10437           * Subscription to be used for data call on a multi sim device. The supported values
   10438           * are 0 = SUB1, 1 = SUB2 and etc.
   10439           * @hide
   10440           */
   10441         public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
   10442 
   10443         /**
   10444           * Subscription to be used for SMS on a multi sim device. The supported values
   10445           * are 0 = SUB1, 1 = SUB2 and etc.
   10446           * @hide
   10447           */
   10448         public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
   10449 
   10450        /**
   10451           * Used to provide option to user to select subscription during send SMS.
   10452           * The value 1 - enable, 0 - disable
   10453           * @hide
   10454           */
   10455         public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
   10456 
   10457 
   10458 
   10459         /** User preferred subscriptions setting.
   10460           * This holds the details of the user selected subscription from the card and
   10461           * the activation status. Each settings string have the coma separated values
   10462           * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
   10463           * @hide
   10464          */
   10465         public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
   10466                 "user_preferred_sub2","user_preferred_sub3"};
   10467 
   10468         /**
   10469          * Whether to enable new contacts aggregator or not.
   10470          * The value 1 - enable, 0 - disable
   10471          * @hide
   10472          */
   10473         public static final String NEW_CONTACT_AGGREGATOR = "new_contact_aggregator";
   10474 
   10475         /**
   10476          * Whether to enable contacts metadata syncing or not
   10477          * The value 1 - enable, 0 - disable
   10478          *
   10479          * @removed
   10480          */
   10481         @Deprecated
   10482         public static final String CONTACT_METADATA_SYNC = "contact_metadata_sync";
   10483 
   10484         /**
   10485          * Whether to enable contacts metadata syncing or not
   10486          * The value 1 - enable, 0 - disable
   10487          */
   10488         public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
   10489 
   10490         /**
   10491          * Whether to enable cellular on boot.
   10492          * The value 1 - enable, 0 - disable
   10493          * @hide
   10494          */
   10495         public static final String ENABLE_CELLULAR_ON_BOOT = "enable_cellular_on_boot";
   10496 
   10497         /**
   10498          * The maximum allowed notification enqueue rate in Hertz.
   10499          *
   10500          * Should be a float, and includes both posts and updates.
   10501          * @hide
   10502          */
   10503         public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate";
   10504 
   10505         /**
   10506          * Displays toasts when an app posts a notification that does not specify a valid channel.
   10507          *
   10508          * The value 1 - enable, 0 - disable
   10509          * @hide
   10510          */
   10511         public static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS =
   10512                 "show_notification_channel_warnings";
   10513 
   10514         /**
   10515          * Whether cell is enabled/disabled
   10516          * @hide
   10517          */
   10518         public static final String CELL_ON = "cell_on";
   10519 
   10520         /**
   10521          * Global settings which can be accessed by instant apps.
   10522          * @hide
   10523          */
   10524         public static final Set<String> INSTANT_APP_SETTINGS = new ArraySet<>();
   10525         static {
   10526             INSTANT_APP_SETTINGS.add(WAIT_FOR_DEBUGGER);
   10527             INSTANT_APP_SETTINGS.add(DEVICE_PROVISIONED);
   10528             INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES);
   10529             INSTANT_APP_SETTINGS.add(DEVELOPMENT_FORCE_RTL);
   10530             INSTANT_APP_SETTINGS.add(EPHEMERAL_COOKIE_MAX_SIZE_BYTES);
   10531             INSTANT_APP_SETTINGS.add(AIRPLANE_MODE_ON);
   10532             INSTANT_APP_SETTINGS.add(WINDOW_ANIMATION_SCALE);
   10533             INSTANT_APP_SETTINGS.add(TRANSITION_ANIMATION_SCALE);
   10534             INSTANT_APP_SETTINGS.add(ANIMATOR_DURATION_SCALE);
   10535             INSTANT_APP_SETTINGS.add(DEBUG_VIEW_ATTRIBUTES);
   10536             INSTANT_APP_SETTINGS.add(WTF_IS_FATAL);
   10537         }
   10538 
   10539         /**
   10540          * Whether to show the high temperature warning notification.
   10541          * @hide
   10542          */
   10543         public static final String SHOW_TEMPERATURE_WARNING = "show_temperature_warning";
   10544 
   10545         /**
   10546          * Temperature at which the high temperature warning notification should be shown.
   10547          * @hide
   10548          */
   10549         public static final String WARNING_TEMPERATURE = "warning_temperature";
   10550 
   10551         /**
   10552          * Whether the diskstats logging task is enabled/disabled.
   10553          * @hide
   10554          */
   10555         public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
   10556 
   10557         /**
   10558          * Whether the cache quota calculation task is enabled/disabled.
   10559          * @hide
   10560          */
   10561         public static final String ENABLE_CACHE_QUOTA_CALCULATION =
   10562                 "enable_cache_quota_calculation";
   10563     }
   10564 
   10565     /**
   10566      * User-defined bookmarks and shortcuts.  The target of each bookmark is an
   10567      * Intent URL, allowing it to be either a web page or a particular
   10568      * application activity.
   10569      *
   10570      * @hide
   10571      */
   10572     public static final class Bookmarks implements BaseColumns
   10573     {
   10574         private static final String TAG = "Bookmarks";
   10575 
   10576         /**
   10577          * The content:// style URL for this table
   10578          */
   10579         public static final Uri CONTENT_URI =
   10580             Uri.parse("content://" + AUTHORITY + "/bookmarks");
   10581 
   10582         /**
   10583          * The row ID.
   10584          * <p>Type: INTEGER</p>
   10585          */
   10586         public static final String ID = "_id";
   10587 
   10588         /**
   10589          * Descriptive name of the bookmark that can be displayed to the user.
   10590          * If this is empty, the title should be resolved at display time (use
   10591          * {@link #getTitle(Context, Cursor)} any time you want to display the
   10592          * title of a bookmark.)
   10593          * <P>
   10594          * Type: TEXT
   10595          * </P>
   10596          */
   10597         public static final String TITLE = "title";
   10598 
   10599         /**
   10600          * Arbitrary string (displayed to the user) that allows bookmarks to be
   10601          * organized into categories.  There are some special names for
   10602          * standard folders, which all start with '@'.  The label displayed for
   10603          * the folder changes with the locale (via {@link #getLabelForFolder}) but
   10604          * the folder name does not change so you can consistently query for
   10605          * the folder regardless of the current locale.
   10606          *
   10607          * <P>Type: TEXT</P>
   10608          *
   10609          */
   10610         public static final String FOLDER = "folder";
   10611 
   10612         /**
   10613          * The Intent URL of the bookmark, describing what it points to.  This
   10614          * value is given to {@link android.content.Intent#getIntent} to create
   10615          * an Intent that can be launched.
   10616          * <P>Type: TEXT</P>
   10617          */
   10618         public static final String INTENT = "intent";
   10619 
   10620         /**
   10621          * Optional shortcut character associated with this bookmark.
   10622          * <P>Type: INTEGER</P>
   10623          */
   10624         public static final String SHORTCUT = "shortcut";
   10625 
   10626         /**
   10627          * The order in which the bookmark should be displayed
   10628          * <P>Type: INTEGER</P>
   10629          */
   10630         public static final String ORDERING = "ordering";
   10631 
   10632         private static final String[] sIntentProjection = { INTENT };
   10633         private static final String[] sShortcutProjection = { ID, SHORTCUT };
   10634         private static final String sShortcutSelection = SHORTCUT + "=?";
   10635 
   10636         /**
   10637          * Convenience function to retrieve the bookmarked Intent for a
   10638          * particular shortcut key.
   10639          *
   10640          * @param cr The ContentResolver to query.
   10641          * @param shortcut The shortcut key.
   10642          *
   10643          * @return Intent The bookmarked URL, or null if there is no bookmark
   10644          *         matching the given shortcut.
   10645          */
   10646         public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
   10647         {
   10648             Intent intent = null;
   10649 
   10650             Cursor c = cr.query(CONTENT_URI,
   10651                     sIntentProjection, sShortcutSelection,
   10652                     new String[] { String.valueOf((int) shortcut) }, ORDERING);
   10653             // Keep trying until we find a valid shortcut
   10654             try {
   10655                 while (intent == null && c.moveToNext()) {
   10656                     try {
   10657                         String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
   10658                         intent = Intent.parseUri(intentURI, 0);
   10659                     } catch (java.net.URISyntaxException e) {
   10660                         // The stored URL is bad...  ignore it.
   10661                     } catch (IllegalArgumentException e) {
   10662                         // Column not found
   10663                         Log.w(TAG, "Intent column not found", e);
   10664                     }
   10665                 }
   10666             } finally {
   10667                 if (c != null) c.close();
   10668             }
   10669 
   10670             return intent;
   10671         }
   10672 
   10673         /**
   10674          * Add a new bookmark to the system.
   10675          *
   10676          * @param cr The ContentResolver to query.
   10677          * @param intent The desired target of the bookmark.
   10678          * @param title Bookmark title that is shown to the user; null if none
   10679          *            or it should be resolved to the intent's title.
   10680          * @param folder Folder in which to place the bookmark; null if none.
   10681          * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
   10682          *            this is non-zero and there is an existing bookmark entry
   10683          *            with this same shortcut, then that existing shortcut is
   10684          *            cleared (the bookmark is not removed).
   10685          * @return The unique content URL for the new bookmark entry.
   10686          */
   10687         public static Uri add(ContentResolver cr,
   10688                                            Intent intent,
   10689                                            String title,
   10690                                            String folder,
   10691                                            char shortcut,
   10692                                            int ordering)
   10693         {
   10694             // If a shortcut is supplied, and it is already defined for
   10695             // another bookmark, then remove the old definition.
   10696             if (shortcut != 0) {
   10697                 cr.delete(CONTENT_URI, sShortcutSelection,
   10698                         new String[] { String.valueOf((int) shortcut) });
   10699             }
   10700 
   10701             ContentValues values = new ContentValues();
   10702             if (title != null) values.put(TITLE, title);
   10703             if (folder != null) values.put(FOLDER, folder);
   10704             values.put(INTENT, intent.toUri(0));
   10705             if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
   10706             values.put(ORDERING, ordering);
   10707             return cr.insert(CONTENT_URI, values);
   10708         }
   10709 
   10710         /**
   10711          * Return the folder name as it should be displayed to the user.  This
   10712          * takes care of localizing special folders.
   10713          *
   10714          * @param r Resources object for current locale; only need access to
   10715          *          system resources.
   10716          * @param folder The value found in the {@link #FOLDER} column.
   10717          *
   10718          * @return CharSequence The label for this folder that should be shown
   10719          *         to the user.
   10720          */
   10721         public static CharSequence getLabelForFolder(Resources r, String folder) {
   10722             return folder;
   10723         }
   10724 
   10725         /**
   10726          * Return the title as it should be displayed to the user. This takes
   10727          * care of localizing bookmarks that point to activities.
   10728          *
   10729          * @param context A context.
   10730          * @param cursor A cursor pointing to the row whose title should be
   10731          *        returned. The cursor must contain at least the {@link #TITLE}
   10732          *        and {@link #INTENT} columns.
   10733          * @return A title that is localized and can be displayed to the user,
   10734          *         or the empty string if one could not be found.
   10735          */
   10736         public static CharSequence getTitle(Context context, Cursor cursor) {
   10737             int titleColumn = cursor.getColumnIndex(TITLE);
   10738             int intentColumn = cursor.getColumnIndex(INTENT);
   10739             if (titleColumn == -1 || intentColumn == -1) {
   10740                 throw new IllegalArgumentException(
   10741                         "The cursor must contain the TITLE and INTENT columns.");
   10742             }
   10743 
   10744             String title = cursor.getString(titleColumn);
   10745             if (!TextUtils.isEmpty(title)) {
   10746                 return title;
   10747             }
   10748 
   10749             String intentUri = cursor.getString(intentColumn);
   10750             if (TextUtils.isEmpty(intentUri)) {
   10751                 return "";
   10752             }
   10753 
   10754             Intent intent;
   10755             try {
   10756                 intent = Intent.parseUri(intentUri, 0);
   10757             } catch (URISyntaxException e) {
   10758                 return "";
   10759             }
   10760 
   10761             PackageManager packageManager = context.getPackageManager();
   10762             ResolveInfo info = packageManager.resolveActivity(intent, 0);
   10763             return info != null ? info.loadLabel(packageManager) : "";
   10764         }
   10765     }
   10766 
   10767     /**
   10768      * Returns the device ID that we should use when connecting to the mobile gtalk server.
   10769      * This is a string like "android-0x1242", where the hex string is the Android ID obtained
   10770      * from the GoogleLoginService.
   10771      *
   10772      * @param androidId The Android ID for this device.
   10773      * @return The device ID that should be used when connecting to the mobile gtalk server.
   10774      * @hide
   10775      */
   10776     public static String getGTalkDeviceId(long androidId) {
   10777         return "android-" + Long.toHexString(androidId);
   10778     }
   10779 
   10780     private static final String[] PM_WRITE_SETTINGS = {
   10781         android.Manifest.permission.WRITE_SETTINGS
   10782     };
   10783     private static final String[] PM_CHANGE_NETWORK_STATE = {
   10784         android.Manifest.permission.CHANGE_NETWORK_STATE,
   10785         android.Manifest.permission.WRITE_SETTINGS
   10786     };
   10787     private static final String[] PM_SYSTEM_ALERT_WINDOW = {
   10788         android.Manifest.permission.SYSTEM_ALERT_WINDOW
   10789     };
   10790 
   10791     /**
   10792      * Performs a strict and comprehensive check of whether a calling package is allowed to
   10793      * write/modify system settings, as the condition differs for pre-M, M+, and
   10794      * privileged/preinstalled apps. If the provided uid does not match the
   10795      * callingPackage, a negative result will be returned.
   10796      * @hide
   10797      */
   10798     public static boolean isCallingPackageAllowedToWriteSettings(Context context, int uid,
   10799             String callingPackage, boolean throwException) {
   10800         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
   10801                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
   10802                 PM_WRITE_SETTINGS, false);
   10803     }
   10804 
   10805     /**
   10806      * Performs a strict and comprehensive check of whether a calling package is allowed to
   10807      * write/modify system settings, as the condition differs for pre-M, M+, and
   10808      * privileged/preinstalled apps. If the provided uid does not match the
   10809      * callingPackage, a negative result will be returned. The caller is expected to have
   10810      * the WRITE_SETTINGS permission declared.
   10811      *
   10812      * Note: if the check is successful, the operation of this app will be updated to the
   10813      * current time.
   10814      * @hide
   10815      */
   10816     public static boolean checkAndNoteWriteSettingsOperation(Context context, int uid,
   10817             String callingPackage, boolean throwException) {
   10818         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
   10819                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
   10820                 PM_WRITE_SETTINGS, true);
   10821     }
   10822 
   10823     /**
   10824      * Performs a strict and comprehensive check of whether a calling package is allowed to
   10825      * change the state of network, as the condition differs for pre-M, M+, and
   10826      * privileged/preinstalled apps. The caller is expected to have either the
   10827      * CHANGE_NETWORK_STATE or the WRITE_SETTINGS permission declared. Either of these
   10828      * permissions allow changing network state; WRITE_SETTINGS is a runtime permission and
   10829      * can be revoked, but (except in M, excluding M MRs), CHANGE_NETWORK_STATE is a normal
   10830      * permission and cannot be revoked. See http://b/23597341
   10831      *
   10832      * Note: if the check succeeds because the application holds WRITE_SETTINGS, the operation
   10833      * of this app will be updated to the current time.
   10834      * @hide
   10835      */
   10836     public static boolean checkAndNoteChangeNetworkStateOperation(Context context, int uid,
   10837             String callingPackage, boolean throwException) {
   10838         if (context.checkCallingOrSelfPermission(android.Manifest.permission.CHANGE_NETWORK_STATE)
   10839                 == PackageManager.PERMISSION_GRANTED) {
   10840             return true;
   10841         }
   10842         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
   10843                 callingPackage, throwException, AppOpsManager.OP_WRITE_SETTINGS,
   10844                 PM_CHANGE_NETWORK_STATE, true);
   10845     }
   10846 
   10847     /**
   10848      * Performs a strict and comprehensive check of whether a calling package is allowed to
   10849      * draw on top of other apps, as the conditions differs for pre-M, M+, and
   10850      * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
   10851      * a negative result will be returned.
   10852      * @hide
   10853      */
   10854     public static boolean isCallingPackageAllowedToDrawOverlays(Context context, int uid,
   10855             String callingPackage, boolean throwException) {
   10856         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
   10857                 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
   10858                 PM_SYSTEM_ALERT_WINDOW, false);
   10859     }
   10860 
   10861     /**
   10862      * Performs a strict and comprehensive check of whether a calling package is allowed to
   10863      * draw on top of other apps, as the conditions differs for pre-M, M+, and
   10864      * privileged/preinstalled apps. If the provided uid does not match the callingPackage,
   10865      * a negative result will be returned.
   10866      *
   10867      * Note: if the check is successful, the operation of this app will be updated to the
   10868      * current time.
   10869      * @hide
   10870      */
   10871     public static boolean checkAndNoteDrawOverlaysOperation(Context context, int uid, String
   10872             callingPackage, boolean throwException) {
   10873         return isCallingPackageAllowedToPerformAppOpsProtectedOperation(context, uid,
   10874                 callingPackage, throwException, AppOpsManager.OP_SYSTEM_ALERT_WINDOW,
   10875                 PM_SYSTEM_ALERT_WINDOW, true);
   10876     }
   10877 
   10878     /**
   10879      * Helper method to perform a general and comprehensive check of whether an operation that is
   10880      * protected by appops can be performed by a caller or not. e.g. OP_SYSTEM_ALERT_WINDOW and
   10881      * OP_WRITE_SETTINGS
   10882      * @hide
   10883      */
   10884     public static boolean isCallingPackageAllowedToPerformAppOpsProtectedOperation(Context context,
   10885             int uid, String callingPackage, boolean throwException, int appOpsOpCode, String[]
   10886             permissions, boolean makeNote) {
   10887         if (callingPackage == null) {
   10888             return false;
   10889         }
   10890 
   10891         AppOpsManager appOpsMgr = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE);
   10892         int mode = AppOpsManager.MODE_DEFAULT;
   10893         if (makeNote) {
   10894             mode = appOpsMgr.noteOpNoThrow(appOpsOpCode, uid, callingPackage);
   10895         } else {
   10896             mode = appOpsMgr.checkOpNoThrow(appOpsOpCode, uid, callingPackage);
   10897         }
   10898 
   10899         switch (mode) {
   10900             case AppOpsManager.MODE_ALLOWED:
   10901                 return true;
   10902 
   10903             case AppOpsManager.MODE_DEFAULT:
   10904                 // this is the default operating mode after an app's installation
   10905                 // In this case we will check all associated static permission to see
   10906                 // if it is granted during install time.
   10907                 for (String permission : permissions) {
   10908                     if (context.checkCallingOrSelfPermission(permission) == PackageManager
   10909                             .PERMISSION_GRANTED) {
   10910                         // if either of the permissions are granted, we will allow it
   10911                         return true;
   10912                     }
   10913                 }
   10914 
   10915             default:
   10916                 // this is for all other cases trickled down here...
   10917                 if (!throwException) {
   10918                     return false;
   10919                 }
   10920         }
   10921 
   10922         // prepare string to throw SecurityException
   10923         StringBuilder exceptionMessage = new StringBuilder();
   10924         exceptionMessage.append(callingPackage);
   10925         exceptionMessage.append(" was not granted ");
   10926         if (permissions.length > 1) {
   10927             exceptionMessage.append(" either of these permissions: ");
   10928         } else {
   10929             exceptionMessage.append(" this permission: ");
   10930         }
   10931         for (int i = 0; i < permissions.length; i++) {
   10932             exceptionMessage.append(permissions[i]);
   10933             exceptionMessage.append((i == permissions.length - 1) ? "." : ", ");
   10934         }
   10935 
   10936         throw new SecurityException(exceptionMessage.toString());
   10937     }
   10938 
   10939     /**
   10940      * Retrieves a correponding package name for a given uid. It will query all
   10941      * packages that are associated with the given uid, but it will return only
   10942      * the zeroth result.
   10943      * Note: If package could not be found, a null is returned.
   10944      * @hide
   10945      */
   10946     public static String getPackageNameForUid(Context context, int uid) {
   10947         String[] packages = context.getPackageManager().getPackagesForUid(uid);
   10948         if (packages == null) {
   10949             return null;
   10950         }
   10951         return packages[0];
   10952     }
   10953 }
   10954