summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeven Shen <lingtongshen@gmail.com>2016-04-06 12:25:17 -0700
committerThe Android Automerger <android-build@google.com>2016-04-21 19:11:23 -0700
commita283d524475da1b9ce9013eb2c8709bc7bd9dcfc (patch)
tree7bc435c518d99edd42df2577958fad8e96f9ca67
parent674c089aca0f38382ab7e2eb84d85292a2790125 (diff)
downloadandroid_packages_apps_Bluetooth-a283d524475da1b9ce9013eb2c8709bc7bd9dcfc.tar.gz
android_packages_apps_Bluetooth-a283d524475da1b9ce9013eb2c8709bc7bd9dcfc.tar.bz2
android_packages_apps_Bluetooth-a283d524475da1b9ce9013eb2c8709bc7bd9dcfc.zip
"DO NOT MERGE" Add write SMS protection
Bug: 25138326 Change-Id: I9f418370b8725d49e3734406b6f435107bcff021
-rwxr-xr-xsrc/com/android/bluetooth/map/BluetoothMapService.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapService.java b/src/com/android/bluetooth/map/BluetoothMapService.java
index 04d704355..f696bfaab 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.Message;
import android.os.ParcelUuid;
@@ -560,7 +561,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);
}
@@ -1012,8 +1016,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) {