summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-10-21 16:50:12 -0700
committerSteve Kondik <steve@cyngn.com>2015-10-21 16:50:12 -0700
commit96209feb22610e737a0b88ea12525fffe49337c3 (patch)
tree703ef7a012d37d0ce8706b9e75dc78bfcd0c8443 /src/com/android
parent587efed7f64c32d822baead8651c1f47067b59c1 (diff)
parentf36c88df114d69ddb5143167642af5f5d493257a (diff)
downloadpackages_apps_Settings-96209feb22610e737a0b88ea12525fffe49337c3.zip
packages_apps_Settings-96209feb22610e737a0b88ea12525fffe49337c3.tar.gz
packages_apps_Settings-96209feb22610e737a0b88ea12525fffe49337c3.tar.bz2
Merge branch 'm' of git://codeaurora.org/platform/packages/apps/Settings into cm-13.0
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/settings/DeviceInfoSettings.java5
-rw-r--r--src/com/android/settings/SubSettings.java1
-rw-r--r--src/com/android/settings/Utils.java25
-rw-r--r--src/com/android/settings/bluetooth/BluetoothPairingRequest.java3
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java60
-rw-r--r--src/com/android/settings/deviceinfo/SimStatus.java14
6 files changed, 93 insertions, 15 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 1f0cad1..3a0e061 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -180,9 +180,10 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
removePreferenceIfBoolFalse(KEY_UPDATE_SETTING,
R.bool.config_additional_system_update_setting_enable);
- // Remove regulatory information if none present.
+ // Remove regulatory information if none present or config_show_regulatory_info is disabled
final Intent intent = new Intent(Settings.ACTION_SHOW_REGULATORY_INFO);
- if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()) {
+ if (getPackageManager().queryIntentActivities(intent, 0).isEmpty()
+ || !getResources().getBoolean(R.bool.config_show_regulatory_info)) {
Preference pref = findPreference(KEY_REGULATORY_INFO);
if (pref != null) {
getPreferenceScreen().removePreference(pref);
diff --git a/src/com/android/settings/SubSettings.java b/src/com/android/settings/SubSettings.java
index 04955b2..13ead6e 100644
--- a/src/com/android/settings/SubSettings.java
+++ b/src/com/android/settings/SubSettings.java
@@ -35,4 +35,5 @@ public class SubSettings extends SettingsActivity {
Log.d("SubSettings", "Launching fragment " + fragmentName);
return true;
}
+ public static class BluetoothSubSettings extends SubSettings { /* empty */ }
}
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index d25d8c3..b6d9414 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -69,6 +69,7 @@ import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Profile;
import android.provider.ContactsContract.RawContacts;
import android.service.persistentdata.PersistentDataBlockManager;
+import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableString;
@@ -91,6 +92,7 @@ import com.android.settings.UserAdapter.UserDetails;
import com.android.settings.dashboard.DashboardTile;
import com.android.settings.drawable.CircleFramedDrawable;
import com.android.settingslib.applications.ApplicationsState;
+import com.android.settings.bluetooth.BluetoothSettings;
import java.io.IOException;
import java.io.InputStream;
@@ -716,7 +718,12 @@ public final class Utils {
Bundle args, String titleResPackageName, int titleResId, CharSequence title,
boolean isShortcut) {
Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClass(context, SubSettings.class);
+ if (BluetoothSettings.class.getName().equals(fragmentName)) {
+ intent.setClass(context, SubSettings.BluetoothSubSettings.class);
+ intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_AS_SUBSETTING, true);
+ } else {
+ intent.setClass(context, SubSettings.class);
+ }
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, fragmentName);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS, args);
intent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RES_PACKAGE_NAME,
@@ -1245,5 +1252,19 @@ public final class Utils {
return UserHandle.myUserId();
}
}
-}
+ public static String getServiceStateString(int state, Resources res) {
+ switch (state) {
+ case ServiceState.STATE_IN_SERVICE:
+ return res.getString(R.string.radioInfo_service_in);
+ case ServiceState.STATE_OUT_OF_SERVICE:
+ case ServiceState.STATE_EMERGENCY_ONLY:
+ return res.getString(R.string.radioInfo_service_out);
+ case ServiceState.STATE_POWER_OFF:
+ return res.getString(R.string.radioInfo_service_off);
+ default:
+ return res.getString(R.string.radioInfo_unknown);
+ }
+ }
+
+}
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
index 5290538..71d6364 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -122,7 +122,8 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
int oldState = intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
BluetoothDevice.ERROR);
if((oldState == BluetoothDevice.BOND_BONDING) &&
- (bondState == BluetoothDevice.BOND_NONE)) {
+ (bondState == BluetoothDevice.BOND_NONE ||
+ bondState == BluetoothDevice.BOND_BONDED)) {
// Remove the notification
NotificationManager manager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 2663e07..ab5cf26 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -18,6 +18,8 @@ package com.android.settings.bluetooth;
import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
+import android.app.ActionBar;
+import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
@@ -25,6 +27,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.Preference;
@@ -34,13 +37,17 @@ import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.text.Spannable;
import android.text.style.TextAppearanceSpan;
+import android.util.DisplayMetrics;
import android.util.Log;
+import android.util.TypedValue;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.ViewGroup.LayoutParams;
import android.widget.TextView;
+import android.widget.Toolbar;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.LinkifyUtils;
@@ -146,6 +153,59 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
}
@Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ Activity activity = getActivity();
+ float titleTextSize;
+ int actionBarHeight;
+ int switchBarHeight;
+ if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ titleTextSize = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_landscape_title_textsize);
+ switchBarHeight = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_landscape_switchbar_height);
+ actionBarHeight = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_landscape_actionbar_height);
+ } else {
+ titleTextSize = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_portrait_title_textsize);
+ switchBarHeight = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_portrait_switchbar_height);
+ actionBarHeight = activity.getResources().getDimensionPixelSize(
+ R.dimen.bluetooth_portrait_switchbar_height);
+ }
+ resetBarSize(titleTextSize, actionBarHeight, switchBarHeight);
+ }
+
+ private void resetBarSize(float titleTextSize, int actionBarHeight, int switchBarHeight) {
+ Activity activity = getActivity();
+ DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
+ int titleId = Resources.getSystem().getIdentifier("action_bar", "id", "android");
+ Toolbar toolbar = (Toolbar) activity.getWindow().findViewById(titleId);
+ TextView title = null;
+ if (toolbar != null) {
+ LayoutParams layoutParams = toolbar.getLayoutParams();
+ layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ actionBarHeight, displayMetrics);
+ for (int i = 0; i < toolbar.getChildCount(); ++i) {
+ if (toolbar.getChildAt(i) instanceof TextView) {
+ title = (TextView) toolbar.getChildAt(i);
+ }
+ Toolbar.LayoutParams childLayoutParams = (Toolbar.LayoutParams) toolbar.getChildAt(
+ i).getLayoutParams();
+ childLayoutParams.gravity = Gravity.CENTER_VERTICAL;
+ }
+ }
+ if (title != null)
+ title.setTextSize(TypedValue.COMPLEX_UNIT_DIP, titleTextSize);
+ if (mSwitchBar != null) {
+ LayoutParams layoutParams = mSwitchBar.getLayoutParams();
+ layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
+ switchBarHeight, displayMetrics);
+ }
+ }
+
+ @Override
public void onDestroyView() {
super.onDestroyView();
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index b81b068..8a249ee 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -290,30 +290,24 @@ public class SimStatus extends InstrumentedPreferenceActivity {
private void updateServiceState(ServiceState serviceState) {
final int state = serviceState.getState();
final int dataState = mPhone.getServiceState().getDataRegState();
- String display = mRes.getString(R.string.radioInfo_unknown);
switch (state) {
- case ServiceState.STATE_IN_SERVICE:
- display = mRes.getString(R.string.radioInfo_service_in);
- break;
case ServiceState.STATE_OUT_OF_SERVICE:
// Set signal strength to 0 when service state is STATE_OUT_OF_SERVICE
if (ServiceState.STATE_OUT_OF_SERVICE == dataState) {
mSignalStrength.setSummary("0");
}
- case ServiceState.STATE_EMERGENCY_ONLY:
- // Set summary string of service state to radioInfo_service_out when
- // service state is both STATE_OUT_OF_SERVICE & STATE_EMERGENCY_ONLY
- display = mRes.getString(R.string.radioInfo_service_out);
break;
case ServiceState.STATE_POWER_OFF:
- display = mRes.getString(R.string.radioInfo_service_off);
// Also set signal strength to 0
mSignalStrength.setSummary("0");
break;
}
+ String voiceDisplay = Utils.getServiceStateString(state, mRes);
+
+ String dataDisplay = Utils.getServiceStateString(dataState, mRes);
- setSummaryText(KEY_SERVICE_STATE, display);
+ setSummaryText(KEY_SERVICE_STATE, "Voice: " + voiceDisplay + " / Data: " + dataDisplay);
if (serviceState.getRoaming()) {
setSummaryText(KEY_ROAMING_STATE, mRes.getString(R.string.radioInfo_roaming_in));