Pull DSPMemChunk related CLs from common HAL. ag/22087481, ag/22093662 Bug: 322648133 Test: idlcli compose commands Test: adb shell cmd vibrator_manager synced prebaked 1 Test: adb shell idlcli vibrator composePwle -b \ a 0.1 300.0 0.1 30.0 1000 \ a 0.1 30.0 0.1 300.0 500 Test: atest PtsVibratorHalTestSuite \ PtsHapticsTestCases \ VibratorHalCs40l26TestSuite \ VtsHalVibratorManagerTargetTest \ VtsHalVibratorTargetTest \ android.os.cts.VibratorTest \ android.os.cts.VibratorManagerTest \ android.os.cts.VibrationEffectTest \ android.os.cts.VibrationAttributesTest \ android.os.cts.CombinedVibrationTest (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:85299be2adc9e3dec373dc48f321c4fa1930e260) Merged-In: I32258500ec02c2a8cbfc6d0b37aaea2c83c7c8b4 Change-Id: I32258500ec02c2a8cbfc6d0b37aaea2c83c7c8b4
92 lines
4 KiB
C++
92 lines
4 KiB
C++
/*
|
|
* Copyright (C) 2022 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 ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
|
|
#define ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
|
|
|
|
#include <aidl/android/hardware/vibrator/BnVibratorCallback.h>
|
|
|
|
#include "Vibrator.h"
|
|
|
|
class MockGPIO : public ::aidl::android::hardware::vibrator::Vibrator::HwGPIO {
|
|
public:
|
|
MOCK_METHOD0(destructor, void());
|
|
MOCK_METHOD0(getGPIO, bool());
|
|
MOCK_METHOD0(initGPIO, bool());
|
|
MOCK_METHOD1(setGPIOOutput, bool(bool value));
|
|
MOCK_METHOD1(debug, void(int fd));
|
|
|
|
~MockGPIO() override { destructor(); };
|
|
};
|
|
|
|
class MockApi : public ::aidl::android::hardware::vibrator::Vibrator::HwApi {
|
|
public:
|
|
MOCK_METHOD0(destructor, void());
|
|
MOCK_METHOD1(setF0, bool(std::string value));
|
|
MOCK_METHOD1(setF0Offset, bool(uint32_t value));
|
|
MOCK_METHOD1(setRedc, bool(std::string value));
|
|
MOCK_METHOD1(setQ, bool(std::string value));
|
|
MOCK_METHOD1(getEffectCount, bool(uint32_t *value));
|
|
MOCK_METHOD2(pollVibeState, bool(uint32_t value, int32_t timeoutMs));
|
|
MOCK_METHOD0(hasOwtFreeSpace, bool());
|
|
MOCK_METHOD1(getOwtFreeSpace, bool(uint32_t *value));
|
|
MOCK_METHOD1(setF0CompEnable, bool(bool value));
|
|
MOCK_METHOD1(setRedcCompEnable, bool(bool value));
|
|
MOCK_METHOD1(setMinOnOffInterval, bool(uint32_t value));
|
|
MOCK_METHOD2(setFFGain, bool(int fd, uint16_t value));
|
|
MOCK_METHOD3(setFFEffect, bool(int fd, struct ff_effect *effect, uint16_t timeoutMs));
|
|
MOCK_METHOD3(setFFPlay, bool(int fd, int8_t index, bool value));
|
|
MOCK_METHOD2(getHapticAlsaDevice, bool(int *card, int *device));
|
|
MOCK_METHOD4(setHapticPcmAmp, bool(struct pcm **haptic_pcm, bool enable, int card, int device));
|
|
MOCK_METHOD6(uploadOwtEffect,
|
|
bool(int fd, const uint8_t *owtData, const uint32_t numBytes, struct ff_effect *effect,
|
|
uint32_t *outEffectIndex, int *status));
|
|
MOCK_METHOD3(eraseOwtEffect, bool(int fd, int8_t effectIndex, std::vector<ff_effect> *effect));
|
|
MOCK_METHOD1(debug, void(int fd));
|
|
|
|
~MockApi() override { destructor(); };
|
|
};
|
|
|
|
class MockCal : public ::aidl::android::hardware::vibrator::Vibrator::HwCal {
|
|
public:
|
|
MOCK_METHOD0(destructor, void());
|
|
MOCK_METHOD1(getVersion, bool(uint32_t *value));
|
|
MOCK_METHOD1(getF0, bool(std::string &value));
|
|
MOCK_METHOD1(getF0SyncOffset, bool(uint32_t *value));
|
|
MOCK_METHOD1(getRedc, bool(std::string &value));
|
|
MOCK_METHOD1(getQ, bool(std::string &value));
|
|
MOCK_METHOD1(getLongFrequencyShift, bool(int32_t *value));
|
|
MOCK_METHOD1(getTickVolLevels, bool(std::array<uint32_t, 2> *value));
|
|
MOCK_METHOD1(getClickVolLevels, bool(std::array<uint32_t, 2> *value));
|
|
MOCK_METHOD1(getLongVolLevels, bool(std::array<uint32_t, 2> *value));
|
|
MOCK_METHOD0(isChirpEnabled, bool());
|
|
MOCK_METHOD1(getSupportedPrimitives, bool(uint32_t *value));
|
|
MOCK_METHOD0(isF0CompEnabled, bool());
|
|
MOCK_METHOD0(isRedcCompEnabled, bool());
|
|
MOCK_METHOD1(debug, void(int fd));
|
|
|
|
~MockCal() override { destructor(); };
|
|
// b/132668253: Workaround gMock Compilation Issue
|
|
bool getF0(std::string *value) { return getF0(*value); }
|
|
bool getRedc(std::string *value) { return getRedc(*value); }
|
|
bool getQ(std::string *value) { return getQ(*value); }
|
|
};
|
|
|
|
class MockVibratorCallback : public aidl::android::hardware::vibrator::BnVibratorCallback {
|
|
public:
|
|
MOCK_METHOD(ndk::ScopedAStatus, onComplete, ());
|
|
};
|
|
|
|
#endif // ANDROID_HARDWARE_VIBRATOR_TEST_MOCKS_H
|