Snap for 13235988 from 0b421cdc1d592f3f81d8ee89976978639e4f8652 to 25Q2-release

Change-Id: Ic30eba9d5093401bb8d1ad9c78ff7da5c01ba21c
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 8c53006..c18983e 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -8,7 +8,4 @@
 gofmt = true
 
 [Hook Scripts]
-aosp_hook_confirmationui = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} confirmationui
-aosp_hook_gatekeeper = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} gatekeeper
-aosp_hook_keymaster = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} keymaster
 generate_vehicle_property_enums = ${REPO_ROOT}/hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py --android_build_top ${REPO_ROOT} --preupload_files ${PREUPLOAD_FILES} --check_only
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTestTemplate.xml b/audio/aidl/vts/VtsHalAudioEffectTargetTestTemplate.xml
index 4170b4c..c92e852 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTestTemplate.xml
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTestTemplate.xml
@@ -33,6 +33,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="{MODULE}" />
-        <option name="native-test-timeout" value="30m" />
+        <option name="native-test-timeout" value="10m" />
     </test>
 </configuration>
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index ddb920d..98f7d79 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -871,12 +871,35 @@
         ratio = inputOverThreshold / outputOverThreshold;
     }
 
-    void setLimiterParamsAndProcess(std::vector<float>& input, std::vector<float>& output) {
+    void setLimiterParamsAndProcess(std::vector<float>& input, std::vector<float>& output,
+                                    bool isEngineLimiterEnabled = true) {
+        mEngineConfigPreset.limiterInUse = isEngineLimiterEnabled;
         addEngineConfig(mEngineConfigPreset);
         addLimiterConfig(mLimiterConfigList);
         EXPECT_NO_FATAL_FAILURE(setParamsAndProcess(input, output));
     }
 
+    void testEnableDisableConfiguration(bool isLimiterEnabled, bool isEngineLimiterEnabled) {
+        cleanUpLimiterConfig();
+        std::vector<float> output(mInput.size());
+        for (int i = 0; i < mChannelCount; i++) {
+            // Set non-default values
+            fillLimiterConfig(mLimiterConfigList, i, isLimiterEnabled, kDefaultLinkerGroup,
+                              5 /*attack time*/, 5 /*release time*/, 10 /*ratio*/,
+                              -20 /*threshold*/, 5 /*postgain*/);
+        }
+        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output, isEngineLimiterEnabled));
+        float outputdB = calculateDb(output, kStartIndex);
+        if (isAllParamsValid()) {
+            if (isLimiterEnabled && isEngineLimiterEnabled) {
+                EXPECT_GT(std::abs(mInputDb - outputdB), kMinDifferenceDb)
+                        << "Input level: " << mInputDb << " Output level: " << outputdB;
+            } else {
+                EXPECT_NEAR(mInputDb, outputdB, kLimiterTestToleranceDb);
+            }
+        }
+    }
+
     void cleanUpLimiterConfig() {
         CleanUp();
         mLimiterConfigList.clear();
@@ -888,6 +911,8 @@
     static constexpr float kDefaultThreshold = -10;
     static constexpr float kDefaultPostGain = 0;
     static constexpr float kLimiterTestToleranceDb = 0.05;
+    static constexpr float kMinDifferenceDb = 5;
+    const std::vector<bool> kEnableValues = {true, false, true};
     std::vector<DynamicsProcessing::LimiterConfig> mLimiterConfigList;
     int mBufferSize;
 };
