Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ecd1de05 authored by Ajay Panicker's avatar Ajay Panicker
Browse files

"DO NOT MERGE" Add write SMS protection

Bug: 25138326
Change-Id: I494db57e9291fac108e2abae85db367992ad81a1
parent 0d486b76
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter.MalformedMimeTypeException;
import android.Manifest;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
@@ -553,7 +554,10 @@ public class BluetoothMapService extends ProfileService {

        try {
            registerReceiver(mMapReceiver, filter);
            registerReceiver(mMapReceiver, filterMessageSent);
            // We need WRITE_SMS permission to handle messages in
            // actionMessageSentDisconnected()
            registerReceiver(mMapReceiver, filterMessageSent,
                             Manifest.permission.WRITE_SMS, null);
        } catch (Exception e) {
            Log.w(TAG,"Unable to register map receiver",e);
        }
@@ -952,7 +956,12 @@ public class BluetoothMapService extends ProfileService {
                {
                    /* We do not have a connection to a device, hence we need to move
                       the SMS to the correct folder. */
                    BluetoothMapContentObserver.actionMessageSentDisconnected(context, intent, result);
                    try {
                        BluetoothMapContentObserver
                            .actionMessageSentDisconnected(context, intent, result);
                    } catch(IllegalArgumentException e) {
                        return;
                    }
                }
            } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) &&
                    mIsWaitingAuthorization) {