Merge "UI changes to reflect the primary IMEI value in hidden menu"
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index ede0015..58b8299 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -65,6 +65,7 @@
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SubscriptionInfoUpdater;
import com.android.internal.telephony.TelephonyPermissions;
+import com.android.internal.telephony.subscription.SubscriptionManagerService;
import com.android.internal.telephony.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.telephony.Rlog;
@@ -309,7 +310,7 @@
// smoothly.
mConfigFromDefaultApp[phoneId] = new PersistableBundle();
// Send broadcast if bind fails.
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
// TODO: We *must* call unbindService even if bindService returns false.
// (And possibly if SecurityException was thrown.)
loge("binding to default app: "
@@ -344,7 +345,7 @@
if (resultCode == RESULT_ERROR || resultData == null) {
// On error, abort config fetching.
loge("Failed to get carrier config");
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
return;
}
PersistableBundle config =
@@ -393,7 +394,7 @@
}
// Put a stub bundle in place so that the rest of the logic continues smoothly.
mConfigFromDefaultApp[phoneId] = new PersistableBundle();
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
break;
}
@@ -409,7 +410,7 @@
logd("Found carrier config app: " + carrierPackageName);
sendMessage(obtainMessage(EVENT_DO_FETCH_CARRIER, phoneId, -1));
} else {
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
}
break;
}
@@ -443,7 +444,7 @@
// Send broadcast if bind fails.
broadcastConfigChangedIntent(phoneId);
loge("Bind to carrier app: " + carrierPackageName + " fails");
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
}
}
break;
@@ -476,7 +477,7 @@
loge("Failed to get carrier config from carrier app: "
+ getCarrierPackageForPhoneId(phoneId));
broadcastConfigChangedIntent(phoneId);
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
return;
}
PersistableBundle config =
@@ -533,7 +534,7 @@
}
// Put a stub bundle in place so that the rest of the logic continues smoothly.
mConfigFromCarrierApp[phoneId] = new PersistableBundle();
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
break;
}
case EVENT_FETCH_CARRIER_DONE: {
@@ -543,7 +544,7 @@
&& mServiceConnection[phoneId] == null) {
break;
}
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
break;
}
@@ -696,7 +697,8 @@
*/
@VisibleForTesting
/* package */ CarrierConfigLoader(@NonNull Context context,
- @NonNull SubscriptionInfoUpdater subscriptionInfoUpdater, @NonNull Looper looper) {
+ //TODO: Remove SubscriptionInfoUpdater.
+ @Nullable SubscriptionInfoUpdater subscriptionInfoUpdater, @NonNull Looper looper) {
mContext = context;
mPlatformCarrierConfigPackage =
mContext.getString(R.string.platform_carrier_config_package);
@@ -774,17 +776,17 @@
}
}
- private void notifySubscriptionInfoUpdater(int phoneId) {
- String configPackagename;
+ private void updateSubscriptionDatabase(int phoneId) {
+ String configPackageName;
PersistableBundle configToSend;
int carrierId = getSpecificCarrierIdForPhoneId(phoneId);
// Prefer the carrier privileged carrier app, but if there is not one, use the platform
// default carrier app.
if (mConfigFromCarrierApp[phoneId] != null) {
- configPackagename = getCarrierPackageForPhoneId(phoneId);
+ configPackageName = getCarrierPackageForPhoneId(phoneId);
configToSend = mConfigFromCarrierApp[phoneId];
} else {
- configPackagename = mPlatformCarrierConfigPackage;
+ configPackageName = mPlatformCarrierConfigPackage;
configToSend = mConfigFromDefaultApp[phoneId];
}
@@ -799,9 +801,16 @@
configToSend.putAll(config);
}
- mSubscriptionInfoUpdater.updateSubscriptionByCarrierConfigAndNotifyComplete(
- phoneId, configPackagename, configToSend,
- mHandler.obtainMessage(EVENT_SUBSCRIPTION_INFO_UPDATED, phoneId, -1));
+ if (PhoneFactory.isSubscriptionManagerServiceEnabled()) {
+ SubscriptionManagerService.getInstance().updateSubscriptionByCarrierConfig(
+ phoneId, configPackageName, configToSend,
+ () -> mHandler.obtainMessage(EVENT_SUBSCRIPTION_INFO_UPDATED, phoneId, -1)
+ .sendToTarget());
+ } else {
+ mSubscriptionInfoUpdater.updateSubscriptionByCarrierConfigAndNotifyComplete(
+ phoneId, configPackageName, configToSend,
+ mHandler.obtainMessage(EVENT_SUBSCRIPTION_INFO_UPDATED, phoneId, -1));
+ }
}
private void broadcastConfigChangedIntent(int phoneId) {
@@ -1434,7 +1443,7 @@
fileToDelete.delete();
}
}
- notifySubscriptionInfoUpdater(phoneId);
+ updateSubscriptionDatabase(phoneId);
});
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c4449d8..ff4dcfe 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -394,7 +394,7 @@
private AppOpsManager mAppOps;
private PackageManager mPm;
private MainThreadHandler mMainThreadHandler;
- private SubscriptionController mSubscriptionController;
+ private final SubscriptionController mSubscriptionController;
private SharedPreferences mTelephonySharedPreferences;
private PhoneConfigurationManager mPhoneConfigurationManager;
private final RadioInterfaceCapabilityController mRadioInterfaceCapabilities;
@@ -2410,7 +2410,11 @@
mAppOps = (AppOpsManager)app.getSystemService(Context.APP_OPS_SERVICE);
mPm = app.getSystemService(PackageManager.class);
mMainThreadHandler = new MainThreadHandler();
- mSubscriptionController = SubscriptionController.getInstance();
+ if (!PhoneFactory.isSubscriptionManagerServiceEnabled()) {
+ mSubscriptionController = SubscriptionController.getInstance();
+ } else {
+ mSubscriptionController = null;
+ }
mTelephonySharedPreferences =
PreferenceManager.getDefaultSharedPreferences(mApp);
mNetworkScanRequestTracker = new NetworkScanRequestTracker();
@@ -6730,11 +6734,15 @@
return false;
}
- log("setAllowedNetworkTypesForReason: " + reason + " value: "
+ log("setAllowedNetworkTypesForReason: subId=" + subId + ", reason=" + reason + " value: "
+ TelephonyManager.convertNetworkTypeBitmaskToString(allowedNetworkTypes));
+ Phone phone = getPhone(subId);
+ if (phone == null) {
+ return false;
+ }
- if (allowedNetworkTypes == getPhoneFromSubId(subId).getAllowedNetworkTypes(reason)) {
+ if (allowedNetworkTypes == phone.getAllowedNetworkTypes(reason)) {
log("setAllowedNetworkTypesForReason: " + reason + "does not change value");
return true;
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 4952596..a5be6c3 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -602,18 +602,21 @@
// code from original connection.
com.android.internal.telephony.Connection connection =
mNormalCallConnection.getOriginalConnection();
- if (cause == android.telephony.DisconnectCause.NOT_VALID) {
- cause = connection.getDisconnectCause();
+ if (connection != null) {
+ if (cause == android.telephony.DisconnectCause.NOT_VALID) {
+ cause = connection.getDisconnectCause();
+ }
+
+ String reason = connection.getVendorDisconnectCause();
+
+ mNormalCallConnection.setTelephonyConnectionDisconnected(
+ mDisconnectCauseFactory.toTelecomDisconnectCause(
+ cause, reason));
+ Log.d(this, "Call connection closed. Cause: " + cause
+ + " Reason: " + reason);
}
-
- String reason = connection.getVendorDisconnectCause();
- mNormalCallConnection.setTelephonyConnectionDisconnected(
- mDisconnectCauseFactory.toTelecomDisconnectCause(cause, reason));
-
mNormalCallConnection.close();
mNormalCallConnection = null;
- Log.d(this, "Call connection closed. Cause: " + cause
- + " Reason: " + reason);
}
}