Loading src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java +13 −16 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { private final int MIN_FILE_LEN_FOR_TPUT_MEASUREMENT = 500000; private ContentResolverUpdateThread uiUpdateThread = null; public BluetoothOppObexClientSession(Context context, ObexTransport transport) { if (transport == null) { throw new NullPointerException("transport is null"); Loading Loading @@ -123,7 +125,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { } private class ContentResolverUpdateThread extends Thread { private static final int sSleepTime = 500; private Uri contentUri; private Context mContext1; private long position; Loading @@ -135,28 +136,27 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { position = pos; } public void updateProgress (long pos) { position = pos; } @Override public void run() { ContentValues updateValues; Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); while (true) { updateValues = new ContentValues(); synchronized (BluetoothOppObexClientSession.this) { if (uiUpdateThread != this) { throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppObexClientSession"); } } ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.CURRENT_BYTES, position); mContext1.getContentResolver().update(contentUri, updateValues, null, null); synchronized (BluetoothOppObexClientSession.this) { uiUpdateThread = null; try { Thread.sleep(sSleepTime); } catch (InterruptedException e1) { if (V) Log.v(TAG, "ContentResolverUpdateThread was interrupted (1), exiting"); return; } } } } Loading Loading @@ -383,7 +383,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { int status = BluetoothShare.STATUS_SUCCESS; Uri contentUri = Uri.parse(BluetoothShare.CONTENT_URI + "/" + mInfo.mId); ContentValues updateValues; ContentResolverUpdateThread uiUpdateThread = null; HeaderSet reply = new HeaderSet(); HeaderSet request; request = new HeaderSet(); Loading Loading @@ -524,8 +523,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { uiUpdateThread = new ContentResolverUpdateThread (mContext1, contentUri, position); uiUpdateThread.start ( ); } else { uiUpdateThread.updateProgress (position); } } } Loading src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java +13 −19 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen boolean mTransferInProgress = false; private ContentResolverUpdateThread uiUpdateThread = null; public BluetoothOppObexServerSession(Context context, ObexTransport transport) { mContext = context; mTransport = transport; Loading Loading @@ -169,7 +171,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen private class ContentResolverUpdateThread extends Thread { private static final int sSleepTime = 500; private Uri contentUri; private Context mContext1; private long position; Loading @@ -181,31 +182,27 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen position = pos; } public void updateProgress (long pos) { position = pos; } @Override public void run() { ContentValues updateValues; Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); synchronized (BluetoothOppObexServerSession.this) { if (uiUpdateThread != this) { throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppObexServerSession"); } } if (V) Log.v(TAG, "Is ContentResolverUpdateThread Interrupted :" + isInterrupted()); /* Check if the Operation is interrupted before entering into loop */ while ( !isInterrupted() ) { updateValues = new ContentValues(); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.CURRENT_BYTES, position); mContext1.getContentResolver().update(contentUri, updateValues, null, null); try { Thread.sleep(sSleepTime); } catch (InterruptedException e1) { if (V) Log.v(TAG, "Server ContentResolverUpdateThread was interrupted (1), exiting"); return; } synchronized (BluetoothOppObexServerSession.this) { uiUpdateThread = null; } } } /* Loading Loading @@ -504,7 +501,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen long beginTime = 0; int status = -1; BufferedOutputStream bos = null; ContentResolverUpdateThread uiUpdateThread = null; InputStream is = null; boolean error = false; Loading Loading @@ -559,8 +555,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen uiUpdateThread = new ContentResolverUpdateThread (mContext, contentUri, position); if (V) Log.v(TAG, "Worker for Updation : Created"); uiUpdateThread.start(); } else { uiUpdateThread.updateProgress (position); } } Loading Loading
src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java +13 −16 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { private final int MIN_FILE_LEN_FOR_TPUT_MEASUREMENT = 500000; private ContentResolverUpdateThread uiUpdateThread = null; public BluetoothOppObexClientSession(Context context, ObexTransport transport) { if (transport == null) { throw new NullPointerException("transport is null"); Loading Loading @@ -123,7 +125,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { } private class ContentResolverUpdateThread extends Thread { private static final int sSleepTime = 500; private Uri contentUri; private Context mContext1; private long position; Loading @@ -135,28 +136,27 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { position = pos; } public void updateProgress (long pos) { position = pos; } @Override public void run() { ContentValues updateValues; Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); while (true) { updateValues = new ContentValues(); synchronized (BluetoothOppObexClientSession.this) { if (uiUpdateThread != this) { throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppObexClientSession"); } } ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.CURRENT_BYTES, position); mContext1.getContentResolver().update(contentUri, updateValues, null, null); synchronized (BluetoothOppObexClientSession.this) { uiUpdateThread = null; try { Thread.sleep(sSleepTime); } catch (InterruptedException e1) { if (V) Log.v(TAG, "ContentResolverUpdateThread was interrupted (1), exiting"); return; } } } } Loading Loading @@ -383,7 +383,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { int status = BluetoothShare.STATUS_SUCCESS; Uri contentUri = Uri.parse(BluetoothShare.CONTENT_URI + "/" + mInfo.mId); ContentValues updateValues; ContentResolverUpdateThread uiUpdateThread = null; HeaderSet reply = new HeaderSet(); HeaderSet request; request = new HeaderSet(); Loading Loading @@ -524,8 +523,6 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession { uiUpdateThread = new ContentResolverUpdateThread (mContext1, contentUri, position); uiUpdateThread.start ( ); } else { uiUpdateThread.updateProgress (position); } } } Loading
src/com/android/bluetooth/opp/BluetoothOppObexServerSession.java +13 −19 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen boolean mTransferInProgress = false; private ContentResolverUpdateThread uiUpdateThread = null; public BluetoothOppObexServerSession(Context context, ObexTransport transport) { mContext = context; mTransport = transport; Loading Loading @@ -169,7 +171,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen private class ContentResolverUpdateThread extends Thread { private static final int sSleepTime = 500; private Uri contentUri; private Context mContext1; private long position; Loading @@ -181,31 +182,27 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen position = pos; } public void updateProgress (long pos) { position = pos; } @Override public void run() { ContentValues updateValues; Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); synchronized (BluetoothOppObexServerSession.this) { if (uiUpdateThread != this) { throw new IllegalStateException( "multiple UpdateThreads in BluetoothOppObexServerSession"); } } if (V) Log.v(TAG, "Is ContentResolverUpdateThread Interrupted :" + isInterrupted()); /* Check if the Operation is interrupted before entering into loop */ while ( !isInterrupted() ) { updateValues = new ContentValues(); ContentValues updateValues = new ContentValues(); updateValues.put(BluetoothShare.CURRENT_BYTES, position); mContext1.getContentResolver().update(contentUri, updateValues, null, null); try { Thread.sleep(sSleepTime); } catch (InterruptedException e1) { if (V) Log.v(TAG, "Server ContentResolverUpdateThread was interrupted (1), exiting"); return; } synchronized (BluetoothOppObexServerSession.this) { uiUpdateThread = null; } } } /* Loading Loading @@ -504,7 +501,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen long beginTime = 0; int status = -1; BufferedOutputStream bos = null; ContentResolverUpdateThread uiUpdateThread = null; InputStream is = null; boolean error = false; Loading Loading @@ -559,8 +555,6 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler implemen uiUpdateThread = new ContentResolverUpdateThread (mContext, contentUri, position); if (V) Log.v(TAG, "Worker for Updation : Created"); uiUpdateThread.start(); } else { uiUpdateThread.updateProgress (position); } } Loading