Merge "Radio Keepalive HAL" into oc-dr1-dev
diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp
index 03a71fa..6209cb8 100644
--- a/camera/common/1.0/default/Android.bp
+++ b/camera/common/1.0/default/Android.bp
@@ -1,10 +1,11 @@
 cc_library_static {
     name: "android.hardware.camera.common@1.0-helper",
-    vendor: true,
+    vendor_available: true,
     defaults: ["hidl_defaults"],
     srcs: [
         "CameraModule.cpp",
         "CameraMetadata.cpp",
+        "CameraParameters.cpp",
         "VendorTagDescriptor.cpp",
         "HandleImporter.cpp"],
     cflags: [
diff --git a/camera/provider/2.4/vts/functional/CameraParameters.cpp b/camera/common/1.0/default/CameraParameters.cpp
similarity index 98%
rename from camera/provider/2.4/vts/functional/CameraParameters.cpp
rename to camera/common/1.0/default/CameraParameters.cpp
index 97b263b..d224483 100644
--- a/camera/provider/2.4/vts/functional/CameraParameters.cpp
+++ b/camera/common/1.0/default/CameraParameters.cpp
@@ -24,6 +24,12 @@
 #include <system/graphics.h>
 
 namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
 // Parameter keys to communicate between camera application and driver.
 const char CameraParameters::KEY_PREVIEW_SIZE[] = "preview-size";
 const char CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES[] = "preview-size-values";
@@ -534,4 +540,9 @@
     return mMap.isEmpty();
 }
 
+};
+};
+};
+};
+};
 }; // namespace android
diff --git a/camera/provider/2.4/vts/functional/CameraParameters.h b/camera/common/1.0/default/include/CameraParameters.h
similarity index 99%
rename from camera/provider/2.4/vts/functional/CameraParameters.h
rename to camera/common/1.0/default/include/CameraParameters.h
index ba33ffe..e4ff6f2 100644
--- a/camera/provider/2.4/vts/functional/CameraParameters.h
+++ b/camera/common/1.0/default/include/CameraParameters.h
@@ -21,6 +21,11 @@
 #include <utils/String8.h>
 
 namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
 
 struct Size {
     int width;
@@ -694,6 +699,11 @@
     DefaultKeyedVector<String8,String8>    mMap;
 };
 
-}; // namespace android
+};
+};
+};
+};
+};
+}; // namespace
 
 #endif
diff --git a/camera/device/1.0/default/CameraDevice.cpp b/camera/device/1.0/default/CameraDevice.cpp
index 6f4e70f..c53c0d8 100644
--- a/camera/device/1.0/default/CameraDevice.cpp
+++ b/camera/device/1.0/default/CameraDevice.cpp
@@ -116,7 +116,7 @@
     Mutex::Autolock _l(mLock);
     if (mDevice != nullptr) {
         ALOGW("%s: camera %s is deleted while open", __FUNCTION__, mCameraId.c_str());
-        close();
+        closeLocked();
     }
     mHalPreviewWindow.cleanUpCirculatingBuffers();
 }
@@ -130,7 +130,7 @@
     }
     if (!connected) {
         ALOGW("%s: camera %s is disconneted. Closing", __FUNCTION__, mCameraId.c_str());
-        close();
+        closeLocked();
     }
     return;
 }
@@ -982,8 +982,13 @@
 }
 
 Return<void> CameraDevice::close() {
-    ALOGI("Closing camera %s", mCameraId.c_str());
     Mutex::Autolock _l(mLock);
+    closeLocked();
+    return Void();
+}
+
+void CameraDevice::closeLocked() {
+    ALOGI("Closing camera %s", mCameraId.c_str());
     if(mDevice) {
         int rc = mDevice->common.close(&mDevice->common);
         if (rc != OK) {
@@ -991,7 +996,6 @@
         }
         mDevice = nullptr;
     }
-    return Void();
 }
 
 }  // namespace implementation
diff --git a/camera/device/1.0/default/CameraDevice_1_0.h b/camera/device/1.0/default/CameraDevice_1_0.h
index 0e5a49b..c078596 100644
--- a/camera/device/1.0/default/CameraDevice_1_0.h
+++ b/camera/device/1.0/default/CameraDevice_1_0.h
@@ -222,6 +222,7 @@
     static status_t getStatusT(const Status& s);
 
     Status initStatus() const;
+    void closeLocked();
 };
 
 }  // namespace implementation
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 85312c1..439fe3d 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -17,8 +17,7 @@
 cc_test {
     name: "VtsHalCameraProviderV2_4TargetTest",
     defaults: ["hidl_defaults"],
-    srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp",
-           "CameraParameters.cpp" ],
+    srcs: ["VtsHalCameraProviderV2_4TargetTest.cpp"],
     shared_libs: [
         "liblog",
         "libhidlbase",
@@ -31,9 +30,14 @@
         "libcamera_metadata",
         "libbinder",
         "libgui",
-        "libui"
+        "libui",
+        "libfmq",
     ],
