Merge "Set enum defaults for biometrics" into sc-dev
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 67dc34f..8028089 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -57,12 +57,10 @@
 ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId,
                                               const std::shared_ptr<ISessionCallback>& cb,
                                               std::shared_ptr<ISession>* out) {
-    auto sessionSp = mSession.lock();
-    CHECK(sessionSp == nullptr || sessionSp->isClosed()) << "Open session already exists!";
+    CHECK(mSession == nullptr || mSession->isClosed()) << "Open session already exists!";
 
-    auto session = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
-    mSession = session;
-    *out = session;
+    mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
+    *out = mSession;
     return ndk::ScopedAStatus::ok();
 }
 
diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
index 9b8eef8..9b43419 100644
--- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h
+++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
@@ -39,7 +39,7 @@
   private:
     std::unique_ptr<FakeFingerprintEngine> mEngine;
     WorkerThread mWorker;
-    std::weak_ptr<Session> mSession;
+    std::shared_ptr<Session> mSession;
 };
 
 }  // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
index ddbc0fe..894fdfe 100644
--- a/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
+++ b/biometrics/fingerprint/aidl/vts/VtsHalBiometricsFingerprintTargetTest.cpp
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #include <aidl/Gtest.h>
 #include <aidl/Vintf.h>
 #include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h>
@@ -30,25 +31,35 @@
 constexpr int kUserId = 0;
 constexpr auto kCallbackTimeout = std::chrono::seconds(1);
 
-enum class SessionCallbackMethodName {
+enum class MethodName {
     kOnStateChanged,
 };
 
-struct SessionCallbackInvocation {
-    SessionCallbackMethodName method_name;
+struct Invocation {
+    MethodName methodName;
+    int32_t cookie;
     SessionState state;
 };
 
 class SessionCallback : public BnSessionCallback {
   public:
-    explicit SessionCallback(std::promise<SessionCallbackInvocation> invocation_promise)
-        : invocation_promise_(std::move(invocation_promise)) {}
+    explicit SessionCallback() : mIsPromiseValid(false) {}
 
-    ndk::ScopedAStatus onStateChanged(int32_t /*cookie*/, SessionState state) override {
-        SessionCallbackInvocation invocation = {};
-        invocation.method_name = SessionCallbackMethodName::kOnStateChanged;
+    void setPromise(std::promise<std::vector<Invocation>>&& promise) {
+        mPromise = std::move(promise);
+        mIsPromiseValid = true;
+    }
+
+    ndk::ScopedAStatus onStateChanged(int32_t cookie, SessionState state) override {
+        Invocation invocation = {};
+        invocation.methodName = MethodName::kOnStateChanged;
+        invocation.cookie = cookie;
         invocation.state = state;
-        invocation_promise_.set_value(invocation);
+        mInvocations.push_back(invocation);
+        if (state == SessionState::IDLING) {
+            assert(mIsPromiseValid);
+            mPromise.set_value(mInvocations);
+        }
         return ndk::ScopedAStatus::ok();
     }
 
@@ -73,26 +84,20 @@
         return ndk::ScopedAStatus::ok();
     }
 
-    ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/,
-                                       const keymaster::HardwareAuthToken& /*hat*/) override {
+    ndk::ScopedAStatus onAuthenticationSucceeded(
+            int32_t /*enrollmentId*/, const keymaster::HardwareAuthToken& /*hat*/) override {
         return ndk::ScopedAStatus::ok();
     }
 
-    ndk::ScopedAStatus onAuthenticationFailed() override {
-        return ndk::ScopedAStatus::ok();
-    }
+    ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); }
 
     ndk::ScopedAStatus onLockoutTimed(int64_t /*durationMillis*/) override {
         return ndk::ScopedAStatus::ok();
     }
 
-    ndk::ScopedAStatus onLockoutPermanent() override {
-        return ndk::ScopedAStatus::ok();
-    }
+    ndk::ScopedAStatus onLockoutPermanent() override { return ndk::ScopedAStatus::ok(); }
 
-    ndk::ScopedAStatus onLockoutCleared() override {
-        return ndk::ScopedAStatus::ok();
-    }
+    ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); }
 
     ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); }
 
@@ -115,7 +120,9 @@
     }
 
   private:
