summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2018-03-30 07:37:01 -0700
committer Tomasz Wasilczyk <twasilczyk@google.com> 2018-03-30 07:37:01 -0700
commitdffc226e010a96fc78236fadc63c0dea868a7af1 (patch)
treef4a5143995bbdcdb155130424b8b816d39918339
parent491c654434fe55f0112c966bfbf2d4c1c1721f0b (diff)
Workaround HAL 1.1 program list fetching limitation by preferring FM.
Bug: 75970985 Test: manual Change-Id: I842e9b4765c5ec2479950e88b6f33aa2264a9d0b
-rw-r--r--services/core/jni/BroadcastRadio/BroadcastRadioService.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/jni/BroadcastRadio/BroadcastRadioService.cpp b/services/core/jni/BroadcastRadio/BroadcastRadioService.cpp
index ecf1a33539e9..f7ca363e54a1 100644
--- a/services/core/jni/BroadcastRadio/BroadcastRadioService.cpp
+++ b/services/core/jni/BroadcastRadio/BroadcastRadioService.cpp
@@ -231,6 +231,13 @@ static jobject nativeOpenTuner(JNIEnv *env, jobject obj, long nativeContext, jin
return nullptr;
}
bandConfigHal = module.bands[0];
+
+ /* Prefer FM to workaround possible program list fetching limitation
+ * (if tuner scans only configured band for programs). */
+ auto fmIt = std::find_if(module.bands.begin(), module.bands.end(),
+ [](const BandConfig & band) { return utils::isFm(band.type); });
+ if (fmIt != module.bands.end()) bandConfigHal = *fmIt;
+
if (bandConfigHal.spacings.size() > 1) {
bandConfigHal.spacings = hidl_vec<uint32_t>({ *std::min_element(
bandConfigHal.spacings.begin(), bandConfigHal.spacings.end()) });