private boolean internalWriteDescriptor(
			@Nullable final BluetoothGattDescriptor descriptor,
			@Nullable final byte[] data
	) {
		final BluetoothGatt gatt = bluetoothGatt;
		if (gatt == null || descriptor == null || !connected)
			return false;

		try {
			final byte[] notNullData = data != null ? data : new byte[] {};
			log(Log.VERBOSE, () -> "Writing descriptor " + descriptor.getUuid());
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
				log(Log.DEBUG, () -> "gatt.writeDescriptor(" + descriptor.getUuid() +
						", value=" + ParserUtils.parseDebug(notNullData) + ")");
				return gatt.writeDescriptor(descriptor, notNullData) == BluetoothStatusCodes.SUCCESS;
			} else {
				log(Log.DEBUG, () -> "descriptor.setValue(" + descriptor.getUuid() + ")");
				descriptor.setValue(notNullData);
				log(Log.DEBUG, () -> "gatt.writeDescriptor(" + descriptor.getUuid() + ")");
				if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
					return internalWriteDescriptorWorkaround(descriptor);
				} else {
					return gatt.writeDescriptor(descriptor);
				}
			}
		} catch (final SecurityException e) {
			log(Log.ERROR, e::getLocalizedMessage);
			return false;
		}
	}
Returns the Client Characteristic Config Descriptor if the characteristic has the
required property. It may return null if the CCCD is not there.

@param characteristic   the characteristic to look the CCCD in.
@param requiredProperty the required property: {@link BluetoothGattCharacteristic#PROPERTY_NOTIFY}
                        or {@link BluetoothGattCharacteristic#PROPERTY_INDICATE}.
@return The CCC descriptor or null if characteristic is null, if it doesn't have the
required property, or if the CCCD is missing.
ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java