Merge "Initial change to add mock DAB stations (hardcoded for now)."
diff --git a/audio/5.0/config/api/current.txt b/audio/5.0/config/api/current.txt
index 17f38c1..c665781 100644
--- a/audio/5.0/config/api/current.txt
+++ b/audio/5.0/config/api/current.txt
@@ -114,6 +114,7 @@
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX;
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_ADAPTIVE;
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_HD;
+    enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_TWSP;
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_CELT;
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DOLBY_TRUEHD;
     enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DSD;
diff --git a/audio/5.0/config/audio_policy_configuration.xsd b/audio/5.0/config/audio_policy_configuration.xsd
index c580b25..2e1a722 100644
--- a/audio/5.0/config/audio_policy_configuration.xsd
+++ b/audio/5.0/config/audio_policy_configuration.xsd
@@ -374,6 +374,7 @@
             <xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE"/>
             <xs:enumeration value="AUDIO_FORMAT_LHDC"/>
             <xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
+            <xs:enumeration value="AUDIO_FORMAT_APTX_TWSP"/>
         </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="extendableAudioFormat">
diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal
index 0a8d75b..0cbf35e 100644
--- a/audio/common/5.0/types.hal
+++ b/audio/common/5.0/types.hal
@@ -240,6 +240,7 @@
     APTX_ADAPTIVE       = 0x27000000UL,
     LHDC                = 0x28000000UL,
     LHDC_LL             = 0x29000000UL,
+    APTX_TWSP           = 0x2A000000UL,
 
     /** Deprecated */
     MAIN_MASK           = 0xFF000000UL,
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index bb630f1..30c3217 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -22,7 +22,6 @@
 
 package android.hardware.camera.metadata@3.4;
 
-/* Include definitions from all prior minor HAL metadata revisions */
 import android.hardware.camera.metadata@3.2;
 import android.hardware.camera.metadata@3.3;
 
@@ -213,8 +212,10 @@
                                                                  = 0x4,
     ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW
                                                                  = 0x5,
-    ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END
+    ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT
                                                                  = 0x6,
+    ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PUBLIC_END
+                                                                 = 0x7,
     ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START
                                                                  = 0x18,
 };
diff --git a/current.txt b/current.txt
index 62f04d0..99100f1 100644
--- a/current.txt
+++ b/current.txt
@@ -420,7 +420,7 @@
 9471b12b1c255bb530695720bc4174bd74987b75b1f820854af8944bc8c215c9 android.hardware.audio@5.0::IStreamOut
 1b0500367ed2b32a841667ac3200edf3d3a164e8004aca445ff1b085ac831e93 android.hardware.audio@5.0::IStreamOutCallback
 83e365479cc77d8717c155e1787ee668cd2ae4c557b467cf75b8e7cd53697ad8 android.hardware.audio@5.0::types
-c25ae57a9197fdf83aa6f7b31ab1ac4922dea4f19f92cdb1f9013ad49fa56594 android.hardware.audio.common@5.0::types
+a0df6961e65444e1ca40a206d7f31304d313e8b7e5b122855e3272ab02720cd4 android.hardware.audio.common@5.0::types
 f269297866765b95ddd1825676cc8a772f0c7c9863286df596fc302781a42ff5 android.hardware.audio.effect@5.0::IAcousticEchoCancelerEffect
 fa187b602d8939644ef708ed7627f2e3deac97899a4bda1de07f2ff126abe243 android.hardware.audio.effect@5.0::IAutomaticGainControlEffect
 e1bf864ccb8458c0da1dcc74a2e748b1dca8ac360df590591cf82d98292d7981 android.hardware.audio.effect@5.0::IBassBoostEffect
@@ -447,7 +447,7 @@
 06237de53c42890029e3f8fe7d1480d078469c0d07608e51c37b4d485d342992 android.hardware.camera.device@3.5::ICameraDeviceCallback
 08c68b196e2fc4e5ba67ba0d0917bde828a87cbe2cffec19d04733972da9eb49 android.hardware.camera.device@3.5::ICameraDeviceSession
 a848f7cb3cb3d080cf175bf08412322bfddb535168253796cdf777afdbf05b38 android.hardware.camera.device@3.5::types
-74ec7732fdacb22292c907b49f8f933510851ea1b3ed195c4dcdff35a20387f5 android.hardware.camera.metadata@3.4::types
+f727d5f350f55a6d3354aad2feb64e43200de77c10d9d642465566bc260bb8ec android.hardware.camera.metadata@3.4::types
 0fb39a7809ad1c52b3efbbed5ef4749b06c2a4f1f19cdc3efa2e3d9b28f1205c android.hardware.camera.provider@2.5::ICameraProvider
 f5777403d65135a5407723671bc7a864cdca83aea13ee3ce2894b95e6588ca3a android.hardware.camera.provider@2.5::types
 44c88954b3c201b26f64fcdb6f278024ab3aae864a9e1ec70e8a74274ae9d6aa android.hardware.cas@1.1::ICas
@@ -465,17 +465,18 @@
 2e5ad983734069e84a760004b32da0d09e4170c05380abe27e6eb80e4aa70d5a android.hardware.gnss@2.0::IAGnssCallback
 1f4ac068a88a72360280d94a7f6fd7c63813c1eea4891a0eb01394d3e7e775f2 android.hardware.gnss@2.0::IAGnssRil
 6e2f9a44375a0ae0b49ca7d711cb88945189d398535078408269e1e85889061d android.hardware.gnss@2.0::IGnss
-d815623a6d1ba4abf21248b84eca70a2bfab03058a88b68a29c063ce8aee6b5c android.hardware.gnss@2.0::IGnssCallback
+782dfc724272f279985de348c824197357941382f73c0083f0344d8ec594d2a8 android.hardware.gnss@2.0::IGnssCallback
 ecc966c68bddbd95c8dae782b84204cf01c75734675e8769963f3b5106ec128b android.hardware.gnss@2.0::IGnssConfiguration
 c67759f5d6387d273b66729180d03690e827f0b6b8d4e13ce2ff42d31b224065 android.hardware.gnss@2.0::IGnssMeasurement
 3dd30a3ca77ef5ab109a55ba603ff816ae5019436886093dccf8fd6a068f85f1 android.hardware.gnss@2.0::IGnssMeasurementCallback
-9e66234e65bcde75733d75d8b5d5cc094c2a5e14b074a25cd3f9ad141dc56f60 android.hardware.gnss@2.0::types
-50623a69a88b1c8a05738e4af7d5f78e905f415ccb0e84c99d0a71ea182e9393 android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrections
+4bcd767dd05304b4722c6521c7ed8d4a05faf6022f228f2c088379c647871f7c android.hardware.gnss@2.0::types
+d4cc8d91930d5a1a62deb0d97d398510a115ce3ede2d2978738651b9d01b11c3 android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrections
+3eec9763db9b101644f14175b77c9954047445a468e9c743fd402d472d4aa97e android.hardware.gnss.measurement_corrections@1.0::IMeasurementCorrectionsCallback
 6ef12cd95df73f8f80c25eb035d98ca4594f9cee571fdabea838a0b6016dd908 android.hardware.gnss.measurement_corrections@1.0::types
 0d278956d7fc6fdf9ca9c42962ff2d73967bbb1c9f0b3e0b58d71b7095c286bc android.hardware.gnss.visibility_control@1.0::IGnssVisibilityControl
 0d99e34500cfc2d40b684cb4dea7ebd89d4aff9f5315ed36b33442a7a88c138c android.hardware.gnss.visibility_control@1.0::IGnssVisibilityControlCallback
 6b2d8dfa3db505c34a3a19082d8737c86bd859ec00f0e6c5fd19cce3c1ef95d1 android.hardware.graphics.allocator@3.0::IAllocator
-2a81d3132df91614a30ca45dfe088d67ddbb30240ab8c25feb6b8110d7ec3800 android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer
+eb3bcf4e8afacc72fd09821920f277fbbe8b9837513c1f5549fb42588580cbe4 android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer
 b826892686850a9cf2b60ca5845db7185c2196ea4dd765cd80cd163169678a78 android.hardware.graphics.bufferqueue@2.0::IProducerListener
 01c6398c90fc6be0640810e2c5d8a4863b457280132bb3f97dd5682e19632b62 android.hardware.graphics.bufferqueue@2.0::types
 7a2d64095252f85781b2d521f4f11d04ce774544feececcec2088c568656e93c android.hardware.graphics.common@1.2::types
@@ -493,13 +494,13 @@
 aee53b2865b4f7939fb3df6fae758d9750c14f93dd454b479fc74aa7978fda4f android.hardware.media.bufferpool@2.0::IConnection
 0bf3758eeeb05767830ea87041214be80968c4679fb73577ac5b3091841ee71f android.hardware.media.bufferpool@2.0::IObserver
 82255e252ae215382473ad2e5ac7a2814a439a24f0092551aad7a2f89c6e9546 android.hardware.media.bufferpool@2.0::types
-277161ea99236a0858e9fcc021c357db03be2de500acf5701d125e73e3e8071a android.hardware.media.c2@1.0::IComponent
+7faa207e2507c6a2617e5ec2554b83383ebe392b6e627dddf2e3b0eae5715ba8 android.hardware.media.c2@1.0::IComponent
 389d06e4a4ecf60f828a260045b0c327a5ae883ee0856a3c054556dd22b1f450 android.hardware.media.c2@1.0::IComponentInterface
 5ee0c02265c5505ade189796bef46697df4e0563e3544bb0c934855b34694b07 android.hardware.media.c2@1.0::IComponentListener
 43d70bcdc63b3d042bac3c3297f5d941dfabbd08f3ceb96b6016cc14f6e34ba3 android.hardware.media.c2@1.0::IComponentStore
 d36f747f9c9a8f2f21db2f8323c2d755dd08b34ce813932d7339979f7d490dab android.hardware.media.c2@1.0::IConfigurable
-cd2bd9f424515aeb0c2b91f3bb879797defb5b846b8660784b68d225285bcdff android.hardware.media.c2@1.0::IInputSink
-c3dfaa1fcd452c6cfc26d8dcbb67b71b08a1fe6dad5f87427e93d11a95372b05 android.hardware.media.c2@1.0::IInputSurface
+21aa259585caaa27b6470ebcd8509aabde0ef5d039160aa6425d589cb787488b android.hardware.media.c2@1.0::IInputSink
+b9422a9aca84df1ff9623dc12c0562abce97716e28d63a965f2bfb88f9ad9607 android.hardware.media.c2@1.0::IInputSurface
 0a786a19e6753f9774a7ca7781c2a2edfe5c0b5fa112355dfa0e50ebedeb08b9 android.hardware.media.c2@1.0::IInputSurfaceConnection
 4cb139f729c29d8d6f4ecdab149c4feb571dad8a06e56cd57fcb52e70208bab4 android.hardware.media.c2@1.0::types
 4880af120fc1640225abdc2c60bda6d79617d73484d5124913c7278af3b11e2d android.hardware.neuralnetworks@1.2::IBurstCallback
diff --git a/gnss/2.0/IGnssCallback.hal b/gnss/2.0/IGnssCallback.hal
index 7924b64..4c31cf5 100644
--- a/gnss/2.0/IGnssCallback.hal
+++ b/gnss/2.0/IGnssCallback.hal
@@ -21,7 +21,7 @@
 import GnssLocation;
 
 /**
- * The interface is required for the HAL to communicate certain information
+ * This interface is required for the HAL to communicate certain information
  * like status and location info back to the platform, the platform implements
  * the interfaces and passes a handle to the HAL.
  */
@@ -29,17 +29,36 @@
 
     /** Flags for the gnssSetCapabilities callback. */
     @export(name="", value_prefix="GPS_CAPABILITY_")
-    enum Capabilities : @1.0::IGnssCallback.Capabilities {
-        /** GNSS supports line-of-sight satellite identification measurement Corrections */
-        MEASUREMENT_CORRECTIONS_LOS_SATS                        = 1 << 8,
-        /** GNSS supports per satellite excess-path-length measurement Corrections */
-        MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH              = 1 << 9,
-        /** GNSS supports reflecting planes measurement Corrections */
-        MEASUREMENT_CORRECTIONS_REFLECTING_PLANE                = 1 << 10
+    enum Capabilities : uint32_t {
+        /**
+         * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
+         * If this is not set, then the framework will use 1000ms for
+         * minInterval and must call start() and stop() to schedule the GNSS.
+         */
+        SCHEDULING                      = 1 << 0,
+        /** GNSS supports MS-Based AGNSS mode */
+        MSB                             = 1 << 1,
+        /** GNSS supports MS-Assisted AGNSS mode */
+        MSA                             = 1 << 2,
+        /** GNSS supports single-shot fixes */
+        SINGLE_SHOT                     = 1 << 3,
+        /** GNSS supports on demand time injection */
+        ON_DEMAND_TIME                  = 1 << 4,
+        /**
+         * Values for the flags removed from IGnssCallback.hal@1.0 Capabilities
+         * enum are marked as reserved and not reused here to avoid confusion.
+         */
+        RESERVED_1                      = 1 << 5,
+        RESERVED_2                      = 1 << 6,
+        RESERVED_3                      = 1 << 7,
+        /** GNSS supports low power mode */
+        LOW_POWER_MODE                  = 1 << 8,
+        /** GNSS supports blacklisting satellites */
+        SATELLITE_BLACKLIST             = 1 << 9
     };
 
     /**
-     * Callback to inform framework of the GNSS engine's capabilities.
+     * Callback to inform framework of the GNSS HAL implementation's capabilities.
      *
      * @param capabilities Capability parameter is a bit field of the Capabilities enum.
      */
@@ -75,4 +94,4 @@
      *        during-call to E911, or up to 5 minutes after end-of-call or text to E911).
      */
     gnssRequestLocationCb_2_0(bool independentFromGnss, bool isUserEmergency);
