summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Wasilczyk2018-06-05 12:10:39 -0500
committerScott Randolph2018-06-07 17:19:27 -0500
commitb557e0b748f874a5abe4282d244cb696fa626811 (patch)
treed7f6298035725a3d09d28d8e9ec0f3b4501c0d90 /broadcastradio
parent62fd03d8e64f368fadce4a972ead88404f94b21d (diff)
downloadplatform-hardware-interfaces-b557e0b748f874a5abe4282d244cb696fa626811.tar.gz
platform-hardware-interfaces-b557e0b748f874a5abe4282d244cb696fa626811.tar.xz
platform-hardware-interfaces-b557e0b748f874a5abe4282d244cb696fa626811.zip
Fix comments and internal names about SEEK operation.
Legacy radio HAL named it SCAN and the name slipped through HAL 1.x into HAL 2.0. I finally noticed it after HAL 2.0 was locked down. Bug: 109740376 Test: build ow Change-Id: I5ca4147227a7dd0c32248a279f03fb632d97258e
Diffstat (limited to 'broadcastradio')
-rw-r--r--broadcastradio/2.0/ITunerCallback.hal3
-rw-r--r--broadcastradio/2.0/ITunerSession.hal21
-rw-r--r--broadcastradio/2.0/default/TunerSession.cpp10
-rw-r--r--broadcastradio/2.0/default/VirtualProgram.h4
-rw-r--r--broadcastradio/2.0/types.hal17
-rw-r--r--broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp12
6 files changed, 39 insertions, 28 deletions
diff --git a/broadcastradio/2.0/ITunerCallback.hal b/broadcastradio/2.0/ITunerCallback.hal
index b20a0b2d..a174c9ce 100644
--- a/broadcastradio/2.0/ITunerCallback.hal
+++ b/broadcastradio/2.0/ITunerCallback.hal
@@ -18,7 +18,8 @@ package android.hardware.broadcastradio@2.0;
18interface ITunerCallback { 18interface ITunerCallback {
19 /** 19 /**
20 * Method called by the HAL when a tuning operation fails asynchronously 20 * Method called by the HAL when a tuning operation fails asynchronously
21 * following a step(), scan() or tune() command. 21 * following ITunerSession::tune(), ITunerSession::scan() or
22 * ITunerSession::step().
22 * 23 *
23 * This callback is only called when the step(), scan() or tune() command 24 * This callback is only called when the step(), scan() or tune() command
24 * returned OK at first. 25 * returned OK at first.
diff --git a/broadcastradio/2.0/ITunerSession.hal b/broadcastradio/2.0/ITunerSession.hal
index e891a234..3c27246f 100644
--- a/broadcastradio/2.0/ITunerSession.hal
+++ b/broadcastradio/2.0/ITunerSession.hal
@@ -19,7 +19,7 @@ interface ITunerSession {
19 /** 19 /**
20 * Tune to a specified program. 20 * Tune to a specified program.
21 * 21 *
22 * Automatically cancels pending scan, step or tune. 22 * Automatically cancels pending tune(), scan() or step().
23 * If the method returns OK, tuneFailed or currentProgramInfoChanged 23 * If the method returns OK, tuneFailed or currentProgramInfoChanged
24 * callback must be called. 24 * callback must be called.
25 * 25 *
@@ -33,9 +33,16 @@ interface ITunerSession {
33 tune(ProgramSelector program) generates (Result result); 33 tune(ProgramSelector program) generates (Result result);
34 34
35 /** 35 /**
36 * Tune to the next valid program. 36 * Tune (seek) to the next valid program on the "air".
37 * 37 *
38 * Automatically cancels pending scan, step or tune. 38 * This might more naturally be called "seek" but for legacy reasons, the
39 * entry point remains "scan". This should not be confused with the actual
40 * scan operation (where the radio seeks through programs in a loop until
41 * user chooses to stay on one of them) nor background scan operation (that
42 * a tuner may do in order to locate all available programs. This function
43 * is meant to advance to the next detected program and stay there.
44 *
45 * Automatically cancels pending tune(), scan() or step().
39 * If the method returns OK, tuneFailed or currentProgramInfoChanged 46 * If the method returns OK, tuneFailed or currentProgramInfoChanged
40 * callback must be called. 47 * callback must be called.
41 * 48 *
@@ -44,20 +51,20 @@ interface ITunerSession {
44 * - DAB secondary service. 51 * - DAB secondary service.
45 * 52 *
46 * As an implementation detail, the HAL has the option to perform an actual 53 * As an implementation detail, the HAL has the option to perform an actual
47 * scan or select the next program from the list retrieved in the 54 * seek or select the next program from the list retrieved in the
48 * background, if one is not stale. 55 * background, if one is not stale.
49 * 56 *
50 * @param directionUp True to change towards higher numeric values 57 * @param directionUp True to change towards higher numeric values
51 * (frequency, channel number), false towards lower. 58 * (frequency, channel number), false towards lower.
52 * @param skipSubChannel Don't tune to subchannels. 59 * @param skipSubChannel Don't tune to subchannels.
53 * @return result OK if the scan has successfully started. 60 * @return result OK if the operation has successfully started.
54 */ 61 */
55 scan(bool directionUp, bool skipSubChannel) generates (Result result); 62 scan(bool directionUp, bool skipSubChannel) generates (Result result);
56 63
57 /** 64 /**
58 * Tune to the adjacent channel, which may not be occupied by any program. 65 * Tune to the adjacent channel, which may not be occupied by any program.
59 * 66 *
60 * Automatically cancels pending scan, step or tune. 67 * Automatically cancels pending tune(), scan() or step().
61 * If the method returns OK, tuneFailed or currentProgramInfoChanged 68 * If the method returns OK, tuneFailed or currentProgramInfoChanged
62 * callback must be called. 69 * callback must be called.
63 * 70 *
@@ -70,7 +77,7 @@ interface ITunerSession {
70 step(bool directionUp) generates (Result result); 77 step(bool directionUp) generates (Result result);
71 78
72 /** 79 /**
73 * Cancel a scan, step or tune operation. 80 * Cancel a pending tune(), scan() or step().
74 * 81 *
75 * If there is no such operation running, the call must be ignored. 82 * If there is no such operation running, the call must be ignored.
76 */ 83 */
diff --git a/broadcastradio/2.0/default/TunerSession.cpp b/broadcastradio/2.0/default/TunerSession.cpp
index 56a35087..da975620 100644
--- a/broadcastradio/2.0/default/TunerSession.cpp
+++ b/broadcastradio/2.0/default/TunerSession.cpp
@@ -42,7 +42,7 @@ using std::vector;
42 42
43namespace delay { 43namespace delay {
44 44
45static constexpr auto scan = 200ms; 45static constexpr auto seek = 200ms;
46static constexpr auto step = 100ms; 46static constexpr auto step = 100ms;
47static constexpr auto tune = 150ms; 47static constexpr auto tune = 150ms;
48static constexpr auto list = 1s; 48static constexpr auto list = 1s;
@@ -131,11 +131,11 @@ Return<Result> TunerSession::scan(bool directionUp, bool /* skipSubChannel */) {
131 if (list.empty()) { 131 if (list.empty()) {
132 mIsTuneCompleted = false; 132 mIsTuneCompleted = false;
133 auto task = [this, directionUp]() { 133 auto task = [this, directionUp]() {
134 ALOGI("Performing failed scan up=%d", directionUp); 134 ALOGI("Performing failed seek up=%d", directionUp);
135 135
136 mCallback->onTuneFailed(Result::TIMEOUT, {}); 136 mCallback->onTuneFailed(Result::TIMEOUT, {});
137 }; 137 };
138 mThread.schedule(task, delay::scan); 138 mThread.schedule(task, delay::seek);
139 139
140 return Result::OK; 140 return Result::OK;
141 } 141 }
@@ -162,12 +162,12 @@ Return<Result> TunerSession::scan(bool directionUp, bool /* skipSubChannel */) {
162 162
163 mIsTuneCompleted = false; 163 mIsTuneCompleted = false;
164 auto task = [this, tuneTo, directionUp]() { 164 auto task = [this, tuneTo, directionUp]() {
165 ALOGI("Performing scan up=%d", directionUp); 165 ALOGI("Performing seek up=%d", directionUp);
166 166
167 lock_guard<mutex> lk(mMut); 167 lock_guard<mutex> lk(mMut);
168 tuneInternalLocked(tuneTo); 168 tuneInternalLocked(tuneTo);
169 }; 169 };
170 mThread.schedule(task, delay::scan); 170 mThread.schedule(task, delay::seek);
171 171
172 return Result::OK; 172 return Result::OK;
173} 173}
diff --git a/broadcastradio/2.0/default/VirtualProgram.h b/broadcastradio/2.0/default/VirtualProgram.h
index e1c4f759..65026164 100644
--- a/broadcastradio/2.0/default/VirtualProgram.h
+++ b/broadcastradio/2.0/default/VirtualProgram.h
@@ -40,8 +40,8 @@ struct VirtualProgram {
40 operator ProgramInfo() const; 40 operator ProgramInfo() const;
41 41
42 /** 42 /**
43 * Defines order on how virtual programs appear on the "air" with 43 * Defines order in which virtual programs appear on the "air" with
44 * ITunerSession::scan operation. 44 * ITunerSession::scan().
45 * 45 *
46 * It's for default implementation purposes, may not be complete or correct. 46 * It's for default implementation purposes, may not be complete or correct.
47 */ 47 */
diff --git a/broadcastradio/2.0/types.hal b/broadcastradio/2.0/types.hal
index 1ce61dfe..987572a4 100644
--- a/broadcastradio/2.0/types.hal
+++ b/broadcastradio/2.0/types.hal
@@ -184,18 +184,20 @@ struct AmFmRegionConfig {
184 * lowerBound + channelNumber * spacing, up to upperBound. 184 * lowerBound + channelNumber * spacing, up to upperBound.
185 */ 185 */
186struct AmFmBandRange { 186struct AmFmBandRange {
187 /** The frequency of the first channel within the range. */ 187 /** The frequency (in kHz) of the first channel within the range. */
188 uint32_t lowerBound; 188 uint32_t lowerBound;
189 189
190 /** The frequency of the last channel within the range. */ 190 /** The frequency (in kHz) of the last channel within the range. */
191 uint32_t upperBound; 191 uint32_t upperBound;
192 192
193 /** Channel grid resolution, how far apart are the channels. */ 193 /** Channel grid resolution (in kHz), how far apart are the channels. */
194 uint32_t spacing; 194 uint32_t spacing;
195 195
196 /** 196 /**
197 * Spacing used when scanning for channels. It's a multiply of spacing and 197 * Channel spacing (in kHz) used to speed up seeking to the next station
198 * allows to skip some channels when scanning to make it faster. 198 * via the ITunerSession::scan() operation.
199 *
200 * It must be a multiple of channel grid resolution.
199 * 201 *
200 * Tuner may first quickly check every n-th channel and if it detects echo 202 * Tuner may first quickly check every n-th channel and if it detects echo
201 * from a station, it fine-tunes to find the exact frequency. 203 * from a station, it fine-tunes to find the exact frequency.
@@ -415,9 +417,10 @@ enum ProgramInfoFlags : uint32_t {
415 TRAFFIC_ANNOUNCEMENT = 1 << 3, 417 TRAFFIC_ANNOUNCEMENT = 1 << 3,
416 418
417 /** 419 /**
418 * Tuned to a program (not playing a static). 420 * Tuned to a program (not playing static).
419 * 421 *
420 * It's the same condition that would stop scan() operation. 422 * It's the same condition that would stop a seek operation
423 * (ie: ITunerSession::scan()).
421 * 424 *
422 * By definition, this flag must be set for all items on the program list. 425 * By definition, this flag must be set for all items on the program list.
423 */ 426 */
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 62b00379..3d7039dc 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -308,7 +308,7 @@ static bool supportsFM(const AmFmRegionConfig& config) {
308 * - there is at least one AM/FM band configured; 308 * - there is at least one AM/FM band configured;
309 * - FM Deemphasis and RDS are correctly configured for FM-capable radio; 309 * - FM Deemphasis and RDS are correctly configured for FM-capable radio;
310 * - all channel grids (frequency ranges and spacings) are valid; 310 * - all channel grids (frequency ranges and spacings) are valid;
311 * - scan spacing is a multiply of manual spacing value. 311 * - seek spacing is a multiple of the manual spacing value.
312 */ 312 */
313TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfig) { 313TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfig) {
314 AmFmRegionConfig config; 314 AmFmRegionConfig config;
@@ -341,7 +341,7 @@ TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfig) {
341 * - there is at least one AM/FM range supported; 341 * - there is at least one AM/FM range supported;
342 * - there is at least one de-emphasis filter mode supported for FM-capable radio; 342 * - there is at least one de-emphasis filter mode supported for FM-capable radio;
343 * - all channel grids (frequency ranges and spacings) are valid; 343 * - all channel grids (frequency ranges and spacings) are valid;
344 * - scan spacing is not set. 344 * - seek spacing is not set.
345 */ 345 */
346TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilities) { 346TEST_F(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilities) {
347 AmFmRegionConfig config; 347 AmFmRegionConfig config;
@@ -501,14 +501,14 @@ TEST_F(BroadcastRadioHalTest, TuneFailsWithEmpty) {
501} 501}
502 502
503/** 503/**
504 * Test scanning to next/prev station. 504 * Test seeking to next/prev station via ITunerSession::scan().
505 * 505 *
506 * Verifies that: 506 * Verifies that:
507 * - the method succeeds; 507 * - the method succeeds;
508 * - the program info is changed within timeout::tune; 508 * - the program info is changed within timeout::tune;
509 * - works both directions and with or without skipping sub-channel. 509 * - works both directions and with or without skipping sub-channel.
510 */ 510 */
511TEST_F(BroadcastRadioHalTest, Scan) { 511TEST_F(BroadcastRadioHalTest, Seek) {
512 ASSERT_TRUE(openSession()); 512 ASSERT_TRUE(openSession());
513 513
514 // TODO(b/69958777): see FmTune workaround 514 // TODO(b/69958777): see FmTune workaround
@@ -564,8 +564,8 @@ TEST_F(BroadcastRadioHalTest, Cancel) {
564 ASSERT_TRUE(openSession()); 564 ASSERT_TRUE(openSession());
565 565
566 for (int i = 0; i < 10; i++) { 566 for (int i = 0; i < 10; i++) {
567 auto scanResult = mSession->scan(true /* up */, true /* skip subchannel */); 567 auto result = mSession->scan(true /* up */, true /* skip subchannel */);
568 ASSERT_EQ(Result::OK, scanResult); 568 ASSERT_EQ(Result::OK, result);
569 569
570 auto cancelResult = mSession->cancel(); 570 auto cancelResult = mSession->cancel();
571 ASSERT_TRUE(cancelResult.isOk()); 571 ASSERT_TRUE(cancelResult.isOk());