Loading android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java +14 −8 Original line number Diff line number Diff line Loading @@ -266,12 +266,14 @@ public class BluetoothOppManager { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; mUriOfSendingFile = uriString; mIsHandoverInitiated = isHandover; Uri uri = Uri.parse(uriString); BluetoothOppUtility.putSendFileInfo(uri, BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal)); fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mUriOfSendingFile = uri.toString(); storeApplicationData(); } } Loading @@ -281,12 +283,15 @@ public class BluetoothOppManager { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; mUrisOfSendingFiles = uris; mUrisOfSendingFiles = new ArrayList<Uri>(); mIsHandoverInitiated = isHandover; for (Uri uri : uris) { BluetoothOppUtility.putSendFileInfo(uri, BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal)); fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); mUrisOfSendingFiles.add(uri); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); } storeApplicationData(); } Loading Loading @@ -452,7 +457,10 @@ public class BluetoothOppManager { Long ts = System.currentTimeMillis(); for (int i = 0; i < count; i++) { Uri fileUri = mUris.get(i); ContentValues values = new ContentValues(); values.put(BluetoothShare.URI, fileUri.toString()); ContentResolver contentResolver = mContext.getContentResolver(); fileUri = BluetoothOppUtility.originalUri(fileUri); String contentType = contentResolver.getType(fileUri); if (V) { Log.v(TAG, "Got mimetype: " + contentType + " Got uri: " + fileUri); Loading @@ -461,8 +469,6 @@ public class BluetoothOppManager { contentType = mTypeOfMultipleFiles; } ContentValues values = new ContentValues(); values.put(BluetoothShare.URI, fileUri.toString()); values.put(BluetoothShare.MIMETYPE, contentType); values.put(BluetoothShare.DESTINATION, mRemoteDevice.getAddress()); values.put(BluetoothShare.TIMESTAMP, ts); Loading android/app/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -381,6 +381,13 @@ public class BluetoothOppTransferActivity extends AlertActivity mTransInfo.mID); // retry the failed transfer Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri)); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(BluetoothOppTransferActivity .this, uri, mTransInfo.mFileType, false); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mTransInfo.mFileUri = uri.toString(); BluetoothOppUtility.retryTransfer(this, mTransInfo); BluetoothDevice remoteDevice = mAdapter.getRemoteDevice(mTransInfo.mDestAddr); Loading android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +20 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,26 @@ public class BluetoothOppUtility { } } static Uri originalUri(Uri uri) { String mUri = uri.toString(); int atIndex = mUri.lastIndexOf("@"); if (atIndex != -1) { mUri = mUri.substring(0, atIndex); uri = Uri.parse(mUri); } if (V) Log.v(TAG, "originalUri: " + uri); return uri; } static Uri generateUri(Uri uri, BluetoothOppSendFileInfo sendFileInfo) { String fileInfo = sendFileInfo.toString(); int atIndex = fileInfo.lastIndexOf("@"); fileInfo = fileInfo.substring(atIndex); uri = Uri.parse(uri + fileInfo); if (V) Log.v(TAG, "generateUri: " + uri); return uri; } static void putSendFileInfo(Uri uri, BluetoothOppSendFileInfo sendFileInfo) { if (D) { Log.d(TAG, "putSendFileInfo: uri=" + uri + " sendFileInfo=" + sendFileInfo); Loading Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java +14 −8 Original line number Diff line number Diff line Loading @@ -266,12 +266,14 @@ public class BluetoothOppManager { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; mUriOfSendingFile = uriString; mIsHandoverInitiated = isHandover; Uri uri = Uri.parse(uriString); BluetoothOppUtility.putSendFileInfo(uri, BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal)); fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mUriOfSendingFile = uri.toString(); storeApplicationData(); } } Loading @@ -281,12 +283,15 @@ public class BluetoothOppManager { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; mUrisOfSendingFiles = uris; mUrisOfSendingFiles = new ArrayList<Uri>(); mIsHandoverInitiated = isHandover; for (Uri uri : uris) { BluetoothOppUtility.putSendFileInfo(uri, BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal)); fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); mUrisOfSendingFiles.add(uri); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); } storeApplicationData(); } Loading Loading @@ -452,7 +457,10 @@ public class BluetoothOppManager { Long ts = System.currentTimeMillis(); for (int i = 0; i < count; i++) { Uri fileUri = mUris.get(i); ContentValues values = new ContentValues(); values.put(BluetoothShare.URI, fileUri.toString()); ContentResolver contentResolver = mContext.getContentResolver(); fileUri = BluetoothOppUtility.originalUri(fileUri); String contentType = contentResolver.getType(fileUri); if (V) { Log.v(TAG, "Got mimetype: " + contentType + " Got uri: " + fileUri); Loading @@ -461,8 +469,6 @@ public class BluetoothOppManager { contentType = mTypeOfMultipleFiles; } ContentValues values = new ContentValues(); values.put(BluetoothShare.URI, fileUri.toString()); values.put(BluetoothShare.MIMETYPE, contentType); values.put(BluetoothShare.DESTINATION, mRemoteDevice.getAddress()); values.put(BluetoothShare.TIMESTAMP, ts); Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java +7 −0 Original line number Diff line number Diff line Loading @@ -381,6 +381,13 @@ public class BluetoothOppTransferActivity extends AlertActivity mTransInfo.mID); // retry the failed transfer Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri)); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(BluetoothOppTransferActivity .this, uri, mTransInfo.mFileType, false); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mTransInfo.mFileUri = uri.toString(); BluetoothOppUtility.retryTransfer(this, mTransInfo); BluetoothDevice remoteDevice = mAdapter.getRemoteDevice(mTransInfo.mDestAddr); Loading
android/app/src/com/android/bluetooth/opp/BluetoothOppUtility.java +20 −0 Original line number Diff line number Diff line Loading @@ -345,6 +345,26 @@ public class BluetoothOppUtility { } } static Uri originalUri(Uri uri) { String mUri = uri.toString(); int atIndex = mUri.lastIndexOf("@"); if (atIndex != -1) { mUri = mUri.substring(0, atIndex); uri = Uri.parse(mUri); } if (V) Log.v(TAG, "originalUri: " + uri); return uri; } static Uri generateUri(Uri uri, BluetoothOppSendFileInfo sendFileInfo) { String fileInfo = sendFileInfo.toString(); int atIndex = fileInfo.lastIndexOf("@"); fileInfo = fileInfo.substring(atIndex); uri = Uri.parse(uri + fileInfo); if (V) Log.v(TAG, "generateUri: " + uri); return uri; } static void putSendFileInfo(Uri uri, BluetoothOppSendFileInfo sendFileInfo) { if (D) { Log.d(TAG, "putSendFileInfo: uri=" + uri + " sendFileInfo=" + sendFileInfo); Loading