-    static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
+    static_libs: [
+        "VtsHalHidlTargetTestBase",
+        "libgrallocusage",
+        "android.hardware.camera.common@1.0-helper",
+    ],
     cflags: [
         "-O0",
         "-g",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 8695e4e..13c53ba 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -15,29 +15,33 @@
  */
 
 #define LOG_TAG "camera_hidl_hal_test"
-#include <VtsHalHidlTargetTestBase.h>
+
+#include <chrono>
+#include <mutex>
+#include <regex>
+#include <unordered_map>
+#include <condition_variable>
+
+#include <inttypes.h>
+
 #include <android/hardware/camera/device/1.0/ICameraDevice.h>
 #include <android/hardware/camera/device/3.2/ICameraDevice.h>
 #include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <android/log.h>
 #include <binder/MemoryHeapBase.h>
+#include <CameraMetadata.h>
+#include <CameraParameters.h>
+#include <fmq/MessageQueue.h>
 #include <grallocusage/GrallocUsageConversion.h>
 #include <gui/BufferItemConsumer.h>
 #include <gui/BufferQueue.h>
 #include <gui/Surface.h>
 #include <hardware/gralloc.h>
 #include <hardware/gralloc1.h>
-#include <inttypes.h>
 #include <system/camera.h>
+#include <system/camera_metadata.h>
 #include <ui/GraphicBuffer.h>
-#include <utils/Errors.h>
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <regex>
-#include <unordered_map>
-#include "CameraParameters.h"
-#include "system/camera_metadata.h"
+
+#include <VtsHalHidlTargetTestBase.h>
 
 using ::android::hardware::Return;
 using ::android::hardware::Void;
@@ -52,13 +56,14 @@
 using ::android::BufferQueue;
 using ::android::BufferItemConsumer;
 using ::android::Surface;
-using ::android::CameraParameters;
 using ::android::hardware::graphics::common::V1_0::BufferUsage;
 using ::android::hardware::graphics::common::V1_0::PixelFormat;
 using ::android::hardware::camera::common::V1_0::Status;
 using ::android::hardware::camera::common::V1_0::CameraDeviceStatus;
 using ::android::hardware::camera::common::V1_0::TorchMode;
 using ::android::hardware::camera::common::V1_0::TorchModeStatus;
+using ::android::hardware::camera::common::V1_0::helper::CameraParameters;
+using ::android::hardware::camera::common::V1_0::helper::Size;
 using ::android::hardware::camera::provider::V2_4::ICameraProvider;
 using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
 using ::android::hardware::camera::device::V3_2::ICameraDevice;
@@ -89,6 +94,9 @@
 using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
 using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
 using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::kSynchronizedReadWrite;
+using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
 
 const char kCameraLegacyServiceName[] = "legacy/0";
 const uint32_t kMaxPreviewWidth = 1920;
@@ -251,9 +259,7 @@
 
             size_t result = 1;
             result = 31 * result + buf->numFds;
-            result = 31 * result + buf->numInts;
-            int length = buf->numFds + buf->numInts;
-            for (int i = 0; i < length; i++) {
+            for (int i = 0; i < buf->numFds; i++) {
                 result = 31 * result + buf->data[i];
             }
             return result;
@@ -263,10 +269,8 @@
     struct BufferComparator {
         bool operator()(const buffer_handle_t& buf1,
                 const buffer_handle_t& buf2) const {
-            if ((buf1->numFds == buf2->numFds) &&
-                    (buf1->numInts == buf2->numInts)) {
-                int length = buf1->numFds + buf1->numInts;
-                for (int i = 0; i < length; i++) {
+            if (buf1->numFds == buf2->numFds) {
+                for (int i = 0; i < buf1->numFds; i++) {
                     if (buf1->data[i] != buf2->data[i]) {
                         return false;
                     }
@@ -550,7 +554,9 @@
             const AvailableStream *previewThreshold,
             sp<ICameraDeviceSession> *session /*out*/,
             Stream *previewStream /*out*/,
-            HalStreamConfiguration *halStreamConfig /*out*/);
+            HalStreamConfiguration *halStreamConfig /*out*/,
+            bool *supportsPartialResults /*out*/,
+            uint32_t *partialResultCount /*out*/);
     static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
             std::vector<AvailableStream> &outputStreams,
             const AvailableStream *threshold = nullptr);
@@ -564,14 +570,78 @@
             const std::vector<AvailableStream> &streamSizes,
             int32_t format, AvailableStream &result);
     static Status isAutoFocusModeAvailable(
-            ::android::CameraParameters &cameraParams, const char *mode) ;
+            CameraParameters &cameraParams, const char *mode) ;
 
 protected:
+
+    // In-flight queue for tracking completion of capture requests.
+    struct InFlightRequest {
+        // Set by notify() SHUTTER call.
+        nsecs_t shutterTimestamp;
+
+        bool errorCodeValid;
+        ErrorCode errorCode;
+
+        //Is partial result supported
+        bool usePartialResult;
+
+        //Partial result count expected
+        uint32_t numPartialResults;
+
+        // Message queue
+        std::shared_ptr<ResultMetadataQueue> resultQueue;
+
+        // Set by process_capture_result call with valid metadata
+        bool haveResultMetadata;
+
+        // Decremented by calls to process_capture_result with valid output
+        // and input buffers
+        ssize_t numBuffersLeft;
+
+         // A 64bit integer to index the frame number associated with this result.
+        int64_t frameNumber;
+
+         // The partial result count (index) for this capture result.
+        int32_t partialResultCount;
+
+        // For buffer drop errors, the stream ID for the stream that lost a buffer.
+        // Otherwise -1.
+        int32_t errorStreamId;
+
+        // If this request has any input buffer
+        bool hasInputBuffer;
+
+        // Result metadata
+        ::android::hardware::camera::common::V1_0::helper::CameraMetadata collectedResult;
+
+        // Buffers are added by process_capture_result when output buffers
+        // return from HAL but framework.
+        ::android::Vector<StreamBuffer> resultOutputBuffers;
+
+        InFlightRequest(ssize_t numBuffers, bool hasInput,
+                bool partialResults, uint32_t partialCount,
+                std::shared_ptr<ResultMetadataQueue> queue = nullptr) :
+                shutterTimestamp(0),
+                errorCodeValid(false),
+                errorCode(ErrorCode::ERROR_BUFFER),
+                usePartialResult(partialResults),
+                numPartialResults(partialCount),
+                resultQueue(queue),
+                haveResultMetadata(false),
+                numBuffersLeft(numBuffers),
+                frameNumber(0),
+                partialResultCount(0),
+                errorStreamId(-1),
+                hasInputBuffer(hasInput) {}
+    };
+
+    // Map from frame number to the in-flight request state
+    typedef ::android::KeyedVector<uint32_t, InFlightRequest*> InFlightMap;
+
     std::mutex mLock;                          // Synchronize access to member variables
     std::condition_variable mResultCondition;  // Condition variable for incoming results
-    uint32_t mResultFrameNumber;               // Expected result frame number
-    std::vector<StreamBuffer> mResultBuffers;  // Holds stream buffers from capture result
-    std::vector<ErrorMsg> mErrors;             // Holds incoming error notifications
+    InFlightMap mInflightMap;                  // Map of all inflight requests
+
     DataCallbackMsg mDataMessageTypeReceived;  // Most recent message type received through data callbacks
     uint32_t mVideoBufferIndex;                // Buffer index of the most recent video buffer
     uint32_t mVideoData;                       // Buffer data of the most recent video buffer
@@ -694,45 +764,173 @@
         return Void();
     }
 
+    bool notify = false;
     std::unique_lock<std::mutex> l(mParent->mLock);
-    const CaptureResult& result = results[0];
+    for (size_t i = 0 ; i < results.size(); i++) {
+        uint32_t frameNumber = results[i].frameNumber;
 
-    if(mParent->mResultFrameNumber != result.frameNumber) {
-        ALOGE("%s: Unexpected frame number! Expected: %u received: %u",
-              __func__, mParent->mResultFrameNumber, result.frameNumber);
-        ADD_FAILURE();
+        if ((results[i].result.size() == 0) &&
+                (results[i].outputBuffers.size() == 0) &&
+                (results[i].inputBuffer.buffer == nullptr) &&
+                (results[i].fmqResultSize == 0)) {
+            ALOGE("%s: No result data provided by HAL for frame %d result count: %d",
+                  __func__, frameNumber, (int) results[i].fmqResultSize);
+            ADD_FAILURE();
+            break;
+        }
+
+        ssize_t idx = mParent->mInflightMap.indexOfKey(frameNumber);
+        if (::android::NAME_NOT_FOUND == idx) {
+            ALOGE("%s: Unexpected frame number! received: %u",
+                  __func__, frameNumber);
+            ADD_FAILURE();
+            break;
+        }
+
+        bool isPartialResult = false;
+        bool hasInputBufferInRequest = false;
+        InFlightRequest *request = mParent->mInflightMap.editValueAt(idx);
+        ::android::hardware::camera::device::V3_2::CameraMetadata resultMetadata;
+        size_t resultSize = 0;
+        if (results[i].fmqResultSize > 0) {
+            resultMetadata.resize(results[i].fmqResultSize);
+            if (request->resultQueue == nullptr) {
+                ADD_FAILURE();
+                break;
+            }
+            if (!request->resultQueue->read(resultMetadata.data(),
+                    results[i].fmqResultSize)) {
+                ALOGE("%s: Frame %d: Cannot read camera metadata from fmq,"
+                        "size = %" PRIu64, __func__, frameNumber,
+                        results[i].fmqResultSize);
+                ADD_FAILURE();
+                break;
+            }
+            resultSize = resultMetadata.size();
+        } else if (results[i].result.size() > 0) {
+            resultMetadata.setToExternal(const_cast<uint8_t *>(
+                    results[i].result.data()), results[i].result.size());
+            resultSize = resultMetadata.size();
+        }
+
+        if (!request->usePartialResult && (resultSize > 0) &&
+                (results[i].partialResult != 1)) {
+            ALOGE("%s: Result is malformed for frame %d: partial_result %u "
+                    "must be 1  if partial result is not supported", __func__,
+                    frameNumber, results[i].partialResult);
+            ADD_FAILURE();
+            break;
+        }
+
+        if (results[i].partialResult != 0) {
+            request->partialResultCount = results[i].partialResult;
+        }
+
+        // Check if this result carries only partial metadata
+        if (request->usePartialResult && (resultSize > 0)) {
+            if ((results[i].partialResult > request->numPartialResults) ||
+                    (results[i].partialResult < 1)) {
+                ALOGE("%s: Result is malformed for frame %d: partial_result %u"
+                        " must be  in the range of [1, %d] when metadata is "
+                        "included in the result", __func__, frameNumber,
+                        results[i].partialResult, request->numPartialResults);
+                ADD_FAILURE();
+                break;
+            }
+            request->collectedResult.append(
+                    reinterpret_cast<const camera_metadata_t*>(
+                            resultMetadata.data()));
+
+            isPartialResult =
+                    (results[i].partialResult < request->numPartialResults);
+        }
+
+        hasInputBufferInRequest = request->hasInputBuffer;
+
+        // Did we get the (final) result metadata for this capture?
+        if ((resultSize > 0) && !isPartialResult) {
+            if (request->haveResultMetadata) {
+                ALOGE("%s: Called multiple times with metadata for frame %d",
+                      __func__, frameNumber);
+                ADD_FAILURE();
+                break;
+            }
+            request->haveResultMetadata = true;
+            request->collectedResult.sort();
+        }
+
+        uint32_t numBuffersReturned = results[i].outputBuffers.size();
+        if (results[i].inputBuffer.buffer != nullptr) {
+            if (hasInputBufferInRequest) {
+                numBuffersReturned += 1;
+            } else {
+                ALOGW("%s: Input buffer should be NULL if there is no input"
+                        " buffer sent in the request", __func__);
+            }
+        }
+        request->numBuffersLeft -= numBuffersReturned;
+        if (request->numBuffersLeft < 0) {
+            ALOGE("%s: Too many buffers returned for frame %d", __func__,
+                    frameNumber);
+            ADD_FAILURE();
+            break;
+        }
+
+        request->resultOutputBuffers.appendArray(results[i].outputBuffers.data(),
+                results[i].outputBuffers.size());
+        // If shutter event is received notify the pending threads.
+        if (request->shutterTimestamp != 0) {
+            notify = true;
+        }
     }
 
-    size_t resultLength = result.outputBuffers.size();
-    for (size_t i = 0; i < resultLength; i++) {
-        mParent->mResultBuffers.push_back(result.outputBuffers[i]);
-    }
-
-    // TODO(epeev): Handle partial results in case client supports them and
-    //              verify the result against request settings.
-
     l.unlock();
-    mParent->mResultCondition.notify_one();
+    if (notify) {
+        mParent->mResultCondition.notify_one();
+    }
 
     return Void();
 }
 
 Return<void> CameraHidlTest::DeviceCb::notify(
         const hidl_vec<NotifyMsg>& messages) {
-    const NotifyMsg& message = messages[0];
+    std::lock_guard<std::mutex> l(mParent->mLock);
 
-    if (MsgType::ERROR == message.type) {
-        {
-            std::lock_guard<std::mutex> l(mParent->mLock);
-            mParent->mErrors.push_back(message.msg.error);
+    for (size_t i = 0; i < messages.size(); i++) {
+        ssize_t idx = mParent->mInflightMap.indexOfKey(
+                messages[i].msg.shutter.frameNumber);
+        if (::android::NAME_NOT_FOUND == idx) {
+            ALOGE("%s: Unexpected frame number! received: %u",
+                  __func__, messages[i].msg.shutter.frameNumber);
+            ADD_FAILURE();
+            break;
         }
+        InFlightRequest *r = mParent->mInflightMap.editValueAt(idx);
 
-        if ((ErrorCode::ERROR_REQUEST == message.msg.error.errorCode)
-                || (ErrorCode::ERROR_BUFFER == message.msg.error.errorCode)) {
-            mParent->mResultCondition.notify_one();
+        switch(messages[i].type) {
+            case MsgType::ERROR:
+                if (ErrorCode::ERROR_DEVICE == messages[i].msg.error.errorCode) {
+                    ALOGE("%s: Camera reported serious device error",
+                          __func__);
+                    ADD_FAILURE();
+                } else {
+                    r->errorCodeValid = true;
+                    r->errorCode = messages[i].msg.error.errorCode;
+                    r->errorStreamId = messages[i].msg.error.errorStreamId;
+                }
+                break;
+            case MsgType::SHUTTER:
+                r->shutterTimestamp = messages[i].msg.shutter.timestamp;
+                break;
+            default:
+                ALOGE("%s: Unsupported notify message %d", __func__,
+                      messages[i].type);
+                ADD_FAILURE();
+                break;
         }
     }
 
+    mParent->mResultCondition.notify_one();
     return Void();
 }
 
@@ -1333,7 +1531,7 @@
             openCameraDevice(name, env, &device1 /*out*/);
             ASSERT_NE(nullptr, device1.get());
 
-            ::android::CameraParameters cameraParams;
+            CameraParameters cameraParams;
             getParameters(device1, &cameraParams /*out*/);
 
             if (Status::OK != isAutoFocusModeAvailable(cameraParams,
@@ -1395,7 +1593,7 @@
             openCameraDevice(name, env, &device1 /*out*/);
             ASSERT_NE(nullptr, device1.get());
 
-            ::android::CameraParameters cameraParams;
+            CameraParameters cameraParams;
             getParameters(device1, &cameraParams /*out*/);
 
             if (Status::OK != isAutoFocusModeAvailable(cameraParams,
@@ -1443,7 +1641,7 @@
             openCameraDevice(name, env, &device1 /*out*/);
             ASSERT_NE(nullptr, device1.get());
 
-            ::android::CameraParameters cameraParams;
+            CameraParameters cameraParams;
             getParameters(device1, &cameraParams /*out*/);
 
             int32_t hwFaces = cameraParams.getInt(
@@ -1506,7 +1704,7 @@
             openCameraDevice(name, env, &device1 /*out*/);
             ASSERT_NE(nullptr, device1.get());
 
-            ::android::CameraParameters cameraParams;
+            CameraParameters cameraParams;
             getParameters(device1, &cameraParams /*out*/);
 
             const char *smoothZoomStr = cameraParams.get(
@@ -1557,7 +1755,7 @@
             openCameraDevice(name, env, &device1 /*out*/);
             ASSERT_NE(nullptr, device1.get());
 
-            ::android::CameraParameters cameraParams;
+            CameraParameters cameraParams;
             getParameters(device1, &cameraParams /*out*/);
 
             int32_t width, height;
@@ -1587,10 +1785,10 @@
             ASSERT_TRUE((nullptr == effect) || (strcmp(
                     CameraParameters::EFFECT_NONE, effect) == 0));
 
-            ::android::Vector<::android::Size> previewSizes;
+            ::android::Vector<Size> previewSizes;
             cameraParams.getSupportedPreviewSizes(previewSizes);
             ASSERT_FALSE(previewSizes.empty());
-            ::android::Vector<::android::Size> pictureSizes;
+            ::android::Vector<Size> pictureSizes;
             cameraParams.getSupportedPictureSizes(pictureSizes);
             ASSERT_FALSE(pictureSizes.empty());
             const char *previewFormats = cameraParams.get(
@@ -2466,9 +2664,31 @@
             Stream previewStream;
             HalStreamConfiguration halStreamConfig;
             sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
             configurePreviewStream(name, env, &previewThreshold,
                     &session /*out*/, &previewStream /*out*/,
-                    &halStreamConfig /*out*/);
+                    &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+                    &partialResultCount/*out*/);
+
+            std::shared_ptr<ResultMetadataQueue> resultQueue;
+            auto resultQueueRet = session->getCaptureResultMetadataQueue(
+                [&resultQueue](const auto& descriptor) {
+                    resultQueue = std::make_shared<ResultMetadataQueue>(
+                            descriptor);
+                    if (!resultQueue->isValid() ||
+                            resultQueue->availableToWrite() <= 0) {
+                        ALOGE("%s: HAL returns empty result metadata fmq,"
+                                " not use it", __func__);
+                        resultQueue = nullptr;
+                        // Don't use the queue onwards.
+                    }
+                });
+            ASSERT_TRUE(resultQueueRet.isOk());
+            ASSERT_NE(nullptr, resultQueue);
+
+            InFlightRequest inflightReq = {1, false, supportsPartialResults,
+                    partialResultCount, resultQueue};
 
             RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
             Return<void> ret;
@@ -2497,8 +2717,8 @@
 
             {
                 std::unique_lock<std::mutex> l(mLock);
-                mResultBuffers.clear();
-                mResultFrameNumber = frameNumber;
+                mInflightMap.clear();
+                mInflightMap.add(frameNumber, &inflightReq);
             }
 
             Status status = Status::INTERNAL_ERROR;
@@ -2517,22 +2737,28 @@
 
             {
                 std::unique_lock<std::mutex> l(mLock);
-                while (0 == mResultBuffers.size()) {
+                while (!inflightReq.errorCodeValid &&
+                        ((0 < inflightReq.numBuffersLeft) ||
+                                (!inflightReq.haveResultMetadata))) {
                     auto timeout = std::chrono::system_clock::now() +
                             std::chrono::seconds(kStreamBufferTimeoutSec);
                     ASSERT_NE(std::cv_status::timeout,
                             mResultCondition.wait_until(l, timeout));
                 }
 
-                ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
-                ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
+                ASSERT_FALSE(inflightReq.errorCodeValid);
+                ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                ASSERT_EQ(previewStream.id,
+                          inflightReq.resultOutputBuffers[0].streamId);
 
                 request.frameNumber++;
                 //Empty settings should be supported after the first call
                 //for repeating requests.
                 request.settings.setToExternal(nullptr, 0, true);
-                mResultBuffers.clear();
-                mResultFrameNumber++;
+                mInflightMap.clear();
+                inflightReq = {1, false, supportsPartialResults,
+                                    partialResultCount, resultQueue};
+                mInflightMap.add(request.frameNumber, &inflightReq);
             }
 
             returnStatus = session->processCaptureRequest(
@@ -2548,14 +2774,19 @@
 
             {
                 std::unique_lock<std::mutex> l(mLock);
-                while (0 == mResultBuffers.size()) {
+                while (!inflightReq.errorCodeValid &&
+                        ((0 < inflightReq.numBuffersLeft) ||
+                                (!inflightReq.haveResultMetadata))) {
                     auto timeout = std::chrono::system_clock::now() +
                             std::chrono::seconds(kStreamBufferTimeoutSec);
                     ASSERT_NE(std::cv_status::timeout,
                             mResultCondition.wait_until(l, timeout));
                 }
-                ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
-                ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
+
+                ASSERT_FALSE(inflightReq.errorCodeValid);
+                ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                ASSERT_EQ(previewStream.id,
+                          inflightReq.resultOutputBuffers[0].streamId);
             }
 
             ret = session->close();
@@ -2581,9 +2812,12 @@
             Stream previewStream;
             HalStreamConfiguration halStreamConfig;
             sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
             configurePreviewStream(name, env, &previewThreshold,
                     &session /*out*/, &previewStream /*out*/,
-                    &halStreamConfig /*out*/);
+                    &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+                    &partialResultCount /*out*/);
 
             sp<GraphicBuffer> gb = new GraphicBuffer(
                 previewStream.width, previewStream.height,
@@ -2639,9 +2873,12 @@
             Stream previewStream;
             HalStreamConfiguration halStreamConfig;
             sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
             configurePreviewStream(name, env, &previewThreshold,
                     &session /*out*/, &previewStream /*out*/,
-                    &halStreamConfig /*out*/);
+                    &halStreamConfig /*out*/, &supportsPartialResults/*out*/,
+                    &partialResultCount /*out*/);
 
             RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
             Return<void> ret;
@@ -2694,10 +2931,31 @@
             Stream previewStream;
             HalStreamConfiguration halStreamConfig;
             sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
             configurePreviewStream(name, env, &previewThreshold,
                     &session /*out*/, &previewStream /*out*/,
-                    &halStreamConfig /*out*/);
+                    &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+                    &partialResultCount /*out*/);
 
+            std::shared_ptr<ResultMetadataQueue> resultQueue;
+            auto resultQueueRet = session->getCaptureResultMetadataQueue(
+                [&resultQueue](const auto& descriptor) {
+                    resultQueue = std::make_shared<ResultMetadataQueue>(
+                            descriptor);
+                    if (!resultQueue->isValid() ||
+                            resultQueue->availableToWrite() <= 0) {
+                        ALOGE("%s: HAL returns empty result metadata fmq,"
+                                " not use it", __func__);
+                        resultQueue = nullptr;
+                        // Don't use the queue onwards.
+                    }
+                });
+            ASSERT_TRUE(resultQueueRet.isOk());
+            ASSERT_NE(nullptr, resultQueue);
+
+            InFlightRequest inflightReq = {1, false, supportsPartialResults,
+                    partialResultCount, resultQueue};
             RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
             Return<void> ret;
             ret = session->constructDefaultRequestSettings(reqTemplate,
@@ -2725,9 +2983,8 @@
 
             {
                 std::unique_lock<std::mutex> l(mLock);
-                mResultBuffers.clear();
-                mErrors.clear();
-                mResultFrameNumber = frameNumber;
+                mInflightMap.clear();
+                mInflightMap.add(frameNumber, &inflightReq);
             }
 
             Status status = Status::INTERNAL_ERROR;
@@ -2751,32 +3008,30 @@
 
             {
                 std::unique_lock<std::mutex> l(mLock);
-                while ((0 == mResultBuffers.size()) && (0 == mErrors.size())) {
+                while (!inflightReq.errorCodeValid &&
+                        ((0 < inflightReq.numBuffersLeft) ||
+                                (!inflightReq.haveResultMetadata))) {
                     auto timeout = std::chrono::system_clock::now() +
                             std::chrono::seconds(kStreamBufferTimeoutSec);
                     ASSERT_NE(std::cv_status::timeout,
                             mResultCondition.wait_until(l, timeout));
                 }
 
-                if (mErrors.empty()) {
-                    ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
-                    ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
+                if (!inflightReq.errorCodeValid) {
+                    ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+                    ASSERT_EQ(previewStream.id,
+                              inflightReq.resultOutputBuffers[0].streamId);
                 } else {
-                    for (auto &error : mErrors) {
-                        switch (error.errorCode) {
-                            case ErrorCode::ERROR_REQUEST:
-                            case ErrorCode::ERROR_RESULT:
-                                //Expected
-                                break;
-                            case ErrorCode::ERROR_BUFFER:
-                                //Expected as well
-                                ASSERT_EQ(frameNumber, error.frameNumber);
-                                ASSERT_EQ(previewStream.id, error.errorStreamId);
-                                break;
-                            case ErrorCode::ERROR_DEVICE:
-                            default:
-                                FAIL() <<"Unexpected error:" << static_cast<uint32_t> (error.errorCode);
-                        }
+                    switch (inflightReq.errorCode) {
+                        case ErrorCode::ERROR_REQUEST:
+                        case ErrorCode::ERROR_RESULT:
+                        case ErrorCode::ERROR_BUFFER:
+                            //Expected
+                            break;
+                        case ErrorCode::ERROR_DEVICE:
+                        default:
+                            FAIL() << "Unexpected error:" << static_cast<uint32_t> (
+                                    inflightReq.errorCode);
                     }
                 }
             }
@@ -2800,16 +3055,12 @@
             Stream previewStream;
             HalStreamConfiguration halStreamConfig;
             sp<ICameraDeviceSession> session;
+            bool supportsPartialResults = false;
+            uint32_t partialResultCount = 0;
             configurePreviewStream(name, env, &previewThreshold,
                     &session /*out*/, &previewStream /*out*/,
-                    &halStreamConfig /*out*/);
-
-            {
-                std::unique_lock<std::mutex> l(mLock);
-                mResultBuffers.clear();
-                mErrors.clear();
-                mResultFrameNumber = 0;
-            }
+                    &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+                    &partialResultCount /*out*/);
 
             Return<Status> returnStatus = session->flush();
             ASSERT_TRUE(returnStatus.isOk());
@@ -2821,8 +3072,6 @@
                         std::chrono::milliseconds(kEmptyFlushTimeoutMSec);
                 ASSERT_EQ(std::cv_status::timeout,
                         mResultCondition.wait_until(l, timeout));
-                ASSERT_TRUE(mErrors.empty());
-                ASSERT_TRUE(mResultBuffers.empty());
             }
 
             Return<void> ret = session->close();
@@ -3003,7 +3252,7 @@
 
 // Check whether the camera device supports specific focus mode.
 Status CameraHidlTest::isAutoFocusModeAvailable(
-        ::android::CameraParameters &cameraParams,
+        CameraParameters &cameraParams,
         const char *mode) {
     ::android::String8 focusModes(cameraParams.get(
             CameraParameters::KEY_SUPPORTED_FOCUS_MODES));
@@ -3020,11 +3269,15 @@
         const AvailableStream *previewThreshold,
         sp<ICameraDeviceSession> *session /*out*/,
         Stream *previewStream /*out*/,
-        HalStreamConfiguration *halStreamConfig /*out*/) {
+        HalStreamConfiguration *halStreamConfig /*out*/,
+        bool *supportsPartialResults /*out*/,
+        uint32_t *partialResultCount /*out*/) {
     ASSERT_NE(nullptr, env);
     ASSERT_NE(nullptr, session);
     ASSERT_NE(nullptr, previewStream);
     ASSERT_NE(nullptr, halStreamConfig);
+    ASSERT_NE(nullptr, supportsPartialResults);
+    ASSERT_NE(nullptr, partialResultCount);
 
     std::vector<AvailableStream> outputPreviewStreams;
     ::android::sp<ICameraDevice> device3_2;
@@ -3062,6 +3315,14 @@
     });
     ASSERT_TRUE(ret.isOk());
 
+    camera_metadata_ro_entry entry;
+    auto status = find_camera_metadata_ro_entry(staticMeta,
+            ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry);
+    if ((0 == status) && (entry.count > 0)) {
+        *partialResultCount = entry.data.i32[0];
+        *supportsPartialResults = (*partialResultCount > 1);
+    }
+
     outputPreviewStreams.clear();
     auto rc = getAvailableOutputStreams(staticMeta,
             outputPreviewStreams, previewThreshold);
diff --git a/current.txt b/current.txt
index 8d0785f..64fafbf 100644
--- a/current.txt
+++ b/current.txt
@@ -101,7 +101,7 @@
 4f6dedbcdd21c309dfc650acea81a096d6b242493ffe49c8d61bd3c43aad354e android.hardware.graphics.common@1.0::types
 b3aac6c3817f039964fcd62268274b3039e17bd7d0d5b40b4d1d1c7b19a1f866 android.hardware.graphics.composer@2.1::IComposer
 b19d00eb8a8b3b0034a0321f22e8f32162bf4c2aebbce6da22c025f56e459ea2 android.hardware.graphics.composer@2.1::IComposerCallback
-e992684e690dfe67a8cbeab5005bfa3fa9c2bf3d4b0b75657fb1f0c2d5dd2bae android.hardware.graphics.composer@2.1::IComposerClient
+61ee43ffe6fb6dbe8b22dc17c51ff3d5ba703fc6029cba211f901f3d79c8a72d android.hardware.graphics.composer@2.1::IComposerClient
 1c98c2f5154345312ec054871792a2982ec5f3e2bc2abfb61a10c0b517978e20 android.hardware.graphics.composer@2.1::types
 a695898589e1ef15b2b2510f11edd6aafac9918d9cf8d74b4b6143b309dee542 android.hardware.graphics.mapper@2.0::IMapper
 28507d385a3dd224bf3c32f1bfd9f96092c4701b9c1cc66caa578fc3efc97877 android.hardware.graphics.mapper@2.0::types
@@ -189,4 +189,6 @@
 
 # ABI preserving changes to HALs released in Android O
 
+760485232f6cce07f8bb05e3475509956996b702f77415ee5bff05e2ec5a5bcc android.hardware.dumpstate@1.0::IDumpstateDevice
+78589343d8ee2e1b155acad3fbdc7fcbb6af94491aee968b2383c21627264f8b android.hardware.radio@1.0::IRadioResponse
 28e929b453df3d9f5060af2764e6cdb123ddb893e3e86923c877f6ff7e5f02c9 android.hardware.wifi@1.0::types
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
index 7829de7..731f58f 100644
--- a/drm/1.0/Android.bp
+++ b/drm/1.0/Android.bp
@@ -89,3 +89,5 @@
         "libutils",
     ],
 }
+
+subdirs = ["default"]
diff --git a/drm/1.0/default/Android.bp b/drm/1.0/default/Android.bp
new file mode 100644
index 0000000..ed6bcde
--- /dev/null
+++ b/drm/1.0/default/Android.bp
@@ -0,0 +1,23 @@
+cc_library_static {
+    name: "android.hardware.drm@1.0-helper",
+    vendor_available: true,
+    defaults: ["hidl_defaults"],
+    srcs: [
+        "SharedLibrary.cpp",
+    ],
+    cflags: [
+        "-Werror",
+        "-Wextra",
+        "-Wall",
+    ],
+    shared_libs: [
+        "liblog",
+    ],
+    header_libs: [
+        "libutils_headers",
+    ],
+    export_header_lib_headers: [
+        "libutils_headers",
+    ],
+    export_include_dirs : ["include"]
+}
diff --git a/drm/1.0/default/Android.mk b/drm/1.0/default/Android.mk
index 4c05da8..0cc6e71 100644
--- a/drm/1.0/default/Android.mk
+++ b/drm/1.0/default/Android.mk
@@ -36,6 +36,9 @@
   libutils \
   libbinder \
 
+LOCAL_STATIC_LIBRARIES := \
+  android.hardware.drm@1.0-helper \
+
 LOCAL_C_INCLUDES := \
   hardware/interfaces/drm
 
@@ -71,10 +74,12 @@
     libhidlmemory \
     libhidltransport \
     liblog \
-    libmediadrm \
     libstagefright_foundation \
     libutils \
 
+LOCAL_STATIC_LIBRARIES := \
+    android.hardware.drm@1.0-helper \
+
 LOCAL_C_INCLUDES := \
     frameworks/native/include \
     frameworks/av/include
diff --git a/drm/1.0/default/CryptoFactory.h b/drm/1.0/default/CryptoFactory.h
index 412b557..6b1d1ff 100644
--- a/drm/1.0/default/CryptoFactory.h
+++ b/drm/1.0/default/CryptoFactory.h
@@ -19,7 +19,7 @@
 #include <android/hardware/drm/1.0/ICryptoFactory.h>
 #include <hidl/Status.h>
 #include <media/hardware/CryptoAPI.h>
-#include <media/PluginLoader.h>
+#include <PluginLoader.h>
 #include <media/SharedLibrary.h>
 
 namespace android {
@@ -28,6 +28,7 @@
 namespace V1_0 {
 namespace implementation {
 
+using ::android::hardware::drm::V1_0::helper::PluginLoader;
 using ::android::hardware::drm::V1_0::ICryptoFactory;
 using ::android::hardware::drm::V1_0::ICryptoPlugin;
 using ::android::hardware::hidl_array;
@@ -51,7 +52,7 @@
             override;
 
 private:
-    android::PluginLoader<android::CryptoFactory> loader;
+    PluginLoader<android::CryptoFactory> loader;
 
     CryptoFactory(const CryptoFactory &) = delete;
     void operator=(const CryptoFactory &) = delete;
diff --git a/drm/1.0/default/DrmFactory.h b/drm/1.0/default/DrmFactory.h
index a008844..726bf97 100644
--- a/drm/1.0/default/DrmFactory.h
+++ b/drm/1.0/default/DrmFactory.h
@@ -19,7 +19,7 @@
 #include <android/hardware/drm/1.0/IDrmFactory.h>
 #include <hidl/Status.h>
 #include <media/drm/DrmAPI.h>
-#include <media/PluginLoader.h>
+#include <PluginLoader.h>
 #include <media/SharedLibrary.h>
 
 namespace android {
@@ -28,6 +28,7 @@
 namespace V1_0 {
 namespace implementation {
 
+using ::android::hardware::drm::V1_0::helper::PluginLoader;
 using ::android::hardware::drm::V1_0::IDrmFactory;
 using ::android::hardware::drm::V1_0::IDrmPlugin;
 using ::android::hardware::hidl_array;
@@ -53,7 +54,7 @@
             const hidl_string& appPackageName, createPlugin_cb _hidl_cb) override;
 
 private:
-    android::PluginLoader<android::DrmFactory> loader;
+    PluginLoader<android::DrmFactory> loader;
 
     DrmFactory(const DrmFactory &) = delete;
     void operator=(const DrmFactory &) = delete;
diff --git a/drm/1.0/vts/functional/shared_library.cpp b/drm/1.0/default/SharedLibrary.cpp
similarity index 82%
rename from drm/1.0/vts/functional/shared_library.cpp
rename to drm/1.0/default/SharedLibrary.cpp
index 6658150..0a942cd 100644
--- a/drm/1.0/vts/functional/shared_library.cpp
+++ b/drm/1.0/default/SharedLibrary.cpp
@@ -14,17 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "drm-vts-shared-library"
+
+#include "SharedLibrary.h"
 
 #include <dlfcn.h>
-#include <shared_library.h>
 
-using std::string;
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
 
-namespace drm_vts {
-
-SharedLibrary::SharedLibrary(const string& path) {
-    mLibHandle = dlopen(path.c_str(), RTLD_NOW);
+SharedLibrary::SharedLibrary(const String8& path) {
+    mLibHandle = dlopen(path.string(), RTLD_NOW);
 }
 
 SharedLibrary::~SharedLibrary() {
@@ -53,4 +55,9 @@
     const char* error = dlerror();
     return error ? error : "No errors or unknown error";
 }
-};
+
+}
+}
+}
+}
+} // namespace android
diff --git a/drm/1.0/default/include/PluginLoader.h b/drm/1.0/default/include/PluginLoader.h
new file mode 100644
index 0000000..f387b3c
--- /dev/null
+++ b/drm/1.0/default/include/PluginLoader.h
@@ -0,0 +1,107 @@
+/**
+ * Copyright (C) 2016 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 PLUGIN_LOADER_H_
+#define PLUGIN_LOADER_H_
+
+#include "SharedLibrary.h"
+#include <utils/Log.h>
+#include <utils/String8.h>
+#include <utils/Vector.h>
+
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
+
+template <class T>
+class PluginLoader {
+
+  public:
+    PluginLoader(const char *dir, const char *entry) {
+        /**
+         * scan all plugins in the plugin directory and add them to the
+         * factories list.
+         */
+        String8 pluginDir(dir);
+
+        DIR* pDir = opendir(pluginDir.string());
+        if (pDir == NULL) {
+            ALOGE("Failed to find plugin directory %s", pluginDir.string());
+        } else {
+            struct dirent* pEntry;
+            while ((pEntry = readdir(pDir))) {
+                String8 file(pEntry->d_name);
+                if (file.getPathExtension() == ".so") {
+                    String8 path = pluginDir + "/" + pEntry->d_name;
+                    T *plugin = loadOne(path, entry);
+                    if (plugin) {
+                        factories.push(plugin);
+                    }
+                }
+            }
+            closedir(pDir);
+        }
+    }
+
+    ~PluginLoader() {
+        for (size_t i = 0; i < factories.size(); i++) {
+            delete factories[i];
+        }
+    }
+
+    T *getFactory(size_t i) const {
+        return factories[i];
+    }
+
+    size_t factoryCount() const {return factories.size();}
+
+  private:
+    T* loadOne(const char *path, const char *entry) {
+        sp<SharedLibrary> library = new SharedLibrary(String8(path));
+        if (!library.get()) {
+            ALOGE("Failed to open plugin library %s: %s", path,
+                    library->lastError());
+        } else {
+            typedef T *(*CreateFactoryFunc)();
+            CreateFactoryFunc createFactoryFunc =
+                    (CreateFactoryFunc)library->lookup(entry);
+            if (createFactoryFunc) {
+                ALOGV("Found plugin factory entry %s in %s", entry, path);
+                libraries.push(library);
+                T* result = createFactoryFunc();
+                return  result;
+           }
+        }
+        return NULL;
+    }
+
+    Vector<T *> factories;
+    Vector<sp<SharedLibrary> > libraries;
+
+    PluginLoader(const PluginLoader &) = delete;
+    void operator=(const PluginLoader &) = delete;
+};
+
+}
+}
+}
+}
+} // namespace android
+
+#endif // PLUGIN_LOADER_H_
+
diff --git a/drm/1.0/vts/functional/shared_library.h b/drm/1.0/default/include/SharedLibrary.h
similarity index 79%
rename from drm/1.0/vts/functional/shared_library.h
rename to drm/1.0/default/include/SharedLibrary.h
index 1f32243..8e174d0 100644
--- a/drm/1.0/vts/functional/shared_library.h
+++ b/drm/1.0/default/include/SharedLibrary.h
@@ -17,13 +17,18 @@
 #ifndef SHARED_LIBRARY_H_
 #define SHARED_LIBRARY_H_
 
-#include <string>
-#include <vector>
+#include <utils/RefBase.h>
+#include <utils/String8.h>
 
-namespace drm_vts {
-class SharedLibrary {
+namespace android {
+namespace hardware {
+namespace drm {
+namespace V1_0 {
+namespace helper {
+
+class SharedLibrary : public RefBase {
    public:
-    explicit SharedLibrary(const std::string& path);
+    explicit SharedLibrary(const String8& path);
     ~SharedLibrary();
 
     bool operator!() const;
@@ -36,6 +41,11 @@
     SharedLibrary(const SharedLibrary&) = delete;
     void operator=(const SharedLibrary&) = delete;
 };
-};
+
+}
+}
+}
+}
+}
 
 #endif  // SHARED_LIBRARY_H_
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index 43ea372..b45ce84 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -19,7 +19,6 @@
     srcs: [
         "drm_hal_clearkey_test.cpp",
         "drm_hal_vendor_test.cpp",
-        "shared_library.cpp",
         "vendor_modules.cpp"
         ],
     shared_libs: [
@@ -39,7 +38,8 @@
         "libutils",
     ],
     static_libs: [
-        "VtsHalHidlTargetTestBase"
+        "VtsHalHidlTargetTestBase",
+        "android.hardware.drm@1.0-helper",
     ],
     cflags: [
         "-O0",
diff --git a/drm/1.0/vts/functional/vendor_modules.cpp b/drm/1.0/vts/functional/vendor_modules.cpp
index 2bf0b28..98430f5 100644
--- a/drm/1.0/vts/functional/vendor_modules.cpp
+++ b/drm/1.0/vts/functional/vendor_modules.cpp
@@ -20,13 +20,16 @@
 #include <dlfcn.h>
 #include <log/log.h>
 #include <memory>
+#include <utils/String8.h>
+#include <SharedLibrary.h>
 
-#include "shared_library.h"
 #include "vendor_modules.h"
 
 using std::string;
 using std::vector;
 using std::unique_ptr;
+using ::android::String8;
+using ::android::hardware::drm::V1_0::helper::SharedLibrary;
 
 namespace drm_vts {
 void VendorModules::scanModules(const std::string &directory) {
@@ -48,7 +51,7 @@
 
 DrmHalVTSVendorModule* VendorModules::getModule(const string& path) {
     if (mOpenLibraries.find(path) == mOpenLibraries.end()) {
-        auto library = std::make_unique<SharedLibrary>(path);
+        auto library = std::make_unique<SharedLibrary>(String8(path.c_str()));
         if (!library) {
             ALOGE("failed to map shared library %s", path.c_str());
             return NULL;
diff --git a/drm/1.0/vts/functional/vendor_modules.h b/drm/1.0/vts/functional/vendor_modules.h
index ca538f6..8330b0a 100644
--- a/drm/1.0/vts/functional/vendor_modules.h
+++ b/drm/1.0/vts/functional/vendor_modules.h
@@ -18,8 +18,12 @@
 #define VENDOR_MODULES_H
 
 #include <map>
+#include <vector>
+#include <string>
 
-#include "shared_library.h"
+#include <SharedLibrary.h>
+
+using ::android::hardware::drm::V1_0::helper::SharedLibrary;
 
 class DrmHalVTSVendorModule;
 
diff --git a/dumpstate/1.0/IDumpstateDevice.hal b/dumpstate/1.0/IDumpstateDevice.hal
index 206c139..12a0db4 100644
--- a/dumpstate/1.0/IDumpstateDevice.hal
+++ b/dumpstate/1.0/IDumpstateDevice.hal
@@ -18,7 +18,14 @@
 
 interface IDumpstateDevice {
     /**
-     * Dumps device-specific state into the given file descriptor.
+     * Dump device-specific state into the given file descriptors.
+     *
+     * One file descriptor must be passed to this method but two may be passed:
+     * the first descriptor must be used to dump device-specific state in text
+     * format, the second descriptor is optional and may be used to dump
+     * device-specific state in binary format.
+     *
+     * @param h A native handle with one or two valid file descriptors.
      */
     dumpstateBoard(handle h);
 };
diff --git a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
index 7ab4812..046bf56 100644
--- a/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
+++ b/dumpstate/1.0/vts/functional/VtsHalDumpstateV1_0TargetTest.cpp
@@ -59,6 +59,7 @@
 // Positive test: make sure dumpstateBoard() writes something to the FD.
 TEST_F(DumpstateHidlTest, TestOk) {
     FILE* file = tmpfile();
+
     ASSERT_NE(nullptr, file) << "Could not create temp file: " << strerror(errno);
 
     native_handle_t* handle = native_handle_create(1, 0);
@@ -80,6 +81,29 @@
     native_handle_delete(handle);
 }
 
+// Positive test: make sure dumpstateBoard() doesn't crash with two FDs.
+TEST_F(DumpstateHidlTest, TestHandleWithTwoFds) {
+    FILE* file1 = tmpfile();
+    FILE* file2 = tmpfile();
+
+    ASSERT_NE(nullptr, file1) << "Could not create temp file #1: " << strerror(errno);
+    ASSERT_NE(nullptr, file2) << "Could not create temp file #2: " << strerror(errno);
+
+    native_handle_t* handle = native_handle_create(2, 0);
+    ASSERT_NE(handle, nullptr) << "Could not create native_handle";
+    handle->data[0] = fileno(file1);
+    handle->data[1] = fileno(file2);
+
+    Return<void> status = dumpstate->dumpstateBoard(handle);
+    ASSERT_TRUE(status.isOk()) << "Status should be ok: " << status.description();
+
+    EXPECT_EQ(0, fclose(file1)) << errno;
+    EXPECT_EQ(0, fclose(file2)) << errno;
+
+    native_handle_close(handle);
+    native_handle_delete(handle);
+}
+
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
     int status = RUN_ALL_TESTS();
diff --git a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
index fde3171..91e75fe 100644
--- a/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
+++ b/gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp
@@ -39,7 +39,7 @@
 
 // for command line argument on how strictly to run the test
 bool sAgpsIsPresent = false;  // if SUPL or XTRA assistance available
-bool sSignalIsWeak = false;  // if GNSS signals are weak (e.g. light indoor)
+bool sSignalIsWeak = false;   // if GNSS signals are weak (e.g. light indoor)
 
 // The main test class for GNSS HAL.
 class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
@@ -49,6 +49,7 @@
     capabilities_called_count_ = 0;
     location_called_count_ = 0;
     info_called_count_ = 0;
+    notify_count_ = 0;
 
     gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>();
     ASSERT_NE(gnss_hal_, nullptr);
@@ -93,12 +94,15 @@
     if (gnss_hal_ != nullptr) {
       gnss_hal_->cleanup();
     }
+    if (notify_count_ > 0) {
+        ALOGW("%d unprocessed callbacks discarded", notify_count_);
+    }
   }
 
   /* Used as a mechanism to inform the test that a callback has occurred */
   inline void notify() {
     std::unique_lock<std::mutex> lock(mtx_);
-    count++;
+    notify_count_++;
     cv_.notify_one();
   }
 
@@ -108,14 +112,132 @@
 
     std::cv_status status = std::cv_status::no_timeout;
     auto now = std::chrono::system_clock::now();
-    while (count == 0) {
-      status = cv_.wait_until(lock, now + std::chrono::seconds(timeoutSeconds));
-      if (status == std::cv_status::timeout) return status;
+    while (notify_count_ == 0) {
+        status = cv_.wait_until(lock, now + std::chrono::seconds(timeoutSeconds));
+        if (status == std::cv_status::timeout) return status;
     }
-    count--;
+    notify_count_--;
     return status;
   }
 
+  /*
+   * 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 = sAgpsIsPresent ? 15 : 45;
+      if (sSignalIsWeak) {
+          // allow more time for weak signals
+          firstGnssLocationTimeoutSeconds += 30;
+      }
+
+      wait(firstGnssLocationTimeoutSeconds);
+      if (sAgpsIsPresent) {
+          EXPECT_EQ(location_called_count_, 1);
+      }
+      if (location_called_count_ > 0) {
+          CheckLocation(last_location_, checkAccuracies);
+          return true;
+      }
+      return false;
+  }
+
+  /*
+   * 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) {
+      }
+  }
+
+  /*
+   * CheckLocation:
+   * Helper function to vet Location fields
+   */
+  void CheckLocation(GnssLocation& location, bool checkAccuracies) {
+      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
+      EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
+      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);
+          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);
+      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);
+  }
+
   /* Callback class for data & Event. */
   class GnssCallback : public IGnssCallback {
    public:
@@ -188,7 +310,7 @@
  private:
   std::mutex mtx_;
   std::condition_variable cv_;
-  int count;
+  int notify_count_;
 };
 
 /*
@@ -201,107 +323,6 @@
 TEST_F(GnssHalTest, SetCallbackCapabilitiesCleanup) {}
 
 /*
- * CheckLocation:
- * Helper function to vet Location fields
- */
-void CheckLocation(GnssLocation& location, bool checkAccuracies) {
-  EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_LAT_LONG);
-  EXPECT_TRUE(location.gnssLocationFlags & GnssLocationFlags::HAS_ALTITUDE);
-  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);
-    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);
-  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);
-}
-
-/*
- * StartAndGetSingleLocation:
- * Helper function to get one Location and check fields
- *
- * returns  true if a location was successfully generated
- */
-bool StartAndGetSingleLocation(GnssHalTest* test, bool checkAccuracies) {
-  auto result = test->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 = sAgpsIsPresent ? 15 : 45;
-  if (sSignalIsWeak) {
-    // allow more time for weak signals
-    firstGnssLocationTimeoutSeconds += 30;
-  }
-
-  test->wait(firstGnssLocationTimeoutSeconds);
-  if (sAgpsIsPresent) {
-    EXPECT_EQ(test->location_called_count_, 1);
-  }
-  if (test->location_called_count_ > 0) {
-    CheckLocation(test->last_location_, checkAccuracies);
-    return true;
-  }
-  return false;
-}
-
-/*
  * GetLocation:
  * Turns on location, waits 45 second for at least 5 locations,
  * and checks them for reasonable validity.
@@ -329,21 +350,17 @@
    * GPS signals initially optional for this test, so don't expect no timeout
    * yet
    */
-  bool gotLocation = StartAndGetSingleLocation(this, checkMoreAccuracies);
+  bool gotLocation = StartAndGetSingleLocation(checkMoreAccuracies);
 
   if (gotLocation) {
     for (int i = 1; i < LOCATIONS_TO_CHECK; i++) {
-      EXPECT_EQ(std::cv_status::no_timeout,
-          wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
-      EXPECT_EQ(location_called_count_, i + 1);
-      CheckLocation(last_location_, checkMoreAccuracies);
+        EXPECT_EQ(std::cv_status::no_timeout, wait(LOCATION_TIMEOUT_SUBSEQUENT_SEC));
+        EXPECT_EQ(location_called_count_, i + 1);
+        CheckLocation(last_location_, checkMoreAccuracies);
     }
   }
 
-  result = gnss_hal_->stop();
-
-  ASSERT_TRUE(result.isOk());
-  ASSERT_TRUE(result);
+  StopAndClearLocations();
 }
 
 /*
@@ -368,7 +385,9 @@
   ASSERT_TRUE(resultVoid.isOk());
 
   // Ensure we can get a good location after a bad injection has been deleted
-  StartAndGetSingleLocation(this, false);
+  StartAndGetSingleLocation(false);
+
+  StopAndClearLocations();
 }
 
 /*
@@ -437,13 +456,13 @@
    * stronger tests that require the presence of GPS signal.
    */
   for (int i = 1; i < argc; i++) {
-    if (strcmp(argv[i],"-agps") == 0) {
-      sAgpsIsPresent = true;
-    } else if (strcmp(argv[i],"-weak") == 0) {
-      sSignalIsWeak = true;
+      if (strcmp(argv[i], "-agps") == 0) {
+          sAgpsIsPresent = true;
+      } else if (strcmp(argv[i], "-weak") == 0) {
+          sSignalIsWeak = true;
     }
   }
   int status = RUN_ALL_TESTS();
   ALOGI("Test result = %d", status);
   return status;
-}
\ No newline at end of file
+}
diff --git a/graphics/composer/2.1/IComposerClient.hal b/graphics/composer/2.1/IComposerClient.hal
index 85572d4..f2ff932 100644
--- a/graphics/composer/2.1/IComposerClient.hal
+++ b/graphics/composer/2.1/IComposerClient.hal
@@ -1117,6 +1117,7 @@
         VALIDATE_DISPLAY                   = 0x203 << OPCODE_SHIFT,
         ACCEPT_DISPLAY_CHANGES             = 0x204 << OPCODE_SHIFT,
         PRESENT_DISPLAY                    = 0x205 << OPCODE_SHIFT,
+        PRESENT_OR_VALIDATE_DISPLAY        = 0x206 << OPCODE_SHIFT,
 
         /** layer commands (VALIDATE_DISPLAY not required) */
         SET_LAYER_CURSOR_POSITION          = 0x300 << OPCODE_SHIFT,
@@ -1135,6 +1136,7 @@
         SET_LAYER_TRANSFORM                = 0x408 << OPCODE_SHIFT,
         SET_LAYER_VISIBLE_REGION           = 0x409 << OPCODE_SHIFT,
         SET_LAYER_Z_ORDER                  = 0x40a << OPCODE_SHIFT,
+        SET_PRESENT_OR_VALIDATE_DISPLAY_RESULT = 0x40b << OPCODE_SHIFT,
 
         /** 0x800 - 0xfff are reserved for vendor extensions */
         /** 0x1000 - 0xffff are reserved */
diff --git a/graphics/composer/2.1/default/ComposerClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
index ce4e17f..5a96e29 100644
--- a/graphics/composer/2.1/default/ComposerClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -562,6 +562,8 @@
         return parseSetOutputBuffer(length);
     case IComposerClient::Command::VALIDATE_DISPLAY:
         return parseValidateDisplay(length);
+    case IComposerClient::Command::PRESENT_OR_VALIDATE_DISPLAY:
+        return parsePresentOrValidateDisplay(length);
     case IComposerClient::Command::ACCEPT_DISPLAY_CHANGES:
         return parseAcceptDisplayChanges(length);
     case IComposerClient::Command::PRESENT_DISPLAY:
@@ -739,6 +741,47 @@
     return true;
 }
 
+bool ComposerClient::CommandReader::parsePresentOrValidateDisplay(uint16_t length)
+{
+    if (length != CommandWriterBase::kPresentOrValidateDisplayLength) {
+        return false;
+    }
+
+    // First try to Present as is.
+    int presentFence = -1;
+    std::vector<Layer> layers;
+    std::vector<int> fences;
+    auto err = mHal.presentDisplay(mDisplay, &presentFence, &layers, &fences);
+    if (err == Error::NONE) {
+        mWriter.setPresentOrValidateResult(1);
+        mWriter.setPresentFence(presentFence);
+        mWriter.setReleaseFences(layers, fences);
+        return true;
+    }
+
+    // Present has failed. We need to fallback to validate
+    std::vector<Layer> changedLayers;
+    std::vector<IComposerClient::Composition> compositionTypes;
+    uint32_t displayRequestMask = 0x0;
+    std::vector<Layer> requestedLayers;
+    std::vector<uint32_t> requestMasks;
+
+    err = mHal.validateDisplay(mDisplay, &changedLayers,
+                               &compositionTypes, &displayRequestMask,
+                               &requestedLayers, &requestMasks);
+    if (err == Error::NONE) {
+        mWriter.setPresentOrValidateResult(0);
+        mWriter.setChangedCompositionTypes(changedLayers,
+                                           compositionTypes);
+        mWriter.setDisplayRequests(displayRequestMask,
+                                   requestedLayers, requestMasks);
+    } else {
+        mWriter.setError(getCommandLoc(), err);
+    }
+
+    return true;
+}
+
 bool ComposerClient::CommandReader::parseAcceptDisplayChanges(uint16_t length)
 {
     if (length != CommandWriterBase::kAcceptDisplayChangesLength) {
diff --git a/graphics/composer/2.1/default/ComposerClient.h b/graphics/composer/2.1/default/ComposerClient.h
index 3d10f80..ee825fe 100644
--- a/graphics/composer/2.1/default/ComposerClient.h
+++ b/graphics/composer/2.1/default/ComposerClient.h
@@ -141,6 +141,7 @@
         bool parseSetClientTarget(uint16_t length);
         bool parseSetOutputBuffer(uint16_t length);
         bool parseValidateDisplay(uint16_t length);
+        bool parsePresentOrValidateDisplay(uint16_t length);
         bool parseAcceptDisplayChanges(uint16_t length);
         bool parsePresentDisplay(uint16_t length);
         bool parseSetLayerCursorPosition(uint16_t length);
diff --git a/graphics/composer/2.1/default/IComposerCommandBuffer.h b/graphics/composer/2.1/default/IComposerCommandBuffer.h
index fb78ef8..9ee5f4f 100644
--- a/graphics/composer/2.1/default/IComposerCommandBuffer.h
+++ b/graphics/composer/2.1/default/IComposerCommandBuffer.h
@@ -152,6 +152,13 @@
         endCommand();
     }
 
+    static constexpr uint32_t kPresentOrValidateDisplayResultLength = 1;
+    void setPresentOrValidateResult(uint32_t  state) {
+       beginCommand(IComposerClient::Command::SET_PRESENT_OR_VALIDATE_DISPLAY_RESULT, kPresentOrValidateDisplayResultLength);
+       write(state);
+       endCommand();
+    }
+
     void setChangedCompositionTypes(const std::vector<Layer>& layers,
             const std::vector<IComposerClient::Composition>& types)
     {
@@ -284,6 +291,14 @@
         endCommand();
     }
 
+    static constexpr uint16_t kPresentOrValidateDisplayLength = 0;
+    void presentOrvalidateDisplay()
+    {
+        beginCommand(IComposerClient::Command::PRESENT_OR_VALIDATE_DISPLAY,
+                     kPresentOrValidateDisplayLength);
+        endCommand();
+    }
+
     static constexpr uint16_t kAcceptDisplayChangesLength = 0;
     void acceptDisplayChanges()
     {
diff --git a/graphics/mapper/2.0/default/GrallocMapper.cpp b/graphics/mapper/2.0/default/GrallocMapper.cpp
index e06fbcb..d16143d 100644
--- a/graphics/mapper/2.0/default/GrallocMapper.cpp
+++ b/graphics/mapper/2.0/default/GrallocMapper.cpp
@@ -293,31 +293,20 @@
     return Void();
 }
 
-namespace {
-// Load the gralloc module when this shared library is loaded, rather than
-// waiting until HIDL_FETCH_IMapper is called. This allows it (and its
-// dependencies) to be loaded by Zygote, reducing app startup time and sharing
-// pages dirtied during library load between all apps.
-struct GrallocModule {
-    const hw_module_t* module;
-    GrallocModule() : module(nullptr) {
-        int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
-        ALOGE_IF(err, "failed to get gralloc module: %s (%d)", strerror(-err),
-                 err);
-    }
-};
-GrallocModule gGralloc;
-}  // namespace
-
 IMapper* HIDL_FETCH_IMapper(const char* /* name */) {
-    if (!gGralloc.module) return nullptr;
+    const hw_module_t* module = nullptr;
+    int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
+    if (err) {
+        ALOGE("failed to get gralloc module");
+        return nullptr;
+    }
 
-    uint8_t major = (gGralloc.module->module_api_version >> 8) & 0xff;
+    uint8_t major = (module->module_api_version >> 8) & 0xff;
     switch (major) {
         case 1:
-            return new Gralloc1Mapper(gGralloc.module);
+            return new Gralloc1Mapper(module);
         case 0:
-            return new Gralloc0Mapper(gGralloc.module);
+            return new Gralloc0Mapper(module);
         default:
             ALOGE("unknown gralloc module major version %d", major);
             return nullptr;
diff --git a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
index 570e33f..78353ea 100644
--- a/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/3.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -247,34 +247,47 @@
     return retval;
 }
 
-string rsa_key = hex2str("30820275020100300d06092a864886f70d01010105000482025f3082025b"
-                         "02010002818100c6095409047d8634812d5a218176e45c41d60a75b13901"
-                         "f234226cffe776521c5a77b9e389417b71c0b6a44d13afe4e4a2805d46c9"
-                         "da2935adb1ff0c1f24ea06e62b20d776430a4d435157233c6f916783c30e"
-                         "310fcbd89b85c2d56771169785ac12bca244abda72bfb19fc44d27c81e1d"
-                         "92de284f4061edfd99280745ea6d2502030100010281801be0f04d9cae37"
-                         "18691f035338308e91564b55899ffb5084d2460e6630257e05b3ceab0297"
-                         "2dfabcd6ce5f6ee2589eb67911ed0fac16e43a444b8c861e544a05933657"
-                         "72f8baf6b22fc9e3c5f1024b063ac080a7b2234cf8aee8f6c47bbf4fd3ac"
-                         "e7240290bef16c0b3f7f3cdd64ce3ab5912cf6e32f39ab188358afcccd80"
-                         "81024100e4b49ef50f765d3b24dde01aceaaf130f2c76670a91a61ae08af"
-                         "497b4a82be6dee8fcdd5e3f7ba1cfb1f0c926b88f88c92bfab137fba2285"
-                         "227b83c342ff7c55024100ddabb5839c4c7f6bf3d4183231f005b31aa58a"
-                         "ffdda5c79e4cce217f6bc930dbe563d480706c24e9ebfcab28a6cdefd324"
-                         "b77e1bf7251b709092c24ff501fd91024023d4340eda3445d8cd26c14411"
-                         "da6fdca63c1ccd4b80a98ad52b78cc8ad8beb2842c1d280405bc2f6c1bea"
-                         "214a1d742ab996b35b63a82a5e470fa88dbf823cdd02401b7b57449ad30d"
-                         "1518249a5f56bb98294d4b6ac12ffc86940497a5a5837a6cf946262b4945"
-                         "26d328c11e1126380fde04c24f916dec250892db09a6d77cdba351024077"
-                         "62cd8f4d050da56bd591adb515d24d7ccd32cca0d05f866d583514bd7324"
-                         "d5f33645e8ed8b4a1cb3cc4a1d67987399f2a09f5b3fb68c88d5e5d90ac3"
-                         "3492d6");
+string rsa_key = hex2str(
+    "30820275020100300d06092a864886f70d01010105000482025f3082025b"
+    "02010002818100c6095409047d8634812d5a218176e45c41d60a75b13901"
+    "f234226cffe776521c5a77b9e389417b71c0b6a44d13afe4e4a2805d46c9"
+    "da2935adb1ff0c1f24ea06e62b20d776430a4d435157233c6f916783c30e"
+    "310fcbd89b85c2d56771169785ac12bca244abda72bfb19fc44d27c81e1d"
+    "92de284f4061edfd99280745ea6d2502030100010281801be0f04d9cae37"
+    "18691f035338308e91564b55899ffb5084d2460e6630257e05b3ceab0297"
+    "2dfabcd6ce5f6ee2589eb67911ed0fac16e43a444b8c861e544a05933657"
+    "72f8baf6b22fc9e3c5f1024b063ac080a7b2234cf8aee8f6c47bbf4fd3ac"
+    "e7240290bef16c0b3f7f3cdd64ce3ab5912cf6e32f39ab188358afcccd80"
+    "81024100e4b49ef50f765d3b24dde01aceaaf130f2c76670a91a61ae08af"
+    "497b4a82be6dee8fcdd5e3f7ba1cfb1f0c926b88f88c92bfab137fba2285"
+    "227b83c342ff7c55024100ddabb5839c4c7f6bf3d4183231f005b31aa58a"
+    "ffdda5c79e4cce217f6bc930dbe563d480706c24e9ebfcab28a6cdefd324"
+    "b77e1bf7251b709092c24ff501fd91024023d4340eda3445d8cd26c14411"
+    "da6fdca63c1ccd4b80a98ad52b78cc8ad8beb2842c1d280405bc2f6c1bea"
+    "214a1d742ab996b35b63a82a5e470fa88dbf823cdd02401b7b57449ad30d"
+    "1518249a5f56bb98294d4b6ac12ffc86940497a5a5837a6cf946262b4945"
+    "26d328c11e1126380fde04c24f916dec250892db09a6d77cdba351024077"
+    "62cd8f4d050da56bd591adb515d24d7ccd32cca0d05f866d583514bd7324"
+    "d5f33645e8ed8b4a1cb3cc4a1d67987399f2a09f5b3fb68c88d5e5d90ac3"
+    "3492d6");
 
-string ec_key = hex2str("308187020100301306072a8648ce3d020106082a8648ce3d030107046d30"
-                        "6b0201010420737c2ecd7b8d1940bf2930aa9b4ed3ff941eed09366bc032"
-                        "99986481f3a4d859a14403420004bf85d7720d07c25461683bc648b4778a"
-                        "9a14dd8a024e3bdd8c7ddd9ab2b528bbc7aa1b51f14ebbbb0bd0ce21bcc4"
-                        "1c6eb00083cf3376d11fd44949e0b2183bfe");
+string ec_256_key = hex2str(
+    "308187020100301306072a8648ce3d020106082a8648ce3d030107046d30"
+    "6b0201010420737c2ecd7b8d1940bf2930aa9b4ed3ff941eed09366bc032"
+    "99986481f3a4d859a14403420004bf85d7720d07c25461683bc648b4778a"
+    "9a14dd8a024e3bdd8c7ddd9ab2b528bbc7aa1b51f14ebbbb0bd0ce21bcc4"
+    "1c6eb00083cf3376d11fd44949e0b2183bfe");
+
+string ec_521_key = hex2str(
+    "3081EE020100301006072A8648CE3D020106052B810400230481D63081D3"
+    "02010104420011458C586DB5DAA92AFAB03F4FE46AA9D9C3CE9A9B7A006A"
+    "8384BEC4C78E8E9D18D7D08B5BCFA0E53C75B064AD51C449BAE0258D54B9"
+    "4B1E885DED08ED4FB25CE9A1818903818600040149EC11C6DF0FA122C6A9"
+    "AFD9754A4FA9513A627CA329E349535A5629875A8ADFBE27DCB932C05198"
+    "6377108D054C28C6F39B6F2C9AF81802F9F326B842FF2E5F3C00AB7635CF"
+    "B36157FC0882D574A10D839C1A0C049DC5E0D775E2EE50671A208431BB45"
+    "E78E70BEFE930DB34818EE4D5C26259F5C6B8E28A652950F9F88D7B4B2C9"
+    "D9");
 
 struct RSA_Delete {
     void operator()(RSA* p) { RSA_free(p); }
@@ -408,7 +421,7 @@
   public:
     void TearDown() override {
         if (key_blob_.size()) {
-            EXPECT_EQ(ErrorCode::OK, DeleteKey());
+            CheckedDeleteKey();
         }
         AbortIfNeeded();
     }
@@ -540,6 +553,13 @@
         return error;
     }
 
+    void CheckedDeleteKey(HidlBuf* key_blob, bool keep_key_blob = false) {
+        auto rc = DeleteKey(key_blob, keep_key_blob);
+        EXPECT_TRUE(rc == ErrorCode::OK || rc == ErrorCode::UNIMPLEMENTED);
+    }
+
+    void CheckedDeleteKey() { CheckedDeleteKey(&key_blob_); }
+
     ErrorCode GetCharacteristics(const HidlBuf& key_blob, const HidlBuf& client_id,
                                  const HidlBuf& app_data, KeyCharacteristics* key_characteristics) {
         ErrorCode error = ErrorCode::UNKNOWN_ERROR;
@@ -760,7 +780,7 @@
                             KeyFormat::RAW, key));
         string signature = MacMessage(message, digest, expected_mac.size() * 8);
         EXPECT_EQ(expected_mac, signature) << "Test vector didn't match for digest " << (int)digest;
-        DeleteKey();
+        CheckedDeleteKey();
     }
 
     void CheckAesCtrTestVector(const string& key, const string& nonce, const string& message,
@@ -1107,7 +1127,7 @@
         EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
         EXPECT_TRUE(crypto_params.Contains(TAG_RSA_PUBLIC_EXPONENT, 3));
 
-        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+        CheckedDeleteKey(&key_blob);
     }
 }
 
@@ -1152,7 +1172,7 @@
         EXPECT_TRUE(crypto_params.Contains(TAG_ALGORITHM, Algorithm::EC));
         EXPECT_TRUE(crypto_params.Contains(TAG_KEY_SIZE, key_size));
 
-        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+        CheckedDeleteKey(&key_blob);
     }
 }
 
