Loading src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver { // Save type/stream, will be used when adding transfer // session to DB. BluetoothOppManager.getInstance(context).saveSendingFileInfo(type, stream.toString(), true); stream.toString(), true /* isHandover */, true /* fromExternal */); } else { if (D) Log.d(TAG, "No mimeType or stream attached to handover request"); } Loading @@ -60,7 +60,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver { uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); if (mimeType != null && uris != null) { BluetoothOppManager.getInstance(context).saveSendingFileInfo(mimeType, uris, true); uris, true /* isHandover */, true /* fromExternal */); } else { if (D) Log.d(TAG, "No mimeType or stream attached to handover request"); return; Loading src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java +6 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,stream.toString(), false); .saveSendingFileInfo(type,stream.toString(), false /* isHandover */, true /* fromExternal */); //Done getting file info..Launch device picker and finish this activity launchDevicePicker(); finish(); Loading @@ -128,7 +129,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,fileUri.toString(), false); .saveSendingFileInfo(type,fileUri.toString(), false /* isHandover */, false /* fromExternal */); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); Loading Loading @@ -156,7 +158,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(mimeType,uris, false); .saveSendingFileInfo(mimeType,uris, false /* isHandover */, true /* fromExternal */); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); Loading src/com/android/bluetooth/opp/BluetoothOppManager.java +4 −4 Original line number Diff line number Diff line Loading @@ -246,14 +246,14 @@ public class BluetoothOppManager { if (V) Log.v(TAG, "Application data stored to SharedPreference! "); } public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) { public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover, boolean fromExternal) { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; mIsHandoverInitiated = isHandover; Uri uri = Uri.parse(uriString); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType); BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mUriOfSendingFile = uri.toString(); Loading @@ -261,7 +261,7 @@ public class BluetoothOppManager { } } public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) { public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover, boolean fromExternal) { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; Loading @@ -269,7 +269,7 @@ public class BluetoothOppManager { mIsHandoverInitiated = isHandover; for (Uri uri : uris) { BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType); BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); mUrisOfSendingFiles.add(uri); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); Loading src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java +11 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.provider.OpenableColumns; import android.util.EventLog; import android.util.Log; import java.io.File; Loading Loading @@ -98,7 +99,7 @@ public class BluetoothOppSendFileInfo { } public static BluetoothOppSendFileInfo generateFileInfo(Context context, Uri uri, String type) { String type, boolean fromExternal) { ContentResolver contentResolver = context.getContentResolver(); String scheme = uri.getScheme(); String fileName = null; Loading Loading @@ -134,6 +135,15 @@ public class BluetoothOppSendFileInfo { fileName = uri.getLastPathSegment(); } } else if ("file".equals(scheme)) { if (uri.getPath() == null) { Log.e(TAG, "Invalid URI path: " + uri); return SEND_FILE_INFO_ERROR; } if (fromExternal && !BluetoothOppUtility.isInExternalStorageDir(uri)) { EventLog.writeEvent(0x534e4554, "35310991", -1, uri.getPath()); Log.e(TAG, "File based URI not in Environment.getExternalStorageDirectory() is not allowed."); return SEND_FILE_INFO_ERROR; } fileName = uri.getLastPathSegment(); contentType = type; File f = new File(uri.getPath()); Loading src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -372,8 +372,10 @@ public class BluetoothOppTransferActivity extends AlertActivity implements // retry the failed transfer Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri)); // this uri has already been examined by intent handler and // is considered from internal in the retry situation BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(this, uri, mTransInfo.mFileType); BluetoothOppSendFileInfo.generateFileInfo(this, uri, mTransInfo.mFileType, false); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mTransInfo.mFileUri = uri.toString(); Loading Loading
src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java +2 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver { // Save type/stream, will be used when adding transfer // session to DB. BluetoothOppManager.getInstance(context).saveSendingFileInfo(type, stream.toString(), true); stream.toString(), true /* isHandover */, true /* fromExternal */); } else { if (D) Log.d(TAG, "No mimeType or stream attached to handover request"); } Loading @@ -60,7 +60,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver { uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); if (mimeType != null && uris != null) { BluetoothOppManager.getInstance(context).saveSendingFileInfo(mimeType, uris, true); uris, true /* isHandover */, true /* fromExternal */); } else { if (D) Log.d(TAG, "No mimeType or stream attached to handover request"); return; Loading
src/com/android/bluetooth/opp/BluetoothOppLauncherActivity.java +6 −3 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,stream.toString(), false); .saveSendingFileInfo(type,stream.toString(), false /* isHandover */, true /* fromExternal */); //Done getting file info..Launch device picker and finish this activity launchDevicePicker(); finish(); Loading @@ -128,7 +129,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(type,fileUri.toString(), false); .saveSendingFileInfo(type,fileUri.toString(), false /* isHandover */, false /* fromExternal */); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); Loading Loading @@ -156,7 +158,8 @@ public class BluetoothOppLauncherActivity extends Activity { Thread t = new Thread(new Runnable() { public void run() { BluetoothOppManager.getInstance(BluetoothOppLauncherActivity.this) .saveSendingFileInfo(mimeType,uris, false); .saveSendingFileInfo(mimeType,uris, false /* isHandover */, true /* fromExternal */); //Done getting file info..Launch device picker //and finish this activity launchDevicePicker(); Loading
src/com/android/bluetooth/opp/BluetoothOppManager.java +4 −4 Original line number Diff line number Diff line Loading @@ -246,14 +246,14 @@ public class BluetoothOppManager { if (V) Log.v(TAG, "Application data stored to SharedPreference! "); } public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover) { public void saveSendingFileInfo(String mimeType, String uriString, boolean isHandover, boolean fromExternal) { synchronized (BluetoothOppManager.this) { mMultipleFlag = false; mMimeTypeOfSendingFile = mimeType; mIsHandoverInitiated = isHandover; Uri uri = Uri.parse(uriString); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType); BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mUriOfSendingFile = uri.toString(); Loading @@ -261,7 +261,7 @@ public class BluetoothOppManager { } } public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover) { public void saveSendingFileInfo(String mimeType, ArrayList<Uri> uris, boolean isHandover, boolean fromExternal) { synchronized (BluetoothOppManager.this) { mMultipleFlag = true; mMimeTypeOfSendingFiles = mimeType; Loading @@ -269,7 +269,7 @@ public class BluetoothOppManager { mIsHandoverInitiated = isHandover; for (Uri uri : uris) { BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType); BluetoothOppSendFileInfo.generateFileInfo(mContext, uri, mimeType, fromExternal); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); mUrisOfSendingFiles.add(uri); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); Loading
src/com/android/bluetooth/opp/BluetoothOppSendFileInfo.java +11 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.net.Uri; import android.provider.OpenableColumns; import android.util.EventLog; import android.util.Log; import java.io.File; Loading Loading @@ -98,7 +99,7 @@ public class BluetoothOppSendFileInfo { } public static BluetoothOppSendFileInfo generateFileInfo(Context context, Uri uri, String type) { String type, boolean fromExternal) { ContentResolver contentResolver = context.getContentResolver(); String scheme = uri.getScheme(); String fileName = null; Loading Loading @@ -134,6 +135,15 @@ public class BluetoothOppSendFileInfo { fileName = uri.getLastPathSegment(); } } else if ("file".equals(scheme)) { if (uri.getPath() == null) { Log.e(TAG, "Invalid URI path: " + uri); return SEND_FILE_INFO_ERROR; } if (fromExternal && !BluetoothOppUtility.isInExternalStorageDir(uri)) { EventLog.writeEvent(0x534e4554, "35310991", -1, uri.getPath()); Log.e(TAG, "File based URI not in Environment.getExternalStorageDirectory() is not allowed."); return SEND_FILE_INFO_ERROR; } fileName = uri.getLastPathSegment(); contentType = type; File f = new File(uri.getPath()); Loading
src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -372,8 +372,10 @@ public class BluetoothOppTransferActivity extends AlertActivity implements // retry the failed transfer Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri)); // this uri has already been examined by intent handler and // is considered from internal in the retry situation BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo(this, uri, mTransInfo.mFileType); BluetoothOppSendFileInfo.generateFileInfo(this, uri, mTransInfo.mFileType, false); uri = BluetoothOppUtility.generateUri(uri, sendFileInfo); BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo); mTransInfo.mFileUri = uri.toString(); Loading