Merge "Re-order skip checks for attestation tests"
diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h
index d87bbd4..32c36b8 100644
--- a/audio/aidl/common/include/Utils.h
+++ b/audio/aidl/common/include/Utils.h
@@ -19,6 +19,7 @@
 #include <algorithm>
 #include <array>
 #include <initializer_list>
+#include <regex>
 #include <type_traits>
 
 #include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -133,6 +134,18 @@
            kValidAudioModes.end();
 }
 
+static inline bool maybeVendorExtension(const std::string& s) {
+    // Only checks whether the string starts with the "vendor prefix".
+    static const std::string vendorPrefix = "VX_";
+    return s.size() > vendorPrefix.size() && s.substr(0, vendorPrefix.size()) == vendorPrefix;
+}
+
+static inline bool isVendorExtension(const std::string& s) {
+    // Must be the same as defined in {Playback|Record}TrackMetadata.aidl
+    static const std::regex vendorExtension("VX_[A-Z0-9]{3,}_[_A-Z0-9]+");
+    return std::regex_match(s.begin(), s.end(), vendorExtension);
+}
+
 // The helper functions defined below are only applicable to the case when an enum type
 // specifies zero-based bit positions, not bit masks themselves. This is why instantiation
 // is restricted to certain enum types.
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index 024c0ea..4f8fb3c 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -34,13 +34,14 @@
 };
 
 RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const std::string& name,
-                                   const int priority) {
+                                   int priority, int sleepUs /* kSleepTimeUs */) {
     if (mThread.joinable()) {
         LOG(WARNING) << __func__ << " thread already created, no-op";
         return RetCode::SUCCESS;
     }
     mName = name;
     mPriority = priority;
+    mSleepTimeUs = sleepUs;
     {
         std::lock_guard lg(mThreadMutex);
         mThreadContext = std::move(context);
@@ -134,7 +135,7 @@
         LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed
                    << " produced " << status.fmqProduced;
     } else {
-        // TODO: maybe add some sleep here to avoid busy waiting
+        usleep(mSleepTimeUs);
     }
 }
 
diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h
index 9b1a75b..f9c6a31 100644
--- a/audio/aidl/default/include/effect-impl/EffectThread.h
+++ b/audio/aidl/default/include/effect-impl/EffectThread.h
@@ -35,7 +35,7 @@
 
     // called by effect implementation.
     RetCode createThread(std::shared_ptr<EffectContext> context, const std::string& name,
-                         const int priority = ANDROID_PRIORITY_URGENT_AUDIO);
+                         int priority = ANDROID_PRIORITY_URGENT_AUDIO, int sleepUs = kSleepTimeUs);
     RetCode destroyThread();
     RetCode startThread();
     RetCode stopThread();
@@ -72,7 +72,8 @@
     virtual void process_l() REQUIRES(mThreadMutex);
 
   private:
-    const int kMaxTaskNameLen = 15;
+    static constexpr int kMaxTaskNameLen = 15;
+    static constexpr int kSleepTimeUs = 2000;  // in micro-second
     std::mutex mThreadMutex;
     std::condition_variable mCv;
     bool mExit GUARDED_BY(mThreadMutex) = false;
@@ -80,6 +81,7 @@
     std::shared_ptr<EffectContext> mThreadContext GUARDED_BY(mThreadMutex);
     std::thread mThread;
     int mPriority;
+    int mSleepTimeUs = kSleepTimeUs;  // sleep time in micro-second
     std::string mName;
 
     RetCode handleStartStop(bool stop);
diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
index ad9dee2..844a651 100644
--- a/audio/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -81,7 +81,7 @@
 #endif
 
 #if MAJOR_VERSION >= 7
-    static constexpr char sAudioTagSeparator = ';';
+    static constexpr char sAudioTagSeparator = AUDIO_ATTRIBUTES_TAGS_SEPARATOR;
 
     static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
                                             AudioChannelMask* channelMask);
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 9620b6a..491b757 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -805,8 +805,8 @@
         return "Challenge must be a Bstr.";
     }
 
-    if (challenge.size() < 32 || challenge.size() > 64) {
-        return "Challenge size must be between 32 and 64 bytes inclusive. "
+    if (challenge.size() < 16 || challenge.size() > 64) {
+        return "Challenge size must be between 16 and 64 bytes inclusive. "
                "However, challenge is " +
                std::to_string(challenge.size()) + " bytes long.";
     }
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 5bd2145..35b83dd 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -315,7 +315,7 @@
      *
      * @param in challenge contains a byte string from the provisioning server which will be
      *        included in the signed data of the CSR structure. Different provisioned backends may
-     *        use different semantic data for this field, but the supported sizes must be between 32
+     *        use different semantic data for this field, but the supported sizes must be between 16
      *        and 64 bytes, inclusive.
      *
      * @return the following CBOR Certificate Signing Request (Csr) serialized into a byte array: