Home
last modified time | relevance | path

Searched refs:bytes (Results 1 – 25 of 800) sorted by relevance

12345678910>>...32

/packages/modules/NetworkStack/tests/unit/src/android/net/dhcp6/
DDhcp6PacketTest.kt44 val bytes = HexDump.hexStringToByteArray(solicitHex) in testDecodeDhcp6SolicitPacket() constant
45 val packet = Dhcp6Packet.decode(bytes, bytes.size) in testDecodeDhcp6SolicitPacket()
62 val bytes = HexDump.hexStringToByteArray(solicitHex) in testDecodeDhcp6SolicitPacket_incorrectOptionLength() constant
64 Dhcp6Packet.decode(bytes, bytes.size) in testDecodeDhcp6SolicitPacket_incorrectOptionLength()
81 val bytes = HexDump.hexStringToByteArray(solicitHex) in testDecodeDhcp6SolicitPacket_lastTruncatedOption() constant
83 Dhcp6Packet.decode(bytes, bytes.size) in testDecodeDhcp6SolicitPacket_lastTruncatedOption()
100 val bytes = HexDump.hexStringToByteArray(solicitHex) in testDecodeDhcp6SolicitPacket_middleTruncatedOption() constant
102 Dhcp6Packet.decode(bytes, bytes.size) in testDecodeDhcp6SolicitPacket_middleTruncatedOption()
121 val bytes = HexDump.hexStringToByteArray(advertiseHex) in testDecodeDhcp6AdvertisePacket() constant
122 val packet = Dhcp6Packet.decode(bytes, bytes.size) in testDecodeDhcp6AdvertisePacket()
[all …]
/packages/modules/Uwb/service/java/com/android/server/uwb/util/
DDataTypeConversionUtil.java99 public static short byteArrayToI16(byte[] bytes) { in byteArrayToI16() argument
100 if (bytes.length != 2) { in byteArrayToI16()
101 throw new NumberFormatException("Expected length 2 but was " + bytes.length); in byteArrayToI16()
103 return ByteBuffer.wrap(bytes).order(ByteOrder.BIG_ENDIAN).getShort(); in byteArrayToI16()
109 public static int byteArrayToI32(byte[] bytes) { in byteArrayToI32() argument
110 if (bytes.length != 4) { in byteArrayToI32()
111 throw new NumberFormatException("Expected length 4 but was " + bytes.length); in byteArrayToI32()
113 return ByteBuffer.wrap(bytes).order(ByteOrder.BIG_ENDIAN).getInt(); in byteArrayToI32()
119 public static int arbitraryByteArrayToI32(byte[] bytes) { in arbitraryByteArrayToI32() argument
120 if (bytes.length > 4 || bytes.length < 1) { in arbitraryByteArrayToI32()
[all …]
/packages/modules/Bluetooth/floss/hcidoc/packets/
Dlib.rs16 let bytes = u64::to_le_bytes(self.0); in fmt() localVariable
20 bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0], in fmt()
26 fn from(bytes: &[u8; 6]) -> Self { in from()
28 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], 0, 0,
35 let bytes = u64::to_le_bytes(addr); in from() localVariable
36 bytes[0..6].try_into().unwrap() in from()
/packages/modules/Wifi/service/java/com/android/server/wifi/util/
DInformationElementUtil.java76 public byte[] bytes; field in InformationElementUtil.DefragmentElement
83 DefragmentElement(byte[] bytes, int start, int eid, int fid) { in DefragmentElement() argument
84 if (bytes == null) return; in DefragmentElement()
86 ByteBuffer element = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); in DefragmentElement()
123 this.bytes = defrag.toByteArray(); in DefragmentElement()
135 sb.append(HexEncoding.encode(new byte[]{(byte) e.bytes.length})); in toHexString()
136 sb.append(HexEncoding.encode(e.bytes)); in toHexString()
154 public static InformationElement[] parseInformationElements(byte[] bytes) { in parseInformationElements() argument
155 if (bytes == null) { in parseInformationElements()
158 ByteBuffer data = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN); in parseInformationElements()
[all …]
/packages/modules/Bluetooth/system/blueberry/utils/
Dbluetooth.py7 address: bytes = field(default=bytes([0, 0, 0, 0, 0, 0]))
11 self.address = bytes([0, 0, 0, 0, 0, 0])
15 self.address = bytes([int(b, 16) for b in address.split(':')])
16 elif isinstance(address, bytes) and len(address) == 6:
18 elif isinstance(address, bytes):
20 self.address = bytes([int(b, 16) for b in address.split(':')])
25 return Address(bytes([int(b, 16) for b in address.split(':')]))
27 def parse(span: bytes) -> Tuple['Address', bytes]: argument
29 return (Address(bytes(reversed(span[:6]))), span[6:])
31 def parse_all(span: bytes) -> 'Address': argument
[all …]
/packages/modules/Bluetooth/tools/rootcanal/py/
Dbluetooth.py21 address: bytes = field(default=bytes([0, 0, 0, 0, 0, 0]))
25 self.address = bytes([0, 0, 0, 0, 0, 0])
29 self.address = bytes([int(b, 16) for b in address.split(':')])
30 elif isinstance(address, (bytes, list)) and len(address) == 6:
31 self.address = bytes(address)
32 elif isinstance(address, bytes):
34 self.address = bytes([int(b, 16) for b in address.split(':')])
38 def parse(span: bytes) -> Tuple['Address', bytes]: argument
40 return (Address(bytes(reversed(span[:6]))), span[6:])
42 def parse_all(span: bytes) -> 'Address': argument
[all …]
/packages/modules/Wifi/service/tests/wifitests/src/com/android/server/wifi/util/
DInformationElementUtilTest.java118 byte[] bytes = { (byte) 0xFF, (byte) 0x00 }; in parseInformationElements_withZeroLengthAndExtensionId()
120 InformationElementUtil.parseInformationElements(bytes); in parseInformationElements_withZeroLengthAndExtensionId()
133 byte[] bytes = concatenateByteArrays(TEST_BSS_LOAD_BYTES_IE, malFormedIEbytes); in parseInformationElements_withZeroLengthAndExtensionIdAfterAnotherIe()
135 InformationElementUtil.parseInformationElements(bytes); in parseInformationElements_withZeroLengthAndExtensionIdAfterAnotherIe()
157 TEST_SSID_BYTES, results[0].bytes); in parseInformationElements_withSingleElement()
180 TEST_SSID_BYTES, results[0].bytes); in parseInformationElements_withExtraPadding()
203 TEST_SSID_BYTES, results[0].bytes); in parseInformationElements_secondElementInvalidLength()
224 TEST_SSID_BYTES, results[0].bytes); in parseInformationElements_twoElements()
227 assertEquals("second element should have data of length 1", 1, results[1].bytes.length); in parseInformationElements_twoElements()
229 (byte) 0x08, results[1].bytes[0]); in parseInformationElements_twoElements()
[all …]
/packages/modules/AdServices/adservices/tests/unittest/service-core/src/jni/java/com/android/adservices/ohttp/
DObliviousHttpKeyConfigTest.java48 byte[] bytes = BaseEncoding.base16().lowerCase().decode(keyConfigHex); in create_configuresKeyCorrectly()
50 ObliviousHttpKeyConfig keyConfig = ObliviousHttpKeyConfig.fromSerializedKeyConfig(bytes); in create_configuresKeyCorrectly()
64 byte[] bytes = BaseEncoding.base16().lowerCase().decode(keyConfigHex); in create_emptyKeyConfig_throwsError()
68 () -> ObliviousHttpKeyConfig.fromSerializedKeyConfig(bytes)); in create_emptyKeyConfig_throwsError()
74 byte[] bytes = BaseEncoding.base16().lowerCase().decode(keyConfigHex); in create_wrongKemIdLength_throwsError()
78 () -> ObliviousHttpKeyConfig.fromSerializedKeyConfig(bytes)); in create_wrongKemIdLength_throwsError()
84 byte[] bytes = BaseEncoding.base16().lowerCase().decode(keyConfigHex); in create_unsupportedKemId_throwsError()
88 () -> ObliviousHttpKeyConfig.fromSerializedKeyConfig(bytes)); in create_unsupportedKemId_throwsError()
95 byte[] bytes = BaseEncoding.base16().lowerCase().decode(keyConfigHex); in create_wrongPublicKeyLength_throwsError()
99 () -> ObliviousHttpKeyConfig.fromSerializedKeyConfig(bytes)); in create_wrongPublicKeyLength_throwsError()
[all …]
/packages/modules/Uwb/service/tests/src/com/android/server/uwb/discovery/info/
DFiraConnectorCapabilitiesTest.java79 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidProtocolVersion()
80 bytes[0] = 0x00; in fromBytes_invalidProtocolVersion()
82 IllegalArgumentException.class, () -> FiraConnectorCapabilities.fromBytes(bytes)); in fromBytes_invalidProtocolVersion()
87 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidOptimizedDataPacketSize()
88 bytes[2] = 0x00; in fromBytes_invalidOptimizedDataPacketSize()
89 bytes[3] = 0x00; in fromBytes_invalidOptimizedDataPacketSize()
91 IllegalArgumentException.class, () -> FiraConnectorCapabilities.fromBytes(bytes)); in fromBytes_invalidOptimizedDataPacketSize()
96 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidMaxMessageBufferSize()
97 bytes[4] = 0x01; in fromBytes_invalidMaxMessageBufferSize()
98 bytes[5] = 0x03; in fromBytes_invalidMaxMessageBufferSize()
[all …]
DRegulatoryInfoTest.java63 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidSourceOfInfo()
64 bytes[0] = 0x71; in fromBytes_invalidSourceOfInfo()
65 assertThat(RegulatoryInfo.fromBytes(bytes)).isNull(); in fromBytes_invalidSourceOfInfo()
70 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidReservedField()
71 bytes[0] = 0x47; in fromBytes_invalidReservedField()
72 assertThat(RegulatoryInfo.fromBytes(bytes)).isNull(); in fromBytes_invalidReservedField()
77 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in fromBytes_invalidCountryCode()
78 bytes[1] = 0x2b; in fromBytes_invalidCountryCode()
79 assertThat(RegulatoryInfo.fromBytes(bytes)).isNull(); in fromBytes_invalidCountryCode()
143 byte[] bytes = Arrays.copyOf(TEST_BYTES, TEST_BYTES.length); in testSourceOfInfo()
[all …]
/packages/modules/Bluetooth/tools/rootcanal/rust/src/
Dpackets.rs28 let bytes = u64::to_le_bytes(self.0); in fmt() localVariable
32 bytes[5], bytes[4], bytes[3], bytes[2], bytes[1], bytes[0], in fmt()
38 fn from(bytes: &[u8; 6]) -> Self { in from()
40 bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], 0, 0,
47 let bytes = u64::to_le_bytes(addr); in from() localVariable
48 bytes[0..6].try_into().unwrap() in from()
/packages/modules/Bluetooth/system/gd/hci/acl_manager/
Dclassic_impl_test.cc64 auto bytes = std::make_shared<std::vector<uint8_t>>(); in Serialize() local
65 BitInserter bi(*bytes); in Serialize()
67 return bytes; in Serialize()
71 T CreateCommandView(std::shared_ptr<std::vector<uint8_t>> bytes) { in CreateCommandView() argument
72 return T::Create(hci::CommandView::Create(hci::PacketView<hci::kLittleEndian>(bytes))); in CreateCommandView()
76 T CreateAclCommandView(std::shared_ptr<std::vector<uint8_t>> bytes) { in CreateAclCommandView() argument
77 return T::Create(CreateCommandView<hci::AclCommandView>(bytes)); in CreateAclCommandView()
81 T CreateConnectionManagementCommandView(std::shared_ptr<std::vector<uint8_t>> bytes) { in CreateConnectionManagementCommandView() argument
82 return T::Create(CreateAclCommandView<hci::ConnectionManagementCommandView>(bytes)); in CreateConnectionManagementCommandView()
86 T CreateSecurityCommandView(std::shared_ptr<std::vector<uint8_t>> bytes) { in CreateSecurityCommandView() argument
[all …]
/packages/modules/Bluetooth/system/bta/gatt/
Dbta_gattc_db_storage.cc173 std::vector<uint8_t>& bytes) { in SerializeStoredAttribute() argument
174 size_t original_size = bytes.size(); in SerializeStoredAttribute()
176 bytes.push_back(attr.handle & 0xff); in SerializeStoredAttribute()
177 bytes.push_back(attr.handle >> 8); in SerializeStoredAttribute()
179 bytes.insert(bytes.cend(), uuid.cbegin(), uuid.cend()); in SerializeStoredAttribute()
187 bytes.insert(bytes.cend(), uuid.cbegin(), uuid.cend()); in SerializeStoredAttribute()
188 bytes.push_back(attr.value.service.end_handle & 0xff); in SerializeStoredAttribute()
189 bytes.push_back(attr.value.service.end_handle >> 8); in SerializeStoredAttribute()
193 bytes.push_back(attr.value.included_service.handle & 0xff); in SerializeStoredAttribute()
194 bytes.push_back(attr.value.included_service.handle >> 8); in SerializeStoredAttribute()
[all …]
/packages/modules/Bluetooth/system/gd/packet/
Dbit_inserter_unittest.cc31 std::vector<uint8_t> bytes; in TEST() local
32 BitInserter it(bytes); in TEST()
41 ASSERT_EQ(result.size(), bytes.size()); in TEST()
42 for (size_t i = 0; i < bytes.size(); i++) { in TEST()
43 ASSERT_EQ(result[i], bytes[i]); in TEST()
48 std::vector<uint8_t> bytes; in TEST() local
49 BitInserter it(bytes); in TEST()
62 ASSERT_EQ(result.size(), bytes.size()); in TEST()
63 for (size_t i = 0; i < bytes.size(); i++) { in TEST()
64 ASSERT_EQ(result[i], bytes[i]); in TEST()
[all …]
/packages/modules/Bluetooth/pandora/server/bumble_experimental/
Dasha.py65 def on_volume_write(connection: Connection, value: bytes) -> None: argument
70 def on_audio_control_point_write(connection: Connection, value: bytes) -> None: argument
103 def on_read_only_properties_read(connection: Connection) -> bytes:
105 bytes(
111 + bytes(self.hisyncid)
112 + bytes(AshaGattService.FEATURE_MAP)
113 + bytes(AshaGattService.RENDER_DELAY)
114 + bytes(AshaGattService.RESERVED_FOR_FUTURE_USE)
115 + bytes(AshaGattService.SUPPORTED_CODEC_ID)
120 def on_le_psm_out_read(connection: Connection) -> bytes:
[all …]
/packages/modules/Connectivity/nearby/service/java/com/android/server/nearby/util/
DHex.java35 public static String bytesToStringLowercase(byte[] bytes) { in bytesToStringLowercase() argument
36 char[] hexChars = new char[bytes.length * 2]; in bytesToStringLowercase()
38 for (byte aByte : bytes) { in bytesToStringLowercase()
49 public static String bytesToStringUppercase(byte[] bytes) { in bytesToStringUppercase() argument
50 return bytesToStringUppercase(bytes, false /* zeroTerminated */); in bytesToStringUppercase()
54 public static String bytesToStringUppercase(byte[] bytes, boolean zeroTerminated) { in bytesToStringUppercase() argument
55 int length = bytes.length; in bytesToStringUppercase()
58 if (zeroTerminated && i == length - 1 && (bytes[i] & 0xff) == 0) { in bytesToStringUppercase()
61 out.append(HEX_UPPERCASE[(bytes[i] & 0xf0) >>> 4]); in bytesToStringUppercase()
62 out.append(HEX_UPPERCASE[bytes[i] & 0x0f]); in bytesToStringUppercase()
/packages/modules/Connectivity/nearby/service/java/com/android/server/nearby/presence/
DDataElementHeader.java113 @Nonnull byte[] bytes) {
114 Objects.requireNonNull(bytes, "Data parsed in for DataElement should not be null.");
116 if (bytes.length == 0) {
120 if (bytes.length == 1) {
121 if (isExtending(bytes[0])) {
125 getTypeSingleByte(bytes[0]), getLengthSingleByte(bytes[0]));
131 if (!isExtending(bytes[0]) || isExtending(bytes[bytes.length - 1])) {
136 getTypeMultipleBytes(Arrays.copyOfRange(bytes, 1, bytes.length)),
137 getHeaderValue(bytes[0]));
/packages/apps/Messaging/src/com/android/messaging/mmslib/pdu/
DQuotedPrintable.java39 public static final byte[] decodeQuotedPrintable(byte[] bytes) { in decodeQuotedPrintable() argument
40 if (bytes == null) { in decodeQuotedPrintable()
44 for (int i = 0; i < bytes.length; i++) { in decodeQuotedPrintable()
45 int b = bytes[i]; in decodeQuotedPrintable()
48 if ('\r' == (char) bytes[i + 1] && in decodeQuotedPrintable()
49 '\n' == (char) bytes[i + 2]) { in decodeQuotedPrintable()
53 int u = Character.digit((char) bytes[++i], 16); in decodeQuotedPrintable()
54 int l = Character.digit((char) bytes[++i], 16); in decodeQuotedPrintable()
/packages/apps/Messaging/src/android/support/v7/mms/pdu/
DQuotedPrintable.java39 public static final byte[] decodeQuotedPrintable(byte[] bytes) { in decodeQuotedPrintable() argument
40 if (bytes == null) { in decodeQuotedPrintable()
44 for (int i = 0; i < bytes.length; i++) { in decodeQuotedPrintable()
45 int b = bytes[i]; in decodeQuotedPrintable()
48 if('\r' == (char)bytes[i + 1] && in decodeQuotedPrintable()
49 '\n' == (char)bytes[i + 2]) { in decodeQuotedPrintable()
53 int u = Character.digit((char) bytes[++i], 16); in decodeQuotedPrintable()
54 int l = Character.digit((char) bytes[++i], 16); in decodeQuotedPrintable()
/packages/modules/Bluetooth/system/gd/common/
Dbyte_array.h42 ByteArray(std::array<uint8_t, kLength> a) : bytes(std::move(a)) {} in ByteArray()
44 std::array<uint8_t, kLength> bytes = {}; variable
47 return bytes.data(); in data()
51 return bytes.data(); in data()
56 return bytes < rhs.bytes;
59 return bytes == rhs.bytes;
76 return common::ToHexString(bytes.begin(), bytes.end()); in ToString()
/packages/apps/Gallery2/gallerycommon/src/com/android/gallery3d/common/
DFingerprint.java67 public Fingerprint(byte[] bytes) { in Fingerprint() argument
68 if ((bytes == null) || (bytes.length != FINGERPRINT_BYTE_LENGTH)) { in Fingerprint()
71 mMd5Digest = bytes; in Fingerprint()
87 byte[] bytes = new byte[8192]; in fromInputStream()
90 int n = in.read(bytes); in fromInputStream()
112 byte[] bytes = new byte[FINGERPRINT_BYTE_LENGTH]; in fromStreamId()
117 bytes[byteIdx++] = (byte) (value & 0xff); in fromStreamId()
119 return new Fingerprint(bytes); in fromStreamId()
180 private static void appendHexFingerprint(StringBuilder sb, byte[] bytes) { in appendHexFingerprint() argument
182 int value = bytes[idx]; in appendHexFingerprint()
/packages/modules/GeoTZ/s2storage/src/write/java/com/android/storage/io/write/
DTypedOutputStream.java92 public void writeBytes(byte[] bytes) throws IOException { in writeBytes() argument
93 mDataOutputStream.write(bytes); in writeBytes()
99 public void writeBytes(byte[] bytes, int off, int len) throws IOException { in writeBytes() argument
100 mDataOutputStream.write(bytes, off, len); in writeBytes()
106 public void writeTinyByteArray(byte[] bytes) throws IOException { in writeTinyByteArray() argument
107 writeUnsignedByte(bytes.length); in writeTinyByteArray()
108 mDataOutputStream.write(bytes); in writeTinyByteArray()
114 public void writeByteArray(byte[] bytes) throws IOException { in writeByteArray() argument
115 writeInt(bytes.length); in writeByteArray()
116 mDataOutputStream.write(bytes); in writeByteArray()
/packages/modules/Bluetooth/system/gd/rust/linux/utils/src/
Dadv_parser.rs52 pub fn extract_flags(bytes: &[u8]) -> u8 { in extract_flags()
53 iterate_adv_data(bytes, FLAGS).next().map_or(0, |v| v[0]) in extract_flags()
57 pub fn extract_service_uuids(bytes: &[u8]) -> Vec<Uuid> { in extract_service_uuids()
58 iterate_adv_data(bytes, COMPLETE_LIST_16_BIT_SERVICE_UUIDS) in extract_service_uuids()
62 iterate_adv_data(bytes, COMPLETE_LIST_32_BIT_SERVICE_UUIDS) in extract_service_uuids()
67 iterate_adv_data(bytes, COMPLETE_LIST_128_BIT_SERVICE_UUIDS) in extract_service_uuids()
75 pub fn extract_name(bytes: &[u8]) -> String { in extract_name()
76 iterate_adv_data(bytes, COMPLETE_LOCAL_NAME) in extract_name()
78 .or(iterate_adv_data(bytes, SHORTENED_LOCAL_NAME).next()) in extract_name()
83 pub fn extract_service_data(bytes: &[u8]) -> HashMap<String, Vec<u8>> { in extract_service_data()
[all …]
/packages/modules/Bluetooth/system/gd/rust/linux/stack/src/
Dbluetooth_adv.rs285 for (ad_type, bytes) in
286 ad_types.iter().zip(bytes_list.iter()).filter(|(_, bytes)| bytes.len() > 0)
288 AdvertiseData::append_adv_data(dest, *ad_type, bytes);
346 let mut bytes = Vec::<u8>::new(); in make_with() localVariable
348 AdvertiseData::append_device_name(&mut bytes, device_name); in make_with()
352 AdvertiseData::append_adv_data(&mut bytes, TX_POWER_LEVEL, &[0]); in make_with()
354 AdvertiseData::append_manufacturer_data(&mut bytes, &self.manufacturer_data); in make_with()
355 AdvertiseData::append_service_uuids(&mut bytes, &self.service_uuids); in make_with()
356 AdvertiseData::append_service_data(&mut bytes, &self.service_data); in make_with()
357 AdvertiseData::append_solicit_uuids(&mut bytes, &self.solicit_uuids); in make_with()
[all …]
/packages/modules/Bluetooth/system/rust/src/core/
Duuid.rs24 fn new_from_le_bytes(mut bytes: [u8; 16]) -> Self { in new_from_le_bytes()
25 bytes.reverse();
26 Self(bytes)
40 let bytes = value.get_data_iter().collect::<Vec<_>>(); in try_from() localVariable
41 Ok(match bytes.len() { in try_from()
42 2 => Self::new(u16::from_le_bytes([bytes[0], bytes[1]]) as u32), in try_from()
43 4 => Self::new(u32::from_le_bytes([bytes[0], bytes[1], bytes[2], bytes[3]])), in try_from()
46 bytes.try_into().map_err(|_| ParseError::OutOfBoundsAccess)?, in try_from()

12345678910>>...32