Merge "VtsHalDrmV1_0Target test failure" into oc-dev
diff --git a/camera/device/3.2/ICameraDeviceCallback.hal b/camera/device/3.2/ICameraDeviceCallback.hal
index bf51da2..69715de 100644
--- a/camera/device/3.2/ICameraDeviceCallback.hal
+++ b/camera/device/3.2/ICameraDeviceCallback.hal
@@ -42,7 +42,9 @@
      * metadata and low-resolution buffers to be returned in one call, and
      * post-processed JPEG buffers in a later call, once it is available. Each
      * call must include the frame number of the request it is returning
-     * metadata or buffers for.
+     * metadata or buffers for. Only one call to processCaptureResult
+     * may be made at a time by the HAL although the calls may come from
+     * different threads in the HAL.
      *
      * A component (buffer or metadata) of the complete result may only be
      * included in one process_capture_result call. A buffer for each stream,
diff --git a/camera/device/3.2/ICameraDeviceSession.hal b/camera/device/3.2/ICameraDeviceSession.hal
index bf56881..477a3cc 100644
--- a/camera/device/3.2/ICameraDeviceSession.hal
+++ b/camera/device/3.2/ICameraDeviceSession.hal
@@ -263,6 +263,24 @@
     getCaptureRequestMetadataQueue() generates (fmq_sync<uint8_t> queue);
 
     /**
+     * getCaptureResultMetadataQueue:
+     *
+     * Retrieves the queue used along with
+     * ICameraDeviceCallback.processCaptureResult.
+     *
+     * Clients to ICameraDeviceSession must:
+     * - Call getCaptureRequestMetadataQueue to retrieve the fast message queue;
+     * - In implementation of ICameraDeviceCallback, test whether
+     *   .fmqResultSize field is zero.
+     *     - If .fmqResultSize != 0, read result metadata from the fast message
+     *       queue;
+     *     - otherwise, read result metadata in CaptureResult.result.
+     *
+     * @return queue the queue that implementation writes result metadata to.
+     */
+    getCaptureResultMetadataQueue() generates (fmq_sync<uint8_t> queue);
+
+    /**
      * flush:
      *
      * Flush all currently in-process captures and all buffers in the pipeline
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index ebb8fcb..2499b1a 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -32,6 +32,8 @@
 
 // Size of request metadata fast message queue. Change to 0 to always use hwbinder buffer.
 static constexpr size_t CAMERA_REQUEST_METADATA_QUEUE_SIZE = 1 << 20 /* 1MB */;
+// Size of result metadata fast message queue. Change to 0 to always use hwbinder buffer.
+static constexpr size_t CAMERA_RESULT_METADATA_QUEUE_SIZE  = 1 << 20 /* 1MB */;
 
 HandleImporter& CameraDeviceSession::sHandleImporter = HandleImporter::getInstance();
 const int CameraDeviceSession::ResultBatcher::NOT_BATCHED;
@@ -73,9 +75,16 @@
     mRequestMetadataQueue = std::make_unique<RequestMetadataQueue>(
             CAMERA_REQUEST_METADATA_QUEUE_SIZE, false /* non blocking */);
     if (!mRequestMetadataQueue->isValid()) {
-        ALOGE("%s: invalid fmq", __FUNCTION__);
+        ALOGE("%s: invalid request fmq", __FUNCTION__);
         return true;
     }
+    mResultMetadataQueue = std::make_shared<RequestMetadataQueue>(
+            CAMERA_RESULT_METADATA_QUEUE_SIZE, false /* non blocking */);
+    if (!mResultMetadataQueue->isValid()) {
+        ALOGE("%s: invalid result fmq", __FUNCTION__);
+        return true;
+    }
+    mResultBatcher.setResultMetadataQueue(mResultMetadataQueue);
 
     return false;
 }
@@ -231,6 +240,11 @@
     mStreamsToBatch = streamsToBatch;
 }
 
+void CameraDeviceSession::ResultBatcher::setResultMetadataQueue(std::shared_ptr<ResultMetadataQueue> q) {
+    Mutex::Autolock _l(mLock);
+    mResultMetadataQueue = q;
+}
+
 void CameraDeviceSession::ResultBatcher::registerBatch(
         const hidl_vec<CaptureRequest>& requests) {
     auto batch = std::make_shared<InflightBatch>();
@@ -350,6 +364,7 @@
     results.resize(batchSize);
     for (size_t i = 0; i < batchSize; i++) {
         results[i].frameNumber = batch->mFirstFrame + i;
+        results[i].fmqResultSize = 0;
         results[i].partialResult = 0; // 0 for buffer only results
         results[i].inputBuffer.streamId = -1;
         results[i].inputBuffer.bufferId = 0;
@@ -366,7 +381,7 @@
         }
         results[i].outputBuffers = outBufs;
     }
-    mCallback->processCaptureResult(results);
+    invokeProcessCaptureResultCallback(results, /* tryWriteFmq */false);
     freeReleaseFences(results);
     for (int streamId : streams) {
         InflightBatch::BufferBatch& bb = batch->mBatchBufs[streamId];
@@ -396,6 +411,7 @@
             CaptureResult result;
             result.frameNumber = p.first;
             result.result = std::move(p.second);
+            result.fmqResultSize = 0;
             result.inputBuffer.streamId = -1;
             result.inputBuffer.bufferId = 0;
             result.inputBuffer.buffer = nullptr;
@@ -404,7 +420,9 @@
         }
         mb.mMds.clear();
     }
-    mCallback->processCaptureResult(results);
+    hidl_vec<CaptureResult> hResults;
+    hResults.setToExternal(results.data(), results.size());
+    invokeProcessCaptureResultCallback(hResults, /* tryWriteFmq */true);
     batch->mPartialResultProgress = lastPartialResultIdx;
     for (uint32_t partialIdx : toBeRemovedIdxes) {
         batch->mResultMds.erase(partialIdx);
@@ -477,9 +495,37 @@
     }
 }
 
+void CameraDeviceSession::ResultBatcher::invokeProcessCaptureResultCallback(
+        hidl_vec<CaptureResult> &results, bool tryWriteFmq) {
+    if (mProcessCaptureResultLock.tryLock() != OK) {
+        ALOGW("%s: previous call is not finished! waiting 1s...",
+                __FUNCTION__);
+        if (mProcessCaptureResultLock.timedLock(1000000000 /* 1s */) != OK) {
+            ALOGE("%s: cannot acquire lock in 1s, cannot proceed",
+                    __FUNCTION__);
+            return;
+        }
+    }
+    if (tryWriteFmq && mResultMetadataQueue->availableToWrite() > 0) {
+        for (CaptureResult &result : results) {
+            if (result.result.size() > 0) {
+                if (mResultMetadataQueue->write(result.result.data(), result.result.size())) {
+                    result.fmqResultSize = result.result.size();
+                    result.result.resize(0);
+                } else {
+                    ALOGW("%s: couldn't utilize fmq, fall back to hwbinder", __FUNCTION__);
+                    result.fmqResultSize = 0;
+                }
+            }
+        }
+    }
+    mCallback->processCaptureResult(results);
+    mProcessCaptureResultLock.unlock();
+}
+
 void CameraDeviceSession::ResultBatcher::processOneCaptureResult(CaptureResult& result) {
     hidl_vec<CaptureResult> results = {result};
-    mCallback->processCaptureResult(results);
+    invokeProcessCaptureResultCallback(results, /* tryWriteFmq */true);
     freeReleaseFences(results);
     return;
 }
@@ -526,6 +572,7 @@
         if (nonBatchedBuffers.size() > 0 || result.inputBuffer.streamId != -1) {
             CaptureResult nonBatchedResult;
             nonBatchedResult.frameNumber = result.frameNumber;
+            nonBatchedResult.fmqResultSize = 0;
             nonBatchedResult.outputBuffers = nonBatchedBuffers;
             nonBatchedResult.inputBuffer = result.inputBuffer;
             nonBatchedResult.partialResult = 0; // 0 for buffer only results
@@ -716,6 +763,12 @@
     return Void();
 }
 
