summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmriti Gupta <smritig@codeaurora.org>2014-09-12 22:08:48 +0530
committerLinux Build Service Account <lnxbuild@localhost>2014-11-04 08:45:06 -0700
commit5e222c92ec44e9317d2534d4d9f5c917b9a71f53 (patch)
tree08d87bb3675f17e42514ce4a3f1d894e495d6c11
parent52a2d3e9c6e80f3ce91d81d5ef7a8dad759afb54 (diff)
downloadandroid_frameworks_opt_bluetooth-5e222c92ec44e9317d2534d4d9f5c917b9a71f53.tar.gz
android_frameworks_opt_bluetooth-5e222c92ec44e9317d2534d4d9f5c917b9a71f53.tar.bz2
android_frameworks_opt_bluetooth-5e222c92ec44e9317d2534d4d9f5c917b9a71f53.zip
Bluetooth: Fix to avoid BTTestApp crash while disconnecting PBAPC
A case, where DUT is downloading contacts from remote using PBAP client. While download is in progress, Disconnect the PBAP session from DUT. ANR is occurred & BTtest APP gets crashed. This patch will solve the issue This change also avoids a null pointer exception occuring with some of the remote servers. Change-Id: I3f5e5a87c66c6d7dc28ea18d6173cca7470b4730 CRs-Fixed: 645818
-rw-r--r--src/android/bluetooth/client/pbap/BluetoothPbapCard.java5
-rw-r--r--src/android/bluetooth/client/pbap/BluetoothPbapObexSession.java6
2 files changed, 10 insertions, 1 deletions
diff --git a/src/android/bluetooth/client/pbap/BluetoothPbapCard.java b/src/android/bluetooth/client/pbap/BluetoothPbapCard.java
index 6c4fadc..49678cf 100644
--- a/src/android/bluetooth/client/pbap/BluetoothPbapCard.java
+++ b/src/android/bluetooth/client/pbap/BluetoothPbapCard.java
@@ -50,7 +50,10 @@ public class BluetoothPbapCard {
* format is as for vCard N field, so we have up to 5 tokens: LastName;
* FirstName; MiddleName; Prefix; Suffix
*/
- String[] parsedName = name.split(";", 5);
+ String[] parsedName = new String[0];
+
+ if ((name != null) && (!(name.isEmpty())))
+ parsedName = name.split(";", 5);
lastName = parsedName.length < 1 ? null : parsedName[0];
firstName = parsedName.length < 2 ? null : parsedName[1];
diff --git a/src/android/bluetooth/client/pbap/BluetoothPbapObexSession.java b/src/android/bluetooth/client/pbap/BluetoothPbapObexSession.java
index 8236f8e..7fd4eed 100644
--- a/src/android/bluetooth/client/pbap/BluetoothPbapObexSession.java
+++ b/src/android/bluetooth/client/pbap/BluetoothPbapObexSession.java
@@ -66,6 +66,7 @@ final class BluetoothPbapObexSession {
if (mObexClientThread != null) {
try {
+ abort();
mObexClientThread.interrupt();
mObexClientThread.join();
mObexClientThread = null;
@@ -82,6 +83,7 @@ final class BluetoothPbapObexSession {
* since abort may block until complete GET is processed inside OBEX
* session, let's run it in separate thread so it won't block UI
*/
+ Log.d(TAG, "aborting the ongoing request");
Thread t = new Thread(new Runnable() {
public void run () {
if (mObexClientThread != null && mObexClientThread.mRequest != null) {
@@ -148,15 +150,18 @@ final class BluetoothPbapObexSession {
synchronized (this) {
try {
if (mRequest == null) {
+ Log.d(TAG, "waiting for request");
this.wait();
}
} catch (InterruptedException e) {
+ Log.d(TAG, "Interrupted");
mRunning = false;
break;
}
}
if (mRunning && mRequest != null) {
+ Log.d(TAG, "before executing the request mRunning:" + mRunning);
try {
mRequest.execute(mClientSession);
} catch (IOException e) {
@@ -171,6 +176,7 @@ final class BluetoothPbapObexSession {
mSessionHandler.obtainMessage(OBEX_SESSION_REQUEST_FAILED, mRequest)
.sendToTarget();
}
+ Log.d(TAG, "after executing the request mRunning:" + mRunning);
}
mRequest = null;