To prevent MMS get the incorrect resource on MSIM device
Get TelephonyManager with subid to prevent getting the incorrect
resource(MMS_CONFIG_USER_AGENT and MMS_CONFIG_UA_PROF_URL) on MSIM
device.
Bug: 131296413
Test: Build pass.
Change-Id: I3c51d6e2882596be6dcf660d6903b2cb3e96a6c9
diff --git a/src/com/android/mms/service/MmsRequest.java b/src/com/android/mms/service/MmsRequest.java
index ec8b334..8363686 100644
--- a/src/com/android/mms/service/MmsRequest.java
+++ b/src/com/android/mms/service/MmsRequest.java
@@ -106,8 +106,9 @@
mMmsConfig = config;
// TODO: Make MmsConfigManager authoritative for user agent and don't consult
// TelephonyManager.
- final TelephonyManager telephonyManager =
- (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ final TelephonyManager telephonyManager = ((TelephonyManager) mContext
+ .getSystemService(Context.TELEPHONY_SERVICE))
+ .createForSubscriptionId(mSubId);
final String userAgent = telephonyManager.getMmsUserAgent();
if (!TextUtils.isEmpty(userAgent)) {
config.putString(SmsManager.MMS_CONFIG_USER_AGENT, userAgent);