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

Commit 89a091ad authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Update Memtrack HAL VTS Requirements" am: 251efb3f am: d48676ea am: 0d3cada2

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1556748

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I616f7f06915b2542b0f1043b70122b605e0ebd6d
parents 0f8e9d1b 0d3cada2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ ndk::ScopedAStatus Memtrack::getMemory(int pid, MemtrackType type,

ndk::ScopedAStatus Memtrack::getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) {
    _aidl_return->clear();
    DeviceInfo dev_info = {.id = 0, .name = "virtio_gpu"};
    _aidl_return->emplace_back(dev_info);
    return ndk::ScopedAStatus::ok();
}

+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ cc_test {
    srcs: ["VtsHalMemtrackTargetTest.cpp"],
    shared_libs: [
        "libbinder_ndk",
        "libvintf",
    ],
    static_libs: [
        "android.hardware.memtrack-unstable-ndk_platform",
+20 −0
Original line number Diff line number Diff line
@@ -21,11 +21,15 @@
#include <aidl/android/hardware/memtrack/MemtrackType.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <vintf/VintfObject.h>

using aidl::android::hardware::memtrack::DeviceInfo;
using aidl::android::hardware::memtrack::IMemtrack;
using aidl::android::hardware::memtrack::MemtrackRecord;
using aidl::android::hardware::memtrack::MemtrackType;
using android::vintf::KernelVersion;
using android::vintf::RuntimeInfo;
using android::vintf::VintfObject;

class MemtrackAidlTest : public testing::TestWithParam<std::string> {
  public:
@@ -75,7 +79,23 @@ TEST_P(MemtrackAidlTest, GetGpuDeviceInfo) {

    auto status = memtrack_->getGpuDeviceInfo(&device_info);

    // Devices with < 5.10 kernels aren't required to provide an implementation of
    // getGpuDeviceInfo(), and can return EX_UNSUPPORTED_OPERATION
    if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
        KernelVersion min_kernel_version = KernelVersion(5, 10, 0);
        KernelVersion kernel_version = VintfObject::GetInstance()
                                               ->getRuntimeInfo(RuntimeInfo::FetchFlag::CPU_VERSION)
                                               ->kernelVersion();
        EXPECT_LT(kernel_version, min_kernel_version)
                << "Devices with 5.10 or later kernels must implement getGpuDeviceInfo()";
        return;
    }

    EXPECT_TRUE(status.isOk());
    EXPECT_FALSE(device_info.empty());
    for (auto device : device_info) {
        EXPECT_FALSE(device.name.empty());
    }
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemtrackAidlTest);