diff options
author | Pradeep Panigrahi <pradeepp@codeaurora.org> | 2013-09-16 12:09:13 +0530 |
---|---|---|
committer | Pradeep Panigrahi <pradeepp@codeaurora.org> | 2013-09-16 14:09:59 +0530 |
commit | ef1d58ef0a1612067d4bc351b2d99011df30ff91 (patch) | |
tree | b02eb77677d43a88677ada10587d097fe8015fd2 /src/org/codeaurora/bluetooth/ftp | |
parent | 0a77b74786b8e73f7ff51e5d0cbe909a38267667 (diff) | |
download | android_packages_apps_BluetoothExt-ef1d58ef0a1612067d4bc351b2d99011df30ff91.tar.gz android_packages_apps_BluetoothExt-ef1d58ef0a1612067d4bc351b2d99011df30ff91.tar.bz2 android_packages_apps_BluetoothExt-ef1d58ef0a1612067d4bc351b2d99011df30ff91.zip |
Bluetooth: Use Trust feature in SAP/FTP/MAP applications
Add change in SAP/FTP/MAP application to use bluetoth framework
api to set/get remote device trust value. This marks remote
devices as trusted devices and stores it in NVRAM for subsequent
connections.
Change-Id: I6060698b6aa9c4f7dd6ae19b7b6a6b089b895239
CRs-fixed: 523135
Diffstat (limited to 'src/org/codeaurora/bluetooth/ftp')
-rw-r--r-- | src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java index ceec144..2cb8a14 100644 --- a/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java +++ b/src/org/codeaurora/bluetooth/ftp/BluetoothFtpService.java @@ -216,7 +216,6 @@ public class BluetoothFtpService extends Service { private BluetoothSocket mConnSocket = null; - private static HashSet<BluetoothDevice> trustDevices = new HashSet<BluetoothDevice>(); private BluetoothDevice mRemoteDevice = null; private static String sRemoteDeviceName = null; @@ -313,8 +312,10 @@ public class BluetoothFtpService extends Service { isWaitingAuthorization = false; if (intent.getBooleanExtra(BluetoothFtpService.EXTRA_ALWAYS_ALLOWED, false)) { - trustDevices.add(mRemoteDevice); - Log.v(TAG, "setTrust() D: " + mRemoteDevice.getName()+ "ADDED: " + trustDevices.contains(mRemoteDevice)); + if(mRemoteDevice != null) { + mRemoteDevice.setTrust(true); + Log.v(TAG, "setTrust() TRUE " + mRemoteDevice.getName()); + } } try { if (mConnSocket != null) { @@ -350,21 +351,6 @@ public class BluetoothFtpService extends Service { removeTimeoutMsg = false; } } - } else if ( BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) { - - if (intent.hasExtra(BluetoothDevice.EXTRA_DEVICE)) { - BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - if(device != null) - Log.d(TAG,"device: "+ device.getName()); - if(mRemoteDevice != null) - Log.d(TAG," Remtedevie: "+mRemoteDevice.getName()); - if (device != null && trustDevices.contains(device) && - intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE) == BluetoothDevice.BOND_NONE) { - Log.d(TAG,"BOND_STATE_CHANGED RFRSH trustDevices"+ device.getName()); - trustDevices.remove(device); - } - } - } else { removeTimeoutMsg = false; } @@ -644,8 +630,8 @@ public class BluetoothFtpService extends Service { mSessionStatusHandler.sendMessage(mSessionStatusHandler .obtainMessage(MSG_INTERNAL_OBEX_RFCOMM_SESSION_UP)); boolean trust = false; - if (trustDevices != null) - trust = trustDevices.contains(mRemoteDevice); + if (mRemoteDevice != null) + trust = mRemoteDevice.getTrustState(); if (VERBOSE) Log.v(RTAG, "GetTrustState() = " + trust); |