Protect against SecurityException generated by query
Bug: 30444661
Change-Id: I1d93645f1d4475cf603cda8bb28df0b960ccb445
diff --git a/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java b/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
index b8cb641..b9d2b9f 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java
@@ -117,7 +117,11 @@
} catch (SQLiteException e) {
// some content providers don't support the DISPLAY_NAME or SIZE columns
metadataCursor = null;
+ } catch (SecurityException e) {
+ Log.e(TAG, "generateFileInfo: Permission error, could not access URI: " + uri);
+ return SEND_FILE_INFO_ERROR;
}
+
if (metadataCursor != null) {
try {
if (metadataCursor.moveToFirst()) {
diff --git a/src/com/android/bluetooth/opp/BluetoothOppUtility.java b/src/com/android/bluetooth/opp/BluetoothOppUtility.java
index ab4613f..bd671b2 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppUtility.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppUtility.java
@@ -331,6 +331,9 @@
static void putSendFileInfo(Uri uri, BluetoothOppSendFileInfo sendFileInfo) {
if (D) Log.d(TAG, "putSendFileInfo: uri=" + uri + " sendFileInfo=" + sendFileInfo);
+ if (sendFileInfo == BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR) {
+ Log.e(TAG, "putSendFileInfo: bad sendFileInfo, URI: " + uri);
+ }
sSendFileMap.put(uri, sendFileInfo);
}