From 2758fba3d05d2a0fb0631e85f7d2434b647cb39f Mon Sep 17 00:00:00 2001 From: Aniket Kumar Date: Wed, 5 Aug 2020 15:14:30 +0530 Subject: [PATCH] Removed APN settings from user preferences completely and replaced Klinker's get APN settings method with TelephonyHelper's getPreferredApn method. --- res/values/strings.xml | 9 ------ res/xml/smsplugin_preferences.xml | 22 -------------- .../DelegatingMmsReceivedReceiver.java | 2 +- .../SMSPlugin/MmsReceivedReceiver.java | 29 +++++++++---------- .../Plugins/SMSPlugin/SmsMmsUtils.java | 16 +++++----- .../UserInterface/DeviceFragment.java | 22 ++++++++++++-- 6 files changed, 42 insertions(+), 58 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 66baf019..7b54d361 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -381,15 +381,6 @@ set_long_text_as_mms Convert to MMS convert_to_mms_after - Set MMSC - MMSC - sms_pref_set_mmsc - Set MMS proxy - MMS proxy - sms_pref_set_mms_proxy - Set MMS port - MMS port - sms_pref_set_mms_port 3 After one message diff --git a/res/xml/smsplugin_preferences.xml b/res/xml/smsplugin_preferences.xml index 77fb5ce9..315a90e7 100644 --- a/res/xml/smsplugin_preferences.xml +++ b/res/xml/smsplugin_preferences.xml @@ -1,32 +1,10 @@ - - - - - - = Build.VERSION_CODES.LOLLIPOP_MR1) { + List subIds = TelephonyHelper.getActiveSubscriptionIDs(mActivity); + for (final int subId : subIds) { + if (TelephonyHelper.getPreferredApn(mActivity, subId) != null) { + hasApnSettings = true; + break; + } + } + } else { + if (TelephonyHelper.getPreferredApn(mActivity, 0) != null) { + hasApnSettings = true; + } + } + for (Plugin p : plugins) { - if (p.getPluginKey().equals("SMSPlugin")) { + if (p.getPluginKey().equals("SMSPlugin") && hasApnSettings) { pluginListItems.add(new SetDefaultAppPluginListItem(p, mActivity.getResources().getString(R.string.pref_plugin_telepathy_mms), (action) -> { DialogFragment dialog = new DefaultSmsAppAlertDialogFragment.Builder() .setTitle(R.string.set_default_sms_app_title)