@@ -1201,7 +1221,7 @@
         EXPECT_EQ(ErrorCode::OK,
                   GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(size).Digest(Digest::NONE)))
             << "Failed to generate size: " << size;
-        DeleteKey();
+        CheckedDeleteKey();
     }
 }
 
@@ -1217,7 +1237,7 @@
             ErrorCode::OK,
             GenerateKey(AuthorizationSetBuilder().EcdsaSigningKey(curve).Digest(Digest::SHA_2_512)))
             << "Failed to generate key on curve: " << curve;
-        DeleteKey();
+        CheckedDeleteKey();
     }
 }
 
@@ -1267,7 +1287,7 @@
             EXPECT_TRUE(softwareEnforced.Contains(TAG_KEY_SIZE, key_size));
         }
 
-        EXPECT_EQ(ErrorCode::OK, DeleteKey(&key_blob));
+        CheckedDeleteKey(&key_blob);
     }
 }
 
@@ -1295,7 +1315,7 @@
                                                      .HmacKey(key_size)
                                                      .Digest(Digest::SHA_2_256)
                                                      .Authorization(TAG_MIN_MAC_LENGTH, 256)));
-            DeleteKey();
+            CheckedDeleteKey();
         }
     }
 }
@@ -1327,7 +1347,7 @@
                                       .HmacKey(128)
                                       .Digest(Digest::SHA_2_256)
                                       .Authorization(TAG_MIN_MAC_LENGTH, min_mac_length)));
