|
30 | 30 |
|
31 | 31 | import org.xmlpull.v1.XmlSerializer;
|
32 | 32 |
|
| 33 | +import android.Manifest; |
33 | 34 | import android.app.Activity;
|
34 | 35 | import android.app.PendingIntent;
|
35 | 36 | import android.content.BroadcastReceiver;
|
|
39 | 40 | import android.content.Context;
|
40 | 41 | import android.content.Intent;
|
41 | 42 | import android.content.IntentFilter;
|
| 43 | +import android.content.pm.PackageManager; |
42 | 44 | import android.database.ContentObserver;
|
43 | 45 | import android.database.Cursor;
|
44 | 46 | import android.net.Uri;
|
| 47 | +import android.os.Binder; |
45 | 48 | import android.os.Handler;
|
| 49 | +import android.os.Process; |
46 | 50 | import android.provider.BaseColumns;
|
47 | 51 | import android.provider.Telephony;
|
48 | 52 | import android.provider.Telephony.Mms;
|
@@ -1014,6 +1018,13 @@ public void onReceive(Context context, Intent intent) {
|
1014 | 1018 |
|
1015 | 1019 | private void actionMessageSent(Context context, Intent intent,
|
1016 | 1020 | 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 | + |
1017 | 1028 | int result = getResultCode();
|
1018 | 1029 | boolean delete = false;
|
1019 | 1030 |
|
@@ -1064,8 +1075,7 @@ private void actionMessageSent(Context context, Intent intent,
|
1064 | 1075 | }
|
1065 | 1076 | }
|
1066 | 1077 |
|
1067 |
| - private void actionMessageDelivery(Context context, Intent intent, |
1068 |
| - PushMsgInfo msgInfo) { |
| 1078 | + private void actionMessageDelivery(Context context, Intent intent, PushMsgInfo msgInfo) { |
1069 | 1079 | Uri messageUri = intent.getData();
|
1070 | 1080 | byte[] pdu = intent.getByteArrayExtra("pdu");
|
1071 | 1081 | String format = intent.getStringExtra("format");
|
|
0 commit comments