summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaesu Lee <taesu82.lee@samsung.com>2020-01-06 17:34:43 -0800
committerandroid-build-merger <android-build-merger@google.com>2020-01-06 17:34:43 -0800
commit024ccf3c902bcca7e2fa5ec1f896f283dbae3c40 (patch)
tree886ec518e944500326e3025d8f51210285d4c2d9
parent46c54e08d695aa1a44b1b24bdddbd973c0687107 (diff)
parent52be231088f526eafd20d717d2233fe635f9cf7a (diff)
downloadMms-024ccf3c902bcca7e2fa5ec1f896f283dbae3c40.tar.gz
Merge "Get MMS config through SmsManager"
am: 52be231088 Change-Id: If099d9af1c85f14c3fcf152656048f01300e515f
-rw-r--r--src/com/android/mms/service/MmsConfigManager.java93
-rw-r--r--src/com/android/mms/service/MmsService.java18
2 files changed, 5 insertions, 106 deletions
diff --git a/src/com/android/mms/service/MmsConfigManager.java b/src/com/android/mms/service/MmsConfigManager.java
index 20ae9e4..3606ed8 100644
--- a/src/com/android/mms/service/MmsConfigManager.java
+++ b/src/com/android/mms/service/MmsConfigManager.java
@@ -20,9 +20,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.os.BaseBundle;
import android.os.Bundle;
-import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
@@ -99,90 +97,10 @@ public class MmsConfigManager {
}
/**
- * Filters a bundle to only contain MMS config variables.
- *
- * This is for use with bundles returned by {@link CarrierConfigManager} which contain MMS
- * config and unrelated config. It is assumed that all MMS_CONFIG_* keys are present in the
- * supplied bundle.
- *
- * @param config a Bundle that contains MMS config variables and possibly more.
- * @return a new Bundle that only contains the MMS_CONFIG_* keys defined above.
- * @hide
- */
- private static Bundle getMmsConfig(BaseBundle config) {
- Bundle filtered = new Bundle();
- filtered.putBoolean(SmsManager.MMS_CONFIG_APPEND_TRANSACTION_ID,
- config.getBoolean(SmsManager.MMS_CONFIG_APPEND_TRANSACTION_ID));
- filtered.putBoolean(SmsManager.MMS_CONFIG_MMS_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_MMS_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_GROUP_MMS_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_GROUP_MMS_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_ALIAS_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_ALIAS_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_ALLOW_ATTACH_AUDIO,
- config.getBoolean(SmsManager.MMS_CONFIG_ALLOW_ATTACH_AUDIO));
- filtered.putBoolean(SmsManager.MMS_CONFIG_MULTIPART_SMS_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_MULTIPART_SMS_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION,
- config.getBoolean(SmsManager.MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION));
- filtered.putBoolean(SmsManager.MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES,
- config.getBoolean(SmsManager.MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES));
- filtered.putBoolean(SmsManager.MMS_CONFIG_MMS_READ_REPORT_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_MMS_READ_REPORT_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED,
- config.getBoolean(SmsManager.MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED));
- filtered.putBoolean(SmsManager.MMS_CONFIG_CLOSE_CONNECTION,
- config.getBoolean(SmsManager.MMS_CONFIG_CLOSE_CONNECTION));
- filtered.putInt(SmsManager.MMS_CONFIG_MAX_MESSAGE_SIZE,
- config.getInt(SmsManager.MMS_CONFIG_MAX_MESSAGE_SIZE));
- filtered.putInt(SmsManager.MMS_CONFIG_MAX_IMAGE_WIDTH,
- config.getInt(SmsManager.MMS_CONFIG_MAX_IMAGE_WIDTH));
- filtered.putInt(SmsManager.MMS_CONFIG_MAX_IMAGE_HEIGHT,
- config.getInt(SmsManager.MMS_CONFIG_MAX_IMAGE_HEIGHT));
- filtered.putInt(SmsManager.MMS_CONFIG_RECIPIENT_LIMIT,
- config.getInt(SmsManager.MMS_CONFIG_RECIPIENT_LIMIT));
- filtered.putInt(SmsManager.MMS_CONFIG_ALIAS_MIN_CHARS,
- config.getInt(SmsManager.MMS_CONFIG_ALIAS_MIN_CHARS));
- filtered.putInt(SmsManager.MMS_CONFIG_ALIAS_MAX_CHARS,
- config.getInt(SmsManager.MMS_CONFIG_ALIAS_MAX_CHARS));
- filtered.putInt(SmsManager.MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD,
- config.getInt(SmsManager.MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD));
- filtered.putInt(SmsManager.MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD,
- config.getInt(SmsManager.MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD));
- filtered.putInt(SmsManager.MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE,
- config.getInt(SmsManager.MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE));
- filtered.putInt(SmsManager.MMS_CONFIG_SUBJECT_MAX_LENGTH,
- config.getInt(SmsManager.MMS_CONFIG_SUBJECT_MAX_LENGTH));
- filtered.putInt(SmsManager.MMS_CONFIG_HTTP_SOCKET_TIMEOUT,
- config.getInt(SmsManager.MMS_CONFIG_HTTP_SOCKET_TIMEOUT));
- filtered.putString(SmsManager.MMS_CONFIG_UA_PROF_TAG_NAME,
- config.getString(SmsManager.MMS_CONFIG_UA_PROF_TAG_NAME));
- filtered.putString(SmsManager.MMS_CONFIG_USER_AGENT,
- config.getString(SmsManager.MMS_CONFIG_USER_AGENT));
- filtered.putString(SmsManager.MMS_CONFIG_UA_PROF_URL,
- config.getString(SmsManager.MMS_CONFIG_UA_PROF_URL));
- filtered.putString(SmsManager.MMS_CONFIG_HTTP_PARAMS,
- config.getString(SmsManager.MMS_CONFIG_HTTP_PARAMS));
- filtered.putString(SmsManager.MMS_CONFIG_EMAIL_GATEWAY_NUMBER,
- config.getString(SmsManager.MMS_CONFIG_EMAIL_GATEWAY_NUMBER));
- filtered.putString(SmsManager.MMS_CONFIG_NAI_SUFFIX,
- config.getString(SmsManager.MMS_CONFIG_NAI_SUFFIX));
- filtered.putBoolean(SmsManager.MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS,
- config.getBoolean(SmsManager.MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS));
- filtered.putBoolean(SmsManager.MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER,
- config.getBoolean(SmsManager.MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER));
- return filtered;
- }
-
- /**
* This loads the MMS config for each active subscription.
*
- * MMS config is fetched from CarrierConfigManager and filtered to only include MMS config
- * variables. The resulting bundles are stored in mSubIdConfigMap.
+ * MMS config is fetched from SmsManager#getCarrierConfigValues(). The resulting bundles are
+ * stored in mSubIdConfigMap.
*/
private void load(Context context) {
List<SubscriptionInfo> subs = mSubscriptionManager.getActiveSubscriptionInfoList();
@@ -193,15 +111,14 @@ public class MmsConfigManager {
// Load all the config bundles into a new map and then swap it with the real map to avoid
// blocking.
final Map<Integer, Bundle> newConfigMap = new ArrayMap<Integer, Bundle>();
- final CarrierConfigManager configManager =
- (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
for (SubscriptionInfo sub : subs) {
final int subId = sub.getSubscriptionId();
LogUtil.i("MmsConfigManager loads mms config for "
+ sub.getMccString() + "/" + sub.getMncString()
+ ", CarrierId " + sub.getCarrierId());
- PersistableBundle config = configManager.getConfigForSubId(subId);
- newConfigMap.put(subId, getMmsConfig(config));
+ newConfigMap.put(
+ subId,
+ SmsManager.getSmsManagerForSubscriptionId(subId).getCarrierConfigValues());
}
synchronized(mSubIdConfigMap) {
mSubIdConfigMap.clear();
diff --git a/src/com/android/mms/service/MmsService.java b/src/com/android/mms/service/MmsService.java
index 66b23ac..20e74d5 100644
--- a/src/com/android/mms/service/MmsService.java
+++ b/src/com/android/mms/service/MmsService.java
@@ -263,24 +263,6 @@ public class MmsService extends Service implements MmsRequest.RequestManager {
}
@Override
- public Bundle getCarrierConfigValues(int subId) {
- LogUtil.d("getCarrierConfigValues");
- // Make sure the subId is correct
- if (!SubscriptionManager.isValidSubscriptionId(subId)) {
- LogUtil.e("Invalid subId " + subId);
- return new Bundle();
- }
- if (subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
- subId = SubscriptionManager.getDefaultSmsSubscriptionId();
- }
- final Bundle mmsConfig = MmsConfigManager.getInstance().getMmsConfigBySubId(subId);
- if (mmsConfig == null) {
- return new Bundle();
- }
- return mmsConfig;
- }
-
- @Override
public Uri importTextMessage(String callingPkg, String address, int type, String text,
long timestampMillis, boolean seen, boolean read) {
LogUtil.d("importTextMessage");