* The 1.0 callback must not be called when HAL implementation detects
* 1.1 client (by casting V1_0::ITunerCallback to V1_1::ITunerCallback).
*
+ * In case of success, currentProgramInfoChanged must be called too.
+ * It means the success case may (or may not) be handled by the client in
+ * currentProgramInfoChanged, instead of here.
+ *
* @param result OK if tune succeeded or TIMEOUT in case of time out.
* @param selector A ProgramSelector structure describing the tuned station.
*/
oneway tuneComplete_1_1(Result result, ProgramSelector selector);
/**
- * Method called by the HAL when a frequency switch occurs.
- *
- * This callback supersedes V1_0::afSwitch.
- * The 1.0 callback must not be called when HAL implementation detects
- * 1.1 client (by casting V1_0::ITunerCallback to V1_1::ITunerCallback).
- *
- * @param selector A ProgramSelector structure describing the tuned station.
- */
- oneway afSwitch_1_1(ProgramSelector selector);
-
- /**
* Called by the HAL when background scan feature becomes available or not.
*
* @param isAvailable true, if the tuner turned temporarily background-
*
* This may be called together with tuneComplete_1_1 or afSwitch_1_1.
*
- * This callback supersedes V1_0::newMetadata and partly V1_0::tuneComplete
- * and V1_0::afSwitch.
+ * This callback supersedes V1_0::newMetadata and V1_0::afSwitch;
+ * partly V1_0::tuneComplete.
* 1.0 callbacks must not be called when HAL implementation detects
* 1.1 client (by casting V1_0::ITunerCallback to V1_1::ITunerCallback).
+ *
+ * @param info current program information
*/
- oneway currentProgramInfoChanged();
+ oneway currentProgramInfoChanged(ProgramInfo info);
};
MOCK_METHOD2(tuneComplete, Return<void>(Result, const V1_0::ProgramInfo&));
MOCK_TIMEOUT_METHOD2(tuneComplete_1_1, Return<void>(Result, const ProgramSelector&));
MOCK_METHOD1(afSwitch, Return<void>(const V1_0::ProgramInfo&));
- MOCK_METHOD1(afSwitch_1_1, Return<void>(const ProgramSelector&));
MOCK_METHOD1(antennaStateChange, Return<void>(bool connected));
MOCK_METHOD1(trafficAnnouncement, Return<void>(bool active));
MOCK_METHOD1(emergencyAnnouncement, Return<void>(bool active));
MOCK_METHOD1(backgroundScanAvailable, Return<void>(bool));
MOCK_TIMEOUT_METHOD1(backgroundScanComplete, Return<void>(ProgramListResult));
MOCK_METHOD0(programListChanged, Return<void>());
- MOCK_TIMEOUT_METHOD0(currentProgramInfoChanged, Return<void>());
+ MOCK_TIMEOUT_METHOD1(currentProgramInfoChanged, Return<void>(const ProgramInfo&));
};
class BroadcastRadioHalTest : public ::testing::VtsHalHidlTargetTestBase,
return;
}
+ ProgramInfo infoCb;
ProgramSelector selCb;
EXPECT_CALL(*mCallback, tuneComplete(_, _)).Times(0);
EXPECT_TIMEOUT_CALL(*mCallback, tuneComplete_1_1, Result::OK, _)
.WillOnce(DoAll(SaveArg<1>(&selCb), testing::Return(ByMove(Void()))));
- EXPECT_TIMEOUT_CALL(*mCallback, currentProgramInfoChanged);
+ EXPECT_TIMEOUT_CALL(*mCallback, currentProgramInfoChanged, _)
+ .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(Void()))));
auto tuneResult = mTuner->tuneByProgramSelector(firstProgram.selector);
ASSERT_EQ(Result::OK, tuneResult);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, tuneComplete_1_1, kTuneTimeout);
EXPECT_TIMEOUT_CALL_WAIT(*mCallback, currentProgramInfoChanged, kEventPropagationTimeout);
EXPECT_EQ(firstProgram.selector.primaryId, selCb.primaryId);
+ EXPECT_EQ(infoCb.selector, selCb);
bool called = false;
auto getResult = mTuner->getProgramInformation_1_1([&](Result result, ProgramInfo info) {