Strip out unused logic in android-smsmms

This commit is contained in:
Moez Bhatti
2018-01-13 18:45:26 -05:00
parent a6d5aa54a5
commit 29d06af0e5
9 changed files with 36 additions and 278 deletions
@@ -36,7 +36,6 @@ public class Settings {
private String uaProfUrl;
private String uaProfTagName;
private boolean group;
private boolean useSystemSending;
// SMS options
private boolean deliveryReports;
@@ -114,7 +113,6 @@ public class Settings {
this.preText = preText;
this.sendLongAsMms = sendLongAsMms;
this.sendLongAsMmsAfter = sendLongAsMmsAfter;
setUseSystemSending(useSystemSending);
this.subscriptionId = subscriptionId != null ? subscriptionId : DEFAULT_SUBSCRIPTION_ID;
}
@@ -248,18 +246,6 @@ public class Settings {
this.sendLongAsMmsAfter = sendLongAsMmsAfter;
}
/**
* @param useSystemSending whether or not to use the system sending method on Lollipop+ devices
*/
public void setUseSystemSending(boolean useSystemSending) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
this.useSystemSending = useSystemSending;
} else {
this.useSystemSending = false;
Log.e("Settings", "System sending only available on Lollipop+ devices");
}
}
/**
* Set the subscription ID that should be used for sending. It isn't applied to receiving at this time.
*
@@ -373,13 +359,6 @@ public class Settings {
return this.sendLongAsMmsAfter;
}
/**
* @return whether or not to use the system sending method on Lollipop+ devices
*/
public boolean getUseSystemSending() {
return useSystemSending;
}
/**
* @return the subscription ID or the default if one isn't set.
*/
@@ -33,9 +33,6 @@ import android.text.TextUtils;
import android.widget.Toast;
import com.android.mms.MmsConfig;
import com.android.mms.dom.smil.parser.SmilXmlSerializer;
import com.android.mms.service_alt.MmsNetworkManager;
import com.android.mms.service_alt.MmsRequestManager;
import com.android.mms.service_alt.SendRequest;
import com.android.mms.util.DownloadManager;
import com.android.mms.util.RateController;
import com.google.android.mms.ContentType;
@@ -393,23 +390,8 @@ public class Transaction {
}
Log.v(TAG, "using lollipop method for sending sms");
if (settings.getUseSystemSending()) {
Log.v(TAG, "using system method for sending");
sendMmsThroughSystem(context, subject, data, addresses, explicitSentMmsReceiver);
} else {
try {
MessageInfo info = getBytes(context, saveMessage, address.toString().split(" "),
data.toArray(new MMSPart[data.size()]), subject);
MmsRequestManager requestManager = new MmsRequestManager(context, info.bytes);
SendRequest request = new SendRequest(requestManager, Utils.getDefaultSubscriptionId(),
info.location, null, null, null, null);
MmsNetworkManager manager = new MmsNetworkManager(context, Utils.getDefaultSubscriptionId());
request.execute(context, manager);
} catch (Exception e) {
Log.e(TAG, "error sending mms", e);
}
}
Log.v(TAG, "using system method for sending");
sendMmsThroughSystem(context, subject, data, addresses, explicitSentMmsReceiver);
}
public static MessageInfo getBytes(Context context, boolean saveMessage, String[] recipients,
@@ -64,11 +64,8 @@ public class Utils {
public static <T> T ensureRouteToMmsNetwork(Context context, String url, String proxy, Task<T> task) throws IOException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return ensureRouteToMmsNetworkMarshmallow(context, task);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return ensureRouteToMmsNetworkLollipop(context, task);
} else {
ensureRouteToHost(context, url, proxy);
return task.run();
return ensureRouteToMmsNetworkLollipop(context, task);
}
}