Loading PREUPLOAD.cfg +2 −0 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ bpfmt = -s # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp camera/ media/libaudioclient/tests/ media/libaudiohal/tests/ media/libmediatranscoding/ services/camera/virtualcamera/ services/mediatranscoding/ services/camera/libcameraservice/ camera/camera_platform.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -164,3 +164,10 @@ flag { description: "Enable stream reconfiguration for unchanged streams" bug: "341740105" } flag { namespace: "camera_platform" name: "use_context_attribution_source" description: "Use the context-provided AttributionSource when checking for client permissions" bug: "190657833" } media/audio/aconfig/audio_framework.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,14 @@ flag { bug: "316414750" } flag { name: "dolby_ac4_level4_encoding_api" namespace: "media_audio" description: "Feature flag for Dolby AC-4 level 4 AudioFormat encoding." is_fixed_read_only: true bug: "266537650" } # TODO remove flag { name: "foreground_audio_control" Loading media/audioaidlconversion/AidlConversionCppNdk.cpp +6 −32 Original line number Diff line number Diff line Loading @@ -741,6 +741,8 @@ const detail::AudioFormatPairs& getAudioFormatPairs() { {// Note: not in the IANA registry. AUDIO_FORMAT_APTX_HD, make_AudioFormatDescription("audio/vnd.qcom.aptx.hd")}, {AUDIO_FORMAT_AC4, make_AudioFormatDescription(::android::MEDIA_MIMETYPE_AUDIO_AC4)}, {AUDIO_FORMAT_AC4_L4, make_AudioFormatDescription( std::string(::android::MEDIA_MIMETYPE_AUDIO_AC4) + ";version=02.01.04")}, {// Note: not in the IANA registry. AUDIO_FORMAT_LDAC, make_AudioFormatDescription("audio/vnd.sony.ldac")}, {AUDIO_FORMAT_MAT, Loading Loading @@ -1055,14 +1057,6 @@ AudioDeviceAddress::Tag suggestDeviceAddressTag(const AudioDeviceDescription& de return OK; } namespace { // Use '01' for LSB bits 0 and 1 as Bluetooth MAC addresses are never multicast // and universaly administered constexpr std::array<uint8_t, 4> BTANON_PREFIX {0xFD, 0xFF, 0xFF, 0xFF}; // Keep sync with ServiceUtilities.cpp mustAnonymizeBluetoothAddress constexpr const char * BTANON_PREFIX_STR = "XX:XX:XX:XX:"; } ::android::status_t aidl2legacy_AudioDevice_audio_device( const AudioDevice& aidl, audio_devices_t* legacyType, std::string* legacyAddress) { Loading @@ -1077,16 +1071,8 @@ namespace { case Tag::mac: { const std::vector<uint8_t>& mac = aidl.address.get<AudioDeviceAddress::mac>(); if (mac.size() != 6) return BAD_VALUE; if (std::equal(BTANON_PREFIX.begin(), BTANON_PREFIX.end(), mac.begin())) { // special case for anonymized mac address: // change anonymized bytes back from FD:FF:FF:FF: to XX:XX:XX:XX: snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%s%02X:%02X", BTANON_PREFIX_STR, mac[4], mac[5]); } else { snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%02X:%02X:%02X:%02X:%02X:%02X", snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } } break; case Tag::ipv4: { const std::vector<uint8_t>& ipv4 = aidl.address.get<AudioDeviceAddress::ipv4>(); Loading Loading @@ -1148,20 +1134,8 @@ legacy2aidl_audio_device_AudioDevice( switch (suggestDeviceAddressTag(aidl.type)) { case Tag::mac: { std::vector<uint8_t> mac(6); int status; // special case for anonymized mac address: // change anonymized bytes so that they can be scanned as HEX bytes if (legacyAddress.starts_with(BTANON_PREFIX_STR)) { std::copy(BTANON_PREFIX.begin(), BTANON_PREFIX.end(), mac.begin()); LOG_ALWAYS_FATAL_IF(legacyAddress.length() <= strlen(BTANON_PREFIX_STR)); status = sscanf(legacyAddress.c_str() + strlen(BTANON_PREFIX_STR), "%hhX:%hhX", &mac[4], &mac[5]); status += 4; } else { status = sscanf(legacyAddress.c_str(), "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", int status = sscanf(legacyAddress.c_str(), "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); } if (status != mac.size()) { ALOGE("%s: malformed MAC address: \"%s\"", __func__, legacyAddress.c_str()); return unexpected(BAD_VALUE); Loading media/libaudioclient/tests/audio_aidl_legacy_conversion_tests.cpp +0 −19 Original line number Diff line number Diff line Loading @@ -483,27 +483,8 @@ INSTANTIATE_TEST_SUITE_P( AudioDeviceAddress::make<AudioDeviceAddress::Tag::alsa>( std::vector<int32_t>{1, 2})))); TEST(AnonymizedBluetoothAddressRoundTripTest, Legacy2Aidl2Legacy) { const std::vector<uint8_t> sAnonymizedAidlAddress {0xFD, 0xFF, 0xFF, 0xFF, 0xAB, 0xCD}; const std::string sAnonymizedLegacyAddress = std::string("XX:XX:XX:XX:AB:CD"); auto device = legacy2aidl_audio_device_AudioDevice(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP, sAnonymizedLegacyAddress); ASSERT_TRUE(device.ok()); ASSERT_EQ(AudioDeviceAddress::Tag::mac, device.value().address.getTag()); ASSERT_EQ(sAnonymizedAidlAddress, device.value().address.get<AudioDeviceAddress::mac>()); audio_devices_t legacyType; std::string legacyAddress; status_t status = aidl2legacy_AudioDevice_audio_device(device.value(), &legacyType, &legacyAddress); ASSERT_EQ(OK, status); EXPECT_EQ(legacyType, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP); EXPECT_EQ(sAnonymizedLegacyAddress, legacyAddress); } class AudioFormatDescriptionRoundTripTest : public testing::TestWithParam<AudioFormatDescription> { }; TEST_P(AudioFormatDescriptionRoundTripTest, Aidl2Legacy2Aidl) { const auto initial = GetParam(); auto conv = aidl2legacy_AudioFormatDescription_audio_format_t(initial); Loading Loading
PREUPLOAD.cfg +2 −0 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ bpfmt = -s # Only turn on clang-format check for the following subfolders. clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp camera/ media/libaudioclient/tests/ media/libaudiohal/tests/ media/libmediatranscoding/ services/camera/virtualcamera/ services/mediatranscoding/ services/camera/libcameraservice/
camera/camera_platform.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -164,3 +164,10 @@ flag { description: "Enable stream reconfiguration for unchanged streams" bug: "341740105" } flag { namespace: "camera_platform" name: "use_context_attribution_source" description: "Use the context-provided AttributionSource when checking for client permissions" bug: "190657833" }
media/audio/aconfig/audio_framework.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,14 @@ flag { bug: "316414750" } flag { name: "dolby_ac4_level4_encoding_api" namespace: "media_audio" description: "Feature flag for Dolby AC-4 level 4 AudioFormat encoding." is_fixed_read_only: true bug: "266537650" } # TODO remove flag { name: "foreground_audio_control" Loading
media/audioaidlconversion/AidlConversionCppNdk.cpp +6 −32 Original line number Diff line number Diff line Loading @@ -741,6 +741,8 @@ const detail::AudioFormatPairs& getAudioFormatPairs() { {// Note: not in the IANA registry. AUDIO_FORMAT_APTX_HD, make_AudioFormatDescription("audio/vnd.qcom.aptx.hd")}, {AUDIO_FORMAT_AC4, make_AudioFormatDescription(::android::MEDIA_MIMETYPE_AUDIO_AC4)}, {AUDIO_FORMAT_AC4_L4, make_AudioFormatDescription( std::string(::android::MEDIA_MIMETYPE_AUDIO_AC4) + ";version=02.01.04")}, {// Note: not in the IANA registry. AUDIO_FORMAT_LDAC, make_AudioFormatDescription("audio/vnd.sony.ldac")}, {AUDIO_FORMAT_MAT, Loading Loading @@ -1055,14 +1057,6 @@ AudioDeviceAddress::Tag suggestDeviceAddressTag(const AudioDeviceDescription& de return OK; } namespace { // Use '01' for LSB bits 0 and 1 as Bluetooth MAC addresses are never multicast // and universaly administered constexpr std::array<uint8_t, 4> BTANON_PREFIX {0xFD, 0xFF, 0xFF, 0xFF}; // Keep sync with ServiceUtilities.cpp mustAnonymizeBluetoothAddress constexpr const char * BTANON_PREFIX_STR = "XX:XX:XX:XX:"; } ::android::status_t aidl2legacy_AudioDevice_audio_device( const AudioDevice& aidl, audio_devices_t* legacyType, std::string* legacyAddress) { Loading @@ -1077,16 +1071,8 @@ namespace { case Tag::mac: { const std::vector<uint8_t>& mac = aidl.address.get<AudioDeviceAddress::mac>(); if (mac.size() != 6) return BAD_VALUE; if (std::equal(BTANON_PREFIX.begin(), BTANON_PREFIX.end(), mac.begin())) { // special case for anonymized mac address: // change anonymized bytes back from FD:FF:FF:FF: to XX:XX:XX:XX: snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%s%02X:%02X", BTANON_PREFIX_STR, mac[4], mac[5]); } else { snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%02X:%02X:%02X:%02X:%02X:%02X", snprintf(addressBuffer, AUDIO_DEVICE_MAX_ADDRESS_LEN, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } } break; case Tag::ipv4: { const std::vector<uint8_t>& ipv4 = aidl.address.get<AudioDeviceAddress::ipv4>(); Loading Loading @@ -1148,20 +1134,8 @@ legacy2aidl_audio_device_AudioDevice( switch (suggestDeviceAddressTag(aidl.type)) { case Tag::mac: { std::vector<uint8_t> mac(6); int status; // special case for anonymized mac address: // change anonymized bytes so that they can be scanned as HEX bytes if (legacyAddress.starts_with(BTANON_PREFIX_STR)) { std::copy(BTANON_PREFIX.begin(), BTANON_PREFIX.end(), mac.begin()); LOG_ALWAYS_FATAL_IF(legacyAddress.length() <= strlen(BTANON_PREFIX_STR)); status = sscanf(legacyAddress.c_str() + strlen(BTANON_PREFIX_STR), "%hhX:%hhX", &mac[4], &mac[5]); status += 4; } else { status = sscanf(legacyAddress.c_str(), "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", int status = sscanf(legacyAddress.c_str(), "%hhX:%hhX:%hhX:%hhX:%hhX:%hhX", &mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); } if (status != mac.size()) { ALOGE("%s: malformed MAC address: \"%s\"", __func__, legacyAddress.c_str()); return unexpected(BAD_VALUE); Loading
media/libaudioclient/tests/audio_aidl_legacy_conversion_tests.cpp +0 −19 Original line number Diff line number Diff line Loading @@ -483,27 +483,8 @@ INSTANTIATE_TEST_SUITE_P( AudioDeviceAddress::make<AudioDeviceAddress::Tag::alsa>( std::vector<int32_t>{1, 2})))); TEST(AnonymizedBluetoothAddressRoundTripTest, Legacy2Aidl2Legacy) { const std::vector<uint8_t> sAnonymizedAidlAddress {0xFD, 0xFF, 0xFF, 0xFF, 0xAB, 0xCD}; const std::string sAnonymizedLegacyAddress = std::string("XX:XX:XX:XX:AB:CD"); auto device = legacy2aidl_audio_device_AudioDevice(AUDIO_DEVICE_OUT_BLUETOOTH_A2DP, sAnonymizedLegacyAddress); ASSERT_TRUE(device.ok()); ASSERT_EQ(AudioDeviceAddress::Tag::mac, device.value().address.getTag()); ASSERT_EQ(sAnonymizedAidlAddress, device.value().address.get<AudioDeviceAddress::mac>()); audio_devices_t legacyType; std::string legacyAddress; status_t status = aidl2legacy_AudioDevice_audio_device(device.value(), &legacyType, &legacyAddress); ASSERT_EQ(OK, status); EXPECT_EQ(legacyType, AUDIO_DEVICE_OUT_BLUETOOTH_A2DP); EXPECT_EQ(sAnonymizedLegacyAddress, legacyAddress); } class AudioFormatDescriptionRoundTripTest : public testing::TestWithParam<AudioFormatDescription> { }; TEST_P(AudioFormatDescriptionRoundTripTest, Aidl2Legacy2Aidl) { const auto initial = GetParam(); auto conv = aidl2legacy_AudioFormatDescription_audio_format_t(initial); Loading