Merge changes I59298139,If9519ae3 into main
* changes: Felix HAL: Move mActiveId_mutex as a private member. Felix HAL: Add Destructor to the vibrator HAL.
This commit is contained in:
commit
e0def5d0df
3 changed files with 16 additions and 2 deletions
|
@ -203,7 +203,6 @@ enum vibe_state {
|
||||||
VIBE_STATE_ASP,
|
VIBE_STATE_ASP,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::mutex mActiveId_mutex; // protects mActiveId
|
|
||||||
|
|
||||||
class DspMemChunk {
|
class DspMemChunk {
|
||||||
private:
|
private:
|
||||||
|
@ -1335,6 +1334,17 @@ static void incrementIndex(int *index) {
|
||||||
*index += 1;
|
*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,
|
ndk::ScopedAStatus Vibrator::composePwle(const std::vector<PrimitivePwle> &composite,
|
||||||
const std::shared_ptr<IVibratorCallback> &callback) {
|
const std::shared_ptr<IVibratorCallback> &callback) {
|
||||||
ATRACE_NAME("Vibrator::composePwle");
|
ATRACE_NAME("Vibrator::composePwle");
|
||||||
|
|
|
@ -153,6 +153,7 @@ class Vibrator : public BnVibrator {
|
||||||
Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> hwCalDefault,
|
Vibrator(std::unique_ptr<HwApi> hwApiDefault, std::unique_ptr<HwCal> hwCalDefault,
|
||||||
std::unique_ptr<HwApi> hwApiDual, std::unique_ptr<HwCal> hwCalDual,
|
std::unique_ptr<HwApi> hwApiDual, std::unique_ptr<HwCal> hwCalDual,
|
||||||
std::unique_ptr<HwGPIO> hwgpio);
|
std::unique_ptr<HwGPIO> hwgpio);
|
||||||
|
virtual ~Vibrator();
|
||||||
|
|
||||||
// BnVibrator APIs
|
// BnVibrator APIs
|
||||||
ndk::ScopedAStatus getCapabilities(int32_t *_aidl_return) override;
|
ndk::ScopedAStatus getCapabilities(int32_t *_aidl_return) override;
|
||||||
|
@ -255,6 +256,7 @@ class Vibrator : public BnVibrator {
|
||||||
bool mConfigHapticAlsaDeviceDone{false};
|
bool mConfigHapticAlsaDeviceDone{false};
|
||||||
bool mGPIOStatus;
|
bool mGPIOStatus;
|
||||||
bool mIsDual{false};
|
bool mIsDual{false};
|
||||||
|
std::mutex mActiveId_mutex; // protects mActiveId
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace vibrator
|
} // namespace vibrator
|
||||||
|
|
|
@ -335,7 +335,9 @@ TEST_F(VibratorTest, Constructor) {
|
||||||
EXPECT_CALL(*mMockApi, destructor()).WillOnce(DoDefault());
|
EXPECT_CALL(*mMockApi, destructor()).WillOnce(DoDefault());
|
||||||
EXPECT_CALL(*mMockCal, destructor()).WillOnce(DoDefault());
|
EXPECT_CALL(*mMockCal, destructor()).WillOnce(DoDefault());
|
||||||
EXPECT_CALL(*mMockGpio, 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);
|
deleteVibrator(false);
|
||||||
|
|
||||||
createMock(&mockapi, &mockcal, &mockgpio);
|
createMock(&mockapi, &mockcal, &mockgpio);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue