summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-11-16 14:43:08 -0800
committerSteve Kondik <steve@cyngn.com>2015-11-16 14:43:08 -0800
commite6aed7196211928232ee005bd37a6a220ac64e64 (patch)
treee4d277867c608ed65edd9be63d9da7d53007d893 /src/com/android
parenteeef647fe68714d843bf2bb7c39251c89f62f172 (diff)
parentc9d123c33452bf651b0c6b8c9754f7bf1766e931 (diff)
downloadpackages_apps_Settings-e6aed7196211928232ee005bd37a6a220ac64e64.tar.gz
packages_apps_Settings-e6aed7196211928232ee005bd37a6a220ac64e64.tar.bz2
packages_apps_Settings-e6aed7196211928232ee005bd37a6a220ac64e64.zip
Merge branch 'LA.BF64.1.2.2_rb4.7' 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/ApnEditor.java7
-rw-r--r--[-rwxr-xr-x]src/com/android/settings/bluetooth/DeviceProfilesSettings.java33
-rw-r--r--src/com/android/settings/sim/SimSettings.java87
-rw-r--r--src/com/android/settings/wifi/WifiConfigController.java5
4 files changed, 89 insertions, 43 deletions
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java
index 013d75489..a1315109d 100644
--- a/src/com/android/settings/ApnEditor.java
+++ b/src/com/android/settings/ApnEditor.java
@@ -60,6 +60,8 @@ public class ApnEditor extends InstrumentedPreferenceActivity
private final static String KEY_BEARER_MULTI = "bearer_multi";
private final static String KEY_MVNO_TYPE = "mvno_type";
+ private final static String PROTOCOL_IPV4V6= "IPV4V6";
+
private static final int MENU_DELETE = Menu.FIRST;
private static final int MENU_SAVE = Menu.FIRST + 1;
private static final int MENU_CANCEL = Menu.FIRST + 2;
@@ -216,7 +218,10 @@ public class ApnEditor extends InstrumentedPreferenceActivity
mUri = intent.getData();
} else if (action.equals(Intent.ACTION_INSERT)) {
if (mFirstTime || icicle.getInt(SAVED_POS) == 0) {
- mUri = getContentResolver().insert(intent.getData(), new ContentValues());
+ ContentValues values = new ContentValues();
+ values.put(Telephony.Carriers.PROTOCOL, PROTOCOL_IPV4V6);
+ values.put(Telephony.Carriers.ROAMING_PROTOCOL, PROTOCOL_IPV4V6);
+ mUri = getContentResolver().insert(intent.getData(), values);
} else {
mUri = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI,
icicle.getInt(SAVED_POS));
diff --git a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
index b7d837b74..abee8cc00 100755..100644
--- a/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
+++ b/src/com/android/settings/bluetooth/DeviceProfilesSettings.java
@@ -174,11 +174,16 @@ public final class DeviceProfilesSettings extends DialogFragment implements
private void addPreferencesForProfiles() {
mProfileContainer.removeAllViews();
for (LocalBluetoothProfile profile : mCachedDevice.getConnectableProfiles()) {
- CheckBox pref = createProfilePreference(profile);
- mProfileContainer.addView(pref);
+ // MAP and PBAP profiles would be added based on permission access
+ if (!((profile instanceof PbapServerProfile) ||
+ (profile instanceof MapProfile))) {
+ CheckBox pref = createProfilePreference(profile);
+ mProfileContainer.addView(pref);
+ }
}
final int pbapPermission = mCachedDevice.getPhonebookPermissionChoice();
+ Log.d(TAG, "addPreferencesForProfiles: pbapPermission = " + pbapPermission);
// Only provide PBAP cabability if the client device has requested PBAP.
if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
final PbapServerProfile psp = mManager.getProfileManager().getPbapProfile();
@@ -188,6 +193,7 @@ public final class DeviceProfilesSettings extends DialogFragment implements
final MapProfile mapProfile = mManager.getProfileManager().getMapProfile();
final int mapPermission = mCachedDevice.getMessagePermissionChoice();
+ Log.d(TAG, "addPreferencesForProfiles: mapPermission = " + mapPermission);
if (mapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN) {
CheckBox mapPreference = createProfilePreference(mapProfile);
mProfileContainer.addView(mapPreference);
@@ -242,15 +248,6 @@ public final class DeviceProfilesSettings extends DialogFragment implements
private void onProfileClicked(LocalBluetoothProfile profile, CheckBox profilePref) {
BluetoothDevice device = mCachedDevice.getDevice();
- if (KEY_PBAP_SERVER.equals(profilePref.getTag())) {
- final int newPermission = mCachedDevice.getPhonebookPermissionChoice()
- == CachedBluetoothDevice.ACCESS_ALLOWED ? CachedBluetoothDevice.ACCESS_REJECTED
- : CachedBluetoothDevice.ACCESS_ALLOWED;
- mCachedDevice.setPhonebookPermissionChoice(newPermission);
- profilePref.setChecked(newPermission == CachedBluetoothDevice.ACCESS_ALLOWED);
- return;
- }
-
if (!profilePref.isChecked()) {
// Recheck it, until the dialog is done.
profilePref.setChecked(true);
@@ -259,6 +256,11 @@ public final class DeviceProfilesSettings extends DialogFragment implements
if (profile instanceof MapProfile) {
mCachedDevice.setMessagePermissionChoice(BluetoothDevice.ACCESS_ALLOWED);
}
+ if (profile instanceof PbapServerProfile) {
+ mCachedDevice.setPhonebookPermissionChoice(BluetoothDevice.ACCESS_ALLOWED);
+ refreshProfilePreference(profilePref, profile);
+ return;
+ }
if (profile.isPreferred(device)) {
// profile is preferred but not connected: disable auto-connect
if (profile instanceof PanProfile) {
@@ -296,9 +298,12 @@ public final class DeviceProfilesSettings extends DialogFragment implements
if (which == OK_BUTTON) {
device.disconnect(profile);
profile.setPreferred(device.getDevice(), false);
- }
- if (profile instanceof MapProfile) {
- device.setMessagePermissionChoice(BluetoothDevice.ACCESS_REJECTED);
+ if (profile instanceof MapProfile) {
+ device.setMessagePermissionChoice(BluetoothDevice.ACCESS_REJECTED);
+ }
+ if (profile instanceof PbapServerProfile) {
+ device.setPhonebookPermissionChoice(BluetoothDevice.ACCESS_REJECTED);
+ }
}
refreshProfilePreference(findProfile(profile.toString()), profile);
}
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java
index 1ea2feeda..f16fc1c01 100644
--- a/src/com/android/settings/sim/SimSettings.java
+++ b/src/com/android/settings/sim/SimSettings.java
@@ -108,6 +108,8 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
private int mPhoneCount = TelephonyManager.getDefault().getPhoneCount();
private int[] mUiccProvisionStatus = new int[mPhoneCount];
private Preference mPrimarySubSelect = null;
+ private int[] mCallState = new int[mPhoneCount];
+ private PhoneStateListener[] mPhoneStateListener = new PhoneStateListener[mPhoneCount];
private static final String ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED =
"org.codeaurora.intent.action.ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED";
@@ -245,7 +247,13 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
} else if (sir == null) {
simPref.setSummary(R.string.sim_selection_required_pref);
}
- simPref.setEnabled(mSelectableSubInfos.size() > 1 && !disableDds());
+
+ boolean callStateIdle = isCallStateIdle();
+ final boolean ecbMode = SystemProperties.getBoolean(
+ TelephonyProperties.PROPERTY_INECM_MODE, false);
+ // Enable data preference in msim mode and call state idle
+ simPref.setEnabled((mSelectableSubInfos.size() > 1) && !disableDds()
+ && callStateIdle && !ecbMode);
}
private void updateCallValues() {
@@ -267,19 +275,16 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
public void onResume() {
super.onResume();
mSubscriptionManager.addOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
- final TelephonyManager tm =
- (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
initLTEPreference();
updateSubscriptions();
+ listen();
}
@Override
public void onPause() {
super.onPause();
mSubscriptionManager.removeOnSubscriptionsChangedListener(mOnSubscriptionsChangeListener);
- final TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE);
+ unRegisterPhoneStateListener();
for (int i = 0; i < mSimCards.getPreferenceCount(); ++i) {
Preference pref = mSimCards.getPreference(i);
@@ -290,24 +295,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
}
}
- private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
- // Disable Sim selection for Data when voice call is going on as changing the default data
- // sim causes a modem reset currently and call gets disconnected
- // ToDo : Add subtext on disabled preference to let user know that default data sim cannot
- // be changed while call is going on
- @Override
- public void onCallStateChanged(int state, String incomingNumber) {
- if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
- final Preference pref = findPreference(KEY_CELLULAR_DATA);
- if (pref != null) {
- final boolean ecbMode = SystemProperties.getBoolean(
- TelephonyProperties.PROPERTY_INECM_MODE, false);
- pref.setEnabled((state == TelephonyManager.CALL_STATE_IDLE) && !ecbMode
- && (mSelectableSubInfos.size() > 1) && !disableDds());
- }
- }
- };
-
@Override
public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen,
final Preference preference) {
@@ -970,4 +957,56 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
log(" config disable dds = " + disableDds);
return disableDds;
}
+
+ private void listen() {
+ TelephonyManager tm =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ if (mSelectableSubInfos.size() > 1) {
+ Log.d(TAG, "Register for call state change");
+ for (int i = 0; i < mPhoneCount; i++) {
+ int subId = mSelectableSubInfos.get(i).getSubscriptionId();
+ tm.listen(getPhoneStateListener(i, subId),
+ PhoneStateListener.LISTEN_CALL_STATE);
+ }
+ }
+ }
+
+ private void unRegisterPhoneStateListener() {
+ TelephonyManager tm =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ for (int i = 0; i < mPhoneCount; i++) {
+ if (mPhoneStateListener[i] != null) {
+ tm.listen(mPhoneStateListener[i], PhoneStateListener.LISTEN_NONE);
+ mPhoneStateListener[i] = null;
+ }
+ }
+ }
+
+ private PhoneStateListener getPhoneStateListener(int phoneId, int subId) {
+ // Disable Sim selection for Data when voice call is going on as changing the default data
+ // sim causes a modem reset currently and call gets disconnected
+ // ToDo : Add subtext on disabled preference to let user know that default data sim cannot
+ // be changed while call is going on
+ final int i = phoneId;
+ mPhoneStateListener[phoneId] = new PhoneStateListener(subId) {
+ @Override
+ public void onCallStateChanged(int state, String incomingNumber) {
+ if (DBG) log("PhoneStateListener.onCallStateChanged: state=" + state);
+ mCallState[i] = state;
+ updateCellularDataValues();
+ }
+ };
+ return mPhoneStateListener[phoneId];
+ }
+
+ private boolean isCallStateIdle() {
+ boolean callStateIdle = true;
+ for (int i = 0; i < mCallState.length; i++) {
+ if (TelephonyManager.CALL_STATE_IDLE != mCallState[i]) {
+ callStateIdle = false;
+ }
+ }
+ Log.d(TAG, "isCallStateIdle " + callStateIdle);
+ return callStateIdle;
+ }
}
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index ab7999fa0..b4a89678a 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -157,7 +157,6 @@ public class WifiConfigController implements TextWatcher,
private Context mContext;
private TelephonyManager mTelephonyManager;
private SubscriptionManager mSubscriptionManager = null;
- private String selectedSimCardName;
private int selectedSimCardNumber;
@@ -466,9 +465,7 @@ public class WifiConfigController implements TextWatcher,
case Eap.SIM:
case Eap.AKA:
case Eap.AKA_PRIME:
- selectedSimCardName = (String)mSimCardSpinner.getSelectedItem();
- selectedSimCardNumber = mSimDisplayNames.
- indexOf(selectedSimCardName) + 1;
+ selectedSimCardNumber = mSimCardSpinner.getSelectedItemPosition() + 1;
config.SIMNum = selectedSimCardNumber;
break;
default: