Merge "Fix bug in enabling/disabling SMS cell broadcast activation." into ics-mr0

This commit is contained in:
Jake Hamby
2011-10-27 17:46:32 -07:00
committed by Android (Google) Code Review
3 changed files with 16 additions and 3 deletions

View File

@@ -542,6 +542,14 @@ public abstract class IntRangeManager {
return finishUpdate(); 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 * Called when the list of enabled ranges has changed. This will be
* followed by zero or more calls to {@link #addRange} followed by * followed by zero or more calls to {@link #addRange} followed by

View File

@@ -246,6 +246,8 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
log("Added cell broadcast subscription for MID range " + startMessageId log("Added cell broadcast subscription for MID range " + startMessageId
+ " to " + endMessageId + " from client " + client); + " to " + endMessageId + " from client " + client);
setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty());
return true; return true;
} }
@@ -271,6 +273,8 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
log("Removed cell broadcast subscription for MID range " + startMessageId log("Removed cell broadcast subscription for MID range " + startMessageId
+ " to " + endMessageId + " from client " + client); + " to " + endMessageId + " from client " + client);
setCellBroadcastActivation(!mCellBroadcastRangeManager.isEmpty());
return true; return true;
} }
@@ -301,14 +305,15 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
/** /**
* Called to indicate the end of a range update started by the * Called to indicate the end of a range update started by the
* previous call to {@link #startUpdate}. * previous call to {@link #startUpdate}.
* @return true if successful, false otherwise
*/ */
protected boolean finishUpdate() { protected boolean finishUpdate() {
if (mConfigList.isEmpty()) { if (mConfigList.isEmpty()) {
return setCellBroadcastActivation(false); return true;
} else { } else {
SmsBroadcastConfigInfo[] configs = SmsBroadcastConfigInfo[] configs =
mConfigList.toArray(new SmsBroadcastConfigInfo[mConfigList.size()]); mConfigList.toArray(new SmsBroadcastConfigInfo[mConfigList.size()]);
return setCellBroadcastConfig(configs) && setCellBroadcastActivation(true); return setCellBroadcastConfig(configs);
} }
} }
} }