-    std::promise<SessionCallbackInvocation> invocation_promise_;
+    bool mIsPromiseValid;
+    std::vector<Invocation> mInvocations;
+    std::promise<std::vector<Invocation>> mPromise;
 };
 
 class Fingerprint : public testing::TestWithParam<std::string> {
@@ -123,28 +130,40 @@
     void SetUp() override {
         AIBinder* binder = AServiceManager_waitForService(GetParam().c_str());
         ASSERT_NE(binder, nullptr);
-        hal_ = IFingerprint::fromBinder(ndk::SpAIBinder(binder));
+        mHal = IFingerprint::fromBinder(ndk::SpAIBinder(binder));
     }
 
-    std::shared_ptr<IFingerprint> hal_;
+    std::shared_ptr<IFingerprint> mHal;
 };
 
 TEST_P(Fingerprint, AuthenticateTest) {
-    std::promise<SessionCallbackInvocation> invocation_promise;
-    std::future<SessionCallbackInvocation> invocation_future = invocation_promise.get_future();
-    std::shared_ptr<SessionCallback> session_cb =
-            ndk::SharedRefBase::make<SessionCallback>(std::move(invocation_promise));
+    // Prepare the callback
+    std::promise<std::vector<Invocation>> promise;
+    auto future = promise.get_future();
+    std::shared_ptr<SessionCallback> cb = ndk::SharedRefBase::make<SessionCallback>();
+    cb->setPromise(std::move(promise));
 
+    // Create a session
     std::shared_ptr<ISession> session;
-    ASSERT_TRUE(hal_->createSession(kSensorId, kUserId, session_cb, &session).isOk());
+    ASSERT_TRUE(mHal->createSession(kSensorId, kUserId, cb, &session).isOk());
 
-    std::shared_ptr<common::ICancellationSignal> cancel_cb;
-    ASSERT_TRUE(session->authenticate(0, 0, &cancel_cb).isOk());
-    ASSERT_EQ(invocation_future.wait_for(kCallbackTimeout), std::future_status::ready);
+    // Call authenticate
+    int32_t cookie = 123;
+    std::shared_ptr<common::ICancellationSignal> cancellationSignal;
+    ASSERT_TRUE(session->authenticate(cookie, 0, &cancellationSignal).isOk());
 
-    SessionCallbackInvocation invocation = invocation_future.get();
-    EXPECT_EQ(invocation.method_name, SessionCallbackMethodName::kOnStateChanged);
-    EXPECT_EQ(invocation.state, SessionState::AUTHENTICATING);
+    // Get the results
+    ASSERT_TRUE(future.wait_for(kCallbackTimeout) == std::future_status::ready);
+    std::vector<Invocation> invocations = future.get();
+
+    // Close the session
+    ASSERT_TRUE(session->close(0).isOk());
+
+    ASSERT_FALSE(invocations.empty());
+    EXPECT_EQ(invocations.front().methodName, MethodName::kOnStateChanged);
+    EXPECT_EQ(invocations.front().state, SessionState::AUTHENTICATING);
+    EXPECT_EQ(invocations.back().methodName, MethodName::kOnStateChanged);
+    EXPECT_EQ(invocations.back().state, SessionState::IDLING);
 }
 
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(Fingerprint);
@@ -154,6 +173,7 @@
         ::android::PrintInstanceNameToString);
 
 }  // namespace
+}  // namespace aidl::android::hardware::biometrics::fingerprint
 
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
@@ -161,5 +181,3 @@
     ABinderProcess_startThreadPool();
     return RUN_ALL_TESTS();
 }
-
-}  // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/compatibility_matrices/build/vintf_compatibility_matrix.go b/compatibility_matrices/build/vintf_compatibility_matrix.go
index 2772ba3..f1bd0ae 100644
--- a/compatibility_matrices/build/vintf_compatibility_matrix.go
+++ b/compatibility_matrices/build/vintf_compatibility_matrix.go
@@ -41,7 +41,7 @@
 	}, "inputs")
 
 	xmllintXsd = pctx.AndroidStaticRule("xmllint-xsd", blueprint.RuleParams{
-		Command:     `$XmlLintCmd --schema $xsd $in > /dev/null && touch -a $out`,
+		Command:     `$XmlLintCmd --quiet --schema $xsd $in > /dev/null && touch -a $out`,
 		CommandDeps: []string{"$XmlLintCmd"},
 		Restat:      true,
 	}, "xsd")
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
index 11cdcfc..1a2feb7 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/BlocklistedSource.aidl
@@ -33,6 +33,6 @@
 package android.hardware.gnss;
 @VintfStability
 parcelable BlocklistedSource {
-  android.hardware.gnss.GnssConstellationType constellation;
+  android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN;
   int svid;
 }
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
index 728ff68..bc73bb1 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
@@ -50,7 +50,7 @@
   long carrierCycles;
   double carrierPhase;
   double carrierPhaseUncertainty;
-  android.hardware.gnss.GnssMultipathIndicator multipathIndicator;
+  android.hardware.gnss.GnssMultipathIndicator multipathIndicator = android.hardware.gnss.GnssMultipathIndicator.UNKNOWN;
   double snrDb;
   double agcLevelDb;
   double fullInterSignalBiasNs;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
index f729d4c..ba02f72 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
@@ -33,7 +33,7 @@
 package android.hardware.gnss;
 @VintfStability
 parcelable GnssSignalType {
-  android.hardware.gnss.GnssConstellationType constellation;
+  android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN;
   double carrierFrequencyHz;
   @utf8InCpp String codeType;
   const @utf8InCpp String CODE_TYPE_A = "A";
diff --git a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl
index 2fde5b2..8b73092 100644
--- a/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl
+++ b/gnss/aidl/android/hardware/gnss/BlocklistedSource.aidl
@@ -26,7 +26,7 @@
     /**
      * Defines the constellation of the given satellite(s).
      */
-    GnssConstellationType constellation;
+    GnssConstellationType constellation = GnssConstellationType.UNKNOWN;
 
     /**
      * Satellite (space vehicle) ID number, as defined in GnssSvInfo::svid, or 0 to blocklist all
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
index 4468b63..f20cd25 100644
--- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -536,7 +536,7 @@
      * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
      * signals that are tracked and do not contain multipath.
      */
-    GnssMultipathIndicator multipathIndicator;
+    GnssMultipathIndicator multipathIndicator = GnssMultipathIndicator.UNKNOWN;
 
     /**
      * Signal-to-noise ratio at correlator output in dB.
diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
index 9c68db1..a16b170 100644
--- a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
@@ -26,7 +26,7 @@
     /**
      * Constellation type of the SV that transmits the signal.
      */
-    GnssConstellationType constellation;
+    GnssConstellationType constellation = GnssConstellationType.UNKNOWN;
 
     /**
      * Carrier frequency of the signal tracked, for example it can be the
diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
index f522731..1463c3b 100644
--- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
+++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp
@@ -103,7 +103,8 @@
 
         mTestRenderEngine->initGraphicBuffer(
                 static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight), 1,
-                static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN));
+                static_cast<uint64_t>(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN |
+                                      BufferUsage::GPU_RENDER_TARGET));
         mTestRenderEngine->setDisplaySettings(clientCompositionDisplay);
     }
 
diff --git a/radio/1.6/types.hal b/radio/1.6/types.hal
index 21cb010..20f14dc 100644
--- a/radio/1.6/types.hal
+++ b/radio/1.6/types.hal
@@ -986,7 +986,7 @@
     /**
      * Struct containing all NSSAIs (list of slice info).
      */
-    Nssais nsaids;
+    Nssais nssais;
 };
 
 /**
diff --git a/radio/config/1.3/types.hal b/radio/config/1.3/types.hal
index ba964bf..8915970 100644
--- a/radio/config/1.3/types.hal
+++ b/radio/config/1.3/types.hal
@@ -21,8 +21,14 @@
  */
 struct HalDeviceCapabilities {
   /**
-   * True indicates that the modem is missing features within the current
-   * version of the Radio HAL.
+   * True indicates that the modem does NOT support the following features:
+   * <ul>
+   * <li>Providing either
+   * android.hardware.radio@1.6::LinkCapacityEstimate:secondaryDownlinkCapacityKbps
+   * or android.hardware.radio@1.6::LinkCapacityEstimate:secondaryUplinkCapacityKbps
+   * when given from android.hardware.radio@1.6::RadioIndication:currentLinkCapacityEstimate
+   * </li>
+   * </ul>
    */
   bool modemReducedFeatureSet1;
 };