-};
\ No newline at end of file
+};
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
index ee6da53..1dfdadb 100644
--- a/gnss/2.0/default/Gnss.cpp
+++ b/gnss/2.0/default/Gnss.cpp
@@ -269,8 +269,9 @@
 
     sGnssCallback_2_0 = callback;
 
-    uint32_t capabilities = static_cast<uint32_t>(V1_0::IGnssCallback::Capabilities::MEASUREMENTS);
-    auto ret = sGnssCallback_2_0->gnssSetCapabilitesCb(capabilities);
+    using Capabilities = V2_0::IGnssCallback::Capabilities;
+    const auto capabilities = Capabilities::LOW_POWER_MODE | Capabilities::SATELLITE_BLACKLIST;
+    auto ret = sGnssCallback_2_0->gnssSetCapabilitiesCb_2_0(capabilities);
     if (!ret.isOk()) {
         ALOGE("%s: Unable to invoke callback", __func__);
     }
diff --git a/gnss/2.0/default/GnssMeasurementCorrections.cpp b/gnss/2.0/default/GnssMeasurementCorrections.cpp
index cbf34ba..2bf5601 100644
--- a/gnss/2.0/default/GnssMeasurementCorrections.cpp
+++ b/gnss/2.0/default/GnssMeasurementCorrections.cpp
@@ -54,6 +54,19 @@
     return true;
 }
 
+Return<bool> GnssMeasurementCorrections::setCallback(
+        const sp<V1_0::IMeasurementCorrectionsCallback>& callback) {
+    using Capabilities = V1_0::IMeasurementCorrectionsCallback::Capabilities;
+    auto ret =
+            callback->setCapabilitiesCb(Capabilities::LOS_SATS | Capabilities::EXCESS_PATH_LENGTH |
+                                        Capabilities::REFLECTING_PLANE);
+    if (!ret.isOk()) {
+        ALOGE("%s: Unable to invoke callback", __func__);
+        return false;
+    }
+    return true;
+}
+
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace measurement_corrections
diff --git a/gnss/2.0/default/GnssMeasurementCorrections.h b/gnss/2.0/default/GnssMeasurementCorrections.h
index f758bc8..4339bed 100644
--- a/gnss/2.0/default/GnssMeasurementCorrections.h
+++ b/gnss/2.0/default/GnssMeasurementCorrections.h
@@ -38,6 +38,7 @@
 struct GnssMeasurementCorrections : public IMeasurementCorrections {
     // Methods from V1_0::IMeasurementCorrections follow.
     Return<bool> setCorrections(const MeasurementCorrections& corrections) override;
+    Return<bool> setCallback(const sp<V1_0::IMeasurementCorrectionsCallback>& callback) override;
 };
 
 }  // namespace implementation
diff --git a/gnss/2.0/types.hal b/gnss/2.0/types.hal
index 4abb604..21b64f9 100644
--- a/gnss/2.0/types.hal
+++ b/gnss/2.0/types.hal
@@ -69,7 +69,7 @@
      *
      * This clock information can be obtained from SystemClock.elapsedRealtimeNanos(), when the GNSS
      * is attached straight to the AP/SOC. When it is attached to a separate module the timestamp
-     * needs to be estimatedd by syncing the notion of time via PTP or some other mechanism. 
+     * needs to be estimated by syncing the notion of time via PTP or some other mechanism.
      */
     ElapsedRealtime elapsedRealtime;
 };
\ No newline at end of file
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
index c564f41..b2b62fc 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -77,6 +77,16 @@
     EXPECT_EQ(capabilities_called_count_, 1);
     EXPECT_EQ(info_called_count_, 1);
     EXPECT_EQ(name_called_count_, 1);
+
+    // Setup measurement corrections callback.
+    auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
+    ASSERT_TRUE(measurementCorrections.isOk());
+    sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
+    if (iMeasurementCorrections != nullptr) {
+        sp<IMeasurementCorrectionsCallback> iMeasurementCorrectionsCallback =
+                new GnssMeasurementCorrectionsCallback(*this);
+        iMeasurementCorrections->setCallback(iMeasurementCorrectionsCallback);
+    }
 }
 
 void GnssHalTest::StopAndClearLocations() {
@@ -176,6 +186,16 @@
     return status;
 }
 
+std::cv_status GnssHalTest::waitForMeasurementCorrectionsCapabilities(int timeout_seconds) {
+    std::unique_lock<std::mutex> lock(mtx_);
+    auto status = std::cv_status::no_timeout;
+    while (measurement_corrections_capabilities_called_count_ == 0) {
+        status = cv_.wait_for(lock, std::chrono::seconds(timeout_seconds));
+        if (status == std::cv_status::timeout) return status;
+    }
+    return status;
+}
+
 Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
     const IGnssCallback::GnssSystemInfo& info) {
     ALOGI("Info received, year %d", info.yearOfHw);
@@ -243,3 +263,12 @@
     parent_.notify();
     return Void();
 }
+
+Return<void> GnssHalTest::GnssMeasurementCorrectionsCallback::setCapabilitiesCb(
+        uint32_t capabilities) {
+    ALOGI("GnssMeasurementCorrectionsCallback capabilities received %d", capabilities);
+    parent_.measurement_corrections_capabilities_called_count_++;
+    parent_.last_measurement_corrections_capabilities_ = capabilities;
+    parent_.notify();
+    return Void();
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
index 31750a6..7354aea 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test.h
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -28,6 +28,7 @@
 using android::hardware::Return;
 using android::hardware::Void;
 
+using android::hardware::gnss::measurement_corrections::V1_0::IMeasurementCorrectionsCallback;
 using android::hardware::gnss::V1_0::GnssLocationFlags;
 using android::hardware::gnss::V2_0::IGnss;
 using android::hardware::gnss::V2_0::IGnssCallback;
@@ -73,6 +74,8 @@
     /* Test code calls this function to wait for a callback */
     std::cv_status wait(int timeout_seconds);
 
+    std::cv_status waitForMeasurementCorrectionsCapabilities(int timeout_seconds);
+
     /* Callback class for data & Event. */
     class GnssCallback : public IGnssCallback {
        public:
@@ -136,6 +139,17 @@
         Return<void> gnssMeasurementCb_2_0(const IGnssMeasurementCallback_2_0::GnssData&) override;
     };
 
+    /* Callback class for GnssMeasurementCorrections. */
+    class GnssMeasurementCorrectionsCallback : public IMeasurementCorrectionsCallback {
+      public:
+        GnssHalTest& parent_;
+        GnssMeasurementCorrectionsCallback(GnssHalTest& parent) : parent_(parent){};
+        virtual ~GnssMeasurementCorrectionsCallback() = default;
+
+        // Methods from V1_0::IMeasurementCorrectionsCallback follow.
+        Return<void> setCapabilitiesCb(uint32_t capabilities) override;
+    };
+
     /*
      * SetUpGnssCallback:
      *   Set GnssCallback and verify the result.
@@ -192,12 +206,14 @@
      */
     int info_called_count_;
     int capabilities_called_count_;
+    int measurement_corrections_capabilities_called_count_;
     int location_called_count_;
     int measurement_called_count_;
     int name_called_count_;
 
     IGnssCallback::GnssSystemInfo last_info_;
     uint32_t last_capabilities_;
+    uint32_t last_measurement_corrections_capabilities_;
     GnssLocation_2_0 last_location_;
     IGnssMeasurementCallback_2_0::GnssData last_measurement_;
     android::hardware::hidl_string last_name_;
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
index 67fda89..f3559c5 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -38,6 +38,7 @@
 using android::hardware::gnss::measurement_corrections::V1_0::MeasurementCorrections;
 using android::hardware::gnss::V1_0::IGnssNi;
 using android::hardware::gnss::V2_0::ElapsedRealtimeFlags;
+using android::hardware::gnss::V2_0::IGnssCallback;
 using android::hardware::gnss::visibility_control::V1_0::IGnssVisibilityControl;
 
 /*
@@ -50,23 +51,21 @@
 
 /*
  * TestGnssMeasurementCallback:
- * Gets the GnssMeasurementExtension and verify that it returns an actual extension.
+ * Gets the GnssMeasurementExtension and verifies that it returns an actual extension.
  */
 TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
     auto gnssMeasurement_2_0 = gnss_hal_->getExtensionGnssMeasurement_2_0();
     auto gnssMeasurement_1_1 = gnss_hal_->getExtensionGnssMeasurement_1_1();
     auto gnssMeasurement_1_0 = gnss_hal_->getExtensionGnssMeasurement();
-    ASSERT_TRUE(gnssMeasurement_2_0.isOk() || gnssMeasurement_1_1.isOk() ||
+    ASSERT_TRUE(gnssMeasurement_2_0.isOk() && gnssMeasurement_1_1.isOk() &&
                 gnssMeasurement_1_0.isOk());
-    if (last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS) {
-        sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
-        sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
-        sp<IGnssMeasurement_1_0> iGnssMeas_1_0 = gnssMeasurement_1_0;
-        // At least one interface is non-null.
-        int numNonNull = (int)(iGnssMeas_2_0 != nullptr) + (int)(iGnssMeas_1_1 != nullptr) +
-                         (int)(iGnssMeas_1_0 != nullptr);
-        ASSERT_TRUE(numNonNull >= 1);
-    }
+    sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
+    sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
+    sp<IGnssMeasurement_1_0> iGnssMeas_1_0 = gnssMeasurement_1_0;
+    // At least one interface is non-null.
+    int numNonNull = (int)(iGnssMeas_2_0 != nullptr) + (int)(iGnssMeas_1_1 != nullptr) +
+                     (int)(iGnssMeas_1_0 != nullptr);
+    ASSERT_TRUE(numNonNull >= 1);
 }
 
 /*
@@ -267,8 +266,30 @@
 }
 
 /*
+ * TestGnssMeasurementCorrectionsCapabilities:
+ * If the GnssMeasurementCorrectionsExtension is not null, verifies that the measurement corrections
+ * capabilities are reported and the mandatory LOS_SATS or the EXCESS_PATH_LENGTH
+ * capability flag is set.
+ */
+TEST_F(GnssHalTest, TestGnssMeasurementCorrectionsCapabilities) {
+    auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
+    ASSERT_TRUE(measurementCorrections.isOk());
+    sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
+    if (iMeasurementCorrections == nullptr) {
+        return;
+    }
+
+    const int kMeasurementCorrectionsCapabilitiesTimeoutSeconds = 5;
+    waitForMeasurementCorrectionsCapabilities(kMeasurementCorrectionsCapabilitiesTimeoutSeconds);
+    ASSERT_TRUE(measurement_corrections_capabilities_called_count_ > 0);
+    using Capabilities = IMeasurementCorrectionsCallback::Capabilities;
+    ASSERT_TRUE((last_measurement_corrections_capabilities_ &
+                 (Capabilities::LOS_SATS | Capabilities::EXCESS_PATH_LENGTH)) != 0);
+}
+
+/*
  * TestGnssMeasurementCorrections:
- * Gets the GnssMeasurementCorrectionsExtension and verifies that it supports the
+ * If the GnssMeasurementCorrectionsExtension is not null, verifies that it supports the
  * gnss.measurement_corrections@1.0::IMeasurementCorrections interface by invoking a method.
  */
 TEST_F(GnssHalTest, TestGnssMeasurementCorrections) {
@@ -276,8 +297,13 @@
     auto measurementCorrections = gnss_hal_->getExtensionMeasurementCorrections();
     ASSERT_TRUE(measurementCorrections.isOk());
     sp<IMeasurementCorrections> iMeasurementCorrections = measurementCorrections;
-    ASSERT_NE(iMeasurementCorrections, nullptr);
+    if (iMeasurementCorrections == nullptr) {
+        return;
+    }
 
+    const int kMeasurementCorrectionsCapabilitiesTimeoutSeconds = 5;
+    waitForMeasurementCorrectionsCapabilities(kMeasurementCorrectionsCapabilitiesTimeoutSeconds);
+    ASSERT_TRUE(measurement_corrections_capabilities_called_count_ > 0);
     // Set a mock MeasurementCorrections.
     auto result = iMeasurementCorrections->setCorrections(Utils::getMockMeasurementCorrections());
     ASSERT_TRUE(result.isOk());
diff --git a/gnss/measurement_corrections/1.0/Android.bp b/gnss/measurement_corrections/1.0/Android.bp
index 4aac7e0..456b55c 100644
--- a/gnss/measurement_corrections/1.0/Android.bp
+++ b/gnss/measurement_corrections/1.0/Android.bp
@@ -9,6 +9,7 @@
     srcs: [
         "types.hal",
         "IMeasurementCorrections.hal",
+        "IMeasurementCorrectionsCallback.hal",
     ],
     interfaces: [
         "android.hardware.gnss@1.0",
diff --git a/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal b/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal
index 934d10f..1fa32f4 100644
--- a/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal
+++ b/gnss/measurement_corrections/1.0/IMeasurementCorrections.hal
@@ -16,11 +16,12 @@
 
 package android.hardware.gnss.measurement_corrections@1.0;
 
+import IMeasurementCorrectionsCallback;
+
 /**
  * Interface for measurement corrections support.
  */
 interface IMeasurementCorrections {
-
     /**
      * Injects measurement corrections to be used by the HAL to improve the GNSS location output.
      *
@@ -35,5 +36,15 @@
      *
      * @return success Whether the HAL can accept & use these corrections.
      */
-     setCorrections(MeasurementCorrections corrections) generates (bool success);
-};
+    setCorrections(MeasurementCorrections corrections) generates (bool success);
+
+    /**
+     * Opens the interface and provides the callback routines to the implementation of this
+     * interface.
+     *
+     * @param callback Callback interface for IMeasurementCorrections.
+     *
+     * @return success Returns true on success.
+     */
+    setCallback(IMeasurementCorrectionsCallback callback) generates (bool success);
+};
\ No newline at end of file
diff --git a/gnss/measurement_corrections/1.0/IMeasurementCorrectionsCallback.hal b/gnss/measurement_corrections/1.0/IMeasurementCorrectionsCallback.hal
new file mode 100644
index 0000000..91d1311
--- /dev/null
+++ b/gnss/measurement_corrections/1.0/IMeasurementCorrectionsCallback.hal
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss.measurement_corrections@1.0;
+
+/**
+ * GNSS measurement corrections callback interface.
+ */
+interface IMeasurementCorrectionsCallback {
+
+    /**
+     * Flags to indicate supported measurement corrections capabilities
+     *
+     * Either the LOS_SATS or the EXCESS_PATH_LENGTH capability must be supported.
+     */
+    enum Capabilities : uint32_t {
+        /** GNSS supports line-of-sight satellite identification measurement corrections */
+        LOS_SATS                        = 1 << 0,
+        /** GNSS supports per satellite excess-path-length measurement corrections */
+        EXCESS_PATH_LENGTH              = 1 << 1,
+        /** GNSS supports reflecting planes measurement corrections */
+        REFLECTING_PLANE                = 1 << 2
+    };
+
+    /**
+     * Callback to inform framework the measurement correction specific capabilities of the GNSS
+     * HAL implementation.
+     *
+     * The GNSS HAL must call this method immediately after the framework opens the measurement
+     * corrections interface.
+     *
+     * @param capabilities Supported measurement corrections capabilities. It is mandatory to
+     *        support either LOS_STATS or EXCESS_PATH_LENGTH capability.
+     *
+     */
+    setCapabilitiesCb(bitfield<Capabilities> capabilities);
+};
\ No newline at end of file
diff --git a/graphics/bufferqueue/2.0/IGraphicBufferProducer.hal b/graphics/bufferqueue/2.0/IGraphicBufferProducer.hal
index 734c0b4..23b360a 100644
--- a/graphics/bufferqueue/2.0/IGraphicBufferProducer.hal
+++ b/graphics/bufferqueue/2.0/IGraphicBufferProducer.hal
@@ -75,12 +75,19 @@
      * @param slot Slot index.
      * @return status Status of the call.
      * @return buffer New buffer associated to the given slot index.
+     * @return generationNumber Generation number of the buffer. If
+     *     requestBuffer() is called immediately after dequeueBuffer() returns
+     *     with `bufferNeedsReallocation` set to `true`, @p generationNumber must
+     *     match the current generation number of the buffer queue previously
+     *     set by setGenerationNumber(). Otherwise, @p generationNumber may not
+     *     match the current generation number of the buffer queue.
      */
     requestBuffer(
             int32_t slot
         ) generates (
             Status status,
-            HardwareBuffer buffer
+            HardwareBuffer buffer,
+            uint32_t generationNumber
         );
 
     /**
@@ -212,9 +219,9 @@
      * parameter.
      *
      * @param input See #DequeueBufferInput for more information.
-     * @param status Status of the call.
-     * @param slot Slot index.
-     * @param output See #DequeueBufferOutput for more information.
+     * @return status Status of the call.
+     * @return slot Slot index.
+     * @return output See #DequeueBufferOutput for more information.
      *
      * @sa queueBuffer(), requestBuffer().
      */
@@ -286,6 +293,9 @@
      * See dequeueBuffer() for conditions that may cause the call to fail.
      *
      * @param buffer Buffer to attach to the buffer queue.
+     * @param generationNumber Generation number of the buffer. If this does not
+     *     match the current generation number of the buffer queue, the call
+     *     must fail with @p status set to `BAD_VALUE`.
      * @return status Status of the call.
      * @return slot Slot index assigned to @p buffer.
      * @return releaseAllBuffers Whether the caller is expected to release all
@@ -294,7 +304,8 @@
      * @sa dequeueBuffer().
      */
     attachBuffer(
-            HardwareBuffer buffer
+            HardwareBuffer buffer,
+            uint32_t generationNumber
         ) generates (
             Status status,
             int32_t slot,
diff --git a/keymaster/4.0/support/Keymaster.cpp b/keymaster/4.0/support/Keymaster.cpp
index 9325cc0..e8db074 100644
--- a/keymaster/4.0/support/Keymaster.cpp
+++ b/keymaster/4.0/support/Keymaster.cpp
@@ -106,6 +106,19 @@
     return result;
 }
 
+void Keymaster::logIfKeymasterVendorError(ErrorCode ec) const {
+    static constexpr int32_t k_keymaster_vendor_error_code_range_max = -10000;
+    if (static_cast<int32_t>(ec) <= k_keymaster_vendor_error_code_range_max) {
+        const auto& versionInfo = halVersion();
+        LOG(ERROR) << "Keymaster reported error: " << static_cast<int32_t>(ec) << "\n"
+                   << "NOTE: This is an error in the vendor specific error range.\n"
+                   << "      Refer to the vendor of the implementation for details.\n"
+                   << "      Implementation name: " << versionInfo.keymasterName << "\n"
+                   << "      Vendor name:         " << versionInfo.authorName << "\n"
+                   << "      MajorVersion:        " << versionInfo.majorVersion;
+    }
+}
+
 Keymaster::KeymasterSet Keymaster::enumerateAvailableDevices() {
     auto serviceManager = IServiceManager::getService();
     CHECK(serviceManager) << "Could not retrieve ServiceManager";
diff --git a/keymaster/4.0/support/include/keymasterV4_0/Keymaster.h b/keymaster/4.0/support/include/keymasterV4_0/Keymaster.h
index 458053a..43a34b0 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/Keymaster.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/Keymaster.h
@@ -65,6 +65,12 @@
     const hidl_string& instanceName() const { return instanceName_; }
 
     /**
+     * If ec is in the vendor error code range (<-10000), logs the fact to logcat.
+     * There are no side effects otherwise.
+     */
+    void logIfKeymasterVendorError(ErrorCode ec) const;
+
+    /**
      * Returns all available Keymaster3 and Keymaster4 instances, in order of most secure to least
      * secure (as defined by VersionResult::operator<).
      */
diff --git a/media/c2/1.0/Android.bp b/media/c2/1.0/Android.bp
index 6c836af..7307a81 100644
--- a/media/c2/1.0/Android.bp
+++ b/media/c2/1.0/Android.bp
@@ -19,7 +19,10 @@
     ],
     interfaces: [
         "android.hardware.graphics.bufferqueue@1.0",
+        "android.hardware.graphics.bufferqueue@2.0",
         "android.hardware.graphics.common@1.0",
+        "android.hardware.graphics.common@1.1",
+        "android.hardware.graphics.common@1.2",
         "android.hardware.media.bufferpool@2.0",
         "android.hardware.media.omx@1.0",
         "android.hardware.media@1.0",
diff --git a/media/c2/1.0/IComponent.hal b/media/c2/1.0/IComponent.hal
index abd1448..51ef4e1 100644
--- a/media/c2/1.0/IComponent.hal
+++ b/media/c2/1.0/IComponent.hal
@@ -17,6 +17,7 @@
 package android.hardware.media.c2@1.0;
 
 import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer;
+import android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer;
 import android.hardware.media.omx@1.0::IGraphicBufferSource;
 
 import IConfigurable;
@@ -128,7 +129,7 @@
      */
     setOutputSurface(
             uint64_t blockPoolId,
-            IGraphicBufferProducer surface
+            @2.0::IGraphicBufferProducer surface
         ) generates (
             Status status
         );
@@ -184,7 +185,7 @@
      *     null.
      */
     connectToOmxInputSurface(
-            IGraphicBufferProducer producer,
+            @1.0::IGraphicBufferProducer producer,
             IGraphicBufferSource source
         ) generates (
             Status status,
diff --git a/media/c2/1.0/IInputSink.hal b/media/c2/1.0/IInputSink.hal
index 809c27a..767eb73 100644
--- a/media/c2/1.0/IInputSink.hal
+++ b/media/c2/1.0/IInputSink.hal
@@ -16,8 +16,6 @@
 
 package android.hardware.media.c2@1.0;
 
-import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer;
-
 import IConfigurable;
 
 /**
diff --git a/media/c2/1.0/IInputSurface.hal b/media/c2/1.0/IInputSurface.hal
index d11ce15..3eee7f1 100644
--- a/media/c2/1.0/IInputSurface.hal
+++ b/media/c2/1.0/IInputSurface.hal
@@ -16,7 +16,7 @@
 
 package android.hardware.media.c2@1.0;
 
-import android.hardware.graphics.bufferqueue@1.0::IGraphicBufferProducer;
+import android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer;
 
 import IConfigurable;
 import IInputSink;