summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Taylor <tomtaylor@google.com>2014-11-04 14:38:24 -0800
committerTom Taylor <tomtaylor@google.com>2014-11-04 14:38:24 -0800
commit3abe169b6236d57fd9e053d4329045acdf9c245b (patch)
tree7203ed4013d257c0a812398a79c4803f0b5670cf
parent04f04351c58b767a152f4aac617a3e7ebb1f5e4e (diff)
downloadMms-3abe169b6236d57fd9e053d4329045acdf9c245b.tar.gz
Don't do anything when the Messaging app isn't the default sms app
Bug 7466009 The messaging app has a number of services. In the past, there have been ways to "trick" these services into sending a message, even though the app isn't the default SMS app. Only the SmsReceiverService was protected with an isSmsEnabled check. This CL adds the check to the other potential message sending services. Change-Id: I896e076d3612b73d7754b22dcbbd31ba98e8944f
-rw-r--r--src/com/android/mms/transaction/MessageStatusService.java6
-rw-r--r--src/com/android/mms/transaction/SmsReceiverService.java4
-rw-r--r--src/com/android/mms/transaction/TransactionService.java7
-rw-r--r--src/com/android/mms/ui/NoConfirmationSendService.java6
4 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/mms/transaction/MessageStatusService.java b/src/com/android/mms/transaction/MessageStatusService.java
index d69a8dce..c7253395 100644
--- a/src/com/android/mms/transaction/MessageStatusService.java
+++ b/src/com/android/mms/transaction/MessageStatusService.java
@@ -17,6 +17,7 @@
package com.android.mms.transaction;
import android.app.IntentService;
+import android.app.Service;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
@@ -30,6 +31,7 @@ import android.telephony.SmsMessage;
import android.util.Log;
import com.android.mms.LogTag;
+import com.android.mms.MmsConfig;
/**
* Service that gets started by the MessageStatusReceiver when a message status report is
@@ -50,6 +52,10 @@ public class MessageStatusService extends IntentService {
@Override
protected void onHandleIntent(Intent intent) {
+ if (!MmsConfig.isSmsEnabled()) {
+ Log.d(LOG_TAG, "MessageStatusService: is not the default sms app");
+ return;
+ }
// This method is called on a worker thread.
Uri messageUri = intent.getData();
diff --git a/src/com/android/mms/transaction/SmsReceiverService.java b/src/com/android/mms/transaction/SmsReceiverService.java
index 0f6c11b2..6e1edf08 100644
--- a/src/com/android/mms/transaction/SmsReceiverService.java
+++ b/src/com/android/mms/transaction/SmsReceiverService.java
@@ -134,6 +134,10 @@ public class SmsReceiverService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
+ if (!MmsConfig.isSmsEnabled()) {
+ Log.d(TAG, "SmsReceiverService: is not the default sms app");
+ return Service.START_NOT_STICKY;
+ }
// Temporarily removed for this duplicate message track down.
mResultCode = intent != null ? intent.getIntExtra("result", 0) : 0;
diff --git a/src/com/android/mms/transaction/TransactionService.java b/src/com/android/mms/transaction/TransactionService.java
index 4eac8480..b07d984c 100644
--- a/src/com/android/mms/transaction/TransactionService.java
+++ b/src/com/android/mms/transaction/TransactionService.java
@@ -53,9 +53,11 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.mms.LogTag;
import com.android.mms.MmsConfig;
import com.android.mms.R;
+import com.android.mms.ui.ComposeMessageActivity;
import com.android.mms.util.DownloadManager;
import com.android.mms.util.RateController;
import com.android.mms.util.SubStatusResolver;
+
import com.google.android.mms.pdu.GenericPdu;
import com.google.android.mms.pdu.NotificationInd;
import com.google.android.mms.pdu.PduHeaders;
@@ -205,6 +207,11 @@ public class TransactionService extends Service implements Observer {
}
public void onNewIntent(Intent intent, int serviceId) {
+ if (!MmsConfig.isSmsEnabled()) {
+ Log.d(TAG, "TransactionService: is not the default sms app");
+ stopSelf(serviceId);
+ return;
+ }
mConnMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (mConnMgr == null || !SubStatusResolver.isMobileDataEnabledOnAnySub(getApplicationContext())
|| !MmsConfig.isSmsEnabled()) {
diff --git a/src/com/android/mms/ui/NoConfirmationSendService.java b/src/com/android/mms/ui/NoConfirmationSendService.java
index e9e65b34..8c752c42 100644
--- a/src/com/android/mms/ui/NoConfirmationSendService.java
+++ b/src/com/android/mms/ui/NoConfirmationSendService.java
@@ -27,6 +27,7 @@ import android.util.Log;
import com.android.internal.telephony.PhoneConstants;
import com.android.mms.LogTag;
+import com.android.mms.MmsConfig;
import com.android.mms.data.Conversation;
import com.android.mms.transaction.SmsMessageSender;
@@ -48,6 +49,11 @@ public class NoConfirmationSendService extends IntentService {
protected void onHandleIntent(Intent intent) {
ComposeMessageActivity.log("NoConfirmationSendService onHandleIntent");
+ if (!MmsConfig.isSmsEnabled()) {
+ ComposeMessageActivity.log("NoConfirmationSendService is not the default sms app");
+ return;
+ }
+
String action = intent.getAction();
if (!TelephonyManager.ACTION_RESPOND_VIA_MESSAGE.equals(action)) {
ComposeMessageActivity.log("NoConfirmationSendService onHandleIntent wrong action: " +