@@ -969,25 +994,16 @@
 }
 
 TEST_P(DynamicsProcessingLimiterConfigDataTest, LimiterEnableDisable) {
-    std::vector<bool> limiterEnableValues = {false, true};
-    std::vector<float> output(mInput.size());
-    for (bool isEnabled : limiterEnableValues) {
-        cleanUpLimiterConfig();
-        for (int i = 0; i < mChannelCount; i++) {
-            // Set non-default values
-            fillLimiterConfig(mLimiterConfigList, i, isEnabled, kDefaultLinkerGroup,
-                              5 /*attack time*/, 5 /*release time*/, 10 /*ratio*/,
-                              -10 /*threshold*/, 5 /*postgain*/);
-        }
-        ASSERT_NO_FATAL_FAILURE(setLimiterParamsAndProcess(mInput, output));
-        if (!isAllParamsValid()) {
-            continue;
-        }
-        if (isEnabled) {
-            EXPECT_NE(mInputDb, calculateDb(output, kStartIndex));
-        } else {
-            EXPECT_NEAR(mInputDb, calculateDb(output, kStartIndex), kLimiterTestToleranceDb);
-        }
+    for (bool isLimiterEnabled : kEnableValues) {
+        ASSERT_NO_FATAL_FAILURE(
+                testEnableDisableConfiguration(isLimiterEnabled, true /*Engine Enabled*/));
+    }
+}
+
+TEST_P(DynamicsProcessingLimiterConfigDataTest, LimiterEnableDisableViaEngine) {
+    for (bool isEngineLimiterEnabled : kEnableValues) {
+        ASSERT_NO_FATAL_FAILURE(
+                testEnableDisableConfiguration(true /*Limiter Enabled*/, isEngineLimiterEnabled));
     }
 }
 
@@ -1049,7 +1065,6 @@
         }
     }
 
-    static constexpr float kMinDifferenceDb = 5;
     const std::vector<std::pair<float, float>> kRatioThresholdPairValues = {{2, -10}, {5, -20}};
 };
 
diff --git a/camera/common/default/SimpleThread.cpp b/camera/common/default/SimpleThread.cpp
index 46e89ba..f084970 100644
--- a/camera/common/default/SimpleThread.cpp
+++ b/camera/common/default/SimpleThread.cpp
@@ -24,9 +24,13 @@
 
 SimpleThread::SimpleThread() : mDone(true), mThread() {}
 SimpleThread::~SimpleThread() {
-    // Safe to call requestExitAndWait() from the destructor because requestExitAndWait() ensures
-    // that the thread is joinable before joining on it. This is different from how
-    // android::Thread worked.
+    // b/399939768: We need to be careful calling requestExitAndWait() from
+    // the destructor due to the possibility of
+    // OutputThread::threadLoop->~ExternalCameraDeviceSession->~OutputThread::requestExit()
+    // resulting in join() called on the calling thread.
+    //
+    // Rather than removing `requestExitAndExit`, we guard the `join` call
+    // in it by checking the thread id.
     requestExitAndWait();
 }
 
@@ -43,9 +47,15 @@
     mDone.store(true, std::memory_order_release);
 
     // Wait for thread to exit if needed. This should happen in no more than one iteration of
-    // threadLoop
+    // threadLoop. Only call 'join' if this function is called from a thread
+    // different from the thread associated with this object. Otherwise call
+    // 'detach' so that the threadLoop can finish and clean up itself.
     if (mThread.joinable()) {
-        mThread.join();
+        if (mThread.get_id() != std::this_thread::get_id()) {
+            mThread.join();
+        } else {
+            mThread.detach();
+        }
     }
     mThread = std::thread();
 }
diff --git a/graphics/composer/aidl/libhwc_aidl_test/ComposerClientWrapper.cpp b/graphics/composer/aidl/libhwc_aidl_test/ComposerClientWrapper.cpp
index 2252ce3..bfc4d2d 100644
--- a/graphics/composer/aidl/libhwc_aidl_test/ComposerClientWrapper.cpp
+++ b/graphics/composer/aidl/libhwc_aidl_test/ComposerClientWrapper.cpp
@@ -458,6 +458,11 @@
     return mComposerCallback->takeListOfRefreshRateChangedDebugData();
 }
 
