Strip out more unused logic from Settings

This commit is contained in:
Moez Bhatti
2018-01-13 18:51:36 -05:00
parent 29d06af0e5
commit 7ea2ee6310
9 changed files with 15 additions and 85 deletions
@@ -19,10 +19,8 @@ package com.android.mms.service_alt;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.provider.Telephony;
import android.util.Log;
import com.android.mms.transaction.NotificationTransaction;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu_alt.PduParser;
@@ -75,18 +73,11 @@ public class MmsRequestManager implements MmsRequest.RequestManager {
}
Uri msgUri;
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
}
// Store M-Retrieve.conf into Inbox
PduPersister persister = PduPersister.getPduPersister(context);
msgUri = persister.persist(retrieveConf, Telephony.Mms.Inbox.CONTENT_URI, true,
group, null);
true, null);
// Use local time instead of PDU time
ContentValues values = new ContentValues(2);
@@ -167,15 +167,8 @@ public class MmsMessageSender implements MessageSender {
readRec.setDate(System.currentTimeMillis() / 1000);
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
}
PduPersister.getPduPersister(context).persist(readRec, Mms.Outbox.CONTENT_URI, true,
group, null);
true, null);
context.startService(new Intent(context, TransactionService.class));
} catch (InvalidHeaderValueException e) {
Log.e(TAG, "Invalide header value", e);
@@ -111,16 +111,9 @@ public class NotificationTransaction extends Transaction implements Runnable {
try {
// Save the pdu. If we can start downloading the real pdu immediately, don't allow
// persist() to create a thread for the notificationInd because it causes UI jank.
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("group_message", true);
}
mUri = PduPersister.getPduPersister(context).persist(
ind, Inbox.CONTENT_URI, !allowAutoDownload(mContext),
group, null);
true, null);
} catch (MmsException e) {
Log.e(TAG, "Failed to save NotificationInd in constructor.", e);
throw new IllegalArgumentException();
@@ -194,7 +187,7 @@ public class NotificationTransaction extends Transaction implements Runnable {
// Save the received PDU (must be a M-RETRIEVE.CONF).
PduPersister p = PduPersister.getPduPersister(mContext);
Uri uri = p.persist(pdu, Inbox.CONTENT_URI, true,
com.klinker.android.send_message.Transaction.settings.getGroup(), null);
true, null);
// Use local time instead of PDU time
ContentValues values = new ContentValues(1);
@@ -111,16 +111,8 @@ public class PushReceiver extends BroadcastReceiver {
break;
}
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
}
Uri uri = p.persist(pdu, Uri.parse("content://mms/inbox"), true,
group, null);
true, null);
// Update thread ID for ReadOrigInd & DeliveryInd.
ContentValues values = new ContentValues(1);
values.put(Mms.THREAD_ID, threadId);
@@ -148,17 +140,9 @@ public class PushReceiver extends BroadcastReceiver {
// Save the pdu. If we can start downloading the real pdu immediately,
// don't allow persist() to create a thread for the notificationInd
// because it causes UI jank.
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
}
Uri uri = p.persist(pdu, Inbox.CONTENT_URI,
!NotificationTransaction.allowAutoDownload(mContext),
group,
true,
null);
String location = getContentLocation(mContext, uri);
@@ -16,21 +16,16 @@
package com.android.mms.transaction;
import java.io.IOException;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SqliteWrapper;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.provider.Telephony.Mms;
import android.provider.Telephony.Mms.Inbox;
import android.text.TextUtils;
import com.klinker.android.logger.Log;
import com.android.mms.logs.LogTag;
import com.android.mms.MmsConfig;
import com.android.mms.logs.LogTag;
import com.android.mms.util.DownloadManager;
import com.google.android.mms.MmsException;
import com.google.android.mms.pdu_alt.AcknowledgeInd;
@@ -40,8 +35,11 @@ import com.google.android.mms.pdu_alt.PduHeaders;
import com.google.android.mms.pdu_alt.PduParser;
import com.google.android.mms.pdu_alt.PduPersister;
import com.google.android.mms.pdu_alt.RetrieveConf;
import com.klinker.android.logger.Log;
import com.klinker.android.send_message.Utils;
import java.io.IOException;
/**
* The RetrieveTransaction is responsible for retrieving multimedia
* messages (M-Retrieve.conf) from the MMSC server. It:
@@ -154,18 +152,10 @@ public class RetrieveTransaction extends Transaction implements Runnable {
mTransactionState.setState(TransactionState.FAILED);
mTransactionState.setContentUri(mUri);
} else {
boolean group;
try {
group = com.klinker.android.send_message.Transaction.settings.getGroup();
} catch (Exception e) {
group = PreferenceManager.getDefaultSharedPreferences(mContext).getBoolean("group_message", true);
}
// Store M-Retrieve.conf into Inbox
PduPersister persister = PduPersister.getPduPersister(mContext);
msgUri = persister.persist(retrieveConf, Inbox.CONTENT_URI, true,
group, null);
true, null);
// Use local time instead of PDU time
ContentValues values = new ContentValues(2);