Merge "Remove conditional vndbinder usage in CAS."
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index c074f3c..61d5d8e 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -415,7 +415,7 @@
     // spam the log in this case.
     static const std::vector<int> ignoredErrors{ENOSYS};
     Result retval(Result::NOT_SUPPORTED);
-    if (stream->get_capture_position != NULL) return retval;
+    if (stream->get_capture_position == NULL) return retval;
     int64_t halFrames, halTime;
     retval = Stream::analyzeStatus("get_capture_position",
                                    stream->get_capture_position(stream, &halFrames, &halTime),
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
index ec35200..6754843 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/Android.bp
@@ -23,5 +23,9 @@
     strip: {
         keep_symbols: true,
     },
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
     srcs: ["VehicleHalProto.proto"]
 }
diff --git a/bluetooth/1.0/default/test/bluetooth_address_test.cc b/bluetooth/1.0/default/test/bluetooth_address_test.cc
index e60729e..2c8dbe5 100644
--- a/bluetooth/1.0/default/test/bluetooth_address_test.cc
+++ b/bluetooth/1.0/default/test/bluetooth_address_test.cc
@@ -56,7 +56,7 @@
 
 void BluetoothAddressTest::FileWriteString(const char* path,
                                            const char* string) {
-  int fd = open(path, O_CREAT | O_RDWR);
+  int fd = open(path, O_CREAT | O_RDWR, 0600);
   EXPECT_TRUE(fd > 0) << "err = " << strerror(errno);
 
   size_t length = strlen(string);
diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp
index 3d4fe05..c016c16 100644
--- a/broadcastradio/1.1/vts/functional/Android.bp
+++ b/broadcastradio/1.1/vts/functional/Android.bp
@@ -21,6 +21,7 @@
     static_libs: [
         "android.hardware.broadcastradio@1.0",
         "android.hardware.broadcastradio@1.1",
+        "android.hardware.broadcastradio@1.2",  // common-utils-lib dependency
         "android.hardware.broadcastradio@common-utils-lib",
         "android.hardware.broadcastradio@vts-utils-lib",
         "libgmock",
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index a46378e..bb490c9 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -525,6 +525,98 @@
     ASSERT_FALSE(forced);
 }
 
+static void verifyIdentifier(const ProgramIdentifier& id) {
+    EXPECT_NE(id.type, 0u);
+    auto val = id.value;
+
+    switch (static_cast<IdentifierType>(id.type)) {
+        case IdentifierType::AMFM_FREQUENCY:
+        case IdentifierType::DAB_FREQUENCY:
+        case IdentifierType::DRMO_FREQUENCY:
+            EXPECT_GT(val, 100u) << "Expected f > 100kHz";
+            EXPECT_LT(val, 10000000u) << "Expected f < 10GHz";
+            break;
+        case IdentifierType::RDS_PI:
+            EXPECT_GT(val, 0u);
+            EXPECT_LE(val, 0xFFFFu) << "Expected 16bit id";
+            break;
+        case IdentifierType::HD_STATION_ID_EXT: {
+            auto stationId = val & 0xFFFFFFFF;  // 32bit
+            val >>= 32;
+            auto subchannel = val & 0xF;  // 4bit
+            val >>= 4;
+            auto freq = val & 0x3FFFF;  // 18bit
+            EXPECT_GT(stationId, 0u);
+            EXPECT_LT(subchannel, 8u) << "Expected ch < 8";
+            EXPECT_GT(freq, 100u) << "Expected f > 100kHz";
+            EXPECT_LT(freq, 10000000u) << "Expected f < 10GHz";
+            break;
+        }
+        case IdentifierType::HD_SUBCHANNEL:
+            EXPECT_LT(val, 8u) << "Expected ch < 8";
+            break;
+        case IdentifierType::DAB_SIDECC: {
+            auto sid = val & 0xFFFF;  // 16bit
+            val >>= 16;
+            auto ecc = val & 0xFF;  // 8bit
+            EXPECT_NE(sid, 0u);
+            EXPECT_GE(ecc, 0xA0u) << "Invalid ECC, see ETSI TS 101 756 V2.1.1";
+            EXPECT_LE(ecc, 0xF6u) << "Invalid ECC, see ETSI TS 101 756 V2.1.1";
+            break;
+        }
+        case IdentifierType::DAB_ENSEMBLE:
+            EXPECT_GT(val, 0u);
+            EXPECT_LE(val, 0xFFFFu) << "Expected 16bit id";
+            break;
+        case IdentifierType::DAB_SCID:
+            EXPECT_GT(val, 0xFu) << "Expected 12bit SCId (not 4bit SCIdS)";
+            EXPECT_LE(val, 0xFFFu) << "Expected 12bit id";
+            break;
+        case IdentifierType::DRMO_SERVICE_ID:
+            EXPECT_GT(val, 0u);
+            EXPECT_LE(val, 0xFFFFFFu) << "Expected 24bit id";
+            break;
+        case IdentifierType::DRMO_MODULATION:
+            EXPECT_GE(val, static_cast<uint32_t>(Modulation::AM));
+            EXPECT_LE(val, static_cast<uint32_t>(Modulation::FM));
+            break;
+        case IdentifierType::SXM_SERVICE_ID:
+            EXPECT_GT(val, 0u);
+            EXPECT_LE(val, 0xFFFFFFFFu) << "Expected 32bit id";
+            break;
+        case IdentifierType::SXM_CHANNEL:
+            EXPECT_LT(val, 1000u);
+            break;
+        case IdentifierType::VENDOR_PRIMARY_START:
+        case IdentifierType::VENDOR_PRIMARY_END:
+            // skip
+            break;
+    }
+}
+
+/**
+ * Test ProgramIdentifier format.
+ *
+ * Verifies that:
+ * - values of ProgramIdentifier match their definitions at IdentifierType.
+ */
+TEST_P(BroadcastRadioHalTest, VerifyIdentifiersFormat) {
+    if (skipped) return;
+    ASSERT_TRUE(openTuner());
+
+    do {
+        auto getCb = [&](const hidl_vec<ProgramInfo>& list) {
+            for (auto&& program : list) {
+                verifyIdentifier(program.selector.primaryId);
+                for (auto&& id : program.selector.secondaryIds) {
+                    verifyIdentifier(id);
+                }
+            }
+        };
+        getProgramList(getCb);
+    } while (nextBand());
+}
+
 INSTANTIATE_TEST_CASE_P(BroadcastRadioHalTestCases, BroadcastRadioHalTest,
                         ::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
 
diff --git a/broadcastradio/1.2/default/Tuner.cpp b/broadcastradio/1.2/default/Tuner.cpp
index 70418cf..6209dc1 100644
--- a/broadcastradio/1.2/default/Tuner.cpp
+++ b/broadcastradio/1.2/default/Tuner.cpp
@@ -35,13 +35,13 @@
 using V1_0::BandConfig;
 using V1_0::Class;
 using V1_0::Direction;
-using V1_1::IdentifierType;
 using V1_1::ProgramInfo;
 using V1_1::ProgramInfoFlags;
 using V1_1::ProgramListResult;
 using V1_1::ProgramSelector;
 using V1_1::ProgramType;
 using V1_1::VendorKeyValue;
+using V1_2::IdentifierType;
 using utils::HalRevision;
 
 using std::chrono::milliseconds;
@@ -282,7 +282,7 @@
             return Result::INVALID_ARGUMENTS;
         }
     } else if (programType == ProgramType::DAB) {
-        if (!utils::hasId(sel, IdentifierType::DAB_SIDECC)) return Result::INVALID_ARGUMENTS;
+        if (!utils::hasId(sel, IdentifierType::DAB_SID_EXT)) return Result::INVALID_ARGUMENTS;
     } else if (programType == ProgramType::DRMO) {
         if (!utils::hasId(sel, IdentifierType::DRMO_SERVICE_ID)) return Result::INVALID_ARGUMENTS;
     } else if (programType == ProgramType::SXM) {
diff --git a/broadcastradio/1.2/default/VirtualProgram.cpp b/broadcastradio/1.2/default/VirtualProgram.cpp
index 95879e3..3284bd1 100644
--- a/broadcastradio/1.2/default/VirtualProgram.cpp
+++ b/broadcastradio/1.2/default/VirtualProgram.cpp
@@ -30,9 +30,9 @@
 using V1_0::MetaData;
 using V1_0::MetadataKey;
 using V1_0::MetadataType;
-using V1_1::IdentifierType;
 using V1_1::ProgramInfo;
 using V1_1::VendorKeyValue;
+using V1_2::IdentifierType;
 using utils::HalRevision;
 
 static MetaData createDemoBitmap(MetadataKey key, HalRevision halRev) {
diff --git a/broadcastradio/1.2/types.hal b/broadcastradio/1.2/types.hal
index 5edb097..7301e13 100644
--- a/broadcastradio/1.2/types.hal
+++ b/broadcastradio/1.2/types.hal
@@ -16,8 +16,35 @@
 
 package android.hardware.broadcastradio@1.2;
 
+import @1.1::IdentifierType;
 import @1.1::Result;
 import @1.1::VendorKeyValue;
 
 typedef @1.1::Result Result;
 typedef @1.1::VendorKeyValue VendorKeyValue;
+
+enum IdentifierType : @1.1::IdentifierType {
+    /**
+     * 28bit compound primary identifier for DAB.
+     *
+     * Consists of (from the LSB):
+     * - 16bit: SId;
+     * - 8bit: ECC code;
+     * - 4bit: SCIdS (optional).
+     *
+     * SCIdS (Service Component Identifier within the Service) value
+     * of 0 represents the main service, while 1 and above represents
+     * secondary services.
+     *
+     * The remaining bits should be set to zeros when writing on the chip side
+     * and ignored when read.
+     *
+     * This identifier deprecates DAB_SIDECC and makes new primary identifier
+     * for DAB. If the hal implementation detects 1.2 client (by casting
+     * V1_0::ITunerCallback to V1_2::ITunerCallback), it must use DAB_SID_EXT
+     * as a primary identifier for DAB program type. If the hal client detects
+     * either 1.1 or 1.2 HAL, it must convert those identifiers to the
+     * correct version.
+     */
+    DAB_SID_EXT = SXM_CHANNEL + 1,
+};
diff --git a/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp b/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp
index f075945..f3552a8 100644
--- a/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp
+++ b/broadcastradio/1.2/vts/functional/VtsHalBroadcastradioV1_2TargetTest.cpp
@@ -295,6 +295,9 @@
     ASSERT_EQ(0u, halResults.size());
 }
 
+// TODO(b/69860743): implement VerifyIdentifiersFormat test when
+// the new program list fetching mechanism is implemented
+
 INSTANTIATE_TEST_CASE_P(BroadcastRadioHalTestCases, BroadcastRadioHalTest,
                         ::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
 
diff --git a/broadcastradio/common/utils/Android.bp b/broadcastradio/common/utils/Android.bp
index d8bd125..d29d05c 100644
--- a/broadcastradio/common/utils/Android.bp
+++ b/broadcastradio/common/utils/Android.bp
@@ -29,6 +29,6 @@
     ],
     export_include_dirs: ["include"],
     shared_libs: [
-        "android.hardware.broadcastradio@1.1",
+        "android.hardware.broadcastradio@1.2",
     ],
 }
