summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Shivpure <nshivpur@codeaurora.org>2015-10-30 11:41:48 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-30 03:29:24 -0700
commitf1779be3ab0cb103d64df2abedbd7ee04e3683ee (patch)
tree4429eab546137a82a0c9be1c3375c7ba7c53cf7b
parent21a3e3da140c644d7f4ef7743749f23dc63bb217 (diff)
downloadandroid_packages_apps_BluetoothExt-f1779be3ab0cb103d64df2abedbd7ee04e3683ee.tar.gz
android_packages_apps_BluetoothExt-f1779be3ab0cb103d64df2abedbd7ee04e3683ee.tar.bz2
android_packages_apps_BluetoothExt-f1779be3ab0cb103d64df2abedbd7ee04e3683ee.zip
Bluetooth: Create ftp sdp record in accept thread
A case, where BT On/Off is running into loop, In failure case it was stuck while creating ftp record, which was processing in bt process main thread, which leads ANR. Hence creating ftp sdp record in accept thread to avoid ANR. CRs-fixed: 931421 Change-Id: Id6938a8c51e44b787c68ca6a5a551856bdff0f89
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
index 5d16d65..c231e41 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
@@ -404,12 +404,6 @@ public class BluetoothFtpService extends Service {
VERBOSE = Log.isLoggable(BluetoothFtpService.LOG_TAG, Log.VERBOSE) ? true : false;
Log.v(TAG, "Ftp Service startRfcommSocketListener");
- if (mRfcommServerSocket == null) {
- if (!initRfcommSocket()) {
- closeService();
- return;
- }
- }
if (mRfcommAcceptThread == null) {
mRfcommAcceptThread = new RfcommSocketAcceptThread();
mRfcommAcceptThread.setName("BluetoothFtpRfcommAcceptThread");
@@ -425,7 +419,7 @@ public class BluetoothFtpService extends Service {
// It's possible that create will fail in some cases. retry for 10 times
for (int i = 0; i < CREATE_RETRY_TIME && !mInterrupted; i++) {
try {
- // It is mandatory for PSE to support initiation of bonding and
+ // It is mandatory for FTP to support initiation of bonding and
// encryption.
mRfcommServerSocket = mAdapter.listenUsingRfcommWithServiceRecord("OBEX File Transfer", FileTransfer.getUuid());
initSocketOK = true;
@@ -645,6 +639,14 @@ public class BluetoothFtpService extends Service {
@Override
public void run() {
+
+ if (mRfcommServerSocket == null) {
+ if (!initRfcommSocket()) {
+ closeService();
+ return;
+ }
+ }
+
while (!stopped && mRfcommServerSocket != null) {
try {
Log.v(RTAG,"Run Accept thread");