private void updateItems() {
   if (mItems == null) return;
   Item[] items = null;
   final Collection<CachedBluetoothDevice> devices = mController.getDevices();
   if (devices != null) {
     items = new Item[getBondedCount(devices)];
     int i = 0;
     for (CachedBluetoothDevice device : devices) {
       if (device.getBondState() == BluetoothDevice.BOND_NONE) continue;
       final Item item = new Item();
       item.icon = R.drawable.ic_qs_bluetooth_on;
       item.line1 = device.getName();
       int state = device.getMaxConnectionState();
       if (state == BluetoothProfile.STATE_CONNECTED) {
         item.icon = R.drawable.ic_qs_bluetooth_connected;
         item.line2 = mContext.getString(R.string.quick_settings_connected);
         item.canDisconnect = true;
       } else if (state == BluetoothProfile.STATE_CONNECTING) {
         item.icon = R.drawable.ic_qs_bluetooth_connecting;
         item.line2 = mContext.getString(R.string.quick_settings_connecting);
       }
       item.tag = device;
       items[i++] = item;
     }
   }
   mItems.setItems(items);
 }
 @Override
 public void onDetailItemClick(Item item) {
   if (item == null || item.tag == null) return;
   final CachedBluetoothDevice device = (CachedBluetoothDevice) item.tag;
   if (device != null && device.getMaxConnectionState() == BluetoothProfile.STATE_DISCONNECTED) {
     mController.connect(device);
   }
 }
 private int getBondedCount(Collection<CachedBluetoothDevice> devices) {
   int ct = 0;
   for (CachedBluetoothDevice device : devices) {
     if (device.getBondState() != BluetoothDevice.BOND_NONE) {
       ct++;
     }
   }
   return ct;
 }
  private void onNegative() {
    if (DEBUG) Log.d(TAG, "onNegative");

    boolean always = true;
    if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
      LocalBluetoothManager bluetoothManager = Utils.getLocalBtManager(this);
      CachedBluetoothDeviceManager cachedDeviceManager = bluetoothManager.getCachedDeviceManager();
      CachedBluetoothDevice cachedDevice = cachedDeviceManager.findDevice(mDevice);
      if (cachedDevice == null) {
        cachedDevice =
            cachedDeviceManager.addDevice(
                bluetoothManager.getBluetoothAdapter(),
                bluetoothManager.getProfileManager(),
                mDevice);
      }
      always = cachedDevice.checkAndIncreaseMessageRejectionCount();
    }

    sendReplyIntentToReceiver(false, always);
  }