From 54b9efa08d305293278bd391cca79e4a66ff7e7c Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Mon, 10 Nov 2014 12:49:26 +0530 Subject: FTP: Update isWaitingAuthorization as FALSE when user presses cancel This patch updtes the value of isWaitingAuthorization to FALSE when user presses cancel. Without this, authorization state was not correct in timeout, and cancel scenarios leading to authorization popup not being received at ftp layer which prevented new FTP connection until BT off and on was done CRs-Fixed: 753197 Change-Id: I685fdcc7aba54d3954c8a99a7fbe86e2da2e7773 --- src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java index 164aa4a..cd2f583 100644 --- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java +++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java @@ -83,7 +83,7 @@ public class BluetoothFtpService extends Service { //public static final boolean VERBOSE = false; public static final boolean DEBUG = true; - public static boolean VERBOSE; + public static boolean VERBOSE = true; private int mState; /** @@ -314,6 +314,7 @@ public class BluetoothFtpService extends Service { } else if (action.equals(ACCESS_ALLOWED_ACTION)) { if (!isWaitingAuthorization) { // this reply is not for us + if (VERBOSE) Log.v(TAG, "isWaitingAuthorization = " + isWaitingAuthorization); return; } @@ -336,6 +337,8 @@ public class BluetoothFtpService extends Service { } removeFtpNotification(NOTIFICATION_ID_ACCESS); } else if (action.equals(ACCESS_DISALLOWED_ACTION)) { + if (VERBOSE) Log.v(TAG, "ACCESS_DISALLOWED_ACTION"); + isWaitingAuthorization = false; stopObexServerSession(); } else if (action.equals(AUTH_RESPONSE_ACTION)) { String sessionkey = intent.getStringExtra(EXTRA_SESSION_KEY); @@ -528,6 +531,7 @@ public class BluetoothFtpService extends Service { if (VERBOSE) Log.v(TAG, "Ftp Service stopObexServerSession"); if (mServerSession != null) { + if (VERBOSE) Log.v(TAG, "stopObexServerSession, closing mServerSession"); mServerSession.close(); mServerSession = null; } @@ -535,6 +539,7 @@ public class BluetoothFtpService extends Service { mRfcommAcceptThread = null; try { + if (VERBOSE) Log.v(TAG, "stopObexServerSession, closeRfcommSocket"); closeRfcommSocket(false, true); } catch (IOException e) { Log.e(TAG, "closeSocket error: " + e.toString()); @@ -542,6 +547,7 @@ public class BluetoothFtpService extends Service { // Last obex transaction is finished, we start to listen for incoming // connection again if (mAdapter.isEnabled()) { + if (VERBOSE) Log.v(TAG, "stopObexServerSession, startRfcommSocketListener"); startRfcommSocketListener(); } } -- cgit v1.2.3