Loading android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +54 −51 Original line number Diff line number Diff line Loading @@ -379,57 +379,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti public void handleMessage(Message msg) { switch (msg.what) { case STOP_LISTENER: stopListeners(); mListenStarted = false; // Stop Active INBOUND Transfer if (mServerTransfer != null) { mServerTransfer.onBatchCanceled(); mServerTransfer = null; } // Stop Active OUTBOUND Transfer if (mTransfer != null) { mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 4); Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 5); Log.e(TAG, "Interrupted", e); } mUpdateThread = null; } } if (mNotifier != null) { mNotifier.cancelNotifications(); } stopInternal(); break; case START_LISTENER: if (mAdapterService.isEnabled()) { Loading Loading @@ -634,6 +584,59 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } private void stopInternal() { stopListeners(); mListenStarted = false; // Stop Active INBOUND Transfer if (mServerTransfer != null) { mServerTransfer.onBatchCanceled(); mServerTransfer = null; } // Stop Active OUTBOUND Transfer if (mTransfer != null) { mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 4); Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 5); Log.e(TAG, "Interrupted", e); } mUpdateThread = null; } } if (mNotifier != null) { mNotifier.cancelNotifications(); } } /* suppose we auto accept an incoming OPUSH connection */ private void createServerSession(ObexTransport transport) { mServerSession = new BluetoothOppObexServerSession(this, transport, this); Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +54 −51 Original line number Diff line number Diff line Loading @@ -379,57 +379,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti public void handleMessage(Message msg) { switch (msg.what) { case STOP_LISTENER: stopListeners(); mListenStarted = false; // Stop Active INBOUND Transfer if (mServerTransfer != null) { mServerTransfer.onBatchCanceled(); mServerTransfer = null; } // Stop Active OUTBOUND Transfer if (mTransfer != null) { mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 4); Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 5); Log.e(TAG, "Interrupted", e); } mUpdateThread = null; } } if (mNotifier != null) { mNotifier.cancelNotifications(); } stopInternal(); break; case START_LISTENER: if (mAdapterService.isEnabled()) { Loading Loading @@ -634,6 +584,59 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } } private void stopInternal() { stopListeners(); mListenStarted = false; // Stop Active INBOUND Transfer if (mServerTransfer != null) { mServerTransfer.onBatchCanceled(); mServerTransfer = null; } // Stop Active OUTBOUND Transfer if (mTransfer != null) { mTransfer.onBatchCanceled(); mTransfer = null; } unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 4); Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { ContentProfileErrorReportUtils.report( BluetoothProfile.OPP, BluetoothProtoEnums.BLUETOOTH_OPP_SERVICE, BluetoothStatsLog .BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION, 5); Log.e(TAG, "Interrupted", e); } mUpdateThread = null; } } if (mNotifier != null) { mNotifier.cancelNotifications(); } } /* suppose we auto accept an incoming OPUSH connection */ private void createServerSession(ObexTransport transport) { mServerSession = new BluetoothOppObexServerSession(this, transport, this); Loading