Settings.java revision 42c4c589003c029309c823e8f06ed00b3cdb21de
1d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams/*
2d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * Copyright (C) 2006 The Android Open Source Project
3d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams *
4d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * Licensed under the Apache License, Version 2.0 (the "License");
5d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * you may not use this file except in compliance with the License.
6d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * You may obtain a copy of the License at
7d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams *
8d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams *      http://www.apache.org/licenses/LICENSE-2.0
9d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams *
10d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * Unless required by applicable law or agreed to in writing, software
11d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * distributed under the License is distributed on an "AS IS" BASIS,
12d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * See the License for the specific language governing permissions and
14d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * limitations under the License.
15d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams */
16d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
17f29ca50d80e3dc379de1642e85b7963175b2ca38Jason Samspackage android.provider;
18f29ca50d80e3dc379de1642e85b7963175b2ca38Jason Sams
19d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport com.google.android.collect.Maps;
20d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
21d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport org.apache.commons.codec.binary.Base64;
22d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
23d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.annotation.SdkConstant;
24d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.annotation.SdkConstant.SdkConstantType;
25d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.content.ContentQueryMap;
26d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.content.ContentResolver;
27d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.content.ContentValues;
28ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Samsimport android.content.Context;
29650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.content.Intent;
30650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.content.pm.PackageManager;
31650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.content.pm.ResolveInfo;
32650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.content.res.Configuration;
33ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Samsimport android.content.res.Resources;
34650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.database.Cursor;
35650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guyimport android.database.SQLException;
36f29ca50d80e3dc379de1642e85b7963175b2ca38Jason Samsimport android.net.Uri;
37d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.os.*;
38d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.telephony.TelephonyManager;
39d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.text.TextUtils;
40d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport android.util.AndroidException;
41e29d471e5ca9781d8772d445ec7832e94856fd14Jason Samsimport android.util.Config;
42e29d471e5ca9781d8772d445ec7832e94856fd14Jason Samsimport android.util.Log;
43d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
44d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.net.URISyntaxException;
45d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.security.MessageDigest;
46d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.security.NoSuchAlgorithmException;
47d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.util.Collections;
48d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.util.HashMap;
49d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.util.HashSet;
50d19f10d43aa400e1183aa21a97099d02074131a2Jason Samsimport java.util.Map;
51d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
52d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
53d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams/**
54d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams * The Settings provider contains global system-level device preferences.
55d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams */
56d19f10d43aa400e1183aa21a97099d02074131a2Jason Samspublic final class Settings {
57ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
58ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams    // Intent actions for Settings
5943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
60d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    /**
61ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * Activity Action: Show system settings.
62ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * <p>
63ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * Input: Nothing.
64ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * <p>
65ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * Output: nothing.
66d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
67d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
68d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
69ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
70ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams    /**
71ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams     * Activity Action: Show settings to allow configuration of APNs.
7243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
7343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
7443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
75d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: nothing.
76d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
77ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
78ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams    public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
79ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams
80ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams    /**
81ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * Activity Action: Show settings to allow configuration of current location
82ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * sources.
83ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams     * <p>
84d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
85d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
86d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
873eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * Input: Nothing.
883eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * <p>
893eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * Output: Nothing.
903eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     */
9107ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
923eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams    public static final String ACTION_LOCATION_SOURCE_SETTINGS =
933eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams            "android.settings.LOCATION_SOURCE_SETTINGS";
943eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams
95bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    /**
963eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * Activity Action: Show settings to allow configuration of wireless controls
973eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * such as Wi-Fi, Bluetooth and Mobile networks.
983eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * <p>
997ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
1007ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * safeguard against this.
1017ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * <p>
1027ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * Input: Nothing.
1037ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * <p>
1047ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     * Output: Nothing.
1057ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams     */
1067ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
107730ee65d4ddb307898053b623120bad1655fadadJason Sams    public static final String ACTION_WIRELESS_SETTINGS =
108730ee65d4ddb307898053b623120bad1655fadadJason Sams            "android.settings.WIRELESS_SETTINGS";
109730ee65d4ddb307898053b623120bad1655fadadJason Sams
110730ee65d4ddb307898053b623120bad1655fadadJason Sams    /**
111730ee65d4ddb307898053b623120bad1655fadadJason Sams     * Activity Action: Show settings to allow entering/exiting airplane mode.
112730ee65d4ddb307898053b623120bad1655fadadJason Sams     * <p>
113730ee65d4ddb307898053b623120bad1655fadadJason Sams     * In some cases, a matching Activity may not exist, so ensure you
114730ee65d4ddb307898053b623120bad1655fadadJason Sams     * safeguard against this.
115730ee65d4ddb307898053b623120bad1655fadadJason Sams     * <p>
1163eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * Input: Nothing.
11764676f3c21a07d650069315572811570cbf8f728Jason Sams     * <p>
11864676f3c21a07d650069315572811570cbf8f728Jason Sams     * Output: Nothing.
11964676f3c21a07d650069315572811570cbf8f728Jason Sams     */
12064676f3c21a07d650069315572811570cbf8f728Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
12164676f3c21a07d650069315572811570cbf8f728Jason Sams    public static final String ACTION_AIRPLANE_MODE_SETTINGS =
12264676f3c21a07d650069315572811570cbf8f728Jason Sams            "android.settings.AIRPLANE_MODE_SETTINGS";
12364676f3c21a07d650069315572811570cbf8f728Jason Sams
12464676f3c21a07d650069315572811570cbf8f728Jason Sams    /**
125bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams     * Activity Action: Show settings for accessibility modules.
12664676f3c21a07d650069315572811570cbf8f728Jason Sams     * <p>
12764676f3c21a07d650069315572811570cbf8f728Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
12864676f3c21a07d650069315572811570cbf8f728Jason Sams     * safeguard against this.
12964676f3c21a07d650069315572811570cbf8f728Jason Sams     * <p>
1303eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * Input: Nothing.
1313eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams     * <p>
132d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: Nothing.
133d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
134d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
135d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_ACCESSIBILITY_SETTINGS =
136d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "android.settings.ACCESSIBILITY_SETTINGS";
137d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
138d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    /**
139d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Activity Action: Show settings to allow configuration of security and
140d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * location privacy.
141d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
142d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
143d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
144d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
145d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
146ebfb436a49673693b98469683451bd9ede797557Jason Sams     * <p>
147ebfb436a49673693b98469683451bd9ede797557Jason Sams     * Output: Nothing.
148ebfb436a49673693b98469683451bd9ede797557Jason Sams     */
149ebfb436a49673693b98469683451bd9ede797557Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
150ebfb436a49673693b98469683451bd9ede797557Jason Sams    public static final String ACTION_SECURITY_SETTINGS =
151ebfb436a49673693b98469683451bd9ede797557Jason Sams            "android.settings.SECURITY_SETTINGS";
152ebfb436a49673693b98469683451bd9ede797557Jason Sams
153d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    /**
1543bc47d438171dce294e816366d53bc9eca772c5bJason Sams     * Activity Action: Show settings to allow configuration of privacy options.
155d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
156d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
1573bc47d438171dce294e816366d53bc9eca772c5bJason Sams     * safeguard against this.
158d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
159d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
160d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
1617d787b4722eaeb79cab42c36060336e092b77b5fJason Sams     * Output: Nothing.
1627d787b4722eaeb79cab42c36060336e092b77b5fJason Sams     */
1637d787b4722eaeb79cab42c36060336e092b77b5fJason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
1647d787b4722eaeb79cab42c36060336e092b77b5fJason Sams    public static final String ACTION_PRIVACY_SETTINGS =
1657d787b4722eaeb79cab42c36060336e092b77b5fJason Sams            "android.settings.PRIVACY_SETTINGS";
1667d787b4722eaeb79cab42c36060336e092b77b5fJason Sams
1677d787b4722eaeb79cab42c36060336e092b77b5fJason Sams    /**
1687d787b4722eaeb79cab42c36060336e092b77b5fJason Sams     * Activity Action: Show settings to allow configuration of Wi-Fi.
1697d787b4722eaeb79cab42c36060336e092b77b5fJason Sams
1707d787b4722eaeb79cab42c36060336e092b77b5fJason Sams     * <p>
1713bc47d438171dce294e816366d53bc9eca772c5bJason Sams     * In some cases, a matching Activity may not exist, so ensure you
172efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * safeguard against this.
173efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * <p>
1743bc47d438171dce294e816366d53bc9eca772c5bJason Sams     * Input: Nothing.
175efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * <p>
176efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * Output: Nothing.
177efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams
178efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     */
179efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
180efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams    public static final String ACTION_WIFI_SETTINGS =
181efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams            "android.settings.WIFI_SETTINGS";
182efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams
183efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams    /**
184efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * Activity Action: Show settings to allow configuration of a static IP
1853bc47d438171dce294e816366d53bc9eca772c5bJason Sams     * address for Wi-Fi.
186efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * <p>
187efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * In some cases, a matching Activity may not exist, so ensure you safeguard
188efd9b6fb2e0f31b50db089352118e5daeb268879Jason Sams     * against this.
189d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
190d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
191d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
192715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams     * Output: Nothing.
193d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
194d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
195715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams    public static final String ACTION_WIFI_IP_SETTINGS =
196715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams            "android.settings.WIFI_IP_SETTINGS";
197715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams
198715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams    /**
199715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams     * Activity Action: Show settings to allow configuration of Bluetooth.
200715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams     * <p>
201715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams     * In some cases, a matching Activity may not exist, so ensure you
202d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
203d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
20465e7aa56f56097418d617663683544c25b3988eaJason Sams     * Input: Nothing.
20565e7aa56f56097418d617663683544c25b3988eaJason Sams     * <p>
20665e7aa56f56097418d617663683544c25b3988eaJason Sams     * Output: Nothing.
20765e7aa56f56097418d617663683544c25b3988eaJason Sams     */
20865e7aa56f56097418d617663683544c25b3988eaJason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
20965e7aa56f56097418d617663683544c25b3988eaJason Sams    public static final String ACTION_BLUETOOTH_SETTINGS =
21065e7aa56f56097418d617663683544c25b3988eaJason Sams            "android.settings.BLUETOOTH_SETTINGS";
21165e7aa56f56097418d617663683544c25b3988eaJason Sams
21265e7aa56f56097418d617663683544c25b3988eaJason Sams    /**
21365e7aa56f56097418d617663683544c25b3988eaJason Sams     * Activity Action: Show settings to allow configuration of date and time.
21465e7aa56f56097418d617663683544c25b3988eaJason Sams     * <p>
21565e7aa56f56097418d617663683544c25b3988eaJason Sams     * In some cases, a matching Activity may not exist, so ensure you
21665e7aa56f56097418d617663683544c25b3988eaJason Sams     * safeguard against this.
21765e7aa56f56097418d617663683544c25b3988eaJason Sams     * <p>
21865e7aa56f56097418d617663683544c25b3988eaJason Sams     * Input: Nothing.
219516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
220516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Output: Nothing.
221516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     */
222516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
223516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    public static final String ACTION_DATE_SETTINGS =
224516c31911578db8ce53529483c3ded918ac7dc6bJason Sams            "android.settings.DATE_SETTINGS";
225516c31911578db8ce53529483c3ded918ac7dc6bJason Sams
226516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    /**
227516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Activity Action: Show settings to allow configuration of sound and volume.
228516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
229516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * In some cases, a matching Activity may not exist, so ensure you
230516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * safeguard against this.
231516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
232516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Input: Nothing.
233516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
234516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Output: Nothing.
235516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     */
236516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
237516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    public static final String ACTION_SOUND_SETTINGS =
238516c31911578db8ce53529483c3ded918ac7dc6bJason Sams            "android.settings.SOUND_SETTINGS";
239516c31911578db8ce53529483c3ded918ac7dc6bJason Sams
240516c31911578db8ce53529483c3ded918ac7dc6bJason Sams    /**
241516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Activity Action: Show settings to allow configuration of display.
242516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
243516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * In some cases, a matching Activity may not exist, so ensure you
244516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * safeguard against this.
245516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
246516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Input: Nothing.
247516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * <p>
248516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     * Output: Nothing.
249516c31911578db8ce53529483c3ded918ac7dc6bJason Sams     */
25065e7aa56f56097418d617663683544c25b3988eaJason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
251d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_DISPLAY_SETTINGS =
252d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "android.settings.DISPLAY_SETTINGS";
253d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
254d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    /**
255bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams     * Activity Action: Show settings to allow configuration of locale.
256d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
257d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
258d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
259d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
260768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams     * Input: Nothing.
261d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
262d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: Nothing.
26343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
26443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
26543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_LOCALE_SETTINGS =
26643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.LOCALE_SETTINGS";
267d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
268bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    /**
26943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings to configure input methods, in particular
27043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * allowing the user to enable input methods.
27143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
272d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
273d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
274d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
275d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
276d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
277d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: Nothing.
278d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
279bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
280d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_INPUT_METHOD_SETTINGS =
281d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "android.settings.INPUT_METHOD_SETTINGS";
282d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
283d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    /**
284d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Activity Action: Show settings to manage the user input dictionary.
285d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
286d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
287d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
288d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
289bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams     * Input: Nothing.
290d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
291d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: Nothing.
292d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
293d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
294d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_USER_DICTIONARY_SETTINGS =
295d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "android.settings.USER_DICTIONARY_SETTINGS";
296d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
297bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    /**
298d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Activity Action: Show settings to allow configuration of application-related settings.
299d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
300d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
301d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
302d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
303d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
304d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
305bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams     * Output: Nothing.
306d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
307d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
30843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_APPLICATION_SETTINGS =
30943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.APPLICATION_SETTINGS";
31043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
31143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
31243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings to allow configuration of application
31343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * development-related settings.
31443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
31543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you safeguard
31643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * against this.
31743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
31843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
31943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
32043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Output: Nothing.
32143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
32243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
32343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS =
32443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
32543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
32643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
32743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings to allow configuration of quick launch shortcuts.
32843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
32943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
33043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * safeguard against this.
33143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
3325f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Input: Nothing.
3335f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
3345f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Output: Nothing.
3355f43fd289abbd5380b6068766daf721b555d0053Jason Sams     */
3365f43fd289abbd5380b6068766daf721b555d0053Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
3375f43fd289abbd5380b6068766daf721b555d0053Jason Sams    public static final String ACTION_QUICK_LAUNCH_SETTINGS =
3385f43fd289abbd5380b6068766daf721b555d0053Jason Sams            "android.settings.QUICK_LAUNCH_SETTINGS";
3395f43fd289abbd5380b6068766daf721b555d0053Jason Sams
3405f43fd289abbd5380b6068766daf721b555d0053Jason Sams    /**
3415f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Activity Action: Show settings to manage installed applications.
3425f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
3435f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
3445f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * safeguard against this.
3455f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
3465f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Input: Nothing.
3475f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
3485f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Output: Nothing.
3495f43fd289abbd5380b6068766daf721b555d0053Jason Sams     */
3505f43fd289abbd5380b6068766daf721b555d0053Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
3515f43fd289abbd5380b6068766daf721b555d0053Jason Sams    public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS =
3525f43fd289abbd5380b6068766daf721b555d0053Jason Sams            "android.settings.MANAGE_APPLICATIONS_SETTINGS";
3535f43fd289abbd5380b6068766daf721b555d0053Jason Sams
3545f43fd289abbd5380b6068766daf721b555d0053Jason Sams    /**
3555f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Activity Action: Show settings for system update functionality.
35643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
35743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
35843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * safeguard against this.
35943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
3605f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Input: Nothing.
36143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
36243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Output: Nothing.
36343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     *
36443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * @hide
36543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
36643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
36743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_SYSTEM_UPDATE_SETTINGS =
36843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.SYSTEM_UPDATE_SETTINGS";
36943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
37043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
37143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings to allow configuration of sync settings.
37243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
37343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
37443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * safeguard against this.
37543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
37643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
37743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
37843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Output: Nothing.
37943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
38043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
38143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_SYNC_SETTINGS =
38243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.SYNC_SETTINGS";
38343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
38443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
38543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings for selecting the network operator.
38643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
38743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
38843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * safeguard against this.
38943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
39043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
39143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
39243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Output: Nothing.
39343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
39443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
39543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_NETWORK_OPERATOR_SETTINGS =
39643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.NETWORK_OPERATOR_SETTINGS";
39743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams
39843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
39943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings for selection of 2G/3G.
4005f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
40143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
40243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * safeguard against this.
40343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
40443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
4055f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
4065f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Output: Nothing.
4075f43fd289abbd5380b6068766daf721b555d0053Jason Sams     */
4085f43fd289abbd5380b6068766daf721b555d0053Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
4095f43fd289abbd5380b6068766daf721b555d0053Jason Sams    public static final String ACTION_DATA_ROAMING_SETTINGS =
4105f43fd289abbd5380b6068766daf721b555d0053Jason Sams            "android.settings.DATA_ROAMING_SETTINGS";
4115f43fd289abbd5380b6068766daf721b555d0053Jason Sams
4125f43fd289abbd5380b6068766daf721b555d0053Jason Sams    /**
4135f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * Activity Action: Show settings for internal storage.
4145f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * <p>
4155f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
4165f43fd289abbd5380b6068766daf721b555d0053Jason Sams     * safeguard against this.
41743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
41843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Input: Nothing.
41943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
42043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Output: Nothing.
42143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     */
42243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
42343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    public static final String ACTION_INTERNAL_STORAGE_SETTINGS =
42443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            "android.settings.INTERNAL_STORAGE_SETTINGS";
42543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams    /**
42643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * Activity Action: Show settings for memory card storage.
42743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams     * <p>
428d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * In some cases, a matching Activity may not exist, so ensure you
429d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * safeguard against this.
430d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
431d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Input: Nothing.
432d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * <p>
433d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     * Output: Nothing.
434d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams     */
435bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
436d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    public static final String ACTION_MEMORY_CARD_SETTINGS =
437d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "android.settings.MEMORY_CARD_SETTINGS";
438d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
439d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    // End of Intent actions for Settings
440d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
441d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    private static final String JID_RESOURCE_PREFIX = "android";
442d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
443bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams    public static final String AUTHORITY = "settings";
444d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
445d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams    private static final String TAG = "Settings";
44607ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams    private static final boolean LOCAL_LOGV = Config.LOGV || false;
44707ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams
44807ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams    public static class SettingNotFoundException extends AndroidException {
44907ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams        public SettingNotFoundException(String msg) {
45007ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams            super(msg);
45107ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams        }
45207ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams    }
45307ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams
454ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams    /**
455ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams     * Common base for tables of name/value settings.
456ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams     */
457ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams    public static class NameValueTable implements BaseColumns {
458ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams        public static final String NAME = "name";
459ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        public static final String VALUE = "value";
460ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams
461ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        protected static boolean putString(ContentResolver resolver, Uri uri,
462ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                String name, String value) {
463ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams            // The database will take care of replacing duplicates.
464ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams            try {
465ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                ContentValues values = new ContentValues();
466ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                values.put(NAME, name);
467ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                values.put(VALUE, value);
468ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                resolver.insert(uri, values);
469ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                return true;
470ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams            } catch (SQLException e) {
471ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                Log.w(TAG, "Can't set key " + name + " in " + uri, e);
472ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams                return false;
473ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams            }
474fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams        }
475ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
476fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams        public static Uri getUriFor(Uri uri, String name) {
477fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams            return Uri.withAppendedPath(uri, name);
478ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        }
479ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams    }
480ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
481ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams    private static class NameValueCache {
482fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams        private final String mVersionSystemProperty;
483ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams        private final Uri mUri;
484ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams
485ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        // Must synchronize(mValues) to access mValues and mValuesVersion.
486ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        private final HashMap<String, String> mValues = new HashMap<String, String>();
487ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        private long mValuesVersion = 0;
488ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
489ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams        public NameValueCache(String versionSystemProperty, Uri uri) {
490ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams            mVersionSystemProperty = versionSystemProperty;
491ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams            mUri = uri;
492ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        }
493ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams
494ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        public String getString(ContentResolver cr, String name) {
495fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams            long newValuesVersion = SystemProperties.getLong(mVersionSystemProperty, 0);
496b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams
497650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy            synchronized (mValues) {
498650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                if (mValuesVersion != newValuesVersion) {
499650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    if (LOCAL_LOGV) {
500650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                        Log.v(TAG, "invalidate [" + mUri.getLastPathSegment() + "]: current " +
501650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                                newValuesVersion + " != cached " + mValuesVersion);
502650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    }
503650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy
504650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    mValues.clear();
505650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    mValuesVersion = newValuesVersion;
506650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                }
507650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy
508ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                if (mValues.containsKey(name)) {
509650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    return mValues.get(name);  // Could be null, that's OK -- negative caching
510ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                }
511650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy            }
512650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy
513650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy            Cursor c = null;
514650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy            try {
515ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                c = cr.query(mUri, new String[] { Settings.NameValueTable.VALUE },
516650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                        Settings.NameValueTable.NAME + "=?", new String[]{name}, null);
517650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                if (c == null) {
518650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    Log.w(TAG, "Can't get key " + name + " from " + mUri);
519650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                    return null;
520650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                }
521650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy
522650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy                String value = c.moveToNext() ? c.getString(0) : null;
523b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                synchronized (mValues) {
524b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                    mValues.put(name, value);
525b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                }
526b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                if (LOCAL_LOGV) {
527b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                    Log.v(TAG, "cache miss [" + mUri.getLastPathSegment() + "]: " +
528b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                            name + " = " + (value == null ? "(null)" : value));
529b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                }
530b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                return value;
531ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams            } catch (SQLException e) {
532b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                Log.w(TAG, "Can't get key " + name + " from " + mUri, e);
533ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams                return null;  // Return null, but don't cache it.
534b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams            } finally {
535b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams                if (c != null) c.close();
536b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams            }
537b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams        }
538ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams    }
539b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams
540b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams    /**
541b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams     * System settings, containing miscellaneous system preferences.  This
542b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams     * table holds simple name/value pairs.  There are convenience
543b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams     * functions for accessing individual settings entries.
544b0ec1b46d6f5b5612e33fe43a828abea79b87a00Jason Sams     */
545fe08d99725efd0dde7ba67ff1979a04fec2ba99fJason Sams    public static final class System extends NameValueTable {
546d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_system_version";
547768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams
548d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        private static volatile NameValueCache mNameValueCache = null;
549d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
550d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        private static final HashSet<String> MOVED_TO_SECURE;
551768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams        static {
552d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE = new HashSet<String>(30);
553768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.ADB_ENABLED);
554d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.ANDROID_ID);
555d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.BLUETOOTH_ON);
556d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.DATA_ROAMING);
557d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.DEVICE_PROVISIONED);
558768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.HTTP_PROXY);
559d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.INSTALL_NON_MARKET_APPS);
560d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.LOCATION_PROVIDERS_ALLOWED);
561d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.LOGGING_ID);
562768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED);
563768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_LAST_UPDATE);
564768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_REDIRECT_URL);
565768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.SETTINGS_CLASSNAME);
566d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.USB_MASS_STORAGE_ENABLED);
567d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.USE_GOOGLE_MAIL);
568d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON);
569768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY);
570d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_NUM_OPEN_NETWORKS_KEPT);
571d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_ON);
572d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE);
573768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_AP_COUNT);
574768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS);
57507ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED);
576768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS);
577d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT);
578d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_MAX_AP_CHECKS);
579d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_ON);
58007ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_COUNT);
581d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_DELAY_MS);
582d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            MOVED_TO_SECURE.add(Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS);
583d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        }
584768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams
585d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
58607ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * Look up a name in the database.
587d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param resolver to access the database with
588d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name to look up in the table
589d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @return the corresponding value, or null if not present
590d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
59107ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams        public synchronized static String getString(ContentResolver resolver, String name) {
592d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            if (MOVED_TO_SECURE.contains(name)) {
593d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
594d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                        + " to android.provider.Settings.Secure, returning read-only value.");
595d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                return Secure.getString(resolver, name);
596d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            }
59707ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams            if (mNameValueCache == null) {
598d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
599d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            }
600d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            return mNameValueCache.getString(resolver, name);
601d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        }
60207ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams
603d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
604d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Store a name/value pair into the database.
605d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param resolver to access the database with
606d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name to store
607d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param value to associate with the name
60807ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * @return true if the value was set, false on database errors
609d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
610d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static boolean putString(ContentResolver resolver, String name, String value) {
611d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            if (MOVED_TO_SECURE.contains(name)) {
61240a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
61340a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams                        + " to android.provider.Settings.Secure, value is unchanged.");
61440a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams                return false;
61540a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams            }
61640a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams            return putString(resolver, CONTENT_URI, name, value);
61740a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams        }
61840a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams
619bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
620ae209acd8d48755df7d49459b1bcbc3b8e20561dJoe Onorato         * Construct the content URI for a particular name/value pair,
62140a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams         * useful for monitoring changes with a ContentObserver.
62240a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams         * @param name to look up in the table
62340a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams         * @return the corresponding content URI, or null if not present
62440a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams         */
62540a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams        public static Uri getUriFor(String name) {
62640a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams            if (MOVED_TO_SECURE.contains(name)) {
62740a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams                Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.System"
628a8f2acee39aae94f9d7148f775ca8e35344da4b4Joe Onorato                    + " to android.provider.Settings.Secure, returning Secure URI.");
62940a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams                return Secure.getUriFor(Secure.CONTENT_URI, name);
630bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams            }
631ae209acd8d48755df7d49459b1bcbc3b8e20561dJoe Onorato            return getUriFor(CONTENT_URI, name);
63240a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams        }
633d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
634d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
63543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * Convenience function for retrieving a single system settings value
63643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * as an integer.  Note that internally setting values are always
6372525a815220652b37e2e390fe8c62394a6d0e574Jason Sams         * stored as strings; this function converts the string to an integer
63843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * for you.  The default value will be returned if the setting is
63943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * not defined or not an integer.
64043ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         *
64143ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * @param cr The ContentResolver to access.
64243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * @param name The name of the setting to retrieve.
64343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * @param def Value to return if the setting is not defined.
64443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         *
64543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * @return The setting's current value, or 'def' if it is not defined
64643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * or not a valid integer.
64743ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         */
64843ee06857bb7f99446d1d84f8789016c5d105558Jason Sams        public static int getInt(ContentResolver cr, String name, int def) {
64943ee06857bb7f99446d1d84f8789016c5d105558Jason Sams            String v = getString(cr, name);
6502525a815220652b37e2e390fe8c62394a6d0e574Jason Sams            try {
6515f43fd289abbd5380b6068766daf721b555d0053Jason Sams                return v != null ? Integer.parseInt(v) : def;
6525f43fd289abbd5380b6068766daf721b555d0053Jason Sams            } catch (NumberFormatException e) {
6535f43fd289abbd5380b6068766daf721b555d0053Jason Sams                return def;
6545f43fd289abbd5380b6068766daf721b555d0053Jason Sams            }
6555f43fd289abbd5380b6068766daf721b555d0053Jason Sams        }
6565f43fd289abbd5380b6068766daf721b555d0053Jason Sams
6575f43fd289abbd5380b6068766daf721b555d0053Jason Sams        /**
6585f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * Convenience function for retrieving a single system settings value
6595f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * as an integer.  Note that internally setting values are always
6605f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * stored as strings; this function converts the string to an integer
6615f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * for you.
6625f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * <p>
6635f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * This version does not take a default value.  If the setting has not
6645f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * been set, or the string value is not a number,
6655f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * it throws {@link SettingNotFoundException}.
6665f43fd289abbd5380b6068766daf721b555d0053Jason Sams         *
6675f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * @param cr The ContentResolver to access.
6685f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * @param name The name of the setting to retrieve.
6695f43fd289abbd5380b6068766daf721b555d0053Jason Sams         *
6705f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * @throws SettingNotFoundException Thrown if a setting by the given
6715f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * name can't be found or the setting value is not an integer.
67243ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         *
67343ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         * @return The setting's current value.
67443ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         */
675d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static int getInt(ContentResolver cr, String name)
676d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                throws SettingNotFoundException {
677d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            String v = getString(cr, name);
678d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            try {
679d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                return Integer.parseInt(v);
680d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            } catch (NumberFormatException e) {
681d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                throw new SettingNotFoundException(name);
682d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            }
683bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        }
684d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
685d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
686d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Convenience function for updating a single settings value as an
687d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * integer. This will either create a new entry in the table if the
688d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * given name does not exist, or modify the value of the existing row
689d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * with that name.  Note that internally setting values are always
690d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * stored as strings, so this function converts the given value to a
691bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * string before storing it.
692d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         *
693d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param cr The ContentResolver to access.
694d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name The name of the setting to modify.
695d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param value The new value for the setting.
696d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @return true if the value was set, false on database errors
697d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
698d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static boolean putInt(ContentResolver cr, String name, int value) {
699d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            return putString(cr, name, Integer.toString(value));
700d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        }
701bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
702d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
703d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Convenience function for retrieving a single system settings value
704d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * as a {@code long}.  Note that internally setting values are always
705d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * stored as strings; this function converts the string to a {@code long}
706d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * for you.  The default value will be returned if the setting is
707d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * not defined or not a {@code long}.
708d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         *
709d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param cr The ContentResolver to access.
710d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name The name of the setting to retrieve.
711d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param def Value to return if the setting is not defined.
712bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         *
713d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @return The setting's current value, or 'def' if it is not defined
714d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * or not a valid {@code long}.
715d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
716d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static long getLong(ContentResolver cr, String name, long def) {
717d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            String valString = getString(cr, name);
718d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            long value;
719d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            try {
720d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                value = valString != null ? Long.parseLong(valString) : def;
721d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            } catch (NumberFormatException e) {
722d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                value = def;
723bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams            }
724d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            return value;
725d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        }
726d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
727d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
728d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Convenience function for retrieving a single system settings value
729d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * as a {@code long}.  Note that internally setting values are always
730d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * stored as strings; this function converts the string to a {@code long}
731d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * for you.
732d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * <p>
733d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * This version does not take a default value.  If the setting has not
734bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * been set, or the string value is not a number,
735d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * it throws {@link SettingNotFoundException}.
736d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         *
737d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param cr The ContentResolver to access.
738d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name The name of the setting to retrieve.
739d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         *
740d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @return The setting's current value.
741d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @throws SettingNotFoundException Thrown if a setting by the given
742d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * name can't be found or the setting value is not an integer.
743bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
744d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static long getLong(ContentResolver cr, String name)
745d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                throws SettingNotFoundException {
746d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            String valString = getString(cr, name);
747d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            try {
748d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                return Long.parseLong(valString);
749bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            } catch (NumberFormatException e) {
750bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                throw new SettingNotFoundException(name);
751bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            }
752bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        }
753bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
754bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        /**
755bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * Convenience function for updating a single settings value as a long
756bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * integer. This will either create a new entry in the table if the
757bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * given name does not exist, or modify the value of the existing row
758bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * with that name.  Note that internally setting values are always
759bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * stored as strings, so this function converts the given value to a
760bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * string before storing it.
761bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         *
762bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param cr The ContentResolver to access.
763bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param name The name of the setting to modify.
764bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param value The new value for the setting.
765bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @return true if the value was set, false on database errors
766bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         */
767bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        public static boolean putLong(ContentResolver cr, String name, long value) {
768bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            return putString(cr, name, Long.toString(value));
769bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        }
770bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams
771bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
772bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * Convenience function for retrieving a single system settings value
773bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * as a floating point number.  Note that internally setting values are
774bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * always stored as strings; this function converts the string to an
775bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * float for you. The default value will be returned if the setting
776bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * is not defined or not a valid float.
777bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         *
778bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param cr The ContentResolver to access.
779bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param name The name of the setting to retrieve.
780bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param def Value to return if the setting is not defined.
781bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         *
782bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * @return The setting's current value, or 'def' if it is not defined
783bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * or not a valid float.
784bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         */
785bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        public static float getFloat(ContentResolver cr, String name, float def) {
786bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            String v = getString(cr, name);
787bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            try {
788bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                return v != null ? Float.parseFloat(v) : def;
789bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            } catch (NumberFormatException e) {
790bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                return def;
791bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            }
792bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        }
793bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams
794bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
795bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * Convenience function for retrieving a single system settings value
796bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * as a float.  Note that internally setting values are always
797bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * stored as strings; this function converts the string to a float
798bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * for you.
799bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * <p>
800bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * This version does not take a default value.  If the setting has not
801bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * been set, or the string value is not a number,
802bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * it throws {@link SettingNotFoundException}.
803bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         *
804bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param cr The ContentResolver to access.
805bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @param name The name of the setting to retrieve.
806bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         *
807bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @throws SettingNotFoundException Thrown if a setting by the given
808bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * name can't be found or the setting value is not a float.
809bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         *
810bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * @return The setting's current value.
811bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         */
812bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        public static float getFloat(ContentResolver cr, String name)
813bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                throws SettingNotFoundException {
814bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            String v = getString(cr, name);
815bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams            try {
816bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                return Float.parseFloat(v);
817bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            } catch (NumberFormatException e) {
818bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams                throw new SettingNotFoundException(name);
819bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams            }
820bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        }
821d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
822d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
823d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Convenience function for updating a single settings value as a
824d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * floating point number. This will either create a new entry in the
825bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * table if the given name does not exist, or modify the value of the
826d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * existing row with that name.  Note that internally setting values
827d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * are always stored as strings, so this function converts the given
828d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * value to a string before storing it.
82922534176fb5c1257130ef4ee589739ca42766a32Jason Sams         *
830d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param cr The ContentResolver to access.
831d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param name The name of the setting to modify.
83207ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * @param value The new value for the setting.
833bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * @return true if the value was set, false on database errors
834d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
835d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static boolean putFloat(ContentResolver cr, String name, float value) {
836d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            return putString(cr, name, Float.toString(value));
83722534176fb5c1257130ef4ee589739ca42766a32Jason Sams        }
838d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
839d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
84007ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * Convenience function to read all of the current
841bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * configuration-related settings into a
842d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * {@link Configuration} object.
843d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         *
844d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @param cr The ContentResolver to access.
84522534176fb5c1257130ef4ee589739ca42766a32Jason Sams         * @param outConfig Where to place the configuration settings.
846d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
847d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static void getConfiguration(ContentResolver cr, Configuration outConfig) {
84807ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams            outConfig.fontScale = Settings.System.getFloat(
849bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams                cr, FONT_SCALE, outConfig.fontScale);
850d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            if (outConfig.fontScale < 0) {
851d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams                outConfig.fontScale = 1;
852d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            }
85322534176fb5c1257130ef4ee589739ca42766a32Jason Sams        }
854584a375df68ed7d62b38389078c6804edf228f9cRomain Guy
855584a375df68ed7d62b38389078c6804edf228f9cRomain Guy        /**
85607ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * Convenience function to write a batch of configuration-related
857584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         * settings from a {@link Configuration} object.
858584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         *
859584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         * @param cr The ContentResolver to access.
860584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         * @param config The settings to write.
861584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         * @return true if the values were set, false on database errors
862bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
863584a375df68ed7d62b38389078c6804edf228f9cRomain Guy        public static boolean putConfiguration(ContentResolver cr, Configuration config) {
864584a375df68ed7d62b38389078c6804edf228f9cRomain Guy            return Settings.System.putFloat(cr, FONT_SCALE, config.fontScale);
865584a375df68ed7d62b38389078c6804edf228f9cRomain Guy        }
866584a375df68ed7d62b38389078c6804edf228f9cRomain Guy
867584a375df68ed7d62b38389078c6804edf228f9cRomain Guy        public static boolean getShowGTalkServiceStatus(ContentResolver cr) {
868584a375df68ed7d62b38389078c6804edf228f9cRomain Guy            return getInt(cr, SHOW_GTALK_SERVICE_STATUS, 0) != 0;
86922534176fb5c1257130ef4ee589739ca42766a32Jason Sams        }
870334ea0c98f051b5a6b85bc616c93304651854298Jason Sams
87122534176fb5c1257130ef4ee589739ca42766a32Jason Sams        public static void setShowGTalkServiceStatus(ContentResolver cr, boolean flag) {
87222534176fb5c1257130ef4ee589739ca42766a32Jason Sams            putInt(cr, SHOW_GTALK_SERVICE_STATUS, flag ? 1 : 0);
873334ea0c98f051b5a6b85bc616c93304651854298Jason Sams        }
874fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams
875fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams        /**
876fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         * The content:// style URL for this table
877fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         */
878bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final Uri CONTENT_URI =
879fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams            Uri.parse("content://" + AUTHORITY + "/system");
880fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams
881fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams        /**
88222534176fb5c1257130ef4ee589739ca42766a32Jason Sams         * Whether we keep the device on while the device is plugged in.
88322534176fb5c1257130ef4ee589739ca42766a32Jason Sams         * Supported values are:
884584a375df68ed7d62b38389078c6804edf228f9cRomain Guy         * <ul>
885be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * <li>{@code 0} to never stay on while plugged in</li>
886be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * <li>{@link BatteryManager#BATTERY_PLUGGED_AC} to stay on for AC charger</li>
887be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * <li>{@link BatteryManager#BATTERY_PLUGGED_USB} to stay on for USB charger</li>
888be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * </ul>
889be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * These values can be OR-ed together.
890be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         */
891be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams        public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
892be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams
893be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams        /**
894be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * What happens when the user presses the end call button if they're not
895be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * on a call.<br/>
896be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * <b>Values:</b><br/>
897be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * 0 - The end button does nothing.<br/>
898be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * 1 - The end button goes to the home screen.<br/>
899be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * 2 - The end button puts the device to sleep and locks the keyguard.<br/>
900be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * 3 - The end button goes to the home screen.  If the user is already on the
901be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * home screen, it puts the device to sleep.
902be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         */
903be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams        public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
904be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams
905be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams        /**
906be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * Whether Airplane Mode is on.
907be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         */
908fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams        public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
909d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
910d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
911fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         * Constant for use in AIRPLANE_MODE_RADIOS to specify Bluetooth radio.
912bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
913d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String RADIO_BLUETOOTH = "bluetooth";
914d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
915fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams        /**
916fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         * Constant for use in AIRPLANE_MODE_RADIOS to specify Wi-Fi radio.
917d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
918fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams        public static final String RADIO_WIFI = "wifi";
919d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
920d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
921fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         * Constant for use in AIRPLANE_MODE_RADIOS to specify Cellular radio.
922bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
923d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String RADIO_CELL = "cell";
924d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
925d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
92643702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * A comma separated list of radios that need to be disabled when airplane mode
92743702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi and bluetooth are
928d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * included in the comma separated list.
929d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
930d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
93143702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich
93243702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        /**
93343702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * A comma separated list of radios that should to be disabled when airplane mode
93443702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * is on, but can be manually reenabled by the user.  For example, if RADIO_WIFI is
93543702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * added to both AIRPLANE_MODE_RADIOS and AIRPLANE_MODE_TOGGLEABLE_RADIOS, then Wifi
93643702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * will be turned off when entering airplane mode, but the user will be able to reenable
93743702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * Wifi in the Settings app.
93843702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         *
93943702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * {@hide}
94043702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         */
94143702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        public static final String AIRPLANE_MODE_TOGGLEABLE_RADIOS = "airplane_mode_toggleable_radios";
94243702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich
94343702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        /**
94443702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * The policy for deciding when Wi-Fi should go to sleep (which will in
94543702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * turn switch to using the mobile data as an Internet connection).
94643702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * <p>
94743702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * Set to one of {@link #WIFI_SLEEP_POLICY_DEFAULT},
94843702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * {@link #WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED}, or
94943702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * {@link #WIFI_SLEEP_POLICY_NEVER}.
95043702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         */
95143702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
95243702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich
95343702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        /**
95443702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * Value for {@link #WIFI_SLEEP_POLICY} to use the default Wi-Fi sleep
95543702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * policy, which is to sleep shortly after the turning off
95643702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * according to the {@link #STAY_ON_WHILE_PLUGGED_IN} setting.
95743702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         */
95843702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        public static final int WIFI_SLEEP_POLICY_DEFAULT = 0;
95943702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich
960bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
96139ddc950c9064129ead5de04b200106c0659f937Jason Sams         * Value for {@link #WIFI_SLEEP_POLICY} to use the default policy when
96243702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * the device is on battery, and never go to sleep when the device is
96343702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         * plugged in.
96443702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich         */
96543702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1;
96643702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich
967d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
968d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Value for {@link #WIFI_SLEEP_POLICY} to never go to sleep.
969d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
970d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final int WIFI_SLEEP_POLICY_NEVER = 2;
971d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
972d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
973d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether to use static IP and other static network attributes.
974bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * <p>
975d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Set to 1 for true and 0 for false.
976d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
977d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
978d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato
979d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        /**
980d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * The static IP address.
981d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * <p>
982d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * Example: "192.168.1.51"
983bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
984d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        public static final String WIFI_STATIC_IP = "wifi_static_ip";
985d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato
986d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        /**
987d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * If using static IP, the gateway's IP address.
988d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * <p>
989d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * Example: "192.168.1.1"
990d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         */
991d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
992d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato
993bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
994d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * If using static IP, the net mask.
995d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * <p>
996d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * Example: "255.255.255.0"
997d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
998d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
999d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1000d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1001d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * If using static IP, the primary DNS's IP address.
1002d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * <p>
1003d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Example: "192.168.1.1"
1004bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1005d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
1006d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1007d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1008d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * If using static IP, the secondary DNS's IP address.
1009d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * <p>
1010d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Example: "192.168.1.2"
1011d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1012bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
1013d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1014d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1015d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * The number of radio channels that are allowed in the local
1016d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * 802.11 regulatory domain.
1017d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1018d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1019d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
1020bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
1021d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1022d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Determines whether remote devices may discover and/or connect to
1023d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * this device.
1024d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * <P>Type: INT</P>
1025d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * 2 -- discoverable and connectable
1026d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * 1 -- connectable but not discoverable
1027d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * 0 -- neither connectable nor discoverable
1028bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1029d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String BLUETOOTH_DISCOVERABILITY =
1030d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "bluetooth_discoverability";
1031d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1032d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1033d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Bluetooth discoverability timeout.  If this value is nonzero, then
1034d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Bluetooth becomes discoverable for a certain number of seconds,
1035d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * after which is becomes simply connectable.  The value is in seconds.
1036bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1037d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT =
1038d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "bluetooth_discoverability_timeout";
1039d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1040d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1041d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether autolock is enabled (0 = false, 1 = true)
1042d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1043d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
1044bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
1045d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1046d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether lock pattern is visible as user enters (0 = false, 1 = true)
1047d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1048d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
1049d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1050d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1051d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether lock pattern will vibrate as user enters (0 = false, 1 = true)
10523eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams         */
1053bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED =
1054d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            "lock_pattern_tactile_feedback_enabled";
1055d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1056d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1057d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1058d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * A formatted string of the next alarm that is set, or the empty string
105925ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams         * if there is no alarm set.
1060d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1061d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
106225ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams
106325ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams        /**
1064d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Scaling factor for fonts, float.
1065d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1066d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String FONT_SCALE = "font_scale";
1067d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1068d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1069d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Name of an application package to be debugged.
1070d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1071bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final String DEBUG_APP = "debug_app";
1072d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1073d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1074d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * If 1, when launching DEBUG_APP it will wait for the debugger before
1075d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * starting user code.  If 0, it will run normally.
1076d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1077d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
1078d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1079bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
1080d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether or not to dim the screen. 0=no  1=yes
1081d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1082d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String DIM_SCREEN = "dim_screen";
108325ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams
1084d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1085d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * The timeout before the screen turns off.
108625ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams         */
108725ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams        public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
1088d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1089d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1090d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * If 0, the compatibility mode is off for all applications.
1091d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * If 1, older applications run under compatibility mode.
1092d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * TODO: remove this settings before code freeze (bug/1907571)
1093d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1094d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1095bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final String COMPATIBILITY_MODE = "compatibility_mode";
1096d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1097d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
10981fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * The screen backlight brightness between 0 and 255.
10991fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         */
11001fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        public static final String SCREEN_BRIGHTNESS = "screen_brightness";
11011fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11021fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
11031fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * Control whether to enable automatic brightness mode.
11041fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * @hide
1105bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
11061fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
11071fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11081fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
11099bee51c42eb8c3daffe7d6fa483edbb1689b94d2Jason Sams         * SCREEN_BRIGHTNESS_MODE value for manual mode.
11101fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * @hide
11111fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         */
111207ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams        public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
1113bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
11141fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
11151fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * SCREEN_BRIGHTNESS_MODE value for manual mode.
11161fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * @hide
11171fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         */
11181fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
11191fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11201fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
1121bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * Control whether the process CPU usage meter should be shown.
11221fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         */
11231fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        public static final String SHOW_PROCESSES = "show_processes";
1124ee41112e1539de95596600fd2c6dada5d275217fJason Sams
1125ee41112e1539de95596600fd2c6dada5d275217fJason Sams        /**
1126ee41112e1539de95596600fd2c6dada5d275217fJason Sams         * If 1, the activity manager will aggressively finish activities and
1127ee41112e1539de95596600fd2c6dada5d275217fJason Sams         * processes as soon as they are no longer needed.  If 0, the normal
1128ee41112e1539de95596600fd2c6dada5d275217fJason Sams         * extended lifetime is used.
1129bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1130ee41112e1539de95596600fd2c6dada5d275217fJason Sams        public static final String ALWAYS_FINISH_ACTIVITIES =
1131ee41112e1539de95596600fd2c6dada5d275217fJason Sams                "always_finish_activities";
11321fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11331fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11341fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
11351fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * Ringer mode. This is used internally, changing this value will not
11361fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * change the ringer mode. See AudioManager.
1137bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
11381fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        public static final String MODE_RINGER = "mode_ringer";
11391fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams
11401fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams        /**
1141ebfb436a49673693b98469683451bd9ede797557Jason Sams         * Determines which streams are affected by ringer mode changes. The
1142ebfb436a49673693b98469683451bd9ede797557Jason Sams         * stream type's bit should be set to 1 if it should be muted when going
1143ebfb436a49673693b98469683451bd9ede797557Jason Sams         * into an inaudible ringer mode.
1144ebfb436a49673693b98469683451bd9ede797557Jason Sams         */
1145ebfb436a49673693b98469683451bd9ede797557Jason Sams        public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
1146ebfb436a49673693b98469683451bd9ede797557Jason Sams
1147ebfb436a49673693b98469683451bd9ede797557Jason Sams         /**
1148ebfb436a49673693b98469683451bd9ede797557Jason Sams          * Determines which streams are affected by mute. The
1149ebfb436a49673693b98469683451bd9ede797557Jason Sams          * stream type's bit should be set to 1 if it should be muted when a mute request
1150ebfb436a49673693b98469683451bd9ede797557Jason Sams          * is received.
1151ebfb436a49673693b98469683451bd9ede797557Jason Sams          */
1152ebfb436a49673693b98469683451bd9ede797557Jason Sams         public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
1153ebfb436a49673693b98469683451bd9ede797557Jason Sams
1154ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
1155ebfb436a49673693b98469683451bd9ede797557Jason Sams         * Whether vibrate is on for different events. This is used internally,
1156ebfb436a49673693b98469683451bd9ede797557Jason Sams         * changing this value will not change the vibrate. See AudioManager.
1157ebfb436a49673693b98469683451bd9ede797557Jason Sams         */
1158ebfb436a49673693b98469683451bd9ede797557Jason Sams        public static final String VIBRATE_ON = "vibrate_on";
1159ebfb436a49673693b98469683451bd9ede797557Jason Sams
1160ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
1161ebfb436a49673693b98469683451bd9ede797557Jason Sams         * Ringer volume. This is used internally, changing this value will not
1162ebfb436a49673693b98469683451bd9ede797557Jason Sams         * change the volume. See AudioManager.
1163ebfb436a49673693b98469683451bd9ede797557Jason Sams         */
1164ebfb436a49673693b98469683451bd9ede797557Jason Sams        public static final String VOLUME_RING = "volume_ring";
1165ebfb436a49673693b98469683451bd9ede797557Jason Sams
1166ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
1167ebfb436a49673693b98469683451bd9ede797557Jason Sams         * System/notifications volume. This is used internally, changing this
1168ebfb436a49673693b98469683451bd9ede797557Jason Sams         * value will not change the volume. See AudioManager.
1169d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1170d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String VOLUME_SYSTEM = "volume_system";
1171d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1172d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1173d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Voice call volume. This is used internally, changing this value will
1174d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * not change the volume. See AudioManager.
1175d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1176d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String VOLUME_VOICE = "volume_voice";
1177bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
1178d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1179d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Music/media/gaming volume. This is used internally, changing this
1180d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * value will not change the volume. See AudioManager.
1181d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1182d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String VOLUME_MUSIC = "volume_music";
1183d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1184d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1185bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * Alarm volume. This is used internally, changing this
1186d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * value will not change the volume. See AudioManager.
1187d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1188d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String VOLUME_ALARM = "volume_alarm";
1189d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1190d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1191d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Notification volume. This is used internally, changing this
1192d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * value will not change the volume. See AudioManager.
1193bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1194d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String VOLUME_NOTIFICATION = "volume_notification";
1195d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
11960826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams        /**
11970826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * Whether the notifications should use the ring volume (value of 1) or
11980826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * a separate notification volume (value of 0). In most cases, users
11990826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * will have this enabled so the notification and ringer volumes will be
12000826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * the same. However, power users can disable this and use the separate
1201bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * notification volume control.
12020826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * <p>
12030826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams         * Note: This is a one-off setting that will be removed in the future
1204d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * when there is profile support. For this reason, it is kept hidden
1205ebfb436a49673693b98469683451bd9ede797557Jason Sams         * from the public APIs.
1206ebfb436a49673693b98469683451bd9ede797557Jason Sams         *
1207ebfb436a49673693b98469683451bd9ede797557Jason Sams         * @hide
1208ebfb436a49673693b98469683451bd9ede797557Jason Sams         */
1209ebfb436a49673693b98469683451bd9ede797557Jason Sams        public static final String NOTIFICATIONS_USE_RING_VOLUME =
1210ebfb436a49673693b98469683451bd9ede797557Jason Sams            "notifications_use_ring_volume";
1211ebfb436a49673693b98469683451bd9ede797557Jason Sams
1212ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
1213d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * The mapping of stream type (integer) to its setting.
1214d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         */
1215d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        public static final String[] VOLUME_SETTINGS = {
1216d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato            VOLUME_VOICE, VOLUME_SYSTEM, VOLUME_RING, VOLUME_MUSIC,
1217d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato            VOLUME_ALARM, VOLUME_NOTIFICATION
1218bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        };
1219d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato
1220d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        /**
1221d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * Appended to various volume related settings to record the previous
1222d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * values before they the settings were affected by a silent/vibrate
1223d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * ringer mode change.
1224d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         */
1225d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        public static final String APPEND_FOR_LAST_AUDIBLE = "_last_audible";
1226d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato
1227d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato        /**
1228bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * Persistent store for the system-wide default ringtone URI.
1229d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * <p>
1230d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * If you need to play the default ringtone at any given time, it is recommended
1231d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * you give {@link #DEFAULT_RINGTONE_URI} to the media player.  It will resolve
1232d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * to the set default ringtone at the time of playing.
123302fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         *
123402fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * @see #DEFAULT_RINGTONE_URI
123502fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         */
123602fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams        public static final String RINGTONE = "ringtone";
123702fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams
123802fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams        /**
123902fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * A {@link Uri} that will point to the current default ringtone at any
1240bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * given time.
124102fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * <p>
124202fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * If the current default ringtone is in the DRM provider and the caller
124302fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * does not have permission, the exception will be a
124402fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * FileNotFoundException.
124502fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         */
124602fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams        public static final Uri DEFAULT_RINGTONE_URI = getUriFor(RINGTONE);
124702fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams
1248bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
124902fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * Persistent store for the system-wide default notification sound.
125002fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         *
125102fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * @see #RINGTONE
125202fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * @see #DEFAULT_NOTIFICATION_URI
125302fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         */
125402fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams        public static final String NOTIFICATION_SOUND = "notification_sound";
1255bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1256bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
125702fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * A {@link Uri} that will point to the current default notification
125802fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams         * sound at any given time.
1259bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         *
1260bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * @see #DEFAULT_RINGTONE_URI
1261bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         */
1262bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND);
1263bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1264bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1265bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Persistent store for the system-wide default alarm alert.
1266bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         *
1267bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * @see #RINGTONE
1268bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * @see #DEFAULT_ALARM_ALERT_URI
1269bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         */
1270bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String ALARM_ALERT = "alarm_alert";
1271bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1272bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1273bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * A {@link Uri} that will point to the current default alarm alert at
1274bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         * any given time.
1275bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         *
1276bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * @see #DEFAULT_ALARM_ALERT_URI
1277bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         */
1278bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final Uri DEFAULT_ALARM_ALERT_URI = getUriFor(ALARM_ALERT);
1279bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1280bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1281bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Setting to enable Auto Replace (AutoText) in text editors. 1 = On, 0 = Off
1282bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1283bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String TEXT_AUTO_REPLACE = "auto_replace";
1284bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1285bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1286bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Setting to enable Auto Caps in text editors. 1 = On, 0 = Off
1287bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         */
1288bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String TEXT_AUTO_CAPS = "auto_caps";
1289bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1290bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        /**
1291bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Setting to enable Auto Punctuate in text editors. 1 = On, 0 = Off. This
1292bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * feature converts two spaces to a "." and space.
1293bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         */
1294bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
1295bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1296bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1297bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Setting to showing password characters in text editors. 1 = On, 0 = Off
1298bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1299bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String TEXT_SHOW_PASSWORD = "show_password";
1300bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1301bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String SHOW_GTALK_SERVICE_STATUS =
1302bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams                "SHOW_GTALK_SERVICE_STATUS";
1303bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams
1304bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        /**
1305bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams         * Name of activity to use for wallpaper on the home screen.
1306bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
1307bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams        public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
1308d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1309d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1310d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Value to specify if the user prefers the date, time and time zone
13111bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * to be automatically fetched from the network (NITZ). 1=yes, 0=no
13121bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         */
13131bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        public static final String AUTO_TIME = "auto_time";
13141bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams
13151bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        /**
13161bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * Display times as 12 or 24 hours
13171bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *   12
13181bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *   24
1319bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams         */
13201bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        public static final String TIME_12_24 = "time_12_24";
13211bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams
13221bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        /**
13231bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * Date format string
13241bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *   mm/dd/yyyy
13251bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *   dd/mm/yyyy
13261bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *   yyyy/mm/dd
13271bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         */
13281bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        public static final String DATE_FORMAT = "date_format";
1329bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams
13301bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        /**
13311bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * Whether the setup wizard has been run before (on first boot), or if
13321bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * it still needs to be run.
13331bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         *
13341bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * nonzero = it has been run in the past
13351bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * 0 = it has not been run in the past
13361bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         */
1337bc948dedcee57a66fe2cb38d4c79d04a10c7efb3Jason Sams        public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
13381bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams
13391bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams        /**
13401bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * Scaling factor for normal window animations. Setting to 0 will disable window
13411bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams         * animations.
1342d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
134394d8e90ad78ee1dbc0efa315117688abd126ae55Jason Sams        public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
1344d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1345d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1346d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Scaling factor for activity transition animations. Setting to 0 will disable window
1347ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams         * animations.
1348ea84a7c51790f9ba5f2194a66d6cf4ea8d879776Jason Sams         */
1349d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
1350d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1351ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
13523bc47d438171dce294e816366d53bc9eca772c5bJason Sams         * Scaling factor for normal window animations. Setting to 0 will disable window
13537d787b4722eaeb79cab42c36060336e092b77b5fJason Sams         * animations.
13543bc47d438171dce294e816366d53bc9eca772c5bJason Sams         * @hide
1355d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1356715333b832fb448c32165c7d97d408a3fa43f7cbJason Sams        public static final String FANCY_IME_ANIMATIONS = "fancy_ime_animations";
135765e7aa56f56097418d617663683544c25b3988eaJason Sams
135865e7aa56f56097418d617663683544c25b3988eaJason Sams        /**
13593eaa338e11a3b0d6b87d705e5bb95625e82347bdJason Sams         * Control whether the accelerometer will be used to change screen
13607ce033d797e5df5e2131e2ed459fba181eaf4658Jason Sams         * orientation.  If 0, it will not be used unless explicitly requested
1361730ee65d4ddb307898053b623120bad1655fadadJason Sams         * by the application; if 1, it will be used by default unless explicitly
1362516c31911578db8ce53529483c3ded918ac7dc6bJason Sams         * disabled by the application.
1363516c31911578db8ce53529483c3ded918ac7dc6bJason Sams         */
1364516c31911578db8ce53529483c3ded918ac7dc6bJason Sams        public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
1365d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
136664676f3c21a07d650069315572811570cbf8f728Jason Sams        /**
136764676f3c21a07d650069315572811570cbf8f728Jason Sams         * Whether the audible DTMF tones are played by the dialer when dialing. The value is
1368d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * boolean (1 or 0).
1369768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams         */
1370d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
1371d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1372d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1373d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * CDMA only settings
1374d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * DTMF tone type played by the dialer when dialing.
137543ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         *                 0 = Normal
137643ee06857bb7f99446d1d84f8789016c5d105558Jason Sams         *                 1 = Long
1377d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1378d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1379ffe9f48890dde7173a0845d32887fdf94a49b0a7Jason Sams        public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
138007ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams
1381650a3eb7d621dc8e81573142a4498bbd07bcde27Romain Guy        /**
1382d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * CDMA only settings
138307ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         * Emergency Tone  0 = Off
138407ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         *                 1 = Alert
1385768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams         *                 2 = Vibrate
1386768bc02d815a94ad29146f1ed60c847d1af118ccJason Sams         * @hide
138707ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams         */
138807ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams        public static final String EMERGENCY_TONE = "emergency_tone";
138907ae40623737a6060b8a925fd2e6bba76780dcd4Jason Sams
139040a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams        /**
139140a29e8e28772b37ab0f9fe9708ecdcba24abb84Jason Sams         * CDMA only settings
13922525a815220652b37e2e390fe8c62394a6d0e574Jason Sams         * Whether the auto retry is enabled. The value is
13935f43fd289abbd5380b6068766daf721b555d0053Jason Sams         * boolean (1 or 0).
1394d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1395d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1396d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String CALL_AUTO_RETRY = "call_auto_retry";
1397d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1398d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1399bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * Whether the hearing aid is enabled. The value is
1400d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * boolean (1 or 0).
1401d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1402d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1403bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        public static final String HEARING_AID = "hearing_aid";
1404bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams
1405bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams        /**
1406bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * CDMA only settings
1407bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * TTY Mode
1408bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * 0 = OFF
1409bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * 1 = FULL
1410bd1c3ad0cdf8e60b849a009cdc0b36764cc1dacbJason Sams         * 2 = VCO
1411d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * 3 = HCO
141222534176fb5c1257130ef4ee589739ca42766a32Jason Sams         * @hide
141322534176fb5c1257130ef4ee589739ca42766a32Jason Sams         */
141422534176fb5c1257130ef4ee589739ca42766a32Jason Sams        public static final String TTY_MODE = "tty_mode";
141522534176fb5c1257130ef4ee589739ca42766a32Jason Sams
1416334ea0c98f051b5a6b85bc616c93304651854298Jason Sams        /**
1417fbf0b9ecda03fbdbd4ebabfd18da09a789686249Jason Sams         * Whether the sounds effects (key clicks, lid open ...) are enabled. The value is
1418be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         * boolean (1 or 0).
1419be2e84193f709419634de4cc3ba0e67acf6976f3Jason Sams         */
142022534176fb5c1257130ef4ee589739ca42766a32Jason Sams        public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
1421d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
142243702d8925c54360ad5f9f66b0d35d61d59f6910Jack Palevich        /**
1423d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether the haptic feedback (long presses, ...) are enabled. The value is
1424d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         * boolean (1 or 0).
1425d7b3774da62d3c70cc7e8cf549967a1c823501e6Joe Onorato         */
1426d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
1427d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1428d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1429d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether live web suggestions while the user types into search dialogs are
1430d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * enabled. Browsers and other search UIs should respect this, as it allows
1431d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * a user to avoid sending partial queries to a search engine, if it poses
1432d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * any privacy concern. The value is boolean (1 or 0).
1433d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1434d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
143525ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams
1436d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1437d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * Whether the notification LED should repeatedly flash when a notification is
143825ffcdc9d7e32c9c1eeb2b48cc2f17d1353e9faeJason Sams         * pending. The value is boolean (1 or 0).
1439d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         * @hide
1440d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams         */
1441ebfb436a49673693b98469683451bd9ede797557Jason Sams        public static final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse";
1442ebfb436a49673693b98469683451bd9ede797557Jason Sams
1443ebfb436a49673693b98469683451bd9ede797557Jason Sams        /**
1444ebfb436a49673693b98469683451bd9ede797557Jason Sams         * Settings to backup. This is here so that it's in the same place as the settings
14459bee51c42eb8c3daffe7d6fa483edbb1689b94d2Jason Sams         * keys and easy to update.
14461fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         * @hide
14471fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams         */
1448ee41112e1539de95596600fd2c6dada5d275217fJason Sams        public static final String[] SETTINGS_TO_BACKUP = {
14491fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams            STAY_ON_WHILE_PLUGGED_IN,
14501fe9b8c3bdc55e624edc1a69c3f3f0b9e90af1e4Jason Sams            END_BUTTON_BEHAVIOR,
1451bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_SLEEP_POLICY,
1452bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_USE_STATIC_IP,
1453bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_STATIC_IP,
1454bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_STATIC_GATEWAY,
1455bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_STATIC_NETMASK,
1456bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_STATIC_DNS1,
1457bba134c8a1dcfe0c8473307a95899a02c9553504Jason Sams            WIFI_STATIC_DNS2,
1458d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            BLUETOOTH_DISCOVERABILITY,
1459d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            BLUETOOTH_DISCOVERABILITY_TIMEOUT,
1460d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            DIM_SCREEN,
14610826a6f90f049bf94fc39fb23ad3a736a14b96ebJason Sams            SCREEN_OFF_TIMEOUT,
1462ebfb436a49673693b98469683451bd9ede797557Jason Sams            SCREEN_BRIGHTNESS,
1463d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            SCREEN_BRIGHTNESS_MODE,
146402fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams            VIBRATE_ON,
146502fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams            NOTIFICATIONS_USE_RING_VOLUME,
146602fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams            MODE_RINGER,
146702fb2cb531035779a25dbf9595e0628ea40585b0Jason Sams            MODE_RINGER_STREAMS_AFFECTED,
14681bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams            MUTE_STREAMS_AFFECTED,
14691bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams            VOLUME_VOICE,
14701bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams            VOLUME_SYSTEM,
14711bada8cd6e4f340de93cff4a2439835fc3b1456cJason Sams            VOLUME_RING,
1472d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_MUSIC,
1473d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_ALARM,
1474d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_NOTIFICATION,
1475d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_VOICE + APPEND_FOR_LAST_AUDIBLE,
1476d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_SYSTEM + APPEND_FOR_LAST_AUDIBLE,
1477d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_RING + APPEND_FOR_LAST_AUDIBLE,
1478d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_MUSIC + APPEND_FOR_LAST_AUDIBLE,
1479d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_ALARM + APPEND_FOR_LAST_AUDIBLE,
1480d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            VOLUME_NOTIFICATION + APPEND_FOR_LAST_AUDIBLE,
1481d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TEXT_AUTO_REPLACE,
1482d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TEXT_AUTO_CAPS,
1483d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TEXT_AUTO_PUNCTUATE,
1484d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TEXT_SHOW_PASSWORD,
1485d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            AUTO_TIME,
1486d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TIME_12_24,
1487d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            DATE_FORMAT,
1488d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            ACCELEROMETER_ROTATION,
1489d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            DTMF_TONE_WHEN_DIALING,
1490d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            DTMF_TONE_TYPE_WHEN_DIALING,
1491d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            EMERGENCY_TONE,
1492d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            CALL_AUTO_RETRY,
1493d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            HEARING_AID,
1494d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            TTY_MODE,
1495d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            SOUND_EFFECTS_ENABLED,
1496d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            HAPTIC_FEEDBACK_ENABLED,
1497d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            SHOW_WEB_SUGGESTIONS,
1498d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams            NOTIFICATION_LIGHT_PULSE
1499d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        };
1500d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1501d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        // Settings moved to Settings.Secure
1502d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams
1503d19f10d43aa400e1183aa21a97099d02074131a2Jason Sams        /**
1504         * @deprecated Use {@link android.provider.Settings.Secure#ADB_ENABLED}
1505         * instead
1506         */
1507        @Deprecated
1508        public static final String ADB_ENABLED = Secure.ADB_ENABLED;
1509
1510        /**
1511         * @deprecated Use {@link android.provider.Settings.Secure#ANDROID_ID} instead
1512         */
1513        @Deprecated
1514        public static final String ANDROID_ID = Secure.ANDROID_ID;
1515
1516        /**
1517         * @deprecated Use {@link android.provider.Settings.Secure#BLUETOOTH_ON} instead
1518         */
1519        @Deprecated
1520        public static final String BLUETOOTH_ON = Secure.BLUETOOTH_ON;
1521
1522        /**
1523         * @deprecated Use {@link android.provider.Settings.Secure#DATA_ROAMING} instead
1524         */
1525        @Deprecated
1526        public static final String DATA_ROAMING = Secure.DATA_ROAMING;
1527
1528        /**
1529         * @deprecated Use {@link android.provider.Settings.Secure#DEVICE_PROVISIONED} instead
1530         */
1531        @Deprecated
1532        public static final String DEVICE_PROVISIONED = Secure.DEVICE_PROVISIONED;
1533
1534        /**
1535         * @deprecated Use {@link android.provider.Settings.Secure#HTTP_PROXY} instead
1536         */
1537        @Deprecated
1538        public static final String HTTP_PROXY = Secure.HTTP_PROXY;
1539
1540        /**
1541         * @deprecated Use {@link android.provider.Settings.Secure#INSTALL_NON_MARKET_APPS} instead
1542         */
1543        @Deprecated
1544        public static final String INSTALL_NON_MARKET_APPS = Secure.INSTALL_NON_MARKET_APPS;
1545
1546        /**
1547         * @deprecated Use {@link android.provider.Settings.Secure#LOCATION_PROVIDERS_ALLOWED}
1548         * instead
1549         */
1550        @Deprecated
1551        public static final String LOCATION_PROVIDERS_ALLOWED = Secure.LOCATION_PROVIDERS_ALLOWED;
1552
1553        /**
1554         * @deprecated Use {@link android.provider.Settings.Secure#LOGGING_ID} instead
1555         */
1556        @Deprecated
1557        public static final String LOGGING_ID = Secure.LOGGING_ID;
1558
1559        /**
1560         * @deprecated Use {@link android.provider.Settings.Secure#NETWORK_PREFERENCE} instead
1561         */
1562        @Deprecated
1563        public static final String NETWORK_PREFERENCE = Secure.NETWORK_PREFERENCE;
1564
1565        /**
1566         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_ENABLED}
1567         * instead
1568         */
1569        @Deprecated
1570        public static final String PARENTAL_CONTROL_ENABLED = Secure.PARENTAL_CONTROL_ENABLED;
1571
1572        /**
1573         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_LAST_UPDATE}
1574         * instead
1575         */
1576        @Deprecated
1577        public static final String PARENTAL_CONTROL_LAST_UPDATE = Secure.PARENTAL_CONTROL_LAST_UPDATE;
1578
1579        /**
1580         * @deprecated Use {@link android.provider.Settings.Secure#PARENTAL_CONTROL_REDIRECT_URL}
1581         * instead
1582         */
1583        @Deprecated
1584        public static final String PARENTAL_CONTROL_REDIRECT_URL =
1585            Secure.PARENTAL_CONTROL_REDIRECT_URL;
1586
1587        /**
1588         * @deprecated Use {@link android.provider.Settings.Secure#SETTINGS_CLASSNAME} instead
1589         */
1590        @Deprecated
1591        public static final String SETTINGS_CLASSNAME = Secure.SETTINGS_CLASSNAME;
1592
1593        /**
1594         * @deprecated Use {@link android.provider.Settings.Secure#USB_MASS_STORAGE_ENABLED} instead
1595         */
1596        @Deprecated
1597        public static final String USB_MASS_STORAGE_ENABLED = Secure.USB_MASS_STORAGE_ENABLED;
1598
1599        /**
1600         * @deprecated Use {@link android.provider.Settings.Secure#USE_GOOGLE_MAIL} instead
1601         */
1602        @Deprecated
1603        public static final String USE_GOOGLE_MAIL = Secure.USE_GOOGLE_MAIL;
1604
1605       /**
1606         * @deprecated Use
1607         * {@link android.provider.Settings.Secure#WIFI_MAX_DHCP_RETRY_COUNT} instead
1608         */
1609        @Deprecated
1610        public static final String WIFI_MAX_DHCP_RETRY_COUNT = Secure.WIFI_MAX_DHCP_RETRY_COUNT;
1611
1612        /**
1613         * @deprecated Use
1614         * {@link android.provider.Settings.Secure#WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS} instead
1615         */
1616        @Deprecated
1617        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
1618                Secure.WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS;
1619
1620        /**
1621         * @deprecated Use
1622         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON} instead
1623         */
1624        @Deprecated
1625        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
1626            Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON;
1627
1628        /**
1629         * @deprecated Use
1630         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} instead
1631         */
1632        @Deprecated
1633        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
1634            Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY;
1635
1636        /**
1637         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_NUM_OPEN_NETWORKS_KEPT}
1638         * instead
1639         */
1640        @Deprecated
1641        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = Secure.WIFI_NUM_OPEN_NETWORKS_KEPT;
1642
1643        /**
1644         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_ON} instead
1645         */
1646        @Deprecated
1647        public static final String WIFI_ON = Secure.WIFI_ON;
1648
1649        /**
1650         * @deprecated Use
1651         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE}
1652         * instead
1653         */
1654        @Deprecated
1655        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
1656                Secure.WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE;
1657
1658        /**
1659         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_AP_COUNT} instead
1660         */
1661        @Deprecated
1662        public static final String WIFI_WATCHDOG_AP_COUNT = Secure.WIFI_WATCHDOG_AP_COUNT;
1663
1664        /**
1665         * @deprecated Use
1666         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS} instead
1667         */
1668        @Deprecated
1669        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
1670                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS;
1671
1672        /**
1673         * @deprecated Use
1674         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED} instead
1675         */
1676        @Deprecated
1677        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
1678                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED;
1679
1680        /**
1681         * @deprecated Use
1682         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS}
1683         * instead
1684         */
1685        @Deprecated
1686        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
1687                Secure.WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS;
1688
1689        /**
1690         * @deprecated Use
1691         * {@link android.provider.Settings.Secure#WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT} instead
1692         */
1693        @Deprecated
1694        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
1695            Secure.WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT;
1696
1697        /**
1698         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_MAX_AP_CHECKS}
1699         * instead
1700         */
1701        @Deprecated
1702        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = Secure.WIFI_WATCHDOG_MAX_AP_CHECKS;
1703
1704        /**
1705         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_ON} instead
1706         */
1707        @Deprecated
1708        public static final String WIFI_WATCHDOG_ON = Secure.WIFI_WATCHDOG_ON;
1709
1710        /**
1711         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_COUNT} instead
1712         */
1713        @Deprecated
1714        public static final String WIFI_WATCHDOG_PING_COUNT = Secure.WIFI_WATCHDOG_PING_COUNT;
1715
1716        /**
1717         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_DELAY_MS}
1718         * instead
1719         */
1720        @Deprecated
1721        public static final String WIFI_WATCHDOG_PING_DELAY_MS = Secure.WIFI_WATCHDOG_PING_DELAY_MS;
1722
1723        /**
1724         * @deprecated Use {@link android.provider.Settings.Secure#WIFI_WATCHDOG_PING_TIMEOUT_MS}
1725         * instead
1726         */
1727        @Deprecated
1728        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS =
1729            Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
1730    }
1731
1732    /**
1733     * Secure system settings, containing system preferences that applications
1734     * can read but are not allowed to write.  These are for preferences that
1735     * the user must explicitly modify through the system UI or specialized
1736     * APIs for those values, not modified directly by applications.
1737     */
1738    public static final class Secure extends NameValueTable {
1739        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_secure_version";
1740
1741        private static volatile NameValueCache mNameValueCache = null;
1742
1743        /**
1744         * Look up a name in the database.
1745         * @param resolver to access the database with
1746         * @param name to look up in the table
1747         * @return the corresponding value, or null if not present
1748         */
1749        public synchronized static String getString(ContentResolver resolver, String name) {
1750            if (mNameValueCache == null) {
1751                mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
1752            }
1753            return mNameValueCache.getString(resolver, name);
1754        }
1755
1756        /**
1757         * Store a name/value pair into the database.
1758         * @param resolver to access the database with
1759         * @param name to store
1760         * @param value to associate with the name
1761         * @return true if the value was set, false on database errors
1762         */
1763        public static boolean putString(ContentResolver resolver,
1764                String name, String value) {
1765            return putString(resolver, CONTENT_URI, name, value);
1766        }
1767
1768        /**
1769         * Construct the content URI for a particular name/value pair,
1770         * useful for monitoring changes with a ContentObserver.
1771         * @param name to look up in the table
1772         * @return the corresponding content URI, or null if not present
1773         */
1774        public static Uri getUriFor(String name) {
1775            return getUriFor(CONTENT_URI, name);
1776        }
1777
1778        /**
1779         * Convenience function for retrieving a single secure settings value
1780         * as an integer.  Note that internally setting values are always
1781         * stored as strings; this function converts the string to an integer
1782         * for you.  The default value will be returned if the setting is
1783         * not defined or not an integer.
1784         *
1785         * @param cr The ContentResolver to access.
1786         * @param name The name of the setting to retrieve.
1787         * @param def Value to return if the setting is not defined.
1788         *
1789         * @return The setting's current value, or 'def' if it is not defined
1790         * or not a valid integer.
1791         */
1792        public static int getInt(ContentResolver cr, String name, int def) {
1793            String v = getString(cr, name);
1794            try {
1795                return v != null ? Integer.parseInt(v) : def;
1796            } catch (NumberFormatException e) {
1797                return def;
1798            }
1799        }
1800
1801        /**
1802         * Convenience function for retrieving a single secure settings value
1803         * as an integer.  Note that internally setting values are always
1804         * stored as strings; this function converts the string to an integer
1805         * for you.
1806         * <p>
1807         * This version does not take a default value.  If the setting has not
1808         * been set, or the string value is not a number,
1809         * it throws {@link SettingNotFoundException}.
1810         *
1811         * @param cr The ContentResolver to access.
1812         * @param name The name of the setting to retrieve.
1813         *
1814         * @throws SettingNotFoundException Thrown if a setting by the given
1815         * name can't be found or the setting value is not an integer.
1816         *
1817         * @return The setting's current value.
1818         */
1819        public static int getInt(ContentResolver cr, String name)
1820                throws SettingNotFoundException {
1821            String v = getString(cr, name);
1822            try {
1823                return Integer.parseInt(v);
1824            } catch (NumberFormatException e) {
1825                throw new SettingNotFoundException(name);
1826            }
1827        }
1828
1829        /**
1830         * Convenience function for updating a single settings value as an
1831         * integer. This will either create a new entry in the table if the
1832         * given name does not exist, or modify the value of the existing row
1833         * with that name.  Note that internally setting values are always
1834         * stored as strings, so this function converts the given value to a
1835         * string before storing it.
1836         *
1837         * @param cr The ContentResolver to access.
1838         * @param name The name of the setting to modify.
1839         * @param value The new value for the setting.
1840         * @return true if the value was set, false on database errors
1841         */
1842        public static boolean putInt(ContentResolver cr, String name, int value) {
1843            return putString(cr, name, Integer.toString(value));
1844        }
1845
1846        /**
1847         * Convenience function for retrieving a single secure settings value
1848         * as a {@code long}.  Note that internally setting values are always
1849         * stored as strings; this function converts the string to a {@code long}
1850         * for you.  The default value will be returned if the setting is
1851         * not defined or not a {@code long}.
1852         *
1853         * @param cr The ContentResolver to access.
1854         * @param name The name of the setting to retrieve.
1855         * @param def Value to return if the setting is not defined.
1856         *
1857         * @return The setting's current value, or 'def' if it is not defined
1858         * or not a valid {@code long}.
1859         */
1860        public static long getLong(ContentResolver cr, String name, long def) {
1861            String valString = getString(cr, name);
1862            long value;
1863            try {
1864                value = valString != null ? Long.parseLong(valString) : def;
1865            } catch (NumberFormatException e) {
1866                value = def;
1867            }
1868            return value;
1869        }
1870
1871        /**
1872         * Convenience function for retrieving a single secure settings value
1873         * as a {@code long}.  Note that internally setting values are always
1874         * stored as strings; this function converts the string to a {@code long}
1875         * for you.
1876         * <p>
1877         * This version does not take a default value.  If the setting has not
1878         * been set, or the string value is not a number,
1879         * it throws {@link SettingNotFoundException}.
1880         *
1881         * @param cr The ContentResolver to access.
1882         * @param name The name of the setting to retrieve.
1883         *
1884         * @return The setting's current value.
1885         * @throws SettingNotFoundException Thrown if a setting by the given
1886         * name can't be found or the setting value is not an integer.
1887         */
1888        public static long getLong(ContentResolver cr, String name)
1889                throws SettingNotFoundException {
1890            String valString = getString(cr, name);
1891            try {
1892                return Long.parseLong(valString);
1893            } catch (NumberFormatException e) {
1894                throw new SettingNotFoundException(name);
1895            }
1896        }
1897
1898        /**
1899         * Convenience function for updating a secure settings value as a long
1900         * integer. This will either create a new entry in the table if the
1901         * given name does not exist, or modify the value of the existing row
1902         * with that name.  Note that internally setting values are always
1903         * stored as strings, so this function converts the given value to a
1904         * string before storing it.
1905         *
1906         * @param cr The ContentResolver to access.
1907         * @param name The name of the setting to modify.
1908         * @param value The new value for the setting.
1909         * @return true if the value was set, false on database errors
1910         */
1911        public static boolean putLong(ContentResolver cr, String name, long value) {
1912            return putString(cr, name, Long.toString(value));
1913        }
1914
1915        /**
1916         * Convenience function for retrieving a single secure settings value
1917         * as a floating point number.  Note that internally setting values are
1918         * always stored as strings; this function converts the string to an
1919         * float for you. The default value will be returned if the setting
1920         * is not defined or not a valid float.
1921         *
1922         * @param cr The ContentResolver to access.
1923         * @param name The name of the setting to retrieve.
1924         * @param def Value to return if the setting is not defined.
1925         *
1926         * @return The setting's current value, or 'def' if it is not defined
1927         * or not a valid float.
1928         */
1929        public static float getFloat(ContentResolver cr, String name, float def) {
1930            String v = getString(cr, name);
1931            try {
1932                return v != null ? Float.parseFloat(v) : def;
1933            } catch (NumberFormatException e) {
1934                return def;
1935            }
1936        }
1937
1938        /**
1939         * Convenience function for retrieving a single secure settings value
1940         * as a float.  Note that internally setting values are always
1941         * stored as strings; this function converts the string to a float
1942         * for you.
1943         * <p>
1944         * This version does not take a default value.  If the setting has not
1945         * been set, or the string value is not a number,
1946         * it throws {@link SettingNotFoundException}.
1947         *
1948         * @param cr The ContentResolver to access.
1949         * @param name The name of the setting to retrieve.
1950         *
1951         * @throws SettingNotFoundException Thrown if a setting by the given
1952         * name can't be found or the setting value is not a float.
1953         *
1954         * @return The setting's current value.
1955         */
1956        public static float getFloat(ContentResolver cr, String name)
1957                throws SettingNotFoundException {
1958            String v = getString(cr, name);
1959            try {
1960                return Float.parseFloat(v);
1961            } catch (NumberFormatException e) {
1962                throw new SettingNotFoundException(name);
1963            }
1964        }
1965
1966        /**
1967         * Convenience function for updating a single settings value as a
1968         * floating point number. This will either create a new entry in the
1969         * table if the given name does not exist, or modify the value of the
1970         * existing row with that name.  Note that internally setting values
1971         * are always stored as strings, so this function converts the given
1972         * value to a string before storing it.
1973         *
1974         * @param cr The ContentResolver to access.
1975         * @param name The name of the setting to modify.
1976         * @param value The new value for the setting.
1977         * @return true if the value was set, false on database errors
1978         */
1979        public static boolean putFloat(ContentResolver cr, String name, float value) {
1980            return putString(cr, name, Float.toString(value));
1981        }
1982
1983        /**
1984         * The content:// style URL for this table
1985         */
1986        public static final Uri CONTENT_URI =
1987            Uri.parse("content://" + AUTHORITY + "/secure");
1988
1989        /**
1990         * Whether ADB is enabled.
1991         */
1992        public static final String ADB_ENABLED = "adb_enabled";
1993
1994        /**
1995         * Setting to allow mock locations and location provider status to be injected into the
1996         * LocationManager service for testing purposes during application development.  These
1997         * locations and status values  override actual location and status information generated
1998         * by network, gps, or other location providers.
1999         */
2000        public static final String ALLOW_MOCK_LOCATION = "mock_location";
2001
2002        /**
2003         * The Android ID (a unique 64-bit value) as a hex string.
2004         * Identical to that obtained by calling
2005         * GoogleLoginService.getAndroidId(); it is also placed here
2006         * so you can get it without binding to a service.
2007         */
2008        public static final String ANDROID_ID = "android_id";
2009
2010        /**
2011         * Whether bluetooth is enabled/disabled
2012         * 0=disabled. 1=enabled.
2013         */
2014        public static final String BLUETOOTH_ON = "bluetooth_on";
2015
2016        /**
2017         * Get the key that retrieves a bluetooth headset's priority.
2018         * @hide
2019         */
2020        public static final String getBluetoothHeadsetPriorityKey(String address) {
2021            return ("bluetooth_headset_priority_" + address.toUpperCase());
2022        }
2023
2024        /**
2025         * Get the key that retrieves a bluetooth a2dp sink's priority.
2026         * @hide
2027         */
2028        public static final String getBluetoothA2dpSinkPriorityKey(String address) {
2029            return ("bluetooth_a2dp_sink_priority_" + address.toUpperCase());
2030        }
2031
2032        /**
2033         * Whether or not data roaming is enabled. (0 = false, 1 = true)
2034         */
2035        public static final String DATA_ROAMING = "data_roaming";
2036
2037        /**
2038         * Setting to record the input method used by default, holding the ID
2039         * of the desired method.
2040         */
2041        public static final String DEFAULT_INPUT_METHOD = "default_input_method";
2042
2043        /**
2044         * Whether the device has been provisioned (0 = false, 1 = true)
2045         */
2046        public static final String DEVICE_PROVISIONED = "device_provisioned";
2047
2048        /**
2049         * List of input methods that are currently enabled.  This is a string
2050         * containing the IDs of all enabled input methods, each ID separated
2051         * by ':'.
2052         */
2053        public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
2054
2055        /**
2056         * Host name and port for a user-selected proxy.
2057         */
2058        public static final String HTTP_PROXY = "http_proxy";
2059
2060        /**
2061         * Whether the package installer should allow installation of apps downloaded from
2062         * sources other than the Android Market (vending machine).
2063         *
2064         * 1 = allow installing from other sources
2065         * 0 = only allow installing from the Android Market
2066         */
2067        public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
2068
2069        /**
2070         * Comma-separated list of location providers that activities may access.
2071         */
2072        public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
2073
2074        /**
2075         * Whether assisted GPS should be enabled or not.
2076         * @hide
2077         */
2078        public static final String ASSISTED_GPS_ENABLED = "assisted_gps_enabled";
2079
2080        /**
2081         * The Logging ID (a unique 64-bit value) as a hex string.
2082         * Used as a pseudonymous identifier for logging.
2083         * @deprecated This identifier is poorly initialized and has
2084         * many collisions.  It should not be used.
2085         */
2086        @Deprecated
2087        public static final String LOGGING_ID = "logging_id";
2088
2089        /**
2090         * The Logging ID (a unique 64-bit value) as a hex string.
2091         * Used as a pseudonymous identifier for logging.
2092         * @hide
2093         */
2094        public static final String LOGGING_ID2 = "logging_id2";
2095
2096        /**
2097         * User preference for which network(s) should be used. Only the
2098         * connectivity service should touch this.
2099         */
2100        public static final String NETWORK_PREFERENCE = "network_preference";
2101
2102        /**
2103         */
2104        public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
2105
2106        /**
2107         */
2108        public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
2109
2110        /**
2111         */
2112        public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
2113
2114        /**
2115         * Settings classname to launch when Settings is clicked from All
2116         * Applications.  Needed because of user testing between the old
2117         * and new Settings apps.
2118         */
2119        // TODO: 881807
2120        public static final String SETTINGS_CLASSNAME = "settings_classname";
2121
2122        /**
2123         * USB Mass Storage Enabled
2124         */
2125        public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
2126
2127        /**
2128         * If this setting is set (to anything), then all references
2129         * to Gmail on the device must change to Google Mail.
2130         */
2131        public static final String USE_GOOGLE_MAIL = "use_google_mail";
2132
2133        /**
2134         * If accessibility is enabled.
2135         */
2136        public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
2137
2138        /**
2139         * List of the enabled accessibility providers.
2140         */
2141        public static final String ENABLED_ACCESSIBILITY_SERVICES =
2142            "enabled_accessibility_services";
2143
2144        /**
2145         * Setting to always use the default text-to-speech settings regardless
2146         * of the application settings.
2147         * 1 = override application settings,
2148         * 0 = use application settings (if specified).
2149         */
2150        public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
2151
2152        /**
2153         * Default text-to-speech engine speech rate. 100 = 1x
2154         */
2155        public static final String TTS_DEFAULT_RATE = "tts_default_rate";
2156
2157        /**
2158         * Default text-to-speech engine pitch. 100 = 1x
2159         */
2160        public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
2161
2162        /**
2163         * Default text-to-speech engine.
2164         */
2165        public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
2166
2167        /**
2168         * Default text-to-speech language.
2169         */
2170        public static final String TTS_DEFAULT_LANG = "tts_default_lang";
2171
2172        /**
2173         * Default text-to-speech country.
2174         */
2175        public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
2176
2177        /**
2178         * Default text-to-speech locale variant.
2179         */
2180        public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
2181
2182        /**
2183         * Whether to notify the user of open networks.
2184         * <p>
2185         * If not connected and the scan results have an open network, we will
2186         * put this notification up. If we attempt to connect to a network or
2187         * the open network(s) disappear, we remove the notification. When we
2188         * show the notification, we will not show it again for
2189         * {@link android.provider.Settings.Secure#WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY} time.
2190         */
2191        public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON =
2192                "wifi_networks_available_notification_on";
2193
2194        /**
2195         * Delay (in seconds) before repeating the Wi-Fi networks available notification.
2196         * Connecting to a network will reset the timer.
2197         */
2198        public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY =
2199                "wifi_networks_available_repeat_delay";
2200
2201        /**
2202         * The number of radio channels that are allowed in the local
2203         * 802.11 regulatory domain.
2204         * @hide
2205         */
2206        public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels";
2207
2208        /**
2209         * When the number of open networks exceeds this number, the
2210         * least-recently-used excess networks will be removed.
2211         */
2212        public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
2213
2214        /**
2215         * Whether the Wi-Fi should be on.  Only the Wi-Fi service should touch this.
2216         */
2217        public static final String WIFI_ON = "wifi_on";
2218
2219        /**
2220         * The acceptable packet loss percentage (range 0 - 100) before trying
2221         * another AP on the same network.
2222         */
2223        public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE =
2224                "wifi_watchdog_acceptable_packet_loss_percentage";
2225
2226        /**
2227         * The number of access points required for a network in order for the
2228         * watchdog to monitor it.
2229         */
2230        public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
2231
2232        /**
2233         * The delay between background checks.
2234         */
2235        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS =
2236                "wifi_watchdog_background_check_delay_ms";
2237
2238        /**
2239         * Whether the Wi-Fi watchdog is enabled for background checking even
2240         * after it thinks the user has connected to a good access point.
2241         */
2242        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED =
2243                "wifi_watchdog_background_check_enabled";
2244
2245        /**
2246         * The timeout for a background ping
2247         */
2248        public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS =
2249                "wifi_watchdog_background_check_timeout_ms";
2250
2251        /**
2252         * The number of initial pings to perform that *may* be ignored if they
2253         * fail. Again, if these fail, they will *not* be used in packet loss
2254         * calculation. For example, one network always seemed to time out for
2255         * the first couple pings, so this is set to 3 by default.
2256         */
2257        public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT =
2258            "wifi_watchdog_initial_ignored_ping_count";
2259
2260        /**
2261         * The maximum number of access points (per network) to attempt to test.
2262         * If this number is reached, the watchdog will no longer monitor the
2263         * initial connection state for the network. This is a safeguard for
2264         * networks containing multiple APs whose DNS does not respond to pings.
2265         */
2266        public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
2267
2268        /**
2269         * Whether the Wi-Fi watchdog is enabled.
2270         */
2271        public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
2272
2273        /**
2274         * A comma-separated list of SSIDs for which the Wi-Fi watchdog should be enabled.
2275         */
2276        public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
2277
2278        /**
2279         * The number of pings to test if an access point is a good connection.
2280         */
2281        public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
2282
2283        /**
2284         * The delay between pings.
2285         */
2286        public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
2287
2288        /**
2289         * The timeout per ping.
2290         */
2291        public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
2292
2293        /**
2294         * The maximum number of times we will retry a connection to an access
2295         * point for which we have failed in acquiring an IP address from DHCP.
2296         * A value of N means that we will make N+1 connection attempts in all.
2297         */
2298        public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
2299
2300        /**
2301         * Maximum amount of time in milliseconds to hold a wakelock while waiting for mobile
2302         * data connectivity to be established after a disconnect from Wi-Fi.
2303         */
2304        public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS =
2305            "wifi_mobile_data_transition_wakelock_timeout_ms";
2306
2307        /**
2308         * Whether background data usage is allowed by the user. See
2309         * ConnectivityManager for more info.
2310         */
2311        public static final String BACKGROUND_DATA = "background_data";
2312
2313        /**
2314         * The time in msec, when the LAST_KMSG file was send to the checkin server.
2315         * We will only send the LAST_KMSG file if it was modified after this time.
2316         *
2317         * @hide
2318         */
2319        public static final String CHECKIN_SEND_LAST_KMSG_TIME = "checkin_kmsg_time";
2320
2321        /**
2322         * The time in msec, when the apanic_console file was send to the checkin server.
2323         * We will only send the apanic_console file if it was modified after this time.
2324         *
2325         * @hide
2326         */
2327        public static final String CHECKIN_SEND_APANIC_CONSOLE_TIME =
2328            "checkin_apanic_console_time";
2329
2330        /**
2331         * The time in msec, when the apanic_thread file was send to the checkin server.
2332         * We will only send the apanic_thread file if it was modified after this time.
2333         *
2334         * @hide
2335         */
2336        public static final String CHECKIN_SEND_APANIC_THREAD_TIME =
2337            "checkin_apanic_thread_time";
2338
2339        /**
2340         * The CDMA roaming mode 0 = Home Networks, CDMA default
2341         *                       1 = Roaming on Affiliated networks
2342         *                       2 = Roaming on any networks
2343         * @hide
2344         */
2345        public static final String CDMA_ROAMING_MODE = "roaming_settings";
2346
2347        /**
2348         * The CDMA subscription mode 0 = RUIM/SIM (default)
2349         *                                1 = NV
2350         * @hide
2351         */
2352        public static final String CDMA_SUBSCRIPTION_MODE = "subscription_mode";
2353
2354        /**
2355         * The preferred network mode   7 = Global
2356         *                              6 = EvDo only
2357         *                              5 = CDMA w/o EvDo
2358         *                              4 = CDMA / EvDo auto
2359         *                              3 = GSM / WCDMA auto
2360         *                              2 = WCDMA only
2361         *                              1 = GSM only
2362         *                              0 = GSM / WCDMA preferred
2363         * @hide
2364         */
2365        public static final String PREFERRED_NETWORK_MODE =
2366                "preferred_network_mode";
2367
2368        /**
2369         * The preferred TTY mode     0 = TTy Off, CDMA default
2370         *                            1 = TTY Full
2371         *                            2 = TTY HCO
2372         *                            3 = TTY VCO
2373         * @hide
2374         */
2375        public static final String PREFERRED_TTY_MODE =
2376                "preferred_tty_mode";
2377
2378
2379        /**
2380         * CDMA Cell Broadcast SMS
2381         *                            0 = CDMA Cell Broadcast SMS disabled
2382         *                            1 = CDMA Cell Broadcast SMS enabled
2383         * @hide
2384         */
2385        public static final String CDMA_CELL_BROADCAST_SMS =
2386                "cdma_cell_broadcast_sms";
2387
2388        /**
2389         * The cdma subscription 0 = Subscription from RUIM, when available
2390         *                       1 = Subscription from NV
2391         * @hide
2392         */
2393        public static final String PREFERRED_CDMA_SUBSCRIPTION =
2394                "preferred_cdma_subscription";
2395
2396        /**
2397         * Whether the enhanced voice privacy mode is enabled.
2398         * 0 = normal voice privacy
2399         * 1 = enhanced voice privacy
2400         * @hide
2401         */
2402        public static final String ENHANCED_VOICE_PRIVACY_ENABLED = "enhanced_voice_privacy_enabled";
2403
2404        /**
2405         * Whether the TTY mode mode is enabled.
2406         * 0 = disabled
2407         * 1 = enabled
2408         * @hide
2409         */
2410        public static final String TTY_MODE_ENABLED = "tty_mode_enabled";
2411
2412        /**
2413         * Flag for allowing service provider to use location information to improve products and
2414         * services.
2415         * Type: int ( 0 = disallow, 1 = allow )
2416         * @hide
2417         */
2418        public static final String USE_LOCATION_FOR_SERVICES = "use_location";
2419
2420        /**
2421         * Controls whether settings backup is enabled.
2422         * Type: int ( 0 = disabled, 1 = enabled )
2423         * @hide
2424         */
2425        public static final String BACKUP_ENABLED = "backup_enabled";
2426
2427        /**
2428         * Indicates whether settings backup has been fully provisioned.
2429         * Type: int ( 0 = unprovisioned, 1 = fully provisioned )
2430         * @hide
2431         */
2432        public static final String BACKUP_PROVISIONED = "backup_provisioned";
2433
2434        /**
2435         * Component of the transport to use for backup/restore.
2436         * @hide
2437         */
2438        public static final String BACKUP_TRANSPORT = "backup_transport";
2439
2440        /**
2441         * Version for which the setup wizard was last shown.  Bumped for
2442         * each release when there is new setup information to show.
2443         * @hide
2444         */
2445        public static final String LAST_SETUP_SHOWN = "last_setup_shown";
2446
2447        /**
2448         * @hide
2449         */
2450        public static final String[] SETTINGS_TO_BACKUP = {
2451            ADB_ENABLED,
2452            ALLOW_MOCK_LOCATION,
2453            PARENTAL_CONTROL_ENABLED,
2454            PARENTAL_CONTROL_REDIRECT_URL,
2455            USB_MASS_STORAGE_ENABLED,
2456            ACCESSIBILITY_ENABLED,
2457            ENABLED_ACCESSIBILITY_SERVICES,
2458            TTS_USE_DEFAULTS,
2459            TTS_DEFAULT_RATE,
2460            TTS_DEFAULT_PITCH,
2461            TTS_DEFAULT_SYNTH,
2462            TTS_DEFAULT_LANG,
2463            TTS_DEFAULT_COUNTRY,
2464            WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON,
2465            WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY,
2466            WIFI_NUM_ALLOWED_CHANNELS,
2467            WIFI_NUM_OPEN_NETWORKS_KEPT,
2468        };
2469
2470        /**
2471         * Helper method for determining if a location provider is enabled.
2472         * @param cr the content resolver to use
2473         * @param provider the location provider to query
2474         * @return true if the provider is enabled
2475         *
2476         * @hide
2477         */
2478        public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) {
2479            String allowedProviders = Settings.Secure.getString(cr, LOCATION_PROVIDERS_ALLOWED);
2480            if (allowedProviders != null) {
2481                return (allowedProviders.equals(provider) ||
2482                        allowedProviders.contains("," + provider + ",") ||
2483                        allowedProviders.startsWith(provider + ",") ||
2484                        allowedProviders.endsWith("," + provider));
2485            }
2486            return false;
2487        }
2488
2489        /**
2490         * Thread-safe method for enabling or disabling a single location provider.
2491         * @param cr the content resolver to use
2492         * @param provider the location provider to enable or disable
2493         * @param enabled true if the provider should be enabled
2494         *
2495         * @hide
2496         */
2497        public static final void setLocationProviderEnabled(ContentResolver cr,
2498                String provider, boolean enabled) {
2499            // to ensure thread safety, we write the provider name with a '+' or '-'
2500            // and let the SettingsProvider handle it rather than reading and modifying
2501            // the list of enabled providers.
2502            if (enabled) {
2503                provider = "+" + provider;
2504            } else {
2505                provider = "-" + provider;
2506            }
2507            putString(cr, Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider);
2508        }
2509    }
2510
2511    /**
2512     * Gservices settings, containing the network names for Google's
2513     * various services. This table holds simple name/addr pairs.
2514     * Addresses can be accessed through the getString() method.
2515     *
2516     * TODO: This should move to partner/google/... somewhere.
2517     *
2518     * @hide
2519     */
2520    public static final class Gservices extends NameValueTable {
2521        public static final String SYS_PROP_SETTING_VERSION = "sys.settings_gservices_version";
2522
2523        /**
2524         * Intent action broadcast when the Gservices table is updated by the server.
2525         * This is broadcast once after settings change (so many values may have been updated).
2526         */
2527        @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2528        public static final String CHANGED_ACTION =
2529            "com.google.gservices.intent.action.GSERVICES_CHANGED";
2530
2531        /**
2532         * Intent action to override Gservices for testing.  (Requires WRITE_GSERVICES permission.)
2533         */
2534        @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2535        public static final String OVERRIDE_ACTION =
2536            "com.google.gservices.intent.action.GSERVICES_OVERRIDE";
2537
2538        /**
2539         * Intent action to set Gservices with new values.  (Requires WRITE_GSERVICES permission.)
2540         */
2541        @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
2542        public static final String UPDATE_ACTION =
2543            "com.google.gservices.intent.action.GSERVICES_UPDATE";
2544
2545        private static volatile NameValueCache mNameValueCache = null;
2546        private static final Object mNameValueCacheLock = new Object();
2547
2548        /**
2549         * Look up a name in the database.
2550         * @param resolver to access the database with
2551         * @param name to look up in the table
2552         * @return the corresponding value, or null if not present
2553         */
2554        public static String getString(ContentResolver resolver, String name) {
2555            synchronized (mNameValueCacheLock) {
2556                if (mNameValueCache == null) {
2557                    mNameValueCache = new NameValueCache(SYS_PROP_SETTING_VERSION, CONTENT_URI);
2558                }
2559                return mNameValueCache.getString(resolver, name);
2560            }
2561        }
2562
2563        /**
2564         * Store a name/value pair into the database.
2565         * @param resolver to access the database with
2566         * @param name to store
2567         * @param value to associate with the name
2568         * @return true if the value was set, false on database errors
2569         */
2570        public static boolean putString(ContentResolver resolver,
2571                String name, String value) {
2572            return putString(resolver, CONTENT_URI, name, value);
2573        }
2574
2575        /**
2576         * Look up the value for name in the database, convert it to an int using Integer.parseInt
2577         * and return it. If it is null or if a NumberFormatException is caught during the
2578         * conversion then return defValue.
2579         */
2580        public static int getInt(ContentResolver resolver, String name, int defValue) {
2581            String valString = getString(resolver, name);
2582            int value;
2583            try {
2584                value = valString != null ? Integer.parseInt(valString) : defValue;
2585            } catch (NumberFormatException e) {
2586                value = defValue;
2587            }
2588            return value;
2589        }
2590
2591        /**
2592         * Look up the value for name in the database, convert it to a long using Long.parseLong
2593         * and return it. If it is null or if a NumberFormatException is caught during the
2594         * conversion then return defValue.
2595         */
2596        public static long getLong(ContentResolver resolver, String name, long defValue) {
2597            String valString = getString(resolver, name);
2598            long value;
2599            try {
2600                value = valString != null ? Long.parseLong(valString) : defValue;
2601            } catch (NumberFormatException e) {
2602                value = defValue;
2603            }
2604            return value;
2605        }
2606
2607        /**
2608         * Construct the content URI for a particular name/value pair,
2609         * useful for monitoring changes with a ContentObserver.
2610         * @param name to look up in the table
2611         * @return the corresponding content URI, or null if not present
2612         */
2613        public static Uri getUriFor(String name) {
2614            return getUriFor(CONTENT_URI, name);
2615        }
2616
2617        /**
2618         * The content:// style URL for this table
2619         */
2620        public static final Uri CONTENT_URI =
2621                Uri.parse("content://" + AUTHORITY + "/gservices");
2622
2623        /**
2624         * MMS - URL to use for HTTP "x-wap-profile" header
2625         */
2626        public static final String MMS_X_WAP_PROFILE_URL
2627                = "mms_x_wap_profile_url";
2628
2629        /**
2630         * YouTube - the flag to indicate whether to use proxy
2631         */
2632        public static final String YOUTUBE_USE_PROXY
2633                = "youtube_use_proxy";
2634
2635        /**
2636         * MMS - maximum message size in bytes for a MMS message.
2637         */
2638        public static final String MMS_MAXIMUM_MESSAGE_SIZE
2639                = "mms_maximum_message_size";
2640
2641        /**
2642         * Event tags from the kernel event log to upload during checkin.
2643         */
2644        public static final String CHECKIN_EVENTS = "checkin_events";
2645
2646        /**
2647         * Comma-separated list of service names to dump and upload during checkin.
2648         */
2649        public static final String CHECKIN_DUMPSYS_LIST = "checkin_dumpsys_list";
2650
2651        /**
2652         * Comma-separated list of packages to specify for each service that is
2653         * dumped (currently only meaningful for user activity).
2654         */
2655        public static final String CHECKIN_PACKAGE_LIST = "checkin_package_list";
2656
2657        /**
2658         * The interval (in seconds) between periodic checkin attempts.
2659         */
2660        public static final String CHECKIN_INTERVAL = "checkin_interval";
2661
2662        /**
2663         * The interval (in seconds) between event log aggregation runs.
2664         */
2665        public static final String AGGREGATION_INTERVAL_SECONDS = "aggregation_interval_seconds";
2666
2667        /**
2668         * Boolean indicating if the market app should force market only checkins on
2669         * install/uninstall. Any non-0 value is considered true.
2670         */
2671        public static final String MARKET_FORCE_CHECKIN = "market_force_checkin";
2672
2673        /**
2674         * How frequently (in seconds) to check the memory status of the
2675         * device.
2676         */
2677        public static final String MEMCHECK_INTERVAL = "memcheck_interval";
2678
2679        /**
2680         * Max frequency (in seconds) to log memory check stats, in realtime
2681         * seconds.  This allows for throttling of logs when the device is
2682         * running for large amounts of time.
2683         */
2684        public static final String MEMCHECK_LOG_REALTIME_INTERVAL =
2685                "memcheck_log_realtime_interval";
2686
2687        /**
2688         * Boolean indicating whether rebooting due to system memory checks
2689         * is enabled.
2690         */
2691        public static final String MEMCHECK_SYSTEM_ENABLED = "memcheck_system_enabled";
2692
2693        /**
2694         * How many bytes the system process must be below to avoid scheduling
2695         * a soft reboot.  This reboot will happen when it is next determined
2696         * to be a good time.
2697         */
2698        public static final String MEMCHECK_SYSTEM_SOFT_THRESHOLD = "memcheck_system_soft";
2699
2700        /**
2701         * How many bytes the system process must be below to avoid scheduling
2702         * a hard reboot.  This reboot will happen immediately.
2703         */
2704        public static final String MEMCHECK_SYSTEM_HARD_THRESHOLD = "memcheck_system_hard";
2705
2706        /**
2707         * How many bytes the phone process must be below to avoid scheduling
2708         * a soft restart.  This restart will happen when it is next determined
2709         * to be a good time.
2710         */
2711        public static final String MEMCHECK_PHONE_SOFT_THRESHOLD = "memcheck_phone_soft";
2712
2713        /**
2714         * How many bytes the phone process must be below to avoid scheduling
2715         * a hard restart.  This restart will happen immediately.
2716         */
2717        public static final String MEMCHECK_PHONE_HARD_THRESHOLD = "memcheck_phone_hard";
2718
2719        /**
2720         * Boolean indicating whether restarting the phone process due to
2721         * memory checks is enabled.
2722         */
2723        public static final String MEMCHECK_PHONE_ENABLED = "memcheck_phone_enabled";
2724
2725        /**
2726         * First time during the day it is okay to kill processes
2727         * or reboot the device due to low memory situations.  This number is
2728         * in seconds since midnight.
2729         */
2730        public static final String MEMCHECK_EXEC_START_TIME = "memcheck_exec_start_time";
2731
2732        /**
2733         * Last time during the day it is okay to kill processes
2734         * or reboot the device due to low memory situations.  This number is
2735         * in seconds since midnight.
2736         */
2737        public static final String MEMCHECK_EXEC_END_TIME = "memcheck_exec_end_time";
2738
2739        /**
2740         * How long the screen must have been off in order to kill processes
2741         * or reboot.  This number is in seconds.  A value of -1 means to
2742         * entirely disregard whether the screen is on.
2743         */
2744        public static final String MEMCHECK_MIN_SCREEN_OFF = "memcheck_min_screen_off";
2745
2746        /**
2747         * How much time there must be until the next alarm in order to kill processes
2748         * or reboot.  This number is in seconds.  Note: this value must be
2749         * smaller than {@link #MEMCHECK_RECHECK_INTERVAL} or else it will
2750         * always see an alarm scheduled within its time.
2751         */
2752        public static final String MEMCHECK_MIN_ALARM = "memcheck_min_alarm";
2753
2754        /**
2755         * How frequently to check whether it is a good time to restart things,
2756         * if the device is in a bad state.  This number is in seconds.  Note:
2757         * this value must be larger than {@link #MEMCHECK_MIN_ALARM} or else
2758         * the alarm to schedule the recheck will always appear within the
2759         * minimum "do not execute now" time.
2760         */
2761        public static final String MEMCHECK_RECHECK_INTERVAL = "memcheck_recheck_interval";
2762
2763        /**
2764         * How frequently (in DAYS) to reboot the device.  If 0, no reboots
2765         * will occur.
2766         */
2767        public static final String REBOOT_INTERVAL = "reboot_interval";
2768
2769        /**
2770         * First time during the day it is okay to force a reboot of the
2771         * device (if REBOOT_INTERVAL is set).  This number is
2772         * in seconds since midnight.
2773         */
2774        public static final String REBOOT_START_TIME = "reboot_start_time";
2775
2776        /**
2777         * The window of time (in seconds) after each REBOOT_INTERVAL in which
2778         * a reboot can be executed.  If 0, a reboot will always be executed at
2779         * exactly the given time.  Otherwise, it will only be executed if
2780         * the device is idle within the window.
2781         */
2782        public static final String REBOOT_WINDOW = "reboot_window";
2783
2784        /**
2785         * The minimum version of the server that is required in order for the device to accept
2786         * the server's recommendations about the initial sync settings to use. When this is unset,
2787         * blank or can't be interpreted as an integer then we will not ask the server for a
2788         * recommendation.
2789         */
2790        public static final String GMAIL_CONFIG_INFO_MIN_SERVER_VERSION =
2791                "gmail_config_info_min_server_version";
2792
2793        /**
2794         * Controls whether Gmail offers a preview button for images.
2795         */
2796        public static final String GMAIL_DISALLOW_IMAGE_PREVIEWS = "gmail_disallow_image_previews";
2797
2798        /**
2799         * The maximal size in bytes allowed for attachments when composing messages in Gmail
2800         */
2801        public static final String GMAIL_MAX_ATTACHMENT_SIZE = "gmail_max_attachment_size_bytes";
2802
2803        /**
2804         * The timeout in milliseconds that Gmail uses when opening a connection and reading
2805         * from it. A missing value or a value of -1 instructs Gmail to use the defaults provided
2806         * by GoogleHttpClient.
2807         */
2808        public static final String GMAIL_TIMEOUT_MS = "gmail_timeout_ms";
2809
2810        /**
2811         * Controls whether Gmail will request an expedited sync when a message is sent. Value must
2812         * be an integer where non-zero means true. Defaults to 1.
2813         */
2814        public static final String GMAIL_SEND_IMMEDIATELY = "gmail_send_immediately";
2815
2816        /**
2817         * Controls whether gmail buffers server responses.  Possible values are "memory", for a
2818         * memory-based buffer, or "file", for a temp-file-based buffer.  All other values
2819         * (including not set) disable buffering.
2820         */
2821        public static final String GMAIL_BUFFER_SERVER_RESPONSE = "gmail_buffer_server_response";
2822
2823        /**
2824         * The maximum size in bytes allowed for the provider to gzip a protocol buffer uploaded to
2825         * the server.
2826         */
2827        public static final String GMAIL_MAX_GZIP_SIZE = "gmail_max_gzip_size_bytes";
2828
2829        /**
2830         * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
2831         * an integer where non-zero means true. Defaults to 1. This flag controls Donut devices.
2832         */
2833        public static final String GMAIL_DISCARD_ERROR_UPHILL_OP = "gmail_discard_error_uphill_op";
2834
2835        /**
2836         * Controls whether Gmail will discard uphill operations that repeatedly fail. Value must be
2837         * an integer where non-zero means true. Defaults to 1. This flag controls Eclair and
2838         * future devices.
2839         */
2840        public static final String GMAIL_DISCARD_ERROR_UPHILL_OP_NEW =
2841            "gmail_discard_error_uphill_op_new";
2842
2843        /**
2844         * Controls how many attempts Gmail will try to upload an uphill operations before it
2845         * abandons the operation. Defaults to 20.
2846         */
2847        public static final String GMAIL_NUM_RETRY_UPHILL_OP = "gmail_num_retry_uphill_op";
2848
2849        /**
2850         * How much time in seconds Gmail will try to upload an uphill operations before it
2851         * abandons the operation. Defaults to 36400 (one day).
2852         */
2853        public static final String GMAIL_WAIT_TIME_RETRY_UPHILL_OP =
2854                "gmail_wait_time_retry_uphill_op";
2855
2856        /**
2857         * Controls if Gmail should delay sending operations that have previously failed.
2858         */
2859        public static final String GMAIL_DELAY_BAD_OP = "gmail_delay_bad_op";
2860
2861        /**
2862         * Controls if the protocol buffer version of the protocol will use a multipart request for
2863         * attachment uploads. Value must be an integer where non-zero means true. Defaults to 0.
2864         */
2865        public static final String GMAIL_USE_MULTIPART_PROTOBUF = "gmail_use_multipart_protobuf";
2866
2867        /**
2868         * the transcoder URL for mobile devices.
2869         */
2870        public static final String TRANSCODER_URL = "mobile_transcoder_url";
2871
2872        /**
2873         * URL that points to the privacy terms of the Google Talk service.
2874         */
2875        public static final String GTALK_TERMS_OF_SERVICE_URL = "gtalk_terms_of_service_url";
2876
2877        /**
2878         * Hostname of the GTalk server.
2879         */
2880        public static final String GTALK_SERVICE_HOSTNAME = "gtalk_hostname";
2881
2882        /**
2883         * Secure port of the GTalk server.
2884         */
2885        public static final String GTALK_SERVICE_SECURE_PORT = "gtalk_secure_port";
2886
2887        /**
2888         * The server configurable RMQ acking interval
2889         */
2890        public static final String GTALK_SERVICE_RMQ_ACK_INTERVAL = "gtalk_rmq_ack_interval";
2891
2892        /**
2893         * The minimum reconnect delay for short network outages or when the network is suspended
2894         * due to phone use.
2895         */
2896        public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT =
2897                "gtalk_min_reconnect_delay_short";
2898
2899        /**
2900         * The reconnect variant range for short network outages or when the network is suspended
2901         * due to phone use. A random number between 0 and this constant is computed and
2902         * added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_SHORT} to form the initial reconnect
2903         * delay.
2904         */
2905        public static final String GTALK_SERVICE_RECONNECT_VARIANT_SHORT =
2906                "gtalk_reconnect_variant_short";
2907
2908        /**
2909         * The minimum reconnect delay for long network outages
2910         */
2911        public static final String GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG =
2912                "gtalk_min_reconnect_delay_long";
2913
2914        /**
2915         * The reconnect variant range for long network outages.  A random number between 0 and this
2916         * constant is computed and added to {@link #GTALK_SERVICE_MIN_RECONNECT_DELAY_LONG} to
2917         * form the initial reconnect delay.
2918         */
2919        public static final String GTALK_SERVICE_RECONNECT_VARIANT_LONG =
2920                "gtalk_reconnect_variant_long";
2921
2922        /**
2923         * The maximum reconnect delay time, in milliseconds.
2924         */
2925        public static final String GTALK_SERVICE_MAX_RECONNECT_DELAY =
2926                "gtalk_max_reconnect_delay";
2927
2928        /**
2929         * The network downtime that is considered "short" for the above calculations,
2930         * in milliseconds.
2931         */
2932        public static final String GTALK_SERVICE_SHORT_NETWORK_DOWNTIME =
2933                "gtalk_short_network_downtime";
2934
2935        /**
2936         * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2937         * will reset the heartbeat timer. The away heartbeat should be used when the user is
2938         * logged into the GTalk app, but not actively using it.
2939         */
2940        public static final String GTALK_SERVICE_AWAY_HEARTBEAT_INTERVAL_MS =
2941                "gtalk_heartbeat_ping_interval_ms";  // keep the string backward compatible
2942
2943        /**
2944         * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2945         * will reset the heartbeat timer. The active heartbeat should be used when the user is
2946         * actively using the GTalk app.
2947         */
2948        public static final String GTALK_SERVICE_ACTIVE_HEARTBEAT_INTERVAL_MS =
2949                "gtalk_active_heartbeat_ping_interval_ms";
2950
2951        /**
2952         * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2953         * will reset the heartbeat timer. The sync heartbeat should be used when the user isn't
2954         * logged into the GTalk app, but auto-sync is enabled.
2955         */
2956        public static final String GTALK_SERVICE_SYNC_HEARTBEAT_INTERVAL_MS =
2957                "gtalk_sync_heartbeat_ping_interval_ms";
2958
2959        /**
2960         * How frequently we send heartbeat pings to the GTalk server. Receiving a server packet
2961         * will reset the heartbeat timer. The no sync heartbeat should be used when the user isn't
2962         * logged into the GTalk app, and auto-sync is not enabled.
2963         */
2964        public static final String GTALK_SERVICE_NOSYNC_HEARTBEAT_INTERVAL_MS =
2965                "gtalk_nosync_heartbeat_ping_interval_ms";
2966
2967        /**
2968         * The maximum heartbeat interval used while on the WIFI network.
2969         */
2970        public static final String GTALK_SERVICE_WIFI_MAX_HEARTBEAT_INTERVAL_MS =
2971                "gtalk_wifi_max_heartbeat_ping_interval_ms";
2972
2973        /**
2974         * How long we wait to receive a heartbeat ping acknowledgement (or another packet)
2975         * from the GTalk server, before deeming the connection dead.
2976         */
2977        public static final String GTALK_SERVICE_HEARTBEAT_ACK_TIMEOUT_MS =
2978                "gtalk_heartbeat_ack_timeout_ms";
2979
2980        /**
2981         * How long after screen is turned off before we consider the user to be idle.
2982         */
2983        public static final String GTALK_SERVICE_IDLE_TIMEOUT_MS =
2984                "gtalk_idle_timeout_ms";
2985
2986        /**
2987         * By default, GTalkService will always connect to the server regardless of the auto-sync
2988         * setting. However, if this parameter is true, then GTalkService will only connect
2989         * if auto-sync is enabled. Using the GTalk app will trigger the connection too.
2990         */
2991        public static final String GTALK_SERVICE_CONNECT_ON_AUTO_SYNC =
2992                "gtalk_connect_on_auto_sync";
2993
2994        /**
2995         * GTalkService holds a wakelock while broadcasting the intent for data message received.
2996         * It then automatically release the wakelock after a timeout. This setting controls what
2997         * the timeout should be.
2998         */
2999        public static final String GTALK_DATA_MESSAGE_WAKELOCK_MS =
3000                "gtalk_data_message_wakelock_ms";
3001
3002        /**
3003         * The socket read timeout used to control how long ssl handshake wait for reads before
3004         * timing out. This is needed so the ssl handshake doesn't hang for a long time in some
3005         * circumstances.
3006         */
3007        public static final String GTALK_SSL_HANDSHAKE_TIMEOUT_MS =
3008                "gtalk_ssl_handshake_timeout_ms";
3009
3010        /**
3011         * Compress the gtalk stream.
3012         */
3013        public static final String GTALK_COMPRESS = "gtalk_compress";
3014
3015        /**
3016         * This is the timeout for which Google Talk will send the message using bareJID. In a
3017         * established chat between two XMPP endpoints, Google Talk uses fullJID in the format
3018         * of user@domain/resource in order to send the message to the specific client. However,
3019         * if Google Talk hasn't received a message from that client after some time, it would
3020         * fall back to use the bareJID, which would broadcast the message to all clients for
3021         * the other user.
3022         */
3023        public static final String GTALK_USE_BARE_JID_TIMEOUT_MS = "gtalk_use_barejid_timeout_ms";
3024
3025        /**
3026         * This is the threshold of retry number when there is an authentication expired failure
3027         * for Google Talk. In some situation, e.g. when a Google Apps account is disabled chat
3028         * service, the connection keeps failing. This threshold controls when we should stop
3029         * the retrying.
3030         */
3031        public static final String GTALK_MAX_RETRIES_FOR_AUTH_EXPIRED =
3032                "gtalk_max_retries_for_auth_expired";
3033
3034        /**
3035         * a boolean setting indicating whether the GTalkService should use RMQ2 protocol or not.
3036         */
3037        public static final String GTALK_USE_RMQ2_PROTOCOL =
3038                "gtalk_use_rmq2";
3039
3040        /**
3041         * a boolean setting indicating whether the GTalkService should support both RMQ and
3042         * RMQ2 protocols. This setting is true for the transitional period when we need to
3043         * support both protocols.
3044         */
3045        public static final String GTALK_SUPPORT_RMQ_AND_RMQ2_PROTOCOLS =
3046                "gtalk_support_rmq_and_rmq2";
3047
3048        /**
3049         * a boolean setting controlling whether the rmq2 protocol will include stream ids in
3050         * the protobufs. This is used for debugging.
3051         */
3052        public static final String GTALK_RMQ2_INCLUDE_STREAM_ID =
3053                "gtalk_rmq2_include_stream_id";
3054
3055        /**
3056         * when receiving a chat message from the server, the message could be an older message
3057         * whose "time sent" is x seconds from now. If x is significant enough, we want to flag
3058         * it so the UI can give it some special treatment when displaying the "time sent" for
3059         * it. This setting is to control what x is.
3060         */
3061        public static final String GTALK_OLD_CHAT_MESSAGE_THRESHOLD_IN_SEC =
3062                "gtalk_old_chat_msg_threshold_in_sec";
3063
3064        /**
3065         * a setting to control the max connection history record GTalkService stores.
3066         */
3067        public static final String GTALK_MAX_CONNECTION_HISTORY_RECORDS =
3068                "gtalk_max_conn_history_records";
3069
3070        /**
3071         * This is gdata url to lookup album and picture info from picasa web. It also controls
3072         * whether url scraping for picasa is enabled (NULL to disable).
3073         */
3074        public static final String GTALK_PICASA_ALBUM_URL =
3075                "gtalk_picasa_album_url";
3076
3077        /**
3078         * This is the url to lookup picture info from flickr. It also controls
3079         * whether url scraping for flickr is enabled (NULL to disable).
3080         */
3081        public static final String GTALK_FLICKR_PHOTO_INFO_URL =
3082                "gtalk_flickr_photo_info_url";
3083
3084        /**
3085         * This is the url to lookup an actual picture from flickr.
3086         */
3087        public static final String GTALK_FLICKR_PHOTO_URL =
3088                "gtalk_flickr_photo_url";
3089
3090        /**
3091         * This is the gdata url to lookup info on a youtube video. It also controls
3092         * whether url scraping for youtube is enabled (NULL to disable).
3093         */
3094        public static final String GTALK_YOUTUBE_VIDEO_URL =
3095                "gtalk_youtube_video_url";
3096
3097        /**
3098         * Enable/disable GTalk URL scraping for JPG images ("true" to enable).
3099         */
3100        public static final String GTALK_URL_SCRAPING_FOR_JPG =
3101                "gtalk_url_scraping_for_jpg";
3102
3103        /**
3104         * Chat message lifetime (for pruning old chat messages).
3105         */
3106        public static final String GTALK_CHAT_MESSAGE_LIFETIME =
3107                "gtalk_chat_message_lifetime";
3108
3109        /**
3110         * OTR message lifetime (for pruning old otr messages).
3111         */
3112        public static final String GTALK_OTR_MESSAGE_LIFETIME =
3113                "gtalk_otr_message_lifetime";
3114
3115        /**
3116         * Chat expiration time, i.e., time since last message in the chat (for pruning old chats).
3117         */
3118        public static final String GTALK_CHAT_EXPIRATION_TIME =
3119                "gtalk_chat_expiration_time";
3120
3121        /**
3122         * This is the url for getting the app token for server-to-device push messaging.
3123         */
3124        public static final String PUSH_MESSAGING_REGISTRATION_URL =
3125                "push_messaging_registration_url";
3126
3127        /**
3128         * Use android://&lt;it&gt; routing infos for Google Sync Server subcriptions.
3129         */
3130        public static final String GSYNC_USE_RMQ2_ROUTING_INFO = "gsync_use_rmq2_routing_info";
3131
3132        /**
3133         * Enable use of ssl session caching.
3134         * 'db' - save each session in a (per process) database
3135         * 'file' - save each session in a (per process) file
3136         * not set or any other value - normal java in-memory caching
3137         */
3138        public static final String SSL_SESSION_CACHE = "ssl_session_cache";
3139
3140        /**
3141         * How many bytes long a message has to be, in order to be gzipped.
3142         */
3143        public static final String SYNC_MIN_GZIP_BYTES =
3144                "sync_min_gzip_bytes";
3145
3146        /**
3147         * The hash value of the current provisioning settings
3148         */
3149        public static final String PROVISIONING_DIGEST = "digest";
3150
3151        /**
3152         * Provisioning keys to block from server update
3153         */
3154        public static final String PROVISIONING_OVERRIDE = "override";
3155
3156        /**
3157         * "Generic" service name for  authentication requests.
3158         */
3159        public static final String GOOGLE_LOGIN_GENERIC_AUTH_SERVICE
3160                = "google_login_generic_auth_service";
3161
3162        /**
3163         * Duration in milliseconds after setup at which market does not reconcile applications
3164         * which are installed during restore.
3165         */
3166        public static final String VENDING_RESTORE_WINDOW_MS = "vending_restore_window_ms";
3167
3168
3169        /**
3170         * Frequency in milliseconds at which we should sync the locally installed Vending Machine
3171         * content with the server.
3172         */
3173        public static final String VENDING_SYNC_FREQUENCY_MS = "vending_sync_frequency_ms";
3174
3175        /**
3176         * Support URL that is opened in a browser when user clicks on 'Help and Info' in Vending
3177         * Machine.
3178         */
3179        public static final String VENDING_SUPPORT_URL = "vending_support_url";
3180
3181        /**
3182         * Indicates if Vending Machine requires a SIM to be in the phone to allow a purchase.
3183         *
3184         * true = SIM is required
3185         * false = SIM is not required
3186         */
3187        public static final String VENDING_REQUIRE_SIM_FOR_PURCHASE =
3188                "vending_require_sim_for_purchase";
3189
3190        /**
3191         * Indicates the Vending Machine backup state. It is set if the
3192         * Vending application has been backed up at least once.
3193         */
3194        public static final String VENDING_BACKUP_STATE = "vending_backup_state";
3195
3196        /**
3197         * The current version id of the Vending Machine terms of service.
3198         */
3199        public static final String VENDING_TOS_VERSION = "vending_tos_version";
3200
3201        /**
3202         * URL that points to the terms of service for Vending Machine.
3203         */
3204        public static final String VENDING_TOS_URL = "vending_tos_url";
3205
3206        /**
3207         * URL to navigate to in browser (not Market) when the terms of service
3208         * for Vending Machine could not be accessed due to bad network
3209         * connection.
3210         */
3211        public static final String VENDING_TOS_MISSING_URL = "vending_tos_missing_url";
3212
3213        /**
3214         * Whether to use sierraqa instead of sierra tokens for the purchase flow in
3215         * Vending Machine.
3216         *
3217         * true = use sierraqa
3218         * false = use sierra (default)
3219         */
3220        public static final String VENDING_USE_CHECKOUT_QA_SERVICE =
3221                "vending_use_checkout_qa_service";
3222
3223        /**
3224         * Default value to use for all/free/priced filter in Market.
3225         * Valid values: ALL, FREE, PAID (case insensitive)
3226         */
3227        public static final String VENDING_DEFAULT_FILTER = "vending_default_filter";
3228        /**
3229         * Ranking type value to use for the first category tab (currently popular)
3230         */
3231        public static final String VENDING_TAB_1_RANKING_TYPE = "vending_tab_1_ranking_type";
3232
3233        /**
3234         * Title string to use for first category tab.
3235         */
3236        public static final String VENDING_TAB_1_TITLE = "vending_tab_1_title";
3237
3238        /**
3239         * Ranking type value to use for the second category tab (currently newest)
3240         */
3241        public static final String VENDING_TAB_2_RANKING_TYPE = "vending_tab_2_ranking_type";
3242
3243        /**
3244         * Title string to use for second category tab.
3245         */
3246        public static final String VENDING_TAB_2_TITLE = "vending_tab_2_title";
3247
3248        /**
3249         * Frequency in milliseconds at which we should request MCS heartbeats
3250         * from the Vending Machine client.
3251         */
3252        public static final String VENDING_HEARTBEAT_FREQUENCY_MS =
3253                "vending_heartbeat_frequency_ms";
3254
3255        /**
3256         * Frequency in milliseconds at which we should resend pending download
3257         * requests to the API Server from the Vending Machine client.
3258         */
3259        public static final String VENDING_PENDING_DOWNLOAD_RESEND_FREQUENCY_MS =
3260                "vending_pd_resend_frequency_ms";
3261
3262        /**
3263         * Time before an asset in the 'DOWNLOADING' state is considered ready
3264         * for an install kick on the client.
3265         */
3266        public static final String VENDING_DOWNLOADING_KICK_TIMEOUT_MS =
3267                "vending_downloading_kick_ms";
3268
3269        /**
3270         * Size of buffer in bytes for Vending to use when reading cache files.
3271         */
3272        public static final String VENDING_DISK_INPUT_BUFFER_BYTES =
3273                "vending_disk_input_buffer_bytes";
3274
3275        /**
3276         * Size of buffer in bytes for Vending to use when writing cache files.
3277         */
3278        public static final String VENDING_DISK_OUTPUT_BUFFER_BYTES =
3279                "vending_disk_output_buffer_bytes";
3280
3281        /**
3282         * Frequency in milliseconds at which we should cycle through the promoted applications
3283         * on the home screen or the categories page.
3284         */
3285        public static final String VENDING_PROMO_REFRESH_FREQUENCY_MS =
3286                "vending_promo_refresh_freq_ms";
3287
3288        /**
3289         * Frequency in milliseconds when we should refresh the provisioning information from
3290         * the carrier backend.
3291         */
3292        public static final String VENDING_CARRIER_PROVISIONING_REFRESH_FREQUENCY_MS =
3293                "vending_carrier_ref_freq_ms";
3294
3295        /**
3296         * Interval in milliseconds after which a failed provisioning request should be retried.
3297         */
3298        public static final String VENDING_CARRIER_PROVISIONING_RETRY_MS =
3299            "vending_carrier_prov_retry_ms";
3300
3301        /**
3302         * Buffer in milliseconds for carrier credentials to be considered valid.
3303         */
3304        public static final String VENDING_CARRIER_CREDENTIALS_BUFFER_MS =
3305            "vending_carrier_cred_buf_ms";
3306
3307        /**
3308         * Whether to turn on performance logging in the Market client.
3309         */
3310        public static final String VENDING_LOG_PERFORMANCE =
3311            "vending_log_perf";
3312
3313        /**
3314         * URL that points to the legal terms of service to display in Settings.
3315         * <p>
3316         * This should be a https URL. For a pretty user-friendly URL, use
3317         * {@link #SETTINGS_TOS_PRETTY_URL}.
3318         */
3319        public static final String SETTINGS_TOS_URL = "settings_tos_url";
3320
3321        /**
3322         * URL that points to the legal terms of service to display in Settings.
3323         * <p>
3324         * This should be a pretty http URL. For the URL the device will access
3325         * via Settings, use {@link #SETTINGS_TOS_URL}.
3326         */
3327        public static final String SETTINGS_TOS_PRETTY_URL = "settings_tos_pretty_url";
3328
3329        /**
3330         * URL that points to the contributors to display in Settings.
3331         * <p>
3332         * This should be a https URL. For a pretty user-friendly URL, use
3333         * {@link #SETTINGS_CONTRIBUTORS_PRETTY_URL}.
3334         */
3335        public static final String SETTINGS_CONTRIBUTORS_URL = "settings_contributors_url";
3336
3337        /**
3338         * URL that points to the contributors to display in Settings.
3339         * <p>
3340         * This should be a pretty http URL. For the URL the device will access
3341         * via Settings, use {@link #SETTINGS_CONTRIBUTORS_URL}.
3342         */
3343        public static final String SETTINGS_CONTRIBUTORS_PRETTY_URL =
3344                "settings_contributors_pretty_url";
3345
3346        /**
3347         * URL that points to the Terms Of Service for the device.
3348         * <p>
3349         * This should be a pretty http URL.
3350         */
3351        public static final String SETUP_GOOGLE_TOS_URL = "setup_google_tos_url";
3352
3353        /**
3354         * URL that points to the Android privacy policy for the device.
3355         * <p>
3356         * This should be a pretty http URL.
3357         */
3358        public static final String SETUP_ANDROID_PRIVACY_URL = "setup_android_privacy_url";
3359
3360        /**
3361         * URL that points to the Google privacy policy for the device.
3362         * <p>
3363         * This should be a pretty http URL.
3364         */
3365        public static final String SETUP_GOOGLE_PRIVACY_URL = "setup_google_privacy_url";
3366
3367        /**
3368         * Request an MSISDN token for various Google services.
3369         */
3370        public static final String USE_MSISDN_TOKEN = "use_msisdn_token";
3371
3372        /**
3373         * RSA public key used to encrypt passwords stored in the database.
3374         */
3375        public static final String GLS_PUBLIC_KEY = "google_login_public_key";
3376
3377        /**
3378         * Only check parental control status if this is set to "true".
3379         */
3380        public static final String PARENTAL_CONTROL_CHECK_ENABLED =
3381                "parental_control_check_enabled";
3382
3383        /**
3384         * The list of applications we need to block if parental control is
3385         * enabled.
3386         */
3387        public static final String PARENTAL_CONTROL_APPS_LIST =
3388                "parental_control_apps_list";
3389
3390        /**
3391         * Duration in which parental control status is valid.
3392         */
3393        public static final String PARENTAL_CONTROL_TIMEOUT_IN_MS =
3394                "parental_control_timeout_in_ms";
3395
3396        /**
3397         * When parental control is off, we expect to get this string from the
3398         * litmus url.
3399         */
3400        public static final String PARENTAL_CONTROL_EXPECTED_RESPONSE =
3401                "parental_control_expected_response";
3402
3403        /**
3404         * When the litmus url returns a 302, declare parental control to be on
3405         * only if the redirect url matches this regular expression.
3406         */
3407        public static final String PARENTAL_CONTROL_REDIRECT_REGEX =
3408                "parental_control_redirect_regex";
3409
3410        /**
3411         * Threshold for the amount of change in disk free space required to report the amount of
3412         * free space. Used to prevent spamming the logs when the disk free space isn't changing
3413         * frequently.
3414         */
3415        public static final String DISK_FREE_CHANGE_REPORTING_THRESHOLD =
3416                "disk_free_change_reporting_threshold";
3417
3418        /**
3419         * Prefix for new Google services published by the checkin
3420         * server.
3421         */
3422        public static final String GOOGLE_SERVICES_PREFIX
3423                = "google_services:";
3424
3425        /**
3426         * The maximum reconnect delay for short network outages or when the network is suspended
3427         * due to phone use.
3428         */
3429        public static final String SYNC_MAX_RETRY_DELAY_IN_SECONDS =
3430                "sync_max_retry_delay_in_seconds";
3431
3432        /**
3433         * Minimum percentage of free storage on the device that is used to determine if
3434         * the device is running low on storage.
3435         * Say this value is set to 10, the device is considered running low on storage
3436         * if 90% or more of the device storage is filled up.
3437         */
3438        public static final String SYS_STORAGE_THRESHOLD_PERCENTAGE =
3439                "sys_storage_threshold_percentage";
3440
3441        /**
3442         * The interval in minutes after which the amount of free storage left on the
3443         * device is logged to the event log
3444         */
3445        public static final String SYS_FREE_STORAGE_LOG_INTERVAL =
3446                "sys_free_storage_log_interval";
3447
3448        /**
3449         * The interval in milliseconds at which to check the number of SMS sent
3450         * out without asking for use permit, to limit the un-authorized SMS
3451         * usage.
3452         */
3453        public static final String SMS_OUTGOING_CHECK_INTERVAL_MS =
3454                "sms_outgoing_check_interval_ms";
3455
3456        /**
3457         * The number of outgoing SMS sent without asking for user permit
3458         * (of {@link #SMS_OUTGOING_CHECK_INTERVAL_MS}
3459         */
3460        public static final String SMS_OUTGOING_CEHCK_MAX_COUNT =
3461                "sms_outgoing_check_max_count";
3462
3463        /**
3464         * The interval in milliseconds at which to check packet counts on the
3465         * mobile data interface when screen is on, to detect possible data
3466         * connection problems.
3467         */
3468        public static final String PDP_WATCHDOG_POLL_INTERVAL_MS =
3469                "pdp_watchdog_poll_interval_ms";
3470
3471        /**
3472         * The interval in milliseconds at which to check packet counts on the
3473         * mobile data interface when screen is off, to detect possible data
3474         * connection problems.
3475         */
3476        public static final String PDP_WATCHDOG_LONG_POLL_INTERVAL_MS =
3477                "pdp_watchdog_long_poll_interval_ms";
3478
3479        /**
3480         * The interval in milliseconds at which to check packet counts on the
3481         * mobile data interface after {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT}
3482         * outgoing packets has been reached without incoming packets.
3483         */
3484        public static final String PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS =
3485                "pdp_watchdog_error_poll_interval_ms";
3486
3487        /**
3488         * The number of outgoing packets sent without seeing an incoming packet
3489         * that triggers a countdown (of {@link #PDP_WATCHDOG_ERROR_POLL_COUNT}
3490         * device is logged to the event log
3491         */
3492        public static final String PDP_WATCHDOG_TRIGGER_PACKET_COUNT =
3493                "pdp_watchdog_trigger_packet_count";
3494
3495        /**
3496         * The number of polls to perform (at {@link #PDP_WATCHDOG_ERROR_POLL_INTERVAL_MS})
3497         * after hitting {@link #PDP_WATCHDOG_TRIGGER_PACKET_COUNT} before
3498         * attempting data connection recovery.
3499         */
3500        public static final String PDP_WATCHDOG_ERROR_POLL_COUNT =
3501                "pdp_watchdog_error_poll_count";
3502
3503        /**
3504         * The number of failed PDP reset attempts before moving to something more
3505         * drastic: re-registering to the network.
3506         */
3507        public static final String PDP_WATCHDOG_MAX_PDP_RESET_FAIL_COUNT =
3508                "pdp_watchdog_max_pdp_reset_fail_count";
3509
3510        /**
3511         * Address to ping as a last sanity check before attempting any recovery.
3512         * Unset or set to "0.0.0.0" to skip this check.
3513         */
3514        public static final String PDP_WATCHDOG_PING_ADDRESS = "pdp_watchdog_ping_address";
3515
3516        /**
3517         * The "-w deadline" parameter for the ping, ie, the max time in
3518         * seconds to spend pinging.
3519         */
3520        public static final String PDP_WATCHDOG_PING_DEADLINE = "pdp_watchdog_ping_deadline";
3521
3522        /**
3523         * The interval in milliseconds at which to check gprs registration
3524         * after the first registration mismatch of gprs and voice service,
3525         * to detect possible data network registration problems.
3526         *
3527         */
3528        public static final String GPRS_REGISTER_CHECK_PERIOD_MS =
3529                "gprs_register_check_period_ms";
3530
3531        /**
3532         * The interval in milliseconds after which Wi-Fi is considered idle.
3533         * When idle, it is possible for the device to be switched from Wi-Fi to
3534         * the mobile data network.
3535         */
3536        public static final String WIFI_IDLE_MS = "wifi_idle_ms";
3537
3538        /**
3539         * Screen timeout in milliseconds corresponding to the
3540         * PowerManager's POKE_LOCK_SHORT_TIMEOUT flag (i.e. the fastest
3541         * possible screen timeout behavior.)
3542         */
3543        public static final String SHORT_KEYLIGHT_DELAY_MS =
3544                "short_keylight_delay_ms";
3545
3546        /**
3547         * List of test suites (local disk filename) for the automatic instrumentation test runner.
3548         * The file format is similar to automated_suites.xml, see AutoTesterService.
3549         * If this setting is missing or empty, the automatic test runner will not start.
3550         */
3551        public static final String AUTOTEST_SUITES_FILE = "autotest_suites_file";
3552
3553        /**
3554         * Interval between synchronous checkins forced by the automatic test runner.
3555         * If you set this to a value smaller than CHECKIN_INTERVAL, then the test runner's
3556         * frequent checkins will prevent asynchronous background checkins from interfering
3557         * with any performance measurements.
3558         */
3559        public static final String AUTOTEST_CHECKIN_SECONDS = "autotest_checkin_seconds";
3560
3561        /**
3562         * Interval between reboots forced by the automatic test runner.
3563         */
3564        public static final String AUTOTEST_REBOOT_SECONDS = "autotest_reboot_seconds";
3565
3566
3567        /**
3568         * Threshold values for the duration and level of a discharge cycle, under
3569         * which we log discharge cycle info.
3570         */
3571        public static final String BATTERY_DISCHARGE_DURATION_THRESHOLD =
3572                "battery_discharge_duration_threshold";
3573        public static final String BATTERY_DISCHARGE_THRESHOLD = "battery_discharge_threshold";
3574
3575        /**
3576         * An email address that anr bugreports should be sent to.
3577         */
3578        public static final String ANR_BUGREPORT_RECIPIENT = "anr_bugreport_recipient";
3579
3580        /**
3581         * Flag for allowing service provider to use location information to improve products and
3582         * services.
3583         * Type: int ( 0 = disallow, 1 = allow )
3584         * @deprecated
3585         */
3586        public static final String USE_LOCATION_FOR_SERVICES = "use_location";
3587
3588        /**
3589         * The number of entries to fetch from the feed at a time for calendar sync.
3590         */
3591        private static final String GOOGLE_CALENDAR_SYNC_ENTRY_FETCH_QUEUE_SIZE =
3592                "google_calendar_sync_entry_fetch_queue_size";
3593
3594        /**
3595         * The number of entities to fetch from the provider at a time for calendar sync.
3596         */
3597        private static final String GOOGLE_CALENDAR_SYNC_ENTITY_FETCH_QUEUE_SIZE =
3598                "google_calendar_sync_entity_fetch_queue_size";
3599
3600        /**
3601         * The maximum number of simultaneous changes to allow before alerting the user for
3602         *  calendar sync.
3603         */
3604        private static final String GOOGLE_CALENDAR_SYNC_NUM_ALLOWED_SIMULTANEOUS_CHANGES =
3605                "google_calendar_sync_num_allowed_simultaneous changes";
3606
3607        /**
3608         * The maximum percentage of simultaneous changes to allow before alerting the user for
3609         *  calendar sync.
3610         */
3611        private static final String GOOGLE_CALENDAR_SYNC_PERCENT_ALLOWED_SIMULTANEOUS_CHANGES =
3612                "google_calendar_sync_percent_allowed_simultaneous_changes";
3613
3614        /**
3615         * The number of times to apply local changes in calendar sync before stopping.
3616         */
3617        private static final String GOOGLE_CALENDAR_SYNC_MAX_LOOP_ATTEMPTS =
3618                "google_calendar_sync_max_loop_attempts";
3619
3620        /**
3621         * The batch size for applying server changes to the provider for calendar sync.
3622         */
3623        private static final String GOOGLE_CALENDAR_SYNC_NUM_APPLICATIONS_PER_BATCH =
3624                "google_calendar_sync_num_applications_per_batch";
3625
3626        /**
3627         * The length of the calendar sync window into the future.
3628         * This specifies the number of days into the future for the sliding window sync.
3629         * Setting this to zero will disable sliding sync.
3630         */
3631        public static final String GOOGLE_CALENDAR_SYNC_WINDOW_DAYS =
3632                "google_calendar_sync_window_days";
3633
3634        /**
3635         * How often to update the calendar sync window.
3636         * The window will be advanced every n days.
3637         */
3638        public static final String GOOGLE_CALENDAR_SYNC_WINDOW_UPDATE_DAYS =
3639                "google_calendar_sync_window_update_days";
3640
3641        /**
3642         * The number of promoted sources in GlobalSearch.
3643         */
3644        public static final String SEARCH_NUM_PROMOTED_SOURCES = "search_num_promoted_sources";
3645        /**
3646         * The maximum number of suggestions returned by GlobalSearch.
3647         */
3648        public static final String SEARCH_MAX_RESULTS_TO_DISPLAY = "search_max_results_to_display";
3649        /**
3650         * The number of suggestions GlobalSearch will ask each non-web search source for.
3651         */
3652        public static final String SEARCH_MAX_RESULTS_PER_SOURCE = "search_max_results_per_source";
3653        /**
3654         * The number of suggestions the GlobalSearch will ask the web search source for.
3655         */
3656        public static final String SEARCH_WEB_RESULTS_OVERRIDE_LIMIT =
3657                "search_web_results_override_limit";
3658        /**
3659         * The number of milliseconds that GlobalSearch will wait for suggestions from
3660         * promoted sources before continuing with all other sources.
3661         */
3662        public static final String SEARCH_PROMOTED_SOURCE_DEADLINE_MILLIS =
3663                "search_promoted_source_deadline_millis";
3664        /**
3665         * The number of milliseconds before GlobalSearch aborts search suggesiton queries.
3666         */
3667        public static final String SEARCH_SOURCE_TIMEOUT_MILLIS = "search_source_timeout_millis";
3668        /**
3669         * The maximum number of milliseconds that GlobalSearch shows the previous results
3670         * after receiving a new query.
3671         */
3672        public static final String SEARCH_PREFILL_MILLIS = "search_prefill_millis";
3673        /**
3674         * The maximum age of log data used for shortcuts in GlobalSearch.
3675         */
3676        public static final String SEARCH_MAX_STAT_AGE_MILLIS = "search_max_stat_age_millis";
3677        /**
3678         * The maximum age of log data used for source ranking in GlobalSearch.
3679         */
3680        public static final String SEARCH_MAX_SOURCE_EVENT_AGE_MILLIS =
3681                "search_max_source_event_age_millis";
3682        /**
3683         * The minimum number of impressions needed to rank a source in GlobalSearch.
3684         */
3685        public static final String SEARCH_MIN_IMPRESSIONS_FOR_SOURCE_RANKING =
3686                "search_min_impressions_for_source_ranking";
3687        /**
3688         * The minimum number of clicks needed to rank a source in GlobalSearch.
3689         */
3690        public static final String SEARCH_MIN_CLICKS_FOR_SOURCE_RANKING =
3691                "search_min_clicks_for_source_ranking";
3692        /**
3693         * The maximum number of shortcuts shown by GlobalSearch.
3694         */
3695        public static final String SEARCH_MAX_SHORTCUTS_RETURNED = "search_max_shortcuts_returned";
3696        /**
3697         * The size of the core thread pool for suggestion queries in GlobalSearch.
3698         */
3699        public static final String SEARCH_QUERY_THREAD_CORE_POOL_SIZE =
3700                "search_query_thread_core_pool_size";
3701        /**
3702         * The maximum size of the thread pool for suggestion queries in GlobalSearch.
3703         */
3704        public static final String SEARCH_QUERY_THREAD_MAX_POOL_SIZE =
3705                "search_query_thread_max_pool_size";
3706        /**
3707         * The size of the core thread pool for shortcut refreshing in GlobalSearch.
3708         */
3709        public static final String SEARCH_SHORTCUT_REFRESH_CORE_POOL_SIZE =
3710                "search_shortcut_refresh_core_pool_size";
3711        /**
3712         * The maximum size of the thread pool for shortcut refreshing in GlobalSearch.
3713         */
3714        public static final String SEARCH_SHORTCUT_REFRESH_MAX_POOL_SIZE =
3715                "search_shortcut_refresh_max_pool_size";
3716        /**
3717         * The maximun time that excess threads in the GlobalSeach thread pools will
3718         * wait before terminating.
3719         */
3720        public static final String SEARCH_THREAD_KEEPALIVE_SECONDS =
3721                "search_thread_keepalive_seconds";
3722        /**
3723         * The maximum number of concurrent suggestion queries to each source.
3724         */
3725        public static final String SEARCH_PER_SOURCE_CONCURRENT_QUERY_LIMIT =
3726                "search_per_source_concurrent_query_limit";
3727        /**
3728         * Flag for allowing ActivityManagerService to send ACTION_APP_ERROR intents
3729         * on application crashes and ANRs. If this is disabled, the crash/ANR dialog
3730         * will never display the "Report" button.
3731         * Type: int ( 0 = disallow, 1 = allow )
3732         */
3733        public static final String SEND_ACTION_APP_ERROR = "send_action_app_error";
3734
3735        /**
3736         * Maximum size of /proc/last_kmsg content to upload after reboot.
3737         */
3738        public static final String LAST_KMSG_KB = "last_kmsg_kb";
3739
3740        /**
3741         * Maximum age of entries kept by {@link android.os.IDropBox}.
3742         */
3743        public static final String DROPBOX_AGE_SECONDS =
3744                "dropbox_age_seconds";
3745        /**
3746         * Maximum amount of disk space used by {@link android.os.IDropBox} no matter what.
3747         */
3748        public static final String DROPBOX_QUOTA_KB =
3749                "dropbox_quota_kb";
3750        /**
3751         * Percent of free disk (excluding reserve) which {@link android.os.IDropBox} will use.
3752         */
3753        public static final String DROPBOX_QUOTA_PERCENT =
3754                "dropbox_quota_percent";
3755        /**
3756         * Percent of total disk which {@link android.os.IDropBox} will never dip into.
3757         */
3758        public static final String DROPBOX_RESERVE_PERCENT =
3759                "dropbox_reserve_percent";
3760        /**
3761         * Prefix for per-tag dropbox disable/enable settings.
3762         */
3763        public static final String DROPBOX_TAG_PREFIX =
3764                "dropbox:";
3765
3766        /**
3767         * The length of time in milli-seconds that automatic small adjustments to
3768         * SystemClock are ignored if NITZ_UPDATE_DIFF is not exceeded.
3769         */
3770        public static final String NITZ_UPDATE_SPACING = "nitz_update_spacing";
3771
3772        /**
3773         * If the NITZ_UPDATE_DIFF time is exceeded then an automatic adjustment
3774         * to SystemClock will be allowed even if NITZ_UPDATE_SPACING has not been
3775         * exceeded.
3776         */
3777        public static final String NITZ_UPDATE_DIFF = "nitz_update_diff";
3778
3779        /**
3780         * @deprecated
3781         * @hide
3782         */
3783        @Deprecated  // Obviated by NameValueCache: just fetch the value directly.
3784        public static class QueryMap extends ContentQueryMap {
3785
3786            public QueryMap(ContentResolver contentResolver, Cursor cursor, boolean keepUpdated,
3787                    Handler handlerForUpdateNotifications) {
3788                super(cursor, NAME, keepUpdated, handlerForUpdateNotifications);
3789            }
3790
3791            public QueryMap(ContentResolver contentResolver, boolean keepUpdated,
3792                    Handler handlerForUpdateNotifications) {
3793                this(contentResolver,
3794                        contentResolver.query(CONTENT_URI, null, null, null, null),
3795                        keepUpdated, handlerForUpdateNotifications);
3796            }
3797
3798            public String getString(String name) {
3799                ContentValues cv = getValues(name);
3800                if (cv == null) return null;
3801                return cv.getAsString(VALUE);
3802            }
3803        }
3804
3805    }
3806
3807    /**
3808     * User-defined bookmarks and shortcuts.  The target of each bookmark is an
3809     * Intent URL, allowing it to be either a web page or a particular
3810     * application activity.
3811     *
3812     * @hide
3813     */
3814    public static final class Bookmarks implements BaseColumns
3815    {
3816        private static final String TAG = "Bookmarks";
3817
3818        /**
3819         * The content:// style URL for this table
3820         */
3821        public static final Uri CONTENT_URI =
3822            Uri.parse("content://" + AUTHORITY + "/bookmarks");
3823
3824        /**
3825         * The row ID.
3826         * <p>Type: INTEGER</p>
3827         */
3828        public static final String ID = "_id";
3829
3830        /**
3831         * Descriptive name of the bookmark that can be displayed to the user.
3832         * If this is empty, the title should be resolved at display time (use
3833         * {@link #getTitle(Context, Cursor)} any time you want to display the
3834         * title of a bookmark.)
3835         * <P>
3836         * Type: TEXT
3837         * </P>
3838         */
3839        public static final String TITLE = "title";
3840
3841        /**
3842         * Arbitrary string (displayed to the user) that allows bookmarks to be
3843         * organized into categories.  There are some special names for
3844         * standard folders, which all start with '@'.  The label displayed for
3845         * the folder changes with the locale (via {@link #getLabelForFolder}) but
3846         * the folder name does not change so you can consistently query for
3847         * the folder regardless of the current locale.
3848         *
3849         * <P>Type: TEXT</P>
3850         *
3851         */
3852        public static final String FOLDER = "folder";
3853
3854        /**
3855         * The Intent URL of the bookmark, describing what it points to.  This
3856         * value is given to {@link android.content.Intent#getIntent} to create
3857         * an Intent that can be launched.
3858         * <P>Type: TEXT</P>
3859         */
3860        public static final String INTENT = "intent";
3861
3862        /**
3863         * Optional shortcut character associated with this bookmark.
3864         * <P>Type: INTEGER</P>
3865         */
3866        public static final String SHORTCUT = "shortcut";
3867
3868        /**
3869         * The order in which the bookmark should be displayed
3870         * <P>Type: INTEGER</P>
3871         */
3872        public static final String ORDERING = "ordering";
3873
3874        private static final String[] sIntentProjection = { INTENT };
3875        private static final String[] sShortcutProjection = { ID, SHORTCUT };
3876        private static final String sShortcutSelection = SHORTCUT + "=?";
3877
3878        /**
3879         * Convenience function to retrieve the bookmarked Intent for a
3880         * particular shortcut key.
3881         *
3882         * @param cr The ContentResolver to query.
3883         * @param shortcut The shortcut key.
3884         *
3885         * @return Intent The bookmarked URL, or null if there is no bookmark
3886         *         matching the given shortcut.
3887         */
3888        public static Intent getIntentForShortcut(ContentResolver cr, char shortcut)
3889        {
3890            Intent intent = null;
3891
3892            Cursor c = cr.query(CONTENT_URI,
3893                    sIntentProjection, sShortcutSelection,
3894                    new String[] { String.valueOf((int) shortcut) }, ORDERING);
3895            // Keep trying until we find a valid shortcut
3896            try {
3897                while (intent == null && c.moveToNext()) {
3898                    try {
3899                        String intentURI = c.getString(c.getColumnIndexOrThrow(INTENT));
3900                        intent = Intent.getIntent(intentURI);
3901                    } catch (java.net.URISyntaxException e) {
3902                        // The stored URL is bad...  ignore it.
3903                    } catch (IllegalArgumentException e) {
3904                        // Column not found
3905                        Log.w(TAG, "Intent column not found", e);
3906                    }
3907                }
3908            } finally {
3909                if (c != null) c.close();
3910            }
3911
3912            return intent;
3913        }
3914
3915        /**
3916         * Add a new bookmark to the system.
3917         *
3918         * @param cr The ContentResolver to query.
3919         * @param intent The desired target of the bookmark.
3920         * @param title Bookmark title that is shown to the user; null if none
3921         *            or it should be resolved to the intent's title.
3922         * @param folder Folder in which to place the bookmark; null if none.
3923         * @param shortcut Shortcut that will invoke the bookmark; 0 if none. If
3924         *            this is non-zero and there is an existing bookmark entry
3925         *            with this same shortcut, then that existing shortcut is
3926         *            cleared (the bookmark is not removed).
3927         * @return The unique content URL for the new bookmark entry.
3928         */
3929        public static Uri add(ContentResolver cr,
3930                                           Intent intent,
3931                                           String title,
3932                                           String folder,
3933                                           char shortcut,
3934                                           int ordering)
3935        {
3936            // If a shortcut is supplied, and it is already defined for
3937            // another bookmark, then remove the old definition.
3938            if (shortcut != 0) {
3939                Cursor c = cr.query(CONTENT_URI,
3940                        sShortcutProjection, sShortcutSelection,
3941                        new String[] { String.valueOf((int) shortcut) }, null);
3942                try {
3943                    if (c.moveToFirst()) {
3944                        while (c.getCount() > 0) {
3945                            if (!c.deleteRow()) {
3946                                Log.w(TAG, "Could not delete existing shortcut row");
3947                            }
3948                        }
3949                    }
3950                } finally {
3951                    if (c != null) c.close();
3952                }
3953            }
3954
3955            ContentValues values = new ContentValues();
3956            if (title != null) values.put(TITLE, title);
3957            if (folder != null) values.put(FOLDER, folder);
3958            values.put(INTENT, intent.toURI());
3959            if (shortcut != 0) values.put(SHORTCUT, (int) shortcut);
3960            values.put(ORDERING, ordering);
3961            return cr.insert(CONTENT_URI, values);
3962        }
3963
3964        /**
3965         * Return the folder name as it should be displayed to the user.  This
3966         * takes care of localizing special folders.
3967         *
3968         * @param r Resources object for current locale; only need access to
3969         *          system resources.
3970         * @param folder The value found in the {@link #FOLDER} column.
3971         *
3972         * @return CharSequence The label for this folder that should be shown
3973         *         to the user.
3974         */
3975        public static CharSequence getLabelForFolder(Resources r, String folder) {
3976            return folder;
3977        }
3978
3979        /**
3980         * Return the title as it should be displayed to the user. This takes
3981         * care of localizing bookmarks that point to activities.
3982         *
3983         * @param context A context.
3984         * @param cursor A cursor pointing to the row whose title should be
3985         *        returned. The cursor must contain at least the {@link #TITLE}
3986         *        and {@link #INTENT} columns.
3987         * @return A title that is localized and can be displayed to the user,
3988         *         or the empty string if one could not be found.
3989         */
3990        public static CharSequence getTitle(Context context, Cursor cursor) {
3991            int titleColumn = cursor.getColumnIndex(TITLE);
3992            int intentColumn = cursor.getColumnIndex(INTENT);
3993            if (titleColumn == -1 || intentColumn == -1) {
3994                throw new IllegalArgumentException(
3995                        "The cursor must contain the TITLE and INTENT columns.");
3996            }
3997
3998            String title = cursor.getString(titleColumn);
3999            if (!TextUtils.isEmpty(title)) {
4000                return title;
4001            }
4002
4003            String intentUri = cursor.getString(intentColumn);
4004            if (TextUtils.isEmpty(intentUri)) {
4005                return "";
4006            }
4007
4008            Intent intent;
4009            try {
4010                intent = Intent.getIntent(intentUri);
4011            } catch (URISyntaxException e) {
4012                return "";
4013            }
4014
4015            PackageManager packageManager = context.getPackageManager();
4016            ResolveInfo info = packageManager.resolveActivity(intent, 0);
4017            return info != null ? info.loadLabel(packageManager) : "";
4018        }
4019    }
4020
4021    /**
4022     * Returns the device ID that we should use when connecting to the mobile gtalk server.
4023     * This is a string like "android-0x1242", where the hex string is the Android ID obtained
4024     * from the GoogleLoginService.
4025     *
4026     * @param androidId The Android ID for this device.
4027     * @return The device ID that should be used when connecting to the mobile gtalk server.
4028     * @hide
4029     */
4030    public static String getGTalkDeviceId(long androidId) {
4031        return "android-" + Long.toHexString(androidId);
4032    }
4033}
4034