Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1708d25 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "c2f2_sensors_vts-qt-dev" into qt-dev

* changes:
  Fix handling of reportToken when stopping
  Change expected return type in direct report VTS
  Add support for new gralloc HAL versions
  Avoid NPD when re-initializing HAL fails
  Fix NPD in GrallocWrapper
  Fix log tag for sensors VTS tests
parents 41605f08 2321aa95
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


cc_test {
cc_test {
    name: "VtsHalSensorsV1_0TargetTest",
    name: "VtsHalSensorsV1_0TargetTest",
    cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""],
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
    srcs: [
        "SensorsHidlEnvironmentV1_0.cpp",
        "SensorsHidlEnvironmentV1_0.cpp",
@@ -23,7 +24,10 @@ cc_test {
    ],
    ],
    static_libs: [
    static_libs: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@3.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.graphics.mapper@3.0",
        "android.hardware.sensors@1.0",
        "android.hardware.sensors@1.0",
        "VtsHalSensorsTargetTestUtils",
        "VtsHalSensorsTargetTestUtils",
    ],
    ],
+0 −2
Original line number Original line Diff line number Diff line
@@ -14,8 +14,6 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


#define LOG_TAG "sensors_hidl_hal_test"

#include "SensorsHidlEnvironmentV1_0.h"
#include "SensorsHidlEnvironmentV1_0.h"
#include "sensors-vts-utils/SensorsHidlTestBase.h"
#include "sensors-vts-utils/SensorsHidlTestBase.h"


+4 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


cc_test {
cc_test {
    name: "VtsHalSensorsV2_0TargetTest",
    name: "VtsHalSensorsV2_0TargetTest",
    cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""],
    defaults: ["VtsHalTargetTestDefaults"],
    defaults: ["VtsHalTargetTestDefaults"],
    srcs: [
    srcs: [
        "SensorsHidlEnvironmentV2_0.cpp",
        "SensorsHidlEnvironmentV2_0.cpp",
@@ -23,7 +24,10 @@ cc_test {
    ],
    ],
    static_libs: [
    static_libs: [
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@2.0",
        "android.hardware.graphics.allocator@3.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.0",
        "android.hardware.graphics.mapper@2.1",
        "android.hardware.graphics.mapper@3.0",
        "android.hardware.sensors@1.0",
        "android.hardware.sensors@1.0",
        "android.hardware.sensors@2.0",
        "android.hardware.sensors@2.0",
        "libfmq",
        "libfmq",
+8 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,13 @@ constexpr typename std::underlying_type<EnumType>::type asBaseType(EnumType valu


constexpr size_t SensorsHidlEnvironmentV2_0::MAX_RECEIVE_BUFFER_EVENT_COUNT;
constexpr size_t SensorsHidlEnvironmentV2_0::MAX_RECEIVE_BUFFER_EVENT_COUNT;


void SensorsHalDeathRecipient::serviceDied(
        uint64_t /* cookie */,
        const ::android::wp<::android::hidl::base::V1_0::IBase>& /* service */) {
    ALOGE("Sensors HAL died (likely crashed) during test");
    FAIL() << "Sensors HAL died during test";
}

struct SensorsCallback : ISensorsCallback {
struct SensorsCallback : ISensorsCallback {
    Return<void> onDynamicSensorsConnected(const hidl_vec<SensorInfo>& /* sensorInfos */) {
    Return<void> onDynamicSensorsConnected(const hidl_vec<SensorInfo>& /* sensorInfos */) {
        return Return<void>();
        return Return<void>();
@@ -56,6 +63,7 @@ bool SensorsHidlEnvironmentV2_0::resetHal() {
        if (mSensors == nullptr) {
        if (mSensors == nullptr) {
            break;
            break;
        }
        }
        mSensors->linkToDeath(mDeathRecipient, 0 /* cookie */);


        // Initialize FMQs
        // Initialize FMQs
        mEventQueue = std::make_unique<EventMessageQueue>(MAX_RECEIVE_BUFFER_EVENT_COUNT,
        mEventQueue = std::make_unique<EventMessageQueue>(MAX_RECEIVE_BUFFER_EVENT_COUNT,
+12 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,13 @@ using ::android::sp;
using ::android::hardware::MessageQueue;
using ::android::hardware::MessageQueue;


class SensorsHidlTest;
class SensorsHidlTest;

class SensorsHalDeathRecipient : public ::android::hardware::hidl_death_recipient {
    virtual void serviceDied(
            uint64_t cookie,
            const ::android::wp<::android::hidl::base::V1_0::IBase>& service) override;
};

class SensorsHidlEnvironmentV2_0 : public SensorsHidlEnvironmentBase {
class SensorsHidlEnvironmentV2_0 : public SensorsHidlEnvironmentBase {
   public:
   public:
    using Event = ::android::hardware::sensors::V1_0::Event;
    using Event = ::android::hardware::sensors::V1_0::Event;
@@ -83,6 +90,11 @@ class SensorsHidlEnvironmentV2_0 : public SensorsHidlEnvironmentBase {
     */
     */
    sp<android::hardware::sensors::V2_0::ISensors> mSensors;
    sp<android::hardware::sensors::V2_0::ISensors> mSensors;


    /**
     * Monitors the HAL for crashes, triggering test failure if seen
     */
    sp<SensorsHalDeathRecipient> mDeathRecipient = new SensorsHalDeathRecipient();

    /**
    /**
     * Type used to simplify the creation of the Event FMQ
     * Type used to simplify the creation of the Event FMQ
     */
     */
Loading