+Return<void> CameraDeviceSession::getCaptureResultMetadataQueue(
+    getCaptureResultMetadataQueue_cb _hidl_cb) {
+    _hidl_cb(*mResultMetadataQueue->getDesc());
+    return Void();
+}
+
 Return<void> CameraDeviceSession::processCaptureRequest(
         const hidl_vec<CaptureRequest>& requests,
         const hidl_vec<BufferCache>& cachesToRemove,
@@ -915,6 +968,7 @@
     // within the scope of this function
     CaptureResult result;
     result.frameNumber = frameNumber;
+    result.fmqResultSize = 0;
     result.partialResult = hal_result->partial_result;
     convertToHidl(hal_result->result, &result.result);
     if (hasInputBuf) {
diff --git a/camera/device/3.2/default/CameraDeviceSession.h b/camera/device/3.2/default/CameraDeviceSession.h
index f59f503..7682165 100644
--- a/camera/device/3.2/default/CameraDeviceSession.h
+++ b/camera/device/3.2/default/CameraDeviceSession.h
@@ -90,6 +90,8 @@
             const StreamConfiguration& requestedConfiguration, configureStreams_cb _hidl_cb) override;
     Return<void> getCaptureRequestMetadataQueue(
         getCaptureRequestMetadataQueue_cb _hidl_cb) override;
+    Return<void> getCaptureResultMetadataQueue(
+        getCaptureResultMetadataQueue_cb _hidl_cb) override;
     Return<void> processCaptureRequest(
             const hidl_vec<CaptureRequest>& requests,
             const hidl_vec<BufferCache>& cachesToRemove,
@@ -134,12 +136,15 @@
 
     using RequestMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
     std::unique_ptr<RequestMetadataQueue> mRequestMetadataQueue;
+    using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+    std::shared_ptr<ResultMetadataQueue> mResultMetadataQueue;
 
     class ResultBatcher {
     public:
         ResultBatcher(const sp<ICameraDeviceCallback>& callback);
         void setNumPartialResults(uint32_t n);
         void setBatchedStreams(const std::vector<int>& streamsToBatch);
+        void setResultMetadataQueue(std::shared_ptr<ResultMetadataQueue> q);
 
         void registerBatch(const hidl_vec<CaptureRequest>& requests);
         void notify(NotifyMsg& msg);
@@ -217,6 +222,7 @@
         void freeReleaseFences(hidl_vec<CaptureResult>&);
         void notifySingleMsg(NotifyMsg& msg);
         void processOneCaptureResult(CaptureResult& result);
+        void invokeProcessCaptureResultCallback(hidl_vec<CaptureResult> &results, bool tryWriteFmq);
 
         // Protect access to mInflightBatches, mNumPartialResults and mStreamsToBatch
         // processCaptureRequest, processCaptureResult, notify will compete for this lock
@@ -226,6 +232,11 @@
         uint32_t mNumPartialResults;
         std::vector<int> mStreamsToBatch;
         const sp<ICameraDeviceCallback> mCallback;
+        std::shared_ptr<ResultMetadataQueue> mResultMetadataQueue;
+
+        // Protect against invokeProcessCaptureResultCallback()
+        Mutex mProcessCaptureResultLock;
+
     } mResultBatcher;
 
     std::vector<int> mVideoStreamIds;
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index 8e433f6..276e92a 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -853,6 +853,13 @@
     uint32_t frameNumber;
 
     /**
+     * If non-zero, read result from result queue instead
+     * (see ICameraDeviceSession.getCaptureResultMetadataQueue).
+     * If zero, read result from .result field.
+     */
+    uint64_t fmqResultSize;
+
+    /**
      * The result metadata for this capture. This contains information about the
      * final capture parameters, the state of the capture and post-processing
      * hardware, the state of the 3A algorithms, if enabled, and the output of
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_module_api.h b/drm/1.0/vts/functional/drm_hal_vendor_module_api.h
index 2c49ab6..b8b2052 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_module_api.h
+++ b/drm/1.0/vts/functional/drm_hal_vendor_module_api.h
@@ -65,7 +65,7 @@
 
 class DrmHalVTSVendorModule {
    public:
-    DrmHalVTSVendorModule() {}
+    DrmHalVTSVendorModule() : installed(true) {}
     virtual ~DrmHalVTSVendorModule() {}
 
     /**
@@ -89,7 +89,15 @@
      */
     virtual std::string getServiceName() const = 0;
 
+    /**
+     * Set a flag in the vendor module to indicate whether or not the drm
+     * scheme corresponding to this module is installed on the device.
+     */
+    void setInstalled(bool flag) {installed = flag;}
+    bool isInstalled() const {return installed;}
+
    private:
+    bool installed;
     DrmHalVTSVendorModule(const DrmHalVTSVendorModule&) = delete;
     void operator=(const DrmHalVTSVendorModule&) = delete;
 };
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 0ea35c4..ec73a7d 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -83,6 +83,14 @@
 #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
 #define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
 
+#define RETURN_IF_SKIPPED \
+    if (!vendorModule->isInstalled()) { \
+        std::cout << "[  SKIPPED ] This drm scheme not supported." << \
+                " library:" << GetParam() << " service-name:" << \
+                vendorModule->getServiceName() << std::endl; \
+        return; \
+    }
+
 static const uint8_t kInvalidUUID[16] = {
         0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
         0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80,
@@ -124,6 +132,12 @@
             VtsTestBase::getService<ICryptoFactory>();
         }
         ASSERT_NE(cryptoFactory, nullptr);
+
+        // If drm scheme not installed skip subsequent tests
+        if (!drmFactory->isCryptoSchemeSupported(getVendorUUID())) {
+            vendorModule->setInstalled(false);
+            return;
+        }
     }
 
     virtual void TearDown() override {}
