Loading core/java/android/provider/Telephony.java +6 −4 Original line number Diff line number Diff line Loading @@ -1422,6 +1422,8 @@ public final class Telephony { */ public static final String _DATA = "_data"; public static final String TEXT = "text"; } public static final class Rate { Loading core/java/com/google/android/mms/pdu/PduPersister.java +62 −39 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; import android.net.Uri; import android.provider.Telephony; import android.provider.Telephony.Mms; import android.provider.Telephony.MmsSms; import android.provider.Telephony.Threads; Loading @@ -54,6 +55,8 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; import com.google.android.mms.pdu.EncodedStringValue; /** * This class is the high-level manager of PDU storage. */ Loading Loading @@ -159,6 +162,7 @@ public class PduPersister { Part.CONTENT_TYPE, Part.FILENAME, Part.NAME, Part.TEXT }; private static final int PART_COLUMN_ID = 0; Loading @@ -169,6 +173,7 @@ public class PduPersister { private static final int PART_COLUMN_CONTENT_TYPE = 5; private static final int PART_COLUMN_FILENAME = 6; private static final int PART_COLUMN_NAME = 7; private static final int PART_COLUMN_TEXT = 8; private static final HashMap<Uri, Integer> MESSAGE_BOX_MAP; // These map are used for convenience in persist() and load(). Loading Loading @@ -414,6 +419,15 @@ public class PduPersister { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = null; // Store simple string values directly in the database instead of an // external file. This makes the text searchable and retrieval slightly // faster. if ("text/plain".equals(type) || "application/smil".equals(type)) { String text = c.getString(PART_COLUMN_TEXT); byte [] blob = new EncodedStringValue(text).getTextString(); baos.write(blob, 0, blob.length); } else { try { is = mContentResolver.openInputStream(partURI); Loading @@ -436,6 +450,7 @@ public class PduPersister { } // Ignore } } } part.setData(baos.toByteArray()); } parts[partIdx++] = part; Loading Loading @@ -719,8 +734,15 @@ public class PduPersister { InputStream is = null; try { os = mContentResolver.openOutputStream(uri); byte[] data = part.getData(); if ("text/plain".equals(contentType) || "application/smil".equals(contentType)) { ContentValues cv = new ContentValues(); cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString()); if (mContentResolver.update(uri, cv, null, null) != 1) { throw new MmsException("unable to update " + uri.toString()); } } else { os = mContentResolver.openOutputStream(uri); if (data == null) { Uri dataUri = part.getDataUri(); if ((dataUri == null) || (dataUri == uri)) { Loading @@ -743,6 +765,7 @@ public class PduPersister { } os.write(data); } } } catch (FileNotFoundException e) { Log.e(TAG, "Failed to open Input/Output stream.", e); throw new MmsException(e); Loading Loading
core/java/android/provider/Telephony.java +6 −4 Original line number Diff line number Diff line Loading @@ -1422,6 +1422,8 @@ public final class Telephony { */ public static final String _DATA = "_data"; public static final String TEXT = "text"; } public static final class Rate { Loading
core/java/com/google/android/mms/pdu/PduPersister.java +62 −39 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; import android.net.Uri; import android.provider.Telephony; import android.provider.Telephony.Mms; import android.provider.Telephony.MmsSms; import android.provider.Telephony.Threads; Loading @@ -54,6 +55,8 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; import com.google.android.mms.pdu.EncodedStringValue; /** * This class is the high-level manager of PDU storage. */ Loading Loading @@ -159,6 +162,7 @@ public class PduPersister { Part.CONTENT_TYPE, Part.FILENAME, Part.NAME, Part.TEXT }; private static final int PART_COLUMN_ID = 0; Loading @@ -169,6 +173,7 @@ public class PduPersister { private static final int PART_COLUMN_CONTENT_TYPE = 5; private static final int PART_COLUMN_FILENAME = 6; private static final int PART_COLUMN_NAME = 7; private static final int PART_COLUMN_TEXT = 8; private static final HashMap<Uri, Integer> MESSAGE_BOX_MAP; // These map are used for convenience in persist() and load(). Loading Loading @@ -414,6 +419,15 @@ public class PduPersister { ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream is = null; // Store simple string values directly in the database instead of an // external file. This makes the text searchable and retrieval slightly // faster. if ("text/plain".equals(type) || "application/smil".equals(type)) { String text = c.getString(PART_COLUMN_TEXT); byte [] blob = new EncodedStringValue(text).getTextString(); baos.write(blob, 0, blob.length); } else { try { is = mContentResolver.openInputStream(partURI); Loading @@ -436,6 +450,7 @@ public class PduPersister { } // Ignore } } } part.setData(baos.toByteArray()); } parts[partIdx++] = part; Loading Loading @@ -719,8 +734,15 @@ public class PduPersister { InputStream is = null; try { os = mContentResolver.openOutputStream(uri); byte[] data = part.getData(); if ("text/plain".equals(contentType) || "application/smil".equals(contentType)) { ContentValues cv = new ContentValues(); cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString()); if (mContentResolver.update(uri, cv, null, null) != 1) { throw new MmsException("unable to update " + uri.toString()); } } else { os = mContentResolver.openOutputStream(uri); if (data == null) { Uri dataUri = part.getDataUri(); if ((dataUri == null) || (dataUri == uri)) { Loading @@ -743,6 +765,7 @@ public class PduPersister { } os.write(data); } } } catch (FileNotFoundException e) { Log.e(TAG, "Failed to open Input/Output stream.", e); throw new MmsException(e); Loading