diff --git a/broadcastradio/common/utils/Utils.cpp b/broadcastradio/common/utils/Utils.cpp
index bdaf8e8..22a6970 100644
--- a/broadcastradio/common/utils/Utils.cpp
+++ b/broadcastradio/common/utils/Utils.cpp
@@ -26,10 +26,10 @@
 namespace utils {
 
 using V1_0::Band;
-using V1_1::IdentifierType;
 using V1_1::ProgramIdentifier;
 using V1_1::ProgramSelector;
 using V1_1::ProgramType;
+using V1_2::IdentifierType;
 
 static bool isCompatibleProgramType(const uint32_t ia, const uint32_t ib) {
     auto a = static_cast<ProgramType>(ia);
@@ -88,7 +88,7 @@
 
             return haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY);
         case ProgramType::DAB:
-            return haveEqualIds(a, b, IdentifierType::DAB_SIDECC);
+            return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT);
         case ProgramType::DRMO:
             return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID);
         case ProgramType::SXM:
@@ -126,23 +126,50 @@
     return band == Band::FM || band == Band::FM_HD;
 }
 
-bool hasId(const ProgramSelector& sel, const IdentifierType type) {
+static bool maybeGetId(const ProgramSelector& sel, const IdentifierType type, uint64_t* val) {
     auto itype = static_cast<uint32_t>(type);
-    if (sel.primaryId.type == itype) return true;
-    // not optimal, but we don't care in default impl
-    for (auto&& id : sel.secondaryIds) {
-        if (id.type == itype) return true;
+    auto itypeAlt = itype;
+    if (type == IdentifierType::DAB_SIDECC) {
+        itypeAlt = static_cast<uint32_t>(IdentifierType::DAB_SID_EXT);
     }
-    return false;
+    if (type == IdentifierType::DAB_SID_EXT) {
+        itypeAlt = static_cast<uint32_t>(IdentifierType::DAB_SIDECC);
+    }
+
+    if (sel.primaryId.type == itype || sel.primaryId.type == itypeAlt) {
+        if (val) *val = sel.primaryId.value;
+        return true;
+    }
+
+    // not optimal, but we don't care in default impl
+    bool gotAlt = false;
+    for (auto&& id : sel.secondaryIds) {
+        if (id.type == itype) {
+            if (val) *val = id.value;
+            return true;
+        }
+        // alternative identifier is a backup, we prefer original value
+        if (id.type == itypeAlt) {
+            if (val) *val = id.value;
+            gotAlt = true;
+            continue;
+        }
+    }
+
+    return gotAlt;
+}
+
+bool hasId(const ProgramSelector& sel, const IdentifierType type) {
+    return maybeGetId(sel, type, nullptr);
 }
 
 uint64_t getId(const ProgramSelector& sel, const IdentifierType type) {
-    auto itype = static_cast<uint32_t>(type);
-    if (sel.primaryId.type == itype) return sel.primaryId.value;
-    // not optimal, but we don't care in default impl
-    for (auto&& id : sel.secondaryIds) {
-        if (id.type == itype) return id.value;
+    uint64_t val;
+
+    if (maybeGetId(sel, type, &val)) {
+        return val;
     }
+
     ALOGW("Identifier %s not found", toString(type).c_str());
     return 0;
 }
diff --git a/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h b/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h
index b07ce79..9cdc629 100644
--- a/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h
+++ b/broadcastradio/common/utils/include/broadcastradio-utils/Utils.h
@@ -16,7 +16,7 @@
 #ifndef ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_H
 #define ANDROID_HARDWARE_BROADCASTRADIO_COMMON_UTILS_H
 
-#include <android/hardware/broadcastradio/1.1/types.h>
+#include <android/hardware/broadcastradio/1.2/types.h>
 #include <chrono>
 #include <queue>
 #include <thread>
@@ -50,21 +50,21 @@
 bool isAm(const V1_0::Band band);
 bool isFm(const V1_0::Band band);
 
-bool hasId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type);
+bool hasId(const V1_1::ProgramSelector& sel, const V1_2::IdentifierType type);
 
 /**
  * Returns ID (either primary or secondary) for a given program selector.
  *
  * If the selector does not contain given type, returns 0 and emits a warning.
  */
-uint64_t getId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type);
+uint64_t getId(const V1_1::ProgramSelector& sel, const V1_2::IdentifierType type);
 
 /**
  * Returns ID (either primary or secondary) for a given program selector.
  *
  * If the selector does not contain given type, returns default value.
  */
-uint64_t getId(const V1_1::ProgramSelector& sel, const V1_1::IdentifierType type, uint64_t defval);
+uint64_t getId(const V1_1::ProgramSelector& sel, const V1_2::IdentifierType type, uint64_t defval);
 
 V1_1::ProgramSelector make_selector(V1_0::Band band, uint32_t channel, uint32_t subChannel = 0);
 
diff --git a/gnss/1.1/Android.bp b/gnss/1.1/Android.bp
new file mode 100644
index 0000000..6909807
--- /dev/null
+++ b/gnss/1.1/Android.bp
@@ -0,0 +1,20 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+    name: "android.hardware.gnss@1.1",
+    root: "android.hardware",
+    vndk: {
+        enabled: true,
+    },
+    srcs: [
+        "IGnss.hal",
+        "IGnssCallback.hal",
+        "IGnssMeasurement.hal",
+    ],
+    interfaces: [
+        "android.hardware.gnss@1.0",
+        "android.hidl.base@1.0",
+    ],
+    gen_java: true,
+}
+
diff --git a/gnss/1.1/IGnss.hal b/gnss/1.1/IGnss.hal
new file mode 100644
index 0000000..d5e0c3e
--- /dev/null
+++ b/gnss/1.1/IGnss.hal
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2017 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@1.1;
+
+import @1.0::IGnss;
+
+import IGnssMeasurement;
+import IGnssCallback;
+
+/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
+interface IGnss extends @1.0::IGnss {
+    /**
+     * Opens the interface and provides the callback routines to the implementation of this
+     * interface.
+     *
+     * @param callback Callback interface for IGnss.
+     *
+     * @return success Returns true on success.
+     */
+    setCallback_1_1(IGnssCallback callback) generates (bool success);
+
+    /**
+     * Sets the GnssPositionMode parameter, its associated recurrence value,
+     * the time between fixes, requested fix accuracy, time to first fix.
+     *
+     * @param mode Parameter must be one of MS_BASED or STANDALONE. It is allowed by the platform
+     *     (and it is recommended) to fallback to MS_BASED if MS_ASSISTED is passed in, and MS_BASED
+     *     is supported.
+     * @param recurrence GNSS postion recurrence value, either periodic or single.
+     * @param minIntervalMs Represents the time between fixes in milliseconds.
+     * @param preferredAccuracyMeters Represents the requested fix accuracy in meters.
+     * @param preferredTimeMs Represents the requested time to first fix in milliseconds.
+     * @param lowPowerMode When true, HAL must make strong tradeoffs to substantially restrict power
+     *     use. Specifically, in the case of a several second long minIntervalMs, the GNSS chipset
+     *     must not, on average, run power hungry operations like RF and signal searches for more
+     *     than one second per interval, and must make exactly one call to gnssSvStatusCb(), and
+     *     either zero or one call to GnssLocationCb() at each interval. When false, HAL must
+     *     operate in the nominal mode (similar to V1.0 where this flag wasn't present) and is
+     *     expected to make power and performance tradoffs such as duty-cycling when signal
+     *     conditions are good and more active searches to reacquire GNSS signals when no signals
+     *     are present.
+     *
+     * @return success Returns true if successful.
+     */
+    setPositionMode_1_1(GnssPositionMode mode,
+                        GnssPositionRecurrence recurrence,
+                        uint32_t minIntervalMs,
+                        uint32_t preferredAccuracyMeters,
+                        uint32_t preferredTimeMs,
+                        bool lowPowerMode)
+             generates (bool success);
+
+   /**
+    * This method returns the IGnssMeasurement interface.
+    *
+    * @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
+    */
+    getExtensionGnssMeasurement_1_1() generates (IGnssMeasurement gnssMeasurementIface);
+};
\ No newline at end of file
diff --git a/gnss/1.1/IGnssCallback.hal b/gnss/1.1/IGnssCallback.hal
new file mode 100644
index 0000000..7a2849e
--- /dev/null
+++ b/gnss/1.1/IGnssCallback.hal
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 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@1.1;
+
+import @1.0::IGnssCallback;
+
+/**
+ * The 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.
+ */
+interface IGnssCallback extends @1.0::IGnssCallback {
+    /**
+     * Callback to inform framework of the GNSS HAL implementation model & version name.
+     *
+     * This is a user-visible string that identifies the model and version of the GNSS HAL.
+     * For example "ABC Co., Baseband Part 1234, RF Part 567, Software version 3.14.159"
+     *
+     * This must be called in response to IGnss::setCallback
+     *
+     * @param name String providing the name of the GNSS HAL implementation
+     */
+    gnssNameCb(string name);
+};
\ No newline at end of file
diff --git a/gnss/1.1/IGnssMeasurement.hal b/gnss/1.1/IGnssMeasurement.hal
new file mode 100644
index 0000000..75df5a8
--- /dev/null
+++ b/gnss/1.1/IGnssMeasurement.hal
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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@1.1;
+
+import @1.0::IGnssMeasurement;
+import @1.0::IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement extends @1.0::IGnssMeasurement {
+
+    /**
+     * Initializes the interface and registers the callback routines with the HAL. After a
+     * successful call to 'setCallback_1_1' the HAL must begin to provide updates at an average
+     * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+     * can be tolerated.)
+     *
+     * @param callback Handle to GnssMeasurement callback interface.
+     * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+     *     no clock discontinuities are expected and, when supported, carrier phase should be
+     *     continuous in good signal conditions. All constellations and frequency bands that the
+     *     chipset supports must be reported in this mode. The GNSS chipset is allowed to consume
+     *     more power in this mode. If false, API must behave as in HAL V1_0, optimizing power via
+     *     duty cycling, constellations and frequency limits, etc.
+     *
+     * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+     *     already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+     *     for any other error. The HAL must not generate any other updates upon returning this
+     *     error code.
+     */
+    setCallback_1_1(IGnssMeasurementCallback callback, bool enableFullTracking)
+         generates (GnssMeasurementStatus initRet);
+
+};
diff --git a/gnss/1.1/vts/OWNERS b/gnss/1.1/vts/OWNERS
new file mode 100644
index 0000000..56648ad
--- /dev/null
+++ b/gnss/1.1/vts/OWNERS
@@ -0,0 +1,6 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+
+# VTS team
+yim@google.com
diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..67ef486
--- /dev/null
+++ b/gnss/1.1/vts/functional/Android.bp
@@ -0,0 +1,29 @@
+//
+// Copyright (C) 2017 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.
+//
+
+cc_test {
+    name: "VtsHalGnssV1_1TargetTest",
+    defaults: ["VtsHalTargetTestDefaults"],
+    srcs: [
+        "gnss_hal_test.cpp",
+        "gnss_hal_test_cases.cpp",
+        "VtsHalGnssV1_1TargetTest.cpp",
+    ],
+    static_libs: [
+        "android.hardware.gnss@1.0",
+        "android.hardware.gnss@1.1",
+    ],
+}
diff --git a/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp b/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp
new file mode 100644
index 0000000..9b805e4
--- /dev/null
+++ b/gnss/1.1/vts/functional/VtsHalGnssV1_1TargetTest.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <VtsHalHidlTargetTestBase.h>
+
+int main(int argc, char** argv) {
+    ::testing::InitGoogleTest(&argc, argv);
+    int status = RUN_ALL_TESTS();
+    ALOGI("Test result = %d", status);
+    return status;
+}
\ No newline at end of file
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.cpp b/gnss/1.1/vts/functional/gnss_hal_test.cpp
new file mode 100644
index 0000000..2f4dd93
--- /dev/null
+++ b/gnss/1.1/vts/functional/gnss_hal_test.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "VtsHalGnssV1_1TargetTest"
+#include <log/log.h>
+
+#include <gnss_hal_test.h>
+
+#include <chrono>
+
+// Implementations for the main test class for GNSS HAL
+GnssHalTest::GnssHalTest()
+    : info_called_count_(0),
+      capabilities_called_count_(0),
+      location_called_count_(0),
+      name_called_count_(0),
+      notify_count_(0) {}
+
+void GnssHalTest::SetUp() {
+    gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>();
+    ASSERT_NE(gnss_hal_, nullptr);
+}
+
+void GnssHalTest::TearDown() {
+    if (gnss_hal_ != nullptr) {
+        gnss_hal_->cleanup();
+    }
+    if (notify_count_ > 0) {
+        ALOGW("%d unprocessed callbacks discarded", notify_count_);
+    }
+}
+
+void GnssHalTest::notify() {
+    std::unique_lock<std::mutex> lock(mtx_);
+    notify_count_++;
+    cv_.notify_one();
+}
+
+std::cv_status GnssHalTest::wait(int timeoutSeconds) {
+    std::unique_lock<std::mutex> lock(mtx_);
+
+    auto status = std::cv_status::no_timeout;
+    while (notify_count_ == 0) {
+        status = cv_.wait_for(lock, std::chrono::seconds(timeoutSeconds));
+        if (status == std::cv_status::timeout) return status;
+    }
+    notify_count_--;
+    return status;
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
+    const IGnssCallback::GnssSystemInfo& info) {
+    ALOGI("Info received, year %d", info.yearOfHw);
+    parent_.info_called_count_++;
+    parent_.last_info_ = info;
+    parent_.notify();
+    return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) {
+    ALOGI("Capabilities received %d", capabilities);
+    parent_.capabilities_called_count_++;
+    parent_.last_capabilities_ = capabilities;
+    parent_.notify();
+    return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) {
+    ALOGI("Name received: %s", name.c_str());
+    parent_.name_called_count_++;
+    parent_.last_name_ = name;
+    parent_.notify();
+    return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssLocationCb(const GnssLocation& location) {
+    ALOGI("Location received");
+    parent_.location_called_count_++;
+    parent_.last_location_ = location;
+    parent_.notify();
+    return Void();
+}
diff --git a/gnss/1.1/vts/functional/gnss_hal_test.h b/gnss/1.1/vts/functional/gnss_hal_test.h
new file mode 100644
index 0000000..bbc8d9f
--- /dev/null
+++ b/gnss/1.1/vts/functional/gnss_hal_test.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#ifndef GNSS_HAL_TEST_H_
+#define GNSS_HAL_TEST_H_
+
+#include <android/hardware/gnss/1.1/IGnss.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include <condition_variable>
+#include <mutex>
+
+using android::hardware::Return;
+using android::hardware::Void;
+
+using android::hardware::gnss::V1_0::GnssLocation;
+
+using android::hardware::gnss::V1_1::IGnss;
+using android::hardware::gnss::V1_1::IGnssCallback;
+using android::hardware::gnss::V1_0::GnssLocationFlags;
+using android::sp;
+#define TIMEOUT_SEC 2  // for basic commands/responses
+
+// The main test class for GNSS HAL.
+class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    GnssHalTest();
+
+    virtual void SetUp() override;
+
+    virtual void TearDown() override;
+
+    /* Used as a mechanism to inform the test that a callback has occurred */
+    void notify();
+
+    /* Test code calls this function to wait for a callback */
+    std::cv_status wait(int timeoutSeconds);
+
+    /* Callback class for data & Event. */
+    class GnssCallback : public IGnssCallback {
+       public:
+        GnssHalTest& parent_;
+
+        GnssCallback(GnssHalTest& parent) : parent_(parent){};
+
+        virtual ~GnssCallback() = default;
+
+        // Dummy callback handlers
+        Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue /* status */) override {
+            return Void();
+        }
+        Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& /* svStatus */) override {
+            return Void();
+        }
+        Return<void> gnssNmeaCb(int64_t /* timestamp */,
+                                const android::hardware::hidl_string& /* nmea */) override {
+            return Void();
+        }
+        Return<void> gnssAcquireWakelockCb() override { return Void(); }
+        Return<void> gnssReleaseWakelockCb() override { return Void(); }
+        Return<void> gnssRequestTimeCb() override { return Void(); }
+        // Actual (test) callback handlers
+        Return<void> gnssLocationCb(const GnssLocation& location) override;
+        Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
+        Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
+        Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
+    };
+
+    /*
+     * StartAndGetSingleLocation:
+     * Helper function to get one Location and check fields
+     *
+     * returns  true if a location was successfully generated
+     */
+    bool StartAndGetSingleLocation(bool checkAccuracies) {
+        auto result = gnss_hal_->start();
+
+        EXPECT_TRUE(result.isOk());
+        EXPECT_TRUE(result);
+
+        /*
+         * GPS signals initially optional for this test, so don't expect fast fix,
+         * or no timeout, unless signal is present
+         */
+        int firstGnssLocationTimeoutSeconds = 15;
+
+        wait(firstGnssLocationTimeoutSeconds);
+        EXPECT_EQ(location_called_count_, 1);
+
+        if (location_called_count_ > 0) {
+            // don't require speed on first fix
+            CheckLocation(last_location_, checkAccuracies, false);
+            return true;
+        }
+        return false;
+    }
+
+    /*
+     * CheckLocation:
+     *   Helper function to vet Location fields when calling setPositionMode_1_1()
+     */
+    void CheckLocation(GnssLocation& location, bool checkAccuracies, bool checkSpeed) {
+        EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
+        EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
+        if (checkSpeed) {
+            EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED);
+        }
+        EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_HORIZONTAL_ACCURACY);
+        // New uncertainties available in O must be provided,
+        // at least when paired with modern hardware (2017+)
+        if (checkAccuracies) {
+            EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY);
+            if (checkSpeed) {
+                EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY);
+                if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+                    EXPECT_TRUE(location.gnssLocationFlags &
+                                GnssLocationFlags::HAS_BEARING_ACCURACY);
+                }
+            }
+        }
+        EXPECT_GE(location.latitudeDegrees, -90.0);
+        EXPECT_LE(location.latitudeDegrees, 90.0);
+        EXPECT_GE(location.longitudeDegrees, -180.0);
+        EXPECT_LE(location.longitudeDegrees, 180.0);
+        EXPECT_GE(location.altitudeMeters, -1000.0);
+        EXPECT_LE(location.altitudeMeters, 30000.0);
+        if (checkSpeed) {
+            EXPECT_GE(location.speedMetersPerSec, 0.0);
+            EXPECT_LE(location.speedMetersPerSec, 5.0);  // VTS tests are stationary.
+
+            // Non-zero speeds must be reported with an associated bearing
+            if (location.speedMetersPerSec > 0.0) {
+                EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING);
+            }
+        }
+
+        /*
+         * Tolerating some especially high values for accuracy estimate, in case of
+         * first fix with especially poor geometry (happens occasionally)
+         */
+        EXPECT_GT(location.horizontalAccuracyMeters, 0.0);
+        EXPECT_LE(location.horizontalAccuracyMeters, 250.0);
+
+        /*
+         * Some devices may define bearing as -180 to +180, others as 0 to 360.
+         * Both are okay & understandable.
+         */
+        if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING) {
+            EXPECT_GE(location.bearingDegrees, -180.0);
+            EXPECT_LE(location.bearingDegrees, 360.0);
+        }
+        if (location.gnssLocationFlags & GnssLocationFlags::HAS_VERTICAL_ACCURACY) {
+            EXPECT_GT(location.verticalAccuracyMeters, 0.0);
+            EXPECT_LE(location.verticalAccuracyMeters, 500.0);
+        }
+        if (location.gnssLocationFlags & GnssLocationFlags::HAS_SPEED_ACCURACY) {
+            EXPECT_GT(location.speedAccuracyMetersPerSecond, 0.0);
+            EXPECT_LE(location.speedAccuracyMetersPerSecond, 50.0);
+        }
+        if (location.gnssLocationFlags & GnssLocationFlags::HAS_BEARING_ACCURACY) {
+            EXPECT_GT(location.bearingAccuracyDegrees, 0.0);
+            EXPECT_LE(location.bearingAccuracyDegrees, 360.0);
+        }
+
+        // Check timestamp > 1.48e12 (47 years in msec - 1970->2017+)
+        EXPECT_GT(location.timestamp, 1.48e12);
+    }
+
+    /*
+     * StopAndClearLocations:
+     * Helper function to stop locations
+     *
+     * returns  true if a location was successfully generated
+     */
+    void StopAndClearLocations() {
+        auto result = gnss_hal_->stop();
+
+        EXPECT_TRUE(result.isOk());
+        EXPECT_TRUE(result);
+
+        /*
+         * Clear notify/waiting counter, allowing up till the timeout after
+         * the last reply for final startup messages to arrive (esp. system
+         * info.)
+         */
+        while (wait(TIMEOUT_SEC) == std::cv_status::no_timeout) {
+        }
+    }
+
+    sp<IGnss> gnss_hal_;         // GNSS HAL to call into
+    sp<IGnssCallback> gnss_cb_;  // Primary callback interface
+
+    /* Count of calls to set the following items, and the latest item (used by
+     * test.)
+     */
+    int info_called_count_;
+    IGnssCallback::GnssSystemInfo last_info_;
+    uint32_t last_capabilities_;
+    int capabilities_called_count_;
+    int location_called_count_;
+    GnssLocation last_location_;
+
+    int name_called_count_;
+    android::hardware::hidl_string last_name_;
+
+   private:
+    std::mutex mtx_;
+    std::condition_variable cv_;
+    int notify_count_;
+};
+
+#endif  // GNSS_HAL_TEST_H_
diff --git a/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
new file mode 100644
index 0000000..47bad34
--- /dev/null
+++ b/gnss/1.1/vts/functional/gnss_hal_test_cases.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include <gnss_hal_test.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+using android::hardware::gnss::V1_1::IGnssMeasurement;
+
+/*
+ * SetupTeardownCreateCleanup:
+ * Requests the gnss HAL then calls cleanup
+ *
+ * Empty test fixture to verify basic Setup & Teardown
+ */
+TEST_F(GnssHalTest, SetupTeardownCreateCleanup) {}
+
+/*
+ * SetCallbackResponses:
+ * Sets up the callback, awaits the capability, info & name
+ */
+TEST_F(GnssHalTest, SetCallbackResponses) {
+    gnss_cb_ = new GnssCallback(*this);
+    ASSERT_NE(gnss_cb_, nullptr);
+
+    auto result = gnss_hal_->setCallback_1_1(gnss_cb_);
+    if (!result.isOk()) {
+        ALOGE("result of failed setCallback %s", result.description().c_str());
+    }
+
+    ASSERT_TRUE(result.isOk());
+    ASSERT_TRUE(result);
+
+    /*
+     * All capabilities, name and systemInfo callbacks should trigger
+     */
+    EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+    EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+    EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+
+    EXPECT_EQ(capabilities_called_count_, 1);
+    EXPECT_EQ(info_called_count_, 1);
+    EXPECT_EQ(name_called_count_, 1);
+}
+
+/*
+ * TestGnssMeasurementCallback:
+ * Gets the GnssMeasurementExtension and verify that it returns an actual extension.
+ */
+TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
+    auto gnssMeasurement = gnss_hal_->getExtensionGnssMeasurement_1_1();
+    ASSERT_TRUE(gnssMeasurement.isOk());
+    if (last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS) {
+        sp<IGnssMeasurement> iGnssMeas = gnssMeasurement;
+        EXPECT_NE(iGnssMeas, nullptr);
+    }
+}
+
+/*
+ * GetLocation:
+ * Turns on location, waits for at least 5 locations allowing max of LOCATION_TIMEOUT_SUBSEQUENT_SEC
+ * between one location and the next. Also ensure that MIN_INTERVAL_MSEC is respected by waiting
+ * NO_LOCATION_PERIOD_SEC and verfiy that no location is received. Also perform validity checks on
+ * each received location.
+ */
+TEST_F(GnssHalTest, GetLocationLowPower) {
+#define MIN_INTERVAL_MSEC 5000
+#define PREFERRED_ACCURACY 0   // Ideally perfect (matches GnssLocationProvider)
+#define PREFERRED_TIME_MSEC 0  // Ideally immediate
+
+#define LOCATION_TIMEOUT_SUBSEQUENT_SEC (MIN_INTERVAL_MSEC + 1000) / 1000
+#define NO_LOCATION_PERIOD_SEC 2
+#define LOCATIONS_TO_CHECK 5
+#define LOW_POWER_MODE true
+
+    bool checkMoreAccuracies = (info_called_count_ > 0 && last_info_.yearOfHw >= 2017);
+
+    auto result = gnss_hal_->setPositionMode_1_1(
+        IGnss::GnssPositionMode::MS_BASED, IGnss::GnssPositionRecurrence::RECURRENCE_PERIODIC,
+        MIN_INTERVAL_MSEC, PREFERRED_ACCURACY, PREFERRED_TIME_MSEC, LOW_POWER_MODE);
+
+    ASSERT_TRUE(result.isOk());
+    EXPECT_TRUE(result);
+
+    EXPECT_TRUE(StartAndGetSingleLocation(checkMoreAccuracies));
+
+    for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
+        // Verify that MIN_INTERVAL_MSEC is respected by waiting NO_LOCATION_PERIOD_SEC and
+        // ensure that no location is received yet
+        wait(NO_LOCATION_PERIOD_SEC);
+        EXPECT_EQ(location_called_count_, i);
+        EXPECT_EQ(std::cv_status::no_timeout,
+                  wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC - NO_LOCATION_PERIOD_SEC));
+        EXPECT_EQ(location_called_count_, i + 1);
+        CheckLocation(last_location_, checkMoreAccuracies, true);
+    }
+
+    StopAndClearLocations();
+}
\ No newline at end of file
diff --git a/keymaster/4.0/Android.bp b/keymaster/4.0/Android.bp
index 2d4e7bf..34997d2 100644
--- a/keymaster/4.0/Android.bp
+++ b/keymaster/4.0/Android.bp
@@ -8,7 +8,7 @@
     },
     srcs: [
         "types.hal",
-        "IKeymaster.hal",
+        "IKeymasterDevice.hal",
     ],
     interfaces: [
         "android.hardware.keymaster@3.0",
diff --git a/keymaster/4.0/IKeymaster.hal b/keymaster/4.0/IKeymasterDevice.hal
similarity index 99%
rename from keymaster/4.0/IKeymaster.hal
rename to keymaster/4.0/IKeymasterDevice.hal
index b841832..06b4b73 100644
--- a/keymaster/4.0/IKeymaster.hal
+++ b/keymaster/4.0/IKeymasterDevice.hal
@@ -23,7 +23,7 @@
  * Keymaster device definition.  For thorough documentation see the implementer's reference, at
  * https://source.android.com/security/keystore/implementer-ref.html
  */
-interface IKeymaster {
+interface IKeymasterDevice {
 
     /**
      * Returns information about the underlying keymaster hardware.
diff --git a/keymaster/4.0/default/service.cpp b/keymaster/4.0/default/service.cpp
index adb27e1..f4b5fd3 100644
--- a/keymaster/4.0/default/service.cpp
+++ b/keymaster/4.0/default/service.cpp
@@ -16,13 +16,13 @@
 */
 
 #include <android-base/logging.h>
-#include <android/hardware/keymaster/4.0/IKeymaster.h>
+#include <android/hardware/keymaster/4.0/IKeymasterDevice.h>
 #include <hidl/HidlTransportSupport.h>
 
-#include <AndroidKeymaster4.h>
+#include <AndroidKeymaster4Device.h>
 
 int main() {
-    auto keymaster = ::keymaster::V4_0::ng::CreateKeymaster();
+    auto keymaster = ::keymaster::V4_0::ng::CreateKeymasterDevice();
     auto status = keymaster->registerAsService();
     if (status != android::OK) {
         LOG(FATAL) << "Could not register service for Keymaster 4.0 (" << status << ")";
diff --git a/keymaster/4.0/support/include/keymasterV4_0/attestation_record.h b/keymaster/4.0/support/include/keymasterV4_0/attestation_record.h
index c993d6b..203b349 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/attestation_record.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/attestation_record.h
@@ -17,7 +17,7 @@
 #ifndef HARDWARE_INTERFACES_KEYMASTER_40_VTS_FUNCTIONAL_ATTESTATION_RECORD_H_
 #define HARDWARE_INTERFACES_KEYMASTER_40_VTS_FUNCTIONAL_ATTESTATION_RECORD_H_
 
-#include <android/hardware/keymaster/4.0/IKeymaster.h>
+#include <android/hardware/keymaster/4.0/IKeymasterDevice.h>
 
 namespace android {
 namespace hardware {
diff --git a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
index 7e3b008..a3aae8b 100644
--- a/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
+++ b/keymaster/4.0/support/include/keymasterV4_0/keymaster_tags.h
@@ -59,7 +59,7 @@
  * value1.isOk() yields false, but value2.isOk() yields true, thus value2.value() is save to access.
  */
 
-#include <android/hardware/keymaster/4.0/IKeymaster.h>
+#include <android/hardware/keymaster/4.0/IKeymasterDevice.h>
 
 #include <type_traits>
 
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index d26b6b9..38dd302 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -22,7 +22,7 @@
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 
-#include <android/hardware/keymaster/4.0/IKeymaster.h>
+#include <android/hardware/keymaster/4.0/IKeymasterDevice.h>
 #include <android/hardware/keymaster/4.0/types.h>
 #include <cutils/properties.h>
 #include <keymaster/keymaster_configuration.h>
@@ -409,7 +409,7 @@
         return instance;
     }
 
-    void registerTestServices() override { registerTestService<IKeymaster>(); }
+    void registerTestServices() override { registerTestService<IKeymasterDevice>(); }
 
    private:
     KeymasterHidlEnvironment(){};
@@ -428,8 +428,10 @@
 
     // SetUpTestCase runs only once per test case, not once per test.
     static void SetUpTestCase() {
-        string service_name = KeymasterHidlEnvironment::Instance()->getServiceName<IKeymaster>();
-        keymaster_ = ::testing::VtsHalHidlTargetTestBase::getService<IKeymaster>(service_name);
+        string service_name =
+            KeymasterHidlEnvironment::Instance()->getServiceName<IKeymasterDevice>();
+        keymaster_ =
+            ::testing::VtsHalHidlTargetTestBase::getService<IKeymasterDevice>(service_name);
         ASSERT_NE(keymaster_, nullptr);
 
         ASSERT_TRUE(keymaster_
@@ -447,7 +449,7 @@
 
     static void TearDownTestCase() { keymaster_.clear(); }
 
-    static IKeymaster& keymaster() { return *keymaster_; }
+    static IKeymasterDevice& keymaster() { return *keymaster_; }
     static uint32_t os_version() { return os_version_; }
     static uint32_t os_patch_level() { return os_patch_level_; }
 
@@ -874,7 +876,7 @@
     OperationHandle op_handle_ = kOpHandleSentinel;
 
    private:
-    static sp<IKeymaster> keymaster_;
+    static sp<IKeymasterDevice> keymaster_;
     static uint32_t os_version_;
     static uint32_t os_patch_level_;
 
@@ -942,7 +944,7 @@
     return true;
 }
 
-sp<IKeymaster> KeymasterHidlTest::keymaster_;
+sp<IKeymasterDevice> KeymasterHidlTest::keymaster_;
 uint32_t KeymasterHidlTest::os_version_;
 uint32_t KeymasterHidlTest::os_patch_level_;
 bool KeymasterHidlTest::is_secure_;
diff --git a/tests/memory/1.0/Android.bp b/tests/memory/1.0/Android.bp
index cd97fe4..5038664 100644
--- a/tests/memory/1.0/Android.bp
+++ b/tests/memory/1.0/Android.bp
@@ -7,6 +7,8 @@
         "IMemoryTest.hal",
     ],
     interfaces: [
+        "android.hidl.memory.token@1.0",
+        "android.hidl.memory.block@1.0",
         "android.hidl.base@1.0",
     ],
     gen_java: false,
diff --git a/tests/memory/1.0/IMemoryTest.hal b/tests/memory/1.0/IMemoryTest.hal
index 4d6de3f..b20859c 100644
--- a/tests/memory/1.0/IMemoryTest.hal
+++ b/tests/memory/1.0/IMemoryTest.hal
@@ -16,7 +16,13 @@
 
 package android.hardware.tests.memory@1.0;
 
+import android.hidl.memory.token@1.0::IMemoryToken;
+import android.hidl.memory.block@1.0::MemoryBlock;
+
 interface IMemoryTest {
     haveSomeMemory(memory mem) generates(memory mem);
     fillMemory(memory memory_in, uint8_t filler);
+    haveSomeMemoryBlock(MemoryBlock blk) generates(MemoryBlock blk);
+    set(memory mem) generates();
+    get()generates(IMemoryToken token);
 };
diff --git a/tests/memory/1.0/default/Android.bp b/tests/memory/1.0/default/Android.bp
index 985183b..3f13634 100644
--- a/tests/memory/1.0/default/Android.bp
+++ b/tests/memory/1.0/default/Android.bp
@@ -28,6 +28,7 @@
         "liblog",
         "libutils",
         "android.hidl.memory@1.0",
+        "android.hidl.memory.token@1.0",
     ],
 
     // These are static libs only for testing purposes and portability. Shared
diff --git a/tests/memory/1.0/default/MemoryTest.cpp b/tests/memory/1.0/default/MemoryTest.cpp
index 37a2a60..5cbf67e 100644
--- a/tests/memory/1.0/default/MemoryTest.cpp
+++ b/tests/memory/1.0/default/MemoryTest.cpp
@@ -20,6 +20,7 @@
 
 #include <log/log.h>
 
+#include <hidlmemory/HidlMemoryToken.h>
 #include <hidlmemory/mapping.h>
 
 #include <android/hidl/memory/1.0/IMemory.h>
@@ -60,6 +61,22 @@
     return Void();
 }
 
+Return<void> Memory::haveSomeMemoryBlock(const MemoryBlock& blk, haveSomeMemoryBlock_cb _hidl_cb) {
+    _hidl_cb(blk);
+    return Void();
+}
+
+Return<void> Memory::set(const hidl_memory& mem) {
+    sp<HidlMemory> hidlMem = HidlMemory::getInstance(mem);
+    if (hidlMem->valid()) {
+        mSavedMemoryToken = new HidlMemoryToken(hidlMem);
+    }
+    return Void();
+}
+
+Return<sp<IMemoryToken>> Memory::get() {
+    return mSavedMemoryToken;
+}
 
 IMemoryTest* HIDL_FETCH_IMemoryTest(const char* /* name */) {
     return new Memory();
diff --git a/tests/memory/1.0/default/MemoryTest.h b/tests/memory/1.0/default/MemoryTest.h
index 0d903f1..4c2ed36 100644
--- a/tests/memory/1.0/default/MemoryTest.h
+++ b/tests/memory/1.0/default/MemoryTest.h
@@ -20,6 +20,7 @@
 #include <android/hardware/tests/memory/1.0/IMemoryTest.h>
 #include <hidl/MQDescriptor.h>
 #include <hidl/Status.h>
+#include <hidlmemory/HidlMemoryToken.h>
 
 namespace android {
 namespace hardware {
@@ -28,14 +29,17 @@
 namespace V1_0 {
 namespace implementation {
 
-using ::android::hardware::tests::memory::V1_0::IMemoryTest;
+using ::android::sp;
 using ::android::hardware::hidl_array;
 using ::android::hardware::hidl_memory;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
+using ::android::hardware::HidlMemoryToken;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
-using ::android::sp;
+using ::android::hardware::tests::memory::V1_0::IMemoryTest;
+using ::android::hidl::memory::block::V1_0::MemoryBlock;
+using ::android::hidl::memory::token::V1_0::IMemoryToken;
 
 struct Memory : public IMemoryTest {
     // Methods from ::android::hardware::tests::memory::V1_0::IMemoryTest follow.
@@ -43,6 +47,14 @@
 
     Return<void> fillMemory(const hidl_memory& memory_in, uint8_t filler) override;
 
+    Return<void> haveSomeMemoryBlock(const MemoryBlock& blk,
+                                     haveSomeMemoryBlock_cb _hidl_cb) override;
+    Return<void> set(const ::android::hardware::hidl_memory& mem) override;
+
+    Return<sp<IMemoryToken>> get() override;
+
+   protected:
+    sp<HidlMemoryToken> mSavedMemoryToken;
 };
 
 extern "C" IMemoryTest* HIDL_FETCH_IMemoryTest(const char* name);
diff --git a/usb/1.0/default/OWNERS b/usb/1.0/default/OWNERS
new file mode 100644
index 0000000..fefae56
--- /dev/null
+++ b/usb/1.0/default/OWNERS
@@ -0,0 +1 @@
+badhri@google.com
diff --git a/usb/1.0/vts/OWNERS b/usb/1.0/vts/OWNERS
new file mode 100644
index 0000000..54f268f
--- /dev/null
+++ b/usb/1.0/vts/OWNERS
@@ -0,0 +1,3 @@
+badhri@google.com
+yim@google.com
+trong@google.com
diff --git a/usb/1.1/vts/OWNERS b/usb/1.1/vts/OWNERS
new file mode 100644
index 0000000..54f268f
--- /dev/null
+++ b/usb/1.1/vts/OWNERS
@@ -0,0 +1,3 @@
+badhri@google.com
+yim@google.com
+trong@google.com