summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2009-09-01 13:46:01 -0700
committerNick Pelly <npelly@google.com>2009-09-01 13:46:01 -0700
commitfa5d402906010cd17c8ed7de0dbcbfdcb78dab20 (patch)
tree89cd798fed97303c81f892f532a123020ebb910d /src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
parent888485a3f5fe991116c5536bb6d6903d47b63a70 (diff)
downloadandroid_packages_apps_Bluetooth-fa5d402906010cd17c8ed7de0dbcbfdcb78dab20.tar.gz
android_packages_apps_Bluetooth-fa5d402906010cd17c8ed7de0dbcbfdcb78dab20.tar.bz2
android_packages_apps_Bluetooth-fa5d402906010cd17c8ed7de0dbcbfdcb78dab20.zip
Workaround bug in Poloroid Pogo.
Rename extra dots to underscores. Working with Poloroid to get an updated list of affected MAC addresses. For now we just have 00:04:48.
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
index 92305bd02..0b240f1c5 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppObexClientSession.java
@@ -296,7 +296,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
if (V) Log.v(TAG, "Client thread processShareInfo() " + mInfo.mId);
BluetoothOppSendFileInfo fileInfo = BluetoothOppSendFileInfo.generateFileInfo(
- mContext1, mInfo.mUri, mInfo.mMimetype);
+ mContext1, mInfo.mUri, mInfo.mMimetype, mInfo.mDestination);
if (fileInfo.mFileName == null || fileInfo.mLength == 0) {
if (V) Log.v(TAG, "BluetoothOppSendFileInfo get invalid file");
Constants.updateShareStatus(mContext1, mInfo.mId, fileInfo.mStatus);
@@ -333,6 +333,8 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
request.setHeader(HeaderSet.NAME, fileInfo.mFileName);
request.setHeader(HeaderSet.TYPE, fileInfo.mMimetype);
+ applyRemoteDeviceQuirks(request, fileInfo);
+
Constants.updateShareStatus(mContext1, mInfo.mId, BluetoothShare.STATUS_RUNNING);
request.setHeader(HeaderSet.LENGTH, fileInfo.mLength);
@@ -546,6 +548,40 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
}
}
+ public static void applyRemoteDeviceQuirks(HeaderSet request, BluetoothOppSendFileInfo info) {
+ String address = info.mDestAddr;
+ if (address == null) {
+ return;
+ }
+ if (address.startsWith("00:04:48")) {
+ // Poloroid Pogo
+ // Rejects filenames with more than one '.'. Rename to '_'.
+ // for example: 'a.b.jpg' -> 'a_b.jpg'
+ // 'abc.jpg' NOT CHANGED
+ String filename = info.mFileName;
+
+ char[] c = filename.toCharArray();
+ boolean firstDot = true;
+ boolean modified = false;
+ for (int i = c.length - 1; i >= 0; i--) {
+ if (c[i] == '.') {
+ if (!firstDot) {
+ modified = true;
+ c[i] = '_';
+ }
+ firstDot = false;
+ }
+ }
+
+ if (modified) {
+ String newFilename = new String(c);
+ request.setHeader(HeaderSet.NAME, newFilename);
+ Log.i(TAG, "Sending file \"" + filename + "\" as \"" + newFilename +
+ "\" to workaround Poloroid filename quirk");
+ }
+ }
+ }
+
public void unblock() {
// Not used for client case
}