Refactor MMS send/download to be synchronous.

1) Make the radio change a synchronous action with a timeout.

2) Move the send logic into an MmsTransport, in preparation for
   UniversalTransport composition.

3) Move the download logic into a synchronous receiver.
This commit is contained in:
Moxie Marlinspike
2013-07-16 19:52:02 -07:00
parent 53803630d4
commit fd045f2354
14 changed files with 476 additions and 532 deletions

View File

@@ -25,6 +25,8 @@ import android.widget.EditText;
import android.os.Build;
import android.provider.Telephony;
import org.thoughtcrime.securesms.mms.MmsRadio;
import java.io.UnsupportedEncodingException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
@@ -134,6 +136,14 @@ public class Util {
}
}
public static void wait(Object lock, int timeout) {
try {
lock.wait(timeout);
} catch (InterruptedException ie) {
throw new AssertionError(ie);
}
}
public static boolean isDefaultSmsProvider(Context context){
return (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) ||