diff --git a/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp b/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp
index f2651fb..2373b26 100644
--- a/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp
+++ b/security/keymint/aidl/default/RemotelyProvisionedComponent.cpp
@@ -259,8 +259,9 @@
 }
 
 static keymaster_key_param_t kKeyMintEcdsaP256Params[] = {
-        Authorization(TAG_PURPOSE, KM_PURPOSE_SIGN), Authorization(TAG_ALGORITHM, KM_ALGORITHM_EC),
-        Authorization(TAG_KEY_SIZE, 256), Authorization(TAG_DIGEST, KM_DIGEST_SHA_2_256),
+        Authorization(TAG_PURPOSE, KM_PURPOSE_ATTEST_KEY),
+        Authorization(TAG_ALGORITHM, KM_ALGORITHM_EC), Authorization(TAG_KEY_SIZE, 256),
+        Authorization(TAG_DIGEST, KM_DIGEST_SHA_2_256),
         Authorization(TAG_EC_CURVE, KM_EC_CURVE_P_256), Authorization(TAG_NO_AUTH_REQUIRED),
         // The certificate generated by KM will be discarded, these values don't matter.
         Authorization(TAG_CERTIFICATE_NOT_BEFORE, 0), Authorization(TAG_CERTIFICATE_NOT_AFTER, 0)};
diff --git a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 45f9df6..db53a8f 100644
--- a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -80,7 +80,7 @@
 /**
  * Generate and validate a production-mode key.  MAC tag can't be verified.
  */
