Loading android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +21 −1 Original line number Diff line number Diff line Loading @@ -116,6 +116,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti private UpdateThread mUpdateThread; private boolean mUpdateThreadRunning; private ArrayList<BluetoothOppShareInfo> mShares; private ArrayList<BluetoothOppBatch> mBatches; Loading Loading @@ -331,8 +333,19 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { Log.e(TAG, "Interrupted", e); Loading @@ -340,6 +353,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mUpdateThread = null; } } mNotifier.cancelNotifications(); break; case START_LISTENER: Loading Loading @@ -552,6 +566,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (mUpdateThread == null) { mUpdateThread = new UpdateThread(); mUpdateThread.start(); mUpdateThreadRunning = true; } } } Loading Loading @@ -581,6 +596,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti while (!mIsInterrupted) { synchronized (BluetoothOppService.this) { if (mUpdateThread != this) { mUpdateThreadRunning = false; throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppService"); } Loading @@ -590,6 +606,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } if (!mPendingUpdate) { mUpdateThread = null; mUpdateThreadRunning = false; return; } mPendingUpdate = false; Loading @@ -599,6 +616,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti BluetoothShare._ID); if (cursor == null) { mUpdateThreadRunning = false; return; } Loading Loading @@ -692,6 +710,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti cursor.close(); } mUpdateThreadRunning = false; } } Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppService.java +21 −1 Original line number Diff line number Diff line Loading @@ -116,6 +116,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti private UpdateThread mUpdateThread; private boolean mUpdateThreadRunning; private ArrayList<BluetoothOppShareInfo> mShares; private ArrayList<BluetoothOppBatch> mBatches; Loading Loading @@ -331,8 +333,19 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti unregisterReceivers(); synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.interrupt(); } } while (mUpdateThread != null && mUpdateThreadRunning) { try { Thread.sleep(50); } catch (Exception e) { Log.e(TAG, "Thread sleep", e); } } synchronized (BluetoothOppService.this) { if (mUpdateThread != null) { try { mUpdateThread.join(); } catch (InterruptedException e) { Log.e(TAG, "Interrupted", e); Loading @@ -340,6 +353,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti mUpdateThread = null; } } mNotifier.cancelNotifications(); break; case START_LISTENER: Loading Loading @@ -552,6 +566,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti if (mUpdateThread == null) { mUpdateThread = new UpdateThread(); mUpdateThread.start(); mUpdateThreadRunning = true; } } } Loading Loading @@ -581,6 +596,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti while (!mIsInterrupted) { synchronized (BluetoothOppService.this) { if (mUpdateThread != this) { mUpdateThreadRunning = false; throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppService"); } Loading @@ -590,6 +606,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti } if (!mPendingUpdate) { mUpdateThread = null; mUpdateThreadRunning = false; return; } mPendingUpdate = false; Loading @@ -599,6 +616,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti BluetoothShare._ID); if (cursor == null) { mUpdateThreadRunning = false; return; } Loading Loading @@ -692,6 +710,8 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti cursor.close(); } mUpdateThreadRunning = false; } } Loading