diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b3863a7ab..1aca47bd3 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -329,18 +329,11 @@
-
-
-
-
.
- */
-package org.thoughtcrime.securesms.providers;
-
-import android.content.ContentProvider;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.UriMatcher;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.ParcelFileDescriptor;
-import android.util.Log;
-
-import org.thoughtcrime.securesms.BuildConfig;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class MmsBodyProvider extends ContentProvider {
- private static final String TAG = MmsBodyProvider.class.getSimpleName();
- private static final String CONTENT_URI_STRING = "content://"+ BuildConfig.APPLICATION_ID+".provider.securesms.mms/mms";
- public static final Uri CONTENT_URI = Uri.parse(CONTENT_URI_STRING);
- private static final int SINGLE_ROW = 1;
-
- private static final UriMatcher uriMatcher;
-
- static {
- uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
- uriMatcher.addURI(BuildConfig.APPLICATION_ID+".provider.securesms.mms", "mms/#", SINGLE_ROW);
- }
-
- @Override
- public boolean onCreate() {
- return true;
- }
-
-
- private File getFile(Uri uri) {
- long id = Long.parseLong(uri.getPathSegments().get(1));
- return new File(getContext().getCacheDir(), id + ".mmsbody");
- }
-
- @Override
- public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
- Log.w(TAG, "openFile(" + uri + ", " + mode + ")");
-
- switch (uriMatcher.match(uri)) {
- case SINGLE_ROW:
- Log.w(TAG, "Fetching message body for a single row...");
- File tmpFile = getFile(uri);
-
- final int fileMode;
- switch (mode) {
- case "w": fileMode = ParcelFileDescriptor.MODE_TRUNCATE |
- ParcelFileDescriptor.MODE_CREATE |
- ParcelFileDescriptor.MODE_WRITE_ONLY; break;
- case "r": fileMode = ParcelFileDescriptor.MODE_READ_ONLY; break;
- default: throw new IllegalArgumentException("requested file mode unsupported");
- }
-
- Log.w(TAG, "returning file " + tmpFile.getAbsolutePath());
- return ParcelFileDescriptor.open(tmpFile, fileMode);
- }
-
- throw new FileNotFoundException("Request for bad message.");
- }
-
- @Override
- public int delete(Uri uri, String arg1, String[] arg2) {
- switch (uriMatcher.match(uri)) {
- case SINGLE_ROW:
- return getFile(uri).delete() ? 1 : 0;
- }
- return 0;
- }
-
- @Override
- public String getType(Uri arg0) {
- return null;
- }
-
- @Override
- public Uri insert(Uri arg0, ContentValues arg1) {
- return null;
- }
-
- @Override
- public Cursor query(Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4) {
- return null;
- }
-
- @Override
- public int update(Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
- return 0;
- }
- public static Pointer makeTemporaryPointer(Context context) {
- return new Pointer(context, ContentUris.withAppendedId(MmsBodyProvider.CONTENT_URI, System.currentTimeMillis()));
- }
-
- public static class Pointer {
- private final Context context;
- private final Uri uri;
-
- public Pointer(Context context, Uri uri) {
- this.context = context;
- this.uri = uri;
- }
-
- public Uri getUri() {
- return uri;
- }
-
- public OutputStream getOutputStream() throws FileNotFoundException {
- return context.getContentResolver().openOutputStream(uri, "w");
- }
-
- public InputStream getInputStream() throws FileNotFoundException {
- return context.getContentResolver().openInputStream(uri);
- }
-
- public void close() {
- context.getContentResolver().delete(uri, null, null);
- }
- }
-}