-TEST_P(GenerateKeyTests, DISABLED_generateEcdsaP256Key_prodMode) {
+TEST_P(GenerateKeyTests, generateEcdsaP256Key_prodMode) {
     MacedPublicKey macedPubKey;
     bytevec privateKeyBlob;
     bool testMode = false;
@@ -133,7 +133,7 @@
 /**
  * Generate and validate a test-mode key.
  */
-TEST_P(GenerateKeyTests, DISABLED_generateEcdsaP256Key_testMode) {
+TEST_P(GenerateKeyTests, generateEcdsaP256Key_testMode) {
     MacedPublicKey macedPubKey;
     bytevec privateKeyBlob;
     bool testMode = true;
@@ -224,7 +224,7 @@
  * Generate an empty certificate request in test mode, and decrypt and verify the structure and
  * content.
  */
-TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_testMode) {
+TEST_P(CertificateRequestTest, EmptyRequest_testMode) {
     bool testMode = true;
     bytevec keysToSignMac;
     ProtectedData protectedData;
@@ -294,7 +294,7 @@
  * TODO(swillden): Get a valid GEEK and use it so the generation can succeed, though we won't be
  * able to decrypt.
  */
-TEST_P(CertificateRequestTest, DISABLED_EmptyRequest_prodMode) {
+TEST_P(CertificateRequestTest, EmptyRequest_prodMode) {
     bool testMode = false;
     bytevec keysToSignMac;
     ProtectedData protectedData;
@@ -309,7 +309,7 @@
 /**
  * Generate a non-empty certificate request in test mode.  Decrypt, parse and validate the contents.
  */
-TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_testMode) {
+TEST_P(CertificateRequestTest, NonEmptyRequest_testMode) {
     bool testMode = true;
     generateKeys(testMode, 4 /* numKeys */);
 
@@ -379,7 +379,7 @@
  * TODO(swillden): Get a valid GEEK and use it so the generation can succeed, though we won't be
  * able to decrypt.
  */
-TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodMode) {
+TEST_P(CertificateRequestTest, NonEmptyRequest_prodMode) {
     bool testMode = false;
     generateKeys(testMode, 4 /* numKeys */);
 
@@ -396,7 +396,7 @@
  * Generate a non-empty certificate request in test mode, with prod keys.  Must fail with
  * STATUS_PRODUCTION_KEY_IN_TEST_REQUEST.
  */
-TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_prodKeyInTestCert) {
+TEST_P(CertificateRequestTest, NonEmptyRequest_prodKeyInTestCert) {
     generateKeys(false /* testMode */, 2 /* numKeys */);
 
     bytevec keysToSignMac;
@@ -414,7 +414,7 @@
  * Generate a non-empty certificate request in prod mode, with test keys.  Must fail with
  * STATUS_TEST_KEY_IN_PRODUCTION_REQUEST.
  */
-TEST_P(CertificateRequestTest, DISABLED_NonEmptyRequest_testKeyInProdCert) {
+TEST_P(CertificateRequestTest, NonEmptyRequest_testKeyInProdCert) {
     generateKeys(true /* testMode */, 2 /* numKeys */);
 
     bytevec keysToSignMac;
diff --git a/tv/tuner/1.1/default/Demux.cpp b/tv/tuner/1.1/default/Demux.cpp
index f4e4a91..db25c2e 100644
--- a/tv/tuner/1.1/default/Demux.cpp
+++ b/tv/tuner/1.1/default/Demux.cpp
@@ -340,6 +340,10 @@
 }
 
 void Demux::frontendInputThreadLoop() {
+    if (!mFrontendInputThreadRunning) {
+        return;
+    }
+
     std::lock_guard<std::mutex> lock(mFrontendInputThreadLock);
     if (!mDvrPlayback) {
         ALOGW("[Demux] No software Frontend input configured. Ending Frontend thread loop.");
diff --git a/tv/tuner/1.1/default/Filter.cpp b/tv/tuner/1.1/default/Filter.cpp
index 2e29aa9..884b507 100644
--- a/tv/tuner/1.1/default/Filter.cpp
+++ b/tv/tuner/1.1/default/Filter.cpp
@@ -72,9 +72,8 @@
     sp<V1_1::IFilterCallback> filterCallback_v1_1 = V1_1::IFilterCallback::castFrom(cb);
     if (filterCallback_v1_1 != NULL) {
         mCallback_1_1 = filterCallback_v1_1;
-    } else {
-        mCallback = cb;
     }
+    mCallback = cb;
 }
 
 Filter::~Filter() {
@@ -141,6 +140,36 @@
 Return<Result> Filter::start() {
     ALOGV("%s", __FUNCTION__);
     mFilterThreadRunning = true;
+    // All the filter event callbacks in start are for testing purpose.
+    switch (mType.mainType) {
+        case DemuxFilterMainType::TS:
+            mCallback->onFilterEvent(createMediaEvent());
+            mCallback->onFilterEvent(createTsRecordEvent());
+            mCallback_1_1->onFilterEvent_1_1(createTsRecordEvent(), createTsRecordEventExt());
+            mCallback->onFilterEvent(createTemiEvent());
+            break;
+        case DemuxFilterMainType::MMTP:
+            mCallback->onFilterEvent(createDownloadEvent());
+            mCallback->onFilterEvent(createMmtpRecordEvent());
+            mCallback_1_1->onFilterEvent_1_1(createMmtpRecordEvent(), createMmtpRecordEventExt());
+            break;
+        case DemuxFilterMainType::IP:
+            mCallback->onFilterEvent(createSectionEvent());
+            mCallback->onFilterEvent(createIpPayloadEvent());
+            break;
+        case DemuxFilterMainType::TLV: {
+            DemuxFilterEvent emptyFilterEvent;
+            mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, createMonitorEvent());
+            break;
+        }
+        case DemuxFilterMainType::ALP: {
+            DemuxFilterEvent emptyFilterEvent;
+            mCallback_1_1->onFilterEvent_1_1(emptyFilterEvent, createRestartEvent());
+            break;
+        }
+        default:
+            break;
+    }
     return startFilterLoop();
 }
 
@@ -926,6 +955,176 @@
     }
     return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino);
 }
+
+DemuxFilterEvent Filter::createMediaEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].media({
+            .streamId = 1,
+            .isPtsPresent = true,
+            .pts = 2,
+            .dataLength = 3,
+            .offset = 4,
+            .isSecureMemory = true,
+            .avDataId = 5,
+            .mpuSequenceNumber = 6,
+            .isPesPrivateData = true,
+    });
+
+    event.events[0].media().extraMetaData.audio({
+            .adFade = 1,
+            .adPan = 2,
+            .versionTextTag = 3,
+            .adGainCenter = 4,
+            .adGainFront = 5,
+            .adGainSurround = 6,
+    });
+
+    int av_fd = createAvIonFd(BUFFER_SIZE_16M);
+    if (av_fd == -1) {
+        return event;
+    }
+
+    native_handle_t* nativeHandle = createNativeHandle(av_fd);
+    if (nativeHandle == NULL) {
+        return event;
+    }
+
+    hidl_handle handle;
+    handle.setTo(nativeHandle, /*shouldOwn=*/true);
+    event.events[0].media().avMemory = std::move(handle);
+    ::close(av_fd);
+
+    return event;
+}
+
+DemuxFilterEvent Filter::createTsRecordEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    DemuxPid pid;
+    pid.tPid(1);
+    DemuxFilterTsRecordEvent::ScIndexMask mask;
+    mask.sc(1);
+    event.events[0].tsRecord({
+            .pid = pid,
+            .tsIndexMask = 1,
+            .scIndexMask = mask,
+            .byteNumber = 2,
+    });
+    return event;
+}
+
+V1_1::DemuxFilterEventExt Filter::createTsRecordEventExt() {
+    V1_1::DemuxFilterEventExt event;
+    event.events.resize(1);
+
+    event.events[0].tsRecord({
+            .pts = 1,
+            .firstMbInSlice = 2,  // random address
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createMmtpRecordEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].mmtpRecord({
+            .scHevcIndexMask = 1,
+            .byteNumber = 2,
+    });
+    return event;
+}
+
+V1_1::DemuxFilterEventExt Filter::createMmtpRecordEventExt() {
+    V1_1::DemuxFilterEventExt event;
+    event.events.resize(1);
+
+    event.events[0].mmtpRecord({
+            .pts = 1,
+            .mpuSequenceNumber = 2,
+            .firstMbInSlice = 3,
+            .tsIndexMask = 4,
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createSectionEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].section({
+            .tableId = 1,
+            .version = 2,
+            .sectionNum = 3,
+            .dataLength = 0,
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createPesEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].pes({
+            .streamId = static_cast<DemuxStreamId>(1),
+            .dataLength = 1,
+            .mpuSequenceNumber = 2,
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createDownloadEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].download({
+            .itemId = 1,
+            .mpuSequenceNumber = 2,
+            .itemFragmentIndex = 3,
+            .lastItemFragmentIndex = 4,
+            .dataLength = 0,
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createIpPayloadEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].ipPayload({
+            .dataLength = 0,
+    });
+    return event;
+}
+
+DemuxFilterEvent Filter::createTemiEvent() {
+    DemuxFilterEvent event;
+    event.events.resize(1);
+
+    event.events[0].temi({.pts = 1, .descrTag = 2, .descrData = {3}});
+    return event;
+}
+
+V1_1::DemuxFilterEventExt Filter::createMonitorEvent() {
+    V1_1::DemuxFilterEventExt event;
+    event.events.resize(1);
+
+    V1_1::DemuxFilterMonitorEvent monitor;
+    monitor.scramblingStatus(V1_1::ScramblingStatus::SCRAMBLED);
+    event.events[0].monitorEvent(monitor);
+    return event;
+}
+
+V1_1::DemuxFilterEventExt Filter::createRestartEvent() {
+    V1_1::DemuxFilterEventExt event;
+    event.events.resize(1);
+
+    event.events[0].startId(1);
+    return event;
+}
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace tuner
diff --git a/tv/tuner/1.1/default/Filter.h b/tv/tuner/1.1/default/Filter.h
index 3a4246e..659bebf 100644
--- a/tv/tuner/1.1/default/Filter.h
+++ b/tv/tuner/1.1/default/Filter.h
@@ -198,6 +198,18 @@
     Result createShareMemMediaEvents(vector<uint8_t> output);
     bool sameFile(int fd1, int fd2);
 
+    DemuxFilterEvent createMediaEvent();
+    DemuxFilterEvent createTsRecordEvent();
+    V1_1::DemuxFilterEventExt createTsRecordEventExt();
+    DemuxFilterEvent createMmtpRecordEvent();
+    V1_1::DemuxFilterEventExt createMmtpRecordEventExt();
+    DemuxFilterEvent createSectionEvent();
+    DemuxFilterEvent createPesEvent();
+    DemuxFilterEvent createDownloadEvent();
+    DemuxFilterEvent createIpPayloadEvent();
+    DemuxFilterEvent createTemiEvent();
+    V1_1::DemuxFilterEventExt createMonitorEvent();
+    V1_1::DemuxFilterEventExt createRestartEvent();
     /**
      * Lock to protect writes to the FMQs
      */