Merge "Associate connected APN list with subscription"
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 19a4851..71ff6e9 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -159,7 +159,7 @@
private String[] mDataConnectionApn;
- private ArrayList<String> mConnectedApns;
+ private ArrayList<String>[] mConnectedApns;
private LinkProperties[] mDataConnectionLinkProperties;
@@ -292,11 +292,11 @@
mContext = context;
mBatteryStats = BatteryStatsService.getService();
- mConnectedApns = new ArrayList<String>();
int numPhones = TelephonyManager.getDefault().getPhoneCount();
if (DBG) log("TelephonyRegistor: ctor numPhones=" + numPhones);
mNumPhones = numPhones;
+ mConnectedApns = new ArrayList[numPhones];
mCallState = new int[numPhones];
mDataActivity = new int[numPhones];
mDataConnectionState = new int[numPhones];
@@ -314,6 +314,7 @@
mDataConnectionNetworkCapabilities = new NetworkCapabilities[numPhones];
mCellInfo = new ArrayList<List<CellInfo>>();
for (int i = 0; i < numPhones; i++) {
+ mConnectedApns[i] = new ArrayList<String>();
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
mDataActivity[i] = TelephonyManager.DATA_ACTIVITY_NONE;
mDataConnectionState[i] = TelephonyManager.DATA_UNKNOWN;
@@ -336,7 +337,6 @@
location.fillInNotifierBundle(mCellLocation[i]);
}
}
- mConnectedApns = new ArrayList<String>();
mAppOps = mContext.getSystemService(AppOpsManager.class);
}
@@ -1057,18 +1057,21 @@
synchronized (mRecords) {
int phoneId = SubscriptionManager.getPhoneId(subId);
if (validatePhoneId(phoneId)) {
+ if (VDBG) {
+ log(" mConnectedApns[" + phoneId + "]=" + mConnectedApns[phoneId].toString());
+ }
boolean modified = false;
if (state == TelephonyManager.DATA_CONNECTED) {
- if (!mConnectedApns.contains(apnType)) {
- mConnectedApns.add(apnType);
+ if (!mConnectedApns[phoneId].contains(apnType)) {
+ mConnectedApns[phoneId].add(apnType);
if (mDataConnectionState[phoneId] != state) {
mDataConnectionState[phoneId] = state;
modified = true;
}
}
} else {
- if (mConnectedApns.remove(apnType)) {
- if (mConnectedApns.isEmpty()) {
+ if (mConnectedApns[phoneId].remove(apnType)) {
+ if (mConnectedApns[phoneId].isEmpty()) {
mDataConnectionState[phoneId] = state;
modified = true;
} else {