Merge "Effect AIDL: add Spatializer default implementation to Cuttlefish" into main
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
index c7761c5..1eb6a6d 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
@@ -120,6 +120,12 @@
 ndk::ScopedAStatus A2dpOffloadAudioProvider::parseA2dpConfiguration(
     const CodecId& codec_id, const std::vector<uint8_t>& configuration,
     CodecParameters* codec_parameters, A2dpStatus* _aidl_return) {
+  if (!kEnableA2dpCodecExtensibility) {
+    // parseA2dpConfiguration must not be implemented if A2dp codec
+    // extensibility is not supported.
+    return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
+  }
+
   auto codec = codec_factory_.GetCodec(codec_id);
   if (!codec) {
     LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
@@ -136,6 +142,12 @@
     const std::vector<A2dpRemoteCapabilities>& remote_a2dp_capabilities,
     const A2dpConfigurationHint& hint,
     std::optional<audio::A2dpConfiguration>* _aidl_return) {
+  if (!kEnableA2dpCodecExtensibility) {
+    // getA2dpConfiguration must not be implemented if A2dp codec
+    // extensibility is not supported.
+    return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
+  }
+
   *_aidl_return = std::nullopt;
   A2dpConfiguration avdtp_configuration;
 
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
index 2c21440..866eaeb 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
@@ -35,6 +35,23 @@
 namespace bluetooth {
 namespace audio {
 
+/// Enable flag for the reference implementation for A2dp Codec
+/// Extensibility.
+///
+/// A2dp Codec extensibility cannot be enabled until the following
+/// requirements are fulfilled.
+///
+///  1. The Bluetooth controller must support the HCI Requirements
+///     v1.04 or later, and must support the vendor HCI command
+///     A2DP Offload Start (v2), A2DP Offload Stop (v2) as indicated
+///     by the field a2dp_offload_v2 of the vendor capabilities.
+///
+///  2. The implementation of the provider must be completed with
+///     DSP configuration for streaming.
+enum : bool {
+  kEnableA2dpCodecExtensibility = false,
+};
+
 class BluetoothAudioProvider : public BnBluetoothAudioProvider {
  public:
   BluetoothAudioProvider();
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
index c7c6e6d..584640b 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
@@ -159,6 +159,12 @@
 
   if (session_type == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
       session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+    if (!kEnableA2dpCodecExtensibility) {
+      // Implementing getProviderInfo equates supporting
+      // A2dp codec extensibility.
+      return ndk::ScopedAStatus::fromStatus(STATUS_UNKNOWN_TRANSACTION);
+    }
+
     auto& provider_info = _aidl_return->emplace();
 
     provider_info.name = a2dp_offload_codec_factory_.name;
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index b21fe54..dd502ba 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -82,11 +82,3 @@
         "kernel_config_v_6.6",
     ],
 }
-
-vintf_compatibility_matrix {
-    name: "framework_compatibility_matrix.tmp.xml",
-    stem: "compatibility_matrix.tmp.xml",
-    srcs: [
-        "compatibility_matrix.tmp.xml",
-    ],
-}
diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk
index 76dbdd6..639abf9 100644
--- a/compatibility_matrices/Android.mk
+++ b/compatibility_matrices/Android.mk
@@ -112,7 +112,7 @@
 ifeq ($(RELEASE_AIDL_USE_UNFROZEN),true)
 my_system_matrix_deps += \
     framework_compatibility_matrix.202404.xml \
-    framework_compatibility_matrix.tmp.xml
+
 endif
 
 my_framework_matrix_deps += \
diff --git a/compatibility_matrices/compatibility_matrix.tmp.xml b/compatibility_matrices/compatibility_matrix.tmp.xml
deleted file mode 100644
index 85e3c4c..0000000
--- a/compatibility_matrices/compatibility_matrix.tmp.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<compatibility-matrix version="1.0" type="framework" level="202404">
-  <!-- This file holds the HIDL media.c2 interface while it
-  is being deprecated. This will be removed after the flag ramping
-  complete. This interface is not allowed in the 202404 vendor interface -->
-    <hal format="hidl" optional="true">
-        <name>android.hardware.media.c2</name>
-        <version>1.0-2</version>
-        <interface>
-            <name>IComponentStore</name>
-            <instance>software</instance>
-            <regex-instance>default[0-9]*</regex-instance>
-            <regex-instance>vendor[0-9]*_software</regex-instance>
-        </interface>
-    </hal>
-    <hal format="hidl" optional="true">
-        <name>android.hardware.media.c2</name>
-        <version>1.0</version>
-        <interface>
-            <name>IConfigurable</name>
-            <instance>default</instance>
-            <instance>software</instance>
-        </interface>
-    </hal>
-</compatibility-matrix>
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index e098aca..0b7627c 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -1064,32 +1064,53 @@
 TEST_P(NewKeyGenerationTest, RsaWithSpecifiedValidity) {
     vector<uint8_t> key_blob;
     vector<KeyCharacteristics> key_characteristics;
-    ASSERT_EQ(ErrorCode::OK,
-              GenerateKey(AuthorizationSetBuilder()
-                                  .RsaSigningKey(2048, 65537)
-                                  .Digest(Digest::NONE)
-                                  .Padding(PaddingMode::NONE)
-                                  .Authorization(TAG_CERTIFICATE_NOT_BEFORE,
-                                                 1183806000000 /* 2007-07-07T11:00:00Z */)
-                                  .Authorization(TAG_CERTIFICATE_NOT_AFTER,
-                                                 1916049600000 /* 2030-09-19T12:00:00Z */),
-                          &key_blob, &key_characteristics));
-    ASSERT_GT(cert_chain_.size(), 0);
+    vector<uint64_t> test_vector_not_before_millis = {
+            458046000000,    /* 1984-07-07T11:00:00Z */
+            1183806000000,   /* 2007-07-07T11:00:00Z */
+            1924991999000,   /* 2030-12-31T23:59:59Z */
+            3723753599000,   /* 2087-12-31T23:59:59Z */
+            26223868799000,  /* 2800-12-31T23:59:59Z */
+            45157996799000,  /* 3400-12-31T23:59:59Z */
+            60719587199000,  /* 3894-02-15T23:59:59Z */
+            95302051199000,  /* 4989-12-31T23:59:59Z */
+            86182012799000,  /* 4700-12-31T23:59:59Z */
+            111427574399000, /* 5500-12-31T23:59:59Z */
+            136988668799000, /* 6310-12-31T23:59:59Z */
+            139828895999000, /* 6400-12-31T23:59:59Z */
+            169839503999000, /* 7351-12-31T23:59:59Z */
+            171385804799000, /* 7400-12-31T23:59:59Z */
+            190320019199000, /* 8000-12-31T23:59:59Z */
+            193475692799000, /* 8100-12-31T23:59:59Z */
+            242515209599000, /* 9654-12-31T23:59:59Z */
+            250219065599000, /* 9899-02-15T23:59:59Z */
+    };
+    for (auto notBefore : test_vector_not_before_millis) {
+        uint64_t notAfter = notBefore + 378691200000 /* 12 years milliseconds*/;
+        ASSERT_EQ(ErrorCode::OK,
+                  GenerateKey(AuthorizationSetBuilder()
+                                      .RsaSigningKey(2048, 65537)
+                                      .Digest(Digest::NONE)
+                                      .Padding(PaddingMode::NONE)
+                                      .Authorization(TAG_CERTIFICATE_NOT_BEFORE, notBefore)
+                                      .Authorization(TAG_CERTIFICATE_NOT_AFTER, notAfter),
+                              &key_blob, &key_characteristics));
+        ASSERT_GT(cert_chain_.size(), 0);
 
-    X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate));
-    ASSERT_TRUE(!!cert.get());
+        X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate));
+        ASSERT_TRUE(!!cert.get());
 
-    const ASN1_TIME* not_before = X509_get0_notBefore(cert.get());
-    ASSERT_NE(not_before, nullptr);
-    time_t not_before_time;
-    ASSERT_EQ(ASN1_TIME_to_time_t(not_before, &not_before_time), 1);
-    EXPECT_EQ(not_before_time, 1183806000);
+        const ASN1_TIME* not_before = X509_get0_notBefore(cert.get());
+        ASSERT_NE(not_before, nullptr);
+        time_t not_before_time;
+        ASSERT_EQ(ASN1_TIME_to_time_t(not_before, &not_before_time), 1);
+        EXPECT_EQ(not_before_time, (notBefore / 1000));
 
-    const ASN1_TIME* not_after = X509_get0_notAfter(cert.get());
-    ASSERT_NE(not_after, nullptr);
-    time_t not_after_time;
-    ASSERT_EQ(ASN1_TIME_to_time_t(not_after, &not_after_time), 1);
-    EXPECT_EQ(not_after_time, 1916049600);
+        const ASN1_TIME* not_after = X509_get0_notAfter(cert.get());
+        ASSERT_NE(not_after, nullptr);
+        time_t not_after_time;
+        ASSERT_EQ(ASN1_TIME_to_time_t(not_after, &not_after_time), 1);
+        EXPECT_EQ(not_after_time, (notAfter / 1000));
+    }
 }
 
 /*