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

Commit 63dd5e25 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use getCapabilities call to ping vibrator AIDL HAL"

parents 8fa63e04 df1625fc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -149,8 +149,8 @@ private:
// -------------------------------------------------------------------------------------------------

HalResult<void> AidlHalWrapper::ping() {
    return IInterface::asBinder(getHal())->pingBinder() ? HalResult<void>::ok()
                                                        : HalResult<void>::failed();
    // TODO(b/153415251): Investigate why IBinder::pingBinder() is returning false even on success.
    return getCapabilitiesInternal().isFailed() ? HalResult<void>::failed() : HalResult<void>::ok();
}

void AidlHalWrapper::tryReconnect() {
+8 −4
Original line number Diff line number Diff line
@@ -118,13 +118,17 @@ ACTION(TriggerCallbackInArg2) {
TEST_F(VibratorHalWrapperAidlTest, TestPing) {
    {
        InSequence seq;
        EXPECT_CALL(*mMockHal.get(), onAsBinder())
                .Times(Exactly(1))
                .WillRepeatedly(Return(mMockBinder.get()));
        EXPECT_CALL(*mMockBinder.get(), pingBinder()).Times(Exactly(1));
        EXPECT_CALL(*mMockHal.get(), getCapabilities(_))
                .Times(Exactly(3))
                .WillOnce(Return(Status::fromExceptionCode(Status::Exception::EX_SECURITY)))
                .WillOnce(Return(
                        Status::fromExceptionCode(Status::Exception::EX_UNSUPPORTED_OPERATION)))
                .WillRepeatedly(Return(Status()));
    }

    ASSERT_TRUE(mWrapper->ping().isFailed());
    ASSERT_TRUE(mWrapper->ping().isOk());
    ASSERT_TRUE(mWrapper->ping().isOk());
}

TEST_F(VibratorHalWrapperAidlTest, TestOnWithCallbackSupport) {