diff options
3 files changed, 14 insertions, 9 deletions
diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java index 524d16a74..44f2cf844 100755 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -1768,8 +1768,7 @@ public class AdapterService extends Service { if (!pref.contains(device.getAddress())) { return BluetoothDevice.ACCESS_UNKNOWN; } - return pref.getBoolean(device.getAddress(), false) - ? BluetoothDevice.ACCESS_ALLOWED : BluetoothDevice.ACCESS_REJECTED; + return pref.getInt(device.getAddress(), BluetoothDevice.ACCESS_UNKNOWN); } boolean setPhonebookAccessPermission(BluetoothDevice device, int value) { @@ -1781,7 +1780,7 @@ public class AdapterService extends Service { if (value == BluetoothDevice.ACCESS_UNKNOWN) { editor.remove(device.getAddress()); } else { - editor.putBoolean(device.getAddress(), value == BluetoothDevice.ACCESS_ALLOWED); + editor.putInt(device.getAddress(), value); } return editor.commit(); } diff --git a/src/com/android/bluetooth/map/BluetoothMapService.java b/src/com/android/bluetooth/map/BluetoothMapService.java index 413cd51d1..7582766b1 100644 --- a/src/com/android/bluetooth/map/BluetoothMapService.java +++ b/src/com/android/bluetooth/map/BluetoothMapService.java @@ -1029,7 +1029,7 @@ public class BluetoothMapService extends ProfileService { } } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY)) { int requestType = intent.getIntExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, - BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS); + BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS); if (DEBUG) Log.d(TAG, "Received ACTION_CONNECTION_ACCESS_REPLY:" + requestType + "isWaitingAuthorization:" + isWaitingAuthorization); if ((!isWaitingAuthorization) || diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapService.java b/src/com/android/bluetooth/pbap/BluetoothPbapService.java index f0f42337f..62787b4fe 100644 --- a/src/com/android/bluetooth/pbap/BluetoothPbapService.java +++ b/src/com/android/bluetooth/pbap/BluetoothPbapService.java @@ -178,6 +178,9 @@ public class BluetoothPbapService extends Service { private int mStartId = -1; + // PBAP Client has sent pbap connection request + private final static int PBAP_CONNECT_RECEIVED = 3; + //private IBluetooth mBluetoothService; private boolean mIsWaitingAuthorization = false; @@ -295,9 +298,9 @@ public class BluetoothPbapService extends Service { if (intent.getBooleanExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, false)) { boolean result = mRemoteDevice.setPhonebookAccessPermission( - BluetoothDevice.ACCESS_ALLOWED); + PBAP_CONNECT_RECEIVED); if (VERBOSE) { - Log.v(TAG, "setPhonebookAccessPermission(ACCESS_ALLOWED) result=" + Log.v(TAG, "setPhonebookAccessPermission(PBAP_CONNECT_RECEIVED) result=" + result); } } @@ -614,12 +617,15 @@ public class BluetoothPbapService extends Service { int permission = mRemoteDevice.getPhonebookAccessPermission(); if (VERBOSE) Log.v(TAG, "getPhonebookAccessPermission() = " + permission); - if (permission == BluetoothDevice.ACCESS_ALLOWED) { + if (permission == BluetoothDevice.ACCESS_ALLOWED || + permission == PBAP_CONNECT_RECEIVED) { try { if (VERBOSE) { Log.v(TAG, "incoming connection accepted from: " + sRemoteDeviceName + " automatically as already allowed device"); } + // update permission access request + mRemoteDevice.setPhonebookAccessPermission(PBAP_CONNECT_RECEIVED); startObexServerSession(); } catch (IOException ex) { Log.e(TAG, "Caught exception starting obex server session" @@ -756,8 +762,8 @@ public class BluetoothPbapService extends Service { int prevState = mState; mState = state; Intent intent = new Intent(BluetoothPbap.PBAP_STATE_CHANGED_ACTION); - intent.putExtra(BluetoothPbap.PBAP_PREVIOUS_STATE, prevState); - intent.putExtra(BluetoothPbap.PBAP_STATE, mState); + intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); + intent.putExtra(BluetoothProfile.EXTRA_STATE, mState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); sendBroadcast(intent, BLUETOOTH_PERM); AdapterService s = AdapterService.getAdapterService(); |