-            DeleteKey();
+            CheckedDeleteKey();
         }
     }
 }
@@ -1717,7 +1737,7 @@
             string message(1024, 'a');
             if (digest == Digest::NONE) message.resize(key_size / 8);
             SignMessage(message, AuthorizationSetBuilder().Digest(digest));
-            DeleteKey();
+            CheckedDeleteKey();
         }
     }
 }
@@ -1738,7 +1758,7 @@
 
         string message(1024, 'a');
         SignMessage(message, AuthorizationSetBuilder().Digest(Digest::SHA_2_256));
-        DeleteKey();
+        CheckedDeleteKey();
     }
 }
 
@@ -1799,7 +1819,7 @@
         string signature = MacMessage(message, digest, 160);
         EXPECT_EQ(160U / 8U, signature.size())
             << "Failed to sign with HMAC key with digest " << digest;
-        DeleteKey();
+        CheckedDeleteKey();
     }
 }
 
@@ -2186,7 +2206,8 @@
                 << curve << ' ' << digest;
         }
 
-        ASSERT_EQ(ErrorCode::OK, DeleteKey());
+        auto rc = DeleteKey();
+        ASSERT_TRUE(rc == ErrorCode::OK || rc == ErrorCode::UNIMPLEMENTED);
     }
 }
 
@@ -2232,8 +2253,8 @@
     VerifyMessage(verification_key, message, signature,
                   AuthorizationSetBuilder().Digest(Digest::SHA1));
 
-    EXPECT_EQ(ErrorCode::OK, DeleteKey(&signing_key));
-    EXPECT_EQ(ErrorCode::OK, DeleteKey(&verification_key));
+    CheckedDeleteKey(&signing_key);
+    CheckedDeleteKey(&verification_key);
 }
 
 typedef KeymasterHidlTest ExportKeyTest;
@@ -2377,14 +2398,14 @@
 /*
  * ImportKeyTest.EcdsaSuccess
  *
- * Verifies that importing and using an ECDSA key pair works correctly.
+ * Verifies that importing and using an ECDSA P-256 key pair works correctly.
  */
 TEST_F(ImportKeyTest, EcdsaSuccess) {
     ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
                                            .Authorization(TAG_NO_AUTH_REQUIRED)
                                            .EcdsaSigningKey(256)
                                            .Digest(Digest::SHA_2_256),
-                                       KeyFormat::PKCS8, ec_key))
+                                       KeyFormat::PKCS8, ec_256_key))
         << "(Possibly b/33945114)";
 
     CheckKm0CryptoParam(TAG_ALGORITHM, Algorithm::EC);
