Skip to content

Commit f044a37

Browse files
author
Jake Hamby
committed
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
1 parent 8d059ac commit f044a37

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

telephony/java/com/android/internal/telephony/IntRangeManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,14 @@ private boolean tryAddSingleRange(int startId, int endId, boolean selected) {
542542
return finishUpdate();
543543
}
544544

545+
/**
546+
* Returns whether the list of ranges is completely empty.
547+
* @return true if there are no enabled ranges
548+
*/
549+
public boolean isEmpty() {
550+
return mRanges.isEmpty();
551+
}
552+
545553
/**
546554
* Called when the list of enabled ranges has changed. This will be
547555
* followed by zero or more calls to {@link #addRange} followed by

telephony/java/com/android/internal/telephony/RIL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message respo
19281928

19291929
if (RILJ_LOGD) {
19301930
riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
1931-
+ " with " + numOfConfig + "configs : ");
1931+
+ " with " + numOfConfig + " configs : ");
19321932
for (int i = 0; i < numOfConfig; i++) {
19331933
riljLog(config[i].toString());
19341934
}

telephony/java/com/android/internal/telephony/gsm/SimSmsInterfaceManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ public boolean enableCellBroadcastRange(int startMessageId, int endMessageId) {
246246
log("Added cell broadcast subscription for MID range " + startMessageId
247247
+ " to " + endMessageId + " from client " + client);
248248

249+
setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty());
250+
249251
return true;
250252
}
251253

@@ -271,6 +273,8 @@ public boolean disableCellBroadcastRange(int startMessageId, int endMessageId) {
271273
log("Removed cell broadcast subscription for MID range " + startMessageId
272274
+ " to " + endMessageId + " from client " + client);
273275

276+
setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty());
277+
274278
return true;
275279
}
276280

@@ -301,14 +305,15 @@ protected void addRange(int startId, int endId, boolean selected) {
301305
/**
302306
* Called to indicate the end of a range update started by the
303307
* previous call to {@link #startUpdate}.
308+
* @return true if successful, false otherwise
304309
*/
305310
protected boolean finishUpdate() {
306311
if (mConfigList.isEmpty()) {
307-
return setCellBroadcastActivation(false);
312+
return true;
308313
} else {
309314
SmsBroadcastConfigInfo[] configs =
310315
mConfigList.toArray(new SmsBroadcastConfigInfo[mConfigList.size()]);
311-
return setCellBroadcastConfig(configs) && setCellBroadcastActivation(true);
316+
return setCellBroadcastConfig(configs);
312317
}
313318
}
314319
}

0 commit comments

Comments
 (0)