MMS auto persisting (2/4)
1. Added new MMS message box type for failed messages
2. Use global static flag to temporarily turn off new SMS API semantics
b/14095333
Change-Id: I150a08a4b26bba6f3a7a1d8f848fe07c8be9298b
diff --git a/src/java/android/provider/Telephony.java b/src/java/android/provider/Telephony.java
index 86affb7..3538849 100644
--- a/src/java/android/provider/Telephony.java
+++ b/src/java/android/provider/Telephony.java
@@ -107,6 +107,12 @@
private static final String TAG = "Telephony";
/**
+ * TODO(ywen): temoprary flag to turn off new SMS API semantics
+ * @hide
+ */
+ public static final boolean NEW_API = false;
+
+ /**
* Not instantiable.
* @hide
*/
@@ -1131,6 +1137,8 @@
public static final int MESSAGE_BOX_DRAFTS = 3;
/** Message box: outbox. */
public static final int MESSAGE_BOX_OUTBOX = 4;
+ /** Message box: failed. */
+ public static final int MESSAGE_BOX_FAILED = 5;
/**
* The thread ID of the message.
diff --git a/src/java/com/android/internal/telephony/InboundSmsHandler.java b/src/java/com/android/internal/telephony/InboundSmsHandler.java
index 00bc0cb..e6cc316 100644
--- a/src/java/com/android/internal/telephony/InboundSmsHandler.java
+++ b/src/java/com/android/internal/telephony/InboundSmsHandler.java
@@ -995,9 +995,8 @@
* @return The URI of written message
*/
private Uri writeInboxMessage(Intent intent) {
- if (!SystemProperties.getBoolean("telephony.sms.autopersist", false)) {
- // TODO(ywen): Temporarily only enable this with a system property
- // so not to break existing apps
+ if (!Telephony.NEW_API) {
+ // TODO(ywen): Temporarily only enable this with a flag so not to break existing apps
return null;
}
final SmsMessage[] messages = Telephony.Sms.Intents.getMessagesFromIntent(intent);
diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java
index 427fb72..4b26505 100644
--- a/src/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/SMSDispatcher.java
@@ -345,9 +345,8 @@
if (ar.exception == null) {
if (DBG) Rlog.d(TAG, "SMS send complete. Broadcasting intent: " + sentIntent);
- if (!SystemProperties.getBoolean("telephony.sms.autopersist", false)) {
- // TODO(ywen): Temporarily only disable this with a system property
- // so not to break existing apps
+ if (!Telephony.NEW_API) {
+ // TODO(ywen):Temporarily only enable this with a flag so not to break existing apps
if (SmsApplication.shouldWriteMessageForPackage(
tracker.mAppInfo.applicationInfo.packageName, mContext)) {
// Persist it into the SMS database as a sent message
@@ -1121,9 +1120,8 @@
* @param errorCode The error code
*/
private void updateMessageErrorCode(Context context, int errorCode) {
- if (!SystemProperties.getBoolean("telephony.sms.autopersist", false)) {
- // TODO(ywen): Temporarily only enable this with a system property
- // so not to break existing apps
+ if (!Telephony.NEW_API) {
+ // TODO(ywen):Temporarily only enable this with a flag so not to break existing apps
return;
}
if (mMessageUri == null) {
@@ -1149,9 +1147,8 @@
* @param messageType The final message type
*/
private void setMessageFinalState(Context context, int messageType) {
- if (!SystemProperties.getBoolean("telephony.sms.autopersist", false)) {
- // TODO(ywen): Temporarily only enable this with a system property
- // so not to break existing apps
+ if (!Telephony.NEW_API) {
+ // TODO(ywen):Temporarily only enable this with a flag so not to break existing apps
return;
}
if (mMessageUri == null) {
@@ -1414,9 +1411,8 @@
protected Uri writeOutboxMessage(long subId, String address, String text,
boolean requireDeliveryReport) {
- if (!SystemProperties.getBoolean("telephony.sms.autopersist", false)) {
- // TODO(ywen): Temporarily only enable this with a system property
- // so not to break existing apps
+ if (!Telephony.NEW_API) {
+ // TODO(ywen): Temporarily only enable this with a flag so not to break existing apps
return null;
}
final ContentValues values = new ContentValues(7);