summaryrefslogtreecommitdiffstats
path: root/packages/SettingsProvider
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-08-16 15:54:57 +0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-01-04 15:37:42 -0800
commitf6f56f8f0ed39a4eb5d33300984b9cddf8f3a426 (patch)
tree018026a6f8d2b906605b74aa66850a394ad32319 /packages/SettingsProvider
parent93d770d4d9c1889fa22bc2b18b6e109419e1cc6b (diff)
downloadframeworks_base-f6f56f8f0ed39a4eb5d33300984b9cddf8f3a426.zip
frameworks_base-f6f56f8f0ed39a4eb5d33300984b9cddf8f3a426.tar.gz
frameworks_base-f6f56f8f0ed39a4eb5d33300984b9cddf8f3a426.tar.bz2
Regional: Customize features for regional package
-Customize default Date&Time display format. -Customize mock and Dock on or off for carrier. -Customize accessibility on or off for carrier. -Customize default input method. -Customize default enable data roaming or not. -Customize default enable mobile data or not. -Customize default network. TICKET: CYNGNOS-1473 Change-Id: I3a74d0113d6b730c4d7935aaa2da307ebe500566
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r--packages/SettingsProvider/res/values/customize.xml63
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java59
2 files changed, 112 insertions, 10 deletions
diff --git a/packages/SettingsProvider/res/values/customize.xml b/packages/SettingsProvider/res/values/customize.xml
new file mode 100644
index 0000000..3a8bfa4
--- /dev/null
+++ b/packages/SettingsProvider/res/values/customize.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<resources>
+
+ <!-- Time format,default vlaue is 24 : 24 format,other value is 12 format -->
+ <string name="def_time_format" translatable="false">24</string>
+
+ <!-- Date format,yyyy-MM-dd: 2013/07/30; MM-dd-yyyy:07/30/2013; dd-MM-yyyy:30/07/2013 -->
+ <string name="def_date_format" translatable="false">MM-dd-yyyy</string>
+
+ <!--
+ Default Input Method, its value is from inputmethod's package name and main class name
+ such as "com.android.inputmethod.pinyin/.PinyinIME"
+ -->
+ <string name="def_input_method" translatable="false"></string>
+
+ <!-- Default for Settings.Global.DATA_ROAMING -->
+ <bool name="def_enable_data_roaming">true</bool>
+
+ <!-- Default for Settings.Global.MOBILE_DATA -->
+ <bool name="def_enable_mobile_data">true</bool>
+
+ <!--
+ Default Enable InputMethods, its value is from inputmethod's package name and main class name
+ such as "com.android.inputmethod.pinyin/.PinyinIME" ;This is a string
+ containing the IDs of all enabled input methods, each ID separated by ':'.
+ -->
+ <string name="def_enable_input_methods" translatable="false"></string>
+
+ <!-- enable accessiblity or not,1:enable;0:disable -->
+ <integer name="def_enable_accessiblity" translatable="false">0</integer>
+
+ <!-- for enable accessiblity services,split by ":" ,example "com.google.android.marvin.talkback/com.google.android.marvin.talkback.TalkBackService" -->
+ <string name="def_enable_accessiblity_services" translatable="false"></string>
+
+</resources>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 02e4e88..9d7328b 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -80,12 +80,17 @@ class DatabaseHelper extends SQLiteOpenHelper {
private static final String TAG = "SettingsProvider";
private static final String DATABASE_NAME = "settings.db";
+ private static final int TYPE_NONE = -1;
+
// Please, please please. If you update the database version, check to make sure the
// database gets upgraded properly. At a minimum, please confirm that 'upgradeVersion'
// is properly propagated through your change. Not doing so will result in a loss of user
// settings.
private static final int DATABASE_VERSION = 125;
+ //Maximum number of phones
+ private static final int MAX_PHONE_COUNT = 3;
+
private Context mContext;
private int mUserHandle;
@@ -2589,6 +2594,13 @@ class DatabaseHelper extends SQLiteOpenHelper {
*
* See: SettingsProvider.UpgradeController#onUpgradeLocked
*/
+
+ //LEGACY CAF CHANGES
+ loadStringSetting(stmt, Settings.System.TIME_12_24,
+ R.string.def_time_format);
+
+ loadStringSetting(stmt, Settings.System.DATE_FORMAT,
+ R.string.def_date_format);
} finally {
if (stmt != null) stmt.close();
}
@@ -2638,7 +2650,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
// Allow mock locations default, based on build
loadSetting(stmt, Settings.Secure.ALLOW_MOCK_LOCATION,
- "1".equals(SystemProperties.get("ro.allow.mock.location")) ? 1 : 0);
+ "1".equals(SystemProperties.get("persist.env.c.allow.enable")) ? 1 : 0);
loadSecure35Settings(stmt);
@@ -2728,6 +2740,24 @@ class DatabaseHelper extends SQLiteOpenHelper {
*
* See: SettingsProvider.UpgradeController#onUpgradeLocked
*/
+
+ //LEGACY CAF CHANGES
+ if (!TextUtils.isEmpty(mContext.getResources().getString(R.string.def_input_method))) {
+ loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
+ R.string.def_input_method);
+ }
+
+ if (!TextUtils.isEmpty(mContext.getResources().getString(
+ R.string.def_enable_input_methods))) {
+ loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
+ R.string.def_enable_input_methods);
+ }
+
+ // for accessibility enabled
+ loadStringSetting(stmt, Settings.Secure.ACCESSIBILITY_ENABLED,
+ R.integer.def_enable_accessiblity);
+ loadStringSetting(stmt, Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ R.string.def_enable_accessiblity_services);
} finally {
if (stmt != null) stmt.close();
}
@@ -2798,10 +2828,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED);
// Data roaming default, based on build
- loadSetting(stmt, Settings.Global.DATA_ROAMING,
- "true".equalsIgnoreCase(
- SystemProperties.get("ro.com.android.dataroaming",
- "false")) ? 1 : 0);
+ loadBooleanSetting(stmt, Settings.Global.DATA_ROAMING,
+ R.bool.def_enable_data_roaming);
loadBooleanSetting(stmt, Settings.Global.DEVICE_PROVISIONED,
R.bool.def_device_provisioned);
@@ -2821,10 +2849,20 @@ class DatabaseHelper extends SQLiteOpenHelper {
}
// Mobile Data default, based on build
- loadSetting(stmt, Settings.Global.MOBILE_DATA,
- "true".equalsIgnoreCase(
- SystemProperties.get("ro.com.android.mobiledata",
- "true")) ? 1 : 0);
+ loadBooleanSetting(stmt, Settings.Global.MOBILE_DATA,
+ R.bool.def_enable_mobile_data);
+
+ int phoneCount = TelephonyManager.getDefault().getPhoneCount();
+ // SUB specific flags for Multisim devices
+ for (int phoneId = 0; phoneId < MAX_PHONE_COUNT; phoneId++) {
+ // Mobile Data default, based on build
+ loadBooleanSetting(stmt, Settings.Global.MOBILE_DATA + phoneId,
+ R.bool.def_enable_mobile_data);
+
+ // Data roaming default, based on build
+ loadBooleanSetting(stmt, Settings.Global.DATA_ROAMING + phoneId,
+ R.bool.def_enable_data_roaming);
+ }
loadBooleanSetting(stmt, Settings.Global.NETSTATS_ENABLED,
R.bool.def_netstats_enabled);
@@ -2860,6 +2898,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
R.string.def_car_undock_sound);
loadStringSetting(stmt, Settings.Global.WIRELESS_CHARGING_STARTED_SOUND,
R.string.def_wireless_charging_started_sound);
+ loadIntegerSetting(stmt, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
+ R.integer.def_dock_audio_media_enabled);
loadIntegerSetting(stmt, Settings.Global.DOCK_AUDIO_MEDIA_ENABLED,
R.integer.def_dock_audio_media_enabled);
@@ -2876,7 +2916,6 @@ class DatabaseHelper extends SQLiteOpenHelper {
// Set the preferred network mode to target desired value or Default
// value defined in RILConstants
- int phoneCount = TelephonyManager.getDefault().getPhoneCount();
final String defVal = SystemProperties.get("ro.telephony.default_network", "");
final String[] defNetworkSettings = defVal.split(",");
final String[] networkSettings = new String[phoneCount];