From: Ajay Panicker Date: Wed, 3 Aug 2016 01:53:00 +0000 (-0700) Subject: Protect against SecurityException generated by query X-Git-Tag: android-7.1.2_r17~30^2~17 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3b00f32c411a7c5d352a6c427cf56a0429114b0c;p=android-x86%2Fpackages-apps-Bluetooth.git 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 b8cb641f..b9d2b9f2 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java +++ b/src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java @@ -117,7 +117,11 @@ public class BluetoothOppSendFileInfo { } 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 ab4613fe..bd671b21 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppUtility.java +++ b/src/com/android/bluetooth/opp/BluetoothOppUtility.java @@ -331,6 +331,9 @@ public class BluetoothOppUtility { 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); }