Settings.java revision fc746f8ac5ea74747a502d4a75161a46f9cb892d
18eb69d60c09c1c4683066a94c889df28d0e9d233James Dong/*
28eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * Copyright (C) 2006 The Android Open Source Project
38eb69d60c09c1c4683066a94c889df28d0e9d233James Dong *
48eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * Licensed under the Apache License, Version 2.0 (the "License");
58eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * you may not use this file except in compliance with the License.
68eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * You may obtain a copy of the License at
78eb69d60c09c1c4683066a94c889df28d0e9d233James Dong *
88eb69d60c09c1c4683066a94c889df28d0e9d233James Dong *      http://www.apache.org/licenses/LICENSE-2.0
98eb69d60c09c1c4683066a94c889df28d0e9d233James Dong *
108eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * Unless required by applicable law or agreed to in writing, software
118eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * distributed under the License is distributed on an "AS IS" BASIS,
128eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * See the License for the specific language governing permissions and
148eb69d60c09c1c4683066a94c889df28d0e9d233James Dong * limitations under the License.
158eb69d60c09c1c4683066a94c889df28d0e9d233James Dong */
168eb69d60c09c1c4683066a94c889df28d0e9d233James Dong
179a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huberpackage android.provider;
189a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber
199a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huberimport android.annotation.SdkConstant;
209a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huberimport android.annotation.SdkConstant.SdkConstantType;
21e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.annotation.SystemApi;
22840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huberimport android.app.SearchManager;
23e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.app.WallpaperManager;
241b86fe063badb5f28c467ade39be0f4008688947Andreas Huberimport android.content.ComponentName;
25e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.content.ContentResolver;
26e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.content.ContentValues;
27e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.content.Context;
2814acc736e336cbd6026df781d4f411e908831815Andreas Huberimport android.content.IContentProvider;
29b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.content.Intent;
30b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.content.pm.ActivityInfo;
31b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.content.pm.PackageManager;
32b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.content.pm.ResolveInfo;
33b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.content.res.Configuration;
34e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.content.res.Resources;
35e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.database.Cursor;
36e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.database.SQLException;
37a6195decfe4f9021bbbd7deb050495c33371366bJeff Brownimport android.location.LocationManager;
38df712ea86e6350f7005a02ab0e1c60c28a343ed0Mathias Agopianimport android.net.ConnectivityManager;
391a2952aee048ca7b1765e2bc09ebe9aeddaeafa3Mathias Agopianimport android.net.Uri;
40e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.net.wifi.WifiManager;
41e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.BatteryManager;
423dca4c7a5622fc6aa03397d749c4b4c1201cc4f3Mathias Agopianimport android.os.Bundle;
43e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.DropBoxManager;
44e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.IBinder;
45e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.Process;
46e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.RemoteException;
47b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huberimport android.os.ServiceManager;
48e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.SystemProperties;
49e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.UserHandle;
50e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.os.Build.VERSION_CODES;
51e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.speech.tts.TextToSpeech;
52e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.text.TextUtils;
53e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.util.AndroidException;
54e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.util.ArrayMap;
55e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.util.ArraySet;
56e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport android.util.Log;
57e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
58e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport com.android.internal.util.ArrayUtils;
59e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport com.android.internal.widget.ILockSettings;
60f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
619a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huberimport java.net.URISyntaxException;
62e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.text.SimpleDateFormat;
63e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.util.HashMap;
64e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.util.HashSet;
65e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.util.Locale;
66e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.util.Map;
67e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huberimport java.util.Set;
68e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
69e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber/**
70f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * The Settings provider contains global system-level device preferences.
71f933441648ef6a71dee783d733aac17b9508b452Andreas Huber */
729a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huberpublic final class Settings {
73e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
74f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    // Intent actions for Settings
75f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
76f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    /**
77e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show system settings.
78e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
79e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
80b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
81b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
82e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
83e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
84e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
85e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
86e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
87e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of APNs.
88e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
89e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
90e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
91e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
92e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
93e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
94f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
959a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber
969a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber    /**
97df64d15042bbd5e0e4933ac49bf3c177dd94752cSteve Block     * Activity Action: Show settings to allow configuration of current location
989a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * sources.
999a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * <p>
1009a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
101f933441648ef6a71dee783d733aac17b9508b452Andreas Huber     * safeguard against this.
102f933441648ef6a71dee783d733aac17b9508b452Andreas Huber     * <p>
103f933441648ef6a71dee783d733aac17b9508b452Andreas Huber     * Input: Nothing.
1049a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * <p>
1059a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * Output: Nothing.
1069a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     */
107f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1089a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber    public static final String ACTION_LOCATION_SOURCE_SETTINGS =
109f933441648ef6a71dee783d733aac17b9508b452Andreas Huber            "android.settings.LOCATION_SOURCE_SETTINGS";
1109a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber
111f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    /**
1129a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * Activity Action: Show settings to allow configuration of wireless controls
113f933441648ef6a71dee783d733aac17b9508b452Andreas Huber     * such as Wi-Fi, Bluetooth and Mobile networks.
114e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
115e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
116e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
117e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
11814acc736e336cbd6026df781d4f411e908831815Andreas Huber     * Input: Nothing.
119e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
120e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
1219a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     */
1229a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
123e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_WIRELESS_SETTINGS =
124e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.WIRELESS_SETTINGS";
125b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
126b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
127b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to allow entering/exiting airplane mode.
128b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
129b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
130b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
131b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
132b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
133b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
134b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
135b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
136b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
137b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_AIRPLANE_MODE_SETTINGS =
138b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.AIRPLANE_MODE_SETTINGS";
139b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
140b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
141b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Modify Airplane mode settings using the users voice.
142b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
143b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you safeguard against this.
144b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
145b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * This intent MUST be started using
146b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * {@link android.service.voice.VoiceInteractionSession#startVoiceActivity
147b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * startVoiceActivity}.
148b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
149b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * To tell which state airplane mode should be set to, add the
150b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * {@link #EXTRA_AIRPLANE_MODE_ENABLED} extra to this Intent with the state specified.
151b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * If there is no extra in this Intent, no changes will be made.
152b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
153b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * The activity should verify that
154b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * {@link android.app.Activity#isVoiceInteraction isVoiceInteraction} returns true before
155b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * modifying the setting.
156b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
157b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
158b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
159b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
160b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
161b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
162b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE =
1631b86fe063badb5f28c467ade39be0f4008688947Andreas Huber            "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
1641b86fe063badb5f28c467ade39be0f4008688947Andreas Huber
1651b86fe063badb5f28c467ade39be0f4008688947Andreas Huber    /**
166b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings for accessibility modules.
167b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
168b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
169b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
170b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
171b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
172b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
173b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
174b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
175b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
176b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_ACCESSIBILITY_SETTINGS =
177b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.ACCESSIBILITY_SETTINGS";
178b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
179b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
180b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to control access to usage information.
181b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
182b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
183b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
184b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
185b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
186b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
187b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
188b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
189b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
190b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_USAGE_ACCESS_SETTINGS =
191b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.USAGE_ACCESS_SETTINGS";
192b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
193b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
194b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to allow configuration of security and
195b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * location privacy.
196b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
197b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
198b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
199b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
200b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
201b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
202b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
203b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
204b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
205b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_SECURITY_SETTINGS =
206b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.SECURITY_SETTINGS";
207b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
208b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
209b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show trusted credentials settings, opening to the user tab,
210b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * to allow management of installed credentials.
211b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
212b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
213b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
214b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
215b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
216b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
217b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
218b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * @hide
219b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
220b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
221b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_TRUSTED_CREDENTIALS_USER =
222b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "com.android.settings.TRUSTED_CREDENTIALS_USER";
223b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
224b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
225b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show dialog explaining that an installed CA cert may enable
226b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * monitoring of encrypted network traffic.
227b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
228b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
229b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
230b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
231b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
232b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
233b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
234b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * @hide
235b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
236b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
237b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_MONITORING_CERT_INFO =
238b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "com.android.settings.MONITORING_CERT_INFO";
239b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
240b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
241b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to allow configuration of privacy options.
242b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
243b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
244b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
245b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
246b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
247b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
248b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
249b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
250b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
251b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_PRIVACY_SETTINGS =
252b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.PRIVACY_SETTINGS";
253b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
254b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
255b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to allow configuration of Wi-Fi.
256b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
257b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
258b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
259b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
260b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
261b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
262b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
263b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
264e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
265e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
266e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_WIFI_SETTINGS =
267e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.WIFI_SETTINGS";
268e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
269e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
270e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of a static IP
271e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * address for Wi-Fi.
272b483c4724846c0b8d4e82afcbb7c17f671bae81cGloria Wang     * <p>
273e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you safeguard
274e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * against this.
275e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
276e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
277e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
278e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
279e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
280e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
281e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_WIFI_IP_SETTINGS =
282e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.WIFI_IP_SETTINGS";
283e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
284e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
285e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of Bluetooth.
286e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
287e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
288e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
289e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
290e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
291e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
292e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
293e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
294e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
295e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_BLUETOOTH_SETTINGS =
296e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.BLUETOOTH_SETTINGS";
297e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
298e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
299e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of Wifi Displays.
300e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
301e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
302e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
303e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
304b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
305b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
306e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
307e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * @hide
308e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
309e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
310e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_WIFI_DISPLAY_SETTINGS =
311e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.WIFI_DISPLAY_SETTINGS";
312e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
313e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
314a6195decfe4f9021bbbd7deb050495c33371366bJeff Brown     * Activity Action: Show settings to allow configuration of
315a6195decfe4f9021bbbd7deb050495c33371366bJeff Brown     * {@link android.media.routing.MediaRouteService media route providers}.
3163dca4c7a5622fc6aa03397d749c4b4c1201cc4f3Mathias Agopian     * <p>
317a6195decfe4f9021bbbd7deb050495c33371366bJeff Brown     * In some cases, a matching Activity may not exist, so ensure you
3183dca4c7a5622fc6aa03397d749c4b4c1201cc4f3Mathias Agopian     * safeguard against this.
3193dca4c7a5622fc6aa03397d749c4b4c1201cc4f3Mathias Agopian     * <p>
3209a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * Input: Nothing.
3213856b090cd04ba5dd4a59a12430ed724d5995909Steve Block     * <p>
3229a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber     * Output: Nothing.
323e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
324e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
325e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_CAST_SETTINGS =
3269a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber            "android.settings.CAST_SETTINGS";
3279a442c1b9a051edc6d4ceb0daad2d0a8433e7b0bAndreas Huber
328e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
329e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of date and time.
330e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
331e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
332e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
333e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
3342df788fb0c402938f827bf9c9ce2ca3ab1dcd464Mathias Agopian     * Input: Nothing.
33593d5ab693626fa2700375e838e4bb90e4d50e605Andreas Huber     * <p>
336e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
3372df788fb0c402938f827bf9c9ce2ca3ab1dcd464Mathias Agopian     */
338e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
339e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_DATE_SETTINGS =
340e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.DATE_SETTINGS";
341e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
342e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
343e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to allow configuration of sound and volume.
344e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
345e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
346e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
347e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
348b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
349b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
350b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
351e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     */
352840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
353840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    public static final String ACTION_SOUND_SETTINGS =
354840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber            "android.settings.SOUND_SETTINGS";
355840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber
356b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
357840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber     * Activity Action: Show settings to allow configuration of display.
358b9787142c5f5f8f47e7e35409f4f2ef7112ab72eAndreas Huber     * <p>
359b9787142c5f5f8f47e7e35409f4f2ef7112ab72eAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
360b9787142c5f5f8f47e7e35409f4f2ef7112ab72eAndreas Huber     * safeguard against this.
361b9787142c5f5f8f47e7e35409f4f2ef7112ab72eAndreas Huber     * <p>
362b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Input: Nothing.
363e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
364b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Output: Nothing.
365b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     */
366b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
367b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    public static final String ACTION_DISPLAY_SETTINGS =
368b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber            "android.settings.DISPLAY_SETTINGS";
369b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber
370b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber    /**
371b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * Activity Action: Show settings to allow configuration of locale.
372b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * <p>
373b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * In some cases, a matching Activity may not exist, so ensure you
374b26a1176517579bd4d23f2a2cc91eca2e59b245cAndreas Huber     * safeguard against this.
375e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
376e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
3778d6cc842e8d525405c68e57fdf3bc5da0b4d7e87Glenn Kasten     * <p>
378e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
379d681bbb1767bed09415e050ba78975df214bcd68Dave Burke     */
3809e1cdea45d40fa8cf95dd080943053856009054fMathias Agopian    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
381e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    public static final String ACTION_LOCALE_SETTINGS =
382e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber            "android.settings.LOCALE_SETTINGS";
383e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber
384e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber    /**
385e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Activity Action: Show settings to configure input methods, in particular
386e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * allowing the user to enable input methods.
387e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
388e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * In some cases, a matching Activity may not exist, so ensure you
389e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * safeguard against this.
390e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
391e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Input: Nothing.
392e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * <p>
393e2b1028852120bcfded33b8f06f66b780437fe92Andreas Huber     * Output: Nothing.
394     */
395    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
396    public static final String ACTION_VOICE_INPUT_SETTINGS =
397            "android.settings.VOICE_INPUT_SETTINGS";
398
399    /**
400     * Activity Action: Show settings to configure input methods, in particular
401     * allowing the user to enable input methods.
402     * <p>
403     * In some cases, a matching Activity may not exist, so ensure you
404     * safeguard against this.
405     * <p>
406     * Input: Nothing.
407     * <p>
408     * Output: Nothing.
409     */
410    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
411    public static final String ACTION_INPUT_METHOD_SETTINGS =
412            "android.settings.INPUT_METHOD_SETTINGS";
413
414    /**
415     * Activity Action: Show settings to enable/disable input method subtypes.
416     * <p>
417     * In some cases, a matching Activity may not exist, so ensure you
418     * safeguard against this.
419     * <p>
420     * To tell which input method's subtypes are displayed in the settings, add
421     * {@link #EXTRA_INPUT_METHOD_ID} extra to this Intent with the input method id.
422     * If there is no extra in this Intent, subtypes from all installed input methods
423     * will be displayed in the settings.
424     *
425     * @see android.view.inputmethod.InputMethodInfo#getId
426     * <p>
427     * Input: Nothing.
428     * <p>
429     * Output: Nothing.
430     */
431    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
432    public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS =
433            "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
434
435    /**
436     * Activity Action: Show a dialog to select input method.
437     * <p>
438     * In some cases, a matching Activity may not exist, so ensure you
439     * safeguard against this.
440     * <p>
441     * Input: Nothing.
442     * <p>
443     * Output: Nothing.
444     * @hide
445     */
446    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
447    public static final String ACTION_SHOW_INPUT_METHOD_PICKER =
448            "android.settings.SHOW_INPUT_METHOD_PICKER";
449
450    /**
451     * Activity Action: Show settings to manage the user input dictionary.
452     * <p>
453     * Starting with {@link android.os.Build.VERSION_CODES#KITKAT},
454     * it is guaranteed there will always be an appropriate implementation for this Intent action.
455     * In prior releases of the platform this was optional, so ensure you safeguard against it.
456     * <p>
457     * Input: Nothing.
458     * <p>
459     * Output: Nothing.
460     */
461    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
462    public static final String ACTION_USER_DICTIONARY_SETTINGS =
463            "android.settings.USER_DICTIONARY_SETTINGS";
464
465    /**
466     * Activity Action: Adds a word to the user dictionary.
467     * <p>
468     * In some cases, a matching Activity may not exist, so ensure you
469     * safeguard against this.
470     * <p>
471     * Input: An extra with key <code>word</code> that contains the word
472     * that should be added to the dictionary.
473     * <p>
474     * Output: Nothing.
475     *
476     * @hide
477     */
478    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
479    public static final String ACTION_USER_DICTIONARY_INSERT =
480            "com.android.settings.USER_DICTIONARY_INSERT";
481
482    /**
483     * Activity Action: Show settings to allow configuration of application-related settings.
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_APPLICATION_SETTINGS =
494            "android.settings.APPLICATION_SETTINGS";
495
496    /**
497     * Activity Action: Show settings to allow configuration of application
498     * development-related settings.  As of
499     * {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} this action is
500     * a required part of the platform.
501     * <p>
502     * Input: Nothing.
503     * <p>
504     * Output: Nothing.
505     */
506    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
507    public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
508            "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
509
510    /**
511     * Activity Action: Show settings to allow configuration of quick launch shortcuts.
512     * <p>
513     * In some cases, a matching Activity may not exist, so ensure you
514     * safeguard against this.
515     * <p>
516     * Input: Nothing.
517     * <p>
518     * Output: Nothing.
519     */
520    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
521    public static final String ACTION_QUICK_LAUNCH_SETTINGS =
522            "android.settings.QUICK_LAUNCH_SETTINGS";
523
524    /**
525     * Activity Action: Show settings to manage installed applications.
526     * <p>
527     * In some cases, a matching Activity may not exist, so ensure you
528     * safeguard against this.
529     * <p>
530     * Input: Nothing.
531     * <p>
532     * Output: Nothing.
533     */
534    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
535    public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
536            "android.settings.MANAGE_APPLICATIONS_SETTINGS";
537
538    /**
539     * Activity Action: Show settings to manage all applications.
540     * <p>
541     * In some cases, a matching Activity may not exist, so ensure you
542     * safeguard against this.
543     * <p>
544     * Input: Nothing.
545     * <p>
546     * Output: Nothing.
547     */
548    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
549    public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
550            "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
551
552    /**
553     * Activity Action: Show screen of details about a particular application.
554     * <p>
555     * In some cases, a matching Activity may not exist, so ensure you
556     * safeguard against this.
557     * <p>
558     * Input: The Intent's data URI specifies the application package name
559     * to be shown, with the "package" scheme.  That is "package:com.my.app".
560     * <p>
561     * Output: Nothing.
562     */
563    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
564    public static final String ACTION_APPLICATION_DETAILS_SETTINGS =
565            "android.settings.APPLICATION_DETAILS_SETTINGS";
566
567    /**
568     * @hide
569     * Activity Action: Show the "app ops" settings screen.
570     * <p>
571     * Input: Nothing.
572     * <p>
573     * Output: Nothing.
574     */
575    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
576    public static final String ACTION_APP_OPS_SETTINGS =
577            "android.settings.APP_OPS_SETTINGS";
578
579    /**
580     * Activity Action: Show settings for system update functionality.
581     * <p>
582     * In some cases, a matching Activity may not exist, so ensure you
583     * safeguard against this.
584     * <p>
585     * Input: Nothing.
586     * <p>
587     * Output: Nothing.
588     *
589     * @hide
590     */
591    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
592    public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
593            "android.settings.SYSTEM_UPDATE_SETTINGS";
594
595    /**
596     * Activity Action: Show settings to allow configuration of sync settings.
597     * <p>
598     * In some cases, a matching Activity may not exist, so ensure you
599     * safeguard against this.
600     * <p>
601     * The account types available to add via the add account button may be restricted by adding an
602     * {@link #EXTRA_AUTHORITIES} extra to this Intent with one or more syncable content provider's
603     * authorities. Only account types which can sync with that content provider will be offered to
604     * the user.
605     * <p>
606     * Input: Nothing.
607     * <p>
608     * Output: Nothing.
609     */
610    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
611    public static final String ACTION_SYNC_SETTINGS =
612            "android.settings.SYNC_SETTINGS";
613
614    /**
615     * Activity Action: Show add account screen for creating a new account.
616     * <p>
617     * In some cases, a matching Activity may not exist, so ensure you
618     * safeguard against this.
619     * <p>
620     * The account types available to add may be restricted by adding an {@link #EXTRA_AUTHORITIES}
621     * extra to the Intent with one or more syncable content provider's authorities.  Only account
622     * types which can sync with that content provider will be offered to the user.
623     * <p>
624     * Account types can also be filtered by adding an {@link #EXTRA_ACCOUNT_TYPES} extra to the
625     * Intent with one or more account types.
626     * <p>
627     * Input: Nothing.
628     * <p>
629     * Output: Nothing.
630     */
631    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
632    public static final String ACTION_ADD_ACCOUNT =
633            "android.settings.ADD_ACCOUNT_SETTINGS";
634
635    /**
636     * Activity Action: Show settings for selecting the network operator.
637     * <p>
638     * In some cases, a matching Activity may not exist, so ensure you
639     * safeguard against this.
640     * <p>
641     * Input: Nothing.
642     * <p>
643     * Output: Nothing.
644     */
645    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
646    public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
647            "android.settings.NETWORK_OPERATOR_SETTINGS";
648
649    /**
650     * Activity Action: Show settings for selection of 2G/3G.
651     * <p>
652     * In some cases, a matching Activity may not exist, so ensure you
653     * safeguard against this.
654     * <p>
655     * Input: Nothing.
656     * <p>
657     * Output: Nothing.
658     */
659    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
660    public static final String ACTION_DATA_ROAMING_SETTINGS =
661            "android.settings.DATA_ROAMING_SETTINGS";
662
663    /**
664     * Activity Action: Show settings for internal storage.
665     * <p>
666     * In some cases, a matching Activity may not exist, so ensure you
667     * safeguard against this.
668     * <p>
669     * Input: Nothing.
670     * <p>
671     * Output: Nothing.
672     */
673    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
674    public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
675            "android.settings.INTERNAL_STORAGE_SETTINGS";
676    /**
677     * Activity Action: Show settings for memory card storage.
678     * <p>
679     * In some cases, a matching Activity may not exist, so ensure you
680     * safeguard against this.
681     * <p>
682     * Input: Nothing.
683     * <p>
684     * Output: Nothing.
685     */
686    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
687    public static final String ACTION_MEMORY_CARD_SETTINGS =
688            "android.settings.MEMORY_CARD_SETTINGS";
689
690    /**
691     * Activity Action: Show settings for global search.
692     * <p>
693     * In some cases, a matching Activity may not exist, so ensure you
694     * safeguard against this.
695     * <p>
696     * Input: Nothing.
697     * <p>
698     * Output: Nothing
699     */
700    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
701    public static final String ACTION_SEARCH_SETTINGS =
702        "android.search.action.SEARCH_SETTINGS";
703
704    /**
705     * Activity Action: Show general device information settings (serial
706     * number, software version, phone number, etc.).
707     * <p>
708     * In some cases, a matching Activity may not exist, so ensure you
709     * safeguard against this.
710     * <p>
711     * Input: Nothing.
712     * <p>
713     * Output: Nothing
714     */
715    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
716    public static final String ACTION_DEVICE_INFO_SETTINGS =
717        "android.settings.DEVICE_INFO_SETTINGS";
718
719    /**
720     * Activity Action: Show NFC settings.
721     * <p>
722     * This shows UI that allows NFC to be turned on or off.
723     * <p>
724     * In some cases, a matching Activity may not exist, so ensure you
725     * safeguard against this.
726     * <p>
727     * Input: Nothing.
728     * <p>
729     * Output: Nothing
730     * @see android.nfc.NfcAdapter#isEnabled()
731     */
732    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
733    public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
734
735    /**
736     * Activity Action: Show NFC Sharing settings.
737     * <p>
738     * This shows UI that allows NDEF Push (Android Beam) to be turned on or
739     * off.
740     * <p>
741     * In some cases, a matching Activity may not exist, so ensure you
742     * safeguard against this.
743     * <p>
744     * Input: Nothing.
745     * <p>
746     * Output: Nothing
747     * @see android.nfc.NfcAdapter#isNdefPushEnabled()
748     */
749    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
750    public static final String ACTION_NFCSHARING_SETTINGS =
751        "android.settings.NFCSHARING_SETTINGS";
752
753    /**
754     * Activity Action: Show NFC Tap & Pay settings
755     * <p>
756     * This shows UI that allows the user to configure Tap&Pay
757     * settings.
758     * <p>
759     * In some cases, a matching Activity may not exist, so ensure you
760     * safeguard against this.
761     * <p>
762     * Input: Nothing.
763     * <p>
764     * Output: Nothing
765     */
766    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
767    public static final String ACTION_NFC_PAYMENT_SETTINGS =
768        "android.settings.NFC_PAYMENT_SETTINGS";
769
770    /**
771     * Activity Action: Show Daydream settings.
772     * <p>
773     * In some cases, a matching Activity may not exist, so ensure you
774     * safeguard against this.
775     * <p>
776     * Input: Nothing.
777     * <p>
778     * Output: Nothing.
779     * @see android.service.dreams.DreamService
780     */
781    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
782    public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
783
784    /**
785     * Activity Action: Show Notification listener settings.
786     * <p>
787     * In some cases, a matching Activity may not exist, so ensure you
788     * safeguard against this.
789     * <p>
790     * Input: Nothing.
791     * <p>
792     * Output: Nothing.
793     * @see android.service.notification.NotificationListenerService
794     */
795    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
796    public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS
797            = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
798
799    /**
800     * @hide
801     */
802    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
803    public static final String ACTION_CONDITION_PROVIDER_SETTINGS
804            = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
805
806    /**
807     * Activity Action: Show settings for video captioning.
808     * <p>
809     * In some cases, a matching Activity may not exist, so ensure you safeguard
810     * against this.
811     * <p>
812     * Input: Nothing.
813     * <p>
814     * Output: Nothing.
815     */
816    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
817    public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
818
819    /**
820     * Activity Action: Show the top level print settings.
821     * <p>
822     * In some cases, a matching Activity may not exist, so ensure you
823     * safeguard against this.
824     * <p>
825     * Input: Nothing.
826     * <p>
827     * Output: Nothing.
828     */
829    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
830    public static final String ACTION_PRINT_SETTINGS =
831            "android.settings.ACTION_PRINT_SETTINGS";
832
833    /**
834     * Activity Action: Show Zen Mode configuration settings.
835     *
836     * @hide
837     */
838    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
839    public static final String ACTION_ZEN_MODE_SETTINGS = "android.settings.ZEN_MODE_SETTINGS";
840
841    /**
842     * Activity Action: Show Zen Mode priority configuration settings.
843     *
844     * @hide
845     */
846    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
847    public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS
848            = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
849
850    /**
851     * Activity Action: Show the regulatory information screen for the device.
852     * <p>
853     * In some cases, a matching Activity may not exist, so ensure you safeguard
854     * against this.
855     * <p>
856     * Input: Nothing.
857     * <p>
858     * Output: Nothing.
859     */
860    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
861    public static final String
862            ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
863
864    /**
865     * Activity Action: Show Device Name Settings.
866     * <p>
867     * In some cases, a matching Activity may not exist, so ensure you safeguard
868     * against this.
869     *
870     * @hide
871     */
872    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
873    public static final String DEVICE_NAME_SETTINGS = "android.settings.DEVICE_NAME";
874
875    /**
876     * Activity Action: Show pairing settings.
877     * <p>
878     * In some cases, a matching Activity may not exist, so ensure you safeguard
879     * against this.
880     *
881     * @hide
882     */
883    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
884    public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
885
886    /**
887     * Activity Action: Show battery saver settings.
888     * <p>
889     * In some cases, a matching Activity may not exist, so ensure you safeguard
890     * against this.
891     */
892    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
893    public static final String ACTION_BATTERY_SAVER_SETTINGS
894            = "android.settings.BATTERY_SAVER_SETTINGS";
895
896    /**
897     * Activity Action: Show Home selection settings. If there are multiple activities
898     * that can satisfy the {@link Intent#CATEGORY_HOME} intent, this screen allows you
899     * to pick your preferred activity.
900     */
901    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
902    public static final String ACTION_HOME_SETTINGS
903            = "android.settings.HOME_SETTINGS";
904
905    /**
906     * Activity Action: Show notification settings.
907     *
908     * @hide
909     */
910    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
911    public static final String ACTION_NOTIFICATION_SETTINGS
912            = "android.settings.NOTIFICATION_SETTINGS";
913
914    /**
915     * Activity Action: Show notification settings for a single app.
916     *
917     * @hide
918     */
919    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
920    public static final String ACTION_APP_NOTIFICATION_SETTINGS
921            = "android.settings.APP_NOTIFICATION_SETTINGS";
922
923    /**
924     * Activity Action: Show notification redaction settings.
925     *
926     * @hide
927     */
928    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
929    public static final String ACTION_APP_NOTIFICATION_REDACTION
930            = "android.settings.ACTION_APP_NOTIFICATION_REDACTION";
931
932    /** @hide */ public static final String EXTRA_APP_UID = "app_uid";
933    /** @hide */ public static final String EXTRA_APP_PACKAGE = "app_package";
934
935    // End of Intent actions for Settings
936
937    /**
938     * @hide - Private call() method on SettingsProvider to read from 'system' table.
939     */
940    public static final String CALL_METHOD_GET_SYSTEM = "GET_system";
941
942    /**
943     * @hide - Private call() method on SettingsProvider to read from 'secure' table.
944     */
945    public static final String CALL_METHOD_GET_SECURE = "GET_secure";
946
947    /**
948     * @hide - Private call() method on SettingsProvider to read from 'global' table.
949     */
950    public static final String CALL_METHOD_GET_GLOBAL = "GET_global";
951
952    /**
953     * @hide - User handle argument extra to the fast-path call()-based requests
954     */
955    public static final String CALL_METHOD_USER_KEY = "_user";
956
957    /** @hide - Private call() method to write to 'system' table */
958    public static final String CALL_METHOD_PUT_SYSTEM = "PUT_system";
959
960    /** @hide - Private call() method to write to 'secure' table */
961    public static final String CALL_METHOD_PUT_SECURE = "PUT_secure";
962
963    /** @hide - Private call() method to write to 'global' table */
964    public static final String CALL_METHOD_PUT_GLOBAL= "PUT_global";
965
966    /**
967     * Activity Extra: Limit available options in launched activity based on the given authority.
968     * <p>
969     * This can be passed as an extra field in an Activity Intent with one or more syncable content
970     * provider's authorities as a String[]. This field is used by some intents to alter the
971     * behavior of the called activity.
972     * <p>
973     * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types available based
974     * on the authority given.
975     */
976    public static final String EXTRA_AUTHORITIES = "authorities";
977
978    /**
979     * Activity Extra: Limit available options in launched activity based on the given account
980     * types.
981     * <p>
982     * This can be passed as an extra field in an Activity Intent with one or more account types
983     * as a String[]. This field is used by some intents to alter the behavior of the called
984     * activity.
985     * <p>
986     * Example: The {@link #ACTION_ADD_ACCOUNT} intent restricts the account types to the specified
987     * list.
988     */
989    public static final String EXTRA_ACCOUNT_TYPES = "account_types";
990
991    public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
992
993    /**
994     * Activity Extra: The device identifier to act upon.
995     * <p>
996     * This can be passed as an extra field in an Activity Intent with a single
997     * InputDeviceIdentifier. This field is used by some activities to jump straight into the
998     * settings for the given device.
999     * <p>
1000     * Example: The {@link #ACTION_INPUT_METHOD_SETTINGS} intent opens the keyboard layout
1001     * dialog for the given device.
1002     * @hide
1003     */
1004    public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
1005
1006    /**
1007     * Activity Extra: Enable or disable Airplane Mode.
1008     * <p>
1009     * This can be passed as an extra field to the {@link #ACTION_VOICE_CONTROL_AIRPLANE_MODE}
1010     * intent as a boolean.
1011     */
1012    public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
1013
1014    private static final String JID_RESOURCE_PREFIX = "android";
1015
1016    public static final String AUTHORITY = "settings";
1017
1018    private static final String TAG = "Settings";
1019    private static final boolean LOCAL_LOGV = false;
1020
1021    // Lock ensures that when enabling/disabling the master location switch, we don't end up
1022    // with a partial enable/disable state in multi-threaded situations.
1023    private static final Object mLocationSettingsLock = new Object();
1024
1025    public static class SettingNotFoundException extends AndroidException {
1026        public SettingNotFoundException(String msg) {
1027            super(msg);
1028        }
1029    }
1030
1031    /**
1032     * Common base for tables of name/value settings.
1033     */
1034    public static class NameValueTable implements BaseColumns {
1035        public static final String NAME = "name";
1036        public static final String VALUE = "value";
1037
1038        protected static boolean putString(ContentResolver resolver, Uri uri,
1039                String name, String value) {
1040            // The database will take care of replacing duplicates.
1041            try {
1042                ContentValues values = new ContentValues();
1043                values.put(NAME, name);
1044                values.put(VALUE, value);
1045                resolver.insert(uri, values);
1046                return true;
1047            } catch (SQLException e) {
1048                Log.w(TAG, "Can't set key " + name + " in " + uri, e);
1049                return false;
1050            }
1051        }
1052
1053        public static Uri getUriFor(Uri uri, String name) {
1054            return Uri.withAppendedPath(uri, name);
1055        }
1056    }
1057
1058    // Thread-safe.
1059    private static class NameValueCache {
1060        private final String mVersionSystemProperty;
1061        private final Uri mUri;
1062
1063        private static final String[] SELECT_VALUE =
1064            new String[] { Settings.NameValueTable.VALUE };
1065        private static final String NAME_EQ_PLACEHOLDER = "name=?";
1066
1067        // Must synchronize on 'this' to access mValues and mValuesVersion.
1068        private final HashMap<String, String> mValues = new HashMap<String, String>();
1069        private long mValuesVersion = 0;
1070
1071        // Initially null; set lazily and held forever.  Synchronized on 'this'.
1072        private IContentProvider mContentProvider = null;
1073
1074        // The method we'll call (or null, to not use) on the provider
1075        // for the fast path of retrieving settings.
1076        private final String mCallGetCommand;
1077        private final String mCallSetCommand;
1078
1079        public NameValueCache(String versionSystemProperty, Uri uri,
1080                String getCommand, String setCommand) {
1081            mVersionSystemProperty = versionSystemProperty;
1082            mUri = uri;
1083            mCallGetCommand = getCommand;
1084            mCallSetCommand = setCommand;
1085        }
1086
1087        private IContentProvider lazyGetProvider(ContentResolver cr) {
1088            IContentProvider cp = null;
1089            synchronized (this) {
1090                cp = mContentProvider;
1091                if (cp == null) {
1092                    cp = mContentProvider = cr.acquireProvider(mUri.getAuthority());
1093                }
1094            }
1095            return cp;
1096        }
1097
1098        public boolean putStringForUser(ContentResolver cr, String name, String value,
1099                final int userHandle) {
1100            try {
1101                Bundle arg = new Bundle();
1102                arg.putString(Settings.NameValueTable.VALUE, value);
1103                arg.putInt(CALL_METHOD_USER_KEY, userHandle);
1104                IContentProvider cp = lazyGetProvider(cr);
1105                cp.call(cr.getPackageName(), mCallSetCommand, name, arg);
1106            } catch (RemoteException e) {
1107                Log.w(TAG, "Can't set key " + name + " in " + mUri, e);
1108                return false;
1109            }
1110            return true;
1111        }
1112
1113        public String getStringForUser(ContentResolver cr, String name, final int userHandle) {
1114            final boolean isSelf = (userHandle == UserHandle.myUserId());
1115            if (isSelf) {
1116                long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
1117
1118                // Our own user's settings data uses a client-side cache
1119                synchronized (this) {
1120                    if (mValuesVersion != newValuesVersion) {
1121                        if (LOCAL_LOGV || false) {
1122                            Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current "
1123                                    + newValuesVersion + " != cached " + mValuesVersion);
1124                        }
1125
1126                        mValues.clear();
1127                        mValuesVersion = newValuesVersion;
1128                    }
1129
1130                    if (mValues.containsKey(name)) {
1131                        return mValues.get(name);  // Could be null, that's OK -- negative caching
1132                    }
1133                }
1134            } else {
1135                if (LOCAL_LOGV) Log.v(TAG, "get setting for user " + userHandle
1136                        + " by user " + UserHandle.myUserId() + " so skipping cache");
1137            }
1138
1139            IContentProvider cp = lazyGetProvider(cr);
1140
1141            // Try the fast path first, not using query().  If this
1142            // fails (alternate Settings provider that doesn't support
1143            // this interface?) then we fall back to the query/table
1144            // interface.
1145            if (mCallGetCommand != null) {
1146                try {
1147                    Bundle args = null;
1148                    if (!isSelf) {
1149                        args = new Bundle();
1150                        args.putInt(CALL_METHOD_USER_KEY, userHandle);
1151                    }
1152                    Bundle b = cp.call(cr.getPackageName(), mCallGetCommand, name, args);
1153                    if (b != null) {
1154                        String value = b.getPairValue();
1155                        // Don't update our cache for reads of other users' data
1156                        if (isSelf) {
1157                            synchronized (this) {
1158                                mValues.put(name, value);
1159                            }
1160                        } else {
1161                            if (LOCAL_LOGV) Log.i(TAG, "call-query of user " + userHandle
1162                                    + " by " + UserHandle.myUserId()
1163                                    + " so not updating cache");
1164                        }
1165                        return value;
1166                    }
1167                    // If the response Bundle is null, we fall through
1168                    // to the query interface below.
1169                } catch (RemoteException e) {
1170                    // Not supported by the remote side?  Fall through
1171                    // to query().
1172                }
1173            }
1174
1175            Cursor c = null;
1176            try {
1177                c = cp.query(cr.getPackageName(), mUri, SELECT_VALUE, NAME_EQ_PLACEHOLDER,
1178                             new String[]{name}, null, null);
1179                if (c == null) {
1180                    Log.w(TAG, "Can't get key " + name + " from " + mUri);
1181                    return null;
1182                }
1183
1184                String value = c.moveToNext() ? c.getString(0) : null;
1185                synchronized (this) {
1186                    mValues.put(name, value);
1187                }
1188                if (LOCAL_LOGV) {
1189                    Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
1190                            name + " = " + (value == null ? "(null)" : value));
1191                }
1192                return value;
1193            } catch (RemoteException e) {
1194                Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
1195                return null;  // Return null, but don't cache it.
1196            } finally {
1197                if (c != null) c.close();
1198            }
1199        }
1200    }
1201
1202    /**
1203     * System settings, containing miscellaneous system preferences.  This
1204     * table holds simple name/value pairs.  There are convenience
1205     * functions for accessing individual settings entries.
1206     */
1207    public static final class System extends NameValueTable {
1208        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
1209
1210        /** @hide */
1211        public static interface Validator {
1212            public boolean validate(String value);
1213        }
1214
1215        /**
1216         * The content:// style URL for this table
1217         */
1218        public static final Uri CONTENT_URI =
1219            Uri.parse("content://" + AUTHORITY + "/system");
1220
1221        private static final NameValueCache sNameValueCache = new NameValueCache(
1222                SYS_PROP_SETTING_VERSION,
1223                CONTENT_URI,
1224                CALL_METHOD_GET_SYSTEM,
1225                CALL_METHOD_PUT_SYSTEM);
1226
1227        private static final HashSet<String> MOVED_TO_SECURE;
1228        static {
1229            MOVED_TO_SECURE = new HashSet<String>(30);
1230            MOVED_TO_SECURE.add(Secure.ANDROID_ID);
1231            MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
1232            MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
1233            MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS);
1234            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED);
1235            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE);
1236            MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
1237            MOVED_TO_SECURE.add(Secure.LOGGING_ID);
1238            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
1239            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
1240            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
1241            MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
1242            MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
1243            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
1244            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
1245            MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
1246            MOVED_TO_SECURE.add(Secure.WIFI_ON);
1247            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
1248            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
1249            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
1250            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
1251            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
1252            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
1253            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
1254            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
1255            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
1256            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
1257            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
1258
1259            // At one time in System, then Global, but now back in Secure
1260            MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
1261        }
1262
1263        private static final HashSet<String> MOVED_TO_GLOBAL;
1264        private static final HashSet<String> MOVED_TO_SECURE_THEN_GLOBAL;
1265        static {
1266            MOVED_TO_GLOBAL = new HashSet<String>();
1267            MOVED_TO_SECURE_THEN_GLOBAL = new HashSet<String>();
1268
1269            // these were originally in system but migrated to secure in the past,
1270            // so are duplicated in the Secure.* namespace
1271            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.ADB_ENABLED);
1272            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.BLUETOOTH_ON);
1273            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DATA_ROAMING);
1274            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.DEVICE_PROVISIONED);
1275            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.USB_MASS_STORAGE_ENABLED);
1276            MOVED_TO_SECURE_THEN_GLOBAL.add(Global.HTTP_PROXY);
1277
1278            // these are moving directly from system to global
1279            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_ON);
1280            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_RADIOS);
1281            MOVED_TO_GLOBAL.add(Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
1282            MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME);
1283            MOVED_TO_GLOBAL.add(Settings.Global.AUTO_TIME_ZONE);
1284            MOVED_TO_GLOBAL.add(Settings.Global.CAR_DOCK_SOUND);
1285            MOVED_TO_GLOBAL.add(Settings.Global.CAR_UNDOCK_SOUND);
1286            MOVED_TO_GLOBAL.add(Settings.Global.DESK_DOCK_SOUND);
1287            MOVED_TO_GLOBAL.add(Settings.Global.DESK_UNDOCK_SOUND);
1288            MOVED_TO_GLOBAL.add(Settings.Global.DOCK_SOUNDS_ENABLED);
1289            MOVED_TO_GLOBAL.add(Settings.Global.LOCK_SOUND);
1290            MOVED_TO_GLOBAL.add(Settings.Global.UNLOCK_SOUND);
1291            MOVED_TO_GLOBAL.add(Settings.Global.LOW_BATTERY_SOUND);
1292            MOVED_TO_GLOBAL.add(Settings.Global.POWER_SOUNDS_ENABLED);
1293            MOVED_TO_GLOBAL.add(Settings.Global.STAY_ON_WHILE_PLUGGED_IN);
1294            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SLEEP_POLICY);
1295            MOVED_TO_GLOBAL.add(Settings.Global.MODE_RINGER);
1296            MOVED_TO_GLOBAL.add(Settings.Global.WINDOW_ANIMATION_SCALE);
1297            MOVED_TO_GLOBAL.add(Settings.Global.TRANSITION_ANIMATION_SCALE);
1298            MOVED_TO_GLOBAL.add(Settings.Global.ANIMATOR_DURATION_SCALE);
1299            MOVED_TO_GLOBAL.add(Settings.Global.FANCY_IME_ANIMATIONS);
1300            MOVED_TO_GLOBAL.add(Settings.Global.COMPATIBILITY_MODE);
1301            MOVED_TO_GLOBAL.add(Settings.Global.EMERGENCY_TONE);
1302            MOVED_TO_GLOBAL.add(Settings.Global.CALL_AUTO_RETRY);
1303            MOVED_TO_GLOBAL.add(Settings.Global.DEBUG_APP);
1304            MOVED_TO_GLOBAL.add(Settings.Global.WAIT_FOR_DEBUGGER);
1305            MOVED_TO_GLOBAL.add(Settings.Global.SHOW_PROCESSES);
1306            MOVED_TO_GLOBAL.add(Settings.Global.ALWAYS_FINISH_ACTIVITIES);
1307            MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_CONTENT_URL);
1308            MOVED_TO_GLOBAL.add(Settings.Global.TZINFO_UPDATE_METADATA_URL);
1309            MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_CONTENT_URL);
1310            MOVED_TO_GLOBAL.add(Settings.Global.SELINUX_UPDATE_METADATA_URL);
1311            MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_CONTENT_URL);
1312            MOVED_TO_GLOBAL.add(Settings.Global.SMS_SHORT_CODES_UPDATE_METADATA_URL);
1313            MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_CONTENT_URL);
1314            MOVED_TO_GLOBAL.add(Settings.Global.CERT_PIN_UPDATE_METADATA_URL);
1315        }
1316
1317        private static final Validator sBooleanValidator =
1318                new DiscreteValueValidator(new String[] {"0", "1"});
1319
1320        private static final Validator sNonNegativeIntegerValidator = new Validator() {
1321            @Override
1322            public boolean validate(String value) {
1323                try {
1324                    return Integer.parseInt(value) >= 0;
1325                } catch (NumberFormatException e) {
1326                    return false;
1327                }
1328            }
1329        };
1330
1331        private static final Validator sUriValidator = new Validator() {
1332            @Override
1333            public boolean validate(String value) {
1334                try {
1335                    Uri.decode(value);
1336                    return true;
1337                } catch (IllegalArgumentException e) {
1338                    return false;
1339                }
1340            }
1341        };
1342
1343        private static final Validator sLenientIpAddressValidator = new Validator() {
1344            private static final int MAX_IPV6_LENGTH = 45;
1345
1346            @Override
1347            public boolean validate(String value) {
1348                return value.length() <= MAX_IPV6_LENGTH;
1349            }
1350        };
1351
1352        /** @hide */
1353        public static void getMovedToGlobalSettings(Set<String> outKeySet) {
1354            outKeySet.addAll(MOVED_TO_GLOBAL);
1355            outKeySet.addAll(MOVED_TO_SECURE_THEN_GLOBAL);
1356        }
1357
1358        /** @hide */
1359        public static void getMovedToSecureSettings(Set<String> outKeySet) {
1360            outKeySet.addAll(MOVED_TO_SECURE);
1361        }
1362
1363        /** @hide */
1364        public static void getNonLegacyMovedKeys(HashSet<String> outKeySet) {
1365            outKeySet.addAll(MOVED_TO_GLOBAL);
1366        }
1367
1368        /**
1369         * Look up a name in the database.
1370         * @param resolver to access the database with
1371         * @param name to look up in the table
1372         * @return the corresponding value, or null if not present
1373         */
1374        public static String getString(ContentResolver resolver, String name) {
1375            return getStringForUser(resolver, name, UserHandle.myUserId());
1376        }
1377
1378        /** @hide */
1379        public static String getStringForUser(ContentResolver resolver, String name,
1380                int userHandle) {
1381            if (MOVED_TO_SECURE.contains(name)) {
1382                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1383                        + " to android.provider.Settings.Secure, returning read-only value.");
1384                return Secure.getStringForUser(resolver, name, userHandle);
1385            }
1386            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1387                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1388                        + " to android.provider.Settings.Global, returning read-only value.");
1389                return Global.getStringForUser(resolver, name, userHandle);
1390            }
1391            return sNameValueCache.getStringForUser(resolver, name, userHandle);
1392        }
1393
1394        /**
1395         * Store a name/value pair into the database.
1396         * @param resolver to access the database with
1397         * @param name to store
1398         * @param value to associate with the name
1399         * @return true if the value was set, false on database errors
1400         */
1401        public static boolean putString(ContentResolver resolver, String name, String value) {
1402            return putStringForUser(resolver, name, value, UserHandle.myUserId());
1403        }
1404
1405        /** @hide */
1406        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
1407                int userHandle) {
1408            if (MOVED_TO_SECURE.contains(name)) {
1409                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1410                        + " to android.provider.Settings.Secure, value is unchanged.");
1411                return false;
1412            }
1413            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1414                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1415                        + " to android.provider.Settings.Global, value is unchanged.");
1416                return false;
1417            }
1418            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
1419        }
1420
1421        /**
1422         * Construct the content URI for a particular name/value pair,
1423         * useful for monitoring changes with a ContentObserver.
1424         * @param name to look up in the table
1425         * @return the corresponding content URI, or null if not present
1426         */
1427        public static Uri getUriFor(String name) {
1428            if (MOVED_TO_SECURE.contains(name)) {
1429                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1430                    + " to android.provider.Settings.Secure, returning Secure URI.");
1431                return Secure.getUriFor(Secure.CONTENT_URI, name);
1432            }
1433            if (MOVED_TO_GLOBAL.contains(name) || MOVED_TO_SECURE_THEN_GLOBAL.contains(name)) {
1434                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
1435                        + " to android.provider.Settings.Global, returning read-only global URI.");
1436                return Global.getUriFor(Global.CONTENT_URI, name);
1437            }
1438            return getUriFor(CONTENT_URI, name);
1439        }
1440
1441        /**
1442         * Convenience function for retrieving a single system settings value
1443         * as an integer.  Note that internally setting values are always
1444         * stored as strings; this function converts the string to an integer
1445         * for you.  The default value will be returned if the setting is
1446         * not defined or not an integer.
1447         *
1448         * @param cr The ContentResolver to access.
1449         * @param name The name of the setting to retrieve.
1450         * @param def Value to return if the setting is not defined.
1451         *
1452         * @return The setting's current value, or 'def' if it is not defined
1453         * or not a valid integer.
1454         */
1455        public static int getInt(ContentResolver cr, String name, int def) {
1456            return getIntForUser(cr, name, def, UserHandle.myUserId());
1457        }
1458
1459        /** @hide */
1460        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
1461            String v = getStringForUser(cr, name, userHandle);
1462            try {
1463                return v != null ? Integer.parseInt(v) : def;
1464            } catch (NumberFormatException e) {
1465                return def;
1466            }
1467        }
1468
1469        /**
1470         * Convenience function for retrieving a single system settings value
1471         * as an integer.  Note that internally setting values are always
1472         * stored as strings; this function converts the string to an integer
1473         * for you.
1474         * <p>
1475         * This version does not take a default value.  If the setting has not
1476         * been set, or the string value is not a number,
1477         * it throws {@link SettingNotFoundException}.
1478         *
1479         * @param cr The ContentResolver to access.
1480         * @param name The name of the setting to retrieve.
1481         *
1482         * @throws SettingNotFoundException Thrown if a setting by the given
1483         * name can't be found or the setting value is not an integer.
1484         *
1485         * @return The setting's current value.
1486         */
1487        public static int getInt(ContentResolver cr, String name)
1488                throws SettingNotFoundException {
1489            return getIntForUser(cr, name, UserHandle.myUserId());
1490        }
1491
1492        /** @hide */
1493        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
1494                throws SettingNotFoundException {
1495            String v = getStringForUser(cr, name, userHandle);
1496            try {
1497                return Integer.parseInt(v);
1498            } catch (NumberFormatException e) {
1499                throw new SettingNotFoundException(name);
1500            }
1501        }
1502
1503        /**
1504         * Convenience function for updating a single settings value as an
1505         * integer. This will either create a new entry in the table if the
1506         * given name does not exist, or modify the value of the existing row
1507         * with that name.  Note that internally setting values are always
1508         * stored as strings, so this function converts the given value to a
1509         * string before storing it.
1510         *
1511         * @param cr The ContentResolver to access.
1512         * @param name The name of the setting to modify.
1513         * @param value The new value for the setting.
1514         * @return true if the value was set, false on database errors
1515         */
1516        public static boolean putInt(ContentResolver cr, String name, int value) {
1517            return putIntForUser(cr, name, value, UserHandle.myUserId());
1518        }
1519
1520        /** @hide */
1521        public static boolean putIntForUser(ContentResolver cr, String name, int value,
1522                int userHandle) {
1523            return putStringForUser(cr, name, Integer.toString(value), userHandle);
1524        }
1525
1526        /**
1527         * Convenience function for retrieving a single system settings value
1528         * as a {@code long}.  Note that internally setting values are always
1529         * stored as strings; this function converts the string to a {@code long}
1530         * for you.  The default value will be returned if the setting is
1531         * not defined or not a {@code long}.
1532         *
1533         * @param cr The ContentResolver to access.
1534         * @param name The name of the setting to retrieve.
1535         * @param def Value to return if the setting is not defined.
1536         *
1537         * @return The setting's current value, or 'def' if it is not defined
1538         * or not a valid {@code long}.
1539         */
1540        public static long getLong(ContentResolver cr, String name, long def) {
1541            return getLongForUser(cr, name, def, UserHandle.myUserId());
1542        }
1543
1544        /** @hide */
1545        public static long getLongForUser(ContentResolver cr, String name, long def,
1546                int userHandle) {
1547            String valString = getStringForUser(cr, name, userHandle);
1548            long value;
1549            try {
1550                value = valString != null ? Long.parseLong(valString) : def;
1551            } catch (NumberFormatException e) {
1552                value = def;
1553            }
1554            return value;
1555        }
1556
1557        /**
1558         * Convenience function for retrieving a single system settings value
1559         * as a {@code long}.  Note that internally setting values are always
1560         * stored as strings; this function converts the string to a {@code long}
1561         * for you.
1562         * <p>
1563         * This version does not take a default value.  If the setting has not
1564         * been set, or the string value is not a number,
1565         * it throws {@link SettingNotFoundException}.
1566         *
1567         * @param cr The ContentResolver to access.
1568         * @param name The name of the setting to retrieve.
1569         *
1570         * @return The setting's current value.
1571         * @throws SettingNotFoundException Thrown if a setting by the given
1572         * name can't be found or the setting value is not an integer.
1573         */
1574        public static long getLong(ContentResolver cr, String name)
1575                throws SettingNotFoundException {
1576            return getLongForUser(cr, name, UserHandle.myUserId());
1577        }
1578
1579        /** @hide */
1580        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
1581                throws SettingNotFoundException {
1582            String valString = getStringForUser(cr, name, userHandle);
1583            try {
1584                return Long.parseLong(valString);
1585            } catch (NumberFormatException e) {
1586                throw new SettingNotFoundException(name);
1587            }
1588        }
1589
1590        /**
1591         * Convenience function for updating a single settings value as a long
1592         * integer. This will either create a new entry in the table if the
1593         * given name does not exist, or modify the value of the existing row
1594         * with that name.  Note that internally setting values are always
1595         * stored as strings, so this function converts the given value to a
1596         * string before storing it.
1597         *
1598         * @param cr The ContentResolver to access.
1599         * @param name The name of the setting to modify.
1600         * @param value The new value for the setting.
1601         * @return true if the value was set, false on database errors
1602         */
1603        public static boolean putLong(ContentResolver cr, String name, long value) {
1604            return putLongForUser(cr, name, value, UserHandle.myUserId());
1605        }
1606
1607        /** @hide */
1608        public static boolean putLongForUser(ContentResolver cr, String name, long value,
1609                int userHandle) {
1610            return putStringForUser(cr, name, Long.toString(value), userHandle);
1611        }
1612
1613        /**
1614         * Convenience function for retrieving a single system settings value
1615         * as a floating point number.  Note that internally setting values are
1616         * always stored as strings; this function converts the string to an
1617         * float for you. The default value will be returned if the setting
1618         * is not defined or not a valid float.
1619         *
1620         * @param cr The ContentResolver to access.
1621         * @param name The name of the setting to retrieve.
1622         * @param def Value to return if the setting is not defined.
1623         *
1624         * @return The setting's current value, or 'def' if it is not defined
1625         * or not a valid float.
1626         */
1627        public static float getFloat(ContentResolver cr, String name, float def) {
1628            return getFloatForUser(cr, name, def, UserHandle.myUserId());
1629        }
1630
1631        /** @hide */
1632        public static float getFloatForUser(ContentResolver cr, String name, float def,
1633                int userHandle) {
1634            String v = getStringForUser(cr, name, userHandle);
1635            try {
1636                return v != null ? Float.parseFloat(v) : def;
1637            } catch (NumberFormatException e) {
1638                return def;
1639            }
1640        }
1641
1642        /**
1643         * Convenience function for retrieving a single system settings value
1644         * as a float.  Note that internally setting values are always
1645         * stored as strings; this function converts the string to a float
1646         * for you.
1647         * <p>
1648         * This version does not take a default value.  If the setting has not
1649         * been set, or the string value is not a number,
1650         * it throws {@link SettingNotFoundException}.
1651         *
1652         * @param cr The ContentResolver to access.
1653         * @param name The name of the setting to retrieve.
1654         *
1655         * @throws SettingNotFoundException Thrown if a setting by the given
1656         * name can't be found or the setting value is not a float.
1657         *
1658         * @return The setting's current value.
1659         */
1660        public static float getFloat(ContentResolver cr, String name)
1661                throws SettingNotFoundException {
1662            return getFloatForUser(cr, name, UserHandle.myUserId());
1663        }
1664
1665        /** @hide */
1666        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
1667                throws SettingNotFoundException {
1668            String v = getStringForUser(cr, name, userHandle);
1669            if (v == null) {
1670                throw new SettingNotFoundException(name);
1671            }
1672            try {
1673                return Float.parseFloat(v);
1674            } catch (NumberFormatException e) {
1675                throw new SettingNotFoundException(name);
1676            }
1677        }
1678
1679        /**
1680         * Convenience function for updating a single settings value as a
1681         * floating point number. This will either create a new entry in the
1682         * table if the given name does not exist, or modify the value of the
1683         * existing row with that name.  Note that internally setting values
1684         * are always stored as strings, so this function converts the given
1685         * value to a string before storing it.
1686         *
1687         * @param cr The ContentResolver to access.
1688         * @param name The name of the setting to modify.
1689         * @param value The new value for the setting.
1690         * @return true if the value was set, false on database errors
1691         */
1692        public static boolean putFloat(ContentResolver cr, String name, float value) {
1693            return putFloatForUser(cr, name, value, UserHandle.myUserId());
1694        }
1695
1696        /** @hide */
1697        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
1698                int userHandle) {
1699            return putStringForUser(cr, name, Float.toString(value), userHandle);
1700        }
1701
1702        /**
1703         * Convenience function to read all of the current
1704         * configuration-related settings into a
1705         * {@link Configuration} object.
1706         *
1707         * @param cr The ContentResolver to access.
1708         * @param outConfig Where to place the configuration settings.
1709         */
1710        public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
1711            getConfigurationForUser(cr, outConfig, UserHandle.myUserId());
1712        }
1713
1714        /** @hide */
1715        public static void getConfigurationForUser(ContentResolver cr, Configuration outConfig,
1716                int userHandle) {
1717            outConfig.fontScale = Settings.System.getFloatForUser(
1718                cr, FONT_SCALE, outConfig.fontScale, userHandle);
1719            if (outConfig.fontScale < 0) {
1720                outConfig.fontScale = 1;
1721            }
1722        }
1723
1724        /**
1725         * @hide Erase the fields in the Configuration that should be applied
1726         * by the settings.
1727         */
1728        public static void clearConfiguration(Configuration inoutConfig) {
1729            inoutConfig.fontScale = 0;
1730        }
1731
1732        /**
1733         * Convenience function to write a batch of configuration-related
1734         * settings from a {@link Configuration} object.
1735         *
1736         * @param cr The ContentResolver to access.
1737         * @param config The settings to write.
1738         * @return true if the values were set, false on database errors
1739         */
1740        public static boolean putConfiguration(ContentResolver cr, Configuration config) {
1741            return putConfigurationForUser(cr, config, UserHandle.myUserId());
1742        }
1743
1744        /** @hide */
1745        public static boolean putConfigurationForUser(ContentResolver cr, Configuration config,
1746                int userHandle) {
1747            return Settings.System.putFloatForUser(cr, FONT_SCALE, config.fontScale, userHandle);
1748        }
1749
1750        /** @hide */
1751        public static boolean hasInterestingConfigurationChanges(int changes) {
1752            return (changes&ActivityInfo.CONFIG_FONT_SCALE) != 0;
1753        }
1754
1755        /** @deprecated - Do not use */
1756        @Deprecated
1757        public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
1758            return getShowGTalkServiceStatusForUser(cr, UserHandle.myUserId());
1759        }
1760
1761        /**
1762         * @hide
1763         * @deprecated - Do not use
1764         */
1765        public static boolean getShowGTalkServiceStatusForUser(ContentResolver cr,
1766                int userHandle) {
1767            return getIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, 0, userHandle) != 0;
1768        }
1769
1770        /** @deprecated - Do not use */
1771        @Deprecated
1772        public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
1773            setShowGTalkServiceStatusForUser(cr, flag, UserHandle.myUserId());
1774        }
1775
1776        /**
1777         * @hide
1778         * @deprecated - Do not use
1779         */
1780        @Deprecated
1781        public static void setShowGTalkServiceStatusForUser(ContentResolver cr, boolean flag,
1782                int userHandle) {
1783            putIntForUser(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0, userHandle);
1784        }
1785
1786        private static final class DiscreteValueValidator implements Validator {
1787            private final String[] mValues;
1788
1789            public DiscreteValueValidator(String[] values) {
1790                mValues = values;
1791            }
1792
1793            @Override
1794            public boolean validate(String value) {
1795                return ArrayUtils.contains(mValues, value);
1796            }
1797        }
1798
1799        private static final class InclusiveIntegerRangeValidator implements Validator {
1800            private final int mMin;
1801            private final int mMax;
1802
1803            public InclusiveIntegerRangeValidator(int min, int max) {
1804                mMin = min;
1805                mMax = max;
1806            }
1807
1808            @Override
1809            public boolean validate(String value) {
1810                try {
1811                    final int intValue = Integer.parseInt(value);
1812                    return intValue >= mMin && intValue <= mMax;
1813                } catch (NumberFormatException e) {
1814                    return false;
1815                }
1816            }
1817        }
1818
1819        private static final class InclusiveFloatRangeValidator implements Validator {
1820            private final float mMin;
1821            private final float mMax;
1822
1823            public InclusiveFloatRangeValidator(float min, float max) {
1824                mMin = min;
1825                mMax = max;
1826            }
1827
1828            @Override
1829            public boolean validate(String value) {
1830                try {
1831                    final float floatValue = Float.parseFloat(value);
1832                    return floatValue >= mMin && floatValue <= mMax;
1833                } catch (NumberFormatException e) {
1834                    return false;
1835                }
1836            }
1837        }
1838
1839        /**
1840         * @deprecated Use {@link android.provider.Settings.Global#STAY_ON_WHILE_PLUGGED_IN} instead
1841         */
1842        @Deprecated
1843        public static final String STAY_ON_WHILE_PLUGGED_IN = Global.STAY_ON_WHILE_PLUGGED_IN;
1844
1845        /**
1846         * What happens when the user presses the end call button if they're not
1847         * on a call.<br/>
1848         * <b>Values:</b><br/>
1849         * 0 - The end button does nothing.<br/>
1850         * 1 - The end button goes to the home screen.<br/>
1851         * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
1852         * 3 - The end button goes to the home screen.  If the user is already on the
1853         * home screen, it puts the device to sleep.
1854         */
1855        public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
1856
1857        private static final Validator END_BUTTON_BEHAVIOR_VALIDATOR =
1858                new InclusiveIntegerRangeValidator(0, 3);
1859
1860        /**
1861         * END_BUTTON_BEHAVIOR value for "go home".
1862         * @hide
1863         */
1864        public static final int END_BUTTON_BEHAVIOR_HOME = 0x1;
1865
1866        /**
1867         * END_BUTTON_BEHAVIOR value for "go to sleep".
1868         * @hide
1869         */
1870        public static final int END_BUTTON_BEHAVIOR_SLEEP = 0x2;
1871
1872        /**
1873         * END_BUTTON_BEHAVIOR default value.
1874         * @hide
1875         */
1876        public static final int END_BUTTON_BEHAVIOR_DEFAULT = END_BUTTON_BEHAVIOR_SLEEP;
1877
1878        /**
1879         * Is advanced settings mode turned on. 0 == no, 1 == yes
1880         * @hide
1881         */
1882        public static final String ADVANCED_SETTINGS = "advanced_settings";
1883
1884        private static final Validator ADVANCED_SETTINGS_VALIDATOR = sBooleanValidator;
1885
1886        /**
1887         * ADVANCED_SETTINGS default value.
1888         * @hide
1889         */
1890        public static final int ADVANCED_SETTINGS_DEFAULT = 0;
1891
1892        /**
1893         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_ON} instead
1894         */
1895        @Deprecated
1896        public static final String AIRPLANE_MODE_ON = Global.AIRPLANE_MODE_ON;
1897
1898        /**
1899         * @deprecated Use {@link android.provider.Settings.Global#RADIO_BLUETOOTH} instead
1900         */
1901        @Deprecated
1902        public static final String RADIO_BLUETOOTH = Global.RADIO_BLUETOOTH;
1903
1904        /**
1905         * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIFI} instead
1906         */
1907        @Deprecated
1908        public static final String RADIO_WIFI = Global.RADIO_WIFI;
1909
1910        /**
1911         * @deprecated Use {@link android.provider.Settings.Global#RADIO_WIMAX} instead
1912         * {@hide}
1913         */
1914        @Deprecated
1915        public static final String RADIO_WIMAX = Global.RADIO_WIMAX;
1916
1917        /**
1918         * @deprecated Use {@link android.provider.Settings.Global#RADIO_CELL} instead
1919         */
1920        @Deprecated
1921        public static final String RADIO_CELL = Global.RADIO_CELL;
1922
1923        /**
1924         * @deprecated Use {@link android.provider.Settings.Global#RADIO_NFC} instead
1925         */
1926        @Deprecated
1927        public static final String RADIO_NFC = Global.RADIO_NFC;
1928
1929        /**
1930         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_RADIOS} instead
1931         */
1932        @Deprecated
1933        public static final String AIRPLANE_MODE_RADIOS = Global.AIRPLANE_MODE_RADIOS;
1934
1935        /**
1936         * @deprecated Use {@link android.provider.Settings.Global#AIRPLANE_MODE_TOGGLEABLE_RADIOS} instead
1937         *
1938         * {@hide}
1939         */
1940        @Deprecated
1941        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS =
1942                Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS;
1943
1944        /**
1945         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY} instead
1946         */
1947        @Deprecated
1948        public static final String WIFI_SLEEP_POLICY = Global.WIFI_SLEEP_POLICY;
1949
1950        /**
1951         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_DEFAULT} instead
1952         */
1953        @Deprecated
1954        public static final int WIFI_SLEEP_POLICY_DEFAULT = Global.WIFI_SLEEP_POLICY_DEFAULT;
1955
1956        /**
1957         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED} instead
1958         */
1959        @Deprecated
1960        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED =
1961                Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED;
1962
1963        /**
1964         * @deprecated Use {@link android.provider.Settings.Global#WIFI_SLEEP_POLICY_NEVER} instead
1965         */
1966        @Deprecated
1967        public static final int WIFI_SLEEP_POLICY_NEVER = Global.WIFI_SLEEP_POLICY_NEVER;
1968
1969        /**
1970         * @deprecated Use {@link android.provider.Settings.Global#MODE_RINGER} instead
1971         */
1972        @Deprecated
1973        public static final String MODE_RINGER = Global.MODE_RINGER;
1974
1975        /**
1976         * Whether to use static IP and other static network attributes.
1977         * <p>
1978         * Set to 1 for true and 0 for false.
1979         *
1980         * @deprecated Use {@link WifiManager} instead
1981         */
1982        @Deprecated
1983        public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
1984
1985        private static final Validator WIFI_USE_STATIC_IP_VALIDATOR = sBooleanValidator;
1986
1987        /**
1988         * The static IP address.
1989         * <p>
1990         * Example: "192.168.1.51"
1991         *
1992         * @deprecated Use {@link WifiManager} instead
1993         */
1994        @Deprecated
1995        public static final String WIFI_STATIC_IP = "wifi_static_ip";
1996
1997        private static final Validator WIFI_STATIC_IP_VALIDATOR = sLenientIpAddressValidator;
1998
1999        /**
2000         * If using static IP, the gateway's IP address.
2001         * <p>
2002         * Example: "192.168.1.1"
2003         *
2004         * @deprecated Use {@link WifiManager} instead
2005         */
2006        @Deprecated
2007        public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
2008
2009        private static final Validator WIFI_STATIC_GATEWAY_VALIDATOR = sLenientIpAddressValidator;
2010
2011        /**
2012         * If using static IP, the net mask.
2013         * <p>
2014         * Example: "255.255.255.0"
2015         *
2016         * @deprecated Use {@link WifiManager} instead
2017         */
2018        @Deprecated
2019        public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
2020
2021        private static final Validator WIFI_STATIC_NETMASK_VALIDATOR = sLenientIpAddressValidator;
2022
2023        /**
2024         * If using static IP, the primary DNS's IP address.
2025         * <p>
2026         * Example: "192.168.1.1"
2027         *
2028         * @deprecated Use {@link WifiManager} instead
2029         */
2030        @Deprecated
2031        public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
2032
2033        private static final Validator WIFI_STATIC_DNS1_VALIDATOR = sLenientIpAddressValidator;
2034
2035        /**
2036         * If using static IP, the secondary DNS's IP address.
2037         * <p>
2038         * Example: "192.168.1.2"
2039         *
2040         * @deprecated Use {@link WifiManager} instead
2041         */
2042        @Deprecated
2043        public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
2044
2045        private static final Validator WIFI_STATIC_DNS2_VALIDATOR = sLenientIpAddressValidator;
2046
2047        /**
2048         * Determines whether remote devices may discover and/or connect to
2049         * this device.
2050         * <P>Type: INT</P>
2051         * 2 -- discoverable and connectable
2052         * 1 -- connectable but not discoverable
2053         * 0 -- neither connectable nor discoverable
2054         */
2055        public static final String BLUETOOTH_DISCOVERABILITY =
2056            "bluetooth_discoverability";
2057
2058        private static final Validator BLUETOOTH_DISCOVERABILITY_VALIDATOR =
2059                new InclusiveIntegerRangeValidator(0, 2);
2060
2061        /**
2062         * Bluetooth discoverability timeout.  If this value is nonzero, then
2063         * Bluetooth becomes discoverable for a certain number of seconds,
2064         * after which is becomes simply connectable.  The value is in seconds.
2065         */
2066        public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
2067            "bluetooth_discoverability_timeout";
2068
2069        private static final Validator BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR =
2070                sNonNegativeIntegerValidator;
2071
2072        /**
2073         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_ENABLED}
2074         * instead
2075         */
2076        @Deprecated
2077        public static final String LOCK_PATTERN_ENABLED = Secure.LOCK_PATTERN_ENABLED;
2078
2079        /**
2080         * @deprecated Use {@link android.provider.Settings.Secure#LOCK_PATTERN_VISIBLE}
2081         * instead
2082         */
2083        @Deprecated
2084        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
2085
2086        /**
2087         * @deprecated Use
2088         * {@link android.provider.Settings.Secure#LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED}
2089         * instead
2090         */
2091        @Deprecated
2092        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
2093            "lock_pattern_tactile_feedback_enabled";
2094
2095        /**
2096         * A formatted string of the next alarm that is set, or the empty string
2097         * if there is no alarm set.
2098         *
2099         * @deprecated Use {@link android.app.AlarmManager#getNextAlarmClock()}.
2100         */
2101        @Deprecated
2102        public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
2103
2104        private static final Validator NEXT_ALARM_FORMATTED_VALIDATOR = new Validator() {
2105            private static final int MAX_LENGTH = 1000;
2106
2107            @Override
2108            public boolean validate(String value) {
2109                // TODO: No idea what the correct format is.
2110                return value == null || value.length() < MAX_LENGTH;
2111            }
2112        };
2113
2114        /**
2115         * Scaling factor for fonts, float.
2116         */
2117        public static final String FONT_SCALE = "font_scale";
2118
2119        private static final Validator FONT_SCALE_VALIDATOR = new Validator() {
2120            @Override
2121            public boolean validate(String value) {
2122                try {
2123                    return Float.parseFloat(value) >= 0;
2124                } catch (NumberFormatException e) {
2125                    return false;
2126                }
2127            }
2128        };
2129
2130        /**
2131         * Name of an application package to be debugged.
2132         *
2133         * @deprecated Use {@link Global#DEBUG_APP} instead
2134         */
2135        @Deprecated
2136        public static final String DEBUG_APP = Global.DEBUG_APP;
2137
2138        /**
2139         * If 1, when launching DEBUG_APP it will wait for the debugger before
2140         * starting user code.  If 0, it will run normally.
2141         *
2142         * @deprecated Use {@link Global#WAIT_FOR_DEBUGGER} instead
2143         */
2144        @Deprecated
2145        public static final String WAIT_FOR_DEBUGGER = Global.WAIT_FOR_DEBUGGER;
2146
2147        /**
2148         * Whether or not to dim the screen. 0=no  1=yes
2149         * @deprecated This setting is no longer used.
2150         */
2151        @Deprecated
2152        public static final String DIM_SCREEN = "dim_screen";
2153
2154        private static final Validator DIM_SCREEN_VALIDATOR = sBooleanValidator;
2155
2156        /**
2157         * The amount of time in milliseconds before the device goes to sleep or begins
2158         * to dream after a period of inactivity.  This value is also known as the
2159         * user activity timeout period since the screen isn't necessarily turned off
2160         * when it expires.
2161         */
2162        public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
2163
2164        private static final Validator SCREEN_OFF_TIMEOUT_VALIDATOR = sNonNegativeIntegerValidator;
2165
2166        /**
2167         * The screen backlight brightness between 0 and 255.
2168         */
2169        public static final String SCREEN_BRIGHTNESS = "screen_brightness";
2170
2171        private static final Validator SCREEN_BRIGHTNESS_VALIDATOR =
2172                new InclusiveIntegerRangeValidator(0, 255);
2173
2174        /**
2175         * Control whether to enable automatic brightness mode.
2176         */
2177        public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
2178
2179        private static final Validator SCREEN_BRIGHTNESS_MODE_VALIDATOR = sBooleanValidator;
2180
2181        /**
2182         * Adjustment to auto-brightness to make it generally more (>0.0 <1.0)
2183         * or less (<0.0 >-1.0) bright.
2184         * @hide
2185         */
2186        public static final String SCREEN_AUTO_BRIGHTNESS_ADJ = "screen_auto_brightness_adj";
2187
2188        private static final Validator SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR =
2189                new InclusiveFloatRangeValidator(-1, 1);
2190
2191        /**
2192         * SCREEN_BRIGHTNESS_MODE value for manual mode.
2193         */
2194        public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
2195
2196        /**
2197         * SCREEN_BRIGHTNESS_MODE value for automatic mode.
2198         */
2199        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
2200
2201        /**
2202         * Control whether the process CPU usage meter should be shown.
2203         *
2204         * @deprecated Use {@link Global#SHOW_PROCESSES} instead
2205         */
2206        @Deprecated
2207        public static final String SHOW_PROCESSES = Global.SHOW_PROCESSES;
2208
2209        /**
2210         * If 1, the activity manager will aggressively finish activities and
2211         * processes as soon as they are no longer needed.  If 0, the normal
2212         * extended lifetime is used.
2213         *
2214         * @deprecated Use {@link Global#ALWAYS_FINISH_ACTIVITIES} instead
2215         */
2216        @Deprecated
2217        public static final String ALWAYS_FINISH_ACTIVITIES = Global.ALWAYS_FINISH_ACTIVITIES;
2218
2219        /**
2220         * Determines which streams are affected by ringer mode changes. The
2221         * stream type's bit should be set to 1 if it should be muted when going
2222         * into an inaudible ringer mode.
2223         */
2224        public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
2225
2226        private static final Validator MODE_RINGER_STREAMS_AFFECTED_VALIDATOR =
2227                sNonNegativeIntegerValidator;
2228
2229        /**
2230          * Determines which streams are affected by mute. The
2231          * stream type's bit should be set to 1 if it should be muted when a mute request
2232          * is received.
2233          */
2234        public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
2235
2236        private static final Validator MUTE_STREAMS_AFFECTED_VALIDATOR =
2237                sNonNegativeIntegerValidator;
2238
2239        /**
2240         * Whether vibrate is on for different events. This is used internally,
2241         * changing this value will not change the vibrate. See AudioManager.
2242         */
2243        public static final String VIBRATE_ON = "vibrate_on";
2244
2245        private static final Validator VIBRATE_ON_VALIDATOR = sBooleanValidator;
2246
2247        /**
2248         * If 1, redirects the system vibrator to all currently attached input devices
2249         * that support vibration.  If there are no such input devices, then the system
2250         * vibrator is used instead.
2251         * If 0, does not register the system vibrator.
2252         *
2253         * This setting is mainly intended to provide a compatibility mechanism for
2254         * applications that only know about the system vibrator and do not use the
2255         * input device vibrator API.
2256         *
2257         * @hide
2258         */
2259        public static final String VIBRATE_INPUT_DEVICES = "vibrate_input_devices";
2260
2261        private static final Validator VIBRATE_INPUT_DEVICES_VALIDATOR = sBooleanValidator;
2262
2263        /**
2264         * Ringer volume. This is used internally, changing this value will not
2265         * change the volume. See AudioManager.
2266         *
2267         * @removed Not used by anything since API 2.
2268         */
2269        public static final String VOLUME_RING = "volume_ring";
2270
2271        /**
2272         * System/notifications volume. This is used internally, changing this
2273         * value will not change the volume. See AudioManager.
2274         *
2275         * @removed Not used by anything since API 2.
2276         */
2277        public static final String VOLUME_SYSTEM = "volume_system";
2278
2279        /**
2280         * Voice call volume. This is used internally, changing this value will
2281         * not change the volume. See AudioManager.
2282         *
2283         * @removed Not used by anything since API 2.
2284         */
2285        public static final String VOLUME_VOICE = "volume_voice";
2286
2287        /**
2288         * Music/media/gaming volume. This is used internally, changing this
2289         * value will not change the volume. See AudioManager.
2290         *
2291         * @removed Not used by anything since API 2.
2292         */
2293        public static final String VOLUME_MUSIC = "volume_music";
2294
2295        /**
2296         * Alarm volume. This is used internally, changing this
2297         * value will not change the volume. See AudioManager.
2298         *
2299         * @removed Not used by anything since API 2.
2300         */
2301        public static final String VOLUME_ALARM = "volume_alarm";
2302
2303        /**
2304         * Notification volume. This is used internally, changing this
2305         * value will not change the volume. See AudioManager.
2306         *
2307         * @removed Not used by anything since API 2.
2308         */
2309        public static final String VOLUME_NOTIFICATION = "volume_notification";
2310
2311        /**
2312         * Bluetooth Headset volume. This is used internally, changing this value will
2313         * not change the volume. See AudioManager.
2314         *
2315         * @removed Not used by anything since API 2.
2316         */
2317        public static final String VOLUME_BLUETOOTH_SCO = "volume_bluetooth_sco";
2318
2319        /**
2320         * Master volume (float in the range 0.0f to 1.0f).
2321         *
2322         * @hide
2323         */
2324        public static final String VOLUME_MASTER = "volume_master";
2325
2326        /**
2327         * Master volume mute (int 1 = mute, 0 = not muted).
2328         *
2329         * @hide
2330         */
2331        public static final String VOLUME_MASTER_MUTE = "volume_master_mute";
2332
2333        private static final Validator VOLUME_MASTER_MUTE_VALIDATOR = sBooleanValidator;
2334
2335        /**
2336         * Microphone mute (int 1 = mute, 0 = not muted).
2337         *
2338         * @hide
2339         */
2340        public static final String MICROPHONE_MUTE = "microphone_mute";
2341
2342        private static final Validator MICROPHONE_MUTE_VALIDATOR = sBooleanValidator;
2343
2344        /**
2345         * Whether the notifications should use the ring volume (value of 1) or
2346         * a separate notification volume (value of 0). In most cases, users
2347         * will have this enabled so the notification and ringer volumes will be
2348         * the same. However, power users can disable this and use the separate
2349         * notification volume control.
2350         * <p>
2351         * Note: This is a one-off setting that will be removed in the future
2352         * when there is profile support. For this reason, it is kept hidden
2353         * from the public APIs.
2354         *
2355         * @hide
2356         * @deprecated
2357         */
2358        @Deprecated
2359        public static final String NOTIFICATIONS_USE_RING_VOLUME =
2360            "notifications_use_ring_volume";
2361
2362        private static final Validator NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR = sBooleanValidator;
2363
2364        /**
2365         * Whether silent mode should allow vibration feedback. This is used
2366         * internally in AudioService and the Sound settings activity to
2367         * coordinate decoupling of vibrate and silent modes. This setting
2368         * will likely be removed in a future release with support for
2369         * audio/vibe feedback profiles.
2370         *
2371         * Not used anymore. On devices with vibrator, the user explicitly selects
2372         * silent or vibrate mode.
2373         * Kept for use by legacy database upgrade code in DatabaseHelper.
2374         * @hide
2375         */
2376        public static final String VIBRATE_IN_SILENT = "vibrate_in_silent";
2377
2378        private static final Validator VIBRATE_IN_SILENT_VALIDATOR = sBooleanValidator;
2379
2380        /**
2381         * The mapping of stream type (integer) to its setting.
2382         *
2383         * @removed  Not used by anything since API 2.
2384         */
2385        public static final String[] VOLUME_SETTINGS = {
2386            VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
2387            VOLUME_ALARM, VOLUME_NOTIFICATION, VOLUME_BLUETOOTH_SCO
2388        };
2389
2390        /**
2391         * Appended to various volume related settings to record the previous
2392         * values before they the settings were affected by a silent/vibrate
2393         * ringer mode change.
2394         *
2395         * @removed  Not used by anything since API 2.
2396         */
2397        public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
2398
2399        /**
2400         * Persistent store for the system-wide default ringtone URI.
2401         * <p>
2402         * If you need to play the default ringtone at any given time, it is recommended
2403         * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
2404         * to the set default ringtone at the time of playing.
2405         *
2406         * @see #DEFAULT_RINGTONE_URI
2407         */
2408        public static final String RINGTONE = "ringtone";
2409
2410        private static final Validator RINGTONE_VALIDATOR = sUriValidator;
2411
2412        /**
2413         * A {@link Uri} that will point to the current default ringtone at any
2414         * given time.
2415         * <p>
2416         * If the current default ringtone is in the DRM provider and the caller
2417         * does not have permission, the exception will be a
2418         * FileNotFoundException.
2419         */
2420        public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
2421
2422        /**
2423         * Persistent store for the system-wide default notification sound.
2424         *
2425         * @see #RINGTONE
2426         * @see #DEFAULT_NOTIFICATION_URI
2427         */
2428        public static final String NOTIFICATION_SOUND = "notification_sound";
2429
2430        private static final Validator NOTIFICATION_SOUND_VALIDATOR = sUriValidator;
2431
2432        /**
2433         * A {@link Uri} that will point to the current default notification
2434         * sound at any given time.
2435         *
2436         * @see #DEFAULT_RINGTONE_URI
2437         */
2438        public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
2439
2440        /**
2441         * Persistent store for the system-wide default alarm alert.
2442         *
2443         * @see #RINGTONE
2444         * @see #DEFAULT_ALARM_ALERT_URI
2445         */
2446        public static final String ALARM_ALERT = "alarm_alert";
2447
2448        private static final Validator ALARM_ALERT_VALIDATOR = sUriValidator;
2449
2450        /**
2451         * A {@link Uri} that will point to the current default alarm alert at
2452         * any given time.
2453         *
2454         * @see #DEFAULT_ALARM_ALERT_URI
2455         */
2456        public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
2457
2458        /**
2459         * Persistent store for the system default media button event receiver.
2460         *
2461         * @hide
2462         */
2463        public static final String MEDIA_BUTTON_RECEIVER = "media_button_receiver";
2464
2465        private static final Validator MEDIA_BUTTON_RECEIVER_VALIDATOR = new Validator() {
2466            @Override
2467            public boolean validate(String value) {
2468                try {
2469                    ComponentName.unflattenFromString(value);
2470                    return true;
2471                } catch (NullPointerException e) {
2472                    return false;
2473                }
2474            }
2475        };
2476
2477        /**
2478         * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
2479         */
2480        public static final String TEXT_AUTO_REPLACE = "auto_replace";
2481
2482        private static final Validator TEXT_AUTO_REPLACE_VALIDATOR = sBooleanValidator;
2483
2484        /**
2485         * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
2486         */
2487        public static final String TEXT_AUTO_CAPS = "auto_caps";
2488
2489        private static final Validator TEXT_AUTO_CAPS_VALIDATOR = sBooleanValidator;
2490
2491        /**
2492         * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
2493         * feature converts two spaces to a "." and space.
2494         */
2495        public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
2496
2497        private static final Validator TEXT_AUTO_PUNCTUATE_VALIDATOR = sBooleanValidator;
2498
2499        /**
2500         * Setting to showing password characters in text editors. 1 = On, 0 = Off
2501         */
2502        public static final String TEXT_SHOW_PASSWORD = "show_password";
2503
2504        private static final Validator TEXT_SHOW_PASSWORD_VALIDATOR = sBooleanValidator;
2505
2506        public static final String SHOW_GTALK_SERVICE_STATUS =
2507                "SHOW_GTALK_SERVICE_STATUS";
2508
2509        private static final Validator SHOW_GTALK_SERVICE_STATUS_VALIDATOR = sBooleanValidator;
2510
2511        /**
2512         * Name of activity to use for wallpaper on the home screen.
2513         *
2514         * @deprecated Use {@link WallpaperManager} instead.
2515         */
2516        @Deprecated
2517        public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
2518
2519        private static final Validator WALLPAPER_ACTIVITY_VALIDATOR = new Validator() {
2520            private static final int MAX_LENGTH = 1000;
2521
2522            @Override
2523            public boolean validate(String value) {
2524                if (value != null && value.length() > MAX_LENGTH) {
2525                    return false;
2526                }
2527                return ComponentName.unflattenFromString(value) != null;
2528            }
2529        };
2530
2531        /**
2532         * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME}
2533         * instead
2534         */
2535        @Deprecated
2536        public static final String AUTO_TIME = Global.AUTO_TIME;
2537
2538        /**
2539         * @deprecated Use {@link android.provider.Settings.Global#AUTO_TIME_ZONE}
2540         * instead
2541         */
2542        @Deprecated
2543        public static final String AUTO_TIME_ZONE = Global.AUTO_TIME_ZONE;
2544
2545        /**
2546         * Display times as 12 or 24 hours
2547         *   12
2548         *   24
2549         */
2550        public static final String TIME_12_24 = "time_12_24";
2551
2552        /** @hide */
2553        public static final Validator TIME_12_24_VALIDATOR =
2554                new DiscreteValueValidator(new String[] {"12", "24"});
2555
2556        /**
2557         * Date format string
2558         *   mm/dd/yyyy
2559         *   dd/mm/yyyy
2560         *   yyyy/mm/dd
2561         */
2562        public static final String DATE_FORMAT = "date_format";
2563
2564        /** @hide */
2565        public static final Validator DATE_FORMAT_VALIDATOR = new Validator() {
2566            @Override
2567            public boolean validate(String value) {
2568                try {
2569                    new SimpleDateFormat(value);
2570                    return true;
2571                } catch (IllegalArgumentException e) {
2572                    return false;
2573                }
2574            }
2575        };
2576
2577        /**
2578         * Whether the setup wizard has been run before (on first boot), or if
2579         * it still needs to be run.
2580         *
2581         * nonzero = it has been run in the past
2582         * 0 = it has not been run in the past
2583         */
2584        public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
2585
2586        /** @hide */
2587        public static final Validator SETUP_WIZARD_HAS_RUN_VALIDATOR = sBooleanValidator;
2588
2589        /**
2590         * Scaling factor for normal window animations. Setting to 0 will disable window
2591         * animations.
2592         *
2593         * @deprecated Use {@link Global#WINDOW_ANIMATION_SCALE} instead
2594         */
2595        @Deprecated
2596        public static final String WINDOW_ANIMATION_SCALE = Global.WINDOW_ANIMATION_SCALE;
2597
2598        /**
2599         * Scaling factor for activity transition animations. Setting to 0 will disable window
2600         * animations.
2601         *
2602         * @deprecated Use {@link Global#TRANSITION_ANIMATION_SCALE} instead
2603         */
2604        @Deprecated
2605        public static final String TRANSITION_ANIMATION_SCALE = Global.TRANSITION_ANIMATION_SCALE;
2606
2607        /**
2608         * Scaling factor for Animator-based animations. This affects both the start delay and
2609         * duration of all such animations. Setting to 0 will cause animations to end immediately.
2610         * The default value is 1.
2611         *
2612         * @deprecated Use {@link Global#ANIMATOR_DURATION_SCALE} instead
2613         */
2614        @Deprecated
2615        public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
2616
2617        /**
2618         * Control whether the accelerometer will be used to change screen
2619         * orientation.  If 0, it will not be used unless explicitly requested
2620         * by the application; if 1, it will be used by default unless explicitly
2621         * disabled by the application.
2622         */
2623        public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
2624
2625        /** @hide */
2626        public static final Validator ACCELEROMETER_ROTATION_VALIDATOR = sBooleanValidator;
2627
2628        /**
2629         * Default screen rotation when no other policy applies.
2630         * When {@link #ACCELEROMETER_ROTATION} is zero and no on-screen Activity expresses a
2631         * preference, this rotation value will be used. Must be one of the
2632         * {@link android.view.Surface#ROTATION_0 Surface rotation constants}.
2633         *
2634         * @see android.view.Display#getRotation
2635         */
2636        public static final String USER_ROTATION = "user_rotation";
2637
2638        /** @hide */
2639        public static final Validator USER_ROTATION_VALIDATOR =
2640                new InclusiveIntegerRangeValidator(0, 3);
2641
2642        /**
2643         * Control whether the rotation lock toggle in the System UI should be hidden.
2644         * Typically this is done for accessibility purposes to make it harder for
2645         * the user to accidentally toggle the rotation lock while the display rotation
2646         * has been locked for accessibility.
2647         *
2648         * If 0, then rotation lock toggle is not hidden for accessibility (although it may be
2649         * unavailable for other reasons).  If 1, then the rotation lock toggle is hidden.
2650         *
2651         * @hide
2652         */
2653        public static final String HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY =
2654                "hide_rotation_lock_toggle_for_accessibility";
2655
2656        /** @hide */
2657        public static final Validator HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR =
2658                sBooleanValidator;
2659
2660        /**
2661         * Whether the phone vibrates when it is ringing due to an incoming call. This will
2662         * be used by Phone and Setting apps; it shouldn't affect other apps.
2663         * The value is boolean (1 or 0).
2664         *
2665         * Note: this is not same as "vibrate on ring", which had been available until ICS.
2666         * It was about AudioManager's setting and thus affected all the applications which
2667         * relied on the setting, while this is purely about the vibration setting for incoming
2668         * calls.
2669         *
2670         * @hide
2671         */
2672        public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
2673
2674        /** @hide */
2675        public static final Validator VIBRATE_WHEN_RINGING_VALIDATOR = sBooleanValidator;
2676
2677        /**
2678         * Whether the audible DTMF tones are played by the dialer when dialing. The value is
2679         * boolean (1 or 0).
2680         */
2681        public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
2682
2683        /** @hide */
2684        public static final Validator DTMF_TONE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
2685
2686        /**
2687         * CDMA only settings
2688         * DTMF tone type played by the dialer when dialing.
2689         *                 0 = Normal
2690         *                 1 = Long
2691         * @hide
2692         */
2693        public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
2694
2695        /** @hide */
2696        public static final Validator DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR = sBooleanValidator;
2697
2698        /**
2699         * Whether the hearing aid is enabled. The value is
2700         * boolean (1 or 0).
2701         * @hide
2702         */
2703        public static final String HEARING_AID = "hearing_aid";
2704
2705        /** @hide */
2706        public static final Validator HEARING_AID_VALIDATOR = sBooleanValidator;
2707
2708        /**
2709         * CDMA only settings
2710         * TTY Mode
2711         * 0 = OFF
2712         * 1 = FULL
2713         * 2 = VCO
2714         * 3 = HCO
2715         * @hide
2716         */
2717        public static final String TTY_MODE = "tty_mode";
2718
2719        /** @hide */
2720        public static final Validator TTY_MODE_VALIDATOR = new InclusiveIntegerRangeValidator(0, 3);
2721
2722        /**
2723         * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
2724         * boolean (1 or 0).
2725         */
2726        public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
2727
2728        /** @hide */
2729        public static final Validator SOUND_EFFECTS_ENABLED_VALIDATOR = sBooleanValidator;
2730
2731        /**
2732         * Whether the haptic feedback (long presses, ...) are enabled. The value is
2733         * boolean (1 or 0).
2734         */
2735        public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
2736
2737        /** @hide */
2738        public static final Validator HAPTIC_FEEDBACK_ENABLED_VALIDATOR = sBooleanValidator;
2739
2740        /**
2741         * @deprecated Each application that shows web suggestions should have its own
2742         * setting for this.
2743         */
2744        @Deprecated
2745        public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
2746
2747        /** @hide */
2748        public static final Validator SHOW_WEB_SUGGESTIONS_VALIDATOR = sBooleanValidator;
2749
2750        /**
2751         * Whether the notification LED should repeatedly flash when a notification is
2752         * pending. The value is boolean (1 or 0).
2753         * @hide
2754         */
2755        public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
2756
2757        /** @hide */
2758        public static final Validator NOTIFICATION_LIGHT_PULSE_VALIDATOR = sBooleanValidator;
2759
2760        /**
2761         * Show pointer location on screen?
2762         * 0 = no
2763         * 1 = yes
2764         * @hide
2765         */
2766        public static final String POINTER_LOCATION = "pointer_location";
2767
2768        /** @hide */
2769        public static final Validator POINTER_LOCATION_VALIDATOR = sBooleanValidator;
2770
2771        /**
2772         * Show touch positions on screen?
2773         * 0 = no
2774         * 1 = yes
2775         * @hide
2776         */
2777        public static final String SHOW_TOUCHES = "show_touches";
2778
2779        /** @hide */
2780        public static final Validator SHOW_TOUCHES_VALIDATOR = sBooleanValidator;
2781
2782        /**
2783         * Log raw orientation data from
2784         * {@link com.android.server.policy.WindowOrientationListener} for use with the
2785         * orientationplot.py tool.
2786         * 0 = no
2787         * 1 = yes
2788         * @hide
2789         */
2790        public static final String WINDOW_ORIENTATION_LISTENER_LOG =
2791                "window_orientation_listener_log";
2792
2793        /** @hide */
2794        public static final Validator WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR = sBooleanValidator;
2795
2796        /**
2797         * @deprecated Use {@link android.provider.Settings.Global#POWER_SOUNDS_ENABLED}
2798         * instead
2799         * @hide
2800         */
2801        @Deprecated
2802        public static final String POWER_SOUNDS_ENABLED = Global.POWER_SOUNDS_ENABLED;
2803
2804        /**
2805         * @deprecated Use {@link android.provider.Settings.Global#DOCK_SOUNDS_ENABLED}
2806         * instead
2807         * @hide
2808         */
2809        @Deprecated
2810        public static final String DOCK_SOUNDS_ENABLED = Global.DOCK_SOUNDS_ENABLED;
2811
2812        /**
2813         * Whether to play sounds when the keyguard is shown and dismissed.
2814         * @hide
2815         */
2816        public static final String LOCKSCREEN_SOUNDS_ENABLED = "lockscreen_sounds_enabled";
2817
2818        /** @hide */
2819        public static final Validator LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR = sBooleanValidator;
2820
2821        /**
2822         * Whether the lockscreen should be completely disabled.
2823         * @hide
2824         */
2825        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";
2826
2827        /** @hide */
2828        public static final Validator LOCKSCREEN_DISABLED_VALIDATOR = sBooleanValidator;
2829
2830        /**
2831         * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
2832         * instead
2833         * @hide
2834         */
2835        @Deprecated
2836        public static final String LOW_BATTERY_SOUND = Global.LOW_BATTERY_SOUND;
2837
2838        /**
2839         * @deprecated Use {@link android.provider.Settings.Global#DESK_DOCK_SOUND}
2840         * instead
2841         * @hide
2842         */
2843        @Deprecated
2844        public static final String DESK_DOCK_SOUND = Global.DESK_DOCK_SOUND;
2845
2846        /**
2847         * @deprecated Use {@link android.provider.Settings.Global#DESK_UNDOCK_SOUND}
2848         * instead
2849         * @hide
2850         */
2851        @Deprecated
2852        public static final String DESK_UNDOCK_SOUND = Global.DESK_UNDOCK_SOUND;
2853
2854        /**
2855         * @deprecated Use {@link android.provider.Settings.Global#CAR_DOCK_SOUND}
2856         * instead
2857         * @hide
2858         */
2859        @Deprecated
2860        public static final String CAR_DOCK_SOUND = Global.CAR_DOCK_SOUND;
2861
2862        /**
2863         * @deprecated Use {@link android.provider.Settings.Global#CAR_UNDOCK_SOUND}
2864         * instead
2865         * @hide
2866         */
2867        @Deprecated
2868        public static final String CAR_UNDOCK_SOUND = Global.CAR_UNDOCK_SOUND;
2869
2870        /**
2871         * @deprecated Use {@link android.provider.Settings.Global#LOCK_SOUND}
2872         * instead
2873         * @hide
2874         */
2875        @Deprecated
2876        public static final String LOCK_SOUND = Global.LOCK_SOUND;
2877
2878        /**
2879         * @deprecated Use {@link android.provider.Settings.Global#UNLOCK_SOUND}
2880         * instead
2881         * @hide
2882         */
2883        @Deprecated
2884        public static final String UNLOCK_SOUND = Global.UNLOCK_SOUND;
2885
2886        /**
2887         * Receive incoming SIP calls?
2888         * 0 = no
2889         * 1 = yes
2890         * @hide
2891         */
2892        public static final String SIP_RECEIVE_CALLS = "sip_receive_calls";
2893
2894        /** @hide */
2895        public static final Validator SIP_RECEIVE_CALLS_VALIDATOR = sBooleanValidator;
2896
2897        /**
2898         * Call Preference String.
2899         * "SIP_ALWAYS" : Always use SIP with network access
2900         * "SIP_ADDRESS_ONLY" : Only if destination is a SIP address
2901         * @hide
2902         */
2903        public static final String SIP_CALL_OPTIONS = "sip_call_options";
2904
2905        /** @hide */
2906        public static final Validator SIP_CALL_OPTIONS_VALIDATOR = new DiscreteValueValidator(
2907                new String[] {"SIP_ALWAYS", "SIP_ADDRESS_ONLY"});
2908
2909        /**
2910         * One of the sip call options: Always use SIP with network access.
2911         * @hide
2912         */
2913        public static final String SIP_ALWAYS = "SIP_ALWAYS";
2914
2915        /** @hide */
2916        public static final Validator SIP_ALWAYS_VALIDATOR = sBooleanValidator;
2917
2918        /**
2919         * One of the sip call options: Only if destination is a SIP address.
2920         * @hide
2921         */
2922        public static final String SIP_ADDRESS_ONLY = "SIP_ADDRESS_ONLY";
2923
2924        /** @hide */
2925        public static final Validator SIP_ADDRESS_ONLY_VALIDATOR = sBooleanValidator;
2926
2927        /**
2928         * @deprecated Use SIP_ALWAYS or SIP_ADDRESS_ONLY instead.  Formerly used to indicate that
2929         * the user should be prompted each time a call is made whether it should be placed using
2930         * SIP.  The {@link com.android.providers.settings.DatabaseHelper} replaces this with
2931         * SIP_ADDRESS_ONLY.
2932         * @hide
2933         */
2934        @Deprecated
2935        public static final String SIP_ASK_ME_EACH_TIME = "SIP_ASK_ME_EACH_TIME";
2936
2937        /** @hide */
2938        public static final Validator SIP_ASK_ME_EACH_TIME_VALIDATOR = sBooleanValidator;
2939
2940        /**
2941         * Pointer speed setting.
2942         * This is an integer value in a range between -7 and +7, so there are 15 possible values.
2943         *   -7 = slowest
2944         *    0 = default speed
2945         *   +7 = fastest
2946         * @hide
2947         */
2948        public static final String POINTER_SPEED = "pointer_speed";
2949
2950        /** @hide */
2951        public static final Validator POINTER_SPEED_VALIDATOR =
2952                new InclusiveFloatRangeValidator(-7, 7);
2953
2954        /**
2955         * Whether lock-to-app will be triggered by long-press on recents.
2956         * @hide
2957         */
2958        public static final String LOCK_TO_APP_ENABLED = "lock_to_app_enabled";
2959
2960        /** @hide */
2961        public static final Validator LOCK_TO_APP_ENABLED_VALIDATOR = sBooleanValidator;
2962
2963        /**
2964         * I am the lolrus.
2965         * <p>
2966         * Nonzero values indicate that the user has a bukkit.
2967         * Backward-compatible with <code>PrefGetPreference(prefAllowEasterEggs)</code>.
2968         * @hide
2969         */
2970        public static final String EGG_MODE = "egg_mode";
2971
2972        /** @hide */
2973        public static final Validator EGG_MODE_VALIDATOR = sBooleanValidator;
2974
2975        /**
2976         * IMPORTANT: If you add a new public settings you also have to add it to
2977         * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
2978         * it to PRIVATE_SETTINGS below. Also add a validator that can validate
2979         * the setting value. See an example above.
2980         */
2981
2982        /**
2983         * Settings to backup. This is here so that it's in the same place as the settings
2984         * keys and easy to update.
2985         *
2986         * NOTE: Settings are backed up and restored in the order they appear
2987         *       in this array. If you have one setting depending on another,
2988         *       make sure that they are ordered appropriately.
2989         *
2990         * @hide
2991         */
2992        public static final String[] SETTINGS_TO_BACKUP = {
2993            STAY_ON_WHILE_PLUGGED_IN,   // moved to global
2994            WIFI_USE_STATIC_IP,
2995            WIFI_STATIC_IP,
2996            WIFI_STATIC_GATEWAY,
2997            WIFI_STATIC_NETMASK,
2998            WIFI_STATIC_DNS1,
2999            WIFI_STATIC_DNS2,
3000            BLUETOOTH_DISCOVERABILITY,
3001            BLUETOOTH_DISCOVERABILITY_TIMEOUT,
3002            DIM_SCREEN,
3003            SCREEN_OFF_TIMEOUT,
3004            SCREEN_BRIGHTNESS,
3005            SCREEN_BRIGHTNESS_MODE,
3006            SCREEN_AUTO_BRIGHTNESS_ADJ,
3007            VIBRATE_INPUT_DEVICES,
3008            MODE_RINGER_STREAMS_AFFECTED,
3009            TEXT_AUTO_REPLACE,
3010            TEXT_AUTO_CAPS,
3011            TEXT_AUTO_PUNCTUATE,
3012            TEXT_SHOW_PASSWORD,
3013            AUTO_TIME,                  // moved to global
3014            AUTO_TIME_ZONE,             // moved to global
3015            TIME_12_24,
3016            DATE_FORMAT,
3017            DTMF_TONE_WHEN_DIALING,
3018            DTMF_TONE_TYPE_WHEN_DIALING,
3019            HEARING_AID,
3020            TTY_MODE,
3021            SOUND_EFFECTS_ENABLED,
3022            HAPTIC_FEEDBACK_ENABLED,
3023            POWER_SOUNDS_ENABLED,       // moved to global
3024            DOCK_SOUNDS_ENABLED,        // moved to global
3025            LOCKSCREEN_SOUNDS_ENABLED,
3026            SHOW_WEB_SUGGESTIONS,
3027            NOTIFICATION_LIGHT_PULSE,
3028            SIP_CALL_OPTIONS,
3029            SIP_RECEIVE_CALLS,
3030            POINTER_SPEED,
3031            VIBRATE_WHEN_RINGING,
3032            RINGTONE,
3033            LOCK_TO_APP_ENABLED,
3034            NOTIFICATION_SOUND
3035        };
3036
3037        /**
3038         * These are all pulbic system settings
3039         *
3040         * @hide
3041         */
3042        public static final Set<String> PUBLIC_SETTINGS = new ArraySet<>();
3043        static {
3044            PUBLIC_SETTINGS.add(END_BUTTON_BEHAVIOR);
3045            PUBLIC_SETTINGS.add(WIFI_USE_STATIC_IP);
3046            PUBLIC_SETTINGS.add(WIFI_STATIC_IP);
3047            PUBLIC_SETTINGS.add(WIFI_STATIC_GATEWAY);
3048            PUBLIC_SETTINGS.add(WIFI_STATIC_NETMASK);
3049            PUBLIC_SETTINGS.add(WIFI_STATIC_DNS1);
3050            PUBLIC_SETTINGS.add(WIFI_STATIC_DNS2);
3051            PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY);
3052            PUBLIC_SETTINGS.add(BLUETOOTH_DISCOVERABILITY_TIMEOUT);
3053            PUBLIC_SETTINGS.add(NEXT_ALARM_FORMATTED);
3054            PUBLIC_SETTINGS.add(FONT_SCALE);
3055            PUBLIC_SETTINGS.add(DIM_SCREEN);
3056            PUBLIC_SETTINGS.add(SCREEN_OFF_TIMEOUT);
3057            PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS);
3058            PUBLIC_SETTINGS.add(SCREEN_BRIGHTNESS_MODE);
3059            PUBLIC_SETTINGS.add(MODE_RINGER_STREAMS_AFFECTED);
3060            PUBLIC_SETTINGS.add(MUTE_STREAMS_AFFECTED);
3061            PUBLIC_SETTINGS.add(VIBRATE_ON);
3062            PUBLIC_SETTINGS.add(VOLUME_RING);
3063            PUBLIC_SETTINGS.add(VOLUME_SYSTEM);
3064            PUBLIC_SETTINGS.add(VOLUME_VOICE);
3065            PUBLIC_SETTINGS.add(VOLUME_MUSIC);
3066            PUBLIC_SETTINGS.add(VOLUME_ALARM);
3067            PUBLIC_SETTINGS.add(VOLUME_NOTIFICATION);
3068            PUBLIC_SETTINGS.add(VOLUME_BLUETOOTH_SCO);
3069            PUBLIC_SETTINGS.add(RINGTONE);
3070            PUBLIC_SETTINGS.add(NOTIFICATION_SOUND);
3071            PUBLIC_SETTINGS.add(ALARM_ALERT);
3072            PUBLIC_SETTINGS.add(TEXT_AUTO_REPLACE);
3073            PUBLIC_SETTINGS.add(TEXT_AUTO_CAPS);
3074            PUBLIC_SETTINGS.add(TEXT_AUTO_PUNCTUATE);
3075            PUBLIC_SETTINGS.add(TEXT_SHOW_PASSWORD);
3076            PUBLIC_SETTINGS.add(SHOW_GTALK_SERVICE_STATUS);
3077            PUBLIC_SETTINGS.add(WALLPAPER_ACTIVITY);
3078            PUBLIC_SETTINGS.add(TIME_12_24);
3079            PUBLIC_SETTINGS.add(DATE_FORMAT);
3080            PUBLIC_SETTINGS.add(SETUP_WIZARD_HAS_RUN);
3081            PUBLIC_SETTINGS.add(ACCELEROMETER_ROTATION);
3082            PUBLIC_SETTINGS.add(USER_ROTATION);
3083            PUBLIC_SETTINGS.add(DTMF_TONE_WHEN_DIALING);
3084            PUBLIC_SETTINGS.add(SOUND_EFFECTS_ENABLED);
3085            PUBLIC_SETTINGS.add(HAPTIC_FEEDBACK_ENABLED);
3086            PUBLIC_SETTINGS.add(SHOW_WEB_SUGGESTIONS);
3087        }
3088
3089        /**
3090         * These are all hidden system settings.
3091         *
3092         * @hide
3093         */
3094        public static final Set<String> PRIVATE_SETTINGS = new ArraySet<>();
3095        static {
3096            PRIVATE_SETTINGS.add(WIFI_USE_STATIC_IP);
3097            PRIVATE_SETTINGS.add(END_BUTTON_BEHAVIOR);
3098            PRIVATE_SETTINGS.add(ADVANCED_SETTINGS);
3099            PRIVATE_SETTINGS.add(SCREEN_AUTO_BRIGHTNESS_ADJ);
3100            PRIVATE_SETTINGS.add(VIBRATE_INPUT_DEVICES);
3101            PRIVATE_SETTINGS.add(VOLUME_MASTER);
3102            PRIVATE_SETTINGS.add(VOLUME_MASTER_MUTE);
3103            PRIVATE_SETTINGS.add(MICROPHONE_MUTE);
3104            PRIVATE_SETTINGS.add(NOTIFICATIONS_USE_RING_VOLUME);
3105            PRIVATE_SETTINGS.add(VIBRATE_IN_SILENT);
3106            PRIVATE_SETTINGS.add(MEDIA_BUTTON_RECEIVER);
3107            PRIVATE_SETTINGS.add(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY);
3108            PRIVATE_SETTINGS.add(VIBRATE_WHEN_RINGING);
3109            PRIVATE_SETTINGS.add(DTMF_TONE_TYPE_WHEN_DIALING);
3110            PRIVATE_SETTINGS.add(HEARING_AID);
3111            PRIVATE_SETTINGS.add(TTY_MODE);
3112            PRIVATE_SETTINGS.add(NOTIFICATION_LIGHT_PULSE);
3113            PRIVATE_SETTINGS.add(POINTER_LOCATION);
3114            PRIVATE_SETTINGS.add(SHOW_TOUCHES);
3115            PRIVATE_SETTINGS.add(WINDOW_ORIENTATION_LISTENER_LOG);
3116            PRIVATE_SETTINGS.add(POWER_SOUNDS_ENABLED);
3117            PRIVATE_SETTINGS.add(DOCK_SOUNDS_ENABLED);
3118            PRIVATE_SETTINGS.add(LOCKSCREEN_SOUNDS_ENABLED);
3119            PRIVATE_SETTINGS.add(LOCKSCREEN_DISABLED);
3120            PRIVATE_SETTINGS.add(LOW_BATTERY_SOUND);
3121            PRIVATE_SETTINGS.add(DESK_DOCK_SOUND);
3122            PRIVATE_SETTINGS.add(DESK_UNDOCK_SOUND);
3123            PRIVATE_SETTINGS.add(CAR_DOCK_SOUND);
3124            PRIVATE_SETTINGS.add(CAR_UNDOCK_SOUND);
3125            PRIVATE_SETTINGS.add(LOCK_SOUND);
3126            PRIVATE_SETTINGS.add(UNLOCK_SOUND);
3127            PRIVATE_SETTINGS.add(SIP_RECEIVE_CALLS);
3128            PRIVATE_SETTINGS.add(SIP_CALL_OPTIONS);
3129            PRIVATE_SETTINGS.add(SIP_ALWAYS);
3130            PRIVATE_SETTINGS.add(SIP_ADDRESS_ONLY);
3131            PRIVATE_SETTINGS.add(SIP_ASK_ME_EACH_TIME);
3132            PRIVATE_SETTINGS.add(POINTER_SPEED);
3133            PRIVATE_SETTINGS.add(LOCK_TO_APP_ENABLED);
3134            PRIVATE_SETTINGS.add(EGG_MODE);
3135        }
3136
3137        /**
3138         * These are all pulbic system settings
3139         *
3140         * @hide
3141         */
3142        public static final Map<String, Validator> VALIDATORS = new ArrayMap<>();
3143        static {
3144            VALIDATORS.put(END_BUTTON_BEHAVIOR,END_BUTTON_BEHAVIOR_VALIDATOR);
3145            VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
3146            VALIDATORS.put(BLUETOOTH_DISCOVERABILITY, BLUETOOTH_DISCOVERABILITY_VALIDATOR);
3147            VALIDATORS.put(BLUETOOTH_DISCOVERABILITY_TIMEOUT,
3148                    BLUETOOTH_DISCOVERABILITY_TIMEOUT_VALIDATOR);
3149            VALIDATORS.put(NEXT_ALARM_FORMATTED, NEXT_ALARM_FORMATTED_VALIDATOR);
3150            VALIDATORS.put(FONT_SCALE, FONT_SCALE_VALIDATOR);
3151            VALIDATORS.put(DIM_SCREEN, DIM_SCREEN_VALIDATOR);
3152            VALIDATORS.put(SCREEN_OFF_TIMEOUT, SCREEN_OFF_TIMEOUT_VALIDATOR);
3153            VALIDATORS.put(SCREEN_BRIGHTNESS, SCREEN_BRIGHTNESS_VALIDATOR);
3154            VALIDATORS.put(SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_VALIDATOR);
3155            VALIDATORS.put(MODE_RINGER_STREAMS_AFFECTED, MODE_RINGER_STREAMS_AFFECTED_VALIDATOR);
3156            VALIDATORS.put(MUTE_STREAMS_AFFECTED, MUTE_STREAMS_AFFECTED_VALIDATOR);
3157            VALIDATORS.put(VIBRATE_ON, VIBRATE_ON_VALIDATOR);
3158            VALIDATORS.put(RINGTONE, RINGTONE_VALIDATOR);
3159            VALIDATORS.put(NOTIFICATION_SOUND, NOTIFICATION_SOUND_VALIDATOR);
3160            VALIDATORS.put(ALARM_ALERT, ALARM_ALERT_VALIDATOR);
3161            VALIDATORS.put(TEXT_AUTO_REPLACE, TEXT_AUTO_REPLACE_VALIDATOR);
3162            VALIDATORS.put(TEXT_AUTO_CAPS, TEXT_AUTO_CAPS_VALIDATOR);
3163            VALIDATORS.put(TEXT_AUTO_PUNCTUATE, TEXT_AUTO_PUNCTUATE_VALIDATOR);
3164            VALIDATORS.put(TEXT_SHOW_PASSWORD, TEXT_SHOW_PASSWORD_VALIDATOR);
3165            VALIDATORS.put(SHOW_GTALK_SERVICE_STATUS, SHOW_GTALK_SERVICE_STATUS_VALIDATOR);
3166            VALIDATORS.put(WALLPAPER_ACTIVITY, WALLPAPER_ACTIVITY_VALIDATOR);
3167            VALIDATORS.put(TIME_12_24, TIME_12_24_VALIDATOR);
3168            VALIDATORS.put(DATE_FORMAT, DATE_FORMAT_VALIDATOR);
3169            VALIDATORS.put(SETUP_WIZARD_HAS_RUN, SETUP_WIZARD_HAS_RUN_VALIDATOR);
3170            VALIDATORS.put(ACCELEROMETER_ROTATION, ACCELEROMETER_ROTATION_VALIDATOR);
3171            VALIDATORS.put(USER_ROTATION, USER_ROTATION_VALIDATOR);
3172            VALIDATORS.put(DTMF_TONE_WHEN_DIALING, DTMF_TONE_WHEN_DIALING_VALIDATOR);
3173            VALIDATORS.put(SOUND_EFFECTS_ENABLED, SOUND_EFFECTS_ENABLED_VALIDATOR);
3174            VALIDATORS.put(HAPTIC_FEEDBACK_ENABLED, HAPTIC_FEEDBACK_ENABLED_VALIDATOR);
3175            VALIDATORS.put(SHOW_WEB_SUGGESTIONS, SHOW_WEB_SUGGESTIONS_VALIDATOR);
3176            VALIDATORS.put(WIFI_USE_STATIC_IP, WIFI_USE_STATIC_IP_VALIDATOR);
3177            VALIDATORS.put(END_BUTTON_BEHAVIOR, END_BUTTON_BEHAVIOR_VALIDATOR);
3178            VALIDATORS.put(ADVANCED_SETTINGS, ADVANCED_SETTINGS_VALIDATOR);
3179            VALIDATORS.put(SCREEN_AUTO_BRIGHTNESS_ADJ, SCREEN_AUTO_BRIGHTNESS_ADJ_VALIDATOR);
3180            VALIDATORS.put(VIBRATE_INPUT_DEVICES, VIBRATE_INPUT_DEVICES_VALIDATOR);
3181            VALIDATORS.put(VOLUME_MASTER_MUTE, VOLUME_MASTER_MUTE_VALIDATOR);
3182            VALIDATORS.put(MICROPHONE_MUTE, MICROPHONE_MUTE_VALIDATOR);
3183            VALIDATORS.put(NOTIFICATIONS_USE_RING_VOLUME, NOTIFICATIONS_USE_RING_VOLUME_VALIDATOR);
3184            VALIDATORS.put(VIBRATE_IN_SILENT, VIBRATE_IN_SILENT_VALIDATOR);
3185            VALIDATORS.put(MEDIA_BUTTON_RECEIVER, MEDIA_BUTTON_RECEIVER_VALIDATOR);
3186            VALIDATORS.put(HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY,
3187                    HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY_VALIDATOR);
3188            VALIDATORS.put(VIBRATE_WHEN_RINGING, VIBRATE_WHEN_RINGING_VALIDATOR);
3189            VALIDATORS.put(DTMF_TONE_TYPE_WHEN_DIALING, DTMF_TONE_TYPE_WHEN_DIALING_VALIDATOR);
3190            VALIDATORS.put(HEARING_AID, HEARING_AID_VALIDATOR);
3191            VALIDATORS.put(TTY_MODE, TTY_MODE_VALIDATOR);
3192            VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, NOTIFICATION_LIGHT_PULSE_VALIDATOR);
3193            VALIDATORS.put(POINTER_LOCATION, POINTER_LOCATION_VALIDATOR);
3194            VALIDATORS.put(SHOW_TOUCHES, SHOW_TOUCHES_VALIDATOR);
3195            VALIDATORS.put(WINDOW_ORIENTATION_LISTENER_LOG,
3196                    WINDOW_ORIENTATION_LISTENER_LOG_VALIDATOR);
3197            VALIDATORS.put(LOCKSCREEN_SOUNDS_ENABLED, LOCKSCREEN_SOUNDS_ENABLED_VALIDATOR);
3198            VALIDATORS.put(LOCKSCREEN_DISABLED, LOCKSCREEN_DISABLED_VALIDATOR);
3199            VALIDATORS.put(SIP_RECEIVE_CALLS, SIP_RECEIVE_CALLS_VALIDATOR);
3200            VALIDATORS.put(SIP_CALL_OPTIONS, SIP_CALL_OPTIONS_VALIDATOR);
3201            VALIDATORS.put(SIP_ALWAYS, SIP_ALWAYS_VALIDATOR);
3202            VALIDATORS.put(SIP_ADDRESS_ONLY, SIP_ADDRESS_ONLY_VALIDATOR);
3203            VALIDATORS.put(SIP_ASK_ME_EACH_TIME, SIP_ASK_ME_EACH_TIME_VALIDATOR);
3204            VALIDATORS.put(POINTER_SPEED, POINTER_SPEED_VALIDATOR);
3205            VALIDATORS.put(LOCK_TO_APP_ENABLED, LOCK_TO_APP_ENABLED_VALIDATOR);
3206            VALIDATORS.put(EGG_MODE, EGG_MODE_VALIDATOR);
3207            VALIDATORS.put(WIFI_STATIC_IP, WIFI_STATIC_IP_VALIDATOR);
3208            VALIDATORS.put(WIFI_STATIC_GATEWAY, WIFI_STATIC_GATEWAY_VALIDATOR);
3209            VALIDATORS.put(WIFI_STATIC_NETMASK, WIFI_STATIC_NETMASK_VALIDATOR);
3210            VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
3211            VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
3212        }
3213
3214        /**
3215         * These entries are considered common between the personal and the managed profile,
3216         * since the managed profile doesn't get to change them.
3217         */
3218        private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
3219        static {
3220            CLONE_TO_MANAGED_PROFILE.add(DATE_FORMAT);
3221            CLONE_TO_MANAGED_PROFILE.add(HAPTIC_FEEDBACK_ENABLED);
3222            CLONE_TO_MANAGED_PROFILE.add(SOUND_EFFECTS_ENABLED);
3223            CLONE_TO_MANAGED_PROFILE.add(TEXT_SHOW_PASSWORD);
3224            CLONE_TO_MANAGED_PROFILE.add(TIME_12_24);
3225        }
3226
3227        /** @hide */
3228        public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
3229            outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
3230        }
3231
3232        /**
3233         * When to use Wi-Fi calling
3234         *
3235         * @see android.telephony.TelephonyManager.WifiCallingChoices
3236         * @hide
3237         */
3238        public static final String WHEN_TO_MAKE_WIFI_CALLS = "when_to_make_wifi_calls";
3239
3240        // Settings moved to Settings.Secure
3241
3242        /**
3243         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED}
3244         * instead
3245         */
3246        @Deprecated
3247        public static final String ADB_ENABLED = Global.ADB_ENABLED;
3248
3249        /**
3250         * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
3251         */
3252        @Deprecated
3253        public static final String ANDROID_ID = Secure.ANDROID_ID;
3254
3255        /**
3256         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
3257         */
3258        @Deprecated
3259        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
3260
3261        /**
3262         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
3263         */
3264        @Deprecated
3265        public static final String DATA_ROAMING = Global.DATA_ROAMING;
3266
3267        /**
3268         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
3269         */
3270        @Deprecated
3271        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
3272
3273        /**
3274         * @deprecated Use {@link android.provider.Settings.Global#HTTP_PROXY} instead
3275         */
3276        @Deprecated
3277        public static final String HTTP_PROXY = Global.HTTP_PROXY;
3278
3279        /**
3280         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
3281         */
3282        @Deprecated
3283        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
3284
3285        /**
3286         * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
3287         * instead
3288         */
3289        @Deprecated
3290        public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
3291
3292        /**
3293         * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
3294         */
3295        @Deprecated
3296        public static final String LOGGING_ID = Secure.LOGGING_ID;
3297
3298        /**
3299         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
3300         */
3301        @Deprecated
3302        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
3303
3304        /**
3305         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
3306         * instead
3307         */
3308        @Deprecated
3309        public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
3310
3311        /**
3312         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
3313         * instead
3314         */
3315        @Deprecated
3316        public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
3317
3318        /**
3319         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
3320         * instead
3321         */
3322        @Deprecated
3323        public static final String PARENTAL_CONTROL_REDIRECT_URL =
3324            Secure.PARENTAL_CONTROL_REDIRECT_URL;
3325
3326        /**
3327         * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
3328         */
3329        @Deprecated
3330        public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
3331
3332        /**
3333         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
3334         */
3335        @Deprecated
3336        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
3337
3338        /**
3339         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
3340         */
3341        @Deprecated
3342        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
3343
3344       /**
3345         * @deprecated Use
3346         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
3347         */
3348        @Deprecated
3349        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
3350
3351        /**
3352         * @deprecated Use
3353         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
3354         */
3355        @Deprecated
3356        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
3357                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
3358
3359        /**
3360         * @deprecated Use
3361         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
3362         */
3363        @Deprecated
3364        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
3365                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
3366
3367        /**
3368         * @deprecated Use
3369         * {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
3370         */
3371        @Deprecated
3372        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
3373                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
3374
3375        /**
3376         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
3377         * instead
3378         */
3379        @Deprecated
3380        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
3381
3382        /**
3383         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON} instead
3384         */
3385        @Deprecated
3386        public static final String WIFI_ON = Global.WIFI_ON;
3387
3388        /**
3389         * @deprecated Use
3390         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
3391         * instead
3392         */
3393        @Deprecated
3394        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
3395                Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
3396
3397        /**
3398         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
3399         */
3400        @Deprecated
3401        public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
3402
3403        /**
3404         * @deprecated Use
3405         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
3406         */
3407        @Deprecated
3408        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
3409                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
3410
3411        /**
3412         * @deprecated Use
3413         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
3414         */
3415        @Deprecated
3416        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
3417                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
3418
3419        /**
3420         * @deprecated Use
3421         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
3422         * instead
3423         */
3424        @Deprecated
3425        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
3426                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
3427
3428        /**
3429         * @deprecated Use
3430         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
3431         */
3432        @Deprecated
3433        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
3434            Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
3435
3436        /**
3437         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
3438         * instead
3439         */
3440        @Deprecated
3441        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
3442
3443        /**
3444         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
3445         */
3446        @Deprecated
3447        public static final String WIFI_WATCHDOG_ON = Global.WIFI_WATCHDOG_ON;
3448
3449        /**
3450         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
3451         */
3452        @Deprecated
3453        public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
3454
3455        /**
3456         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
3457         * instead
3458         */
3459        @Deprecated
3460        public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
3461
3462        /**
3463         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
3464         * instead
3465         */
3466        @Deprecated
3467        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
3468            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
3469    }
3470
3471    /**
3472     * Secure system settings, containing system preferences that applications
3473     * can read but are not allowed to write.  These are for preferences that
3474     * the user must explicitly modify through the system UI or specialized
3475     * APIs for those values, not modified directly by applications.
3476     */
3477    public static final class Secure extends NameValueTable {
3478        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
3479
3480        /**
3481         * The content:// style URL for this table
3482         */
3483        public static final Uri CONTENT_URI =
3484            Uri.parse("content://" + AUTHORITY + "/secure");
3485
3486        // Populated lazily, guarded by class object:
3487        private static final NameValueCache sNameValueCache = new NameValueCache(
3488                SYS_PROP_SETTING_VERSION,
3489                CONTENT_URI,
3490                CALL_METHOD_GET_SECURE,
3491                CALL_METHOD_PUT_SECURE);
3492
3493        private static ILockSettings sLockSettings = null;
3494
3495        private static boolean sIsSystemProcess;
3496        private static final HashSet<String> MOVED_TO_LOCK_SETTINGS;
3497        private static final HashSet<String> MOVED_TO_GLOBAL;
3498        static {
3499            MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3);
3500            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED);
3501            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE);
3502            MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
3503
3504            MOVED_TO_GLOBAL = new HashSet<String>();
3505            MOVED_TO_GLOBAL.add(Settings.Global.ADB_ENABLED);
3506            MOVED_TO_GLOBAL.add(Settings.Global.ASSISTED_GPS_ENABLED);
3507            MOVED_TO_GLOBAL.add(Settings.Global.BLUETOOTH_ON);
3508            MOVED_TO_GLOBAL.add(Settings.Global.BUGREPORT_IN_POWER_MENU);
3509            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_CELL_BROADCAST_SMS);
3510            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_ROAMING_MODE);
3511            MOVED_TO_GLOBAL.add(Settings.Global.CDMA_SUBSCRIPTION_MODE);
3512            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE);
3513            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ACTIVITY_TIMEOUT_WIFI);
3514            MOVED_TO_GLOBAL.add(Settings.Global.DATA_ROAMING);
3515            MOVED_TO_GLOBAL.add(Settings.Global.DEVELOPMENT_SETTINGS_ENABLED);
3516            MOVED_TO_GLOBAL.add(Settings.Global.DEVICE_PROVISIONED);
3517            MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_DENSITY_FORCED);
3518            MOVED_TO_GLOBAL.add(Settings.Global.DISPLAY_SIZE_FORCED);
3519            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_MAX_BYTES_OVER_MOBILE);
3520            MOVED_TO_GLOBAL.add(Settings.Global.DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE);
3521            MOVED_TO_GLOBAL.add(Settings.Global.MOBILE_DATA);
3522            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_BUCKET_DURATION);
3523            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_DELETE_AGE);
3524            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_PERSIST_BYTES);
3525            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_DEV_ROTATE_AGE);
3526            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_ENABLED);
3527            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_GLOBAL_ALERT_BYTES);
3528            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_POLL_INTERVAL);
3529            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_SAMPLE_ENABLED);
3530            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_TIME_CACHE_MAX_AGE);
3531            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_BUCKET_DURATION);
3532            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_DELETE_AGE);
3533            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_PERSIST_BYTES);
3534            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_ROTATE_AGE);
3535            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_BUCKET_DURATION);
3536            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_DELETE_AGE);
3537            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_PERSIST_BYTES);
3538            MOVED_TO_GLOBAL.add(Settings.Global.NETSTATS_UID_TAG_ROTATE_AGE);
3539            MOVED_TO_GLOBAL.add(Settings.Global.NETWORK_PREFERENCE);
3540            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_DIFF);
3541            MOVED_TO_GLOBAL.add(Settings.Global.NITZ_UPDATE_SPACING);
3542            MOVED_TO_GLOBAL.add(Settings.Global.NTP_SERVER);
3543            MOVED_TO_GLOBAL.add(Settings.Global.NTP_TIMEOUT);
3544            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_ERROR_POLL_COUNT);
3545            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_LONG_POLL_INTERVAL_MS);
3546            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT);
3547            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_POLL_INTERVAL_MS);
3548            MOVED_TO_GLOBAL.add(Settings.Global.PDP_WATCHDOG_TRIGGER_PACKET_COUNT);
3549            MOVED_TO_GLOBAL.add(Settings.Global.SAMPLING_PROFILER_MS);
3550            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DATA_SERVICE_URL);
3551            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_REDIR_HOST);
3552            MOVED_TO_GLOBAL.add(Settings.Global.SETUP_PREPAID_DETECTION_TARGET_URL);
3553            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_APN);
3554            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_DUN_REQUIRED);
3555            MOVED_TO_GLOBAL.add(Settings.Global.TETHER_SUPPORTED);
3556            MOVED_TO_GLOBAL.add(Settings.Global.USB_MASS_STORAGE_ENABLED);
3557            MOVED_TO_GLOBAL.add(Settings.Global.USE_GOOGLE_MAIL);
3558            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_COUNTRY_CODE);
3559            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS);
3560            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_FREQUENCY_BAND);
3561            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_IDLE_MS);
3562            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MAX_DHCP_RETRY_COUNT);
3563            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS);
3564            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
3565            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
3566            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NUM_OPEN_NETWORKS_KEPT);
3567            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ON);
3568            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_P2P_DEVICE_NAME);
3569            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SAVED_STATE);
3570            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUPPLICANT_SCAN_INTERVAL_MS);
3571            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_SUSPEND_OPTIMIZATIONS_ENABLED);
3572            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_ENHANCED_AUTO_JOIN);
3573            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_NETWORK_SHOW_RSSI);
3574            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_ON);
3575            MOVED_TO_GLOBAL.add(Settings.Global.WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED);
3576            MOVED_TO_GLOBAL.add(Settings.Global.WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON);
3577            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_ENABLE);
3578            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_TIMEOUT);
3579            MOVED_TO_GLOBAL.add(Settings.Global.PACKAGE_VERIFIER_DEFAULT_RESPONSE);
3580            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS);
3581            MOVED_TO_GLOBAL.add(Settings.Global.DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS);
3582            MOVED_TO_GLOBAL.add(Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS);
3583            MOVED_TO_GLOBAL.add(Settings.Global.WTF_IS_FATAL);
3584            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_DURATION_THRESHOLD);
3585            MOVED_TO_GLOBAL.add(Settings.Global.BATTERY_DISCHARGE_THRESHOLD);
3586            MOVED_TO_GLOBAL.add(Settings.Global.SEND_ACTION_APP_ERROR);
3587            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_AGE_SECONDS);
3588            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_MAX_FILES);
3589            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_KB);
3590            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_QUOTA_PERCENT);
3591            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_RESERVE_PERCENT);
3592            MOVED_TO_GLOBAL.add(Settings.Global.DROPBOX_TAG_PREFIX);
3593            MOVED_TO_GLOBAL.add(Settings.Global.ERROR_LOGCAT_PREFIX);
3594            MOVED_TO_GLOBAL.add(Settings.Global.SYS_FREE_STORAGE_LOG_INTERVAL);
3595            MOVED_TO_GLOBAL.add(Settings.Global.DISK_FREE_CHANGE_REPORTING_THRESHOLD);
3596            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE);
3597            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES);
3598            MOVED_TO_GLOBAL.add(Settings.Global.SYS_STORAGE_FULL_THRESHOLD_BYTES);
3599            MOVED_TO_GLOBAL.add(Settings.Global.SYNC_MAX_RETRY_DELAY_IN_SECONDS);
3600            MOVED_TO_GLOBAL.add(Settings.Global.CONNECTIVITY_CHANGE_DELAY);
3601            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_DETECTION_ENABLED);
3602            MOVED_TO_GLOBAL.add(Settings.Global.CAPTIVE_PORTAL_SERVER);
3603            MOVED_TO_GLOBAL.add(Settings.Global.NSD_ON);
3604            MOVED_TO_GLOBAL.add(Settings.Global.SET_INSTALL_LOCATION);
3605            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_INSTALL_LOCATION);
3606            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_UP_DELAY);
3607            MOVED_TO_GLOBAL.add(Settings.Global.INET_CONDITION_DEBOUNCE_DOWN_DELAY);
3608            MOVED_TO_GLOBAL.add(Settings.Global.READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT);
3609            MOVED_TO_GLOBAL.add(Settings.Global.HTTP_PROXY);
3610            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_HOST);
3611            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_PORT);
3612            MOVED_TO_GLOBAL.add(Settings.Global.GLOBAL_HTTP_PROXY_EXCLUSION_LIST);
3613            MOVED_TO_GLOBAL.add(Settings.Global.SET_GLOBAL_HTTP_PROXY);
3614            MOVED_TO_GLOBAL.add(Settings.Global.DEFAULT_DNS_SERVER);
3615            MOVED_TO_GLOBAL.add(Settings.Global.PREFERRED_NETWORK_MODE);
3616            MOVED_TO_GLOBAL.add(Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY);
3617        }
3618
3619        /** @hide */
3620        public static void getMovedToGlobalSettings(Set<String> outKeySet) {
3621            outKeySet.addAll(MOVED_TO_GLOBAL);
3622        }
3623
3624        /**
3625         * Look up a name in the database.
3626         * @param resolver to access the database with
3627         * @param name to look up in the table
3628         * @return the corresponding value, or null if not present
3629         */
3630        public static String getString(ContentResolver resolver, String name) {
3631            return getStringForUser(resolver, name, UserHandle.myUserId());
3632        }
3633
3634        /** @hide */
3635        public static String getStringForUser(ContentResolver resolver, String name,
3636                int userHandle) {
3637            if (MOVED_TO_GLOBAL.contains(name)) {
3638                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
3639                        + " to android.provider.Settings.Global.");
3640                return Global.getStringForUser(resolver, name, userHandle);
3641            }
3642
3643            if (MOVED_TO_LOCK_SETTINGS.contains(name)) {
3644                synchronized (Secure.class) {
3645                    if (sLockSettings == null) {
3646                        sLockSettings = ILockSettings.Stub.asInterface(
3647                                (IBinder) ServiceManager.getService("lock_settings"));
3648                        sIsSystemProcess = Process.myUid() == Process.SYSTEM_UID;
3649                    }
3650                }
3651                if (sLockSettings != null && !sIsSystemProcess) {
3652                    try {
3653                        return sLockSettings.getString(name, "0", userHandle);
3654                    } catch (RemoteException re) {
3655                        // Fall through
3656                    }
3657                }
3658            }
3659
3660            return sNameValueCache.getStringForUser(resolver, name, userHandle);
3661        }
3662
3663        /**
3664         * Store a name/value pair into the database.
3665         * @param resolver to access the database with
3666         * @param name to store
3667         * @param value to associate with the name
3668         * @return true if the value was set, false on database errors
3669         */
3670        public static boolean putString(ContentResolver resolver, String name, String value) {
3671            return putStringForUser(resolver, name, value, UserHandle.myUserId());
3672        }
3673
3674        /** @hide */
3675        public static boolean putStringForUser(ContentResolver resolver, String name, String value,
3676                int userHandle) {
3677            if (LOCATION_MODE.equals(name)) {
3678                // HACK ALERT: temporary hack to work around b/10491283.
3679                // TODO: once b/10491283 fixed, remove this hack
3680                return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle);
3681            }
3682            if (MOVED_TO_GLOBAL.contains(name)) {
3683                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
3684                        + " to android.provider.Settings.Global");
3685                return Global.putStringForUser(resolver, name, value, userHandle);
3686            }
3687            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
3688        }
3689
3690        /**
3691         * Construct the content URI for a particular name/value pair,
3692         * useful for monitoring changes with a ContentObserver.
3693         * @param name to look up in the table
3694         * @return the corresponding content URI, or null if not present
3695         */
3696        public static Uri getUriFor(String name) {
3697            if (MOVED_TO_GLOBAL.contains(name)) {
3698                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure"
3699                        + " to android.provider.Settings.Global, returning global URI.");
3700                return Global.getUriFor(Global.CONTENT_URI, name);
3701            }
3702            return getUriFor(CONTENT_URI, name);
3703        }
3704
3705        /**
3706         * Convenience function for retrieving a single secure settings value
3707         * as an integer.  Note that internally setting values are always
3708         * stored as strings; this function converts the string to an integer
3709         * for you.  The default value will be returned if the setting is
3710         * not defined or not an integer.
3711         *
3712         * @param cr The ContentResolver to access.
3713         * @param name The name of the setting to retrieve.
3714         * @param def Value to return if the setting is not defined.
3715         *
3716         * @return The setting's current value, or 'def' if it is not defined
3717         * or not a valid integer.
3718         */
3719        public static int getInt(ContentResolver cr, String name, int def) {
3720            return getIntForUser(cr, name, def, UserHandle.myUserId());
3721        }
3722
3723        /** @hide */
3724        public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) {
3725            if (LOCATION_MODE.equals(name)) {
3726                // HACK ALERT: temporary hack to work around b/10491283.
3727                // TODO: once b/10491283 fixed, remove this hack
3728                return getLocationModeForUser(cr, userHandle);
3729            }
3730            String v = getStringForUser(cr, name, userHandle);
3731            try {
3732                return v != null ? Integer.parseInt(v) : def;
3733            } catch (NumberFormatException e) {
3734                return def;
3735            }
3736        }
3737
3738        /**
3739         * Convenience function for retrieving a single secure settings value
3740         * as an integer.  Note that internally setting values are always
3741         * stored as strings; this function converts the string to an integer
3742         * for you.
3743         * <p>
3744         * This version does not take a default value.  If the setting has not
3745         * been set, or the string value is not a number,
3746         * it throws {@link SettingNotFoundException}.
3747         *
3748         * @param cr The ContentResolver to access.
3749         * @param name The name of the setting to retrieve.
3750         *
3751         * @throws SettingNotFoundException Thrown if a setting by the given
3752         * name can't be found or the setting value is not an integer.
3753         *
3754         * @return The setting's current value.
3755         */
3756        public static int getInt(ContentResolver cr, String name)
3757                throws SettingNotFoundException {
3758            return getIntForUser(cr, name, UserHandle.myUserId());
3759        }
3760
3761        /** @hide */
3762        public static int getIntForUser(ContentResolver cr, String name, int userHandle)
3763                throws SettingNotFoundException {
3764            if (LOCATION_MODE.equals(name)) {
3765                // HACK ALERT: temporary hack to work around b/10491283.
3766                // TODO: once b/10491283 fixed, remove this hack
3767                return getLocationModeForUser(cr, userHandle);
3768            }
3769            String v = getStringForUser(cr, name, userHandle);
3770            try {
3771                return Integer.parseInt(v);
3772            } catch (NumberFormatException e) {
3773                throw new SettingNotFoundException(name);
3774            }
3775        }
3776
3777        /**
3778         * Convenience function for updating a single settings value as an
3779         * integer. This will either create a new entry in the table if the
3780         * given name does not exist, or modify the value of the existing row
3781         * with that name.  Note that internally setting values are always
3782         * stored as strings, so this function converts the given value to a
3783         * string before storing it.
3784         *
3785         * @param cr The ContentResolver to access.
3786         * @param name The name of the setting to modify.
3787         * @param value The new value for the setting.
3788         * @return true if the value was set, false on database errors
3789         */
3790        public static boolean putInt(ContentResolver cr, String name, int value) {
3791            return putIntForUser(cr, name, value, UserHandle.myUserId());
3792        }
3793
3794        /** @hide */
3795        public static boolean putIntForUser(ContentResolver cr, String name, int value,
3796                int userHandle) {
3797            return putStringForUser(cr, name, Integer.toString(value), userHandle);
3798        }
3799
3800        /**
3801         * Convenience function for retrieving a single secure settings value
3802         * as a {@code long}.  Note that internally setting values are always
3803         * stored as strings; this function converts the string to a {@code long}
3804         * for you.  The default value will be returned if the setting is
3805         * not defined or not a {@code long}.
3806         *
3807         * @param cr The ContentResolver to access.
3808         * @param name The name of the setting to retrieve.
3809         * @param def Value to return if the setting is not defined.
3810         *
3811         * @return The setting's current value, or 'def' if it is not defined
3812         * or not a valid {@code long}.
3813         */
3814        public static long getLong(ContentResolver cr, String name, long def) {
3815            return getLongForUser(cr, name, def, UserHandle.myUserId());
3816        }
3817
3818        /** @hide */
3819        public static long getLongForUser(ContentResolver cr, String name, long def,
3820                int userHandle) {
3821            String valString = getStringForUser(cr, name, userHandle);
3822            long value;
3823            try {
3824                value = valString != null ? Long.parseLong(valString) : def;
3825            } catch (NumberFormatException e) {
3826                value = def;
3827            }
3828            return value;
3829        }
3830
3831        /**
3832         * Convenience function for retrieving a single secure settings value
3833         * as a {@code long}.  Note that internally setting values are always
3834         * stored as strings; this function converts the string to a {@code long}
3835         * for you.
3836         * <p>
3837         * This version does not take a default value.  If the setting has not
3838         * been set, or the string value is not a number,
3839         * it throws {@link SettingNotFoundException}.
3840         *
3841         * @param cr The ContentResolver to access.
3842         * @param name The name of the setting to retrieve.
3843         *
3844         * @return The setting's current value.
3845         * @throws SettingNotFoundException Thrown if a setting by the given
3846         * name can't be found or the setting value is not an integer.
3847         */
3848        public static long getLong(ContentResolver cr, String name)
3849                throws SettingNotFoundException {
3850            return getLongForUser(cr, name, UserHandle.myUserId());
3851        }
3852
3853        /** @hide */
3854        public static long getLongForUser(ContentResolver cr, String name, int userHandle)
3855                throws SettingNotFoundException {
3856            String valString = getStringForUser(cr, name, userHandle);
3857            try {
3858                return Long.parseLong(valString);
3859            } catch (NumberFormatException e) {
3860                throw new SettingNotFoundException(name);
3861            }
3862        }
3863
3864        /**
3865         * Convenience function for updating a secure settings value as a long
3866         * integer. This will either create a new entry in the table if the
3867         * given name does not exist, or modify the value of the existing row
3868         * with that name.  Note that internally setting values are always
3869         * stored as strings, so this function converts the given value to a
3870         * string before storing it.
3871         *
3872         * @param cr The ContentResolver to access.
3873         * @param name The name of the setting to modify.
3874         * @param value The new value for the setting.
3875         * @return true if the value was set, false on database errors
3876         */
3877        public static boolean putLong(ContentResolver cr, String name, long value) {
3878            return putLongForUser(cr, name, value, UserHandle.myUserId());
3879        }
3880
3881        /** @hide */
3882        public static boolean putLongForUser(ContentResolver cr, String name, long value,
3883                int userHandle) {
3884            return putStringForUser(cr, name, Long.toString(value), userHandle);
3885        }
3886
3887        /**
3888         * Convenience function for retrieving a single secure settings value
3889         * as a floating point number.  Note that internally setting values are
3890         * always stored as strings; this function converts the string to an
3891         * float for you. The default value will be returned if the setting
3892         * is not defined or not a valid float.
3893         *
3894         * @param cr The ContentResolver to access.
3895         * @param name The name of the setting to retrieve.
3896         * @param def Value to return if the setting is not defined.
3897         *
3898         * @return The setting's current value, or 'def' if it is not defined
3899         * or not a valid float.
3900         */
3901        public static float getFloat(ContentResolver cr, String name, float def) {
3902            return getFloatForUser(cr, name, def, UserHandle.myUserId());
3903        }
3904
3905        /** @hide */
3906        public static float getFloatForUser(ContentResolver cr, String name, float def,
3907                int userHandle) {
3908            String v = getStringForUser(cr, name, userHandle);
3909            try {
3910                return v != null ? Float.parseFloat(v) : def;
3911            } catch (NumberFormatException e) {
3912                return def;
3913            }
3914        }
3915
3916        /**
3917         * Convenience function for retrieving a single secure settings value
3918         * as a float.  Note that internally setting values are always
3919         * stored as strings; this function converts the string to a float
3920         * for you.
3921         * <p>
3922         * This version does not take a default value.  If the setting has not
3923         * been set, or the string value is not a number,
3924         * it throws {@link SettingNotFoundException}.
3925         *
3926         * @param cr The ContentResolver to access.
3927         * @param name The name of the setting to retrieve.
3928         *
3929         * @throws SettingNotFoundException Thrown if a setting by the given
3930         * name can't be found or the setting value is not a float.
3931         *
3932         * @return The setting's current value.
3933         */
3934        public static float getFloat(ContentResolver cr, String name)
3935                throws SettingNotFoundException {
3936            return getFloatForUser(cr, name, UserHandle.myUserId());
3937        }
3938
3939        /** @hide */
3940        public static float getFloatForUser(ContentResolver cr, String name, int userHandle)
3941                throws SettingNotFoundException {
3942            String v = getStringForUser(cr, name, userHandle);
3943            if (v == null) {
3944                throw new SettingNotFoundException(name);
3945            }
3946            try {
3947                return Float.parseFloat(v);
3948            } catch (NumberFormatException e) {
3949                throw new SettingNotFoundException(name);
3950            }
3951        }
3952
3953        /**
3954         * Convenience function for updating a single settings value as a
3955         * floating point number. This will either create a new entry in the
3956         * table if the given name does not exist, or modify the value of the
3957         * existing row with that name.  Note that internally setting values
3958         * are always stored as strings, so this function converts the given
3959         * value to a string before storing it.
3960         *
3961         * @param cr The ContentResolver to access.
3962         * @param name The name of the setting to modify.
3963         * @param value The new value for the setting.
3964         * @return true if the value was set, false on database errors
3965         */
3966        public static boolean putFloat(ContentResolver cr, String name, float value) {
3967            return putFloatForUser(cr, name, value, UserHandle.myUserId());
3968        }
3969
3970        /** @hide */
3971        public static boolean putFloatForUser(ContentResolver cr, String name, float value,
3972                int userHandle) {
3973            return putStringForUser(cr, name, Float.toString(value), userHandle);
3974        }
3975
3976        /**
3977         * @deprecated Use {@link android.provider.Settings.Global#DEVELOPMENT_SETTINGS_ENABLED}
3978         * instead
3979         */
3980        @Deprecated
3981        public static final String DEVELOPMENT_SETTINGS_ENABLED =
3982                Global.DEVELOPMENT_SETTINGS_ENABLED;
3983
3984        /**
3985         * When the user has enable the option to have a "bug report" command
3986         * in the power menu.
3987         * @deprecated Use {@link android.provider.Settings.Global#BUGREPORT_IN_POWER_MENU} instead
3988         * @hide
3989         */
3990        @Deprecated
3991        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
3992
3993        /**
3994         * @deprecated Use {@link android.provider.Settings.Global#ADB_ENABLED} instead
3995         */
3996        @Deprecated
3997        public static final String ADB_ENABLED = Global.ADB_ENABLED;
3998
3999        /**
4000         * Setting to allow mock locations and location provider status to be injected into the
4001         * LocationManager service for testing purposes during application development.  These
4002         * locations and status values  override actual location and status information generated
4003         * by network, gps, or other location providers.
4004         */
4005        public static final String ALLOW_MOCK_LOCATION = "mock_location";
4006
4007        /**
4008         * A 64-bit number (as a hex string) that is randomly
4009         * generated when the user first sets up the device and should remain
4010         * constant for the lifetime of the user's device. The value may
4011         * change if a factory reset is performed on the device.
4012         * <p class="note"><strong>Note:</strong> When a device has <a
4013         * href="{@docRoot}about/versions/android-4.2.html#MultipleUsers">multiple users</a>
4014         * (available on certain devices running Android 4.2 or higher), each user appears as a
4015         * completely separate device, so the {@code ANDROID_ID} value is unique to each
4016         * user.</p>
4017         */
4018        public static final String ANDROID_ID = "android_id";
4019
4020        /**
4021         * @deprecated Use {@link android.provider.Settings.Global#BLUETOOTH_ON} instead
4022         */
4023        @Deprecated
4024        public static final String BLUETOOTH_ON = Global.BLUETOOTH_ON;
4025
4026        /**
4027         * @deprecated Use {@link android.provider.Settings.Global#DATA_ROAMING} instead
4028         */
4029        @Deprecated
4030        public static final String DATA_ROAMING = Global.DATA_ROAMING;
4031
4032        /**
4033         * Setting to record the input method used by default, holding the ID
4034         * of the desired method.
4035         */
4036        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
4037
4038        /**
4039         * Setting to record the input method subtype used by default, holding the ID
4040         * of the desired method.
4041         */
4042        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
4043                "selected_input_method_subtype";
4044
4045        /**
4046         * Setting to record the history of input method subtype, holding the pair of ID of IME
4047         * and its last used subtype.
4048         * @hide
4049         */
4050        public static final String INPUT_METHODS_SUBTYPE_HISTORY =
4051                "input_methods_subtype_history";
4052
4053        /**
4054         * Setting to record the visibility of input method selector
4055         */
4056        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
4057                "input_method_selector_visibility";
4058
4059        /**
4060         * The currently selected voice interaction service flattened ComponentName.
4061         * @hide
4062         */
4063        public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
4064
4065        /**
4066         * bluetooth HCI snoop log configuration
4067         * @hide
4068         */
4069        public static final String BLUETOOTH_HCI_LOG =
4070                "bluetooth_hci_log";
4071
4072        /**
4073         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
4074         */
4075        @Deprecated
4076        public static final String DEVICE_PROVISIONED = Global.DEVICE_PROVISIONED;
4077
4078        /**
4079         * Whether the current user has been set up via setup wizard (0 = false, 1 = true)
4080         * @hide
4081         */
4082        public static final String USER_SETUP_COMPLETE = "user_setup_complete";
4083
4084        /**
4085         * List of input methods that are currently enabled.  This is a string
4086         * containing the IDs of all enabled input methods, each ID separated
4087         * by ':'.
4088         */
4089        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
4090
4091        /**
4092         * List of system input methods that are currently disabled.  This is a string
4093         * containing the IDs of all disabled input methods, each ID separated
4094         * by ':'.
4095         * @hide
4096         */
4097        public static final String DISABLED_SYSTEM_INPUT_METHODS = "disabled_system_input_methods";
4098
4099        /**
4100         * Whether to show the IME when a hard keyboard is connected. This is a boolean that
4101         * determines if the IME should be shown when a hard keyboard is attached.
4102         * @hide
4103         */
4104        public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
4105
4106        /**
4107         * Host name and port for global http proxy. Uses ':' seperator for
4108         * between host and port.
4109         *
4110         * @deprecated Use {@link Global#HTTP_PROXY}
4111         */
4112        @Deprecated
4113        public static final String HTTP_PROXY = Global.HTTP_PROXY;
4114
4115        /**
4116         * Whether applications can be installed for this user via the system's
4117         * {@link Intent#ACTION_INSTALL_PACKAGE} mechanism.
4118         *
4119         * <p>1 = permit app installation via the system package installer intent
4120         * <p>0 = do not allow use of the package installer
4121         */
4122        public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
4123
4124        /**
4125         * Comma-separated list of location providers that activities may access. Do not rely on
4126         * this value being present in settings.db or on ContentObserver notifications on the
4127         * corresponding Uri.
4128         *
4129         * @deprecated use {@link #LOCATION_MODE} and
4130         * {@link LocationManager#MODE_CHANGED_ACTION} (or
4131         * {@link LocationManager#PROVIDERS_CHANGED_ACTION})
4132         */
4133        @Deprecated
4134        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
4135
4136        /**
4137         * The degree of location access enabled by the user.
4138         * <p>
4139         * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link
4140         * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link
4141         * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link
4142         * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location
4143         * modes that might be added in the future.
4144         * <p>
4145         * Note: do not rely on this value being present in settings.db or on ContentObserver
4146         * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION}
4147         * to receive changes in this value.
4148         */
4149        public static final String LOCATION_MODE = "location_mode";
4150
4151        /**
4152         * Location access disabled.
4153         */
4154        public static final int LOCATION_MODE_OFF = 0;
4155        /**
4156         * Network Location Provider disabled, but GPS and other sensors enabled.
4157         */
4158        public static final int LOCATION_MODE_SENSORS_ONLY = 1;
4159        /**
4160         * Reduced power usage, such as limiting the number of GPS updates per hour. Requests
4161         * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to
4162         * {@link android.location.Criteria#POWER_MEDIUM}.
4163         */
4164        public static final int LOCATION_MODE_BATTERY_SAVING = 2;
4165        /**
4166         * Best-effort location computation allowed.
4167         */
4168        public static final int LOCATION_MODE_HIGH_ACCURACY = 3;
4169
4170        /**
4171         * A flag containing settings used for biometric weak
4172         * @hide
4173         */
4174        @Deprecated
4175        public static final String LOCK_BIOMETRIC_WEAK_FLAGS =
4176                "lock_biometric_weak_flags";
4177
4178        /**
4179         * Whether lock-to-app will lock the keyguard when exiting.
4180         * @hide
4181         */
4182        public static final String LOCK_TO_APP_EXIT_LOCKED = "lock_to_app_exit_locked";
4183
4184        /**
4185         * Whether autolock is enabled (0 = false, 1 = true)
4186         *
4187         * @deprecated Use {@link android.app.KeyguardManager} to determine the state and security
4188         *             level of the keyguard.
4189         */
4190        @Deprecated
4191        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
4192
4193        /**
4194         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
4195         */
4196        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
4197
4198        /**
4199         * Whether lock pattern will vibrate as user enters (0 = false, 1 =
4200         * true)
4201         *
4202         * @deprecated Starting in {@link VERSION_CODES#JELLY_BEAN_MR1} the
4203         *             lockscreen uses
4204         *             {@link Settings.System#HAPTIC_FEEDBACK_ENABLED}.
4205         */
4206        @Deprecated
4207        public static final String
4208                LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
4209
4210        /**
4211         * This preference allows the device to be locked given time after screen goes off,
4212         * subject to current DeviceAdmin policy limits.
4213         * @hide
4214         */
4215        public static final String LOCK_SCREEN_LOCK_AFTER_TIMEOUT = "lock_screen_lock_after_timeout";
4216
4217
4218        /**
4219         * This preference contains the string that shows for owner info on LockScreen.
4220         * @hide
4221         * @deprecated
4222         */
4223        public static final String LOCK_SCREEN_OWNER_INFO = "lock_screen_owner_info";
4224
4225        /**
4226         * Ids of the user-selected appwidgets on the lockscreen (comma-delimited).
4227         * @hide
4228         */
4229        @Deprecated
4230        public static final String LOCK_SCREEN_APPWIDGET_IDS =
4231            "lock_screen_appwidget_ids";
4232
4233        /**
4234         * List of enrolled fingerprint identifiers (comma-delimited).
4235         * @hide
4236         */
4237        public static final String USER_FINGERPRINT_IDS = "user_fingerprint_ids";
4238
4239        /**
4240         * Id of the appwidget shown on the lock screen when appwidgets are disabled.
4241         * @hide
4242         */
4243        @Deprecated
4244        public static final String LOCK_SCREEN_FALLBACK_APPWIDGET_ID =
4245            "lock_screen_fallback_appwidget_id";
4246
4247        /**
4248         * Index of the lockscreen appwidget to restore, -1 if none.
4249         * @hide
4250         */
4251        @Deprecated
4252        public static final String LOCK_SCREEN_STICKY_APPWIDGET =
4253            "lock_screen_sticky_appwidget";
4254
4255        /**
4256         * This preference enables showing the owner info on LockScreen.
4257         * @hide
4258         * @deprecated
4259         */
4260        public static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
4261            "lock_screen_owner_info_enabled";
4262
4263        /**
4264         * When set by a user, allows notifications to be shown atop a securely locked screen
4265         * in their full "private" form (same as when the device is unlocked).
4266         * @hide
4267         */
4268        public static final String LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS =
4269                "lock_screen_allow_private_notifications";
4270
4271        /**
4272         * Set by the system to track if the user needs to see the call to action for
4273         * the lockscreen notification policy.
4274         * @hide
4275         */
4276        public static final String SHOW_NOTE_ABOUT_NOTIFICATION_HIDING =
4277                "show_note_about_notification_hiding";
4278
4279        /**
4280         * Set to 1 by the system after trust agents have been initialized.
4281         * @hide
4282         */
4283        public static final String TRUST_AGENTS_INITIALIZED =
4284                "trust_agents_initialized";
4285
4286        /**
4287         * The Logging ID (a unique 64-bit value) as a hex string.
4288         * Used as a pseudonymous identifier for logging.
4289         * @deprecated This identifier is poorly initialized and has
4290         * many collisions.  It should not be used.
4291         */
4292        @Deprecated
4293        public static final String LOGGING_ID = "logging_id";
4294
4295        /**
4296         * @deprecated Use {@link android.provider.Settings.Global#NETWORK_PREFERENCE} instead
4297         */
4298        @Deprecated
4299        public static final String NETWORK_PREFERENCE = Global.NETWORK_PREFERENCE;
4300
4301        /**
4302         * No longer supported.
4303         */
4304        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
4305
4306        /**
4307         * No longer supported.
4308         */
4309        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
4310
4311        /**
4312         * No longer supported.
4313         */
4314        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
4315
4316        /**
4317         * Settings classname to launch when Settings is clicked from All
4318         * Applications.  Needed because of user testing between the old
4319         * and new Settings apps.
4320         */
4321        // TODO: 881807
4322        public static final String SETTINGS_CLASSNAME = "settings_classname";
4323
4324        /**
4325         * @deprecated Use {@link android.provider.Settings.Global#USB_MASS_STORAGE_ENABLED} instead
4326         */
4327        @Deprecated
4328        public static final String USB_MASS_STORAGE_ENABLED = Global.USB_MASS_STORAGE_ENABLED;
4329
4330        /**
4331         * @deprecated Use {@link android.provider.Settings.Global#USE_GOOGLE_MAIL} instead
4332         */
4333        @Deprecated
4334        public static final String USE_GOOGLE_MAIL = Global.USE_GOOGLE_MAIL;
4335
4336        /**
4337         * If accessibility is enabled.
4338         */
4339        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
4340
4341        /**
4342         * If touch exploration is enabled.
4343         */
4344        public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
4345
4346        /**
4347         * List of the enabled accessibility providers.
4348         */
4349        public static final String ENABLED_ACCESSIBILITY_SERVICES =
4350            "enabled_accessibility_services";
4351
4352        /**
4353         * List of the accessibility services to which the user has granted
4354         * permission to put the device into touch exploration mode.
4355         *
4356         * @hide
4357         */
4358        public static final String TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES =
4359            "touch_exploration_granted_accessibility_services";
4360
4361        /**
4362         * Whether to speak passwords while in accessibility mode.
4363         */
4364        public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
4365
4366        /**
4367         * Whether to draw text with high contrast while in accessibility mode.
4368         *
4369         * @hide
4370         */
4371        public static final String ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED =
4372                "high_text_contrast_enabled";
4373
4374        /**
4375         * If injection of accessibility enhancing JavaScript screen-reader
4376         * is enabled.
4377         * <p>
4378         *   Note: The JavaScript based screen-reader is served by the
4379         *   Google infrastructure and enable users with disabilities to
4380         *   efficiently navigate in and explore web content.
4381         * </p>
4382         * <p>
4383         *   This property represents a boolean value.
4384         * </p>
4385         * @hide
4386         */
4387        public static final String ACCESSIBILITY_SCRIPT_INJECTION =
4388            "accessibility_script_injection";
4389
4390        /**
4391         * The URL for the injected JavaScript based screen-reader used
4392         * for providing accessibility of content in WebView.
4393         * <p>
4394         *   Note: The JavaScript based screen-reader is served by the
4395         *   Google infrastructure and enable users with disabilities to
4396         *   efficiently navigate in and explore web content.
4397         * </p>
4398         * <p>
4399         *   This property represents a string value.
4400         * </p>
4401         * @hide
4402         */
4403        public static final String ACCESSIBILITY_SCREEN_READER_URL =
4404            "accessibility_script_injection_url";
4405
4406        /**
4407         * Key bindings for navigation in built-in accessibility support for web content.
4408         * <p>
4409         *   Note: These key bindings are for the built-in accessibility navigation for
4410         *   web content which is used as a fall back solution if JavaScript in a WebView
4411         *   is not enabled or the user has not opted-in script injection from Google.
4412         * </p>
4413         * <p>
4414         *   The bindings are separated by semi-colon. A binding is a mapping from
4415         *   a key to a sequence of actions (for more details look at
4416         *   android.webkit.AccessibilityInjector). A key is represented as the hexademical
4417         *   string representation of an integer obtained from a meta state (optional) shifted
4418         *   sixteen times left and bitwise ored with a key code. An action is represented
4419         *   as a hexademical string representation of an integer where the first two digits
4420         *   are navigation action index, the second, the third, and the fourth digit pairs
4421         *   represent the action arguments. The separate actions in a binding are colon
4422         *   separated. The key and the action sequence it maps to are separated by equals.
4423         * </p>
4424         * <p>
4425         *   For example, the binding below maps the DPAD right button to traverse the
4426         *   current navigation axis once without firing an accessibility event and to
4427         *   perform the same traversal again but to fire an event:
4428         *   <code>
4429         *     0x16=0x01000100:0x01000101;
4430         *   </code>
4431         * </p>
4432         * <p>
4433         *   The goal of this binding is to enable dynamic rebinding of keys to
4434         *   navigation actions for web content without requiring a framework change.
4435         * </p>
4436         * <p>
4437         *   This property represents a string value.
4438         * </p>
4439         * @hide
4440         */
4441        public static final String ACCESSIBILITY_WEB_CONTENT_KEY_BINDINGS =
4442            "accessibility_web_content_key_bindings";
4443
4444        /**
4445         * Setting that specifies whether the display magnification is enabled.
4446         * Display magnifications allows the user to zoom in the display content
4447         * and is targeted to low vision users. The current magnification scale
4448         * is controlled by {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE}.
4449         *
4450         * @hide
4451         */
4452        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED =
4453                "accessibility_display_magnification_enabled";
4454
4455        /**
4456         * Setting that specifies what the display magnification scale is.
4457         * Display magnifications allows the user to zoom in the display
4458         * content and is targeted to low vision users. Whether a display
4459         * magnification is performed is controlled by
4460         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
4461         *
4462         * @hide
4463         */
4464        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE =
4465                "accessibility_display_magnification_scale";
4466
4467        /**
4468         * Setting that specifies whether the display magnification should be
4469         * automatically updated. If this fearture is enabled the system will
4470         * exit magnification mode or pan the viewport when a context change
4471         * occurs. For example, on staring a new activity or rotating the screen,
4472         * the system may zoom out so the user can see the new context he is in.
4473         * Another example is on showing a window that is not visible in the
4474         * magnified viewport the system may pan the viewport to make the window
4475         * the has popped up so the user knows that the context has changed.
4476         * Whether a screen magnification is performed is controlled by
4477         * {@link #ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED}
4478         *
4479         * @hide
4480         */
4481        public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE =
4482                "accessibility_display_magnification_auto_update";
4483
4484        /**
4485         * Setting that specifies whether timed text (captions) should be
4486         * displayed in video content. Text display properties are controlled by
4487         * the following settings:
4488         * <ul>
4489         * <li>{@link #ACCESSIBILITY_CAPTIONING_LOCALE}
4490         * <li>{@link #ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR}
4491         * <li>{@link #ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR}
4492         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_COLOR}
4493         * <li>{@link #ACCESSIBILITY_CAPTIONING_EDGE_TYPE}
4494         * <li>{@link #ACCESSIBILITY_CAPTIONING_TYPEFACE}
4495         * <li>{@link #ACCESSIBILITY_CAPTIONING_FONT_SCALE}
4496         * </ul>
4497         *
4498         * @hide
4499         */
4500        public static final String ACCESSIBILITY_CAPTIONING_ENABLED =
4501                "accessibility_captioning_enabled";
4502
4503        /**
4504         * Setting that specifies the language for captions as a locale string,
4505         * e.g. en_US.
4506         *
4507         * @see java.util.Locale#toString
4508         * @hide
4509         */
4510        public static final String ACCESSIBILITY_CAPTIONING_LOCALE =
4511                "accessibility_captioning_locale";
4512
4513        /**
4514         * Integer property that specifies the preset style for captions, one
4515         * of:
4516         * <ul>
4517         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESET_CUSTOM}
4518         * <li>a valid index of {@link android.view.accessibility.CaptioningManager.CaptionStyle#PRESETS}
4519         * </ul>
4520         *
4521         * @see java.util.Locale#toString
4522         * @hide
4523         */
4524        public static final String ACCESSIBILITY_CAPTIONING_PRESET =
4525                "accessibility_captioning_preset";
4526
4527        /**
4528         * Integer property that specifes the background color for captions as a
4529         * packed 32-bit color.
4530         *
4531         * @see android.graphics.Color#argb
4532         * @hide
4533         */
4534        public static final String ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR =
4535                "accessibility_captioning_background_color";
4536
4537        /**
4538         * Integer property that specifes the foreground color for captions as a
4539         * packed 32-bit color.
4540         *
4541         * @see android.graphics.Color#argb
4542         * @hide
4543         */
4544        public static final String ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR =
4545                "accessibility_captioning_foreground_color";
4546
4547        /**
4548         * Integer property that specifes the edge type for captions, one of:
4549         * <ul>
4550         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_NONE}
4551         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_OUTLINE}
4552         * <li>{@link android.view.accessibility.CaptioningManager.CaptionStyle#EDGE_TYPE_DROP_SHADOW}
4553         * </ul>
4554         *
4555         * @see #ACCESSIBILITY_CAPTIONING_EDGE_COLOR
4556         * @hide
4557         */
4558        public static final String ACCESSIBILITY_CAPTIONING_EDGE_TYPE =
4559                "accessibility_captioning_edge_type";
4560
4561        /**
4562         * Integer property that specifes the edge color for captions as a
4563         * packed 32-bit color.
4564         *
4565         * @see #ACCESSIBILITY_CAPTIONING_EDGE_TYPE
4566         * @see android.graphics.Color#argb
4567         * @hide
4568         */
4569        public static final String ACCESSIBILITY_CAPTIONING_EDGE_COLOR =
4570                "accessibility_captioning_edge_color";
4571
4572        /**
4573         * Integer property that specifes the window color for captions as a
4574         * packed 32-bit color.
4575         *
4576         * @see android.graphics.Color#argb
4577         * @hide
4578         */
4579        public static final String ACCESSIBILITY_CAPTIONING_WINDOW_COLOR =
4580                "accessibility_captioning_window_color";
4581
4582        /**
4583         * String property that specifies the typeface for captions, one of:
4584         * <ul>
4585         * <li>DEFAULT
4586         * <li>MONOSPACE
4587         * <li>SANS_SERIF
4588         * <li>SERIF
4589         * </ul>
4590         *
4591         * @see android.graphics.Typeface
4592         * @hide
4593         */
4594        public static final String ACCESSIBILITY_CAPTIONING_TYPEFACE =
4595                "accessibility_captioning_typeface";
4596
4597        /**
4598         * Floating point property that specifies font scaling for captions.
4599         *
4600         * @hide
4601         */
4602        public static final String ACCESSIBILITY_CAPTIONING_FONT_SCALE =
4603                "accessibility_captioning_font_scale";
4604
4605        /**
4606         * Setting that specifies whether display color inversion is enabled.
4607         */
4608        public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED =
4609                "accessibility_display_inversion_enabled";
4610
4611        /**
4612         * Setting that specifies whether display color space adjustment is
4613         * enabled.
4614         *
4615         * @hide
4616         */
4617        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED =
4618                "accessibility_display_daltonizer_enabled";
4619
4620        /**
4621         * Integer property that specifies the type of color space adjustment to
4622         * perform. Valid values are defined in AccessibilityManager.
4623         *
4624         * @hide
4625         */
4626        public static final String ACCESSIBILITY_DISPLAY_DALTONIZER =
4627                "accessibility_display_daltonizer";
4628
4629        /**
4630         * The timout for considering a press to be a long press in milliseconds.
4631         * @hide
4632         */
4633        public static final String LONG_PRESS_TIMEOUT = "long_press_timeout";
4634
4635        /**
4636         * List of the enabled print services.
4637         * @hide
4638         */
4639        public static final String ENABLED_PRINT_SERVICES =
4640            "enabled_print_services";
4641
4642        /**
4643         * List of the system print services we enabled on first boot. On
4644         * first boot we enable all system, i.e. bundled print services,
4645         * once, so they work out-of-the-box.
4646         * @hide
4647         */
4648        public static final String ENABLED_ON_FIRST_BOOT_SYSTEM_PRINT_SERVICES =
4649            "enabled_on_first_boot_system_print_services";
4650
4651        /**
4652         * Setting to always use the default text-to-speech settings regardless
4653         * of the application settings.
4654         * 1 = override application settings,
4655         * 0 = use application settings (if specified).
4656         *
4657         * @deprecated  The value of this setting is no longer respected by
4658         * the framework text to speech APIs as of the Ice Cream Sandwich release.
4659         */
4660        @Deprecated
4661        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
4662
4663        /**
4664         * Default text-to-speech engine speech rate. 100 = 1x
4665         */
4666        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
4667
4668        /**
4669         * Default text-to-speech engine pitch. 100 = 1x
4670         */
4671        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
4672
4673        /**
4674         * Default text-to-speech engine.
4675         */
4676        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
4677
4678        /**
4679         * Default text-to-speech language.
4680         *
4681         * @deprecated this setting is no longer in use, as of the Ice Cream
4682         * Sandwich release. Apps should never need to read this setting directly,
4683         * instead can query the TextToSpeech framework classes for the default
4684         * locale. {@link TextToSpeech#getLanguage()}.
4685         */
4686        @Deprecated
4687        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
4688
4689        /**
4690         * Default text-to-speech country.
4691         *
4692         * @deprecated this setting is no longer in use, as of the Ice Cream
4693         * Sandwich release. Apps should never need to read this setting directly,
4694         * instead can query the TextToSpeech framework classes for the default
4695         * locale. {@link TextToSpeech#getLanguage()}.
4696         */
4697        @Deprecated
4698        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
4699
4700        /**
4701         * Default text-to-speech locale variant.
4702         *
4703         * @deprecated this setting is no longer in use, as of the Ice Cream
4704         * Sandwich release. Apps should never need to read this setting directly,
4705         * instead can query the TextToSpeech framework classes for the
4706         * locale that is in use {@link TextToSpeech#getLanguage()}.
4707         */
4708        @Deprecated
4709        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
4710
4711        /**
4712         * Stores the default tts locales on a per engine basis. Stored as
4713         * a comma seperated list of values, each value being of the form
4714         * {@code engine_name:locale} for example,
4715         * {@code com.foo.ttsengine:eng-USA,com.bar.ttsengine:esp-ESP}. This
4716         * supersedes {@link #TTS_DEFAULT_LANG}, {@link #TTS_DEFAULT_COUNTRY} and
4717         * {@link #TTS_DEFAULT_VARIANT}. Apps should never need to read this
4718         * setting directly, and can query the TextToSpeech framework classes
4719         * for the locale that is in use.
4720         *
4721         * @hide
4722         */
4723        public static final String TTS_DEFAULT_LOCALE = "tts_default_locale";
4724
4725        /**
4726         * Space delimited list of plugin packages that are enabled.
4727         */
4728        public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
4729
4730        /**
4731         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON}
4732         * instead.
4733         */
4734        @Deprecated
4735        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
4736                Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
4737
4738        /**
4739         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY}
4740         * instead.
4741         */
4742        @Deprecated
4743        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
4744                Global.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
4745
4746        /**
4747         * @deprecated Use {@link android.provider.Settings.Global#WIFI_NUM_OPEN_NETWORKS_KEPT}
4748         * instead.
4749         */
4750        @Deprecated
4751        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT =
4752                Global.WIFI_NUM_OPEN_NETWORKS_KEPT;
4753
4754        /**
4755         * @deprecated Use {@link android.provider.Settings.Global#WIFI_ON}
4756         * instead.
4757         */
4758        @Deprecated
4759        public static final String WIFI_ON = Global.WIFI_ON;
4760
4761        /**
4762         * The acceptable packet loss percentage (range 0 - 100) before trying
4763         * another AP on the same network.
4764         * @deprecated This setting is not used.
4765         */
4766        @Deprecated
4767        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
4768                "wifi_watchdog_acceptable_packet_loss_percentage";
4769
4770        /**
4771         * The number of access points required for a network in order for the
4772         * watchdog to monitor it.
4773         * @deprecated This setting is not used.
4774         */
4775        @Deprecated
4776        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
4777
4778        /**
4779         * The delay between background checks.
4780         * @deprecated This setting is not used.
4781         */
4782        @Deprecated
4783        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
4784                "wifi_watchdog_background_check_delay_ms";
4785
4786        /**
4787         * Whether the Wi-Fi watchdog is enabled for background checking even
4788         * after it thinks the user has connected to a good access point.
4789         * @deprecated This setting is not used.
4790         */
4791        @Deprecated
4792        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
4793                "wifi_watchdog_background_check_enabled";
4794
4795        /**
4796         * The timeout for a background ping
4797         * @deprecated This setting is not used.
4798         */
4799        @Deprecated
4800        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
4801                "wifi_watchdog_background_check_timeout_ms";
4802
4803        /**
4804         * The number of initial pings to perform that *may* be ignored if they
4805         * fail. Again, if these fail, they will *not* be used in packet loss
4806         * calculation. For example, one network always seemed to time out for
4807         * the first couple pings, so this is set to 3 by default.
4808         * @deprecated This setting is not used.
4809         */
4810        @Deprecated
4811        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
4812            "wifi_watchdog_initial_ignored_ping_count";
4813
4814        /**
4815         * The maximum number of access points (per network) to attempt to test.
4816         * If this number is reached, the watchdog will no longer monitor the
4817         * initial connection state for the network. This is a safeguard for
4818         * networks containing multiple APs whose DNS does not respond to pings.
4819         * @deprecated This setting is not used.
4820         */
4821        @Deprecated
4822        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
4823
4824        /**
4825         * @deprecated Use {@link android.provider.Settings.Global#WIFI_WATCHDOG_ON} instead
4826         */
4827        @Deprecated
4828        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
4829
4830        /**
4831         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
4832         * @deprecated This setting is not used.
4833         */
4834        @Deprecated
4835        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
4836
4837        /**
4838         * The number of pings to test if an access point is a good connection.
4839         * @deprecated This setting is not used.
4840         */
4841        @Deprecated
4842        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
4843
4844        /**
4845         * The delay between pings.
4846         * @deprecated This setting is not used.
4847         */
4848        @Deprecated
4849        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
4850
4851        /**
4852         * The timeout per ping.
4853         * @deprecated This setting is not used.
4854         */
4855        @Deprecated
4856        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
4857
4858        /**
4859         * @deprecated Use
4860         * {@link android.provider.Settings.Global#WIFI_MAX_DHCP_RETRY_COUNT} instead
4861         */
4862        @Deprecated
4863        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Global.WIFI_MAX_DHCP_RETRY_COUNT;
4864
4865        /**
4866         * @deprecated Use
4867         * {@link android.provider.Settings.Global#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
4868         */
4869        @Deprecated
4870        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
4871                Global.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
4872
4873        /**
4874         * The number of milliseconds to hold on to a PendingIntent based request. This delay gives
4875         * the receivers of the PendingIntent an opportunity to make a new network request before
4876         * the Network satisfying the request is potentially removed.
4877         *
4878         * @hide
4879         */
4880        public static final String CONNECTIVITY_RELEASE_PENDING_INTENT_DELAY_MS =
4881                "connectivity_release_pending_intent_delay_ms";
4882
4883        /**
4884         * Whether background data usage is allowed.
4885         *
4886         * @deprecated As of {@link VERSION_CODES#ICE_CREAM_SANDWICH},
4887         *             availability of background data depends on several
4888         *             combined factors. When background data is unavailable,
4889         *             {@link ConnectivityManager#getActiveNetworkInfo()} will
4890         *             now appear disconnected.
4891         */
4892        @Deprecated
4893        public static final String BACKGROUND_DATA = "background_data";
4894
4895        /**
4896         * Origins for which browsers should allow geolocation by default.
4897         * The value is a space-separated list of origins.
4898         */
4899        public static final String ALLOWED_GEOLOCATION_ORIGINS
4900                = "allowed_geolocation_origins";
4901
4902        /**
4903         * The preferred TTY mode     0 = TTy Off, CDMA default
4904         *                            1 = TTY Full
4905         *                            2 = TTY HCO
4906         *                            3 = TTY VCO
4907         * @hide
4908         */
4909        public static final String PREFERRED_TTY_MODE =
4910                "preferred_tty_mode";
4911
4912        /**
4913         * Whether the enhanced voice privacy mode is enabled.
4914         * 0 = normal voice privacy
4915         * 1 = enhanced voice privacy
4916         * @hide
4917         */
4918        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
4919
4920        /**
4921         * Whether the TTY mode mode is enabled.
4922         * 0 = disabled
4923         * 1 = enabled
4924         * @hide
4925         */
4926        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
4927
4928        /**
4929         * Controls whether settings backup is enabled.
4930         * Type: int ( 0 = disabled, 1 = enabled )
4931         * @hide
4932         */
4933        public static final String BACKUP_ENABLED = "backup_enabled";
4934
4935        /**
4936         * Controls whether application data is automatically restored from backup
4937         * at install time.
4938         * Type: int ( 0 = disabled, 1 = enabled )
4939         * @hide
4940         */
4941        public static final String BACKUP_AUTO_RESTORE = "backup_auto_restore";
4942
4943        /**
4944         * Indicates whether settings backup has been fully provisioned.
4945         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
4946         * @hide
4947         */
4948        public static final String BACKUP_PROVISIONED = "backup_provisioned";
4949
4950        /**
4951         * Component of the transport to use for backup/restore.
4952         * @hide
4953         */
4954        public static final String BACKUP_TRANSPORT = "backup_transport";
4955
4956        /**
4957         * Version for which the setup wizard was last shown.  Bumped for
4958         * each release when there is new setup information to show.
4959         * @hide
4960         */
4961        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
4962
4963        /**
4964         * The interval in milliseconds after which Wi-Fi is considered idle.
4965         * When idle, it is possible for the device to be switched from Wi-Fi to
4966         * the mobile data network.
4967         * @hide
4968         * @deprecated Use {@link android.provider.Settings.Global#WIFI_IDLE_MS}
4969         * instead.
4970         */
4971        @Deprecated
4972        public static final String WIFI_IDLE_MS = Global.WIFI_IDLE_MS;
4973
4974        /**
4975         * The global search provider chosen by the user (if multiple global
4976         * search providers are installed). This will be the provider returned
4977         * by {@link SearchManager#getGlobalSearchActivity()} if it's still
4978         * installed. This setting is stored as a flattened component name as
4979         * per {@link ComponentName#flattenToString()}.
4980         *
4981         * @hide
4982         */
4983        public static final String SEARCH_GLOBAL_SEARCH_ACTIVITY =
4984                "search_global_search_activity";
4985
4986        /**
4987         * The number of promoted sources in GlobalSearch.
4988         * @hide
4989         */
4990        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
4991        /**
4992         * The maximum number of suggestions returned by GlobalSearch.
4993         * @hide
4994         */
4995        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
4996        /**
4997         * The number of suggestions GlobalSearch will ask each non-web search source for.
4998         * @hide
4999         */
5000        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
5001        /**
5002         * The number of suggestions the GlobalSearch will ask the web search source for.
5003         * @hide
5004         */
5005        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
5006                "search_web_results_override_limit";
5007        /**
5008         * The number of milliseconds that GlobalSearch will wait for suggestions from
5009         * promoted sources before continuing with all other sources.
5010         * @hide
5011         */
5012        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
5013                "search_promoted_source_deadline_millis";
5014        /**
5015         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
5016         * @hide
5017         */
5018        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
5019        /**
5020         * The maximum number of milliseconds that GlobalSearch shows the previous results
5021         * after receiving a new query.
5022         * @hide
5023         */
5024        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
5025        /**
5026         * The maximum age of log data used for shortcuts in GlobalSearch.
5027         * @hide
5028         */
5029        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
5030        /**
5031         * The maximum age of log data used for source ranking in GlobalSearch.
5032         * @hide
5033         */
5034        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
5035                "search_max_source_event_age_millis";
5036        /**
5037         * The minimum number of impressions needed to rank a source in GlobalSearch.
5038         * @hide
5039         */
5040        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
5041                "search_min_impressions_for_source_ranking";
5042        /**
5043         * The minimum number of clicks needed to rank a source in GlobalSearch.
5044         * @hide
5045         */
5046        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
5047                "search_min_clicks_for_source_ranking";
5048        /**
5049         * The maximum number of shortcuts shown by GlobalSearch.
5050         * @hide
5051         */
5052        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
5053        /**
5054         * The size of the core thread pool for suggestion queries in GlobalSearch.
5055         * @hide
5056         */
5057        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
5058                "search_query_thread_core_pool_size";
5059        /**
5060         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
5061         * @hide
5062         */
5063        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
5064                "search_query_thread_max_pool_size";
5065        /**
5066         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
5067         * @hide
5068         */
5069        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
5070                "search_shortcut_refresh_core_pool_size";
5071        /**
5072         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
5073         * @hide
5074         */
5075        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
5076                "search_shortcut_refresh_max_pool_size";
5077        /**
5078         * The maximun time that excess threads in the GlobalSeach thread pools will
5079         * wait before terminating.
5080         * @hide
5081         */
5082        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
5083                "search_thread_keepalive_seconds";
5084        /**
5085         * The maximum number of concurrent suggestion queries to each source.
5086         * @hide
5087         */
5088        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
5089                "search_per_source_concurrent_query_limit";
5090
5091        /**
5092         * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
5093         * @hide
5094         */
5095        public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
5096
5097        /**
5098         * Whether or not UMS auto-starts on UMS host detection. (0 = false, 1 = true)
5099         * @hide
5100         */
5101        public static final String MOUNT_UMS_AUTOSTART = "mount_ums_autostart";
5102
5103        /**
5104         * Whether or not a notification is displayed on UMS host detection. (0 = false, 1 = true)
5105         * @hide
5106         */
5107        public static final String MOUNT_UMS_PROMPT = "mount_ums_prompt";
5108
5109        /**
5110         * Whether or not a notification is displayed while UMS is enabled. (0 = false, 1 = true)
5111         * @hide
5112         */
5113        public static final String MOUNT_UMS_NOTIFY_ENABLED = "mount_ums_notify_enabled";
5114
5115        /**
5116         * If nonzero, ANRs in invisible background processes bring up a dialog.
5117         * Otherwise, the process will be silently killed.
5118         * @hide
5119         */
5120        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
5121
5122        /**
5123         * The {@link ComponentName} string of the service to be used as the voice recognition
5124         * service.
5125         *
5126         * @hide
5127         */
5128        public static final String VOICE_RECOGNITION_SERVICE = "voice_recognition_service";
5129
5130        /**
5131         * Stores whether an user has consented to have apps verified through PAM.
5132         * The value is boolean (1 or 0).
5133         *
5134         * @hide
5135         */
5136        public static final String PACKAGE_VERIFIER_USER_CONSENT =
5137            "package_verifier_user_consent";
5138
5139        /**
5140         * The {@link ComponentName} string of the selected spell checker service which is
5141         * one of the services managed by the text service manager.
5142         *
5143         * @hide
5144         */
5145        public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
5146
5147        /**
5148         * The {@link ComponentName} string of the selected subtype of the selected spell checker
5149         * service which is one of the services managed by the text service manager.
5150         *
5151         * @hide
5152         */
5153        public static final String SELECTED_SPELL_CHECKER_SUBTYPE =
5154                "selected_spell_checker_subtype";
5155
5156        /**
5157         * The {@link ComponentName} string whether spell checker is enabled or not.
5158         *
5159         * @hide
5160         */
5161        public static final String SPELL_CHECKER_ENABLED = "spell_checker_enabled";
5162
5163        /**
5164         * What happens when the user presses the Power button while in-call
5165         * and the screen is on.<br/>
5166         * <b>Values:</b><br/>
5167         * 1 - The Power button turns off the screen and locks the device. (Default behavior)<br/>
5168         * 2 - The Power button hangs up the current call.<br/>
5169         *
5170         * @hide
5171         */
5172        public static final String INCALL_POWER_BUTTON_BEHAVIOR = "incall_power_button_behavior";
5173
5174        /**
5175         * INCALL_POWER_BUTTON_BEHAVIOR value for "turn off screen".
5176         * @hide
5177         */
5178        public static final int INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF = 0x1;
5179
5180        /**
5181         * INCALL_POWER_BUTTON_BEHAVIOR value for "hang up".
5182         * @hide
5183         */
5184        public static final int INCALL_POWER_BUTTON_BEHAVIOR_HANGUP = 0x2;
5185
5186        /**
5187         * INCALL_POWER_BUTTON_BEHAVIOR default value.
5188         * @hide
5189         */
5190        public static final int INCALL_POWER_BUTTON_BEHAVIOR_DEFAULT =
5191                INCALL_POWER_BUTTON_BEHAVIOR_SCREEN_OFF;
5192
5193        /**
5194         * Whether the device should wake when the wake gesture sensor detects motion.
5195         * @hide
5196         */
5197        public static final String WAKE_GESTURE_ENABLED = "wake_gesture_enabled";
5198
5199        /**
5200         * Whether the device should doze if configured.
5201         * @hide
5202         */
5203        public static final String DOZE_ENABLED = "doze_enabled";
5204
5205        /**
5206         * The current night mode that has been selected by the user.  Owned
5207         * and controlled by UiModeManagerService.  Constants are as per
5208         * UiModeManager.
5209         * @hide
5210         */
5211        public static final String UI_NIGHT_MODE = "ui_night_mode";
5212
5213        /**
5214         * Whether screensavers are enabled.
5215         * @hide
5216         */
5217        public static final String SCREENSAVER_ENABLED = "screensaver_enabled";
5218
5219        /**
5220         * The user's chosen screensaver components.
5221         *
5222         * These will be launched by the PhoneWindowManager after a timeout when not on
5223         * battery, or upon dock insertion (if SCREENSAVER_ACTIVATE_ON_DOCK is set to 1).
5224         * @hide
5225         */
5226        public static final String SCREENSAVER_COMPONENTS = "screensaver_components";
5227
5228        /**
5229         * If screensavers are enabled, whether the screensaver should be automatically launched
5230         * when the device is inserted into a (desk) dock.
5231         * @hide
5232         */
5233        public static final String SCREENSAVER_ACTIVATE_ON_DOCK = "screensaver_activate_on_dock";
5234
5235        /**
5236         * If screensavers are enabled, whether the screensaver should be automatically launched
5237         * when the screen times out when not on battery.
5238         * @hide
5239         */
5240        public static final String SCREENSAVER_ACTIVATE_ON_SLEEP = "screensaver_activate_on_sleep";
5241
5242        /**
5243         * If screensavers are enabled, the default screensaver component.
5244         * @hide
5245         */
5246        public static final String SCREENSAVER_DEFAULT_COMPONENT = "screensaver_default_component";
5247
5248        /**
5249         * The default NFC payment component
5250         * @hide
5251         */
5252        public static final String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
5253
5254        /**
5255         * Whether NFC payment is handled by the foreground application or a default.
5256         * @hide
5257         */
5258        public static final String NFC_PAYMENT_FOREGROUND = "nfc_payment_foreground";
5259
5260        /**
5261         * Specifies the package name currently configured to be the primary sms application
5262         * @hide
5263         */
5264        public static final String SMS_DEFAULT_APPLICATION = "sms_default_application";
5265
5266        /**
5267         * Specifies the package name currently configured to be the emergency assistance application
5268         *
5269         * @see android.telephony.TelephonyManager#ACTION_EMERGENCY_ASSISTANCE
5270         *
5271         * @hide
5272         */
5273        public static final String EMERGENCY_ASSISTANCE_APPLICATION = "emergency_assistance_application";
5274
5275        /**
5276         * Names of the packages that the current user has explicitly allowed to
5277         * see all of the user's notifications, separated by ':'.
5278         *
5279         * @hide
5280         */
5281        public static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
5282
5283        /**
5284         * @hide
5285         */
5286        public static final String ENABLED_CONDITION_PROVIDERS = "enabled_condition_providers";
5287
5288        /** @hide */
5289        public static final String BAR_SERVICE_COMPONENT = "bar_service_component";
5290
5291        /** @hide */
5292        public static final String VOLUME_CONTROLLER_SERVICE_COMPONENT
5293                = "volume_controller_service_component";
5294
5295        /** @hide */
5296        public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
5297
5298        /**
5299         * This is the query URI for finding a print service to install.
5300         *
5301         * @hide
5302         */
5303        public static final String PRINT_SERVICE_SEARCH_URI = "print_service_search_uri";
5304
5305        /**
5306         * This is the query URI for finding a NFC payment service to install.
5307         *
5308         * @hide
5309         */
5310        public static final String PAYMENT_SERVICE_SEARCH_URI = "payment_service_search_uri";
5311
5312        /**
5313         * If enabled, apps should try to skip any introductory hints on first launch. This might
5314         * apply to users that are already familiar with the environment or temporary users.
5315         * <p>
5316         * Type : int (0 to show hints, 1 to skip showing hints)
5317         */
5318        public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
5319
5320        /**
5321         * Persisted playback time after a user confirmation of an unsafe volume level.
5322         *
5323         * @hide
5324         */
5325        public static final String UNSAFE_VOLUME_MUSIC_ACTIVE_MS = "unsafe_volume_music_active_ms";
5326
5327        /**
5328         * This preference enables notification display on the lockscreen.
5329         * @hide
5330         */
5331        public static final String LOCK_SCREEN_SHOW_NOTIFICATIONS =
5332                "lock_screen_show_notifications";
5333
5334        /**
5335         * List of TV inputs that are currently hidden. This is a string
5336         * containing the IDs of all hidden TV inputs. Each ID is encoded by
5337         * {@link android.net.Uri#encode(String)} and separated by ':'.
5338         * @hide
5339         */
5340        public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";
5341
5342        /**
5343         * List of custom TV input labels. This is a string containing <TV input id, custom name>
5344         * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
5345         * and separated by ','. Each pair is separated by ':'.
5346         * @hide
5347         */
5348        public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
5349
5350        /**
5351         * Whether automatic routing of system audio to USB audio peripheral is disabled.
5352         * The value is boolean (1 or 0), where 1 means automatic routing is disabled,
5353         * and 0 means automatic routing is enabled.
5354         *
5355         * @hide
5356         */
5357        public static final String USB_AUDIO_AUTOMATIC_ROUTING_DISABLED =
5358                "usb_audio_automatic_routing_disabled";
5359
5360        /**
5361         * The timeout in milliseconds before the device fully goes to sleep after
5362         * a period of inactivity.  This value sets an upper bound on how long the device
5363         * will stay awake or dreaming without user activity.  It should generally
5364         * be longer than {@link Settings.System#SCREEN_OFF_TIMEOUT} as otherwise the device
5365         * will sleep before it ever has a chance to dream.
5366         * <p>
5367         * Use -1 to disable this timeout.
5368         * </p>
5369         *
5370         * @hide
5371         */
5372        public static final String SLEEP_TIMEOUT = "sleep_timeout";
5373
5374        /**
5375         * This are the settings to be backed up.
5376         *
5377         * NOTE: Settings are backed up and restored in the order they appear
5378         *       in this array. If you have one setting depending on another,
5379         *       make sure that they are ordered appropriately.
5380         *
5381         * @hide
5382         */
5383        public static final String[] SETTINGS_TO_BACKUP = {
5384            BUGREPORT_IN_POWER_MENU,                            // moved to global
5385            ALLOW_MOCK_LOCATION,
5386            PARENTAL_CONTROL_ENABLED,
5387            PARENTAL_CONTROL_REDIRECT_URL,
5388            USB_MASS_STORAGE_ENABLED,                           // moved to global
5389            ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED,
5390            ACCESSIBILITY_DISPLAY_MAGNIFICATION_SCALE,
5391            ACCESSIBILITY_DISPLAY_MAGNIFICATION_AUTO_UPDATE,
5392            ACCESSIBILITY_SCRIPT_INJECTION,
5393            BACKUP_AUTO_RESTORE,
5394            ENABLED_ACCESSIBILITY_SERVICES,
5395            ENABLED_NOTIFICATION_LISTENERS,
5396            ENABLED_INPUT_METHODS,
5397            TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES,
5398            TOUCH_EXPLORATION_ENABLED,
5399            ACCESSIBILITY_ENABLED,
5400            ACCESSIBILITY_SPEAK_PASSWORD,
5401            ACCESSIBILITY_HIGH_TEXT_CONTRAST_ENABLED,
5402            ACCESSIBILITY_CAPTIONING_ENABLED,
5403            ACCESSIBILITY_CAPTIONING_LOCALE,
5404            ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR,
5405            ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR,
5406            ACCESSIBILITY_CAPTIONING_EDGE_TYPE,
5407            ACCESSIBILITY_CAPTIONING_EDGE_COLOR,
5408            ACCESSIBILITY_CAPTIONING_TYPEFACE,
5409            ACCESSIBILITY_CAPTIONING_FONT_SCALE,
5410            TTS_USE_DEFAULTS,
5411            TTS_DEFAULT_RATE,
5412            TTS_DEFAULT_PITCH,
5413            TTS_DEFAULT_SYNTH,
5414            TTS_DEFAULT_LANG,
5415            TTS_DEFAULT_COUNTRY,
5416            TTS_ENABLED_PLUGINS,
5417            TTS_DEFAULT_LOCALE,
5418            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,            // moved to global
5419            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,               // moved to global
5420            WIFI_NUM_OPEN_NETWORKS_KEPT,                        // moved to global
5421            SELECTED_SPELL_CHECKER,
5422            SELECTED_SPELL_CHECKER_SUBTYPE,
5423            SPELL_CHECKER_ENABLED,
5424            MOUNT_PLAY_NOTIFICATION_SND,
5425            MOUNT_UMS_AUTOSTART,
5426            MOUNT_UMS_PROMPT,
5427            MOUNT_UMS_NOTIFY_ENABLED,
5428            UI_NIGHT_MODE,
5429            SLEEP_TIMEOUT
5430        };
5431
5432        /**
5433         * These entries are considered common between the personal and the managed profile,
5434         * since the managed profile doesn't get to change them.
5435         */
5436        private static final Set<String> CLONE_TO_MANAGED_PROFILE = new ArraySet<>();
5437        static {
5438            CLONE_TO_MANAGED_PROFILE.add(ACCESSIBILITY_ENABLED);
5439            CLONE_TO_MANAGED_PROFILE.add(ALLOW_MOCK_LOCATION);
5440            CLONE_TO_MANAGED_PROFILE.add(ALLOWED_GEOLOCATION_ORIGINS);
5441            CLONE_TO_MANAGED_PROFILE.add(DEFAULT_INPUT_METHOD);
5442            CLONE_TO_MANAGED_PROFILE.add(ENABLED_ACCESSIBILITY_SERVICES);
5443            CLONE_TO_MANAGED_PROFILE.add(ENABLED_INPUT_METHODS);
5444            CLONE_TO_MANAGED_PROFILE.add(LOCATION_MODE);
5445            CLONE_TO_MANAGED_PROFILE.add(LOCATION_PROVIDERS_ALLOWED);
5446            CLONE_TO_MANAGED_PROFILE.add(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
5447            CLONE_TO_MANAGED_PROFILE.add(SELECTED_INPUT_METHOD_SUBTYPE);
5448            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER);
5449            CLONE_TO_MANAGED_PROFILE.add(SELECTED_SPELL_CHECKER_SUBTYPE);
5450        }
5451
5452        /** @hide */
5453        public static void getCloneToManagedProfileSettings(Set<String> outKeySet) {
5454            outKeySet.addAll(CLONE_TO_MANAGED_PROFILE);
5455        }
5456
5457        /**
5458         * Helper method for determining if a location provider is enabled.
5459         *
5460         * @param cr the content resolver to use
5461         * @param provider the location provider to query
5462         * @return true if the provider is enabled
5463         *
5464         * @deprecated use {@link #LOCATION_MODE} or
5465         *             {@link LocationManager#isProviderEnabled(String)}
5466         */
5467        @Deprecated
5468        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
5469            return isLocationProviderEnabledForUser(cr, provider, UserHandle.myUserId());
5470        }
5471
5472        /**
5473         * Helper method for determining if a location provider is enabled.
5474         * @param cr the content resolver to use
5475         * @param provider the location provider to query
5476         * @param userId the userId to query
5477         * @return true if the provider is enabled
5478         * @deprecated use {@link #LOCATION_MODE} or
5479         *             {@link LocationManager#isProviderEnabled(String)}
5480         * @hide
5481         */
5482        @Deprecated
5483        public static final boolean isLocationProviderEnabledForUser(ContentResolver cr, String provider, int userId) {
5484            String allowedProviders = Settings.Secure.getStringForUser(cr,
5485                    LOCATION_PROVIDERS_ALLOWED, userId);
5486            return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
5487        }
5488
5489        /**
5490         * Thread-safe method for enabling or disabling a single location provider.
5491         * @param cr the content resolver to use
5492         * @param provider the location provider to enable or disable
5493         * @param enabled true if the provider should be enabled
5494         * @deprecated use {@link #putInt(ContentResolver, String, int)} and {@link #LOCATION_MODE}
5495         */
5496        @Deprecated
5497        public static final void setLocationProviderEnabled(ContentResolver cr,
5498                String provider, boolean enabled) {
5499            setLocationProviderEnabledForUser(cr, provider, enabled, UserHandle.myUserId());
5500        }
5501
5502        /**
5503         * Thread-safe method for enabling or disabling a single location provider.
5504         *
5505         * @param cr the content resolver to use
5506         * @param provider the location provider to enable or disable
5507         * @param enabled true if the provider should be enabled
5508         * @param userId the userId for which to enable/disable providers
5509         * @return true if the value was set, false on database errors
5510         * @deprecated use {@link #putIntForUser(ContentResolver, String, int, int)} and
5511         *             {@link #LOCATION_MODE}
5512         * @hide
5513         */
5514        @Deprecated
5515        public static final boolean setLocationProviderEnabledForUser(ContentResolver cr,
5516                String provider, boolean enabled, int userId) {
5517            synchronized (mLocationSettingsLock) {
5518                // to ensure thread safety, we write the provider name with a '+' or '-'
5519                // and let the SettingsProvider handle it rather than reading and modifying
5520                // the list of enabled providers.
5521                if (enabled) {
5522                    provider = "+" + provider;
5523                } else {
5524                    provider = "-" + provider;
5525                }
5526                return putStringForUser(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider,
5527                        userId);
5528            }
5529        }
5530
5531        /**
5532         * Thread-safe method for setting the location mode to one of
5533         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
5534         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
5535         *
5536         * @param cr the content resolver to use
5537         * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY}
5538         * @param userId the userId for which to change mode
5539         * @return true if the value was set, false on database errors
5540         *
5541         * @throws IllegalArgumentException if mode is not one of the supported values
5542         */
5543        private static final boolean setLocationModeForUser(ContentResolver cr, int mode,
5544                int userId) {
5545            synchronized (mLocationSettingsLock) {
5546                boolean gps = false;
5547                boolean network = false;
5548                switch (mode) {
5549                    case LOCATION_MODE_OFF:
5550                        break;
5551                    case LOCATION_MODE_SENSORS_ONLY:
5552                        gps = true;
5553                        break;
5554                    case LOCATION_MODE_BATTERY_SAVING:
5555                        network = true;
5556                        break;
5557                    case LOCATION_MODE_HIGH_ACCURACY:
5558                        gps = true;
5559                        network = true;
5560                        break;
5561                    default:
5562                        throw new IllegalArgumentException("Invalid location mode: " + mode);
5563                }
5564                // Note it's important that we set the NLP mode first. The Google implementation
5565                // of NLP clears its NLP consent setting any time it receives a
5566                // LocationManager.PROVIDERS_CHANGED_ACTION broadcast and NLP is disabled. Also,
5567                // it shows an NLP consent dialog any time it receives the broadcast, NLP is
5568                // enabled, and the NLP consent is not set. If 1) we were to enable GPS first,
5569                // 2) a setup wizard has its own NLP consent UI that sets the NLP consent setting,
5570                // and 3) the receiver happened to complete before we enabled NLP, then the Google
5571                // NLP would detect the attempt to enable NLP and show a redundant NLP consent
5572                // dialog. Then the people who wrote the setup wizard would be sad.
5573                boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser(
5574                        cr, LocationManager.NETWORK_PROVIDER, network, userId);
5575                boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser(
5576                        cr, LocationManager.GPS_PROVIDER, gps, userId);
5577                return gpsSuccess && nlpSuccess;
5578            }
5579        }
5580
5581        /**
5582         * Thread-safe method for reading the location mode, returns one of
5583         * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY},
5584         * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}.
5585         *
5586         * @param cr the content resolver to use
5587         * @param userId the userId for which to read the mode
5588         * @return the location mode
5589         */
5590        private static final int getLocationModeForUser(ContentResolver cr, int userId) {
5591            synchronized (mLocationSettingsLock) {
5592                boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser(
5593                        cr, LocationManager.GPS_PROVIDER, userId);
5594                boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser(
5595                        cr, LocationManager.NETWORK_PROVIDER, userId);
5596                if (gpsEnabled && networkEnabled) {
5597                    return LOCATION_MODE_HIGH_ACCURACY;
5598                } else if (gpsEnabled) {
5599                    return LOCATION_MODE_SENSORS_ONLY;
5600                } else if (networkEnabled) {
5601                    return LOCATION_MODE_BATTERY_SAVING;
5602                } else {
5603                    return LOCATION_MODE_OFF;
5604                }
5605            }
5606        }
5607    }
5608
5609    /**
5610     * Global system settings, containing preferences that always apply identically
5611     * to all defined users.  Applications can read these but are not allowed to write;
5612     * like the "Secure" settings, these are for preferences that the user must
5613     * explicitly modify through the system UI or specialized APIs for those values.
5614     */
5615    public static final class Global extends NameValueTable {
5616        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_global_version";
5617
5618        /**
5619         * The content:// style URL for global secure settings items.  Not public.
5620         */
5621        public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/global");
5622
5623        /**
5624         * Whether users are allowed to add more users or guest from lockscreen.
5625         * <p>
5626         * Type: int
5627         * @hide
5628         */
5629        public static final String ADD_USERS_WHEN_LOCKED = "add_users_when_locked";
5630
5631        /**
5632         * Setting whether the global gesture for enabling accessibility is enabled.
5633         * If this gesture is enabled the user will be able to perfrom it to enable
5634         * the accessibility state without visiting the settings app.
5635         * @hide
5636         */
5637        public static final String ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED =
5638                "enable_accessibility_global_gesture_enabled";
5639
5640        /**
5641         * Whether Airplane Mode is on.
5642         */
5643        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
5644
5645        /**
5646         * Whether Theater Mode is on.
5647         * {@hide}
5648         */
5649        @SystemApi
5650        public static final String THEATER_MODE_ON = "theater_mode_on";
5651
5652        /**
5653         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
5654         */
5655        public static final String RADIO_BLUETOOTH = "bluetooth";
5656
5657        /**
5658         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
5659         */
5660        public static final String RADIO_WIFI = "wifi";
5661
5662        /**
5663         * {@hide}
5664         */
5665        public static final String RADIO_WIMAX = "wimax";
5666        /**
5667         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
5668         */
5669        public static final String RADIO_CELL = "cell";
5670
5671        /**
5672         * Constant for use in AIRPLANE_MODE_RADIOS to specify NFC radio.
5673         */
5674        public static final String RADIO_NFC = "nfc";
5675
5676        /**
5677         * A comma separated list of radios that need to be disabled when airplane mode
5678         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
5679         * included in the comma separated list.
5680         */
5681        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
5682
5683        /**
5684         * A comma separated list of radios that should to be disabled when airplane mode
5685         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
5686         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
5687         * will be turned off when entering airplane mode, but the user will be able to reenable
5688         * Wifi in the Settings app.
5689         *
5690         * {@hide}
5691         */
5692        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
5693
5694        /**
5695         * The policy for deciding when Wi-Fi should go to sleep (which will in
5696         * turn switch to using the mobile data as an Internet connection).
5697         * <p>
5698         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
5699         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
5700         * {@link #WIFI_SLEEP_POLICY_NEVER}.
5701         */
5702        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
5703
5704        /**
5705         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
5706         * policy, which is to sleep shortly after the turning off
5707         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
5708         */
5709        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
5710
5711        /**
5712         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
5713         * the device is on battery, and never go to sleep when the device is
5714         * plugged in.
5715         */
5716        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
5717
5718        /**
5719         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
5720         */
5721        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
5722
5723        /**
5724         * Value to specify if the user prefers the date, time and time zone
5725         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
5726         */
5727        public static final String AUTO_TIME = "auto_time";
5728
5729        /**
5730         * Value to specify if the user prefers the time zone
5731         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
5732         */
5733        public static final String AUTO_TIME_ZONE = "auto_time_zone";
5734
5735        /**
5736         * URI for the car dock "in" event sound.
5737         * @hide
5738         */
5739        public static final String CAR_DOCK_SOUND = "car_dock_sound";
5740
5741        /**
5742         * URI for the car dock "out" event sound.
5743         * @hide
5744         */
5745        public static final String CAR_UNDOCK_SOUND = "car_undock_sound";
5746
5747        /**
5748         * URI for the desk dock "in" event sound.
5749         * @hide
5750         */
5751        public static final String DESK_DOCK_SOUND = "desk_dock_sound";
5752
5753        /**
5754         * URI for the desk dock "out" event sound.
5755         * @hide
5756         */
5757        public static final String DESK_UNDOCK_SOUND = "desk_undock_sound";
5758
5759        /**
5760         * Whether to play a sound for dock events.
5761         * @hide
5762         */
5763        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";
5764
5765        /**
5766         * URI for the "device locked" (keyguard shown) sound.
5767         * @hide
5768         */
5769        public static final String LOCK_SOUND = "lock_sound";
5770
5771        /**
5772         * URI for the "device unlocked" sound.
5773         * @hide
5774         */
5775        public static final String UNLOCK_SOUND = "unlock_sound";
5776
5777        /**
5778         * URI for the "device is trusted" sound, which is played when the device enters the trusted
5779         * state without unlocking.
5780         * @hide
5781         */
5782        public static final String TRUSTED_SOUND = "trusted_sound";
5783
5784        /**
5785         * URI for the low battery sound file.
5786         * @hide
5787         */
5788        public static final String LOW_BATTERY_SOUND = "low_battery_sound";
5789
5790        /**
5791         * Whether to play a sound for low-battery alerts.
5792         * @hide
5793         */
5794        public static final String POWER_SOUNDS_ENABLED = "power_sounds_enabled";
5795
5796        /**
5797         * URI for the "wireless charging started" sound.
5798         * @hide
5799         */
5800        public static final String WIRELESS_CHARGING_STARTED_SOUND =
5801                "wireless_charging_started_sound";
5802
5803        /**
5804         * Whether we keep the device on while the device is plugged in.
5805         * Supported values are:
5806         * <ul>
5807         * <li>{@code 0} to never stay on while plugged in</li>
5808         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
5809         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
5810         * <li>{@link BatteryManager#BATTERY_PLUGGED_WIRELESS} to stay on for wireless charger</li>
5811         * </ul>
5812         * These values can be OR-ed together.
5813         */
5814        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
5815
5816        /**
5817         * When the user has enable the option to have a "bug report" command
5818         * in the power menu.
5819         * @hide
5820         */
5821        public static final String BUGREPORT_IN_POWER_MENU = "bugreport_in_power_menu";
5822
5823        /**
5824         * Whether ADB is enabled.
5825         */
5826        public static final String ADB_ENABLED = "adb_enabled";
5827
5828        /**
5829         * Whether Views are allowed to save their attribute data.
5830         * @hide
5831         */
5832        public static final String DEBUG_VIEW_ATTRIBUTES = "debug_view_attributes";
5833
5834        /**
5835         * Whether assisted GPS should be enabled or not.
5836         * @hide
5837         */
5838        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
5839
5840        /**
5841         * Whether bluetooth is enabled/disabled
5842         * 0=disabled. 1=enabled.
5843         */
5844        public static final String BLUETOOTH_ON = "bluetooth_on";
5845
5846        /**
5847         * CDMA Cell Broadcast SMS
5848         *                            0 = CDMA Cell Broadcast SMS disabled
5849         *                            1 = CDMA Cell Broadcast SMS enabled
5850         * @hide
5851         */
5852        public static final String CDMA_CELL_BROADCAST_SMS =
5853                "cdma_cell_broadcast_sms";
5854
5855        /**
5856         * The CDMA roaming mode 0 = Home Networks, CDMA default
5857         *                       1 = Roaming on Affiliated networks
5858         *                       2 = Roaming on any networks
5859         * @hide
5860         */
5861        public static final String CDMA_ROAMING_MODE = "roaming_settings";
5862
5863        /**
5864         * The CDMA subscription mode 0 = RUIM/SIM (default)
5865         *                                1 = NV
5866         * @hide
5867         */
5868        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
5869
5870        /** Inactivity timeout to track mobile data activity.
5871        *
5872        * If set to a positive integer, it indicates the inactivity timeout value in seconds to
5873        * infer the data activity of mobile network. After a period of no activity on mobile
5874        * networks with length specified by the timeout, an {@code ACTION_DATA_ACTIVITY_CHANGE}
5875        * intent is fired to indicate a transition of network status from "active" to "idle". Any
5876        * subsequent activity on mobile networks triggers the firing of {@code
5877        * ACTION_DATA_ACTIVITY_CHANGE} intent indicating transition from "idle" to "active".
5878        *
5879        * Network activity refers to transmitting or receiving data on the network interfaces.
5880        *
5881        * Tracking is disabled if set to zero or negative value.
5882        *
5883        * @hide
5884        */
5885       public static final String DATA_ACTIVITY_TIMEOUT_MOBILE = "data_activity_timeout_mobile";
5886
5887       /** Timeout to tracking Wifi data activity. Same as {@code DATA_ACTIVITY_TIMEOUT_MOBILE}
5888        * but for Wifi network.
5889        * @hide
5890        */
5891       public static final String DATA_ACTIVITY_TIMEOUT_WIFI = "data_activity_timeout_wifi";
5892
5893       /**
5894        * Whether or not data roaming is enabled. (0 = false, 1 = true)
5895        */
5896       public static final String DATA_ROAMING = "data_roaming";
5897
5898       /**
5899        * The value passed to a Mobile DataConnection via bringUp which defines the
5900        * number of retries to preform when setting up the initial connection. The default
5901        * value defined in DataConnectionTrackerBase#DEFAULT_MDC_INITIAL_RETRY is currently 1.
5902        * @hide
5903        */
5904       public static final String MDC_INITIAL_MAX_RETRY = "mdc_initial_max_retry";
5905
5906       /**
5907        * Whether user has enabled development settings.
5908        */
5909       public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
5910
5911       /**
5912        * Whether the device has been provisioned (0 = false, 1 = true)
5913        */
5914       public static final String DEVICE_PROVISIONED = "device_provisioned";
5915
5916       /**
5917        * The saved value for WindowManagerService.setForcedDisplayDensity().
5918        * One integer in dpi.  If unset, then use the real display density.
5919        * @hide
5920        */
5921       public static final String DISPLAY_DENSITY_FORCED = "display_density_forced";
5922
5923       /**
5924        * The saved value for WindowManagerService.setForcedDisplaySize().
5925        * Two integers separated by a comma.  If unset, then use the real display size.
5926        * @hide
5927        */
5928       public static final String DISPLAY_SIZE_FORCED = "display_size_forced";
5929
5930       /**
5931        * The maximum size, in bytes, of a download that the download manager will transfer over
5932        * a non-wifi connection.
5933        * @hide
5934        */
5935       public static final String DOWNLOAD_MAX_BYTES_OVER_MOBILE =
5936               "download_manager_max_bytes_over_mobile";
5937
5938       /**
5939        * The recommended maximum size, in bytes, of a download that the download manager should
5940        * transfer over a non-wifi connection. Over this size, the use will be warned, but will
5941        * have the option to start the download over the mobile connection anyway.
5942        * @hide
5943        */
5944       public static final String DOWNLOAD_RECOMMENDED_MAX_BYTES_OVER_MOBILE =
5945               "download_manager_recommended_max_bytes_over_mobile";
5946
5947       /**
5948        * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
5949        */
5950       @Deprecated
5951       public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
5952
5953       /**
5954        * Whether HDMI control shall be enabled. If disabled, no CEC/MHL command will be
5955        * sent or processed. (0 = false, 1 = true)
5956        * @hide
5957        */
5958       public static final String HDMI_CONTROL_ENABLED = "hdmi_control_enabled";
5959
5960       /**
5961        * Whether HDMI system audio is enabled. If enabled, TV internal speaker is muted,
5962        * and the output is redirected to AV Receiver connected via
5963        * {@Global#HDMI_SYSTEM_AUDIO_OUTPUT}.
5964        * @hide
5965        */
5966       public static final String HDMI_SYSTEM_AUDIO_ENABLED = "hdmi_system_audio_enabled";
5967
5968       /**
5969        * Whether TV will automatically turn on upon reception of the CEC command
5970        * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
5971        * @hide
5972        */
5973       public static final String HDMI_CONTROL_AUTO_WAKEUP_ENABLED =
5974               "hdmi_control_auto_wakeup_enabled";
5975
5976       /**
5977        * Whether TV will also turn off other CEC devices when it goes to standby mode.
5978        * (0 = false, 1 = true)
5979        * @hide
5980        */
5981       public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
5982               "hdmi_control_auto_device_off_enabled";
5983
5984       /**
5985        * Whether to use the DHCP client from Lollipop and earlier instead of the newer Android DHCP
5986        * client.
5987        * (0 = false, 1 = true)
5988        * @hide
5989        */
5990       public static final String LEGACY_DHCP_CLIENT = "legacy_dhcp_client";
5991
5992       /**
5993        * Whether TV will switch to MHL port when a mobile device is plugged in.
5994        * (0 = false, 1 = true)
5995        * @hide
5996        */
5997       public static final String MHL_INPUT_SWITCHING_ENABLED = "mhl_input_switching_enabled";
5998
5999       /**
6000        * Whether TV will charge the mobile device connected at MHL port. (0 = false, 1 = true)
6001        * @hide
6002        */
6003       public static final String MHL_POWER_CHARGE_ENABLED = "mhl_power_charge_enabled";
6004
6005       /**
6006        * Whether mobile data connections are allowed by the user.  See
6007        * ConnectivityManager for more info.
6008        * @hide
6009        */
6010       public static final String MOBILE_DATA = "mobile_data";
6011
6012       /** {@hide} */
6013       public static final String NETSTATS_ENABLED = "netstats_enabled";
6014       /** {@hide} */
6015       public static final String NETSTATS_POLL_INTERVAL = "netstats_poll_interval";
6016       /** {@hide} */
6017       public static final String NETSTATS_TIME_CACHE_MAX_AGE = "netstats_time_cache_max_age";
6018       /** {@hide} */
6019       public static final String NETSTATS_GLOBAL_ALERT_BYTES = "netstats_global_alert_bytes";
6020       /** {@hide} */
6021       public static final String NETSTATS_SAMPLE_ENABLED = "netstats_sample_enabled";
6022
6023       /** {@hide} */
6024       public static final String NETSTATS_DEV_BUCKET_DURATION = "netstats_dev_bucket_duration";
6025       /** {@hide} */
6026       public static final String NETSTATS_DEV_PERSIST_BYTES = "netstats_dev_persist_bytes";
6027       /** {@hide} */
6028       public static final String NETSTATS_DEV_ROTATE_AGE = "netstats_dev_rotate_age";
6029       /** {@hide} */
6030       public static final String NETSTATS_DEV_DELETE_AGE = "netstats_dev_delete_age";
6031
6032       /** {@hide} */
6033       public static final String NETSTATS_UID_BUCKET_DURATION = "netstats_uid_bucket_duration";
6034       /** {@hide} */
6035       public static final String NETSTATS_UID_PERSIST_BYTES = "netstats_uid_persist_bytes";
6036       /** {@hide} */
6037       public static final String NETSTATS_UID_ROTATE_AGE = "netstats_uid_rotate_age";
6038       /** {@hide} */
6039       public static final String NETSTATS_UID_DELETE_AGE = "netstats_uid_delete_age";
6040
6041       /** {@hide} */
6042       public static final String NETSTATS_UID_TAG_BUCKET_DURATION = "netstats_uid_tag_bucket_duration";
6043       /** {@hide} */
6044       public static final String NETSTATS_UID_TAG_PERSIST_BYTES = "netstats_uid_tag_persist_bytes";
6045       /** {@hide} */
6046       public static final String NETSTATS_UID_TAG_ROTATE_AGE = "netstats_uid_tag_rotate_age";
6047       /** {@hide} */
6048       public static final String NETSTATS_UID_TAG_DELETE_AGE = "netstats_uid_tag_delete_age";
6049
6050       /**
6051        * User preference for which network(s) should be used. Only the
6052        * connectivity service should touch this.
6053        */
6054       public static final String NETWORK_PREFERENCE = "network_preference";
6055
6056       /**
6057        * Which package name to use for network scoring. If null, or if the package is not a valid
6058        * scorer app, external network scores will neither be requested nor accepted.
6059        * @hide
6060        */
6061       public static final String NETWORK_SCORER_APP = "network_scorer_app";
6062
6063       /**
6064        * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
6065        * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
6066        * exceeded.
6067        * @hide
6068        */
6069       public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
6070
6071       /**
6072        * The length of time in milli-seconds that automatic small adjustments to
6073        * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
6074        * @hide
6075        */
6076       public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
6077
6078       /** Preferred NTP server. {@hide} */
6079       public static final String NTP_SERVER = "ntp_server";
6080       /** Timeout in milliseconds to wait for NTP server. {@hide} */
6081       public static final String NTP_TIMEOUT = "ntp_timeout";
6082
6083       /**
6084        * Whether the package manager should send package verification broadcasts for verifiers to
6085        * review apps prior to installation.
6086        * 1 = request apps to be verified prior to installation, if a verifier exists.
6087        * 0 = do not verify apps before installation
6088        * @hide
6089        */
6090       public static final String PACKAGE_VERIFIER_ENABLE = "package_verifier_enable";
6091
6092       /** Timeout for package verification.
6093        * @hide */
6094       public static final String PACKAGE_VERIFIER_TIMEOUT = "verifier_timeout";
6095
6096       /** Default response code for package verification.
6097        * @hide */
6098       public static final String PACKAGE_VERIFIER_DEFAULT_RESPONSE = "verifier_default_response";
6099
6100       /**
6101        * Show package verification setting in the Settings app.
6102        * 1 = show (default)
6103        * 0 = hide
6104        * @hide
6105        */
6106       public static final String PACKAGE_VERIFIER_SETTING_VISIBLE = "verifier_setting_visible";
6107
6108       /**
6109        * Run package verification on apps installed through ADB/ADT/USB
6110        * 1 = perform package verification on ADB installs (default)
6111        * 0 = bypass package verification on ADB installs
6112        * @hide
6113        */
6114       public static final String PACKAGE_VERIFIER_INCLUDE_ADB = "verifier_verify_adb_installs";
6115
6116       /**
6117        * Time since last fstrim (milliseconds) after which we force one to happen
6118        * during device startup.  If unset, the default is 3 days.
6119        * @hide
6120        */
6121       public static final String FSTRIM_MANDATORY_INTERVAL = "fstrim_mandatory_interval";
6122
6123       /**
6124        * The interval in milliseconds at which to check packet counts on the
6125        * mobile data interface when screen is on, to detect possible data
6126        * connection problems.
6127        * @hide
6128        */
6129       public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
6130               "pdp_watchdog_poll_interval_ms";
6131
6132       /**
6133        * The interval in milliseconds at which to check packet counts on the
6134        * mobile data interface when screen is off, to detect possible data
6135        * connection problems.
6136        * @hide
6137        */
6138       public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
6139               "pdp_watchdog_long_poll_interval_ms";
6140
6141       /**
6142        * The interval in milliseconds at which to check packet counts on the
6143        * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
6144        * outgoing packets has been reached without incoming packets.
6145        * @hide
6146        */
6147       public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
6148               "pdp_watchdog_error_poll_interval_ms";
6149
6150       /**
6151        * The number of outgoing packets sent without seeing an incoming packet
6152        * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
6153        * device is logged to the event log
6154        * @hide
6155        */
6156       public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
6157               "pdp_watchdog_trigger_packet_count";
6158
6159       /**
6160        * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
6161        * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
6162        * attempting data connection recovery.
6163        * @hide
6164        */
6165       public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
6166               "pdp_watchdog_error_poll_count";
6167
6168       /**
6169        * The number of failed PDP reset attempts before moving to something more
6170        * drastic: re-registering to the network.
6171        * @hide
6172        */
6173       public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
6174               "pdp_watchdog_max_pdp_reset_fail_count";
6175
6176       /**
6177        * A positive value indicates how often the SamplingProfiler
6178        * should take snapshots. Zero value means SamplingProfiler
6179        * is disabled.
6180        *
6181        * @hide
6182        */
6183       public static final String SAMPLING_PROFILER_MS = "sampling_profiler_ms";
6184
6185       /**
6186        * URL to open browser on to allow user to manage a prepay account
6187        * @hide
6188        */
6189       public static final String SETUP_PREPAID_DATA_SERVICE_URL =
6190               "setup_prepaid_data_service_url";
6191
6192       /**
6193        * URL to attempt a GET on to see if this is a prepay device
6194        * @hide
6195        */
6196       public static final String SETUP_PREPAID_DETECTION_TARGET_URL =
6197               "setup_prepaid_detection_target_url";
6198
6199       /**
6200        * Host to check for a redirect to after an attempt to GET
6201        * SETUP_PREPAID_DETECTION_TARGET_URL. (If we redirected there,
6202        * this is a prepaid device with zero balance.)
6203        * @hide
6204        */
6205       public static final String SETUP_PREPAID_DETECTION_REDIR_HOST =
6206               "setup_prepaid_detection_redir_host";
6207
6208       /**
6209        * The interval in milliseconds at which to check the number of SMS sent out without asking
6210        * for use permit, to limit the un-authorized SMS usage.
6211        *
6212        * @hide
6213        */
6214       public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
6215               "sms_outgoing_check_interval_ms";
6216
6217       /**
6218        * The number of outgoing SMS sent without asking for user permit (of {@link
6219        * #SMS_OUTGOING_CHECK_INTERVAL_MS}
6220        *
6221        * @hide
6222        */
6223       public static final String SMS_OUTGOING_CHECK_MAX_COUNT =
6224               "sms_outgoing_check_max_count";
6225
6226       /**
6227        * Used to disable SMS short code confirmation - defaults to true.
6228        * True indcates we will do the check, etc.  Set to false to disable.
6229        * @see com.android.internal.telephony.SmsUsageMonitor
6230        * @hide
6231        */
6232       public static final String SMS_SHORT_CODE_CONFIRMATION = "sms_short_code_confirmation";
6233
6234        /**
6235         * Used to select which country we use to determine premium sms codes.
6236         * One of com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_SIM,
6237         * com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_NETWORK,
6238         * or com.android.internal.telephony.SMSDispatcher.PREMIUM_RULE_USE_BOTH.
6239         * @hide
6240         */
6241        public static final String SMS_SHORT_CODE_RULE = "sms_short_code_rule";
6242
6243       /**
6244        * Used to select TCP's default initial receiver window size in segments - defaults to a build config value
6245        * @hide
6246        */
6247       public static final String TCP_DEFAULT_INIT_RWND = "tcp_default_init_rwnd";
6248
6249       /**
6250        * Used to disable Tethering on a device - defaults to true
6251        * @hide
6252        */
6253       public static final String TETHER_SUPPORTED = "tether_supported";
6254
6255       /**
6256        * Used to require DUN APN on the device or not - defaults to a build config value
6257        * which defaults to false
6258        * @hide
6259        */
6260       public static final String TETHER_DUN_REQUIRED = "tether_dun_required";
6261
6262       /**
6263        * Used to hold a gservices-provisioned apn value for DUN.  If set, or the
6264        * corresponding build config values are set it will override the APN DB
6265        * values.
6266        * Consists of a comma seperated list of strings:
6267        * "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type"
6268        * note that empty fields can be ommitted: "name,apn,,,,,,,,,310,260,,DUN"
6269        * @hide
6270        */
6271       public static final String TETHER_DUN_APN = "tether_dun_apn";
6272
6273       /**
6274        * USB Mass Storage Enabled
6275        */
6276       public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
6277
6278       /**
6279        * If this setting is set (to anything), then all references
6280        * to Gmail on the device must change to Google Mail.
6281        */
6282       public static final String USE_GOOGLE_MAIL = "use_google_mail";
6283
6284        /**
6285         * Webview Data reduction proxy key.
6286         * @hide
6287         */
6288        public static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY =
6289                "webview_data_reduction_proxy_key";
6290
6291       /**
6292        * Whether Wifi display is enabled/disabled
6293        * 0=disabled. 1=enabled.
6294        * @hide
6295        */
6296       public static final String WIFI_DISPLAY_ON = "wifi_display_on";
6297
6298       /**
6299        * Whether Wifi display certification mode is enabled/disabled
6300        * 0=disabled. 1=enabled.
6301        * @hide
6302        */
6303       public static final String WIFI_DISPLAY_CERTIFICATION_ON =
6304               "wifi_display_certification_on";
6305
6306       /**
6307        * WPS Configuration method used by Wifi display, this setting only
6308        * takes effect when WIFI_DISPLAY_CERTIFICATION_ON is 1 (enabled).
6309        *
6310        * Possible values are:
6311        *
6312        * WpsInfo.INVALID: use default WPS method chosen by framework
6313        * WpsInfo.PBC    : use Push button
6314        * WpsInfo.KEYPAD : use Keypad
6315        * WpsInfo.DISPLAY: use Display
6316        * @hide
6317        */
6318       public static final String WIFI_DISPLAY_WPS_CONFIG =
6319           "wifi_display_wps_config";
6320
6321       /**
6322        * Whether to notify the user of open networks.
6323        * <p>
6324        * If not connected and the scan results have an open network, we will
6325        * put this notification up. If we attempt to connect to a network or
6326        * the open network(s) disappear, we remove the notification. When we
6327        * show the notification, we will not show it again for
6328        * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
6329        */
6330       public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
6331               "wifi_networks_available_notification_on";
6332       /**
6333        * {@hide}
6334        */
6335       public static final String WIMAX_NETWORKS_AVAILABLE_NOTIFICATION_ON =
6336               "wimax_networks_available_notification_on";
6337
6338       /**
6339        * Delay (in seconds) before repeating the Wi-Fi networks available notification.
6340        * Connecting to a network will reset the timer.
6341        */
6342       public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
6343               "wifi_networks_available_repeat_delay";
6344
6345       /**
6346        * 802.11 country code in ISO 3166 format
6347        * @hide
6348        */
6349       public static final String WIFI_COUNTRY_CODE = "wifi_country_code";
6350
6351       /**
6352        * The interval in milliseconds to issue wake up scans when wifi needs
6353        * to connect. This is necessary to connect to an access point when
6354        * device is on the move and the screen is off.
6355        * @hide
6356        */
6357       public static final String WIFI_FRAMEWORK_SCAN_INTERVAL_MS =
6358               "wifi_framework_scan_interval_ms";
6359
6360       /**
6361        * The interval in milliseconds after which Wi-Fi is considered idle.
6362        * When idle, it is possible for the device to be switched from Wi-Fi to
6363        * the mobile data network.
6364        * @hide
6365        */
6366       public static final String WIFI_IDLE_MS = "wifi_idle_ms";
6367
6368       /**
6369        * When the number of open networks exceeds this number, the
6370        * least-recently-used excess networks will be removed.
6371        */
6372       public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
6373
6374       /**
6375        * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
6376        */
6377       public static final String WIFI_ON = "wifi_on";
6378
6379       /**
6380        * Setting to allow scans to be enabled even wifi is turned off for connectivity.
6381        * @hide
6382        */
6383       public static final String WIFI_SCAN_ALWAYS_AVAILABLE =
6384                "wifi_scan_always_enabled";
6385
6386       /**
6387        * Settings to allow BLE scans to be enabled even when Bluetooth is turned off for
6388        * connectivity.
6389        * @hide
6390        */
6391       public static final String BLE_SCAN_ALWAYS_AVAILABLE =
6392               "ble_scan_always_enabled";
6393
6394       /**
6395        * Used to save the Wifi_ON state prior to tethering.
6396        * This state will be checked to restore Wifi after
6397        * the user turns off tethering.
6398        *
6399        * @hide
6400        */
6401       public static final String WIFI_SAVED_STATE = "wifi_saved_state";
6402
6403       /**
6404        * The interval in milliseconds to scan as used by the wifi supplicant
6405        * @hide
6406        */
6407       public static final String WIFI_SUPPLICANT_SCAN_INTERVAL_MS =
6408               "wifi_supplicant_scan_interval_ms";
6409
6410        /**
6411         * whether frameworks handles wifi auto-join
6412         * @hide
6413         */
6414       public static final String WIFI_ENHANCED_AUTO_JOIN =
6415                "wifi_enhanced_auto_join";
6416
6417        /**
6418         * whether settings show RSSI
6419         * @hide
6420         */
6421        public static final String WIFI_NETWORK_SHOW_RSSI =
6422                "wifi_network_show_rssi";
6423
6424        /**
6425        * The interval in milliseconds to scan at supplicant when p2p is connected
6426        * @hide
6427        */
6428       public static final String WIFI_SCAN_INTERVAL_WHEN_P2P_CONNECTED_MS =
6429               "wifi_scan_interval_p2p_connected_ms";
6430
6431       /**
6432        * Whether the Wi-Fi watchdog is enabled.
6433        */
6434       public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
6435
6436       /**
6437        * Setting to turn off poor network avoidance on Wi-Fi. Feature is enabled by default and
6438        * the setting needs to be set to 0 to disable it.
6439        * @hide
6440        */
6441       public static final String WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED =
6442               "wifi_watchdog_poor_network_test_enabled";
6443
6444       /**
6445        * Setting to turn on suspend optimizations at screen off on Wi-Fi. Enabled by default and
6446        * needs to be set to 0 to disable it.
6447        * @hide
6448        */
6449       public static final String WIFI_SUSPEND_OPTIMIZATIONS_ENABLED =
6450               "wifi_suspend_optimizations_enabled";
6451
6452       /**
6453        * The maximum number of times we will retry a connection to an access
6454        * point for which we have failed in acquiring an IP address from DHCP.
6455        * A value of N means that we will make N+1 connection attempts in all.
6456        */
6457       public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
6458
6459       /**
6460        * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
6461        * data connectivity to be established after a disconnect from Wi-Fi.
6462        */
6463       public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
6464           "wifi_mobile_data_transition_wakelock_timeout_ms";
6465
6466       /**
6467        * The operational wifi frequency band
6468        * Set to one of {@link WifiManager#WIFI_FREQUENCY_BAND_AUTO},
6469        * {@link WifiManager#WIFI_FREQUENCY_BAND_5GHZ} or
6470        * {@link WifiManager#WIFI_FREQUENCY_BAND_2GHZ}
6471        *
6472        * @hide
6473        */
6474       public static final String WIFI_FREQUENCY_BAND = "wifi_frequency_band";
6475
6476       /**
6477        * The Wi-Fi peer-to-peer device name
6478        * @hide
6479        */
6480       public static final String WIFI_P2P_DEVICE_NAME = "wifi_p2p_device_name";
6481
6482       /**
6483        * The min time between wifi disable and wifi enable
6484        * @hide
6485        */
6486       public static final String WIFI_REENABLE_DELAY_MS = "wifi_reenable_delay";
6487
6488       /**
6489        * Timeout for ephemeral networks when all known BSSIDs go out of range. We will disconnect
6490        * from an ephemeral network if there is no BSSID for that network with a non-null score that
6491        * has been seen in this time period.
6492        *
6493        * If this is less than or equal to zero, we use a more conservative behavior and only check
6494        * for a non-null score from the currently connected or target BSSID.
6495        * @hide
6496        */
6497       public static final String WIFI_EPHEMERAL_OUT_OF_RANGE_TIMEOUT_MS =
6498               "wifi_ephemeral_out_of_range_timeout_ms";
6499
6500       /**
6501        * The number of milliseconds to delay when checking for data stalls during
6502        * non-aggressive detection. (screen is turned off.)
6503        * @hide
6504        */
6505       public static final String DATA_STALL_ALARM_NON_AGGRESSIVE_DELAY_IN_MS =
6506               "data_stall_alarm_non_aggressive_delay_in_ms";
6507
6508       /**
6509        * The number of milliseconds to delay when checking for data stalls during
6510        * aggressive detection. (screen on or suspected data stall)
6511        * @hide
6512        */
6513       public static final String DATA_STALL_ALARM_AGGRESSIVE_DELAY_IN_MS =
6514               "data_stall_alarm_aggressive_delay_in_ms";
6515
6516       /**
6517        * The number of milliseconds to allow the provisioning apn to remain active
6518        * @hide
6519        */
6520       public static final String PROVISIONING_APN_ALARM_DELAY_IN_MS =
6521               "provisioning_apn_alarm_delay_in_ms";
6522
6523       /**
6524        * The interval in milliseconds at which to check gprs registration
6525        * after the first registration mismatch of gprs and voice service,
6526        * to detect possible data network registration problems.
6527        *
6528        * @hide
6529        */
6530       public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
6531               "gprs_register_check_period_ms";
6532
6533       /**
6534        * Nonzero causes Log.wtf() to crash.
6535        * @hide
6536        */
6537       public static final String WTF_IS_FATAL = "wtf_is_fatal";
6538
6539       /**
6540        * Ringer mode. This is used internally, changing this value will not
6541        * change the ringer mode. See AudioManager.
6542        */
6543       public static final String MODE_RINGER = "mode_ringer";
6544
6545       /**
6546        * Overlay display devices setting.
6547        * The associated value is a specially formatted string that describes the
6548        * size and density of simulated secondary display devices.
6549        * <p>
6550        * Format: {width}x{height}/{dpi};...
6551        * </p><p>
6552        * Example:
6553        * <ul>
6554        * <li><code>1280x720/213</code>: make one overlay that is 1280x720 at 213dpi.</li>
6555        * <li><code>1920x1080/320;1280x720/213</code>: make two overlays, the first
6556        * at 1080p and the second at 720p.</li>
6557        * <li>If the value is empty, then no overlay display devices are created.</li>
6558        * </ul></p>
6559        *
6560        * @hide
6561        */
6562       public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
6563
6564        /**
6565         * Threshold values for the duration and level of a discharge cycle,
6566         * under which we log discharge cycle info.
6567         *
6568         * @hide
6569         */
6570        public static final String
6571                BATTERY_DISCHARGE_DURATION_THRESHOLD = "battery_discharge_duration_threshold";
6572
6573        /** @hide */
6574        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
6575
6576        /**
6577         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR
6578         * intents on application crashes and ANRs. If this is disabled, the
6579         * crash/ANR dialog will never display the "Report" button.
6580         * <p>
6581         * Type: int (0 = disallow, 1 = allow)
6582         *
6583         * @hide
6584         */
6585        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
6586
6587        /**
6588         * Maximum age of entries kept by {@link DropBoxManager}.
6589         *
6590         * @hide
6591         */
6592        public static final String DROPBOX_AGE_SECONDS = "dropbox_age_seconds";
6593
6594        /**
6595         * Maximum number of entry files which {@link DropBoxManager} will keep
6596         * around.
6597         *
6598         * @hide
6599         */
6600        public static final String DROPBOX_MAX_FILES = "dropbox_max_files";
6601
6602        /**
6603         * Maximum amount of disk space used by {@link DropBoxManager} no matter
6604         * what.
6605         *
6606         * @hide
6607         */
6608        public static final String DROPBOX_QUOTA_KB = "dropbox_quota_kb";
6609
6610        /**
6611         * Percent of free disk (excluding reserve) which {@link DropBoxManager}
6612         * will use.
6613         *
6614         * @hide
6615         */
6616        public static final String DROPBOX_QUOTA_PERCENT = "dropbox_quota_percent";
6617
6618        /**
6619         * Percent of total disk which {@link DropBoxManager} will never dip
6620         * into.
6621         *
6622         * @hide
6623         */
6624        public static final String DROPBOX_RESERVE_PERCENT = "dropbox_reserve_percent";
6625
6626        /**
6627         * Prefix for per-tag dropbox disable/enable settings.
6628         *
6629         * @hide
6630         */
6631        public static final String DROPBOX_TAG_PREFIX = "dropbox:";
6632
6633        /**
6634         * Lines of logcat to include with system crash/ANR/etc. reports, as a
6635         * prefix of the dropbox tag of the report type. For example,
6636         * "logcat_for_system_server_anr" controls the lines of logcat captured
6637         * with system server ANR reports. 0 to disable.
6638         *
6639         * @hide
6640         */
6641        public static final String ERROR_LOGCAT_PREFIX = "logcat_for_";
6642
6643        /**
6644         * The interval in minutes after which the amount of free storage left
6645         * on the device is logged to the event log
6646         *
6647         * @hide
6648         */
6649        public static final String SYS_FREE_STORAGE_LOG_INTERVAL = "sys_free_storage_log_interval";
6650
6651        /**
6652         * Threshold for the amount of change in disk free space required to
6653         * report the amount of free space. Used to prevent spamming the logs
6654         * when the disk free space isn't changing frequently.
6655         *
6656         * @hide
6657         */
6658        public static final String
6659                DISK_FREE_CHANGE_REPORTING_THRESHOLD = "disk_free_change_reporting_threshold";
6660
6661        /**
6662         * Minimum percentage of free storage on the device that is used to
6663         * determine if the device is running low on storage. The default is 10.
6664         * <p>
6665         * Say this value is set to 10, the device is considered running low on
6666         * storage if 90% or more of the device storage is filled up.
6667         *
6668         * @hide
6669         */
6670        public static final String
6671                SYS_STORAGE_THRESHOLD_PERCENTAGE = "sys_storage_threshold_percentage";
6672
6673        /**
6674         * Maximum byte size of the low storage threshold. This is to ensure
6675         * that {@link #SYS_STORAGE_THRESHOLD_PERCENTAGE} does not result in an
6676         * overly large threshold for large storage devices. Currently this must
6677         * be less than 2GB. This default is 500MB.
6678         *
6679         * @hide
6680         */
6681        public static final String
6682                SYS_STORAGE_THRESHOLD_MAX_BYTES = "sys_storage_threshold_max_bytes";
6683
6684        /**
6685         * Minimum bytes of free storage on the device before the data partition
6686         * is considered full. By default, 1 MB is reserved to avoid system-wide
6687         * SQLite disk full exceptions.
6688         *
6689         * @hide
6690         */
6691        public static final String
6692                SYS_STORAGE_FULL_THRESHOLD_BYTES = "sys_storage_full_threshold_bytes";
6693
6694        /**
6695         * The maximum reconnect delay for short network outages or when the
6696         * network is suspended due to phone use.
6697         *
6698         * @hide
6699         */
6700        public static final String
6701                SYNC_MAX_RETRY_DELAY_IN_SECONDS = "sync_max_retry_delay_in_seconds";
6702
6703        /**
6704         * The number of milliseconds to delay before sending out
6705         * {@link ConnectivityManager#CONNECTIVITY_ACTION} broadcasts. Ignored.
6706         *
6707         * @hide
6708         */
6709        public static final String CONNECTIVITY_CHANGE_DELAY = "connectivity_change_delay";
6710
6711
6712        /**
6713         * Network sampling interval, in seconds. We'll generate link information
6714         * about bytes/packets sent and error rates based on data sampled in this interval
6715         *
6716         * @hide
6717         */
6718
6719        public static final String CONNECTIVITY_SAMPLING_INTERVAL_IN_SECONDS =
6720                "connectivity_sampling_interval_in_seconds";
6721
6722        /**
6723         * The series of successively longer delays used in retrying to download PAC file.
6724         * Last delay is used between successful PAC downloads.
6725         *
6726         * @hide
6727         */
6728        public static final String PAC_CHANGE_DELAY = "pac_change_delay";
6729
6730        /**
6731         * Setting to turn off captive portal detection. Feature is enabled by
6732         * default and the setting needs to be set to 0 to disable it.
6733         *
6734         * @hide
6735         */
6736        public static final String
6737                CAPTIVE_PORTAL_DETECTION_ENABLED = "captive_portal_detection_enabled";
6738
6739        /**
6740         * The server used for captive portal detection upon a new conection. A
6741         * 204 response code from the server is used for validation.
6742         *
6743         * @hide
6744         */
6745        public static final String CAPTIVE_PORTAL_SERVER = "captive_portal_server";
6746
6747        /**
6748         * Whether network service discovery is enabled.
6749         *
6750         * @hide
6751         */
6752        public static final String NSD_ON = "nsd_on";
6753
6754        /**
6755         * Let user pick default install location.
6756         *
6757         * @hide
6758         */
6759        public static final String SET_INSTALL_LOCATION = "set_install_location";
6760
6761        /**
6762         * Default install location value.
6763         * 0 = auto, let system decide
6764         * 1 = internal
6765         * 2 = sdcard
6766         * @hide
6767         */
6768        public static final String DEFAULT_INSTALL_LOCATION = "default_install_location";
6769
6770        /**
6771         * ms during which to consume extra events related to Inet connection
6772         * condition after a transtion to fully-connected
6773         *
6774         * @hide
6775         */
6776        public static final String
6777                INET_CONDITION_DEBOUNCE_UP_DELAY = "inet_condition_debounce_up_delay";
6778
6779        /**
6780         * ms during which to consume extra events related to Inet connection
6781         * condtion after a transtion to partly-connected
6782         *
6783         * @hide
6784         */
6785        public static final String
6786                INET_CONDITION_DEBOUNCE_DOWN_DELAY = "inet_condition_debounce_down_delay";
6787
6788        /** {@hide} */
6789        public static final String
6790                READ_EXTERNAL_STORAGE_ENFORCED_DEFAULT = "read_external_storage_enforced_default";
6791
6792        /**
6793         * Host name and port for global http proxy. Uses ':' seperator for
6794         * between host and port.
6795         */
6796        public static final String HTTP_PROXY = "http_proxy";
6797
6798        /**
6799         * Host name for global http proxy. Set via ConnectivityManager.
6800         *
6801         * @hide
6802         */
6803        public static final String GLOBAL_HTTP_PROXY_HOST = "global_http_proxy_host";
6804
6805        /**
6806         * Integer host port for global http proxy. Set via ConnectivityManager.
6807         *
6808         * @hide
6809         */
6810        public static final String GLOBAL_HTTP_PROXY_PORT = "global_http_proxy_port";
6811
6812        /**
6813         * Exclusion list for global proxy. This string contains a list of
6814         * comma-separated domains where the global proxy does not apply.
6815         * Domains should be listed in a comma- separated list. Example of
6816         * acceptable formats: ".domain1.com,my.domain2.com" Use
6817         * ConnectivityManager to set/get.
6818         *
6819         * @hide
6820         */
6821        public static final String
6822                GLOBAL_HTTP_PROXY_EXCLUSION_LIST = "global_http_proxy_exclusion_list";
6823
6824        /**
6825         * The location PAC File for the proxy.
6826         * @hide
6827         */
6828        public static final String
6829                GLOBAL_HTTP_PROXY_PAC = "global_proxy_pac_url";
6830
6831        /**
6832         * Enables the UI setting to allow the user to specify the global HTTP
6833         * proxy and associated exclusion list.
6834         *
6835         * @hide
6836         */
6837        public static final String SET_GLOBAL_HTTP_PROXY = "set_global_http_proxy";
6838
6839        /**
6840         * Setting for default DNS in case nobody suggests one
6841         *
6842         * @hide
6843         */
6844        public static final String DEFAULT_DNS_SERVER = "default_dns_server";
6845
6846        /** {@hide} */
6847        public static final String
6848                BLUETOOTH_HEADSET_PRIORITY_PREFIX = "bluetooth_headset_priority_";
6849        /** {@hide} */
6850        public static final String
6851                BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX = "bluetooth_a2dp_sink_priority_";
6852        /** {@hide} */
6853        public static final String
6854                BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX = "bluetooth_input_device_priority_";
6855        /** {@hide} */
6856        public static final String
6857                BLUETOOTH_MAP_PRIORITY_PREFIX = "bluetooth_map_priority_";
6858
6859        /**
6860         * Get the key that retrieves a bluetooth headset's priority.
6861         * @hide
6862         */
6863        public static final String getBluetoothHeadsetPriorityKey(String address) {
6864            return BLUETOOTH_HEADSET_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
6865        }
6866
6867        /**
6868         * Get the key that retrieves a bluetooth a2dp sink's priority.
6869         * @hide
6870         */
6871        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
6872            return BLUETOOTH_A2DP_SINK_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
6873        }
6874
6875        /**
6876         * Get the key that retrieves a bluetooth Input Device's priority.
6877         * @hide
6878         */
6879        public static final String getBluetoothInputDevicePriorityKey(String address) {
6880            return BLUETOOTH_INPUT_DEVICE_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
6881        }
6882
6883        /**
6884         * Get the key that retrieves a bluetooth map priority.
6885         * @hide
6886         */
6887        public static final String getBluetoothMapPriorityKey(String address) {
6888            return BLUETOOTH_MAP_PRIORITY_PREFIX + address.toUpperCase(Locale.ROOT);
6889        }
6890        /**
6891         * Scaling factor for normal window animations. Setting to 0 will
6892         * disable window animations.
6893         */
6894        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
6895
6896        /**
6897         * Scaling factor for activity transition animations. Setting to 0 will
6898         * disable window animations.
6899         */
6900        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
6901
6902        /**
6903         * Scaling factor for Animator-based animations. This affects both the
6904         * start delay and duration of all such animations. Setting to 0 will
6905         * cause animations to end immediately. The default value is 1.
6906         */
6907        public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
6908
6909        /**
6910         * Scaling factor for normal window animations. Setting to 0 will
6911         * disable window animations.
6912         *
6913         * @hide
6914         */
6915        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
6916
6917        /**
6918         * If 0, the compatibility mode is off for all applications.
6919         * If 1, older applications run under compatibility mode.
6920         * TODO: remove this settings before code freeze (bug/1907571)
6921         * @hide
6922         */
6923        public static final String COMPATIBILITY_MODE = "compatibility_mode";
6924
6925        /**
6926         * CDMA only settings
6927         * Emergency Tone  0 = Off
6928         *                 1 = Alert
6929         *                 2 = Vibrate
6930         * @hide
6931         */
6932        public static final String EMERGENCY_TONE = "emergency_tone";
6933
6934        /**
6935         * CDMA only settings
6936         * Whether the auto retry is enabled. The value is
6937         * boolean (1 or 0).
6938         * @hide
6939         */
6940        public static final String CALL_AUTO_RETRY = "call_auto_retry";
6941
6942        /**
6943         * See RIL_PreferredNetworkType in ril.h
6944         * @hide
6945         */
6946        public static final String PREFERRED_NETWORK_MODE =
6947                "preferred_network_mode";
6948
6949        /**
6950         * Setting to 1 will hide carrier network settings.
6951         * Default is 0.
6952         * @hide
6953         */
6954        public static final String HIDE_CARRIER_NETWORK_SETTINGS =
6955                "hide_carrier_network_settings";
6956
6957        /**
6958         * Name of an application package to be debugged.
6959         */
6960        public static final String DEBUG_APP = "debug_app";
6961
6962        /**
6963         * If 1, when launching DEBUG_APP it will wait for the debugger before
6964         * starting user code.  If 0, it will run normally.
6965         */
6966        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
6967
6968        /**
6969         * Control whether the process CPU usage meter should be shown.
6970         */
6971        public static final String SHOW_PROCESSES = "show_processes";
6972
6973        /**
6974         * If 1 low power mode is enabled.
6975         * @hide
6976         */
6977        public static final String LOW_POWER_MODE = "low_power";
6978
6979        /**
6980         * Battery level [1-99] at which low power mode automatically turns on.
6981         * If 0, it will not automatically turn on.
6982         * @hide
6983         */
6984        public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
6985
6986         /**
6987         * If 1, the activity manager will aggressively finish activities and
6988         * processes as soon as they are no longer needed.  If 0, the normal
6989         * extended lifetime is used.
6990         */
6991        public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
6992
6993        /**
6994         * Use Dock audio output for media:
6995         *      0 = disabled
6996         *      1 = enabled
6997         * @hide
6998         */
6999        public static final String DOCK_AUDIO_MEDIA_ENABLED = "dock_audio_media_enabled";
7000
7001        /**
7002         * Persisted safe headphone volume management state by AudioService
7003         * @hide
7004         */
7005        public static final String AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state";
7006
7007        /**
7008         * URL for tzinfo (time zone) updates
7009         * @hide
7010         */
7011        public static final String TZINFO_UPDATE_CONTENT_URL = "tzinfo_content_url";
7012
7013        /**
7014         * URL for tzinfo (time zone) update metadata
7015         * @hide
7016         */
7017        public static final String TZINFO_UPDATE_METADATA_URL = "tzinfo_metadata_url";
7018
7019        /**
7020         * URL for selinux (mandatory access control) updates
7021         * @hide
7022         */
7023        public static final String SELINUX_UPDATE_CONTENT_URL = "selinux_content_url";
7024
7025        /**
7026         * URL for selinux (mandatory access control) update metadata
7027         * @hide
7028         */
7029        public static final String SELINUX_UPDATE_METADATA_URL = "selinux_metadata_url";
7030
7031        /**
7032         * URL for sms short code updates
7033         * @hide
7034         */
7035        public static final String SMS_SHORT_CODES_UPDATE_CONTENT_URL =
7036                "sms_short_codes_content_url";
7037
7038        /**
7039         * URL for sms short code update metadata
7040         * @hide
7041         */
7042        public static final String SMS_SHORT_CODES_UPDATE_METADATA_URL =
7043                "sms_short_codes_metadata_url";
7044
7045        /**
7046         * URL for cert pinlist updates
7047         * @hide
7048         */
7049        public static final String CERT_PIN_UPDATE_CONTENT_URL = "cert_pin_content_url";
7050
7051        /**
7052         * URL for cert pinlist updates
7053         * @hide
7054         */
7055        public static final String CERT_PIN_UPDATE_METADATA_URL = "cert_pin_metadata_url";
7056
7057        /**
7058         * URL for intent firewall updates
7059         * @hide
7060         */
7061        public static final String INTENT_FIREWALL_UPDATE_CONTENT_URL =
7062                "intent_firewall_content_url";
7063
7064        /**
7065         * URL for intent firewall update metadata
7066         * @hide
7067         */
7068        public static final String INTENT_FIREWALL_UPDATE_METADATA_URL =
7069                "intent_firewall_metadata_url";
7070
7071        /**
7072         * SELinux enforcement status. If 0, permissive; if 1, enforcing.
7073         * @hide
7074         */
7075        public static final String SELINUX_STATUS = "selinux_status";
7076
7077        /**
7078         * Developer setting to force RTL layout.
7079         * @hide
7080         */
7081        public static final String DEVELOPMENT_FORCE_RTL = "debug.force_rtl";
7082
7083        /**
7084         * Milliseconds after screen-off after which low battery sounds will be silenced.
7085         *
7086         * If zero, battery sounds will always play.
7087         * Defaults to @integer/def_low_battery_sound_timeout in SettingsProvider.
7088         *
7089         * @hide
7090         */
7091        public static final String LOW_BATTERY_SOUND_TIMEOUT = "low_battery_sound_timeout";
7092
7093        /**
7094         * Milliseconds to wait before bouncing Wi-Fi after settings is restored. Note that after
7095         * the caller is done with this, they should call {@link ContentResolver#delete} to
7096         * clean up any value that they may have written.
7097         *
7098         * @hide
7099         */
7100        public static final String WIFI_BOUNCE_DELAY_OVERRIDE_MS = "wifi_bounce_delay_override_ms";
7101
7102        /**
7103         * Defines global runtime overrides to window policy.
7104         *
7105         * See {@link com.android.server.policy.PolicyControl} for value format.
7106         *
7107         * @hide
7108         */
7109        public static final String POLICY_CONTROL = "policy_control";
7110
7111        /**
7112         * Defines global zen mode.  ZEN_MODE_OFF, ZEN_MODE_IMPORTANT_INTERRUPTIONS,
7113         * or ZEN_MODE_NO_INTERRUPTIONS.
7114         *
7115         * @hide
7116         */
7117        public static final String ZEN_MODE = "zen_mode";
7118
7119        /** @hide */ public static final int ZEN_MODE_OFF = 0;
7120        /** @hide */ public static final int ZEN_MODE_IMPORTANT_INTERRUPTIONS = 1;
7121        /** @hide */ public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
7122        /** @hide */ public static final int ZEN_MODE_ALARMS = 3;
7123
7124        /** @hide */ public static String zenModeToString(int mode) {
7125            if (mode == ZEN_MODE_IMPORTANT_INTERRUPTIONS) return "ZEN_MODE_IMPORTANT_INTERRUPTIONS";
7126            if (mode == ZEN_MODE_ALARMS) return "ZEN_MODE_ALARMS";
7127            if (mode == ZEN_MODE_NO_INTERRUPTIONS) return "ZEN_MODE_NO_INTERRUPTIONS";
7128            return "ZEN_MODE_OFF";
7129        }
7130
7131        /**
7132         * Opaque value, changes when persisted zen mode configuration changes.
7133         *
7134         * @hide
7135         */
7136        public static final String ZEN_MODE_CONFIG_ETAG = "zen_mode_config_etag";
7137
7138        /**
7139         * Defines global heads up toggle.  One of HEADS_UP_OFF, HEADS_UP_ON.
7140         *
7141         * @hide
7142         */
7143        public static final String HEADS_UP_NOTIFICATIONS_ENABLED =
7144                "heads_up_notifications_enabled";
7145
7146        /** @hide */ public static final int HEADS_UP_OFF = 0;
7147        /** @hide */ public static final int HEADS_UP_ON = 1;
7148
7149        /**
7150         * The name of the device
7151         *
7152         * @hide
7153         */
7154        public static final String DEVICE_NAME = "device_name";
7155
7156        /**
7157         * Whether it should be possible to create a guest user on the device.
7158         * <p>
7159         * Type: int (0 for disabled, 1 for enabled)
7160         * @hide
7161         */
7162        public static final String GUEST_USER_ENABLED = "guest_user_enabled";
7163
7164        /**
7165         * Whether the NetworkScoringService has been first initialized.
7166         * <p>
7167         * Type: int (0 for false, 1 for true)
7168         * @hide
7169         */
7170        public static final String NETWORK_SCORING_PROVISIONED = "network_scoring_provisioned";
7171
7172        /**
7173         * Whether the user wants to be prompted for password to decrypt the device on boot.
7174         * This only matters if the storage is encrypted.
7175         * <p>
7176         * Type: int (0 for false, 1 for true)
7177         * @hide
7178         */
7179        public static final String REQUIRE_PASSWORD_TO_DECRYPT = "require_password_to_decrypt";
7180
7181        /**
7182         * Whether the Volte/VT is enabled
7183         * <p>
7184         * Type: int (0 for false, 1 for true)
7185         * @hide
7186         */
7187        public static final String ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled";
7188
7189        /**
7190         * Whether WFC is enabled
7191         * <p>
7192         * Type: int (0 for false, 1 for true)
7193         *
7194         * @hide
7195         */
7196        public static final String WFC_IMS_ENABLED = "wfc_ims_enabled";
7197
7198        /**
7199         * WFC Mode.
7200         * <p>
7201         * Type: int - 2=Wi-Fi preferred, 1=Cellular preferred, 0=Wi-Fi only
7202         *
7203         * @hide
7204         */
7205        public static final String WFC_IMS_MODE = "wfc_ims_mode";
7206
7207        /**
7208         * Whether WFC roaming is enabled
7209         * <p>
7210         * Type: int (0 for false, 1 for true)
7211         *
7212         * @hide
7213         */
7214        public static final String WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled";
7215
7216        /**
7217         * Global override to disable VoLTE (independent of user setting)
7218         * <p>
7219         * Type: int (1 for disable VoLTE, 0 to use user configuration)
7220         * @hide
7221         */
7222        public static final String VOLTE_FEATURE_DISABLED = "volte_feature_disabled";
7223
7224        /**
7225         * Whether user can enable/disable LTE as a preferred network. A carrier might control
7226         * this via gservices, OMA-DM, carrier app, etc.
7227         * <p>
7228         * Type: int (0 for false, 1 for true)
7229         * @hide
7230         */
7231        public static final String LTE_SERVICE_FORCED = "lte_service_forced";
7232
7233        /**
7234         * Settings to backup. This is here so that it's in the same place as the settings
7235         * keys and easy to update.
7236         *
7237         * These keys may be mentioned in the SETTINGS_TO_BACKUP arrays in System
7238         * and Secure as well.  This is because those tables drive both backup and
7239         * restore, and restore needs to properly whitelist keys that used to live
7240         * in those namespaces.  The keys will only actually be backed up / restored
7241         * if they are also mentioned in this table (Global.SETTINGS_TO_BACKUP).
7242         *
7243         * NOTE: Settings are backed up and restored in the order they appear
7244         *       in this array. If you have one setting depending on another,
7245         *       make sure that they are ordered appropriately.
7246         *
7247         * @hide
7248         */
7249        public static final String[] SETTINGS_TO_BACKUP = {
7250            BUGREPORT_IN_POWER_MENU,
7251            STAY_ON_WHILE_PLUGGED_IN,
7252            AUTO_TIME,
7253            AUTO_TIME_ZONE,
7254            POWER_SOUNDS_ENABLED,
7255            DOCK_SOUNDS_ENABLED,
7256            USB_MASS_STORAGE_ENABLED,
7257            ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
7258            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
7259            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
7260            WIFI_WATCHDOG_POOR_NETWORK_TEST_ENABLED,
7261            WIFI_NUM_OPEN_NETWORKS_KEPT,
7262            EMERGENCY_TONE,
7263            CALL_AUTO_RETRY,
7264            DOCK_AUDIO_MEDIA_ENABLED,
7265            LOW_POWER_MODE_TRIGGER_LEVEL
7266        };
7267
7268        // Populated lazily, guarded by class object:
7269        private static NameValueCache sNameValueCache = new NameValueCache(
7270                    SYS_PROP_SETTING_VERSION,
7271                    CONTENT_URI,
7272                    CALL_METHOD_GET_GLOBAL,
7273                    CALL_METHOD_PUT_GLOBAL);
7274
7275        // Certain settings have been moved from global to the per-user secure namespace
7276        private static final HashSet<String> MOVED_TO_SECURE;
7277        static {
7278            MOVED_TO_SECURE = new HashSet<String>(1);
7279            MOVED_TO_SECURE.add(Settings.Global.INSTALL_NON_MARKET_APPS);
7280        }
7281
7282        /** @hide */
7283        public static void getMovedToSecureSettings(Set<String> outKeySet) {
7284            outKeySet.addAll(MOVED_TO_SECURE);
7285        }
7286
7287        /**
7288         * Look up a name in the database.
7289         * @param resolver to access the database with
7290         * @param name to look up in the table
7291         * @return the corresponding value, or null if not present
7292         */
7293        public static String getString(ContentResolver resolver, String name) {
7294            return getStringForUser(resolver, name, UserHandle.myUserId());
7295        }
7296
7297        /** @hide */
7298        public static String getStringForUser(ContentResolver resolver, String name,
7299                int userHandle) {
7300            if (MOVED_TO_SECURE.contains(name)) {
7301                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
7302                        + " to android.provider.Settings.Secure, returning read-only value.");
7303                return Secure.getStringForUser(resolver, name, userHandle);
7304            }
7305            return sNameValueCache.getStringForUser(resolver, name, userHandle);
7306        }
7307
7308        /**
7309         * Store a name/value pair into the database.
7310         * @param resolver to access the database with
7311         * @param name to store
7312         * @param value to associate with the name
7313         * @return true if the value was set, false on database errors
7314         */
7315        public static boolean putString(ContentResolver resolver,
7316                String name, String value) {
7317            return putStringForUser(resolver, name, value, UserHandle.myUserId());
7318        }
7319
7320        /** @hide */
7321        public static boolean putStringForUser(ContentResolver resolver,
7322                String name, String value, int userHandle) {
7323            if (LOCAL_LOGV) {
7324                Log.v(TAG, "Global.putString(name=" + name + ", value=" + value
7325                        + " for " + userHandle);
7326            }
7327            // Global and Secure have the same access policy so we can forward writes
7328            if (MOVED_TO_SECURE.contains(name)) {
7329                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Global"
7330                        + " to android.provider.Settings.Secure, value is unchanged.");
7331                return Secure.putStringForUser(resolver, name, value, userHandle);
7332            }
7333            return sNameValueCache.putStringForUser(resolver, name, value, userHandle);
7334        }
7335
7336        /**
7337         * Construct the content URI for a particular name/value pair,
7338         * useful for monitoring changes with a ContentObserver.
7339         * @param name to look up in the table
7340         * @return the corresponding content URI, or null if not present
7341         */
7342        public static Uri getUriFor(String name) {
7343            return getUriFor(CONTENT_URI, name);
7344        }
7345
7346        /**
7347         * Convenience function for retrieving a single secure settings value
7348         * as an integer.  Note that internally setting values are always
7349         * stored as strings; this function converts the string to an integer
7350         * for you.  The default value will be returned if the setting is
7351         * not defined or not an integer.
7352         *
7353         * @param cr The ContentResolver to access.
7354         * @param name The name of the setting to retrieve.
7355         * @param def Value to return if the setting is not defined.
7356         *
7357         * @return The setting's current value, or 'def' if it is not defined
7358         * or not a valid integer.
7359         */
7360        public static int getInt(ContentResolver cr, String name, int def) {
7361            String v = getString(cr, name);
7362            try {
7363                return v != null ? Integer.parseInt(v) : def;
7364            } catch (NumberFormatException e) {
7365                return def;
7366            }
7367        }
7368
7369        /**
7370         * Convenience function for retrieving a single secure settings value
7371         * as an integer.  Note that internally setting values are always
7372         * stored as strings; this function converts the string to an integer
7373         * for you.
7374         * <p>
7375         * This version does not take a default value.  If the setting has not
7376         * been set, or the string value is not a number,
7377         * it throws {@link SettingNotFoundException}.
7378         *
7379         * @param cr The ContentResolver to access.
7380         * @param name The name of the setting to retrieve.
7381         *
7382         * @throws SettingNotFoundException Thrown if a setting by the given
7383         * name can't be found or the setting value is not an integer.
7384         *
7385         * @return The setting's current value.
7386         */
7387        public static int getInt(ContentResolver cr, String name)
7388                throws SettingNotFoundException {
7389            String v = getString(cr, name);
7390            try {
7391                return Integer.parseInt(v);
7392            } catch (NumberFormatException e) {
7393                throw new SettingNotFoundException(name);
7394            }
7395        }
7396
7397        /**
7398         * Convenience function for updating a single settings value as an
7399         * integer. This will either create a new entry in the table if the
7400         * given name does not exist, or modify the value of the existing row
7401         * with that name.  Note that internally setting values are always
7402         * stored as strings, so this function converts the given value to a
7403         * string before storing it.
7404         *
7405         * @param cr The ContentResolver to access.
7406         * @param name The name of the setting to modify.
7407         * @param value The new value for the setting.
7408         * @return true if the value was set, false on database errors
7409         */
7410        public static boolean putInt(ContentResolver cr, String name, int value) {
7411            return putString(cr, name, Integer.toString(value));
7412        }
7413
7414        /**
7415         * Convenience function for retrieving a single secure settings value
7416         * as a {@code long}.  Note that internally setting values are always
7417         * stored as strings; this function converts the string to a {@code long}
7418         * for you.  The default value will be returned if the setting is
7419         * not defined or not a {@code long}.
7420         *
7421         * @param cr The ContentResolver to access.
7422         * @param name The name of the setting to retrieve.
7423         * @param def Value to return if the setting is not defined.
7424         *
7425         * @return The setting's current value, or 'def' if it is not defined
7426         * or not a valid {@code long}.
7427         */
7428        public static long getLong(ContentResolver cr, String name, long def) {
7429            String valString = getString(cr, name);
7430            long value;
7431            try {
7432                value = valString != null ? Long.parseLong(valString) : def;
7433            } catch (NumberFormatException e) {
7434                value = def;
7435            }
7436            return value;
7437        }
7438
7439        /**
7440         * Convenience function for retrieving a single secure settings value
7441         * as a {@code long}.  Note that internally setting values are always
7442         * stored as strings; this function converts the string to a {@code long}
7443         * for you.
7444         * <p>
7445         * This version does not take a default value.  If the setting has not
7446         * been set, or the string value is not a number,
7447         * it throws {@link SettingNotFoundException}.
7448         *
7449         * @param cr The ContentResolver to access.
7450         * @param name The name of the setting to retrieve.
7451         *
7452         * @return The setting's current value.
7453         * @throws SettingNotFoundException Thrown if a setting by the given
7454         * name can't be found or the setting value is not an integer.
7455         */
7456        public static long getLong(ContentResolver cr, String name)
7457                throws SettingNotFoundException {
7458            String valString = getString(cr, name);
7459            try {
7460                return Long.parseLong(valString);
7461            } catch (NumberFormatException e) {
7462                throw new SettingNotFoundException(name);
7463            }
7464        }
7465
7466        /**
7467         * Convenience function for updating a secure settings value as a long
7468         * integer. This will either create a new entry in the table if the
7469         * given name does not exist, or modify the value of the existing row
7470         * with that name.  Note that internally setting values are always
7471         * stored as strings, so this function converts the given value to a
7472         * string before storing it.
7473         *
7474         * @param cr The ContentResolver to access.
7475         * @param name The name of the setting to modify.
7476         * @param value The new value for the setting.
7477         * @return true if the value was set, false on database errors
7478         */
7479        public static boolean putLong(ContentResolver cr, String name, long value) {
7480            return putString(cr, name, Long.toString(value));
7481        }
7482
7483        /**
7484         * Convenience function for retrieving a single secure settings value
7485         * as a floating point number.  Note that internally setting values are
7486         * always stored as strings; this function converts the string to an
7487         * float for you. The default value will be returned if the setting
7488         * is not defined or not a valid float.
7489         *
7490         * @param cr The ContentResolver to access.
7491         * @param name The name of the setting to retrieve.
7492         * @param def Value to return if the setting is not defined.
7493         *
7494         * @return The setting's current value, or 'def' if it is not defined
7495         * or not a valid float.
7496         */
7497        public static float getFloat(ContentResolver cr, String name, float def) {
7498            String v = getString(cr, name);
7499            try {
7500                return v != null ? Float.parseFloat(v) : def;
7501            } catch (NumberFormatException e) {
7502                return def;
7503            }
7504        }
7505
7506        /**
7507         * Convenience function for retrieving a single secure settings value
7508         * as a float.  Note that internally setting values are always
7509         * stored as strings; this function converts the string to a float
7510         * for you.
7511         * <p>
7512         * This version does not take a default value.  If the setting has not
7513         * been set, or the string value is not a number,
7514         * it throws {@link SettingNotFoundException}.
7515         *
7516         * @param cr The ContentResolver to access.
7517         * @param name The name of the setting to retrieve.
7518         *
7519         * @throws SettingNotFoundException Thrown if a setting by the given
7520         * name can't be found or the setting value is not a float.
7521         *
7522         * @return The setting's current value.
7523         */
7524        public static float getFloat(ContentResolver cr, String name)
7525                throws SettingNotFoundException {
7526            String v = getString(cr, name);
7527            if (v == null) {
7528                throw new SettingNotFoundException(name);
7529            }
7530            try {
7531                return Float.parseFloat(v);
7532            } catch (NumberFormatException e) {
7533                throw new SettingNotFoundException(name);
7534            }
7535        }
7536
7537        /**
7538         * Convenience function for updating a single settings value as a
7539         * floating point number. This will either create a new entry in the
7540         * table if the given name does not exist, or modify the value of the
7541         * existing row with that name.  Note that internally setting values
7542         * are always stored as strings, so this function converts the given
7543         * value to a string before storing it.
7544         *
7545         * @param cr The ContentResolver to access.
7546         * @param name The name of the setting to modify.
7547         * @param value The new value for the setting.
7548         * @return true if the value was set, false on database errors
7549         */
7550        public static boolean putFloat(ContentResolver cr, String name, float value) {
7551            return putString(cr, name, Float.toString(value));
7552        }
7553
7554
7555        /**
7556          * Subscription to be used for voice call on a multi sim device. The supported values
7557          * are 0 = SUB1, 1 = SUB2 and etc.
7558          * @hide
7559          */
7560        public static final String MULTI_SIM_VOICE_CALL_SUBSCRIPTION = "multi_sim_voice_call";
7561
7562        /**
7563          * Used to provide option to user to select subscription during dial.
7564          * The supported values are 0 = disable or 1 = enable prompt.
7565          * @hide
7566          */
7567        public static final String MULTI_SIM_VOICE_PROMPT = "multi_sim_voice_prompt";
7568
7569        /**
7570          * Subscription to be used for data call on a multi sim device. The supported values
7571          * are 0 = SUB1, 1 = SUB2 and etc.
7572          * @hide
7573          */
7574        public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";
7575
7576        /**
7577          * Subscription to be used for SMS on a multi sim device. The supported values
7578          * are 0 = SUB1, 1 = SUB2 and etc.
7579          * @hide
7580          */
7581        public static final String MULTI_SIM_SMS_SUBSCRIPTION = "multi_sim_sms";
7582
7583       /**
7584          * Used to provide option to user to select subscription during send SMS.
7585          * The value 1 - enable, 0 - disable
7586          * @hide
7587          */
7588        public static final String MULTI_SIM_SMS_PROMPT = "multi_sim_sms_prompt";
7589
7590
7591
7592        /** User preferred subscriptions setting.
7593          * This holds the details of the user selected subscription from the card and
7594          * the activation status. Each settings string have the coma separated values
7595          * iccId,appType,appId,activationStatus,3gppIndex,3gpp2Index
7596          * @hide
7597         */
7598        public static final String[] MULTI_SIM_USER_PREFERRED_SUBS = {"user_preferred_sub1",
7599                "user_preferred_sub2","user_preferred_sub3"};
7600    }
7601
7602    /**
7603     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
7604     * Intent URL, allowing it to be either a web page or a particular
7605     * application activity.
7606     *
7607     * @hide
7608     */
7609    public static final class Bookmarks implements BaseColumns
7610    {
7611        private static final String TAG = "Bookmarks";
7612
7613        /**
7614         * The content:// style URL for this table
7615         */
7616        public static final Uri CONTENT_URI =
7617            Uri.parse("content://" + AUTHORITY + "/bookmarks");
7618
7619        /**
7620         * The row ID.
7621         * <p>Type: INTEGER</p>
7622         */
7623        public static final String ID = "_id";
7624
7625        /**
7626         * Descriptive name of the bookmark that can be displayed to the user.
7627         * If this is empty, the title should be resolved at display time (use
7628         * {@link #getTitle(Context, Cursor)} any time you want to display the
7629         * title of a bookmark.)
7630         * <P>
7631         * Type: TEXT
7632         * </P>
7633         */
7634        public static final String TITLE = "title";
7635
7636        /**
7637         * Arbitrary string (displayed to the user) that allows bookmarks to be
7638         * organized into categories.  There are some special names for
7639         * standard folders, which all start with '@'.  The label displayed for
7640         * the folder changes with the locale (via {@link #getLabelForFolder}) but
7641         * the folder name does not change so you can consistently query for
7642         * the folder regardless of the current locale.
7643         *
7644         * <P>Type: TEXT</P>
7645         *
7646         */
7647        public static final String FOLDER = "folder";
7648
7649        /**
7650         * The Intent URL of the bookmark, describing what it points to.  This
7651         * value is given to {@link android.content.Intent#getIntent} to create
7652         * an Intent that can be launched.
7653         * <P>Type: TEXT</P>
7654         */
7655        public static final String INTENT = "intent";
7656
7657        /**
7658         * Optional shortcut character associated with this bookmark.
7659         * <P>Type: INTEGER</P>
7660         */
7661        public static final String SHORTCUT = "shortcut";
7662
7663        /**
7664         * The order in which the bookmark should be displayed
7665         * <P>Type: INTEGER</P>
7666         */
7667        public static final String ORDERING = "ordering";
7668
7669        private static final String[] sIntentProjection = { INTENT };
7670        private static final String[] sShortcutProjection = { ID, SHORTCUT };
7671        private static final String sShortcutSelection = SHORTCUT + "=?";
7672
7673        /**
7674         * Convenience function to retrieve the bookmarked Intent for a
7675         * particular shortcut key.
7676         *
7677         * @param cr The ContentResolver to query.
7678         * @param shortcut The shortcut key.
7679         *
7680         * @return Intent The bookmarked URL, or null if there is no bookmark
7681         *         matching the given shortcut.
7682         */
7683        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
7684        {
7685            Intent intent = null;
7686
7687            Cursor c = cr.query(CONTENT_URI,
7688                    sIntentProjection, sShortcutSelection,
7689                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
7690            // Keep trying until we find a valid shortcut
7691            try {
7692                while (intent == null && c.moveToNext()) {
7693                    try {
7694                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
7695                        intent = Intent.parseUri(intentURI, 0);
7696                    } catch (java.net.URISyntaxException e) {
7697                        // The stored URL is bad...  ignore it.
7698                    } catch (IllegalArgumentException e) {
7699                        // Column not found
7700                        Log.w(TAG, "Intent column not found", e);
7701                    }
7702                }
7703            } finally {
7704                if (c != null) c.close();
7705            }
7706
7707            return intent;
7708        }
7709
7710        /**
7711         * Add a new bookmark to the system.
7712         *
7713         * @param cr The ContentResolver to query.
7714         * @param intent The desired target of the bookmark.
7715         * @param title Bookmark title that is shown to the user; null if none
7716         *            or it should be resolved to the intent's title.
7717         * @param folder Folder in which to place the bookmark; null if none.
7718         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
7719         *            this is non-zero and there is an existing bookmark entry
7720         *            with this same shortcut, then that existing shortcut is
7721         *            cleared (the bookmark is not removed).
7722         * @return The unique content URL for the new bookmark entry.
7723         */
7724        public static Uri add(ContentResolver cr,
7725                                           Intent intent,
7726                                           String title,
7727                                           String folder,
7728                                           char shortcut,
7729                                           int ordering)
7730        {
7731            // If a shortcut is supplied, and it is already defined for
7732            // another bookmark, then remove the old definition.
7733            if (shortcut != 0) {
7734                cr.delete(CONTENT_URI, sShortcutSelection,
7735                        new String[] { String.valueOf((int) shortcut) });
7736            }
7737
7738            ContentValues values = new ContentValues();
7739            if (title != null) values.put(TITLE, title);
7740            if (folder != null) values.put(FOLDER, folder);
7741            values.put(INTENT, intent.toUri(0));
7742            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
7743            values.put(ORDERING, ordering);
7744            return cr.insert(CONTENT_URI, values);
7745        }
7746
7747        /**
7748         * Return the folder name as it should be displayed to the user.  This
7749         * takes care of localizing special folders.
7750         *
7751         * @param r Resources object for current locale; only need access to
7752         *          system resources.
7753         * @param folder The value found in the {@link #FOLDER} column.
7754         *
7755         * @return CharSequence The label for this folder that should be shown
7756         *         to the user.
7757         */
7758        public static CharSequence getLabelForFolder(Resources r, String folder) {
7759            return folder;
7760        }
7761
7762        /**
7763         * Return the title as it should be displayed to the user. This takes
7764         * care of localizing bookmarks that point to activities.
7765         *
7766         * @param context A context.
7767         * @param cursor A cursor pointing to the row whose title should be
7768         *        returned. The cursor must contain at least the {@link #TITLE}
7769         *        and {@link #INTENT} columns.
7770         * @return A title that is localized and can be displayed to the user,
7771         *         or the empty string if one could not be found.
7772         */
7773        public static CharSequence getTitle(Context context, Cursor cursor) {
7774            int titleColumn = cursor.getColumnIndex(TITLE);
7775            int intentColumn = cursor.getColumnIndex(INTENT);
7776            if (titleColumn == -1 || intentColumn == -1) {
7777                throw new IllegalArgumentException(
7778                        "The cursor must contain the TITLE and INTENT columns.");
7779            }
7780
7781            String title = cursor.getString(titleColumn);
7782            if (!TextUtils.isEmpty(title)) {
7783                return title;
7784            }
7785
7786            String intentUri = cursor.getString(intentColumn);
7787            if (TextUtils.isEmpty(intentUri)) {
7788                return "";
7789            }
7790
7791            Intent intent;
7792            try {
7793                intent = Intent.parseUri(intentUri, 0);
7794            } catch (URISyntaxException e) {
7795                return "";
7796            }
7797
7798            PackageManager packageManager = context.getPackageManager();
7799            ResolveInfo info = packageManager.resolveActivity(intent, 0);
7800            return info != null ? info.loadLabel(packageManager) : "";
7801        }
7802    }
7803
7804    /**
7805     * Returns the device ID that we should use when connecting to the mobile gtalk server.
7806     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
7807     * from the GoogleLoginService.
7808     *
7809     * @param androidId The Android ID for this device.
7810     * @return The device ID that should be used when connecting to the mobile gtalk server.
7811     * @hide
7812     */
7813    public static String getGTalkDeviceId(long androidId) {
7814        return "android-" + Long.toHexString(androidId);
7815    }
7816}
7817