Skip to content

Commit 32190b5

Browse files
mcchou-crandi34
authored andcommitted
DO NOT MERGE Fix security vulnerabilities in permission of deleting MMS/SMS
This CL adds permission check to avoid unauthorized deletion of any MMS/SMS messages in BluetoothMapContentObserver.actionMessageSentDisconnected function. Bug: 22343270 Change-Id: I30254036309733be4d54db17a8ef17a571cd1c5a
1 parent 24dce60 commit 32190b5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/com/android/bluetooth/map/BluetoothMapContentObserver.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import org.xmlpull.v1.XmlSerializer;
3232

33+
import android.Manifest;
3334
import android.app.Activity;
3435
import android.app.PendingIntent;
3536
import android.content.BroadcastReceiver;
@@ -39,10 +40,13 @@
3940
import android.content.Context;
4041
import android.content.Intent;
4142
import android.content.IntentFilter;
43+
import android.content.pm.PackageManager;
4244
import android.database.ContentObserver;
4345
import android.database.Cursor;
4446
import android.net.Uri;
47+
import android.os.Binder;
4548
import android.os.Handler;
49+
import android.os.Process;
4650
import android.provider.BaseColumns;
4751
import android.provider.Telephony;
4852
import android.provider.Telephony.Mms;
@@ -1014,6 +1018,13 @@ public void onReceive(Context context, Intent intent) {
10141018

10151019
private void actionMessageSent(Context context, Intent intent,
10161020
PushMsgInfo msgInfo) {
1021+
/* Check permission for message deletion. */
1022+
if (context.checkCallingOrSelfPermission(android.Manifest.permission.WRITE_SMS)
1023+
!= PackageManager.PERMISSION_GRANTED) {
1024+
Log.w(TAG, "actionSmsSentDisconnected: Not allowed to delete SMS/MMS messages");
1025+
return;
1026+
}
1027+
10171028
int result = getResultCode();
10181029
boolean delete = false;
10191030

@@ -1064,8 +1075,7 @@ private void actionMessageSent(Context context, Intent intent,
10641075
}
10651076
}
10661077

1067-
private void actionMessageDelivery(Context context, Intent intent,
1068-
PushMsgInfo msgInfo) {
1078+
private void actionMessageDelivery(Context context, Intent intent, PushMsgInfo msgInfo) {
10691079
Uri messageUri = intent.getData();
10701080
byte[] pdu = intent.getByteArrayExtra("pdu");
10711081
String format = intent.getStringExtra("format");

0 commit comments

Comments
 (0)