@@ -2401,6 +2422,32 @@
 }
 
 /*
+ * ImportKeyTest.Ecdsa521Success
+ *
+ * Verifies that importing and using an ECDSA P-521 key pair works correctly.
+ */
+TEST_F(ImportKeyTest, Ecdsa521Success) {
+    ASSERT_EQ(ErrorCode::OK, ImportKey(AuthorizationSetBuilder()
+                                           .Authorization(TAG_NO_AUTH_REQUIRED)
+                                           .EcdsaSigningKey(521)
+                                           .Digest(Digest::SHA_2_256),
+                                       KeyFormat::PKCS8, ec_521_key))
+        << "(Possibly b/33945114)";
+
+    CheckKm0CryptoParam(TAG_ALGORITHM, Algorithm::EC);
+    CheckKm0CryptoParam(TAG_KEY_SIZE, 521U);
+    CheckKm1CryptoParam(TAG_DIGEST, Digest::SHA_2_256);
+    CheckKm2CryptoParam(TAG_EC_CURVE, EcCurve::P_521);
+
+    CheckOrigin();
+
+    string message(32, 'a');
+    auto params = AuthorizationSetBuilder().Digest(Digest::SHA_2_256);
+    string signature = SignMessage(message, params);
+    VerifyMessage(message, signature, params);
+}
+
+/*
  * ImportKeyTest.EcdsaSizeMismatch
  *
  * Verifies that importing an ECDSA key pair with a size that doesn't match the key fails in the
@@ -2411,7 +2458,7 @@
               ImportKey(AuthorizationSetBuilder()
                             .EcdsaSigningKey(224 /* Doesn't match key */)
                             .Digest(Digest::NONE),
-                        KeyFormat::PKCS8, ec_key));
+                        KeyFormat::PKCS8, ec_256_key));
 }
 
 /*
@@ -2430,7 +2477,7 @@
               ImportKey(AuthorizationSetBuilder()
                             .EcdsaSigningKey(EcCurve::P_224 /* Doesn't match key */)
                             .Digest(Digest::NONE),
-                        KeyFormat::PKCS8, ec_key))
+                        KeyFormat::PKCS8, ec_256_key))
         << "(Possibly b/36233241)";
 }
 
@@ -3481,14 +3528,14 @@
     string key = make_string(key_bytes);
     ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
     string plaintext = DecryptMessage(ciphertext, params);
-    EXPECT_EQ(ErrorCode::OK, DeleteKey());
+    CheckedDeleteKey();
 
     // Corrupt key and attempt to decrypt
     key[0] = 0;
     ASSERT_EQ(ErrorCode::OK, ImportKey(import_params, KeyFormat::RAW, key));
     EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
     EXPECT_EQ(ErrorCode::VERIFICATION_FAILED, Finish(ciphertext, &plaintext));
-    EXPECT_EQ(ErrorCode::OK, DeleteKey());
+    CheckedDeleteKey();
 }
 
 /*
diff --git a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
index c94fa4f..da49dfc 100644
--- a/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
+++ b/power/1.0/vts/functional/VtsHalPowerV1_0TargetTest.cpp
@@ -77,6 +77,7 @@
   if (fd1 < 0 || fd2 < 0) {
     // Files don't exist, so skip the rest of the test case
     SUCCEED();
+    return;
   }
 
   char old_governor[80];
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 35ab899..8697e57 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -28,6 +28,12 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getIccCardStatusResponse(RadioResponseInfo info, CardStatus cardStatus);
 
@@ -39,6 +45,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway supplyIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -50,6 +63,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT (PUK is invalid)
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway supplyIccPukForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -61,6 +81,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway supplyIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -71,6 +98,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT (PUK is invalid)
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway supplyIccPuk2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -82,6 +116,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway changeIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -93,6 +134,13 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
      *   RadioError:PASSWORD_INCORRECT (old PIN2 is invalid)
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway changeIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -102,6 +150,7 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:PASSWORD_INCORRECT (code is invalid)
      *   RadioError:NO_MEMORY
      *   RadioError:INVALID_SIM_STATE
@@ -109,6 +158,9 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway supplyNetworkDepersonalizationResponse(RadioResponseInfo info, int32_t remainingRetries);
 
@@ -124,6 +176,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCurrentCallsResponse(RadioResponseInfo info, vec<Call> calls);
 
@@ -152,6 +206,7 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:CANCELLED
      */
     oneway dialResponse(RadioResponseInfo info);
 
@@ -162,6 +217,13 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE (radio resetting)
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:SIM_ERR
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getIMSIForAppResponse(RadioResponseInfo info, string imsi);
 
@@ -177,6 +239,9 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INTERNAL_ERR
      *   RadioError:INVALID_CALL_ID
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway hangupConnectionResponse(RadioResponseInfo info);
 
@@ -196,6 +261,7 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:CANCELLED
      */
     oneway hangupWaitingOrBackgroundResponse(RadioResponseInfo info);
 
@@ -215,6 +281,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway hangupForegroundResumeBackgroundResponse(RadioResponseInfo info);
 
@@ -235,6 +303,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo info);
 
@@ -254,6 +324,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway conferenceResponse(RadioResponseInfo info);
 
@@ -274,6 +346,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway rejectCallResponse(RadioResponseInfo info);
 
@@ -322,6 +396,9 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getLastCallFailCauseResponse(RadioResponseInfo info,
             LastCallFailCauseInfo failCauseinfo);
@@ -339,6 +416,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getSignalStrengthResponse(RadioResponseInfo info, SignalStrength sigStrength);
 
@@ -350,6 +429,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getVoiceRegistrationStateResponse(RadioResponseInfo info,
             VoiceRegStateResult voiceRegResponse);
@@ -368,6 +452,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getDataRegistrationStateResponse(RadioResponseInfo info,
             DataRegStateResult dataRegResponse);
@@ -385,6 +471,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getOperatorResponse(RadioResponseInfo info, string longName, string shortName,
             string numeric);
@@ -406,6 +494,8 @@
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setRadioPowerResponse(RadioResponseInfo info);
 
@@ -423,6 +513,7 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      */
     oneway sendDtmfResponse(RadioResponseInfo info);
@@ -452,6 +543,8 @@
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:NETWORK_NOT_READY
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
@@ -481,6 +574,8 @@
      *   RadioError:INVALID_MODEM_STATE
      *   RadioError:NETWORK_NOT_READY
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendSMSExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms);
 
@@ -497,7 +592,10 @@
      *   RadioError:OP_NOT_ALLOWED_DURING_VOICE_CALL
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_ARGUMENTS
-     *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setupDataCallResponse(RadioResponseInfo info, SetupDataCallResult dcResponse);
 
@@ -510,6 +608,13 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SIM_PIN2
      *   RadioError:SIM_PUK2
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:SIM_ERR
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway iccIOForAppResponse(RadioResponseInfo info, IccIoResult iccIo);
 
@@ -534,6 +639,8 @@
      *   RadioError:INVALID_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendUssdResponse(RadioResponseInfo info);
 
@@ -553,6 +660,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway cancelPendingUssdResponse(RadioResponseInfo info);
 
@@ -574,6 +683,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getClirResponse(RadioResponseInfo info, int32_t n, int32_t m);
 
@@ -591,6 +702,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setClirResponse(RadioResponseInfo info);
 
@@ -620,6 +733,8 @@
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:SYSTEM_ERR
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCallForwardStatusResponse(RadioResponseInfo info,
             vec<CallForwardInfo> callForwardInfos);
@@ -642,6 +757,8 @@
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setCallForwardResponse(RadioResponseInfo info);
 
@@ -669,6 +786,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCallWaitingResponse(RadioResponseInfo info, bool enable, int32_t serviceClass);
 
@@ -690,6 +809,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setCallWaitingResponse(RadioResponseInfo info);
 
@@ -699,6 +820,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo info);
 
