Merge "LocalePicker: Support customize the language list"
diff --git a/core/res/res/values/customize.xml b/core/res/res/values/customize.xml
index e0d5bd8..c483dab 100644
--- a/core/res/res/values/customize.xml
+++ b/core/res/res/values/customize.xml
@@ -50,4 +50,17 @@
for some cdma carriers -->
<java-symbol type="bool" name="config_fetch_apn_from_omh_card" />
<bool name="config_fetch_apn_from_omh_card">false</bool>
+ <!-- Set Wifi hotspot security type
+ NONE : 0
+ WPA2 PSK: 4
+ -->
+ <integer name="wifi_hotspot_security_type">4</integer>
+ <!-- Default wi-fi hotspot pass -->
+ <string name="def_wifi_wifihotspot_pass" translatable="false"></string>
+ <!-- Default wi-fi direct name -->
+ <string name="def_wifi_direct_name" translatable="false"></string>
+ <!-- Setting customize default bluetooth name -->
+ <string name="def_custom_bt_defname"></string>
+ <!-- custom date format or not -->
+ <bool name="config_dateformat">false</bool>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5319abc..8f4c76b 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2385,4 +2385,11 @@
<!-- Data Connectivity Error Configurations -->
<java-symbol type="bool" name="config_reject_ggsn_perm_failure" />
<java-symbol type="bool" name="config_protocol_errors_perm_failure" />
+
+ <!-- Regional Specific Symbols -->
+ <java-symbol type="bool" name="config_dateformat" />
+ <java-symbol type="integer" name="wifi_hotspot_security_type" />
+ <java-symbol type="string" name="def_wifi_wifihotspot_pass" />
+ <java-symbol type="string" name="def_wifi_direct_name" />
+ <java-symbol type="string" name="def_custom_bt_defname" />
</resources>
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
index f95b0ae..6cdf0cb 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
@@ -23,6 +23,7 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.UserHandle;
+import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.AttributeSet;
@@ -229,25 +230,27 @@
: R.string.abbrev_wday_month_day_no_year);
final String clockView12Skel = res.getString(R.string.clock_12hr_format);
final String clockView24Skel = res.getString(R.string.clock_24hr_format);
- final String key = locale.toString() + dateViewSkel + clockView12Skel + clockView24Skel;
- if (key.equals(cacheKey)) return;
-
- dateView = DateFormat.getBestDateTimePattern(locale, dateViewSkel);
-
+ if (res.getBoolean(com.android.internal.R.bool.config_dateformat)) {
+ final String dateformat = Settings.System.getString(context.getContentResolver(),
+ Settings.System.DATE_FORMAT);
+ dateView = dateformat.equals(dateView) ? dateView : dateformat;
+ } else {
+ final String key = locale.toString() + dateViewSkel + clockView12Skel +
+ clockView24Skel;
+ if (key.equals(cacheKey)) return;
+ dateView = DateFormat.getBestDateTimePattern(locale, dateViewSkel);
+ cacheKey = key;
+ }
clockView12 = DateFormat.getBestDateTimePattern(locale, clockView12Skel);
// CLDR insists on adding an AM/PM indicator even though it wasn't in the skeleton
// format. The following code removes the AM/PM indicator if we didn't want it.
if (!clockView12Skel.contains("a")) {
clockView12 = clockView12.replaceAll("a", "").trim();
}
-
clockView24 = DateFormat.getBestDateTimePattern(locale, clockView24Skel);
-
// Use fancy colon.
clockView24 = clockView24.replace(':', '\uee01');
clockView12 = clockView12.replace(':', '\uee01');
-
- cacheKey = key;
}
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
index 8dc48b3..76408d7 100755
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
@@ -23,6 +23,9 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import android.text.TextUtils;
import android.util.Log;
import com.android.settingslib.R;
@@ -107,6 +110,7 @@
addHandler(Intent.ACTION_DOCK_EVENT, new DockEventHandler());
mContext.registerReceiver(mBroadcastReceiver, mAdapterIntentFilter, null, mReceiverHandler);
+ setDefaultBtName();
}
void registerProfileIntentReceiver() {
@@ -120,6 +124,25 @@
registerProfileIntentReceiver();
}
+ // set bluetooth default name
+ private void setDefaultBtName() {
+ String name = mContext.getResources().getString(
+ com.android.internal.R.string.def_custom_bt_defname);
+ boolean needSet = !TextUtils.isEmpty(name);
+ Log.d(TAG, "custom bluetooth name: " + name);
+ // This flag is to only set default bluetooth name once.
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(mContext);
+ boolean notSet = preferences.getBoolean("is_first_boot",true);
+ // only bluetooth state is on, set name will success, or, it will fail.
+ boolean okToSet = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
+ if (needSet && notSet && okToSet) {
+ mLocalAdapter.setName(name);
+ SharedPreferences.Editor edit = preferences.edit();
+ edit.putBoolean("is_first_boot",false);
+ edit.apply();
+ }
+ }
+
/** Register to start receiving callbacks for Bluetooth events. */
public void registerCallback(BluetoothCallback callback) {
synchronized (mCallbacks) {
@@ -155,6 +178,9 @@
BluetoothAdapter.ERROR);
// update local profiles and get paired devices
mLocalAdapter.setBluetoothStateInt(state);
+ if (state == BluetoothAdapter.STATE_ON) {
+ setDefaultBtName();
+ }
// send callback to update UI and possibly start scanning
synchronized (mCallbacks) {
for (BluetoothCallback callback : mCallbacks) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index f6d787c..9207f0a 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -135,6 +135,8 @@
if (newProfileState == BluetoothProfile.STATE_CONNECTED) {
if (profile instanceof MapProfile) {
profile.setPreferred(mDevice, true);
+ mRemovedProfiles.remove(profile);
+ mProfiles.add(profile);
} else if (!mProfiles.contains(profile)) {
mRemovedProfiles.remove(profile);
mProfiles.add(profile);
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
old mode 100755
new mode 100644
index 6a7890f..3876468
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothProfileManager.java
@@ -24,6 +24,7 @@
import android.bluetooth.BluetoothInputDevice;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothDun;
+import android.bluetooth.BluetoothPbap;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothUuid;
import android.content.Context;
@@ -126,15 +127,17 @@
addProfile(mMapProfile, MapProfile.NAME,
BluetoothMap.ACTION_CONNECTION_STATE_CHANGED);
- // enable DUN only if the property is set
+ // enable DUN only if the property is set
if (SystemProperties.getBoolean("ro.bluetooth.dun", false) == true) {
mDunProfile = new DunServerProfile(context);
addProfile(mDunProfile, DunServerProfile.NAME,
BluetoothDun.ACTION_CONNECTION_STATE_CHANGED);
}
- //Create PBAP server profile, but do not add it to list of profiles
- // as we do not need to monitor the profile as part of profile list
+
+ //Create PBAP server profile
mPbapProfile = new PbapServerProfile(context);
+ addProfile(mPbapProfile, PbapServerProfile.NAME,
+ BluetoothPbap.PBAP_STATE_CHANGED_ACTION);
if (DEBUG) Log.d(TAG, "LocalBluetoothProfileManager construction complete");
}
@@ -411,6 +414,13 @@
removedProfiles.remove(mMapProfile);
mMapProfile.setPreferred(device, true);
}
+
+ if ((mPbapProfile != null) &&
+ (mPbapProfile.getConnectionStatus(device) == BluetoothProfile.STATE_CONNECTED)) {
+ profiles.add(mPbapProfile);
+ removedProfiles.remove(mPbapProfile);
+ mPbapProfile.setPreferred(device, true);
+ }
}
}
diff --git a/packages/SettingsProvider/res/values/defaults.xml b/packages/SettingsProvider/res/values/defaults.xml
index c48a29a..c0a1e5c 100644
--- a/packages/SettingsProvider/res/values/defaults.xml
+++ b/packages/SettingsProvider/res/values/defaults.xml
@@ -276,4 +276,18 @@
<!-- Voice Call earpiece Volume,its value is from 0 to 5,default value is 4 -->
<integer name="def_voice_call_earpiece_volume" translatable="false">4</integer>
+
+ <!-- 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"></string>
+
+ <!-- Time format,default value is 24 : 24 format,other value is 12 format -->
+ <string name="def_time_format" translatable="false"></string>
+
+ <!-- enable accessibility or not,1:enable;0:disable -->
+ <integer name="def_enable_accessibility">0</integer>
+
+ <!-- for enable accessibility services,split by ":" ,
+ example "com.google.android.marvin.talkback/
+ com.google.android.marvin.talkback.TalkBackService" -->
+ <string name="def_enable_accessibility_services" translatable="false"></string>
</resources>
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index 8c98f5c..5d2229f 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -2168,6 +2168,35 @@
final SettingsState systemSettings = getSystemSettingsLocked(userId);
loadCustomizedVolumeLevels(systemSettings);
}
+
+ // Allow OEMs to set date format, time format and enable/disable accessibility
+ // services in resource.
+ final SettingsState dateAndTimeSettings = getSystemSettingsLocked(userId);
+ String defaultStringComponent;
+ int defaultIntComponent;
+ defaultStringComponent = getContext().getResources().getString(
+ R.string.def_date_format);
+ if (!TextUtils.isEmpty(defaultStringComponent)) {
+ dateAndTimeSettings.insertSettingLocked(Settings.System.DATE_FORMAT,
+ defaultStringComponent,SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ defaultStringComponent = getContext().getResources().getString(
+ R.string.def_time_format);
+ if (!TextUtils.isEmpty(defaultStringComponent)) {
+ dateAndTimeSettings.insertSettingLocked(Settings.System.TIME_12_24,
+ defaultStringComponent,SettingsState.SYSTEM_PACKAGE_NAME);
+ }
+ defaultIntComponent = getContext().getResources().getInteger(
+ R.integer.def_enable_accessibility);
+ secureSettings.insertSettingLocked(Settings.Secure.ACCESSIBILITY_ENABLED,
+ String.valueOf(defaultIntComponent),SettingsState.SYSTEM_PACKAGE_NAME);
+ defaultStringComponent = getContext().getResources().getString(
+ R.string.def_enable_accessibility_services);
+ if (!TextUtils.isEmpty(defaultStringComponent)) {
+ secureSettings.insertSettingLocked(Settings.Secure.
+ ENABLED_ACCESSIBILITY_SERVICES,defaultStringComponent,
+ SettingsState.SYSTEM_PACKAGE_NAME);
+ }
currentVersion = 122;
}
// vXXX: Add new settings above this point.
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 260d81b..3391b40 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -296,5 +296,7 @@
<!-- Duration of the expansion animation in the volume dialog -->
<item name="volume_expand_animation_duration" type="integer">300</item>
+ <!-- Whether or not to show battery level text. -->
+ <bool name="config_showBatteryPercentage">false</bool>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index b93fc76..418fc92 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -104,7 +104,9 @@
} else if (mMultiUserSwitch.getParent() == this && mKeyguardUserSwitcherShowing) {
removeView(mMultiUserSwitch);
}
- mBatteryLevel.setVisibility(mBatteryCharging ? View.VISIBLE : View.GONE);
+ boolean showBatteryLevel = getResources().getBoolean(R.bool.config_showBatteryPercentage);
+ mBatteryLevel.setVisibility(
+ mBatteryCharging || showBatteryLevel ? View.VISIBLE : View.GONE);
}
private void updateSystemIconsLayoutParams() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
index 186005c..23bdd52 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DateView.java
@@ -106,10 +106,20 @@
mCurrentTime.setTime(System.currentTimeMillis());
- final String text = mDateFormat.format(mCurrentTime);
+ final String text = getDateFormat();
if (!text.equals(mLastText)) {
setText(text);
mLastText = text;
}
}
+
+ private String getDateFormat() {
+ if (getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_dateformat)
+ ) {
+ return DateFormat.getDateFormat(getContext()).format(mCurrentTime);
+ } else {
+ return mDateFormat.format(mCurrentTime);
+ }
+ }
}