Loading services/vibratorservice/VibratorHalWrapper.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,10 @@ HalResult<void> HalResult<void>::fromStatus(status_t status) { } HalResult<void> HalResult<void>::fromStatus(binder::Status status) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { // UNKNOWN_TRANSACTION means the HAL implementation is an older version, so this is // the same as the operation being unsupported by this HAL. Should not retry. return HalResult<void>::unsupported(); } if (status.isOk()) { Loading services/vibratorservice/include/vibratorservice/VibratorHalWrapper.h +4 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,10 @@ public: static HalResult<T> unsupported() { return HalResult("", /* unsupported= */ true); } static HalResult<T> fromStatus(binder::Status status, T data) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { // UNKNOWN_TRANSACTION means the HAL implementation is an older version, so this is // the same as the operation being unsupported by this HAL. Should not retry. return HalResult<T>::unsupported(); } if (status.isOk()) { Loading services/vibratorservice/test/VibratorHalWrapperAidlTest.cpp +7 −14 Original line number Diff line number Diff line Loading @@ -189,8 +189,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestOnWithoutCallbackSupport) { .WillRepeatedly(vibrator::TriggerSchedulerCallback()); EXPECT_CALL(*mMockHal.get(), on(Eq(11), _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), on(Eq(12), _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -228,8 +227,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestSetAmplitude) { EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.1f))).Times(Exactly(1)); EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.2f))) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.5f))) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -265,8 +263,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestAlwaysOnEnable) { EXPECT_CALL(*mMockHal.get(), alwaysOnEnable(Eq(2), Eq(Effect::TICK), Eq(EffectStrength::MEDIUM))) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), alwaysOnEnable(Eq(3), Eq(Effect::POP), Eq(EffectStrength::STRONG))) .Times(Exactly(1)) Loading Loading @@ -397,8 +394,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) { Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); EXPECT_CALL(*mMockHal.get(), getSupportedPrimitives(_)) .Times(Exactly(1)) .WillRepeatedly( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), getFrequencyMinimum(_)) .Times(Exactly(1)) .WillRepeatedly(DoAll(SetArgPointee<0>(F_MIN), Return(Status()))); Loading @@ -411,8 +407,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) { Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); EXPECT_CALL(*mMockHal.get(), getBandwidthAmplitudeMap(_)) .Times(Exactly(1)) .WillRepeatedly( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), getSupportedBraking(_)) .Times(Exactly(1)) .WillRepeatedly( Loading Loading @@ -451,8 +446,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestPerformEffectWithCallbackSupport) { DoAll(SetArgPointee<3>(1000), TriggerCallbackInArg2(), Return(Status()))); EXPECT_CALL(*mMockHal.get(), perform(Eq(Effect::POP), Eq(EffectStrength::MEDIUM), _, _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), perform(Eq(Effect::THUD), Eq(EffectStrength::STRONG), _, _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -549,8 +543,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestPerformComposedEffect) { .WillRepeatedly(DoAll(TriggerCallbackInArg1(), Return(Status()))); EXPECT_CALL(*mMockHal.get(), compose(Eq(singleEffect), _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), compose(Eq(multipleEffects), _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading services/vibratorservice/test/VibratorManagerHalWrapperAidlTest.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -308,8 +308,7 @@ TEST_F(VibratorManagerHalWrapperAidlTest, TestTriggerSyncedWithCallbackSupport) Return(Status()))); EXPECT_CALL(*mMockHal.get(), triggerSynced(_)) .Times(Exactly(3)) .WillOnce(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))) .WillOnce(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))) .WillOnce(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))) .WillRepeatedly(DoAll(TriggerCallback(), Return(Status()))); } Loading Loading @@ -345,8 +344,7 @@ TEST_F(VibratorManagerHalWrapperAidlTest, TestTriggerSyncedWithoutCallbackSuppor TEST_F(VibratorManagerHalWrapperAidlTest, TestCancelSynced) { EXPECT_CALL(*mMockHal.get(), cancelSynced()) .Times(Exactly(3)) .WillOnce( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))) .WillOnce(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))) .WillOnce(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))) .WillRepeatedly(Return(Status())); Loading Loading
services/vibratorservice/VibratorHalWrapper.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -95,7 +95,10 @@ HalResult<void> HalResult<void>::fromStatus(status_t status) { } HalResult<void> HalResult<void>::fromStatus(binder::Status status) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { // UNKNOWN_TRANSACTION means the HAL implementation is an older version, so this is // the same as the operation being unsupported by this HAL. Should not retry. return HalResult<void>::unsupported(); } if (status.isOk()) { Loading
services/vibratorservice/include/vibratorservice/VibratorHalWrapper.h +4 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,10 @@ public: static HalResult<T> unsupported() { return HalResult("", /* unsupported= */ true); } static HalResult<T> fromStatus(binder::Status status, T data) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION) { if (status.exceptionCode() == binder::Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { // UNKNOWN_TRANSACTION means the HAL implementation is an older version, so this is // the same as the operation being unsupported by this HAL. Should not retry. return HalResult<T>::unsupported(); } if (status.isOk()) { Loading
services/vibratorservice/test/VibratorHalWrapperAidlTest.cpp +7 −14 Original line number Diff line number Diff line Loading @@ -189,8 +189,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestOnWithoutCallbackSupport) { .WillRepeatedly(vibrator::TriggerSchedulerCallback()); EXPECT_CALL(*mMockHal.get(), on(Eq(11), _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), on(Eq(12), _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -228,8 +227,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestSetAmplitude) { EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.1f))).Times(Exactly(1)); EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.2f))) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), setAmplitude(Eq(0.5f))) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -265,8 +263,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestAlwaysOnEnable) { EXPECT_CALL(*mMockHal.get(), alwaysOnEnable(Eq(2), Eq(Effect::TICK), Eq(EffectStrength::MEDIUM))) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), alwaysOnEnable(Eq(3), Eq(Effect::POP), Eq(EffectStrength::STRONG))) .Times(Exactly(1)) Loading Loading @@ -397,8 +394,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) { Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); EXPECT_CALL(*mMockHal.get(), getSupportedPrimitives(_)) .Times(Exactly(1)) .WillRepeatedly( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), getFrequencyMinimum(_)) .Times(Exactly(1)) .WillRepeatedly(DoAll(SetArgPointee<0>(F_MIN), Return(Status()))); Loading @@ -411,8 +407,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestGetInfoCachesResult) { Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); EXPECT_CALL(*mMockHal.get(), getBandwidthAmplitudeMap(_)) .Times(Exactly(1)) .WillRepeatedly( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), getSupportedBraking(_)) .Times(Exactly(1)) .WillRepeatedly( Loading Loading @@ -451,8 +446,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestPerformEffectWithCallbackSupport) { DoAll(SetArgPointee<3>(1000), TriggerCallbackInArg2(), Return(Status()))); EXPECT_CALL(*mMockHal.get(), perform(Eq(Effect::POP), Eq(EffectStrength::MEDIUM), _, _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), perform(Eq(Effect::THUD), Eq(EffectStrength::STRONG), _, _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading Loading @@ -549,8 +543,7 @@ TEST_F(VibratorHalWrapperAidlTest, TestPerformComposedEffect) { .WillRepeatedly(DoAll(TriggerCallbackInArg1(), Return(Status()))); EXPECT_CALL(*mMockHal.get(), compose(Eq(singleEffect), _)) .Times(Exactly(1)) .WillRepeatedly(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))); .WillRepeatedly(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))); EXPECT_CALL(*mMockHal.get(), compose(Eq(multipleEffects), _)) .Times(Exactly(1)) .WillRepeatedly(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))); Loading
services/vibratorservice/test/VibratorManagerHalWrapperAidlTest.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -308,8 +308,7 @@ TEST_F(VibratorManagerHalWrapperAidlTest, TestTriggerSyncedWithCallbackSupport) Return(Status()))); EXPECT_CALL(*mMockHal.get(), triggerSynced(_)) .Times(Exactly(3)) .WillOnce(Return( Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))) .WillOnce(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))) .WillOnce(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))) .WillRepeatedly(DoAll(TriggerCallback(), Return(Status()))); } Loading Loading @@ -345,8 +344,7 @@ TEST_F(VibratorManagerHalWrapperAidlTest, TestTriggerSyncedWithoutCallbackSuppor TEST_F(VibratorManagerHalWrapperAidlTest, TestCancelSynced) { EXPECT_CALL(*mMockHal.get(), cancelSynced()) .Times(Exactly(3)) .WillOnce( Return(Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION))) .WillOnce(Return(Status::fromStatusT(UNKNOWN_TRANSACTION))) .WillOnce(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY))) .WillRepeatedly(Return(Status())); Loading