From 02f65dd642dc82ac2f34e5e2fde5f6cfb7a66d32 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt-Samoa Date: Mon, 10 Jan 2022 08:45:55 +0100 Subject: [PATCH] Service: transmits empty station list CP from https://android-review.googlesource.com/c/platform/frameworks/base/+/1942313 In case of bad reception, station lists e.g. for DAB might be empty. Until now, empty station lists from broadcast radio HAL were ignored by radio service and not forwarded to radio app. With this patch, radio service transmits empty station lists from broadcast radio HAL to radio app. Bug: 193674842 Test: manual - Bench test with connected radio Signed-off-by: Tobias Schmidt-Samoa Change-Id: Ida0d7637e32b4b9064cddbd3e8d8d4b8d347023c Merged-In: Ida0d7637e32b4b9064cddbd3e8d8d4b8d347023c --- .../server/broadcastradio/hal2/ProgramInfoCache.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/broadcastradio/hal2/ProgramInfoCache.java b/services/core/java/com/android/server/broadcastradio/hal2/ProgramInfoCache.java index 8c93891011417..6654c0c2304d2 100644 --- a/services/core/java/com/android/server/broadcastradio/hal2/ProgramInfoCache.java +++ b/services/core/java/com/android/server/broadcastradio/hal2/ProgramInfoCache.java @@ -189,7 +189,8 @@ class ProgramInfoCache { removed.add(id); } } - if (modified.isEmpty() && removed.isEmpty() && mComplete == chunk.isComplete()) { + if (modified.isEmpty() && removed.isEmpty() && mComplete == chunk.isComplete() + && !chunk.isPurge()) { return null; } mComplete = chunk.isComplete(); @@ -239,9 +240,10 @@ class ProgramInfoCache { } // Determine number of chunks we need to send. - int numChunks = 0; + int numChunks = purge ? 1 : 0; if (modified != null) { - numChunks = roundUpFraction(modified.size(), maxNumModifiedPerChunk); + numChunks = Math.max(numChunks, + roundUpFraction(modified.size(), maxNumModifiedPerChunk)); } if (removed != null) { numChunks = Math.max(numChunks, roundUpFraction(removed.size(), maxNumRemovedPerChunk));