/* package */ void handleAccessPermissionResult(Intent intent) { if (!mCheckingAccessPermission) { return; } HeadsetBase headset = mHandsfree.getHeadset(); // ASSERT: (headset != null) && headSet.isConnected() // REASON: mCheckingAccessPermission is true, otherwise resetAtState // has set mCheckingAccessPermission to false if (intent.getAction().equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY)) { if (intent.getIntExtra( BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, BluetoothDevice.CONNECTION_ACCESS_NO) == BluetoothDevice.CONNECTION_ACCESS_YES) { BluetoothDevice remoteDevice = headset.getRemoteDevice(); if (intent.getBooleanExtra(BluetoothDevice.EXTRA_ALWAYS_ALLOWED, false)) { remoteDevice.setTrust(true); } AtCommandResult cpbrResult = processCpbrCommand(); headset.sendURC(cpbrResult.toString()); } else { headset.sendURC("ERROR"); } } mCpbrIndex1 = mCpbrIndex2 = -1; mCheckingAccessPermission = false; }