diff options
author | Nitin Shivpure <nshivpur@codeaurora.org> | 2013-11-29 12:22:33 +0530 |
---|---|---|
committer | Nitin Shivpure <nshivpur@codeaurora.org> | 2013-11-29 16:57:14 +0530 |
commit | a880982c1f901e736bf8f044e2bcfa2cd9b49299 (patch) | |
tree | 3b6715e3a79ceb5d862900ebdc10955e415eaa46 | |
parent | 3d872f86423b16865daa7dc5fc3539d17d75417b (diff) | |
download | android_packages_apps_Bluetooth-a880982c1f901e736bf8f044e2bcfa2cd9b49299.tar.gz android_packages_apps_Bluetooth-a880982c1f901e736bf8f044e2bcfa2cd9b49299.tar.bz2 android_packages_apps_Bluetooth-a880982c1f901e736bf8f044e2bcfa2cd9b49299.zip |
Bluetooth:Fix to show authorization popup for FTP after PBAP/MAP
A case where PBAP/MAP connection was accepted before requesting
FTP connection from same remote device. So remote device was
authorized for all profiles & FTP connection is automatically
accepted. As PBAP/MAP have it's own authorization/trust mechanism
to store the user choice. So remote device should not be added
into NV trusted list(BD config file) while accepting PBAP/MAP
authorization request to solve this issue.
Change-Id: Icf781cfd93128058722d9f2ee1c070c3c8fe542d
CRs-Fixed: 568389
-rw-r--r-- | src/com/android/bluetooth/map/BluetoothMapService.java | 48 | ||||
-rw-r--r-- | src/com/android/bluetooth/pbap/BluetoothPbapService.java | 60 |
2 files changed, 34 insertions, 74 deletions
diff --git a/src/com/android/bluetooth/map/BluetoothMapService.java b/src/com/android/bluetooth/map/BluetoothMapService.java index e30bcb879..e0b9bb8d1 100644 --- a/src/com/android/bluetooth/map/BluetoothMapService.java +++ b/src/com/android/bluetooth/map/BluetoothMapService.java @@ -366,40 +366,24 @@ public class BluetoothMapService extends ProfileService { if (TextUtils.isEmpty(sRemoteDeviceName)) { sRemoteDeviceName = getString(R.string.defaultname); } - boolean trust = mRemoteDevice.getTrustState(); - if (DEBUG) Log.d(TAG, "GetTrustState() = " + trust); - - if (trust) { - try { - if (DEBUG) Log.d(TAG, "incoming connection accepted from: " - + sRemoteDeviceName + " automatically as trusted device"); - startObexServerSession(); - } catch (IOException ex) { - Log.e(TAG, "catch exception starting obex server session" - + ex.toString()); - } - } else { - Intent intent = new + Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST); - intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS); - intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, - BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); - - isWaitingAuthorization = true; - sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - - if (DEBUG) Log.d(TAG, "waiting for authorization for connection from: " - + sRemoteDeviceName); - //Queue USER_TIMEOUT to disconnect MAP OBEX session. If user doesn't - //accept or reject authorization request - removeTimeoutMsg = true; - mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler - .obtainMessage(USER_TIMEOUT), USER_CONFIRM_TIMEOUT_VALUE); + intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS); + intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, + BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS); + intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); + isWaitingAuthorization = true; + sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); + if (DEBUG) Log.d(TAG, "waiting for authorization for connection from: " + + sRemoteDeviceName); + //Queue USER_TIMEOUT to disconnect MAP OBEX session. If user doesn't + //accept or reject authorization request + removeTimeoutMsg = true; + mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler + .obtainMessage(USER_TIMEOUT), USER_CONFIRM_TIMEOUT_VALUE); - } stopped = true; // job done ,close this thread; } catch (IOException ex) { stopped=true; @@ -676,10 +660,6 @@ public class BluetoothMapService extends ProfileService { BluetoothDevice.CONNECTION_ACCESS_NO) == BluetoothDevice.CONNECTION_ACCESS_YES) { //bluetooth connection accepted by user - if (intent.getBooleanExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, false)) { - boolean result = mRemoteDevice.setTrust(true); - if (DEBUG) Log.d(TAG, "setTrust() result=" + result); - } try { if (mConnSocket != null) { // start obex server and rfcomm connection diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapService.java b/src/com/android/bluetooth/pbap/BluetoothPbapService.java index 1f7c75f3d..d73781480 100644 --- a/src/com/android/bluetooth/pbap/BluetoothPbapService.java +++ b/src/com/android/bluetooth/pbap/BluetoothPbapService.java @@ -284,11 +284,6 @@ public class BluetoothPbapService extends Service { if (intent.getIntExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, BluetoothDevice.CONNECTION_ACCESS_NO) == BluetoothDevice.CONNECTION_ACCESS_YES) { - - if (intent.getBooleanExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, false)) { - boolean result = mRemoteDevice.setTrust(true); - if (VERBOSE) Log.v(TAG, "setTrust() result=" + result); - } try { if (mConnSocket != null) { startObexServerSession(); @@ -563,42 +558,27 @@ public class BluetoothPbapService extends Service { if (TextUtils.isEmpty(sRemoteDeviceName)) { sRemoteDeviceName = getString(R.string.defaultname); } - boolean trust = mRemoteDevice.getTrustState(); - if (VERBOSE) Log.v(TAG, "GetTrustState() = " + trust); - - if (trust) { - try { - if (VERBOSE) Log.v(TAG, "incoming connection accepted from: " - + sRemoteDeviceName + " automatically as trusted device"); - startObexServerSession(); - } catch (IOException ex) { - Log.e(TAG, "catch exception starting obex server session" - + ex.toString()); - } - } else { - Intent intent = new + + Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST); - intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS); - intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, - BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS); - intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); - intent.putExtra(BluetoothDevice.EXTRA_PACKAGE_NAME, getPackageName()); - intent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, - BluetoothPbapReceiver.class.getName()); - - isWaitingAuthorization = true; - sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); - - if (VERBOSE) Log.v(TAG, "waiting for authorization for connection from: " - + sRemoteDeviceName); - - // In case car kit time out and try to use HFP for - // phonebook - // access, while UI still there waiting for user to - // confirm - mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler - .obtainMessage(USER_TIMEOUT), USER_CONFIRM_TIMEOUT_VALUE); - } + intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS); + intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, + BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS); + intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); + intent.putExtra(BluetoothDevice.EXTRA_PACKAGE_NAME, getPackageName()); + intent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, + BluetoothPbapReceiver.class.getName()); + + isWaitingAuthorization = true; + sendBroadcast(intent, BLUETOOTH_ADMIN_PERM); + + if (VERBOSE) Log.v(TAG, "waiting for authorization for connection from: " + + sRemoteDeviceName); + + // In case car kit time out and try to use HFP for + // phonebook access, while UI still there waiting for user to confirm + mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler + .obtainMessage(USER_TIMEOUT), USER_CONFIRM_TIMEOUT_VALUE); stopped = true; // job done ,close this thread; } catch (IOException ex) { stopped=true; |