Loading android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −18 Original line number Original line Diff line number Diff line Loading @@ -652,9 +652,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); // this advances in the array deleteShare(arrayPos); // this advances in the array } else { } else { int id = cursor.getInt(idColumn); int id = cursor.getInt(idColumn); Loading @@ -678,14 +675,11 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, Log.v(TAG, "Array update: removing " + arrayId + " @ " + arrayPos); "Array update: removing " + arrayId + " @ " + arrayPos); } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); deleteShare(arrayPos); } else if (arrayId == id) { } else if (arrayId == id) { // This cursor row already exists in the stored array. // This cursor row already exists in the stored array. updateShare(cursor, arrayPos); updateShare(cursor, arrayPos); scanFileIfNeeded(arrayPos); ++arrayPos; ++arrayPos; cursor.moveToNext(); cursor.moveToNext(); isAfterLast = cursor.isAfterLast(); isAfterLast = cursor.isAfterLast(); Loading Loading @@ -1051,8 +1045,14 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } } } private boolean scanFile(int arrayPos) { private void scanFileIfNeeded(int arrayPos) { BluetoothOppShareInfo info = mShares.get(arrayPos); BluetoothOppShareInfo info = mShares.get(arrayPos); boolean isFileReceived = BluetoothShare.isStatusSuccess(info.mStatus) && info.mDirection == BluetoothShare.DIRECTION_INBOUND && !info.mMediaScanned && info.mConfirm != BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED; if (!isFileReceived) { return; } synchronized (BluetoothOppService.this) { synchronized (BluetoothOppService.this) { if (D) { if (D) { Log.d(TAG, "Scanning file " + info.mFilename); Log.d(TAG, "Scanning file " + info.mFilename); Loading @@ -1060,20 +1060,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (!mMediaScanInProgress) { if (!mMediaScanInProgress) { mMediaScanInProgress = true; mMediaScanInProgress = true; new MediaScannerNotifier(this, info, mHandler); new MediaScannerNotifier(this, info, mHandler); return true; } else { return false; } } } } } } private boolean shouldScanFile(int arrayPos) { BluetoothOppShareInfo info = mShares.get(arrayPos); return BluetoothShare.isStatusSuccess(info.mStatus) && info.mDirection == BluetoothShare.DIRECTION_INBOUND && !info.mMediaScanned && info.mConfirm != BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED; } // Run in a background thread at boot. // Run in a background thread at boot. private static void trimDatabase(ContentResolver contentResolver) { private static void trimDatabase(ContentResolver contentResolver) { // remove the invisible/unconfirmed inbound shares // remove the invisible/unconfirmed inbound shares Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −18 Original line number Original line Diff line number Diff line Loading @@ -652,9 +652,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); // this advances in the array deleteShare(arrayPos); // this advances in the array } else { } else { int id = cursor.getInt(idColumn); int id = cursor.getInt(idColumn); Loading @@ -678,14 +675,11 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, Log.v(TAG, "Array update: removing " + arrayId + " @ " + arrayPos); "Array update: removing " + arrayId + " @ " + arrayPos); } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); deleteShare(arrayPos); } else if (arrayId == id) { } else if (arrayId == id) { // This cursor row already exists in the stored array. // This cursor row already exists in the stored array. updateShare(cursor, arrayPos); updateShare(cursor, arrayPos); scanFileIfNeeded(arrayPos); ++arrayPos; ++arrayPos; cursor.moveToNext(); cursor.moveToNext(); isAfterLast = cursor.isAfterLast(); isAfterLast = cursor.isAfterLast(); Loading Loading @@ -1051,8 +1045,14 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } } } private boolean scanFile(int arrayPos) { private void scanFileIfNeeded(int arrayPos) { BluetoothOppShareInfo info = mShares.get(arrayPos); BluetoothOppShareInfo info = mShares.get(arrayPos); boolean isFileReceived = BluetoothShare.isStatusSuccess(info.mStatus) && info.mDirection == BluetoothShare.DIRECTION_INBOUND && !info.mMediaScanned && info.mConfirm != BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED; if (!isFileReceived) { return; } synchronized (BluetoothOppService.this) { synchronized (BluetoothOppService.this) { if (D) { if (D) { Log.d(TAG, "Scanning file " + info.mFilename); Log.d(TAG, "Scanning file " + info.mFilename); Loading @@ -1060,20 +1060,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (!mMediaScanInProgress) { if (!mMediaScanInProgress) { mMediaScanInProgress = true; mMediaScanInProgress = true; new MediaScannerNotifier(this, info, mHandler); new MediaScannerNotifier(this, info, mHandler); return true; } else { return false; } } } } } } private boolean shouldScanFile(int arrayPos) { BluetoothOppShareInfo info = mShares.get(arrayPos); return BluetoothShare.isStatusSuccess(info.mStatus) && info.mDirection == BluetoothShare.DIRECTION_INBOUND && !info.mMediaScanned && info.mConfirm != BluetoothShare.USER_CONFIRMATION_HANDOVER_CONFIRMED; } // Run in a background thread at boot. // Run in a background thread at boot. private static void trimDatabase(ContentResolver contentResolver) { private static void trimDatabase(ContentResolver contentResolver) { // remove the invisible/unconfirmed inbound shares // remove the invisible/unconfirmed inbound shares Loading