From f044a370d41687e0546a63b747b7c383f7f41e3e Mon Sep 17 00:00:00 2001 From: Jake Hamby Date: Thu, 27 Oct 2011 16:57:22 -0700 Subject: Fix bug in enabling/disabling SMS cell broadcast activation. When enabling/disabling SMS cell broadcast channels, we were not calling setGsmBroadcastActivation() with the correct value after updating the message IDs. It should be called with true if any message IDs are enabled, or false if the list is empty. Added an isEmpty() method to IntRangeManager, and moved the call to setGsmBroadcastActivation() in SimSmsInterfaceManager to the end of the enableCellBroadcastRange() and disableCellBroadcastRange() methods, where it sets the correct value using the new isEmpty() method to test if there are any message IDs enabled after updating the range list. Bug: 5525441 Change-Id: I7d1ebd54dacf1de20910947efbf5e87e1957fd1a --- .../java/com/android/internal/telephony/IntRangeManager.java | 8 ++++++++ telephony/java/com/android/internal/telephony/RIL.java | 2 +- .../android/internal/telephony/gsm/SimSmsInterfaceManager.java | 9 +++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/telephony/java/com/android/internal/telephony/IntRangeManager.java b/telephony/java/com/android/internal/telephony/IntRangeManager.java index 970bc4424fba..cc7774d66c3e 100644 --- a/telephony/java/com/android/internal/telephony/IntRangeManager.java +++ b/telephony/java/com/android/internal/telephony/IntRangeManager.java @@ -542,6 +542,14 @@ public abstract class IntRangeManager { return finishUpdate(); } + /** + * Returns whether the list of ranges is completely empty. + * @return true if there are no enabled ranges + */ + public boolean isEmpty() { + return mRanges.isEmpty(); + } + /** * Called when the list of enabled ranges has changed. This will be * followed by zero or more calls to {@link #addRange} followed by diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 8aae0d428130..63c22e6d94da 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -1928,7 +1928,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { if (RILJ_LOGD) { riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) - + " with " + numOfConfig + "configs : "); + + " with " + numOfConfig + " configs : "); for (int i = 0; i < numOfConfig; i++) { riljLog(config[i].toString()); } diff --git a/telephony/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java b/telephony/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java index 8d0e5d3eefda..92bf390361a6 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java +++ b/telephony/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java @@ -246,6 +246,8 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager { log("Added cell broadcast subscription for MID range " + startMessageId + " to " + endMessageId + " from client " + client); + setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty()); + return true; } @@ -271,6 +273,8 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager { log("Removed cell broadcast subscription for MID range " + startMessageId + " to " + endMessageId + " from client " + client); + setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty()); + return true; } @@ -301,14 +305,15 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager { /** * Called to indicate the end of a range update started by the * previous call to {@link #startUpdate}. + * @return true if successful, false otherwise */ protected boolean finishUpdate() { if (mConfigList.isEmpty()) { - return setCellBroadcastActivation(false); + return true; } else { SmsBroadcastConfigInfo[] configs = mConfigList.toArray(new SmsBroadcastConfigInfo[mConfigList.size()]); - return setCellBroadcastConfig(configs) && setCellBroadcastActivation(true); + return setCellBroadcastConfig(configs); } } } -- cgit v1.2.3-59-g8ed1b