+std::vector<std::pair<int64_t, common::DisplayHotplugEvent>>
+ComposerClientWrapper::getAndClearLatestHotplugs() {
+    return mComposerCallback->getAndClearLatestHotplugs();
+}
+
 int64_t ComposerClientWrapper::getInvalidDisplayId() {
     // returns an invalid display id (one that has not been registered to a
     // display. Currently assuming that a device will never have close to
diff --git a/graphics/composer/aidl/libhwc_aidl_test/GraphicsComposerCallback.cpp b/graphics/composer/aidl/libhwc_aidl_test/GraphicsComposerCallback.cpp
index ba16348..0daff56 100644
--- a/graphics/composer/aidl/libhwc_aidl_test/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/libhwc_aidl_test/GraphicsComposerCallback.cpp
@@ -100,6 +100,16 @@
     return mInvalidRefreshRateDebugEnabledCallbackCount;
 }
 
+std::vector<std::pair<int64_t, common::DisplayHotplugEvent>>
+GraphicsComposerCallback::getAndClearLatestHotplugs() {
+    std::vector<std::pair<int64_t, common::DisplayHotplugEvent>> ret;
+    {
+        std::scoped_lock lock(mMutex);
+        ret.swap(mLatestHotplugs);
+    }
+    return ret;
+}
+
 ::ndk::ScopedAStatus GraphicsComposerCallback::onHotplug(int64_t in_display, bool in_connected) {
     std::scoped_lock lock(mMutex);
 
@@ -196,6 +206,11 @@
 
 ::ndk::ScopedAStatus GraphicsComposerCallback::onHotplugEvent(int64_t in_display,
                                                               common::DisplayHotplugEvent event) {
+    {
+        std::scoped_lock lock(mMutex);
+        mLatestHotplugs.emplace_back(in_display, event);
+    }
+
     switch (event) {
         case common::DisplayHotplugEvent::CONNECTED:
             return onHotplug(in_display, true);
diff --git a/graphics/composer/aidl/libhwc_aidl_test/include/ComposerClientWrapper.h b/graphics/composer/aidl/libhwc_aidl_test/include/ComposerClientWrapper.h
index 5ba52bc..3d805c2 100644
--- a/graphics/composer/aidl/libhwc_aidl_test/include/ComposerClientWrapper.h
+++ b/graphics/composer/aidl/libhwc_aidl_test/include/ComposerClientWrapper.h
@@ -203,6 +203,8 @@
     std::pair<ScopedAStatus, std::vector<Luts>> getLuts(int64_t display,
                                                         const std::vector<Buffer>& buffers);
 
+    std::vector<std::pair<int64_t, common::DisplayHotplugEvent>> getAndClearLatestHotplugs();
+
     static constexpr int32_t kMaxFrameIntervalNs = 50000000;  // 20fps
     static constexpr int32_t kNoFrameIntervalNs = 0;
 
diff --git a/graphics/composer/aidl/libhwc_aidl_test/include/GraphicsComposerCallback.h b/graphics/composer/aidl/libhwc_aidl_test/include/GraphicsComposerCallback.h
index ff379b7..c769677 100644
--- a/graphics/composer/aidl/libhwc_aidl_test/include/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/libhwc_aidl_test/include/GraphicsComposerCallback.h
@@ -50,6 +50,8 @@
 
     int32_t getInvalidRefreshRateDebugEnabledCallbackCount() const;
 
+    std::vector<std::pair<int64_t, common::DisplayHotplugEvent>> getAndClearLatestHotplugs();
+
   private:
     virtual ::ndk::ScopedAStatus onHotplug(int64_t in_display, bool in_connected) override;
     virtual ::ndk::ScopedAStatus onRefresh(int64_t in_display) override;
@@ -71,6 +73,8 @@
     mutable std::mutex mMutex;
     // the set of all currently connected displays
     std::vector<int64_t> mDisplays GUARDED_BY(mMutex);
+    std::vector<std::pair<int64_t /*display id*/, common::DisplayHotplugEvent>> mLatestHotplugs
+            GUARDED_BY(mMutex);
     // true only when vsync is enabled
     bool mVsyncAllowed GUARDED_BY(mMutex) = true;
     // true only when RefreshRateChangedCallbackDebugEnabled is set to true.
diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
index 2359034..392b095 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
@@ -41,7 +41,7 @@
     if (mHal1_6) {
         mHal1_6->getAllowedNetworkTypesBitmap(serial);
     } else {
-        mHal1_5->getPreferredNetworkType(serial);
+        mHal1_5->getPreferredNetworkTypeBitmap(serial);
     }
     return ok();
 }
@@ -166,7 +166,7 @@
     if (mHal1_6) {
         mHal1_6->setAllowedNetworkTypesBitmap(serial, raf);
     } else {
-        mHal1_5->setPreferredNetworkType(serial, getNetworkTypeFromRaf(raf));
+        mHal1_5->setPreferredNetworkTypeBitmap(serial, raf);
     }
     return ok();
 }
diff --git a/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
index 5a98eb2..428070c 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
@@ -55,9 +55,10 @@
 }
 
 Return<void> RadioResponse::getPreferredNetworkTypeBitmapResponse(
-        const V1_0::RadioResponseInfo& info, hidl_bitfield<V1_4::RadioAccessFamily>) {
+        const V1_0::RadioResponseInfo& info,
+        hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
     LOG_CALL << info.serial;
-    LOG(ERROR) << "IRadio HAL 1.4 not supported";
+    networkCb()->getAllowedNetworkTypesBitmapResponse(toAidl(info), networkTypeBitmap);
     return {};
 }
 
