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

Commit b304ae52 authored by Hao Chen's avatar Hao Chen Committed by Android (Google) Code Review
Browse files

Merge changes from topic "evs-v2" into udc-dev

* changes:
  Add VTS testcases for getDisplayStateById
  Uprev the EVS AIDL NDK Version
parents 17894fc6 be819392
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ cc_defaults {
    name: "EvsHalDefaults",
    defaults: ["android.hardware.graphics.common-ndk_static"],
    static_libs: [
        "android.hardware.automotive.evs-V1-ndk",
        "android.hardware.automotive.evs-V2-ndk",
        "android.hardware.common-V2-ndk",
    ],
    shared_libs: [
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ cc_binary {
    ],
    srcs: [
        ":libgui_frame_event_aidl",
        "src/*.cpp"
        "src/*.cpp",
    ],
    shared_libs: [
        "android.hardware.graphics.bufferqueue@1.0",
@@ -61,7 +61,7 @@ cc_binary {
    ],
    static_libs: [
        "android.frameworks.automotive.display-V1-ndk",
        "android.hardware.automotive.evs-V1-ndk",
        "android.hardware.automotive.evs-V2-ndk",
        "android.hardware.common-V2-ndk",
        "libaidlcommonsupport",
        "libcutils",
+3 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::B
    ndk::ScopedAStatus closeDisplay(const std::shared_ptr<evs::IEvsDisplay>& obj) override;
    ndk::ScopedAStatus getDisplayIdList(std::vector<uint8_t>* list) override;
    ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override;
    ndk::ScopedAStatus getDisplayStateById(int32_t displayId, evs::DisplayState* state) override;
    ndk::ScopedAStatus registerStatusCallback(
            const std::shared_ptr<evs::IEvsEnumeratorStatusCallback>& callback) override;
    ndk::ScopedAStatus openUltrasonicsArray(
@@ -101,6 +102,8 @@ class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::B
    bool checkPermission();
    void closeCamera_impl(const std::shared_ptr<evs::IEvsCamera>& pCamera,
                          const std::string& cameraId);
    ndk::ScopedAStatus getDisplayStateImpl(std::optional<int32_t> displayId,
                                           evs::DisplayState* state);

    static bool qualifyCaptureDevice(const char* deviceName);
    static CameraRecord* findCameraById(const std::string& cameraId);
+14 −6
Original line number Diff line number Diff line
@@ -357,24 +357,32 @@ ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr<IEvsDisplay>& ob

ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) {
    LOG(DEBUG) << __FUNCTION__;
    return getDisplayStateImpl(std::nullopt, state);
}

ScopedAStatus EvsEnumerator::getDisplayStateById(int32_t displayId, DisplayState* state) {
    LOG(DEBUG) << __FUNCTION__;
    return getDisplayStateImpl(displayId, state);
}

ScopedAStatus EvsEnumerator::getDisplayStateImpl(std::optional<int32_t> displayId,
                                                 DisplayState* state) {
    if (!checkPermission()) {
        *state = DisplayState::DEAD;
        return ScopedAStatus::fromServiceSpecificError(
                static_cast<int>(EvsResult::PERMISSION_DENIED));
    }

    // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update
    // the API later.

    const auto& all_displays = mutableActiveDisplays().getAllDisplays();

    // Do we still have a display object we think should be active?
    if (all_displays.empty()) {
    const auto display_search = displayId ? all_displays.find(*displayId) : all_displays.begin();

    if (display_search == all_displays.end()) {
        *state = DisplayState::NOT_OPEN;
        return ScopedAStatus::fromServiceSpecificError(static_cast<int>(EvsResult::OWNERSHIP_LOST));
    }

    std::shared_ptr<IEvsDisplay> pActiveDisplay = all_displays.begin()->second.displayWeak.lock();
    std::shared_ptr<IEvsDisplay> pActiveDisplay = display_search->second.displayWeak.lock();
    if (pActiveDisplay) {
        return pActiveDisplay->getDisplayState(state);
    } else {
+4 −5
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@ package{
}

cc_test {
name:
    "VtsHalEvsTargetTest",
    name: "VtsHalEvsTargetTest",
    srcs: [
        "*.cpp",
    ],
@@ -42,7 +41,7 @@ name:
    ],
    static_libs: [
        "android.hardware.automotive.evs@common-default-lib",
        "android.hardware.automotive.evs-V1-ndk",
        "android.hardware.automotive.evs-V2-ndk",
        "android.hardware.common-V2-ndk",
        "libaidlcommonsupport",
    ],
Loading