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

Commit 104f53ac authored by Matt Buckley's avatar Matt Buckley
Browse files

Update mock classes to reflect powerhal changes

Bug: 315894228
Test: atest libpowermanager_test libsurfaceflinger_unittest libcompositionengine_test
Change-Id: Ib95a53bb4ab42d9756a87b1220130f80a8fa84e7
parent 53e97c92
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -29,9 +29,12 @@
#include <thread>
#include <thread>


using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::ChannelConfig;
using aidl::android::hardware::power::IPower;
using aidl::android::hardware::power::IPower;
using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::Mode;
using aidl::android::hardware::power::Mode;
using aidl::android::hardware::power::SessionConfig;
using aidl::android::hardware::power::SessionTag;
using android::binder::Status;
using android::binder::Status;


using namespace android;
using namespace android;
@@ -53,6 +56,14 @@ public:
                (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds,
                (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds,
                 int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session),
                 int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session),
                (override));
                (override));
    MOCK_METHOD(ndk::ScopedAStatus, createHintSessionWithConfig,
                (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds,
                 int64_t durationNanos, SessionTag tag, SessionConfig* config,
                 std::shared_ptr<IPowerHintSession>* _aidl_return),
                (override));
    MOCK_METHOD(ndk::ScopedAStatus, getSessionChannel,
                (int32_t tgid, int32_t uid, ChannelConfig* _aidl_return), (override));
    MOCK_METHOD(ndk::ScopedAStatus, closeSessionChannel, (int32_t tgid, int32_t uid), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override));
+0 −4
Original line number Original line Diff line number Diff line
@@ -31,10 +31,6 @@
#include <utils/Mutex.h>
#include <utils/Mutex.h>
#include <utils/Trace.h>
#include <utils/Trace.h>


#include <aidl/android/hardware/power/IPower.h>
#include <aidl/android/hardware/power/IPowerHintSession.h>
#include <aidl/android/hardware/power/WorkDuration.h>

#include <binder/IServiceManager.h>
#include <binder/IServiceManager.h>


#include "../SurfaceFlingerProperties.h"
#include "../SurfaceFlingerProperties.h"
+6 −1
Original line number Original line Diff line number Diff line
@@ -25,9 +25,14 @@
#include <ui/FenceTime.h>
#include <ui/FenceTime.h>
#include <utils/Mutex.h>
#include <utils/Mutex.h>


// FMQ library in IPower does questionable conversions
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
#include <aidl/android/hardware/power/IPower.h>
#include <aidl/android/hardware/power/IPower.h>
#include <compositionengine/impl/OutputCompositionState.h>
#include <powermanager/PowerHalController.h>
#include <powermanager/PowerHalController.h>
#pragma clang diagnostic pop

#include <compositionengine/impl/OutputCompositionState.h>
#include <scheduler/Time.h>
#include <scheduler/Time.h>
#include <ui/DisplayIdentification.h>
#include <ui/DisplayIdentification.h>
#include "../Scheduler/OneShotTimer.h"
#include "../Scheduler/OneShotTimer.h"
+17 −0
Original line number Original line Diff line number Diff line
@@ -18,12 +18,21 @@


#include "binder/Status.h"
#include "binder/Status.h"


// FMQ library in IPower does questionable conversions
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
#include <aidl/android/hardware/power/IPower.h>
#include <aidl/android/hardware/power/IPower.h>
#pragma clang diagnostic pop

#include <gmock/gmock.h>
#include <gmock/gmock.h>


using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::ChannelConfig;
using aidl::android::hardware::power::IPower;
using aidl::android::hardware::power::IPower;
using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::SessionConfig;
using aidl::android::hardware::power::SessionTag;

using aidl::android::hardware::power::Mode;
using aidl::android::hardware::power::Mode;
using android::binder::Status;
using android::binder::Status;


@@ -42,6 +51,14 @@ public:
                 int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session),
                 int64_t durationNanos, std::shared_ptr<IPowerHintSession>* session),
                (override));
                (override));
    MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getHintSessionPreferredRate, (int64_t * rate), (override));
    MOCK_METHOD(ndk::ScopedAStatus, createHintSessionWithConfig,
                (int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds,
                 int64_t durationNanos, SessionTag tag, SessionConfig* config,
                 std::shared_ptr<IPowerHintSession>* _aidl_return),
                (override));
    MOCK_METHOD(ndk::ScopedAStatus, getSessionChannel,
                (int32_t tgid, int32_t uid, ChannelConfig* _aidl_return), (override));
    MOCK_METHOD(ndk::ScopedAStatus, closeSessionChannel, (int32_t tgid, int32_t uid), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceVersion, (int32_t * version), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getInterfaceHash, (std::string * hash), (override));
    MOCK_METHOD(ndk::SpAIBinder, asBinder, (), (override));
    MOCK_METHOD(ndk::SpAIBinder, asBinder, (), (override));
+6 −0
Original line number Original line Diff line number Diff line
@@ -18,10 +18,15 @@


#include "binder/Status.h"
#include "binder/Status.h"


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"
#include <aidl/android/hardware/power/IPower.h>
#include <aidl/android/hardware/power/IPower.h>
#pragma clang diagnostic pop

#include <gmock/gmock.h>
#include <gmock/gmock.h>


using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::IPowerHintSession;
using aidl::android::hardware::power::SessionConfig;
using aidl::android::hardware::power::SessionHint;
using aidl::android::hardware::power::SessionHint;
using aidl::android::hardware::power::SessionMode;
using aidl::android::hardware::power::SessionMode;
using android::binder::Status;
using android::binder::Status;
@@ -47,6 +52,7 @@ public:
    MOCK_METHOD(ndk::ScopedAStatus, sendHint, (SessionHint), (override));
    MOCK_METHOD(ndk::ScopedAStatus, sendHint, (SessionHint), (override));
    MOCK_METHOD(ndk::ScopedAStatus, setThreads, (const ::std::vector<int32_t>&), (override));
    MOCK_METHOD(ndk::ScopedAStatus, setThreads, (const ::std::vector<int32_t>&), (override));
    MOCK_METHOD(ndk::ScopedAStatus, setMode, (SessionMode, bool), (override));
    MOCK_METHOD(ndk::ScopedAStatus, setMode, (SessionMode, bool), (override));
    MOCK_METHOD(ndk::ScopedAStatus, getSessionConfig, (SessionConfig * _aidl_return), (override));
};
};


} // namespace android::Hwc2::mock
} // namespace android::Hwc2::mock
Loading