@@ -181,9 +195,10 @@
 }
 
 /**
- * Ensure the factory supports the scheme uuid in the config
+ * Check if the factory supports the scheme uuid in the config.
  */
-TEST_P(DrmHalVendorFactoryTest, EmptyPluginConfigUUIDSupported) {
+TEST_P(DrmHalVendorFactoryTest, PluginConfigUUIDSupported) {
+    RETURN_IF_SKIPPED;
     EXPECT_TRUE(drmFactory->isCryptoSchemeSupported(getVendorUUID()));
     EXPECT_TRUE(cryptoFactory->isCryptoSchemeSupported(getVendorUUID()));
 }
@@ -208,6 +223,7 @@
  * Ensure valid content types in the configs are supported
  */
 TEST_P(DrmHalVendorFactoryTest, ValidContentTypeSupported) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         EXPECT_TRUE(drmFactory->isContentTypeSupported(config.mimeType));
     }
@@ -217,6 +233,7 @@
  * Ensure vendor drm plugin can be created
  */
 TEST_P(DrmHalVendorFactoryTest, CreateVendorDrmPlugin) {
+    RETURN_IF_SKIPPED;
     hidl_string packageName("android.hardware.drm.test");
     auto res = drmFactory->createPlugin(
             getVendorUUID(), packageName,
@@ -231,6 +248,7 @@
  * Ensure vendor crypto plugin can be created
  */
 TEST_P(DrmHalVendorFactoryTest, CreateVendorCryptoPlugin) {
+    RETURN_IF_SKIPPED;
     hidl_vec<uint8_t> initVec;
     auto res = cryptoFactory->createPlugin(
             getVendorUUID(), initVec,
@@ -245,6 +263,7 @@
  * Ensure invalid drm plugin can't be created
  */
 TEST_P(DrmHalVendorFactoryTest, CreateInvalidDrmPlugin) {
+    RETURN_IF_SKIPPED;
     hidl_string packageName("android.hardware.drm.test");
     auto res = drmFactory->createPlugin(
             kInvalidUUID, packageName,
@@ -259,6 +278,7 @@
  * Ensure invalid crypto plugin can't be created
  */
 TEST_P(DrmHalVendorFactoryTest, CreateInvalidCryptoPlugin) {
+    RETURN_IF_SKIPPED;
     hidl_vec<uint8_t> initVec;
     auto res = cryptoFactory->createPlugin(
             kInvalidUUID, initVec,
@@ -275,6 +295,7 @@
     virtual void SetUp() override {
         // Create factories
         DrmHalVendorFactoryTest::SetUp();
+        RETURN_IF_SKIPPED;
 
         hidl_string packageName("android.hardware.drm.test");
         auto res = drmFactory->createPlugin(
@@ -326,6 +347,7 @@
  */
 
 TEST_P(DrmHalVendorPluginTest, DoProvisioning) {
+    RETURN_IF_SKIPPED;
     hidl_string certificateType;
     hidl_string certificateAuthority;
     hidl_vec<uint8_t> provisionRequest;
@@ -363,6 +385,7 @@
  * response is provided.
  */
 TEST_P(DrmHalVendorPluginTest, ProvideEmptyProvisionResponse) {
+    RETURN_IF_SKIPPED;
     hidl_vec<uint8_t> response;
     auto res = drmPlugin->provideProvisionResponse(
             response, [&](Status status, const hidl_vec<uint8_t>&,
@@ -458,6 +481,7 @@
  * Test that a session can be opened and closed
  */
 TEST_P(DrmHalVendorPluginTest, OpenCloseSession) {
+    RETURN_IF_SKIPPED;
     auto sessionId = openSession();
     closeSession(sessionId);
 }
@@ -467,6 +491,7 @@
  * is prohibited with the documented error code.
  */
 TEST_P(DrmHalVendorPluginTest, CloseInvalidSession) {
+    RETURN_IF_SKIPPED;
     SessionId invalidSessionId;
     Status status = drmPlugin->closeSession(invalidSessionId);
     EXPECT_EQ(Status::BAD_VALUE, status);
@@ -477,6 +502,7 @@
  * is prohibited with the documented error code.
  */
 TEST_P(DrmHalVendorPluginTest, CloseClosedSession) {
+    RETURN_IF_SKIPPED;
     auto sessionId = openSession();
     closeSession(sessionId);
     Status status = drmPlugin->closeSession(sessionId);
@@ -487,6 +513,7 @@
  * A get key request should fail if no sessionId is provided
  */
 TEST_P(DrmHalVendorPluginTest, GetKeyRequestNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId invalidSessionId;
     hidl_vec<uint8_t> initData;
     hidl_string mimeType = "video/mp4";
@@ -503,6 +530,7 @@
  * Test that an empty sessionID returns BAD_VALUE
  */
 TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptySessionId) {
+    RETURN_IF_SKIPPED;
     SessionId session;
 
     hidl_vec<uint8_t> keyResponse = {0x7b, 0x22, 0x6b, 0x65,
@@ -520,6 +548,7 @@
  * Test that an empty key response returns BAD_VALUE
  */
 TEST_P(DrmHalVendorPluginTest, ProvideKeyResponseEmptyResponse) {
+    RETURN_IF_SKIPPED;
     SessionId session = openSession();
     hidl_vec<uint8_t> emptyResponse;
     auto res = drmPlugin->provideKeyResponse(
@@ -536,6 +565,7 @@
  * Test that a removeKeys on an empty sessionID returns BAD_VALUE
  */
 TEST_P(DrmHalVendorPluginTest, RemoveKeysEmptySessionId) {
+    RETURN_IF_SKIPPED;
     SessionId sessionId;
     Status status = drmPlugin->removeKeys(sessionId);
     EXPECT_TRUE(status == Status::BAD_VALUE);
@@ -546,6 +576,7 @@
  * that has no keys.
  */
 TEST_P(DrmHalVendorPluginTest, RemoveKeysNewSession) {
+    RETURN_IF_SKIPPED;
     SessionId sessionId = openSession();
     Status status = drmPlugin->removeKeys(sessionId);
     EXPECT_TRUE(status == Status::OK);
@@ -557,6 +588,7 @@
  * for all content having a policy that allows offline use.
  */
 TEST_P(DrmHalVendorPluginTest, RestoreKeys) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         if (config.policy.allowOffline) {
             auto sessionId = openSession();
@@ -577,6 +609,7 @@
  * Error message is expected to be Status::BAD_VALUE.
  */
 TEST_P(DrmHalVendorPluginTest, RestoreKeysNull) {
+    RETURN_IF_SKIPPED;
     SessionId sessionId = openSession();
     hidl_vec<uint8_t> nullKeySetId;
     Status status = drmPlugin->restoreKeys(sessionId, nullKeySetId);
@@ -590,6 +623,7 @@
  * Status::ERROR_DRM_SESSION_NOT_OPENED.
  */
 TEST_P(DrmHalVendorPluginTest, RestoreKeysClosedSession) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         if (config.policy.allowOffline) {
             auto sessionId = openSession();
@@ -611,6 +645,7 @@
  * clearing them.
  */
 TEST_P(DrmHalVendorPluginTest, GetSecureStops) {
+    RETURN_IF_SKIPPED;
     // There may be secure stops, depending on if there were keys
     // loaded and unloaded previously. Clear them to get to a known
     // state, then make sure there are none.
@@ -638,6 +673,7 @@
  * an empty ssid is provided.
  */
 TEST_P(DrmHalVendorPluginTest, GetSecureStopEmptySSID) {
+    RETURN_IF_SKIPPED;
     SecureStopId ssid;
     auto res = drmPlugin->getSecureStop(
             ssid, [&](Status status, const SecureStop&) {
@@ -651,6 +687,7 @@
  * or is completed successfully
  */
 TEST_P(DrmHalVendorPluginTest, ReleaseAllSecureStops) {
+    RETURN_IF_SKIPPED;
     Status status = drmPlugin->releaseAllSecureStops();
     EXPECT_TRUE(status == Status::OK ||
                 status == Status::ERROR_DRM_CANNOT_HANDLE);
@@ -662,6 +699,7 @@
  * This is an optional API so it can also return CANNOT_HANDLE.
  */
 TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopSequenceError) {
+    RETURN_IF_SKIPPED;
     SecureStopId ssid = {1, 2, 3, 4};
     Status status = drmPlugin->releaseSecureStop(ssid);
     EXPECT_TRUE(status == Status::ERROR_DRM_INVALID_STATE ||
@@ -674,6 +712,7 @@
  * CANNOT_HANDLE.
  */
 TEST_P(DrmHalVendorPluginTest, ReleaseSecureStopEmptySSID) {
+    RETURN_IF_SKIPPED;
     SecureStopId ssid;
     Status status = drmPlugin->releaseSecureStop(ssid);
     EXPECT_TRUE(status == Status::BAD_VALUE ||
@@ -686,6 +725,7 @@
  * the plugin.
  */
 TEST_P(DrmHalVendorPluginTest, GetVendorProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyString(
             "vendor", [&](Status status, const hidl_string& value) {
                 EXPECT_EQ(Status::OK, status);
@@ -695,6 +735,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GetVersionProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyString(
             "version", [&](Status status, const hidl_string& value) {
                 EXPECT_EQ(Status::OK, status);
@@ -704,6 +745,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GetDescriptionProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyString(
             "description", [&](Status status, const hidl_string& value) {
                 EXPECT_EQ(Status::OK, status);
@@ -713,6 +755,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GetAlgorithmsProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyString(
             "algorithms", [&](Status status, const hidl_string& value) {
                 if (status == Status::OK) {
@@ -725,6 +768,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GetPropertyUniqueDeviceID) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyByteArray(
             "deviceUniqueId",
             [&](Status status, const hidl_vec<uint8_t>& value) {
@@ -742,6 +786,7 @@
  * properties returns the documented error code.
  */
 TEST_P(DrmHalVendorPluginTest, GetInvalidStringProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyString(
             "invalid", [&](Status status, const hidl_string&) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
@@ -750,6 +795,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GetInvalidByteArrayProperty) {
+    RETURN_IF_SKIPPED;
     auto res = drmPlugin->getPropertyByteArray(
             "invalid", [&](Status status, const hidl_vec<uint8_t>&) {
                 EXPECT_EQ(Status::ERROR_DRM_CANNOT_HANDLE, status);
@@ -762,11 +808,13 @@
  * the expected status value.
  */
 TEST_P(DrmHalVendorPluginTest, SetStringPropertyNotSupported) {
+    RETURN_IF_SKIPPED;
     EXPECT_EQ(drmPlugin->setPropertyString("awefijaeflijwef", "value"),
               Status::ERROR_DRM_CANNOT_HANDLE);
 }
 
 TEST_P(DrmHalVendorPluginTest, SetByteArrayPropertyNotSupported) {
+    RETURN_IF_SKIPPED;
     hidl_vec<uint8_t> value;
     EXPECT_EQ(drmPlugin->setPropertyByteArray("awefijaeflijwef", value),
               Status::ERROR_DRM_CANNOT_HANDLE);
@@ -777,6 +825,7 @@
  * the expected status value.
  */
 TEST_P(DrmHalVendorPluginTest, SetCipherInvalidAlgorithm) {
+    RETURN_IF_SKIPPED;
     SessionId session = openSession();
     hidl_string algorithm;
     Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
@@ -789,6 +838,7 @@
  * the expected status value.
  */
 TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithmNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_string algorithm = "AES/CBC/NoPadding";
     Status status = drmPlugin->setCipherAlgorithm(session, algorithm);
@@ -802,6 +852,7 @@
  * either accept it or return ERROR_DRM_CANNOT_HANDLE
  */
 TEST_P(DrmHalVendorPluginTest, SetCipherAlgorithm) {
+    RETURN_IF_SKIPPED;
     SessionId session = openSession();
     ;
     hidl_string algorithm = "AES/CBC/NoPadding";
@@ -816,6 +867,7 @@
  * the expected status value.
  */
 TEST_P(DrmHalVendorPluginTest, SetMacInvalidAlgorithm) {
+    RETURN_IF_SKIPPED;
     SessionId session = openSession();
     hidl_string algorithm;
     Status status = drmPlugin->setMacAlgorithm(session, algorithm);
@@ -828,6 +880,7 @@
  * the expected status value.
  */
 TEST_P(DrmHalVendorPluginTest, SetMacNullAlgorithmNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_string algorithm = "HmacSHA256";
     Status status = drmPlugin->setMacAlgorithm(session, algorithm);
@@ -841,6 +894,7 @@
  * either accept it or return ERROR_DRM_CANNOT_HANDLE
  */
 TEST_P(DrmHalVendorPluginTest, SetMacAlgorithm) {
+    RETURN_IF_SKIPPED;
     SessionId session = openSession();
     hidl_string algorithm = "HmacSHA256";
     Status status = drmPlugin->setMacAlgorithm(session, algorithm);
@@ -861,6 +915,7 @@
  * inputs, e.g. empty sessionId
  */
 TEST_P(DrmHalVendorPluginTest, GenericEncryptNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_vec<uint8_t> keyId, input, iv;
     auto res = drmPlugin->encrypt(
@@ -872,6 +927,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GenericDecryptNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_vec<uint8_t> keyId, input, iv;
     auto res = drmPlugin->decrypt(
@@ -883,6 +939,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GenericSignNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_vec<uint8_t> keyId, message;
     auto res = drmPlugin->sign(
@@ -894,6 +951,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GenericVerifyNoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_vec<uint8_t> keyId, message, signature;
     auto res = drmPlugin->verify(
@@ -904,6 +962,7 @@
 }
 
 TEST_P(DrmHalVendorPluginTest, GenericSignRSANoSession) {
+    RETURN_IF_SKIPPED;
     SessionId session;
     hidl_string algorithm;
     hidl_vec<uint8_t> message, wrappedKey;
@@ -924,6 +983,7 @@
  * Verify that requiresSecureDecoderComponent handles empty mimetype.
  */
 TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderEmptyMimeType) {
+    RETURN_IF_SKIPPED;
     EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent(""));
 }
 
@@ -931,6 +991,7 @@
  * Verify that requiresSecureDecoderComponent handles invalid mimetype.
  */
 TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderInvalidMimeType) {
+    RETURN_IF_SKIPPED;
     EXPECT_FALSE(cryptoPlugin->requiresSecureDecoderComponent("bad"));
 }
 
@@ -939,6 +1000,7 @@
  * configurations
  */
 TEST_P(DrmHalVendorPluginTest, RequiresSecureDecoderConfig) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         for (auto key : config.keys) {
             if (key.isSecure) {
@@ -1010,6 +1072,7 @@
  * gets them.
  */
 TEST_P(DrmHalVendorPluginTest, ListenerEvents) {
+    RETURN_IF_SKIPPED;
     sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
     drmPlugin->setListener(listener);
     auto sessionId = openSession();
@@ -1036,6 +1099,7 @@
  * the listener gets them.
  */
 TEST_P(DrmHalVendorPluginTest, ListenerExpirationUpdate) {
+    RETURN_IF_SKIPPED;
     sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
     drmPlugin->setListener(listener);
     auto sessionId = openSession();
@@ -1053,6 +1117,7 @@
  * the listener gets them.
  */
 TEST_P(DrmHalVendorPluginTest, ListenerKeysChange) {
+    RETURN_IF_SKIPPED;
     sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
     drmPlugin->setListener(listener);
     auto sessionId = openSession();
@@ -1078,6 +1143,7 @@
  * listener set.
  */
 TEST_P(DrmHalVendorPluginTest, NotListening) {
+    RETURN_IF_SKIPPED;
     sp<TestDrmPluginListener> listener = new TestDrmPluginListener();
     drmPlugin->setListener(listener);
     drmPlugin->setListener(nullptr);
@@ -1103,6 +1169,7 @@
  * just call the method for coverage.
  */
 TEST_P(DrmHalVendorPluginTest, NotifyResolution) {
+    RETURN_IF_SKIPPED;
     cryptoPlugin->notifyResolution(1920, 1080);
 }
 
@@ -1142,6 +1209,7 @@
  * is used to associate a drm session with a crypto session.
  */
 TEST_P(DrmHalVendorPluginTest, SetMediaDrmSession) {
+    RETURN_IF_SKIPPED;
     auto sessionId = openSession();
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
     EXPECT_EQ(Status::OK, status);
@@ -1152,6 +1220,7 @@
  * setMediaDrmSession with a closed session id
  */
 TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionClosedSession) {
+    RETURN_IF_SKIPPED;
     auto sessionId = openSession();
     closeSession(sessionId);
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
@@ -1162,6 +1231,7 @@
  * setMediaDrmSession with a empty session id: BAD_VALUE
  */
 TEST_P(DrmHalVendorPluginTest, SetMediaDrmSessionEmptySession) {
+    RETURN_IF_SKIPPED;
     SessionId sessionId;
     Status status = cryptoPlugin->setMediaDrmSession(sessionId);
     EXPECT_EQ(Status::BAD_VALUE, status);
@@ -1355,6 +1425,7 @@
  * Test key status with empty session id, should return BAD_VALUE
  */
 TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusInvalidSession) {
+    RETURN_IF_SKIPPED;
     SessionId sessionId;
     auto res = drmPlugin->queryKeyStatus(sessionId,
             [&](Status status, KeyedVector /* info */) {
@@ -1368,6 +1439,7 @@
  * Test key status.  There should be no key status prior to loading keys
  */
 TEST_P(DrmHalVendorDecryptTest, QueryKeyStatusWithNoKeys) {
+    RETURN_IF_SKIPPED;
     auto sessionId = openSession();
     auto keyStatus = queryKeyStatus(sessionId);
     EXPECT_EQ(0u, keyStatus.size());
@@ -1379,6 +1451,7 @@
  * Test key status.  There should be key status after loading keys.
  */
 TEST_P(DrmHalVendorDecryptTest, QueryKeyStatus) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         auto sessionId = openSession();
         loadKeys(sessionId, config);
@@ -1392,6 +1465,7 @@
  * Positive decrypt test. "Decrypt" a single clear segment and verify.
  */
 TEST_P(DrmHalVendorDecryptTest, ClearSegmentTest) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         for (auto key : config.keys) {
             const size_t kSegmentSize = 1024;
@@ -1419,6 +1493,7 @@
  * Verify data matches.
  */
 TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTest) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         for (auto key : config.keys) {
             const size_t kSegmentSize = 1024;
@@ -1445,6 +1520,7 @@
  * Negative decrypt test. Decrypt without loading keys.
  */
 TEST_P(DrmHalVendorDecryptTest, EncryptedAesCtrSegmentTestNoKeys) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         for (auto key : config.keys) {
             vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
@@ -1471,6 +1547,7 @@
  * decryption can't be performed.
  */
 TEST_P(DrmHalVendorDecryptTest, AttemptDecryptWithKeysRemoved) {
+    RETURN_IF_SKIPPED;
     for (auto config : contentConfigurations) {
         for (auto key : config.keys) {
             vector<uint8_t> iv(AES_BLOCK_SIZE, 0);
diff --git a/gnss/1.0/default/android.hardware.gnss@1.0-service.rc b/gnss/1.0/default/android.hardware.gnss@1.0-service.rc
index f1116f4..96638a3 100644
--- a/gnss/1.0/default/android.hardware.gnss@1.0-service.rc
+++ b/gnss/1.0/default/android.hardware.gnss@1.0-service.rc
@@ -1,7 +1,4 @@
 service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service
     class main
     user system
-#
-# TODO:(b/35757613) - STOPSHIP - HAL cannot have direct inet access
-#
-    group system inet
+    group system gps