Revert "Register both SMS-B and CB channels to support LTE"

This reverts commit cba619c3e8f416683e7b8dc44af9a0e9145b2ad6.

The original change try to turn on cellbroadcast listening on both GSM and CDMA
channels at that same time.Thus some unexpected cellbroadcast message come in.
We plan to revert this change.

Bug:18128785
Change-Id: I3f6ef385659ddf6446f7986746cec61013de1362
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastConfigService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastConfigService.java
index 6119c6a..3569456 100644
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastConfigService.java
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastConfigService.java
@@ -192,9 +192,20 @@
                 int cmasPresident = SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL;
                 int cmasTaiwanPWS = SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE;
 
-                SmsManager manager = SmsManager.getDefault();
+                // set to CDMA broadcast ID rage if phone is in CDMA mode.
                 boolean isCdma = CellBroadcastReceiver.phoneIsCdma();
+                if (isCdma) {
+                    cmasExtremeStart = SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT;
+                    cmasExtremeEnd = cmasExtremeStart;
+                    cmasSevereStart = SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT;
+                    cmasSevereEnd = cmasSevereStart;
+                    cmasAmber = SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY;
+                    cmasTestStart = SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE;
+                    cmasTestEnd = cmasTestStart;
+                    cmasPresident = SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT;
+                }
 
+                SmsManager manager = SmsManager.getDefault();
                 // Check for system property defining the emergency channel ranges to enable
                 String emergencyIdRange = isCdma ?
                         "" : SystemProperties.get(EMERGENCY_BROADCAST_RANGE_GSM);
@@ -216,26 +227,17 @@
                             manager.enableCellBroadcast(
                                     SmsCbConstants.MESSAGE_ID_ETWS_OTHER_EMERGENCY_TYPE);
                         }
-                        //LTE support - Always enable CMAS SMS-B and CB channels irrespective of NW
                         if (enableCmasExtremeAlerts) {
                             manager.enableCellBroadcastRange(cmasExtremeStart, cmasExtremeEnd);
-                            manager.enableCellBroadcast(
-                                    SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT);
                         }
                         if (enableCmasSevereAlerts) {
                             manager.enableCellBroadcastRange(cmasSevereStart, cmasSevereEnd);
-                            manager.enableCellBroadcast(
-                                    SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT);
                         }
                         if (enableCmasAmberAlerts) {
                             manager.enableCellBroadcast(cmasAmber);
-                            manager.enableCellBroadcast(
-                                    SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY);
                         }
                         if (enableCmasTestAlerts) {
                             manager.enableCellBroadcastRange(cmasTestStart, cmasTestEnd);
-                            manager.enableCellBroadcast(
-                                    SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE);
                         }
                         // CMAS Presidential must be on (See 3GPP TS 22.268 Section 6.2).
                         manager.enableCellBroadcast(cmasPresident);
@@ -243,8 +245,6 @@
                             // register Taiwan PWS 4383 also, by default
                             manager.enableCellBroadcast(cmasTaiwanPWS);
                         }
-                        manager.enableCellBroadcast(
-                                SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT);
                     }
                     if (DBG) log("enabled emergency cell broadcast channels");
                 } else {
@@ -264,11 +264,10 @@
                             manager.disableCellBroadcast(
                                     SmsCbConstants.MESSAGE_ID_ETWS_OTHER_EMERGENCY_TYPE);
                         }
-                        //LTE support - Always disable CMAS SMS-B and CB channels irrespective of NW
-                        manager.disableCellBroadcastRange(cmasExtremeStart, cmasTestEnd);
-                        manager.disableCellBroadcastRange(
-                                SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT,
-                                SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE);
+                        manager.disableCellBroadcastRange(cmasExtremeStart, cmasExtremeEnd);
+                        manager.disableCellBroadcastRange(cmasSevereStart, cmasSevereEnd);
+                        manager.disableCellBroadcast(cmasAmber);
+                        manager.disableCellBroadcastRange(cmasTestStart, cmasTestEnd);
 
                         // CMAS Presidential must be on (See 3GPP TS 22.268 Section 6.2).
                         manager.enableCellBroadcast(cmasPresident);
@@ -276,8 +275,6 @@
                             // register Taiwan PWS 4383 also, by default
                             manager.enableCellBroadcast(cmasTaiwanPWS);
                         }
-                        manager.enableCellBroadcast(
-                                SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT);
                     }
                     if (DBG) log("disabled emergency cell broadcast channels");
                 }
@@ -311,23 +308,18 @@
                 if (!enableCmasExtremeAlerts) {
                     if (DBG) Log.d(TAG, "disabling cell broadcast CMAS extreme");
                     manager.disableCellBroadcastRange(cmasExtremeStart, cmasExtremeEnd);
-                    manager.disableCellBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT);
                 }
                 if (!enableCmasSevereAlerts) {
                     if (DBG) Log.d(TAG, "disabling cell broadcast CMAS severe");
                     manager.disableCellBroadcastRange(cmasSevereStart, cmasSevereEnd);
-                    manager.disableCellBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT);
                 }
                 if (!enableCmasAmberAlerts) {
                     if (DBG) Log.d(TAG, "disabling cell broadcast CMAS amber");
                     manager.disableCellBroadcast(cmasAmber);
-                    manager.disableCellBroadcast(
-                            SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY);
                 }
                 if (!enableCmasTestAlerts) {
                     if (DBG) Log.d(TAG, "disabling cell broadcast CMAS test messages");
                     manager.disableCellBroadcastRange(cmasTestStart, cmasTestEnd);
-                    manager.disableCellBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE);
                 }
             } catch (Exception ex) {
                 Log.e(TAG, "exception enabling cell broadcast channels", ex);