private void updateLanguagesWithSingleConfig(SmsBroadcastConfigInfo info) {
   int languageBeginIndex = info.getFromCodeScheme();
   int languageEndIndex = info.getToCodeScheme();
   if (languageBeginIndex != -1 && languageBeginIndex != -2) {
     for (int j = languageBeginIndex; j <= languageEndIndex; j++) {
       if (mCellBroadcastAsyncTask.isCancelled()) {
         break;
       }
       CellBroadcastLanguage language = getLanguageObjectFromKey(String.valueOf(j));
       if (language != null) {
         language.setLanguageState(info.isSelected());
       }
     }
   } else {
     MmsLog.d(LOG_TAG, "Select all language!");
     if (languageBeginIndex == -2 && languageEndIndex == -2) {
       for (int i = 0; i < mLanguageList.size(); i++) {
         if (mCellBroadcastAsyncTask.isCancelled()) {
           break;
         }
         CellBroadcastLanguage language = (CellBroadcastLanguage) mLanguageList.get(i);
         CellBroadcastLanguage lang =
             getLanguageObjectFromKey(String.valueOf(language.getLanguageId()));
         if (lang != null) {
           lang.setLanguageState(true);
         }
       }
     }
   }
 }
  private void updateChannelsWithSingleConfig(SmsBroadcastConfigInfo info) {
    int channelBeginIndex = info.getFromServiceId();
    int channelEndIndex = info.getToServiceId();
    boolean state = info.isSelected();
    MmsLog.d(LOG_TAG, "updateChannelsWithSingleConfig STATE = " + state);

    if (channelBeginIndex != -1) {
      for (int j = channelBeginIndex; j <= channelEndIndex; j++) {
        if (mCellBroadcastAsyncTask.isCancelled()) {
          break;
        }
        String jStr = String.valueOf(j);
        CellBroadcastChannel channel = getChannelObjectFromKey(jStr);
        if (channel != null) {
          channel.setChannelState(state);
        } else {
          // add a new channel to dataBase while the channel doesn't exists
          String tName = getString(R.string.cb_default_new_channel_name) + jStr;
          CellBroadcastChannel newChannel = new CellBroadcastChannel(j, tName, state);
          if (!insertChannelToDatabase(newChannel)) {
            showUpdateDBErrorInfoDialog();
          }
          mChannelArray.add(newChannel);
          mChannelMap.put(jStr, newChannel);
        }
      }
    }
  }
 private void initChannelMap() {
   mChannelMap = new HashMap<String, CellBroadcastChannel>();
   int tSize = mChannelArray.size();
   for (int i = 0; i < tSize; i++) {
     if (mCellBroadcastAsyncTask.isCancelled()) {
       break;
     }
     int id = mChannelArray.get(i).getChannelId();
     mChannelMap.put(String.valueOf(id), mChannelArray.get(i));
   }
 }
 private void updateCurrentChannelAndLanguage(ArrayList<SmsBroadcastConfigInfo> list) {
   if (list == null || list.size() == 0) {
     return;
   }
   int number = list.size();
   for (int i = 0; i < number; i++) {
     if (mCellBroadcastAsyncTask.isCancelled()) {
       break;
     }
     SmsBroadcastConfigInfo info = list.get(i);
     updateLanguagesWithSingleConfig(info);
     dumpConfigInfo(info);
     updateChannelsWithSingleConfig(info);
   }
 }