summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAshwini Munigala <AshwiniM@codeaurora.org>2014-03-13 15:35:59 +0530
committerAshwini Munigala <AshwiniM@codeaurora.org>2014-03-13 15:35:59 +0530
commit7d0bd03402813fa90b1141fda75375b3f500165a (patch)
treec862734089fc2e3fc7898482db3bbd8168ad2899 /src
parent5254d40bb2b36cd42a10f4ad3c63ba5923b4e1dc (diff)
downloadandroid_packages_apps_BluetoothExt-7d0bd03402813fa90b1141fda75375b3f500165a.tar.gz
android_packages_apps_BluetoothExt-7d0bd03402813fa90b1141fda75375b3f500165a.tar.bz2
android_packages_apps_BluetoothExt-7d0bd03402813fa90b1141fda75375b3f500165a.zip
FTP: Handle FTP registration on SSR.
Check and perform FTP start socket listener from onStartCommand() if not already started from FTP Service onCreate(). CRs-fixed: 625211 Change-Id: I549dd164da7693c49038fcc29440a4a92ca32dc4
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpReceiver.java4
-rw-r--r--src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java16
2 files changed, 15 insertions, 5 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpReceiver.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpReceiver.java
index eb57b4c..f29f957 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpReceiver.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpReceiver.java
@@ -59,6 +59,8 @@ public class BluetoothFtpReceiver extends BroadcastReceiver {
* Other than Tranistioning state, start the FTP service whenever
* BT transitioned to OFF/ON, or Adapter returns error
*/
+ if(V) Log.v(TAG,"BluetoothFtpReceiver Action: " + intent.getAction()
+ + "STATE: "+state);
if ((state == BluetoothAdapter.STATE_TURNING_ON)
|| (state == BluetoothAdapter.STATE_OFF)) {
startService = false;
@@ -69,6 +71,8 @@ public class BluetoothFtpReceiver extends BroadcastReceiver {
if (adapter == null || !adapter.isEnabled()) {
startService = false;
}
+ if(V) Log.v(TAG,"BluetoothFtpReceiver Action: " + intent.getAction()
+ + "startSeervice : "+startService);
}
if (startService) {
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
index 9fe8c63..c5cf81f 100644
--- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
+++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java
@@ -240,16 +240,16 @@ public class BluetoothFtpService extends Service {
public void onCreate() {
super.onCreate();
if (VERBOSE) Log.v(TAG, "Ftp Service onCreate");
- Log.i(TAG, "FFFFFtp Service onCreate");
mAdapter = BluetoothAdapter.getDefaultAdapter();
if (!mHasStarted) {
- mHasStarted = true;
- if (VERBOSE) Log.v(TAG, "Starting FTP service");
int state = mAdapter.getState();
+ if (VERBOSE) Log.v(TAG, "FTP service not started Adapter STATE: "+state);
if (state == BluetoothAdapter.STATE_ON) {
+ if (VERBOSE) Log.v(TAG, "FTP service start listener");
+ mHasStarted = true;
mSessionStatusHandler.sendMessage(mSessionStatusHandler
.obtainMessage(MSG_INTERNAL_START_LISTENER));
}
@@ -285,7 +285,7 @@ public class BluetoothFtpService extends Service {
Log.e(TAG, "Unexpected error! action is null");
return;
}
- if (VERBOSE) Log.v(TAG, "action: " + action);
+ if (VERBOSE) Log.v(TAG, "PARSE INTENT action: " + action);
int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
boolean removeTimeoutMsg = true;
@@ -303,7 +303,13 @@ public class BluetoothFtpService extends Service {
}
// Release all resources
closeService();
- }
+ } else if (state == BluetoothAdapter.STATE_ON && !mHasStarted ) {
+
+ if (VERBOSE) Log.v(TAG, "FTP service start listener");
+ mHasStarted = true;
+ mSessionStatusHandler.sendMessage(mSessionStatusHandler
+ .obtainMessage(MSG_INTERNAL_START_LISTENER));
+ }
} else if (action.equals(ACCESS_ALLOWED_ACTION)) {
if (!isWaitingAuthorization) {
// this reply is not for us