Search in sources :

Example 6 with MmsConfig

use of com.android.mms.service_alt.MmsConfig in project Signal-Android by WhisperSystems.

the class MmsConfigManager method loadMmsConfig.

@NonNull
private static MmsConfig loadMmsConfig(Context context, int subscriptionId) {
    Optional<SubscriptionInfoCompat> subscriptionInfo = new SubscriptionManagerCompat(context).getActiveSubscriptionInfo(subscriptionId);
    if (subscriptionInfo.isPresent()) {
        SubscriptionInfoCompat subscriptionInfoCompat = subscriptionInfo.get();
        Configuration configuration = context.getResources().getConfiguration();
        configuration.mcc = subscriptionInfoCompat.getMcc();
        configuration.mnc = subscriptionInfoCompat.getMnc();
        Context subContext = context.createConfigurationContext(configuration);
        return new MmsConfig(subContext, subscriptionId);
    }
    return new MmsConfig(context, subscriptionId);
}
Also used : Context(android.content.Context) SubscriptionManagerCompat(org.thoughtcrime.securesms.util.dualsim.SubscriptionManagerCompat) MmsConfig(com.android.mms.service_alt.MmsConfig) Configuration(android.content.res.Configuration) SubscriptionInfoCompat(org.thoughtcrime.securesms.util.dualsim.SubscriptionInfoCompat) NonNull(androidx.annotation.NonNull)

Example 7 with MmsConfig

use of com.android.mms.service_alt.MmsConfig in project Signal-Android by WhisperSystems.

the class MmsConfigManager method getMmsConfig.

@WorkerThread
@NonNull
static synchronized MmsConfig getMmsConfig(Context context, int subscriptionId) {
    MmsConfig mmsConfig = mmsConfigMap.get(subscriptionId);
    if (mmsConfig != null) {
        return mmsConfig;
    }
    MmsConfig loadedConfig = loadMmsConfig(context, subscriptionId);
    mmsConfigMap.put(subscriptionId, loadedConfig);
    return loadedConfig;
}
Also used : MmsConfig(com.android.mms.service_alt.MmsConfig) WorkerThread(androidx.annotation.WorkerThread) NonNull(androidx.annotation.NonNull)

Example 8 with MmsConfig

use of com.android.mms.service_alt.MmsConfig in project Signal-Android by signalapp.

the class MmsConfigManager method getMmsConfig.

@WorkerThread
@NonNull
static synchronized MmsConfig getMmsConfig(Context context, int subscriptionId) {
    MmsConfig mmsConfig = mmsConfigMap.get(subscriptionId);
    if (mmsConfig != null) {
        return mmsConfig;
    }
    MmsConfig loadedConfig = loadMmsConfig(context, subscriptionId);
    mmsConfigMap.put(subscriptionId, loadedConfig);
    return loadedConfig;
}
Also used : MmsConfig(com.android.mms.service_alt.MmsConfig) WorkerThread(androidx.annotation.WorkerThread) NonNull(androidx.annotation.NonNull)

Aggregations

MmsConfig (com.android.mms.service_alt.MmsConfig)8 NonNull (androidx.annotation.NonNull)4 PduParser (com.google.android.mms.pdu_alt.PduParser)3 IOException (java.io.IOException)3 TargetApi (android.annotation.TargetApi)2 Context (android.content.Context)2 Configuration (android.content.res.Configuration)2 Bundle (android.os.Bundle)2 SmsManager (android.telephony.SmsManager)2 Nullable (androidx.annotation.Nullable)2 WorkerThread (androidx.annotation.WorkerThread)2 SendConf (com.google.android.mms.pdu_alt.SendConf)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 TimeoutException (java.util.concurrent.TimeoutException)2 MmsBodyProvider (org.thoughtcrime.securesms.providers.MmsBodyProvider)2 UndeliverableMessageException (org.thoughtcrime.securesms.transport.UndeliverableMessageException)2 SubscriptionInfoCompat (org.thoughtcrime.securesms.util.dualsim.SubscriptionInfoCompat)2 SubscriptionManagerCompat (org.thoughtcrime.securesms.util.dualsim.SubscriptionManagerCompat)2 Uri (android.net.Uri)1 TransactionSettings (com.android.mms.transaction.TransactionSettings)1