From 6a046b44e2fe07d23df263c5dfa69968821978e5 Mon Sep 17 00:00:00 2001 From: Seven Shen Date: Tue, 3 May 2016 14:57:48 -0700 Subject: [PATCH] "DO NOT MERGE" Add write SMS protection Ticket: CYNGNOS-2707 Bug: 25138326 Change-Id: I9f418370b8725d49e3734406b6f435107bcff021 (cherry picked from commit 64745b114948ea0c774f74af5721b6283087247d) --- src/com/android/bluetooth/map/BluetoothMapService.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/android/bluetooth/map/BluetoothMapService.java b/src/com/android/bluetooth/map/BluetoothMapService.java index 003687658..3a6690431 100755 --- a/src/com/android/bluetooth/map/BluetoothMapService.java +++ b/src/com/android/bluetooth/map/BluetoothMapService.java @@ -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; @@ -625,7 +626,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); @@ -1113,8 +1117,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 + try { + BluetoothMapContentObserver .actionMessageSentDisconnected(context, intent, result); + } catch(IllegalArgumentException e) { + return; + } } } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) && mIsWaitingAuthorization) { -- cgit v1.2.3