@@ -290,7 +291,7 @@
 Return<void> RadioResponse::setPreferredNetworkTypeBitmapResponse(
         const V1_0::RadioResponseInfo& info) {
     LOG_CALL << info.serial;
-    LOG(ERROR) << "IRadio HAL 1.4 not supported";
+    networkCb()->setAllowedNetworkTypesBitmapResponse(toAidl(info));
     return {};
 }
 
diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp
index 5236e90..195e47b 100644
--- a/security/keymint/aidl/Android.bp
+++ b/security/keymint/aidl/Android.bp
@@ -52,7 +52,7 @@
         },
 
     ],
-
+    min_sdk_version: "35",
 }
 
 // An aidl_interface_defaults that includes the latest KeyMint AIDL interface.
diff --git a/security/rkp/aidl/Android.bp b/security/rkp/aidl/Android.bp
index adc63f6..df8a0ef 100644
--- a/security/rkp/aidl/Android.bp
+++ b/security/rkp/aidl/Android.bp
@@ -35,6 +35,7 @@
                 "//apex_available:platform",
                 "com.android.virt",
             ],
+            min_sdk_version: "35",
         },
     },
     versions_with_info: [
diff --git a/security/secureclock/aidl/Android.bp b/security/secureclock/aidl/Android.bp
index d7e7b43..1d4ec58 100644
--- a/security/secureclock/aidl/Android.bp
+++ b/security/secureclock/aidl/Android.bp
@@ -28,4 +28,5 @@
         },
     },
     versions: ["1"],
+    min_sdk_version: "35",
 }
diff --git a/security/see/authmgr/aidl/README.md b/security/see/authmgr/aidl/README.md
index 97b2b1d..d7bb5e4 100644
--- a/security/see/authmgr/aidl/README.md
+++ b/security/see/authmgr/aidl/README.md
@@ -16,6 +16,9 @@
 requirements that are specific to Android release versions.
 
 ### Android 16
-If implementing `IAuthMgrAuthorization` in Android 16 only one AuthMgr Backend is
+- If implementing `IAuthMgrAuthorization` in Android 16 only one AuthMgr Backend is
 supported and dynamic service discovery is not supported. The AuthMgr Backend
-service must be exposed on secure partition ID 0x8001 over VSOCK port 1.
\ No newline at end of file
+service must be exposed on secure partition ID 0x8001 over VSOCK port 1.
+
+- AuthMgr Front Ends must implement the "android.16" profile as described in the
+[Android Profile for DICE](https://pigweed.googlesource.com/open-dice/+/HEAD/docs/android.md#versions)
\ No newline at end of file