Loading src/com/android/bluetooth/opp/BluetoothOppNotification.java +33 −4 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.util.Log; import android.os.Handler; Loading Loading @@ -161,6 +162,7 @@ class BluetoothOppNotification { mUpdateCompleteNotification = true; updateCompletedNotification(); updateIncomingFileConfirmNotification(); mHandler.removeMessages(NOTIFY); } } Loading Loading @@ -220,8 +222,16 @@ class BluetoothOppNotification { private void updateActiveNotification() { // Active transfers Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_RUNNING, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -378,8 +388,15 @@ class BluetoothOppNotification { } // Creating outbound notification Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_COMPLETED_OUTBOUND, null, BluetoothShare.TIMESTAMP + " DESC"); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -428,8 +445,14 @@ class BluetoothOppNotification { } // Creating inbound notification try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_COMPLETED_INBOUND, null, BluetoothShare.TIMESTAMP + " DESC"); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -476,8 +499,14 @@ class BluetoothOppNotification { } private void updateIncomingFileConfirmNotification() { Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_CONFIRM_PENDING, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfo.java +10 −2 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.os.Environment; import android.os.StatFs; Loading Loading @@ -95,9 +96,16 @@ public class BluetoothOppReceiveFileInfo { Uri contentUri = Uri.parse(BluetoothShare.CONTENT_URI + "/" + id); String filename = null, hint = null, mimeType = null; long length = 0; Cursor metadataCursor = contentResolver.query(contentUri, new String[] { Cursor metadataCursor; try { metadataCursor = contentResolver.query(contentUri, new String[] { BluetoothShare.FILENAME_HINT, BluetoothShare.TOTAL_BYTES, BluetoothShare.MIMETYPE }, null, null, null); } catch (SQLiteException e) { metadataCursor = null; Log.e(Constants.TAG, "SQLite exception: " + e); } if (metadataCursor != null) { try { if (metadataCursor.moveToFirst()) { Loading src/com/android/bluetooth/opp/BluetoothOppReceiver.java +9 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.util.Log; import android.widget.Toast; Loading Loading @@ -199,8 +200,15 @@ public class BluetoothOppReceiver extends BroadcastReceiver { context.startActivity(in); } else if (action.equals(Constants.ACTION_HIDE)) { if (V) Log.v(TAG, "Receiver hide for " + intent.getData()); Cursor cursor = context.getContentResolver().query(intent.getData(), null, null, null, Cursor cursor; try { cursor = context.getContentResolver().query(intent.getData(), null, null, null, null); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor != null) { if (cursor.moveToFirst()) { int statusColumn = cursor.getColumnIndexOrThrow(BluetoothShare.STATUS); Loading src/com/android/bluetooth/opp/BluetoothOppService.java +26 −7 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.IntentFilter; import android.database.CharArrayBuffer; import android.database.ContentObserver; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; Loading Loading @@ -436,8 +437,14 @@ public class BluetoothOppService extends Service { } mPendingUpdate = false; } Cursor cursor = getContentResolver().query(BluetoothShare.CONTENT_URI, null, null, Cursor cursor; try { cursor = getContentResolver().query(BluetoothShare.CONTENT_URI, null, null, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading Loading @@ -935,9 +942,15 @@ public class BluetoothOppService extends Service { + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.STATUS + "=" + BluetoothShare.STATUS_RUNNING; Cursor cursorToFile = contentResolver.query(BluetoothShare.CONTENT_URI, Cursor cursorToFile; try { cursorToFile = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._DATA }, WHERE_INBOUND_INTERRUPTED_ON_POWER_OFF, null, null); } catch (SQLiteException e) { cursorToFile = null; Log.e(TAG, "SQLite exception: " + e); } // remove the share and the respective file which was interrupted by battery // removal in the local device Loading Loading @@ -967,9 +980,15 @@ public class BluetoothOppService extends Service { final String WHERE_INBOUND_SUCCESS = BluetoothShare.DIRECTION + "=" + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.STATUS + "=" + BluetoothShare.STATUS_SUCCESS + " AND " + INVISIBLE; Cursor cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { Cursor cursor; try { cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._ID }, WHERE_INBOUND_SUCCESS, null, BluetoothShare._ID); // sort by id } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading src/com/android/bluetooth/opp/BluetoothOppUtility.java +16 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.util.Log; import java.io.File; Loading @@ -68,7 +69,14 @@ public class BluetoothOppUtility { public static BluetoothOppTransferInfo queryRecord(Context context, Uri uri) { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); BluetoothOppTransferInfo info = new BluetoothOppTransferInfo(); Cursor cursor = context.getContentResolver().query(uri, null, null, null, null); Cursor cursor; try { cursor = context.getContentResolver().query(uri, null, null, null, null); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor != null) { if (cursor.moveToFirst()) { info.mID = cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare._ID)); Loading Loading @@ -136,10 +144,16 @@ public class BluetoothOppUtility { ArrayList<String> uris = Lists.newArrayList(); final String WHERE = BluetoothShare.TIMESTAMP + " == " + timeStamp; Cursor metadataCursor = context.getContentResolver().query(BluetoothShare.CONTENT_URI, Cursor metadataCursor; try { metadataCursor = context.getContentResolver().query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._DATA }, WHERE, null, BluetoothShare._ID); } catch (SQLiteException e) { metadataCursor = null; Log.e(TAG, "SQLite exception: " + e); } if (metadataCursor == null) { return null; Loading Loading
src/com/android/bluetooth/opp/BluetoothOppNotification.java +33 −4 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.util.Log; import android.os.Handler; Loading Loading @@ -161,6 +162,7 @@ class BluetoothOppNotification { mUpdateCompleteNotification = true; updateCompletedNotification(); updateIncomingFileConfirmNotification(); mHandler.removeMessages(NOTIFY); } } Loading Loading @@ -220,8 +222,16 @@ class BluetoothOppNotification { private void updateActiveNotification() { // Active transfers Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_RUNNING, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -378,8 +388,15 @@ class BluetoothOppNotification { } // Creating outbound notification Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_COMPLETED_OUTBOUND, null, BluetoothShare.TIMESTAMP + " DESC"); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -428,8 +445,14 @@ class BluetoothOppNotification { } // Creating inbound notification try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_COMPLETED_INBOUND, null, BluetoothShare.TIMESTAMP + " DESC"); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; } Loading Loading @@ -476,8 +499,14 @@ class BluetoothOppNotification { } private void updateIncomingFileConfirmNotification() { Cursor cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, Cursor cursor; try { cursor = mContext.getContentResolver().query(BluetoothShare.CONTENT_URI, null, WHERE_CONFIRM_PENDING, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading
src/com/android/bluetooth/opp/BluetoothOppReceiveFileInfo.java +10 −2 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.os.Environment; import android.os.StatFs; Loading Loading @@ -95,9 +96,16 @@ public class BluetoothOppReceiveFileInfo { Uri contentUri = Uri.parse(BluetoothShare.CONTENT_URI + "/" + id); String filename = null, hint = null, mimeType = null; long length = 0; Cursor metadataCursor = contentResolver.query(contentUri, new String[] { Cursor metadataCursor; try { metadataCursor = contentResolver.query(contentUri, new String[] { BluetoothShare.FILENAME_HINT, BluetoothShare.TOTAL_BYTES, BluetoothShare.MIMETYPE }, null, null, null); } catch (SQLiteException e) { metadataCursor = null; Log.e(Constants.TAG, "SQLite exception: " + e); } if (metadataCursor != null) { try { if (metadataCursor.moveToFirst()) { Loading
src/com/android/bluetooth/opp/BluetoothOppReceiver.java +9 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.util.Log; import android.widget.Toast; Loading Loading @@ -199,8 +200,15 @@ public class BluetoothOppReceiver extends BroadcastReceiver { context.startActivity(in); } else if (action.equals(Constants.ACTION_HIDE)) { if (V) Log.v(TAG, "Receiver hide for " + intent.getData()); Cursor cursor = context.getContentResolver().query(intent.getData(), null, null, null, Cursor cursor; try { cursor = context.getContentResolver().query(intent.getData(), null, null, null, null); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor != null) { if (cursor.moveToFirst()) { int statusColumn = cursor.getColumnIndexOrThrow(BluetoothShare.STATUS); Loading
src/com/android/bluetooth/opp/BluetoothOppService.java +26 −7 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.content.IntentFilter; import android.database.CharArrayBuffer; import android.database.ContentObserver; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; Loading Loading @@ -436,8 +437,14 @@ public class BluetoothOppService extends Service { } mPendingUpdate = false; } Cursor cursor = getContentResolver().query(BluetoothShare.CONTENT_URI, null, null, Cursor cursor; try { cursor = getContentResolver().query(BluetoothShare.CONTENT_URI, null, null, null, BluetoothShare._ID); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading Loading @@ -935,9 +942,15 @@ public class BluetoothOppService extends Service { + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.STATUS + "=" + BluetoothShare.STATUS_RUNNING; Cursor cursorToFile = contentResolver.query(BluetoothShare.CONTENT_URI, Cursor cursorToFile; try { cursorToFile = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._DATA }, WHERE_INBOUND_INTERRUPTED_ON_POWER_OFF, null, null); } catch (SQLiteException e) { cursorToFile = null; Log.e(TAG, "SQLite exception: " + e); } // remove the share and the respective file which was interrupted by battery // removal in the local device Loading Loading @@ -967,9 +980,15 @@ public class BluetoothOppService extends Service { final String WHERE_INBOUND_SUCCESS = BluetoothShare.DIRECTION + "=" + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.STATUS + "=" + BluetoothShare.STATUS_SUCCESS + " AND " + INVISIBLE; Cursor cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { Cursor cursor; try { cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._ID }, WHERE_INBOUND_SUCCESS, null, BluetoothShare._ID); // sort by id } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor == null) { return; Loading
src/com/android/bluetooth/opp/BluetoothOppUtility.java +16 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.util.Log; import java.io.File; Loading @@ -68,7 +69,14 @@ public class BluetoothOppUtility { public static BluetoothOppTransferInfo queryRecord(Context context, Uri uri) { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); BluetoothOppTransferInfo info = new BluetoothOppTransferInfo(); Cursor cursor = context.getContentResolver().query(uri, null, null, null, null); Cursor cursor; try { cursor = context.getContentResolver().query(uri, null, null, null, null); } catch (SQLiteException e) { cursor = null; Log.e(TAG, "SQLite exception: " + e); } if (cursor != null) { if (cursor.moveToFirst()) { info.mID = cursor.getInt(cursor.getColumnIndexOrThrow(BluetoothShare._ID)); Loading Loading @@ -136,10 +144,16 @@ public class BluetoothOppUtility { ArrayList<String> uris = Lists.newArrayList(); final String WHERE = BluetoothShare.TIMESTAMP + " == " + timeStamp; Cursor metadataCursor = context.getContentResolver().query(BluetoothShare.CONTENT_URI, Cursor metadataCursor; try { metadataCursor = context.getContentResolver().query(BluetoothShare.CONTENT_URI, new String[] { BluetoothShare._DATA }, WHERE, null, BluetoothShare._ID); } catch (SQLiteException e) { metadataCursor = null; Log.e(TAG, "SQLite exception: " + e); } if (metadataCursor == null) { return null; Loading