Loading android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +1 −6 Original line number Diff line number Diff line Loading @@ -545,6 +545,7 @@ class BluetoothOppNotification { if (cursor == null) { return; } for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { BluetoothOppTransferInfo info = new BluetoothOppTransferInfo(); BluetoothOppUtility.fillRecord(mContext, cursor, info); Loading Loading @@ -592,10 +593,4 @@ class BluetoothOppNotification { } cursor.close(); } void cancelNotifications() { if (V) Log.v(TAG, "cancelNotifications "); mHandler.removeCallbacksAndMessages(null); mNotificationMgr.cancelAll(); } } android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −28 Original line number Diff line number Diff line Loading @@ -163,7 +163,13 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } mShares = Lists.newArrayList(); mBatchs = Lists.newArrayList(); mObserver = new BluetoothShareContentObserver(); getContentResolver().registerContentObserver(BluetoothShare.CONTENT_URI, true, mObserver); mBatchId = 1; mNotifier = new BluetoothOppNotification(this); mNotifier.mNotificationMgr.cancelAll(); mNotifier.updateNotification(); final ContentResolver contentResolver = getContentResolver(); new Thread("trimDatabase") { @Override Loading Loading @@ -191,12 +197,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (V) { Log.v(TAG, "start()"); } /* Register observer during BT on */ mObserver = new BluetoothShareContentObserver(); getContentResolver().registerContentObserver(BluetoothShare.CONTENT_URI, true, mObserver); mNotifier = new BluetoothOppNotification(this); mNotifier.mNotificationMgr.cancelAll(); mNotifier.updateNotification(); updateFromProvider(); return true; } Loading Loading @@ -248,7 +248,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { Loading @@ -260,7 +259,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mUpdateThread = null; } } mNotifier.cancelNotifications(); break; case START_LISTENER: if (mAdapter.isEnabled()) { Loading Loading @@ -389,6 +387,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (V) { Log.v(TAG, "onDestroy"); } getContentResolver().unregisterContentObserver(mObserver); unregisterReceiver(mBluetoothReceiver); stopListeners(); if (mBatchs != null) { mBatchs.clear(); Loading @@ -402,18 +402,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti return true; } private void unregisterReceivers() { try { if (mObserver != null) { getContentResolver().unregisterContentObserver(mObserver); mObserver = null; } unregisterReceiver(mBluetoothReceiver); } catch (IllegalArgumentException e) { Log.w(TAG, "unregisterReceivers already " + e.toString()); } } /* suppose we auto accept an incoming OPUSH connection */ private void createServerSession(ObexTransport transport) { mServerSession = new BluetoothOppObexServerSession(this, transport, mServerSocket); Loading Loading @@ -1074,14 +1062,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, "Deleted complete inbound failed shares, number = " + delNum); } // remove unconfirmed inbound shares. final String whereConfirmationPendingInbound = BluetoothShare.DIRECTION + "=" + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.USER_CONFIRMATION + "=" + BluetoothShare.USER_CONFIRMATION_PENDING; delNum = contentResolver.delete( BluetoothShare.CONTENT_URI, whereConfirmationPendingInbound, null); if (V) Log.v(TAG, "Deleted unconfirmed incoming shares, number = " + delNum); // Only keep the inbound and successful shares for LiverFolder use // Keep the latest 1000 to easy db query Cursor cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[]{ Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppNotification.java +1 −6 Original line number Diff line number Diff line Loading @@ -545,6 +545,7 @@ class BluetoothOppNotification { if (cursor == null) { return; } for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { BluetoothOppTransferInfo info = new BluetoothOppTransferInfo(); BluetoothOppUtility.fillRecord(mContext, cursor, info); Loading Loading @@ -592,10 +593,4 @@ class BluetoothOppNotification { } cursor.close(); } void cancelNotifications() { if (V) Log.v(TAG, "cancelNotifications "); mHandler.removeCallbacksAndMessages(null); mNotificationMgr.cancelAll(); } }
android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +8 −28 Original line number Diff line number Diff line Loading @@ -163,7 +163,13 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } mShares = Lists.newArrayList(); mBatchs = Lists.newArrayList(); mObserver = new BluetoothShareContentObserver(); getContentResolver().registerContentObserver(BluetoothShare.CONTENT_URI, true, mObserver); mBatchId = 1; mNotifier = new BluetoothOppNotification(this); mNotifier.mNotificationMgr.cancelAll(); mNotifier.updateNotification(); final ContentResolver contentResolver = getContentResolver(); new Thread("trimDatabase") { @Override Loading Loading @@ -191,12 +197,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (V) { Log.v(TAG, "start()"); } /* Register observer during BT on */ mObserver = new BluetoothShareContentObserver(); getContentResolver().registerContentObserver(BluetoothShare.CONTENT_URI, true, mObserver); mNotifier = new BluetoothOppNotification(this); mNotifier.mNotificationMgr.cancelAll(); mNotifier.updateNotification(); updateFromProvider(); return true; } Loading Loading @@ -248,7 +248,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { Loading @@ -260,7 +259,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mUpdateThread = null; } } mNotifier.cancelNotifications(); break; case START_LISTENER: if (mAdapter.isEnabled()) { Loading Loading @@ -389,6 +387,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (V) { Log.v(TAG, "onDestroy"); } getContentResolver().unregisterContentObserver(mObserver); unregisterReceiver(mBluetoothReceiver); stopListeners(); if (mBatchs != null) { mBatchs.clear(); Loading @@ -402,18 +402,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti return true; } private void unregisterReceivers() { try { if (mObserver != null) { getContentResolver().unregisterContentObserver(mObserver); mObserver = null; } unregisterReceiver(mBluetoothReceiver); } catch (IllegalArgumentException e) { Log.w(TAG, "unregisterReceivers already " + e.toString()); } } /* suppose we auto accept an incoming OPUSH connection */ private void createServerSession(ObexTransport transport) { mServerSession = new BluetoothOppObexServerSession(this, transport, mServerSocket); Loading Loading @@ -1074,14 +1062,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti Log.v(TAG, "Deleted complete inbound failed shares, number = " + delNum); } // remove unconfirmed inbound shares. final String whereConfirmationPendingInbound = BluetoothShare.DIRECTION + "=" + BluetoothShare.DIRECTION_INBOUND + " AND " + BluetoothShare.USER_CONFIRMATION + "=" + BluetoothShare.USER_CONFIRMATION_PENDING; delNum = contentResolver.delete( BluetoothShare.CONTENT_URI, whereConfirmationPendingInbound, null); if (V) Log.v(TAG, "Deleted unconfirmed incoming shares, number = " + delNum); // Only keep the inbound and successful shares for LiverFolder use // Keep the latest 1000 to easy db query Cursor cursor = contentResolver.query(BluetoothShare.CONTENT_URI, new String[]{ Loading