Felix HAL: Add Destructor to the vibrator HAL.
Bug: 379618185 Flag: EXEMPT test only Test: VibratorHalCs40l26TestSuitePrivate Change-Id: If9519ae3aa6b3bd66bfd0a0c9bac844dddfb2f28 Signed-off-by: Zouberou Sayibou <zouberou@google.com>
This commit is contained in:
parent
846792c360
commit
8a2d7fdd7c
3 changed files with 15 additions and 1 deletions
|
@ -1335,6 +1335,17 @@ static void incrementIndex(int *index) {
|
|||
*index += 1;
|
||||
}
|
||||
|
||||
Vibrator::~Vibrator() {
|
||||
if (isUnderExternalControl()) {
|
||||
ALOGD("Disabling external control");
|
||||
setExternalControl(false);
|
||||
}
|
||||
ALOGD("Turning off the vibrator");
|
||||
off();
|
||||
ALOGD("Waiting for mAsyncHandle to complete");
|
||||
mAsyncHandle.wait();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Vibrator::composePwle(const std::vector<PrimitivePwle> &composite,
|
||||
const std::shared_ptr<IVibratorCallback> &callback) {
|
||||
ATRACE_NAME("Vibrator::composePwle");
|
||||
|
|
|
@ -153,6 +153,7 @@ class Vibrator : public BnVibrator {
|
|||
Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> hwCalDefault,
|
||||
std::unique_ptr<HwApi> hwApiDual, std::unique_ptr<HwCal> hwCalDual,
|
||||
std::unique_ptr<HwGPIO> hwgpio);
|
||||
virtual ~Vibrator();
|
||||
|
||||
// BnVibrator APIs
|
||||
ndk::ScopedAStatus getCapabilities(int32_t *_aidl_return) override;
|
||||
|
|
|
@ -335,7 +335,9 @@ TEST_F(VibratorTest, Constructor) {
|
|||
EXPECT_CALL(*mMockApi, destructor()).WillOnce(DoDefault());
|
||||
EXPECT_CALL(*mMockCal, destructor()).WillOnce(DoDefault());
|
||||
EXPECT_CALL(*mMockGpio, destructor()).WillOnce(DoDefault());
|
||||
|
||||
// Mock calls for the VIbrator destructor.
|
||||
EXPECT_CALL(*mMockApi, recordEvent(_, _)).WillRepeatedly(DoDefault());
|
||||
EXPECT_CALL(*mMockApi, setFFGain(_, ON_GLOBAL_SCALE)).WillOnce(DoDefault());
|
||||
deleteVibrator(false);
|
||||
|
||||
createMock(&mockapi, &mockcal, &mockgpio);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue