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

Commit 7be2d6b1 authored by Seven Shen's avatar Seven Shen Committed by Ajay Panicker
Browse files

"DO NOT MERGE" Add write SMS protection

Bug: 25138326
Change-Id: I9f418370b8725d49e3734406b6f435107bcff021
parent c720f9d8
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException;
import android.Manifest;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
@@ -618,7 +619,10 @@ public class BluetoothMapService extends ProfileService {
        if (!mRegisteredMapReceiver) {
            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);
                mRegisteredMapReceiver = true;
            } catch (Exception e) {
                Log.e(TAG,"Unable to register map receiver",e);
@@ -1110,8 +1114,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. */
                    try {
                        BluetoothMapContentObserver
                            .actionMessageSentDisconnected(context, intent, result);
                    } catch(IllegalArgumentException e) {
                        return;
                    }
                }
            } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) &&
                    mIsWaitingAuthorization) {