Hide APN prefs if platform APIs are used am: 95ceb12cdb am: 78df54ed76 am: 9d2baa4eba
Change-Id: Ic5f1b270b6d667bd281cc9f2db44d3de081cb8e8
This commit is contained in:
@@ -135,13 +135,13 @@ public class MmsManager {
|
|||||||
*/
|
*/
|
||||||
public static void sendMultimediaMessage(int subId, Context context, Uri contentUri,
|
public static void sendMultimediaMessage(int subId, Context context, Uri contentUri,
|
||||||
String locationUrl, PendingIntent sentIntent) {
|
String locationUrl, PendingIntent sentIntent) {
|
||||||
if (Utils.hasMmsApi() && !sForceLegacyMms) {
|
if (shouldUseLegacyMms()) {
|
||||||
|
MmsService.startRequest(context, new SendRequest(locationUrl, contentUri, sentIntent));
|
||||||
|
} else {
|
||||||
subId = Utils.getEffectiveSubscriptionId(subId);
|
subId = Utils.getEffectiveSubscriptionId(subId);
|
||||||
final SmsManager smsManager = Utils.getSmsManager(subId);
|
final SmsManager smsManager = Utils.getSmsManager(subId);
|
||||||
smsManager.sendMultimediaMessage(context, contentUri, locationUrl,
|
smsManager.sendMultimediaMessage(context, contentUri, locationUrl,
|
||||||
getConfigOverrides(subId), sentIntent);
|
getConfigOverrides(subId), sentIntent);
|
||||||
} else {
|
|
||||||
MmsService.startRequest(context, new SendRequest(locationUrl, contentUri, sentIntent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,17 +157,26 @@ public class MmsManager {
|
|||||||
*/
|
*/
|
||||||
public static void downloadMultimediaMessage(int subId, Context context, String locationUrl,
|
public static void downloadMultimediaMessage(int subId, Context context, String locationUrl,
|
||||||
Uri contentUri, PendingIntent downloadedIntent) {
|
Uri contentUri, PendingIntent downloadedIntent) {
|
||||||
if (Utils.hasMmsApi() && !sForceLegacyMms) {
|
if (shouldUseLegacyMms()) {
|
||||||
|
MmsService.startRequest(context,
|
||||||
|
new DownloadRequest(locationUrl, contentUri, downloadedIntent));
|
||||||
|
} else {
|
||||||
subId = Utils.getEffectiveSubscriptionId(subId);
|
subId = Utils.getEffectiveSubscriptionId(subId);
|
||||||
final SmsManager smsManager = Utils.getSmsManager(subId);
|
final SmsManager smsManager = Utils.getSmsManager(subId);
|
||||||
smsManager.downloadMultimediaMessage(context, locationUrl, contentUri,
|
smsManager.downloadMultimediaMessage(context, locationUrl, contentUri,
|
||||||
getConfigOverrides(subId), downloadedIntent);
|
getConfigOverrides(subId), downloadedIntent);
|
||||||
} else {
|
|
||||||
MmsService.startRequest(context,
|
|
||||||
new DownloadRequest(locationUrl, contentUri, downloadedIntent));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if we should use legacy APIs for MMS.
|
||||||
|
*
|
||||||
|
* @return true if forced to use legacy APIs or platform doesn't supports MMS APIs.
|
||||||
|
*/
|
||||||
|
public static boolean shouldUseLegacyMms() {
|
||||||
|
return sForceLegacyMms || !Utils.hasMmsApi();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get carrier configuration values overrides when platform MMS API is called.
|
* Get carrier configuration values overrides when platform MMS API is called.
|
||||||
* We only need to compute this if customized carrier config values loader or
|
* We only need to compute this if customized carrier config values loader or
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ import android.preference.Preference.OnPreferenceClickListener;
|
|||||||
import android.preference.PreferenceCategory;
|
import android.preference.PreferenceCategory;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import androidx.core.app.NavUtils;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
import androidx.appcompat.mms.MmsManager;
|
||||||
|
import androidx.core.app.NavUtils;
|
||||||
|
|
||||||
import com.android.messaging.Factory;
|
import com.android.messaging.Factory;
|
||||||
import com.android.messaging.R;
|
import com.android.messaging.R;
|
||||||
import com.android.messaging.datamodel.ParticipantRefresh;
|
import com.android.messaging.datamodel.ParticipantRefresh;
|
||||||
@@ -159,17 +161,18 @@ public class PerSubscriptionSettingsActivity extends BugleActionBarActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Access Point Names (APNs)
|
// Access Point Names (APNs)
|
||||||
final Preference apnsPref = findPreference(getString(R.string.sms_apns_key));
|
final PreferenceScreen apnsScreen =
|
||||||
|
(PreferenceScreen) findPreference(getString(R.string.sms_apns_key));
|
||||||
|
|
||||||
if (MmsUtils.useSystemApnTable() && !ApnDatabase.doesDatabaseExist()) {
|
if (!MmsManager.shouldUseLegacyMms()
|
||||||
// Don't remove the ability to edit the local APN prefs if this device lets us
|
|| (MmsUtils.useSystemApnTable() && !ApnDatabase.doesDatabaseExist())) {
|
||||||
|
// 1) Remove the ability to edit the local APN prefs if it doesn't use legacy APIs.
|
||||||
|
// 2) Don't remove the ability to edit the local APN prefs if this device lets us
|
||||||
// access the system APN, but we can't find the MCC/MNC in the APN table and we
|
// access the system APN, but we can't find the MCC/MNC in the APN table and we
|
||||||
// created the local APN table in case the MCC/MNC was in there. In other words,
|
// created the local APN table in case the MCC/MNC was in there. In other words,
|
||||||
// if the local APN table exists, let the user edit it.
|
// if the local APN table exists, let the user edit it.
|
||||||
advancedCategory.removePreference(apnsPref);
|
advancedCategory.removePreference((Preference) apnsScreen);
|
||||||
} else {
|
} else {
|
||||||
final PreferenceScreen apnsScreen = (PreferenceScreen) findPreference(
|
|
||||||
getString(R.string.sms_apns_key));
|
|
||||||
apnsScreen.setIntent(UIIntents.get()
|
apnsScreen.setIntent(UIIntents.get()
|
||||||
.getApnSettingsIntent(getPreferenceScreen().getContext(), mSubId));
|
.getApnSettingsIntent(getPreferenceScreen().getContext(), mSubId));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user