@@ -717,6 +843,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway acceptCallResponse(RadioResponseInfo info);
 
@@ -730,6 +858,10 @@
      *   RadioError:INVALID_STATE
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway deactivateDataCallResponse(RadioResponseInfo info);
 
@@ -752,6 +884,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getFacilityLockForAppResponse(RadioResponseInfo info, int32_t response);
 
@@ -774,6 +908,8 @@
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setFacilityLockForAppResponse(RadioResponseInfo info, int32_t retry);
 
@@ -793,6 +929,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setBarringPasswordResponse(RadioResponseInfo info);
 
@@ -809,6 +947,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getNetworkSelectionModeResponse(RadioResponseInfo info, bool manual);
 
@@ -826,6 +966,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      *
      * Returns RadioError:ILLEGAL_SIM_OR_ME when the failure is permanent and
      * no retries needed, such as illegal SIM or ME.
@@ -847,6 +989,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      *
      * Returns RadioError:ILLEGAL_SIM_OR_ME when the failure is permanent and
      * no retries needed, such as illegal SIM or ME.
@@ -869,6 +1013,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:CANCELLED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:INTERNAL_ERR
      */
     oneway getAvailableNetworksResponse(RadioResponseInfo info,
             vec<OperatorInfo> networkInfos);
@@ -888,6 +1034,7 @@
      *   RadioError:INVALID_CALL_ID
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      */
     oneway startDtmfResponse(RadioResponseInfo info);
@@ -907,6 +1054,7 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:INVALID_CALL_ID
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      */
     oneway stopDtmfResponse(RadioResponseInfo info);
@@ -925,6 +1073,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getBasebandVersionResponse(RadioResponseInfo info, string version);
 
@@ -945,6 +1095,7 @@
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:CANCELLED
      */
     oneway separateConnectionResponse(RadioResponseInfo info);
 
@@ -960,6 +1111,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setMuteResponse(RadioResponseInfo info);
 
@@ -979,6 +1132,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getMuteResponse(RadioResponseInfo info, bool enable);
 
@@ -996,6 +1151,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:FDN_CHECK_FAILURE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getClipResponse(RadioResponseInfo info, ClipStatus status);
 
@@ -1006,6 +1163,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getDataCallListResponse(RadioResponseInfo info, vec<SetupDataCallResult> dcResponse);
 
@@ -1022,6 +1184,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setSuppServiceNotificationsResponse(RadioResponseInfo info);
 
@@ -1031,6 +1195,7 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SIM_FULL
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:INVALID_SMS_FORMAT
@@ -1045,6 +1210,8 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway writeSmsToSimResponse(RadioResponseInfo info, int32_t index);
 
@@ -1053,6 +1220,8 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:SIM_FULL
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:NO_MEMORY
      *   RadioError:SYSTEM_ERR
@@ -1061,6 +1230,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      */
     oneway deleteSmsOnSimResponse(RadioResponseInfo info);
@@ -1078,6 +1249,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setBandModeResponse(RadioResponseInfo info);
 
@@ -1094,6 +1267,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getAvailableBandModesResponse(RadioResponseInfo info, vec<RadioBandMode> bandModes);
 
@@ -1107,6 +1282,13 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SIM_BUSY
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:MODEM_ERR
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway sendEnvelopeResponse(RadioResponseInfo info, string commandResponse);
 
@@ -1118,6 +1300,12 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway sendTerminalResponseToSimResponse(RadioResponseInfo info);
 
@@ -1126,11 +1314,15 @@
      *
      * Valid errors returned:
      *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:NO_MEMORY
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info);
 
@@ -1151,6 +1343,8 @@
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway explicitCallTransferResponse(RadioResponseInfo info);
 
@@ -1168,6 +1362,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setPreferredNetworkTypeResponse(RadioResponseInfo info);
 
@@ -1184,6 +1380,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getPreferredNetworkTypeResponse(RadioResponseInfo info,
             PreferredNetworkType nwType);
@@ -1202,6 +1400,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NO_NETWORK_FOUND
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getNeighboringCidsResponse(RadioResponseInfo info, vec<NeighboringCell> cells);
 
@@ -1217,6 +1417,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setLocationUpdatesResponse(RadioResponseInfo info);
 
@@ -1228,6 +1430,11 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SIM_ABSENT
      *   RadioError:SUBSCRIPTION_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway setCdmaSubscriptionSourceResponse(RadioResponseInfo info);
 
@@ -1244,6 +1451,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setCdmaRoamingPreferenceResponse(RadioResponseInfo info);
 
@@ -1260,6 +1469,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCdmaRoamingPreferenceResponse(RadioResponseInfo info, CdmaRoamingType type);
 
@@ -1275,6 +1486,8 @@
      *   RadioError:NO_MEMORY
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setTTYModeResponse(RadioResponseInfo info);
 
@@ -1291,6 +1504,8 @@
      *   RadioError:NO_MEMORY
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getTTYModeResponse(RadioResponseInfo info, TtyMode mode);
 
@@ -1307,6 +1522,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_CALL_ID
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setPreferredVoicePrivacyResponse(RadioResponseInfo info);
 
@@ -1324,6 +1541,8 @@
      *   RadioError:NO_MEMORY
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getPreferredVoicePrivacyResponse(RadioResponseInfo info, bool enable);
 
@@ -1344,6 +1563,8 @@
      *   RadioError:INVALID_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendCDMAFeatureCodeResponse(RadioResponseInfo info);
 
@@ -1361,6 +1582,9 @@
      *   RadioError:INVALID_CALL_ID
      *   RadioError:INVALID_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      *   RadioError:MODE_NOT_SUPPORTED
      */
     oneway sendBurstDtmfResponse(RadioResponseInfo info);
@@ -1391,6 +1615,8 @@
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:ENCODING_ERR
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendCdmaSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
@@ -1413,6 +1639,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo info);
 
@@ -1432,6 +1660,9 @@
      *   RadioError:NO_RESOURCES
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway getGsmBroadcastConfigResponse(RadioResponseInfo info,
             vec<GsmBroadcastSmsConfigInfo> configs);
@@ -1450,6 +1681,9 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway setGsmBroadcastConfigResponse(RadioResponseInfo info);
 
@@ -1468,6 +1702,9 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway setGsmBroadcastActivationResponse(RadioResponseInfo info);
 
@@ -1487,6 +1724,9 @@
      *   RadioError:NO_RESOURCES
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway getCdmaBroadcastConfigResponse(RadioResponseInfo info,
             vec<CdmaBroadcastSmsConfigInfo> configs);
@@ -1505,6 +1745,9 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway setCdmaBroadcastConfigResponse(RadioResponseInfo info);
 
@@ -1523,6 +1766,9 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway setCdmaBroadcastActivationResponse(RadioResponseInfo info);
 
@@ -1547,6 +1793,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCDMASubscriptionResponse(RadioResponseInfo info, string mdn, string hSid,
             string hNid, string min, string prl);
@@ -1572,6 +1820,9 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
      */
     oneway writeSmsToRuimResponse(RadioResponseInfo info, uint32_t index);
 
@@ -1588,6 +1839,9 @@
      *   RadioError:NO_SUCH_ENTRY
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
      */
     oneway deleteSmsOnRuimResponse(RadioResponseInfo info);
@@ -1608,6 +1862,9 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      *
      * If a empty string value is returned for any of the device id, it means that there was error
      * accessing the device.
@@ -1629,6 +1886,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:MODEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway exitEmergencyCallbackModeResponse(RadioResponseInfo info);
 
@@ -1649,6 +1908,8 @@
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getSmscAddressResponse(RadioResponseInfo info, string smsc);
 
@@ -1668,6 +1929,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setSmscAddressResponse(RadioResponseInfo info);
 
@@ -1685,6 +1948,8 @@
      *   RadioError:INVALID_STATE
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway reportSmsMemoryStatusResponse(RadioResponseInfo info);
 
@@ -1694,6 +1959,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway reportStkServiceIsRunningResponse(RadioResponseInfo info);
 
@@ -1705,6 +1975,11 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SUBSCRIPTION_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getCdmaSubscriptionSourceResponse(RadioResponseInfo info, CdmaSubscriptionSource source);
 
@@ -1715,6 +1990,13 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway requestIsimAuthenticationResponse(RadioResponseInfo info, string response);
 
@@ -1724,6 +2006,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo info);
 
@@ -1736,6 +2023,11 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SIM_BUSY
      *   RadioError:OPERATION_NOT_ALLOWED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway sendEnvelopeWithStatusResponse(RadioResponseInfo info, IccIoResult iccIo);
 
@@ -1746,6 +2038,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getVoiceRadioTechnologyResponse(RadioResponseInfo info, RadioTechnology rat);
 
@@ -1762,6 +2059,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:NO_NETWORK_FOUND
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getCellInfoListResponse(RadioResponseInfo info, vec<CellInfo> cellInfo);
 
@@ -1775,6 +2074,9 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway setCellInfoListRateResponse(RadioResponseInfo info);
 
@@ -1792,6 +2094,8 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:NOT_PROVISIONED
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setInitialAttachApnResponse(RadioResponseInfo info);
 
@@ -1804,12 +2108,12 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
-     *   RadioError:NO_MEMORY
      *   RadioError:INTERNAL_ERR
-     *   RadioError:SYSTEM_ERR
-     *   RadioError:REQUEST_NOT_SUPPORTED
-     *   RadioError:MODEM_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getImsRegistrationStateResponse(RadioResponseInfo info, bool isRegistered,
             RadioTechnologyFamily ratFamily);
@@ -1837,6 +2141,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:NETWORK_NOT_READY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendImsSmsResponse(RadioResponseInfo info, SendSmsResult sms);
 
@@ -1847,6 +2153,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway iccTransmitApduBasicChannelResponse(RadioResponseInfo info, IccIoResult result);
 
@@ -1861,6 +2172,14 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:MISSING_RESOURCE
      *   RadioError:NO_SUCH_ELEMENT
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:SIM_ERR
+     *   RadioError:INVALID_SIM_STATE
+     *   RadioError:MISSING_RESOURCE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway iccOpenLogicalChannelResponse(RadioResponseInfo info, int32_t channelId,
             vec<int8_t> selectResponse);
@@ -1871,6 +2190,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway iccCloseLogicalChannelResponse(RadioResponseInfo info);
 
@@ -1881,6 +2205,11 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway iccTransmitApduLogicalChannelResponse(RadioResponseInfo info, IccIoResult result);
 
@@ -1891,6 +2220,7 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway nvReadItemResponse(RadioResponseInfo info, string result);
 
@@ -1900,6 +2230,7 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway nvWriteItemResponse(RadioResponseInfo info);
 
@@ -1909,6 +2240,7 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway nvWriteCdmaPrlResponse(RadioResponseInfo info);
 
@@ -1918,6 +2250,7 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway nvResetConfigResponse(RadioResponseInfo info);
 
@@ -1934,6 +2267,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setUiccSubscriptionResponse(RadioResponseInfo info);
 
@@ -1950,6 +2285,9 @@
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:DEVICE_IN_USE
      *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway setDataAllowedResponse(RadioResponseInfo info);
 
@@ -1960,6 +2298,7 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getHardwareConfigResponse(RadioResponseInfo info, vec<HardwareConfig> config);
 
@@ -1970,6 +2309,14 @@
      * Valid errors returned:
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:INVALID_MODEM_STATE
+     *   RadioError:SIM_ERR
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway requestIccSimAuthenticationResponse(RadioResponseInfo info, IccIoResult result);
 
@@ -1980,6 +2327,11 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:SUBSCRIPTION_NOT_AVAILABLE
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway setDataProfileResponse(RadioResponseInfo info);
 
@@ -1994,6 +2346,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway requestShutdownResponse(RadioResponseInfo info);
 
@@ -2007,6 +2361,10 @@
      *   RadioError:OPERATION_NOT_ALLOWED
      *   RadioError:INVALID_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway getRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
 
@@ -2026,6 +2384,8 @@
      *   RadioError:MODEM_ERR
      *   RadioError:INVALID_STATE
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
 
@@ -2039,6 +2399,9 @@
      *   RadioError:LCE_NOT_SUPPORTED
      *   RadioError:INTERNAL_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway startLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
 
@@ -2050,6 +2413,11 @@
      *   RadioError:NONE
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:LCE_NOT_SUPPORTED
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
 
@@ -2062,6 +2430,10 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:LCE_NOT_SUPPORTED
      *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo);
 
@@ -2077,6 +2449,9 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:MODEM_ERR
      *   RadioError:NOT_PROVISIONED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
+     *   RadioError:REQUEST_NOT_SUPPORTED
      */
     oneway getModemActivityInfoResponse(RadioResponseInfo info, ActivityStatsInfo activityInfo);
 
@@ -2122,6 +2497,8 @@
      *   RadioError:SYSTEM_ERR
      *   RadioError:INVALID_ARGUMENTS
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway sendDeviceStateResponse(RadioResponseInfo info);
 
@@ -2136,6 +2513,8 @@
      *   RadioError:INTERNAL_ERR
      *   RadioError:SYSTEM_ERR
      *   RadioError:REQUEST_NOT_SUPPORTED
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setIndicationFilterResponse(RadioResponseInfo info);
 
@@ -2147,6 +2526,10 @@
      *   RadioError:RADIO_NOT_AVAILABLE
      *   RadioError:REQUEST_NOT_SUPPORTED
      *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:NO_MEMORY
+     *   RadioError:NO_RESOURCES
+     *   RadioError:CANCELLED
      */
     oneway setSimCardPowerResponse(RadioResponseInfo info);
 
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp
index 2908737..a5747d4 100644
--- a/sensors/1.0/default/convert.cpp
+++ b/sensors/1.0/default/convert.cpp
@@ -67,9 +67,11 @@
     typedef ::android::hardware::sensors::V1_0::SensorType SensorType;
     typedef ::android::hardware::sensors::V1_0::MetaDataEventType MetaDataEventType;
 
-    dst->sensorHandle = src.sensor;
-    dst->sensorType = (SensorType)src.type;
-    dst->timestamp = src.timestamp;
+    *dst = {
+        .sensorHandle = src.sensor,
+        .sensorType = (SensorType)src.type,
+        .timestamp = src.timestamp
+    };
 
     switch (dst->sensorType) {
         case SensorType::META_DATA:
@@ -206,13 +208,13 @@
 }
 
 void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
