Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f2d4954 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Remove obsolete checks for API 23

parent ce9ba1b9
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -551,9 +551,6 @@ public class MmsConfig {
            final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(
                    Context.TELEPHONY_SERVICE);

            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
                return telephonyManager.getLine1Number();
            } else {
            try {
                Method method = telephonyManager.getClass().getMethod("getLine1NumberForSubscriber", int.class);
                return (String) method.invoke(telephonyManager, subId);
@@ -561,7 +558,6 @@ public class MmsConfig {
                return telephonyManager.getLine1Number();
            }
        }
        }

        private static String getLine1NoCountryCode(Context context, int subId) {
            final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(
@@ -581,9 +577,6 @@ public class MmsConfig {

            String nai = "";

            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
                nai = SystemPropertiesProxy.get(context, "persist.radio.cdma.nai");
            } else {
            try {
                Method method = telephonyManager.getClass().getMethod("getNai", int.class);
                Method getSlotId = SubscriptionManager.class.getMethod("getSlotId", int.class);
@@ -591,7 +584,6 @@ public class MmsConfig {
            } catch (Exception e) {
                nai = SystemPropertiesProxy.get(context, "persist.radio.cdma.nai");
            }
            }

            Timber.v("MmsConfig.getNai: nai=" + nai);

+38 −45
Original line number Diff line number Diff line
@@ -73,12 +73,10 @@ public class MmsConfigManager {
    public void init(final Context context) {
        mContext = context;

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        mSubscriptionManager = SubscriptionManager.from(context);

        // TODO: When this object "finishes" we should unregister.
            IntentFilter intentFilterLoaded =
                    new IntentFilter("LOADED");
        IntentFilter intentFilterLoaded = new IntentFilter("LOADED");

        try {
            context.registerReceiver(mReceiver, intentFilterLoaded);
@@ -87,9 +85,6 @@ public class MmsConfigManager {
        }

        load(context);
        } else {
            load(context);
        }

        // TODO: When this object "finishes" we should unregister by invoking
        // SubscriptionManager.getInstance(mContext).unregister(mOnSubscriptionsChangedListener);
@@ -151,7 +146,6 @@ public class MmsConfigManager {
     *
     */
    private void load(Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        List<SubscriptionInfo> subs = mSubscriptionManager.getActiveSubscriptionInfoList();
        if (subs == null || subs.size() < 1) {
            Timber.e("MmsConfigManager.load -- empty getActiveSubInfoList");
@@ -185,6 +179,5 @@ public class MmsConfigManager {
            mSubIdConfigMap.putAll(newConfigMap);
        }
    }
    }

}
+5 −12
Original line number Diff line number Diff line
@@ -87,18 +87,11 @@ public class MmsNetworkManager implements com.squareup.okhttp.internal.Network {
        mSubId = subId;

        if (!MmsRequest.useWifi(context)) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
            mNetworkRequest = new NetworkRequest.Builder()
                    .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
                    .addCapability(NetworkCapabilities.NET_CAPABILITY_MMS)
                    .setNetworkSpecifier(Integer.toString(mSubId))
                    .build();
            } else {
                mNetworkRequest = new NetworkRequest.Builder()
                        .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
                        .addCapability(NetworkCapabilities.NET_CAPABILITY_MMS)
                        .build();
            }
        } else {
            mNetworkRequest = new NetworkRequest.Builder()
                    .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+4 −16
Original line number Diff line number Diff line
@@ -104,12 +104,8 @@ public abstract class MmsRequest {
    private boolean ensureMmsConfigLoaded() {
        if (mMmsConfig == null) {
            final MmsConfig config;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
            // Not yet retrieved from mms config manager. Try getting it.
            config = MmsConfigManager.getInstance().getMmsConfigBySubId(mSubId);
            } else {
                config = MmsConfigManager.getInstance().getMmsConfig();
            }

            if (config != null) {
                mMmsConfig = new MmsConfig.Overridden(config, mMmsConfigOverrides);
@@ -167,11 +163,7 @@ public abstract class MmsRequest {
            result = SmsManager.MMS_ERROR_IO_ERROR;
        } else if (!isDataNetworkAvailable(context, mSubId)) {
            Timber.e("MmsRequest: in airplane mode or mobile data disabled");
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
            result = SmsManager.MMS_ERROR_NO_DATA_NETWORK;
            } else {
                result = 8;
            }
        } else { // Execute
            long retryDelaySecs = 2;
            // Try multiple times of MMS HTTP request
@@ -268,11 +260,7 @@ public abstract class MmsRequest {
                fillIn.putExtra("uri", messageUri.toString());
            }
            if (result == SmsManager.MMS_ERROR_HTTP_FAILURE && httpStatusCode != 0) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
                fillIn.putExtra(SmsManager.EXTRA_MMS_HTTP_STATUS, httpStatusCode);
                } else {
                    fillIn.putExtra("android.telephony.extra.MMS_HTTP_STATUS", httpStatusCode);
                }
            }
            try {
                if (!succeeded) {
+13 −15
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ class SubscriptionIdChecker {

    // I met a device which does not have Telephony.Mms.SUBSCRIPTION_ID event if it's API Level is 22.
    private void check(Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
        Cursor c = null;
        try {
            c = SqliteWrapper.query(context, context.getContentResolver(),
@@ -33,7 +32,6 @@ class SubscriptionIdChecker {
            }
        }
    }
    }

    static synchronized SubscriptionIdChecker getInstance(Context context) {
        if (sInstance == null) {
Loading