summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusheel Nyamala <snyamala@codeaurora.org>2016-03-21 22:35:34 +0530
committerRoman Birg <roman@cyngn.com>2016-06-29 13:33:24 -0700
commit01a0a160a583671839038d536124e2d40e1b42a0 (patch)
tree193ff6ea04cf9d9b36782f17f84db023013f1dbc
parentc8df0f0bde3db5701871dcd62161dac40fb9da73 (diff)
downloadandroid_packages_providers_TelephonyProvider-01a0a160a583671839038d536124e2d40e1b42a0.tar.gz
android_packages_providers_TelephonyProvider-01a0a160a583671839038d536124e2d40e1b42a0.tar.bz2
android_packages_providers_TelephonyProvider-01a0a160a583671839038d536124e2d40e1b42a0.zip
Fix apn restore issue for multi-sim
If "Restore to Default" option is selected on apn menu, then all carriers table entries are deleted and apns file is read again. Due to this, user added apns on both subs are lost though restore is selected for one sub. Fix is to delete all apns except for user added apns on the other available sub. Ticket: PAELLA-271 Change-Id: I4c01e87829c7deca2cf29b479149d79d7e78c9c7 CRs-Fixed: 985437
-rw-r--r--src/com/android/providers/telephony/TelephonyProvider.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/android/providers/telephony/TelephonyProvider.java b/src/com/android/providers/telephony/TelephonyProvider.java
index bd87c34..8669cdf 100644
--- a/src/com/android/providers/telephony/TelephonyProvider.java
+++ b/src/com/android/providers/telephony/TelephonyProvider.java
@@ -2429,9 +2429,26 @@ public class TelephonyProvider extends ContentProvider
private void restoreDefaultAPN(int subId) {
SQLiteDatabase db = mOpenHelper.getWritableDatabase();
+ TelephonyManager mTm =
+ (TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
+ SubscriptionManager sm = SubscriptionManager.from(getContext());
+ String operatorNumeric = null;
+ String where = null;
+ List<SubscriptionInfo> subInfoList = sm.getActiveSubscriptionInfoList();
+ if (subInfoList != null && subInfoList.size() > 1) {
+ where = "not (";
+ for (SubscriptionInfo subInfo : subInfoList) {
+ if (subId != subInfo.getSubscriptionId()) {
+ operatorNumeric = mTm.getIccOperatorNumericForData(subInfo.getSubscriptionId());
+ where = where + "numeric=" + operatorNumeric + " and ";
+ }
+ }
+ where = where + "edited=" + Telephony.Carriers.USER_EDITED + ")";
+ }
+ log("restoreDefaultAPN: where: " + where);
try {
- db.delete(CARRIERS_TABLE, null, null);
+ db.delete(CARRIERS_TABLE, where, null);
} catch (SQLException e) {
loge("got exception when deleting to restore: " + e);
}