Loading android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −18 Original line number Diff line number Diff line Loading @@ -653,9 +653,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); // this advances in the array } else { int id = cursor.getInt(idColumn); Loading @@ -679,14 +676,11 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, "Array update: removing " + arrayId + " @ " + arrayPos); } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); } else if (arrayId == id) { // This cursor row already exists in the stored array. updateShare(cursor, arrayPos); scanFileIfNeeded(arrayPos); ++arrayPos; cursor.moveToNext(); isAfterLast = cursor.isAfterLast(); Loading Loading @@ -1052,8 +1046,14 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } private boolean scanFile(int arrayPos) { private void scanFileIfNeeded(int 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) { if (D) { Log.d(TAG, "Scanning file " + info.mFilename); Loading @@ -1061,20 +1061,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (!mMediaScanInProgress) { mMediaScanInProgress = true; 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. private static void trimDatabase(ContentResolver contentResolver) { // remove the invisible/unconfirmed inbound shares Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −18 Original line number Diff line number Diff line Loading @@ -653,9 +653,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); // this advances in the array } else { int id = cursor.getInt(idColumn); Loading @@ -679,14 +676,11 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, "Array update: removing " + arrayId + " @ " + arrayPos); } if (shouldScanFile(arrayPos)) { scanFile(arrayPos); } deleteShare(arrayPos); } else if (arrayId == id) { // This cursor row already exists in the stored array. updateShare(cursor, arrayPos); scanFileIfNeeded(arrayPos); ++arrayPos; cursor.moveToNext(); isAfterLast = cursor.isAfterLast(); Loading Loading @@ -1052,8 +1046,14 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } private boolean scanFile(int arrayPos) { private void scanFileIfNeeded(int 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) { if (D) { Log.d(TAG, "Scanning file " + info.mFilename); Loading @@ -1061,20 +1061,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (!mMediaScanInProgress) { mMediaScanInProgress = true; 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. private static void trimDatabase(ContentResolver contentResolver) { // remove the invisible/unconfirmed inbound shares Loading