|
|
@ -21,6 +21,7 @@ import android.net.ConnectivityManager;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.util.Log;
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.http.Header;
|
|
|
|
import org.apache.http.auth.AuthScope;
|
|
|
|
import org.apache.http.auth.AuthScope;
|
|
|
|
import org.apache.http.auth.UsernamePasswordCredentials;
|
|
|
|
import org.apache.http.auth.UsernamePasswordCredentials;
|
|
|
|
import org.apache.http.client.CredentialsProvider;
|
|
|
|
import org.apache.http.client.CredentialsProvider;
|
|
|
@ -33,6 +34,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
|
import org.apache.http.impl.client.LaxRedirectStrategy;
|
|
|
|
import org.apache.http.impl.client.LaxRedirectStrategy;
|
|
|
|
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
|
|
|
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
|
|
|
|
|
|
|
|
import org.apache.http.message.BasicHeader;
|
|
|
|
import org.thoughtcrime.securesms.database.ApnDatabase;
|
|
|
|
import org.thoughtcrime.securesms.database.ApnDatabase;
|
|
|
|
import org.thoughtcrime.securesms.util.TelephonyUtil;
|
|
|
|
import org.thoughtcrime.securesms.util.TelephonyUtil;
|
|
|
|
import org.thoughtcrime.securesms.util.Conversions;
|
|
|
|
import org.thoughtcrime.securesms.util.Conversions;
|
|
|
@ -45,6 +47,8 @@ import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.InetAddress;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
public abstract class MmsConnection {
|
|
|
|
public abstract class MmsConnection {
|
|
|
|
private static final String TAG = "MmsCommunication";
|
|
|
|
private static final String TAG = "MmsCommunication";
|
|
|
@ -168,6 +172,22 @@ public abstract class MmsConnection {
|
|
|
|
|
|
|
|
|
|
|
|
protected abstract HttpUriRequest constructRequest(boolean useProxy) throws IOException;
|
|
|
|
protected abstract HttpUriRequest constructRequest(boolean useProxy) throws IOException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected List<Header> getBaseHeaders() {
|
|
|
|
|
|
|
|
final String number = TelephonyUtil.getManager(context).getLine1Number();
|
|
|
|
|
|
|
|
return new LinkedList<Header>() {{
|
|
|
|
|
|
|
|
add(new BasicHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"));
|
|
|
|
|
|
|
|
add(new BasicHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml"));
|
|
|
|
|
|
|
|
add(new BasicHeader("Content-Type", "application/vnd.wap.mms-message"));
|
|
|
|
|
|
|
|
add(new BasicHeader("x-carrier-magic", "http://magic.google.com"));
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(number)) {
|
|
|
|
|
|
|
|
add(new BasicHeader("x-up-calling-line-id", number));
|
|
|
|
|
|
|
|
add(new BasicHeader("X-MDN", number));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static class Apn {
|
|
|
|
public static class Apn {
|
|
|
|
|
|
|
|
|
|
|
|
public static Apn EMPTY = new Apn("", "", "", "", "");
|
|
|
|
public static Apn EMPTY = new Apn("", "", "", "", "");
|
|
|
|