-  dst->version = sizeof(sensors_event_t);
-  dst->sensor = src.sensorHandle;
-  dst->type = (int32_t)src.sensorType;
-  dst->reserved0 = 0;
-  dst->timestamp = src.timestamp;
-  dst->flags = 0;
-  dst->reserved1[0] = dst->reserved1[1] = dst->reserved1[2] = 0;
+  *dst = {
+      .version = sizeof(sensors_event_t),
+      .sensor = src.sensorHandle,
+      .type = (int32_t)src.sensorType,
+      .reserved0 = 0,
+      .timestamp = src.timestamp
+  };
 
   switch (src.sensorType) {
       case SensorType::META_DATA:
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index c92603b..4842946 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -697,6 +697,7 @@
 SensorFlagBits SensorsHidlTest::expectedReportModeForType(SensorType type) {
   switch (type) {
     case SensorType::ACCELEROMETER:
+    case SensorType::ACCELEROMETER_UNCALIBRATED:
     case SensorType::GYROSCOPE:
     case SensorType::MAGNETIC_FIELD:
     case SensorType::ORIENTATION:
@@ -719,7 +720,6 @@
     case SensorType::AMBIENT_TEMPERATURE:
     case SensorType::HEART_RATE:
     case SensorType::DEVICE_ORIENTATION:
-    case SensorType::MOTION_DETECT:
     case SensorType::STEP_COUNTER:
     case SensorType::LOW_LATENCY_OFFBODY_DETECT:
       return SensorFlagBits::ON_CHANGE_MODE;
@@ -728,6 +728,8 @@
     case SensorType::WAKE_GESTURE:
     case SensorType::GLANCE_GESTURE:
     case SensorType::PICK_UP_GESTURE:
+    case SensorType::MOTION_DETECT:
+    case SensorType::STATIONARY_DETECT:
       return SensorFlagBits::ONE_SHOT_MODE;
 
     case SensorType::STEP_DETECTOR:
diff --git a/wifi/offload/1.0/IOffload.hal b/wifi/offload/1.0/IOffload.hal
index 7ad902c..4819519 100644
--- a/wifi/offload/1.0/IOffload.hal
+++ b/wifi/offload/1.0/IOffload.hal
@@ -25,21 +25,28 @@
      *
      * @param ScanParam paramters for scanning
      * @param ScanFilter settings to filter scan result
-     * @return boolean status indicating success (true) when configuration
-     *            is applied or failure (false) for invalid configuration
+     * @return OffloadStatus indicating status of operation provided by this API
+     * If OffloadStatusCode::OK is returned, the operation was successful
+     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
+     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
      */
     @entry
     @callflow(next={"setEventCallback", "subscribeScanResults"})
-    configureScans(ScanParam param, ScanFilter filter);
+    configureScans(ScanParam param, ScanFilter filter) generates (OffloadStatus status);
 
     /**
      * Get scan statistics
      *
+     * @return OffloadStatus indicating status of operation provided by this API
      * @return ScanStats statistics of scans performed
+     * If OffloadStatusCode::OK is returned, the operation was successful
+     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
+     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
+     * If OffloadStatusCode::TIMEOUT is returned, time out waiting for the requested data
      */
     @exit
     @callflow(next={"subscribeScanResults", "unsubscribeScanResults", "getScanStats"})
-    getScanStats() generates (ScanStats scanStats);
+    getScanStats() generates (OffloadStatus status, ScanStats scanStats);
 
     /**
      * Subscribe to asynchronous scan events sent by offload module. This enables
@@ -50,9 +57,13 @@
      *
      * @param delayMs an integer expressing the minimum delay in mS after
      *        subscribing when scan results must be delivered to the client
+     * @return OffloadStatus indicating status of operation provided by this API
+     * If OffloadStatusCode::OK is returned, the operation was successful
+     * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost
+     * If OffloadStatusCode::ERROR is returned, requested operation could not be completed
      */
     @callflow(next={"unsubscribeScanResults", "getScanStats"})
-    subscribeScanResults(uint32_t delayMs);
+    subscribeScanResults(uint32_t delayMs) generates (OffloadStatus status);
 
     /**
      * Unsubscribe to scan events sent by the offload module, hence disabling scans.
diff --git a/wifi/offload/1.0/types.hal b/wifi/offload/1.0/types.hal
index 38d5eda..234f3fc 100644
--- a/wifi/offload/1.0/types.hal
+++ b/wifi/offload/1.0/types.hal
@@ -202,18 +202,25 @@
 /**
  * Defines a list of return codes to indicate status of Offload HAL
  */
-enum OffloadStatus : uint32_t {
+enum OffloadStatusCode : uint32_t {
     /* No error */
-    OFFLOAD_STATUS_OK,
+    OK,
     /* No Connection to underlying implementation */
-    OFFLOAD_STATUS_NO_CONNECTION,
+    NO_CONNECTION,
     /* Operation timeout */
-    OFFLOAD_STATUS_TIMEOUT,
+    TIMEOUT,
     /* Other errors */
-    OFFLOAD_STATUS_ERROR
+    ERROR
 };
 
-
+/**
+ * Generic structures to return the status of an operation
+ */
+struct OffloadStatus {
+  OffloadStatusCode code;
+  /* Error message */
+  string description;
+};
 
 
 
diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
index 3020542..55f5a87 100644
--- a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
+++ b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
@@ -26,6 +26,8 @@
 
 #include <vector>
 
+#include "hidl_call_util.h"
+
 using ::android::hardware::wifi::offload::V1_0::IOffload;
 using ::android::hardware::wifi::offload::V1_0::IOffloadCallback;
 using ::android::hardware::wifi::offload::V1_0::ScanResult;
@@ -33,6 +35,7 @@
 using ::android::hardware::wifi::offload::V1_0::ScanFilter;
 using ::android::hardware::wifi::offload::V1_0::ScanStats;
 using ::android::hardware::wifi::offload::V1_0::OffloadStatus;
+using ::android::hardware::wifi::offload::V1_0::OffloadStatusCode;
 using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::hardware::hidl_vec;
@@ -89,7 +92,7 @@
             return Void();
         };
 
-        Return<void> onError(OffloadStatus status) {
+        Return<void> onError(const OffloadStatus& status) override {
             OffloadCallbackArgs args;
             args.error_code_ = status;
             NotifyFromCallback(kOffloadCallbackSendError, args);
@@ -106,15 +109,15 @@
  */
 TEST_F(WifiOffloadHidlTest, setEventCallback) {
     auto returnObject = wifi_offload_->setEventCallback(wifi_offload_cb_);
-    ASSERT_EQ(returnObject.isOk(), true);
+    ASSERT_EQ(true, returnObject.isOk());
 }
 
 /*
  * Verify that subscribeScanResults method returns without errors
  */
 TEST_F(WifiOffloadHidlTest, subscribeScanResults) {
-    auto returnObject = wifi_offload_->subscribeScanResults(0);
-    ASSERT_EQ(returnObject.isOk(), true);
+    const auto& result = HIDL_INVOKE(wifi_offload_, subscribeScanResults, 0);
+    ASSERT_EQ(OffloadStatusCode::OK, result.code);
 }
 
 /*
@@ -122,7 +125,7 @@
  */
 TEST_F(WifiOffloadHidlTest, unsubscribeScanResults) {
     auto returnObject = wifi_offload_->unsubscribeScanResults();
-    ASSERT_EQ(returnObject.isOk(), true);
+    ASSERT_EQ(true, returnObject.isOk());
 }
 
 /*
@@ -131,21 +134,18 @@
 TEST_F(WifiOffloadHidlTest, configureScans) {
     ScanParam* pScanParam = new ScanParam();
     ScanFilter* pScanFilter = new ScanFilter();
-    auto returnObject =
-        wifi_offload_->configureScans(*pScanParam, *pScanFilter);
-    ASSERT_EQ(returnObject.isOk(), true);
+    const auto& result =
+        HIDL_INVOKE(wifi_offload_, configureScans, *pScanParam, *pScanFilter);
+    ASSERT_EQ(OffloadStatusCode::OK, result.code);
 }
 
 /*
  * Verify that getScanStats returns without any errors
  */
 TEST_F(WifiOffloadHidlTest, getScanStats) {
-    ScanStats* pScanStats = new ScanStats();
-    const auto& returnObject =
-        wifi_offload_->getScanStats([pScanStats](ScanStats scanStats) -> void {
-            *pScanStats = std::move(scanStats);
-        });
-    ASSERT_EQ(returnObject.isOk(), true);
+    const auto& result = HIDL_INVOKE(wifi_offload_, getScanStats);
+    OffloadStatus status = result.first;
+    ASSERT_EQ(OffloadStatusCode::OK, status.code);
 }
 
 /*
@@ -167,7 +167,7 @@
     wifi_offload_cb_->onScanResult(scan_results);
     auto res =
         wifi_offload_cb_->WaitForCallback(kOffloadCallbackSendScanResult);
-    ASSERT_EQ(res.no_timeout, true);
+    ASSERT_EQ(true, res.no_timeout);
 }
 
 /*
@@ -175,9 +175,10 @@
  */
 TEST_F(WifiOffloadHidlTest, getError) {
     wifi_offload_->setEventCallback(wifi_offload_cb_);
-    wifi_offload_cb_->onError(OffloadStatus::OFFLOAD_STATUS_ERROR);
+    OffloadStatus status = {OffloadStatusCode::ERROR, ""};
+    wifi_offload_cb_->onError(status);
     auto res = wifi_offload_cb_->WaitForCallback(kOffloadCallbackSendError);
-    ASSERT_EQ(res.no_timeout, true);
+    ASSERT_EQ(true, res.no_timeout);
 }
 
 // A class for test environment setup
diff --git a/wifi/offload/1.0/vts/functional/hidl_call_util.h b/wifi/offload/1.0/vts/functional/hidl_call_util.h
new file mode 100644
index 0000000..f3ca517
--- /dev/null
+++ b/wifi/offload/1.0/vts/functional/hidl_call_util.h
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <functional>
+#include <tuple>
+#include <type_traits>
+#include <utility>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+namespace {
+namespace detail {
+template <typename>
+struct functionArgSaver;
+
+// Provides a std::function that takes one argument, and a buffer
+// wherein the function will store its argument. The buffer has
+// the same type as the argument, but with const and reference
+// modifiers removed.
+template <typename ArgT>
+struct functionArgSaver<std::function<void(ArgT)>> final {
+    using StorageT = typename std::remove_const<
+        typename std::remove_reference<ArgT>::type>::type;
+
+    std::function<void(ArgT)> saveArgs = [this](ArgT arg) {
+        this->saved_values = arg;
+    };
+
+    StorageT saved_values;
+};
+
+// Provides a std::function that takes two arguments, and a buffer
+// wherein the function will store its arguments. The buffer is a
+// std::pair, whose elements have the same types as the arguments
+// (but with const and reference modifiers removed).
+template <typename Arg1T, typename Arg2T>
+struct functionArgSaver<std::function<void(Arg1T, Arg2T)>> final {
+    using StorageT =
+        std::pair<typename std::remove_const<
+                      typename std::remove_reference<Arg1T>::type>::type,
+                  typename std::remove_const<
+                      typename std::remove_reference<Arg2T>::type>::type>;
+
+    std::function<void(Arg1T, Arg2T)> saveArgs = [this](Arg1T arg1,
+                                                        Arg2T arg2) {
+        this->saved_values = {arg1, arg2};
+    };
+
+    StorageT saved_values;
+};
+
+// Provides a std::function that takes three or more arguments, and a
+// buffer wherein the function will store its arguments. The buffer is a
+// std::tuple whose elements have the same types as the arguments (but
+// with const and reference modifiers removed).
+template <typename... ArgT>
+struct functionArgSaver<std::function<void(ArgT...)>> final {
+    using StorageT = std::tuple<typename std::remove_const<
+        typename std::remove_reference<ArgT>::type>::type...>;
+
+    std::function<void(ArgT...)> saveArgs = [this](ArgT... arg) {
+        this->saved_values = {arg...};
+    };
+
+    StorageT saved_values;
+};
+
+// Invokes |method| on |object|, providing |method| a CallbackT as the
+// final argument. Returns a copy of the parameters that |method| provided
+// to CallbackT. (The parameters are returned by value.)
+template <typename CallbackT, typename MethodT, typename ObjectT,
+          typename... ArgT>
+typename functionArgSaver<CallbackT>::StorageT invokeMethod(
+    MethodT method, ObjectT object, ArgT&&... methodArg) {
+    functionArgSaver<CallbackT> result_buffer;
+    const auto& res = ((*object).*method)(std::forward<ArgT>(methodArg)...,
+                                          result_buffer.saveArgs);
+    EXPECT_TRUE(res.isOk());
+    return result_buffer.saved_values;
+}
+}  // namespace detail
+}  // namespace
+
+// Invokes |method| on |strong_pointer|, passing provided arguments through to
+// |method|.
+//
+// Returns either:
+// - A copy of the result callback parameter (for callbacks with a single
+//   parameter), OR
+// - A pair containing a copy of the result callback parameters (for callbacks
+//   with two parameters), OR
+// - A tuple containing a copy of the result callback paramters (for callbacks
+//   with three or more parameters).
+//
+// Example usage:
+//   EXPECT_EQ(WifiStatusCode::SUCCESS,
+//       HIDL_INVOKE(strong_pointer, methodReturningWifiStatus).code);
+//   EXPECT_EQ(WifiStatusCode::SUCCESS,
+//       HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndOneMore)
+//         .first.code);
+//   EXPECT_EQ(WifiStatusCode::SUCCESS, std::get<0>(
+//       HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndTwoMore))
+//         .code);
+#define HIDL_INVOKE(strong_pointer, method, ...)                              \
+    (detail::invokeMethod<                                                    \
+        std::remove_reference<decltype(*strong_pointer)>::type::method##_cb>( \
+        &std::remove_reference<decltype(*strong_pointer)>::type::method,      \
+        strong_pointer, ##__VA_ARGS__))