AI 144185: Integrate cdma into the main code base.
Wink Saville [Thu, 2 Apr 2009 08:37:03 +0000 (01:37 -0700)]
Automated import of CL 144185

51 files changed:
AndroidManifest.xml
res/layout/sim_ndp.xml
res/values-cs/strings.xml
res/values-de/strings.xml
res/values-es/strings.xml
res/values-fr/strings.xml
res/values-it/strings.xml
res/values-ja/strings.xml
res/values-ko/strings.xml
res/values-nb/strings.xml
res/values-nl/strings.xml
res/values-pl/strings.xml
res/values-ru/strings.xml
res/values-zh-rCN/strings.xml
res/values-zh-rTW/strings.xml
res/values/strings.xml
res/values/styles.xml
res/xml/call_feature_setting.xml
res/xml/cdma_options.xml [new file with mode: 0644]
res/xml/cell_broadcast_sms.xml [new file with mode: 0644]
res/xml/gsm_umts_options.xml [new file with mode: 0644]
res/xml/network_setting.xml
src/com/android/phone/ADNList.java
src/com/android/phone/BluetoothHandsfree.java
src/com/android/phone/CallCard.java
src/com/android/phone/CallFeaturesSetting.java
src/com/android/phone/CallNotifier.java
src/com/android/phone/CdmaOptions.java [new file with mode: 0644]
src/com/android/phone/CellBroadcastSms.java [new file with mode: 0644]
src/com/android/phone/ChangeIccPinScreen.java [moved from src/com/android/phone/ChangeSimPinScreen.java with 92% similarity]
src/com/android/phone/DeleteFdnContactScreen.java
src/com/android/phone/EditFdnContactScreen.java
src/com/android/phone/EnableFdnScreen.java
src/com/android/phone/EnableIccPinScreen.java [moved from src/com/android/phone/EnableSimPinScreen.java with 86% similarity]
src/com/android/phone/FdnList.java
src/com/android/phone/FdnSetting.java
src/com/android/phone/GsmUmtsOptions.java [new file with mode: 0644]
src/com/android/phone/IccMissingPanel.java [moved from src/com/android/phone/SimMissingPanel.java with 89% similarity]
src/com/android/phone/IccNetworkDepersonalizationPanel.java [moved from src/com/android/phone/SimNetworkDepersonalizationPanel.java with 84% similarity]
src/com/android/phone/IccPanel.java [moved from src/com/android/phone/SimPanel.java with 93% similarity]
src/com/android/phone/IccPinUnlockPanel.java [moved from src/com/android/phone/SimPinUnlockPanel.java with 86% similarity]
src/com/android/phone/IccProvider.java [moved from src/com/android/phone/SimProvider.java with 82% similarity]
src/com/android/phone/InCallScreen.java
src/com/android/phone/NetworkSetting.java
src/com/android/phone/NotificationMgr.java
src/com/android/phone/PhoneApp.java
src/com/android/phone/PhoneInterfaceManager.java
src/com/android/phone/PhoneUtils.java
src/com/android/phone/Ringer.java
src/com/android/phone/Settings.java
src/com/android/phone/SimContacts.java

index 5811d40..eb5537b 100644 (file)
@@ -49,7 +49,7 @@
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.WRITE_APN_SETTINGS"/>
+    <uses-permission android:name="android.permission.WRITE_APN_SETTINGS" />
     <uses-permission android:name="android.permission.BROADCAST_SMS"/>
     <uses-permission android:name="android.permission.BROADCAST_WAP_PUSH"/>
 
@@ -57,8 +57,8 @@
                  android:persistent="true"
                  android:label="@string/dialerIconLabel"
                  android:icon="@drawable/ic_launcher_phone">
-            <provider android:name="SimProvider"
-                      android:authorities="sim"
+            <provider android:name="IccProvider"
+                      android:authorities="icc"
                       android:multiprocess="true"
                       android:readPermission="android.permission.READ_CONTACTS"
                       android:writePermission="android.permission.WRITE_CONTACTS" />
         </activity-alias>
 
         <receiver android:name="ProcessOutgoingCallTest" android:exported="false"
-                android:enabled="false">
+            android:enabled="false">
             <intent-filter android:priority="1">
                 <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
         </activity>
 
+        <activity android:name="GsmUmtsOptions"
+            android:label="@string/gsm_umts_options">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="CdmaOptions"
+            android:label="@string/cdma_options">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name="CellBroadcastSms"
+            android:label="@string/cell_broadcast_sms">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+        
         <!-- fdn setting -->
         <activity android:name="FdnSetting" android:label="@string/fdn">
             <intent-filter>
         </activity>
 
         <!-- SIM PIN setting -->
-        <activity android:name="EnableSimPinScreen" android:label="@string/enable_pin">
+        <activity android:name="EnableIccPinScreen" android:label="@string/enable_pin">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
             </intent-filter>
         </activity>
 
-        <activity android:name="ChangeSimPinScreen" android:label="@string/change_pin">
+        <activity android:name="ChangeIccPinScreen" android:label="@string/change_pin">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
         <activity android:name="EditFdnContactScreen">
         </activity>
 
-        <activity android:name="DeleteFdnContactScreen"
-                android:label="@string/delete_fdn_contact">
+        <activity android:name="DeleteFdnContactScreen" 
+        android:label="@string/delete_fdn_contact">
         </activity>
         
         <activity android:name="DataRoamingReenable" android:label="@string/android:dialog_alert_title"
         </service>
     </application>
 </manifest>
+
index 27f16bd..9460ff3 100644 (file)
                 android:paddingRight="20dip"
                 android:layout_centerHorizontal="true" />
 
+        <Button android:id="@+id/ndp_dismiss"
+                android:gravity="center_horizontal"
+                android:text="@string/sim_ndp_dismiss_text"
+                android:layout_marginTop="3dip"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerHorizontal="true"
+                android:layout_below="@+id/ndp_unlock"/>
+
     </LinearLayout>
 
     <LinearLayout android:id="@+id/status_panel"
index d54fe51..b88ebb1 100644 (file)
     <string name="unlock_failed">"Požadavek na odblokování sítě se nezdařil."</string>
     <string name="unlock_success">"Síť byla úspěšně odblokována."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Další nastavení hovorů"</string>
+
     <string name="apn_settings">"Názvy přístupových bodů"</string>
     <string name="settings_label">"Nastavení sítě"</string>
     <string name="voicemail">"Hlasová schránka"</string>
     <string name="voicemail_abbreviated">"HS:"</string>
     <string name="networks">"Síťoví operátoři"</string>
     <string name="call_settings">"Nastavení hovorů"</string>
-    <string name="additional_call_settings">"Další nastavení hovorů"</string>
+
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"ID volajícího"</string>
     <string name="roaming_disable">"Datové služby se mohou připojovat při roamingu"</string>
     <string name="roaming_reenable_message">"Připojení datových služeb bylo přerušeno, protože jste opustili domovskou síť a datové služby při roamingu máte vypnuty."</string>
     <string name="roaming_warning">"Opravdu chcete povolit datové služby při roamingu? Vystavujete se nebezpečí vysokých poplatků."</string>
-    <string name="prefer_2g">"Používat pouze sítě 2G"</string>
-    <string name="prefer_2g_summary">"Šetří baterii"</string>
     <string name="fdn">"Povolená telefonní čísla"</string>
     <string name="manage_fdn_list">"Seznam povolených telefonních čísel"</string>
     <string name="fdn_activation">"Aktivace povolených telefonních čísel"</string>
     <string name="importingSimContacts">"Importování kontaktů z karty SIM"</string>
     <string name="importToFDNfromContacts">"Import z kontaktů"</string>
 </resources>
+
+
+
index 0403999..571a81f 100644 (file)
     <string name="unlock_failed">"Anfrage für Entsperrung des Netzwerks war nicht erfolgreich."</string>
     <string name="unlock_success">"Entsperrung des Netzwerks nicht erfolgreich."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Zusätzliche Einstellungen"</string>
+
     <string name="apn_settings">"Zugangspunkte"</string>
     <string name="settings_label">"Netzwerkeinstellungen"</string>
     <string name="voicemail">"Mailbox"</string>
     <string name="voicemail_abbreviated">"MB:"</string>
     <string name="networks">"Netzbetreiber"</string>
     <string name="call_settings">"Anrufeinstellungen"</string>
-    <string name="additional_call_settings">"Zusätzliche Anrufeinst."</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"Anrufer-ID"</string>
     <string name="roaming_disable">"Bei Roaming mit Datendienst verbinden"</string>
     <string name="roaming_reenable_message">"Die Datenkonnektivität wurde unterbrochen, da Sie Ihr Heimnetzwerk verlassen haben und Daten-Roaming nicht aktiviert ist."</string>
     <string name="roaming_warning">"Daten-Roaming zulassen? Es können beträchtliche Roaming-Gebühren anfallen!"</string>
-    <string name="prefer_2g">"Nur 2G-Netzwerke"</string>
-    <string name="prefer_2g_summary">"Energiesparend"</string>
     <string name="fdn">"Beschränkte Rufnummern"</string>
     <string name="manage_fdn_list">"Liste der beschränkten Rufnummern"</string>
     <string name="fdn_activation">"Aktivierung der Nummernbeschränkung"</string>
     <string name="importingSimContacts">"SIM-Kontakte werden importiert"</string>
     <string name="importToFDNfromContacts">"Aus Kontakten importieren"</string>
 </resources>
+
+
index 7192965..5efc61d 100644 (file)
     <string name="unlock_failed">"La solicitud de desbloqueo de red no se ha realizado correctamente."</string>
     <string name="unlock_success">"El desbloqueo de red se ha realizado correctamente."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Configuración adicional"</string>
     <string name="apn_settings">"APN"</string>
     <string name="settings_label">"Configuración de red"</string>
     <string name="voicemail">"Buzón de voz"</string>
     <string name="voicemail_abbreviated">"Buzón de voz:"</string>
     <string name="networks">"Operadores de red"</string>
     <string name="call_settings">"Ajustes de llamadas"</string>
-    <string name="additional_call_settings">"Configuración adicional"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"ID del emisor"</string>
     <string name="roaming_disable">"Establecer conexión con servicios de datos en itinerancia"</string>
     <string name="roaming_reenable_message">"Has perdido la conectividad de datos porque has dejado desactivada la itinerancia de datos de tu red doméstica."</string>
     <string name="roaming_warning">"¿Permitir itinerancia de datos? Los costes de itinerancia que deberás asumir pueden ser significativos."</string>
-    <string name="prefer_2g">"Utilizar sólo redes 2G"</string>
-    <string name="prefer_2g_summary">"Ahorra batería"</string>
+
     <string name="fdn">"Marcación fija"</string>
     <string name="manage_fdn_list">"Lista de FDN"</string>
     <string name="fdn_activation">"Activación de FDN"</string>
     <string name="importingSimContacts">"Importando contactos de tarjeta SIM..."</string>
     <string name="importToFDNfromContacts">"Importar de contactos"</string>
 </resources>
+
+
index 50b8519..c5550d7 100644 (file)
     <string name="unlock_failed">"Échec de la demande de déblocage du réseau."</string>
     <string name="unlock_success">"Le réseau a bien été débloqué."</string>
     <string name="imei">"IIEM"</string>
-    <string name="labelMore">"Paramètres d\'appel supplémentaires"</string>
     <string name="apn_settings">"Noms des points d\'accès"</string>
     <string name="settings_label">"Paramètres du réseau"</string>
     <string name="voicemail">"Messagerie vocale"</string>
     <string name="voicemail_abbreviated">"MV :"</string>
     <string name="networks">"Opérateur de réseau"</string>
     <string name="call_settings">"Paramètres d\'appel"</string>
-    <string name="additional_call_settings">"Paramètres supplémentaires"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"Identifiant d\'appelant"</string>
     <string name="roaming_disable">"Se connecter aux services de données lors de l\'itinérance"</string>
     <string name="roaming_reenable_message">"Vous avez été déconnecté car vous avez quitté votre réseau alors que l\'itinérance des données était désactivée."</string>
     <string name="roaming_warning">"Autoriser l\'itinérance des données ? Des frais d\'itinérance importants peuvent s\'appliquer !"</string>
-    <string name="prefer_2g">"Uniquement les réseaux 2G"</string>
-    <string name="prefer_2g_summary">"Économise la batterie"</string>
+
     <string name="fdn">"Numéros autorisés"</string>
     <string name="manage_fdn_list">"Liste de numéros autorisés"</string>
     <string name="fdn_activation">"Activation des numéros autorisés"</string>
     <string name="importingSimContacts">"Importation des contacts SIM"</string>
     <string name="importToFDNfromContacts">"Importer à partir des contacts"</string>
 </resources>
+
+
index 7a1536f..1516da5 100644 (file)
     <string name="unlock_failed">"Richiesta di sblocco della rete respinta."</string>
     <string name="unlock_success">"Sblocco della rete riuscito."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Altre impostazioni"</string>
     <string name="apn_settings">"Nomi punti di accesso"</string>
     <string name="settings_label">"Impostazioni di rete"</string>
     <string name="voicemail">"Segreteria"</string>
     <string name="voicemail_abbreviated">"ST:"</string>
     <string name="networks">"Operatori di rete"</string>
     <string name="call_settings">"Impostazioni chiamate"</string>
-    <string name="additional_call_settings">"Altre impostazioni chiamate"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"ID chiamante"</string>
     <string name="roaming_disable">"Connessione a servizi di dati in roaming"</string>
     <string name="roaming_reenable_message">"Connettività dati persa: hai lasciato la rete del tuo operatore con il roaming dati disattivato."</string>
     <string name="roaming_warning">"Consentire il roaming dati? I costi potrebbero essere elevati."</string>
-    <string name="prefer_2g">"Usa solo reti 2G"</string>
-    <string name="prefer_2g_summary">"Risparmia batteria"</string>
     <string name="fdn">"Numeri di selezione fissa"</string>
     <string name="manage_fdn_list">"Elenco FDN"</string>
     <string name="fdn_activation">"Attivazione FDN"</string>
     <string name="importingSimContacts">"Importazione contatti SIM"</string>
     <string name="importToFDNfromContacts">"Importa da contatti"</string>
 </resources>
+
index ef31742..f50b7de 100644 (file)
     <string name="unlock_failed">"ネットワークロックを解除できませんでした。"</string>
     <string name="unlock_success">"ネットワークロックを解除しました。"</string>
     <string name="imei">"IMEI(端末識別番号)"</string>
-    <string name="labelMore">"その他の通話設定"</string>
     <string name="apn_settings">"アクセスポイント名"</string>
     <string name="settings_label">"ネットワーク設定"</string>
     <string name="voicemail">"ボイスメール"</string>
     <string name="voicemail_abbreviated">"VM:"</string>
     <string name="networks">"ネットワークオペレーター"</string>
     <string name="call_settings">"通話設定"</string>
-    <string name="additional_call_settings">"その他の通話設定"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"発信者番号"</string>
     <string name="roaming_disable">"ローミング時にデータサービスに接続する"</string>
     <string name="roaming_reenable_message">"データローミングをオフにしてホームネットワークを離れたため、データ接続が切断されました。"</string>
     <string name="roaming_warning">"データローミングを許可すると、ローミング料金が発生する場合があります。"</string>
-    <string name="prefer_2g">"2Gネットワークのみ使用"</string>
-    <string name="prefer_2g_summary">"節電"</string>
     <string name="fdn">"発信番号制限"</string>
     <string name="manage_fdn_list">"発信番号制限リスト"</string>
     <string name="fdn_activation">"発信番号制限の有効化"</string>
     <string name="importingSimContacts">"SIMの連絡先をインポート中"</string>
     <string name="importToFDNfromContacts">"連絡先からインポート"</string>
 </resources>
+
+
+
index 6befa63..4f2382b 100644 (file)
     <string name="unlock_failed">"네트워크 잠금해제 요청이 실패했습니다."</string>
     <string name="unlock_success">"네트워크 잠금해제 성공"</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"추가 통화 설정"</string>
+
     <string name="apn_settings">"액세스포인트 이름"</string>
     <string name="settings_label">"네트워크 설정"</string>
     <string name="voicemail">"음성메일"</string>
     <string name="voicemail_abbreviated">"VM:"</string>
     <string name="networks">"네트워크 운영자"</string>
     <string name="call_settings">"통화 설정"</string>
-    <string name="additional_call_settings">"추가 통화 설정"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"발신자 번호"</string>
     <string name="roaming_disable">"로밍할 때 데이터 서비스에 연결"</string>
     <string name="roaming_reenable_message">"데이터 로밍을 해제한 상태에서 홈 네트워크를 벗어났으므로 데이터 연결이 끊어졌습니다."</string>
     <string name="roaming_warning">"데이터 로밍을 허용하시겠습니까? 많은 로밍 요금이 부과될 수 있습니다."</string>
-    <string name="prefer_2g">"2G 네트워크만 사용"</string>
-    <string name="prefer_2g_summary">"배터리 절약"</string>
     <string name="fdn">"FDN(전화걸 수 있는 번호)"</string>
     <string name="manage_fdn_list">"FDN 목록"</string>
     <string name="fdn_activation">"FDN 활성화"</string>
     <string name="importingSimContacts">"SIM 연락처 가져오는 중"</string>
     <string name="importToFDNfromContacts">"연락처에서 가져오기"</string>
 </resources>
+
index 3086600..de037a7 100644 (file)
     <string name="unlock_failed">"Fikk ikke fjerne operatørlås."</string>
     <string name="unlock_success">"Operatørlåsen er fjernet."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Flere innstillinger"</string>
+
     <string name="apn_settings">"Navn på aksesspunkt"</string>
     <string name="settings_label">"Nettverksinnstillinger"</string>
     <string name="voicemail">"Telefonsvarer"</string>
     <string name="voicemail_abbreviated">"Svarer:"</string>
     <string name="networks">"Nettoperatører"</string>
     <string name="call_settings">"Samtaleinnstillinger"</string>
-    <string name="additional_call_settings">"Flere innstillinger"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"Nummervisning"</string>
     <string name="roaming_disable">"Koble til datatjenester ved roaming"</string>
     <string name="roaming_reenable_message">"Du har mistet datakonnektivitet fordi du har forlatt hjemmenettet ditt med dataroaming slått av."</string>
     <string name="roaming_warning">"Tillat dataroaming? Dette kan koste mye penger!"</string>
-    <string name="prefer_2g">"Bruk kun 2G-nettverk"</string>
-    <string name="prefer_2g_summary">"Sparer batteri"</string>
     <string name="fdn">"Faste nummer"</string>
     <string name="manage_fdn_list">"Liste over faste nummer"</string>
     <string name="fdn_activation">"Aktivering av faste nummer"</string>
     <string name="importingSimContacts">"Importerer kontakter fra SIM-kortet"</string>
     <string name="importToFDNfromContacts">"Importer fra kontakter"</string>
 </resources>
+
index b7d88c6..94ea708 100644 (file)
     <string name="unlock_failed">"Verzoek voor ontgrendelen netwerk mislukt."</string>
     <string name="unlock_success">"Het netwerk is gedeblokkeerd."</string>
     <string name="imei">"IMEI-nummer"</string>
-    <string name="labelMore">"Aanvullende oproepinstellingen"</string>
     <string name="apn_settings">"Namen toegangspunten"</string>
     <string name="settings_label">"Netwerkinstellingen"</string>
     <string name="voicemail">"Voicemail"</string>
     <string name="voicemail_abbreviated">"VM:"</string>
     <string name="networks">"Mobiele providers"</string>
     <string name="call_settings">"Oproepinstellingen"</string>
-    <string name="additional_call_settings">"Aanvullende oproepinstellingen"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"Beller-id"</string>
     <string name="roaming_disable">"Verbinding maken met gegevensservices tijdens roaming"</string>
     <string name="roaming_reenable_message">"De gegevensverbinding is verbroken, omdat u uw thuisnetwerk heeft verlaten terwijl gegevensroaming was uitgeschakeld."</string>
     <string name="roaming_warning">"Gegevensroaming toestaan? Er kunnen hoge roamingkosten in rekening worden gebracht."</string>
-    <string name="prefer_2g">"Alleen 2G-netwerken gebruiken"</string>
-    <string name="prefer_2g_summary">"Energiespaarstand"</string>
     <string name="fdn">"Vaste nummers"</string>
     <string name="manage_fdn_list">"FDN-lijst"</string>
     <string name="fdn_activation">"FDN-activering"</string>
     <string name="importingSimContacts">"SIM-contacten importeren"</string>
     <string name="importToFDNfromContacts">"Importeren uit contacten"</string>
 </resources>
+
index 16d8736..d2588a4 100644 (file)
     <string name="unlock_failed">"Żądanie odblokowania sieci zakończyło się niepowodzeniem."</string>
     <string name="unlock_success">"Sieć została pomyślnie odblokowana."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Dodatkowe ustawienia"</string>
     <string name="apn_settings">"Punkty dostępowe"</string>
     <string name="settings_label">"Ustawienia sieci"</string>
     <string name="voicemail">"Poczta głosowa"</string>
     <string name="voicemail_abbreviated">"Poczta głosowa:"</string>
     <string name="networks">"Operatorzy sieci"</string>
     <string name="call_settings">"Ustawienia połączeń"</string>
-    <string name="additional_call_settings">"Dodatkowe ustawienia"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"ID dzwoniącego"</string>
     <string name="roaming_disable">"Połącz z usługami przesyłu danych podczas roamingu"</string>
     <string name="roaming_reenable_message">"Utracono łączność danych, ponieważ pozostawiono wyłączony roaming danych w sieci macierzystej."</string>
     <string name="roaming_warning">"Czy pozwolić na przesył danych w roamingu? Operator może naliczać wysokie opłaty roamingowe!"</string>
-    <string name="prefer_2g">"Używaj tylko sieci 2G"</string>
-    <string name="prefer_2g_summary">"Oszczędza baterię"</string>
+
     <string name="fdn">"Ustalone numery"</string>
     <string name="manage_fdn_list">"Ustalone numery (FDN)"</string>
     <string name="fdn_activation">"Aktywacja usługi ustalnych numerów (FDN)"</string>
     <string name="importingSimContacts">"Importowanie kontaktów z karty SIM"</string>
     <string name="importToFDNfromContacts">"Importuj z Kontaktów"</string>
 </resources>
+
index 0887f52..4cb9f4f 100644 (file)
     <string name="unlock_failed">"Выполнить запрос на разблокирование сети не удалось."</string>
     <string name="unlock_success">"Сеть успешно разблокирована."</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"Дополнительные настройки вызовов"</string>
+
     <string name="apn_settings">"Названия точек доступа"</string>
     <string name="settings_label">"Настройки сети"</string>
     <string name="voicemail">"Голосовая почта"</string>
     <string name="voicemail_abbreviated">"Голосовая почта:"</string>
     <string name="networks">"Операторы сети"</string>
     <string name="call_settings">"Настройки вызовов"</string>
-    <string name="additional_call_settings">"Дополнительные настройки вызовов"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"Идентификатор звонящего"</string>
     <string name="roaming_disable">"Подключаться для передачи данных в роуминге"</string>
     <string name="roaming_reenable_message">"Подключение для передачи данных прервано. Вы покинули домашнюю сеть, не включив роуминг для передачи данных."</string>
     <string name="roaming_warning">"Разрешить передачу данных в роуминге? Это очень дорого!"</string>
-    <string name="prefer_2g">"Использовать только сети 2G"</string>
-    <string name="prefer_2g_summary">"Экономит заряд батареи"</string>
     <string name="fdn">"Номера с фиксированным набором"</string>
     <string name="manage_fdn_list">"Список номеров с фиксированным набором"</string>
     <string name="fdn_activation">"Активация фиксированного набора"</string>
     <string name="importingSimContacts">"Идет импорт контактов с SIM-карты"</string>
     <string name="importToFDNfromContacts">"Импортировать из контактов"</string>
 </resources>
+
index 24772dd..20982d4 100644 (file)
     <string name="unlock_failed">"网络解锁请求失败。"</string>
     <string name="unlock_success">"网络解锁成功。"</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"其他通话设置"</string>
+
     <string name="apn_settings">"接入点名称"</string>
     <string name="settings_label">"网络设置"</string>
     <string name="voicemail">"语音信箱"</string>
     <string name="voicemail_abbreviated">"VM:"</string>
     <string name="networks">"网络运营商"</string>
     <string name="call_settings">"通话设置"</string>
-    <string name="additional_call_settings">"其他通话设置"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"呼叫者 ID"</string>
     <string name="roaming_disable">"漫游时连接至数据服务"</string>
     <string name="roaming_reenable_message">"您已断开数据连接,因为您离开了主网络并关闭了数据漫游。"</string>
     <string name="roaming_warning">"是否允许数据漫游?您可能需要支付高额的漫游费!"</string>
-    <string name="prefer_2g">"仅使用 2G 网络"</string>
-    <string name="prefer_2g_summary">"节约电量"</string>
     <string name="fdn">"固定拨号"</string>
     <string name="manage_fdn_list">"FDN 列表"</string>
     <string name="fdn_activation">"FDN 激活"</string>
     <string name="importingSimContacts">"正在导入 SIM 卡联系人"</string>
     <string name="importToFDNfromContacts">"从联系人导入"</string>
 </resources>
+
index bb1cfee..eccda87 100644 (file)
     <string name="unlock_failed">"網路解鎖失敗。"</string>
     <string name="unlock_success">"網路解鎖成功。"</string>
     <string name="imei">"IMEI"</string>
-    <string name="labelMore">"其他通話設定"</string>
+
     <string name="apn_settings">"存取點名稱 (APN)"</string>
     <string name="settings_label">"網路設定"</string>
     <string name="voicemail">"語音信箱"</string>
     <string name="voicemail_abbreviated">"語音信箱:"</string>
     <string name="networks">"電信業者"</string>
     <string name="call_settings">"通話設定"</string>
-    <string name="additional_call_settings">"其他通話設定"</string>
     <!-- no translation found for labelNwService (4699970172021870983) -->
     <skip />
     <string name="labelCallerId">"本機號碼"</string>
     <string name="roaming_disable">"漫遊時連線到資料服務"</string>
     <string name="roaming_reenable_message">"由於您離開主要網路時關閉了資料漫遊,目前資料連線已中斷。"</string>
     <string name="roaming_warning">"是否允許資料漫遊?您可能會支付許多漫遊費用!"</string>
-    <string name="prefer_2g">"只使用 2G 網路"</string>
-    <string name="prefer_2g_summary">"節省電力"</string>
     <string name="fdn">"限制撥號號碼"</string>
     <string name="manage_fdn_list">"限制撥號號碼清單"</string>
     <string name="fdn_activation">"啟用限制撥號號碼"</string>
     <string name="importingSimContacts">"匯入 SIM 聯絡人"</string>
     <string name="importToFDNfromContacts">"從通訊錄匯入"</string>
 </resources>
+
index 6b87678..778d5ce 100644 (file)
@@ -13,7 +13,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <!-- Launcher labels -->
     <!-- Tab title -->
 
     <!-- settings strings -->
 
-    <!-- Call settings screen, setting option name -->
-    <string name="labelMore">Additional call settings</string>
+    <!-- GSM Call settings screen, setting option name -->
+    <string name="labelGSMMore">GSM call settings</string>
+    <!-- CDM Call settings screen, setting option name -->
+    <string name="labelCDMAMore">CDMA call settings</string>
     <!-- Mobile network settings screen, setting option name -->
     <string name="apn_settings">Access Point Names</string>
     <!-- Label for the "Network settings" screen in the Settings UI -->
     <string name="networks">Network operators</string>
     <!-- Call settings screen title -->
     <string name="call_settings">Call settings</string>
-    <!-- Call settings screen, setting option name -->
-    <string name="additional_call_settings">Additional call settings</string>
-    <!-- Call settings screen, network service setting name -->
+    <!-- GSM Call settings screen, setting option name -->
+    <string name="additional_gsm_call_settings">Additional GSM call settings</string>
+    <!-- GSM-only Call settings screen, setting option name-->
+    <string name="sum_gsm_call_settings">Additional GSM only call settings</string>
+    <!-- CDMA Call settings screen, setting option name -->
+    <string name="additional_cdma_call_settings">Additional CDMA call settings</string>
+    <!-- CDMA-only Call settings screen, setting option name-->
+    <string name="sum_cdma_call_settings">Additional CDMA only call settings</string>
+    <!-- Call setting screen, nework service setting name -->
     <string name="labelNwService">Network service settings</string>
     <!-- Call settings screen, setting option name -->
     <string name="labelCallerId">Caller ID</string>
     <string name="select_automatically">Select automatically</string>
     <!-- Available networks screen, setting summary text -->
     <string name="sum_select_automatically">Automatically select preferred network</string>
-    <!-- Available networks screen, toast when registering automatically -->
-    <string name="register_automatically">Registering automatically\u2026</string>
-
-    <!-- Data roaming settings -->
+    <string name="register_automatically">Automatic registration...</string>
+    <string name="preferred_network_mode_title">Network Mode</string>
+    <string name="preferred_network_mode_summary">Change the network operating mode</string>
+    <string name="preferred_network_mode_dialogtitle">Preferred network mode</string>
+    <string-array name="preferred_network_mode_choices">
+        <item>Global</item>
+        <item>CDMA only</item>
+        <item>GSM/UMTS only</item>
+    </string-array>
+    <string-array name="preferred_network_mode_values">
+        <item>"7"</item>
+        <item>"4"</item>
+        <item>"3"</item>
+    </string-array>
     <!-- Mobile network settings screen, setting check box name -->
     <string name="roaming">Data roaming</string>
     <!-- Mobile network settings screen, setting summary text when check box is selected -->
     <string name="roaming_reenable_message">You have lost data connectivity because you left your home network with data roaming turned off.</string>
     <!-- Mobile network settings screen, dialog message when user selects the Data roaming check box -->
     <string name="roaming_warning">Allow data roaming? You may incur significant roaming charges!</string>
-    <!-- Mobile network settings screen, setting option name -->
-    <string name="prefer_2g">Use only 2G networks</string>
-    <!-- Mobile network settings screen, setting summary text -->
-    <string name="prefer_2g_summary">Saves battery</string>
+    <string name="gsm_umts_options">GSM/UMTS Options</string>
+    <string name="cdma_options">CDMA Options</string>
+    
+    <!-- Cell broadcast SMS strings -->
+    <string name="cdma_cell_broadcast_sms">Cell Broadcast SMS</string>
+    
+    <string name="cell_broadcast_sms">Cell Broadcast SMS</string>
+    
+    <string name="enable_disable_cell_bc_sms">Cell Broadcast SMS</string>
+    <string name="cell_bc_sms_enable">Cell Broadcast SMS enabled</string>
+    <string name="cell_bc_sms_disable">Cell Broadcast SMS disabled</string>
+    
+    <string name="cb_sms_settings">Cell Broadcast SMS settings</string>
+    
+    <string name="enable_disable_emergency_broadcast">Emergency Broadcast</string>
+    <string name="emergency_broadcast_enable">Emergency Broadcast enabled</string>
+    <string name="emergency_broadcast_disable">Emergency Broadcast disabled</string>
+    
+    <string name="enable_disable_administrative">Administrative</string>
+    <string name="administrative_enable">Administrative enabled</string>
+    <string name="administrative_disable">Administrative disabled</string>
+    
+    <string name="enable_disable_maintenance">Maintenance</string>
+    <string name="maintenance_enable">Maintenance enabled</string>
+    <string name="maintenance_disable">Maintenance disabled</string>
+    
+    <string name="general_news_settings">General News</string>
+    <string name="bf_news_settings">Business and Financial News</string>
+    <string name="sports_news_settings">Sports News</string>
+    <string name="entertainment_news_settings">Entertainment News</string>
+
+    <string name="enable_disable_local">Local</string>
+    <string name="local_enable">Local news enabled</string>
+    <string name="local_disable">Local news disabled</string>
+    
+    <string name="enable_disable_regional">Regional</string>
+    <string name="regional_enable">Regional news enabled</string>
+    <string name="regional_disable">Regional news disabled</string>
+    
+    <string name="enable_disable_national">National</string>
+    <string name="national_enable">National news enabled</string>
+    <string name="national_disable">National news disabled</string>
+    
+    <string name="enable_disable_international">International</string>
+    <string name="international_enable">International news enabled</string>
+    <string name="international_disable">International news disabled</string>
+   
+    <string name="list_language_title">Language</string>
+    <string name="list_language_summary">Select the news language</string>
+    <string-array name="list_language_entries">
+        <item>English</item>
+        <item>French</item>
+        <item>Spanish</item>
+        <item>Japanese</item>
+        <item>Korean</item>
+        <item>Chinese</item>
+        <item>Hebrew</item>
+    </string-array>
+    <string-array name="list_language_values">
+        <item>"1"</item>
+        <item>"2"</item>
+        <item>"3"</item>
+        <item>"4"</item>
+        <item>"5"</item>
+        <item>"6"</item>
+        <item>"7"</item>
+    </string-array>
+    <string name="list_language_dtitle">Languages</string>
+
+    <string name="enable_disable_local_weather">Local Weather</string>
+    <string name="local_weather_enable">Local Weather enabled</string>
+    <string name="local_weather_disable">Local Weather disabled</string>
+    
+    <string name="enable_disable_atr">Area Traffic Reports</string>
+    <string name="atr_enable">Area Traffic Reports enabled</string>
+    <string name="atr_disable">Area Traffic Reports disabled</string>
+    
+    <string name="enable_disable_lafs">Local Airport Flight Schedules</string>
+    <string name="lafs_enable">Local Airport Flight Schedules enabled</string>
+    <string name="lafs_disable">Local Airport Flight Schedules disabled</string>
+    
+    <string name="enable_disable_restaurants">Restaurants</string>
+    <string name="restaurants_enable">Restaurants enabled</string>
+    <string name="restaurants_disable">Restaurants disabled</string>
+    
+    <string name="enable_disable_lodgings">Lodgings</string>
+    <string name="lodgings_enable">Lodgings enabled</string>
+    <string name="lodgings_disable">Lodgings disabled</string>
+    
+    <string name="enable_disable_retail_directory">Retail Directory</string>
+    <string name="retail_directory_enable">Retail Directory enabled</string>
+    <string name="retail_directory_disable">Retail Directory disabled</string>
+    
+    <string name="enable_disable_advertisements">Advertisements</string>
+    <string name="advertisements_enable">Advertisements enabled</string>
+    <string name="advertisements_disable">Advertisements disabled</string>
+    
+    <string name="enable_disable_stock_quotes">Stock Quotes</string>
+    <string name="stock_quotes_enable">Stock Quotes enabled</string>
+    <string name="stock_quotes_disable">Stock Quotes disabled</string>
+    
+    <string name="enable_disable_eo">Employment Opportunities</string>
+    <string name="eo_enable">Employment Opportunities enabled</string>
+    <string name="eo_disable">Employment Opportunities disabled</string>
+    
+    <string name="enable_disable_mhh">Medical, Health and Hospital</string>
+    <string name="mhh_enable">Medical, Health and Hospital enabled</string>
+    <string name="mhh_disable">Medical, Health and Hospital disabled</string>
+    
+    <string name="enable_disable_technology_news">Technology News</string>
+    <string name="technology_news_enable">Technology News enabled</string>
+    <string name="technology_news_disable">Technology News disabled</string>
+    
+    <string name="enable_disable_multi_category">Multi-category</string>
+    <string name="multi_category_enable">Multi-category enabled</string>
+    <string name="multi_category_disable">Multi-category disabled</string>
+
+    <!-- GSM/UMTS Options strings -->
+    <string name="gsm_umts_network_preferences_title">GSM/UMTS Network Preferences</string>
+    <string name="gsm_umts_network_preferneces_summary">Not implemented yet! </string>
+    <string name="gsm_umts_network_preferences_dialogtitle">GSM/UMTS network preferences</string>
+    <string-array name="gsm_umts_network_preferences_choices">
+        <item>GSM/WCDMA (auto mode)</item>
+        <item>WCDMA only</item>
+        <item>GSM only</item>
+        <item>GSM/WCDA (WCDMA preferred)</item>
+    </string-array>
+    <string-array name="gsm_umts_network_preferences_values">
+        <item>"0"</item>
+        <item>"1"</item>
+        <item>"2"</item>
+        <item>"3"</item>
+    </string-array>
+    <!-- CDMA Options strings --> 
+    <string name="cdma_roaming_mode_title">CDMA Roaming Mode</string>
+    <string name="cdma_roaming_mode_summary">Change the cdma roaming mode</string>
+    <string name="cdma_roaming_mode_dialogtitle">CDMA roaming mode</string>
+    <string-array name="cdma_roaming_mode_choices">
+        <item>Home Networks only</item>
+        <item>Affiliated Networks</item>
+        <item>Any Network</item>
+    </string-array>
+    <string-array name="cdma_roaming_mode_values">
+        <item>"0"</item>
+        <item>"1"</item>
+        <item>"2"</item>
+    </string-array>
+    <string name="cdma_network_preferences_title">CDMA Network Preferences</string>
+    <string name="cdma_network_preferneces_summary">Not implemented yet! </string>
+    <string name="cdma_network_preferences_dialogtitle">CDMA network preferences</string>
+    <string-array name="cdma_network_preferences_choices">
+        <item>CDMA/EvDo</item>
+        <item>CDMA only</item>
+        <item>EvDo only</item>
+    </string-array>
+    <string-array name="cdma_network_preferences_values">
+        <item>"0"</item>
+        <item>"1"</item>
+        <item>"2"</item>
+    </string-array>
+    <string name="subscription_title">CDMA Subscription TEST</string>
+    <string name="subscription_summary">Change between RUIM/SIM and NV</string>
+    <string name="subscription_dialogtitle">subscription</string>
+    <string-array name="subscription_choices">
+        <item>RUIM/SIM</item>
+        <item>NV</item>
+    </string-array>
+    <string-array name="subscription_values">
+        <item>"0"</item>
+        <item>"1"</item>
+    </string-array>   
 
     <!-- FDN settings strings -->
     <!-- Call settings screen, setting option name -->
     <string name="sum_fdn_change_pin">Change PIN for FDN access</string>
     <!-- Call settings, FDN screen, setting option name -->
     <string name="sum_fdn_manage_list">Manage phone number list</string>
+    <string name="voice_privacy">Voice Privacy</string>
+    <string name="voice_privacy_summary">Enable enhanced privacy mode</string>
+    <string name="tty_mode_title">TTY mode</string>
+    <string name="tty_mode_summary">Enable TTY mode</string>
 
     <!-- FDN list screen: menu item label -->
     <string name="menu_add">Add contact</string>
     <string name="importToFDNfromContacts">Import from contacts</string>
 
 </resources>
+
+
index a377d99..7729c67 100644 (file)
@@ -24,7 +24,7 @@
         <item name="android:windowBackground">@null</item>
     </style>
 
-    <style name="SimPanel">
+    <style name="IccPanel">
         <item name="android:windowFrame">@null</item>
         <item name="android:windowBackground">@drawable/grayBg</item>
     </style>
index a5cb1a5..2bdb741 100644 (file)
         android:singleLine="true"
         android:autoText="false"/>
         
+    
     <!-- Rearranged to allow for lazy queries. -->
     <PreferenceScreen
-        android:key="button_cf_expand_key"
-        android:title="@string/labelCF"
+        android:key="button_gsm_more_expand_key"
+        android:title="@string/labelGSMMore"
+        android:summary="@string/sum_gsm_call_settings"
         android:persistent="false">
-
-        <PreferenceCategory
-            android:title="@string/call_forwarding_settings"/>
         
-        <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
-        <com.android.phone.EditPhoneNumberPreference 
-            android:key="button_cfu_key" 
-            android:title="@string/labelCFU"
-            android:persistent="false"
-            android:summaryOn="@string/sum_cfu_enabled"
-            android:summaryOff="@string/sum_cfu_disabled"
-            android:dialogTitle="@string/labelCFU"
-            phone:confirmMode="activation"
-            android:singleLine="true"
-            android:autoText="false"/>
-    
-        <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
-        <com.android.phone.EditPhoneNumberPreference 
-            android:key="button_cfb_key" 
-            android:title="@string/labelCFB"
-            android:persistent="false"
-            android:summaryOn="@string/sum_cfb_enabled"
-            android:summaryOff="@string/sum_cfb_disabled"
-            android:dialogTitle="@string/labelCFB"
-            phone:confirmMode="activation"
-            android:singleLine="true"
-            android:autoText="false"/>
-            
-        <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
-        <com.android.phone.EditPhoneNumberPreference 
-            android:key="button_cfnry_key" 
-            android:title="@string/labelCFNRy"
-            android:persistent="false"
-            android:summaryOn="@string/sum_cfnry_enabled"
-            android:summaryOff="@string/sum_cfnry_disabled"
-            android:dialogTitle="@string/labelCFNRy"
-            phone:confirmMode="activation"
-            android:singleLine="true"
-            android:autoText="false"/>
+        <PreferenceCategory
+            android:title="@string/additional_gsm_call_settings"/>
+
+        <!-- Rearranged to allow for lazy queries. -->
+        <PreferenceScreen
+            android:key="button_cf_expand_key"
+            android:title="@string/labelCF"
+            android:persistent="false">
     
-        <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
-        <com.android.phone.EditPhoneNumberPreference 
-            android:key="button_cfnrc_key" 
-            android:title="@string/labelCFNRc"
-            android:persistent="false"
-            android:summaryOn="@string/sum_cfnrc_enabled"
-            android:summaryOff="@string/sum_cfnrc_disabled"
-            android:dialogTitle="@string/labelCFNRc"
-            phone:confirmMode="activation"
-            android:singleLine="true"
-            android:autoText="false"/>
+            <PreferenceCategory
+                android:title="@string/call_forwarding_settings"/>
             
-    </PreferenceScreen>
-    
-    <!-- Rearranged to allow for lazy queries. -->
-    <PreferenceScreen
-        android:key="button_more_expand_key"
-        android:title="@string/labelMore"
-        android:persistent="false">
+            <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
+            <com.android.phone.EditPhoneNumberPreference 
+                android:key="button_cfu_key" 
+                android:title="@string/labelCFU"
+                android:persistent="false"
+                android:summaryOn="@string/sum_cfu_enabled"
+                android:summaryOff="@string/sum_cfu_disabled"
+                android:dialogTitle="@string/labelCFU"
+                phone:confirmMode="activation"
+                android:singleLine="true"
+                android:autoText="false"/>
         
-        <PreferenceCategory
-            android:title="@string/additional_call_settings"/>
+            <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
+            <com.android.phone.EditPhoneNumberPreference 
+                android:key="button_cfb_key" 
+                android:title="@string/labelCFB"
+                android:persistent="false"
+                android:summaryOn="@string/sum_cfb_enabled"
+                android:summaryOff="@string/sum_cfb_disabled"
+                android:dialogTitle="@string/labelCFB"
+                phone:confirmMode="activation"
+                android:singleLine="true"
+                android:autoText="false"/>
+                
+            <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
+            <com.android.phone.EditPhoneNumberPreference 
+                android:key="button_cfnry_key" 
+                android:title="@string/labelCFNRy"
+                android:persistent="false"
+                android:summaryOn="@string/sum_cfnry_enabled"
+                android:summaryOff="@string/sum_cfnry_disabled"
+                android:dialogTitle="@string/labelCFNRy"
+                phone:confirmMode="activation"
+                android:singleLine="true"
+                android:autoText="false"/>
+        
+            <!-- See note on com.android.phone.EditPhoneNumberPreference above -->
+            <com.android.phone.EditPhoneNumberPreference 
+                android:key="button_cfnrc_key" 
+                android:title="@string/labelCFNRc"
+                android:persistent="false"
+                android:summaryOn="@string/sum_cfnrc_enabled"
+                android:summaryOff="@string/sum_cfnrc_disabled"
+                android:dialogTitle="@string/labelCFNRc"
+                phone:confirmMode="activation"
+                android:singleLine="true"
+                android:autoText="false"/>
+                
+        </PreferenceScreen>
 
         <ListPreference
             android:key="button_clir_key" 
             android:persistent="false"
             android:summaryOn="@string/sum_cw_enabled"
             android:summaryOff="@string/sum_cw_disabled"/>
-            
+           
     </PreferenceScreen>
-        
-    <PreferenceScreen 
-        android:key="button_carrier_sel_key" 
-        android:title="@string/networks"
-        android:summary="@string/sum_carrier_select"
+
+    <!-- Rearranged to allow for lazy queries. -->
+    <PreferenceScreen
+        android:key="button_cdma_more_expand_key"
+        android:title="@string/labelCDMAMore"
+        android:summary="@string/sum_cdma_call_settings"
         android:persistent="false">
         
-        <intent android:action="android.intent.action.MAIN"
-            android:targetPackage="com.android.phone"
-            android:targetClass="com.android.phone.NetworkSetting" />
-        
+        <PreferenceCategory
+            android:title="@string/additional_cdma_call_settings"/>
+            
+        <CheckBoxPreference 
+            android:key="button_voice_privacy_key"
+            android:title="@string/voice_privacy"
+            android:persistent="false"
+            android:summary="@string/voice_privacy_summary"/>
+            
+        <CheckBoxPreference 
+            android:key="button_tty_mode_key"
+            android:title="@string/tty_mode_title"
+            android:persistent="true"
+            android:summary="@string/tty_mode_summary"/>
+            
     </PreferenceScreen>
-    
+                    
+
 </PreferenceScreen>
diff --git a/res/xml/cdma_options.xml b/res/xml/cdma_options.xml
new file mode 100644 (file)
index 0000000..ac8299a
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.phone">
+        
+    <PreferenceCategory 
+        android:title="@string/cdma_options" />
+            
+    <ListPreference 
+        android:key="cdma_roaming_mode_key"
+        android:title="@string/cdma_roaming_mode_title"
+        android:summary="@string/cdma_roaming_mode_summary"
+        android:entries="@array/cdma_roaming_mode_choices"
+        android:entryValues="@array/cdma_roaming_mode_values"
+        android:dialogTitle="@string/cdma_roaming_mode_dialogtitle" />
+        
+    <ListPreference 
+        android:key="subscription_key"
+        android:title="@string/subscription_title"
+        android:summary="@string/subscription_summary"
+        android:entries="@array/subscription_choices"
+        android:entryValues="@array/subscription_values"
+        android:dialogTitle="@string/subscription_dialogtitle" />
+       
+    <PreferenceScreen 
+        android:key="cdma_cell_broadcast_sms_key" 
+        android:title="@string/cdma_cell_broadcast_sms"
+        android:persistent="false">
+        
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.phone"
+            android:targetClass="com.android.phone.CellBroadcastSms" />
+    </PreferenceScreen>
+
+</PreferenceScreen>   
diff --git a/res/xml/cell_broadcast_sms.xml b/res/xml/cell_broadcast_sms.xml
new file mode 100644 (file)
index 0000000..4b36d52
--- /dev/null
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.phone">
+        
+    <PreferenceCategory 
+        android:title="@string/cell_broadcast_sms">
+            
+    <CheckBoxPreference 
+        android:key="button_enable_disable_cell_bc_sms" 
+        android:title="@string/enable_disable_cell_bc_sms"
+        android:persistent="false"
+        android:summaryOn="@string/cell_bc_sms_enable"
+        android:summaryOff="@string/cell_bc_sms_disable"/>
+    
+    </PreferenceCategory>
+    
+    <PreferenceCategory
+            android:title="@string/cb_sms_settings">
+        
+        <ListPreference
+            android:key="list_language" 
+            android:title="@string/list_language_title"
+            android:summary="@string/list_language_summary"
+            android:entries="@array/list_language_entries"
+            android:entryValues="@array/list_language_values"
+            android:dialogTitle="@string/list_language_dtitle"/>
+            
+        <CheckBoxPreference 
+                android:key="button_emergency_broadcast" 
+                android:title="@string/enable_disable_emergency_broadcast"
+                android:persistent="false"
+                android:summaryOn="@string/emergency_broadcast_enable"
+                android:summaryOff="@string/emergency_broadcast_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_administrative" 
+                android:title="@string/enable_disable_administrative"
+                android:persistent="false"
+                android:summaryOn="@string/administrative_enable"
+                android:summaryOff="@string/administrative_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_maintenance" 
+                android:title="@string/enable_disable_maintenance"
+                android:persistent="false"
+                android:summaryOn="@string/maintenance_enable"
+                android:summaryOff="@string/maintenance_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_local_weather" 
+                android:title="@string/enable_disable_local_weather"
+                android:persistent="false"
+                android:summaryOn="@string/local_weather_enable"
+                android:summaryOff="@string/local_weather_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_atr" 
+                android:title="@string/enable_disable_atr"
+                android:persistent="false"
+                android:summaryOn="@string/atr_enable"
+                android:summaryOff="@string/atr_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_lafs" 
+                android:title="@string/enable_disable_lafs"
+                android:persistent="false"
+                android:summaryOn="@string/lafs_enable"
+                android:summaryOff="@string/lafs_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_restaurants" 
+                android:title="@string/enable_disable_restaurants"
+                android:persistent="false"
+                android:summaryOn="@string/restaurants_enable"
+                android:summaryOff="@string/restaurants_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_lodgings" 
+                android:title="@string/enable_disable_lodgings"
+                android:persistent="false"
+                android:summaryOn="@string/lodgings_enable"
+                android:summaryOff="@string/lodgings_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_retail_directory" 
+                android:title="@string/enable_disable_retail_directory"
+                android:persistent="false"
+                android:summaryOn="@string/retail_directory_enable"
+                android:summaryOff="@string/retail_directory_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_advertisements" 
+                android:title="@string/enable_disable_advertisements"
+                android:persistent="false"
+                android:summaryOn="@string/advertisements_enable"
+                android:summaryOff="@string/advertisements_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_stock_quotes" 
+                android:title="@string/enable_disable_stock_quotes"
+                android:persistent="false"
+                android:summaryOn="@string/stock_quotes_enable"
+                android:summaryOff="@string/stock_quotes_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_eo" 
+                android:title="@string/enable_disable_eo"
+                android:persistent="false"
+                android:summaryOn="@string/eo_enable"
+                android:summaryOff="@string/eo_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_mhh" 
+                android:title="@string/enable_disable_mhh"
+                android:persistent="false"
+                android:summaryOn="@string/mhh_enable"
+                android:summaryOff="@string/mhh_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_technology_news" 
+                android:title="@string/enable_disable_technology_news"
+                android:persistent="false"
+                android:summaryOn="@string/technology_news_enable"
+                android:summaryOff="@string/technology_news_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_multi_category" 
+                android:title="@string/enable_disable_multi_category"
+                android:persistent="false"
+                android:summaryOn="@string/multi_category_enable"
+                android:summaryOff="@string/multi_category_disable"/>
+                
+    </PreferenceCategory>
+    
+    <PreferenceCategory
+            android:title="@string/general_news_settings">
+        
+        <CheckBoxPreference 
+                android:key="button_local_general_news" 
+                android:title="@string/enable_disable_local"
+                android:persistent="false"
+                android:summaryOn="@string/local_enable"
+                android:summaryOff="@string/local_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_regional_general_news" 
+                android:title="@string/enable_disable_regional"
+                android:persistent="false"
+                android:summaryOn="@string/regional_enable"
+                android:summaryOff="@string/regional_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_national_general_news" 
+                android:title="@string/enable_disable_national"
+                android:persistent="false"
+                android:summaryOn="@string/national_enable"
+                android:summaryOff="@string/national_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_international_general_news" 
+                android:title="@string/enable_disable_international"
+                android:persistent="false"
+                android:summaryOn="@string/international_enable"
+                android:summaryOff="@string/international_disable"/>
+        <!--
+        <ListPreference 
+                android:key="list_general_news"
+                android:title="@string/general_news_title"
+                android:summary="@string/general_news_summary"
+                android:entries="@array/general_news_entries"
+                android:entryValues="@array/general_news_entryvalues"
+                android:dialogTitle="@string/general_news_dialogtitle"/> -->
+                
+    </PreferenceCategory>
+    
+    <PreferenceCategory
+            android:title="@string/bf_news_settings">
+        
+        <CheckBoxPreference 
+                android:key="button_local_bf_news" 
+                android:title="@string/enable_disable_local"
+                android:persistent="false"
+                android:summaryOn="@string/local_enable"
+                android:summaryOff="@string/local_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_regional_bf_news" 
+                android:title="@string/enable_disable_regional"
+                android:persistent="false"
+                android:summaryOn="@string/regional_enable"
+                android:summaryOff="@string/regional_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_national_bf_news" 
+                android:title="@string/enable_disable_national"
+                android:persistent="false"
+                android:summaryOn="@string/national_enable"
+                android:summaryOff="@string/national_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_international_bf_news" 
+                android:title="@string/enable_disable_international"
+                android:persistent="false"
+                android:summaryOn="@string/international_enable"
+                android:summaryOff="@string/international_disable"/>
+                
+        <!--    
+        <ListPreference 
+                android:key="list_bf"
+                android:title="@string/bf_news_title"
+                android:summary="@string/bf_news_summary"
+                android:entries="@array/bf_news_entries"
+                android:entryValues="@array/bf_news_entryvalues"
+                android:dialogTitle="@string/bf_news_dialogtitle"/> -->
+    
+    </PreferenceCategory>
+    
+    <PreferenceCategory
+            android:title="@string/sports_news_settings">
+        
+        <CheckBoxPreference 
+                android:key="button_local_sports_news" 
+                android:title="@string/enable_disable_local"
+                android:persistent="false"
+                android:summaryOn="@string/local_enable"
+                android:summaryOff="@string/local_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_regional_sports_news" 
+                android:title="@string/enable_disable_regional"
+                android:persistent="false"
+                android:summaryOn="@string/regional_enable"
+                android:summaryOff="@string/regional_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_national_sports_news" 
+                android:title="@string/enable_disable_national"
+                android:persistent="false"
+                android:summaryOn="@string/national_enable"
+                android:summaryOff="@string/national_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_international_sports_news" 
+                android:title="@string/enable_disable_international"
+                android:persistent="false"
+                android:summaryOn="@string/international_enable"
+                android:summaryOff="@string/international_disable"/>
+                
+        <!--    
+        <ListPreference 
+                android:key="list_sports_news"
+                android:title="@string/sports_news_title"
+                android:summary="@string/sports_news_summary"
+                android:entries="@array/sports_news_entries"
+                android:entryValues="@array/sports_news_entryvalues"
+                android:dialogTitle="@string/sports_news_dialogtitle"/> -->
+                
+    </PreferenceCategory>
+    
+    <PreferenceCategory
+            android:title="@string/entertainment_news_settings">
+        
+        <CheckBoxPreference 
+                android:key="button_local_entertainment_news" 
+                android:title="@string/enable_disable_local"
+                android:persistent="false"
+                android:summaryOn="@string/local_enable"
+                android:summaryOff="@string/local_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_regional_entertainment_news" 
+                android:title="@string/enable_disable_regional"
+                android:persistent="false"
+                android:summaryOn="@string/regional_enable"
+                android:summaryOff="@string/regional_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_national_entertainment_news" 
+                android:title="@string/enable_disable_national"
+                android:persistent="false"
+                android:summaryOn="@string/national_enable"
+                android:summaryOff="@string/national_disable"/>
+                
+        <CheckBoxPreference 
+                android:key="button_international_entertainment_news" 
+                android:title="@string/enable_disable_international"
+                android:persistent="false"
+                android:summaryOn="@string/international_enable"
+                android:summaryOff="@string/international_disable"/>
+                
+        <!--    
+        <ListPreference 
+                android:key="list_entertainment_news"
+                android:title="@string/entertainment_news_title"
+                android:summary="@string/entertainment_news_summary"
+                android:entries="@array/entertainment_news_entries"
+                android:entryValues="@array/entertainment_news_entryvalues"
+                android:dialogTitle="@string/entertainment_news_dialogtitle"/> -->
+                
+    </PreferenceCategory>
+
+</PreferenceScreen>   
diff --git a/res/xml/gsm_umts_options.xml b/res/xml/gsm_umts_options.xml
new file mode 100644 (file)
index 0000000..7c854c6
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:settings="http://schemas.android.com/apk/res/com.android.phone">
+        
+    <PreferenceCategory 
+        android:title="@string/gsm_umts_options" />          
+
+    <PreferenceScreen 
+        android:key="button_apn_key" 
+        android:title="@string/apn_settings"
+        android:persistent="false">
+        
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.settings"
+            android:targetClass="com.android.settings.ApnSettings" />
+            
+    </PreferenceScreen>
+           
+    <PreferenceScreen 
+        android:key="button_carrier_sel_key" 
+        android:title="@string/networks"
+        android:summary="@string/sum_carrier_select"
+        android:persistent="false">
+        
+        <intent android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.phone"
+            android:targetClass="com.android.phone.NetworkSetting" />
+        
+    </PreferenceScreen>
+
+</PreferenceScreen>   
index fb03fe5..9a2d706 100644 (file)
         android:summaryOn="@string/roaming_enable"
         android:summaryOff="@string/roaming_disable"/>
         
-    <CheckBoxPreference 
-        android:key="button_prefer_2g_key" 
-        android:title="@string/prefer_2g"
-        android:persistent="false"
-        android:summary="@string/prefer_2g_summary"/>
+    <ListPreference 
+        android:key="preferred_network_mode_key"
+        android:title="@string/preferred_network_mode_title"
+        android:summary="@string/preferred_network_mode_summary"
+        android:entries="@array/preferred_network_mode_choices"
+        android:entryValues="@array/preferred_network_mode_values"
+        android:dialogTitle="@string/preferred_network_mode_dialogtitle" />
         
     <PreferenceScreen 
-        android:key="button_carrier_sel_key" 
-        android:title="@string/networks"
-        android:summary="@string/sum_carrier_select"
+        android:key="gsm_umts_options_key" 
+        android:title="@string/gsm_umts_options"
         android:persistent="false">
         
         <intent android:action="android.intent.action.MAIN"
             android:targetPackage="com.android.phone"
-            android:targetClass="com.android.phone.NetworkSetting" />
+            android:targetClass="com.android.phone.GsmUmtsOptions" />
         
     </PreferenceScreen>
         
     <PreferenceScreen 
-        android:key="button_apn_key" 
-        android:title="@string/apn_settings"
+        android:key="cdma_options_key" 
+        android:title="@string/cdma_options"
         android:persistent="false">
         
         <intent android:action="android.intent.action.MAIN"
-            android:targetPackage="com.android.settings"
-            android:targetClass="com.android.settings.ApnSettings" />
+            android:targetPackage="com.android.phone"
+            android:targetClass="com.android.phone.CdmaOptions" />
             
     </PreferenceScreen>
         
index 8f8464a..43261ac 100644 (file)
@@ -93,7 +93,7 @@ public class ADNList extends ListActivity {
     protected Uri resolveIntent() {
         Intent intent = getIntent();
         if (intent.getData() == null) {
-            intent.setData(Uri.parse("content://sim/adn"));
+            intent.setData(Uri.parse("content://icc/adn"));
         }
 
         return intent.getData();
index bc37881..8267669 100644 (file)
@@ -367,6 +367,18 @@ public class BluetoothHandsfree {
             mContext.registerReceiver(mStateReceiver, filter);
         }
 
+        private void updateBtPhoneStateAfterRadioTechnologyChange() {
+            if(DBG) Log.d(TAG, "updateBtPhoneStateAfterRadioTechnologyChange...");
+
+            //Unregister all events from the old obsolete phone
+            mPhone.unregisterForServiceStateChanged(mStateChangeHandler);
+            mPhone.unregisterForPhoneStateChanged(mStateChangeHandler);
+
+            //Register all events new to the new active phone
+            mPhone.registerForServiceStateChanged(mStateChangeHandler, SERVICE_STATE_CHANGED, null);
+            mPhone.registerForPhoneStateChanged(mStateChangeHandler, PHONE_STATE_CHANGED, null);
+        }
+
         private boolean sendUpdate() {
             return isHeadsetConnected() && mHeadsetType == TYPE_HANDSFREE && mIndicatorsEnabled;
         }
@@ -748,6 +760,18 @@ public class BluetoothHandsfree {
         mContext.sendBroadcast(intent, android.Manifest.permission.BLUETOOTH);
     }
 
+
+    void updateBtHandsfreeAfterRadioTechnologyChange() {
+        if(DBG) Log.d(TAG, "updateBtHandsfreeAfterRadioTechnologyChange...");
+
+        //Get the Call references from the new active phone again
+        mRingingCall = mPhone.getRingingCall();
+        mForegroundCall = mPhone.getForegroundCall();
+        mBackgroundCall = mPhone.getBackgroundCall();
+
+        mPhoneState.updateBtPhoneStateAfterRadioTechnologyChange();
+    }
+
     /** Request to establish SCO (audio) connection to bluetooth
      * headset/handsfree, if one is connected. Does not block.
      * Returns false if the user has requested audio off, or if there
@@ -1780,3 +1804,6 @@ public class BluetoothHandsfree {
         Log.d(TAG, msg);
     }
 }
+
+
+
index 710f1fa..3ac838d 100644 (file)
@@ -847,7 +847,7 @@ public class CallCard extends FrameLayout
                     resID = R.string.callFailed_powerOff;
                     break;
 
-                case SIM_ERROR:
+                case ICC_ERROR:
                     resID = R.string.callFailed_simError;
                     break;
 
index bcc89a4..b5754ed 100644 (file)
 
 package com.android.phone;
 
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.gsm.CallForwardInfo;
-import com.android.internal.telephony.gsm.CommandsInterface;
-
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.ProgressDialog;
@@ -36,14 +31,21 @@ import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceScreen;
-import android.provider.Contacts.PhonesColumns;
 import android.provider.Settings;
+import android.provider.Contacts.PhonesColumns;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.ServiceState;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.WindowManager;
 
+import com.android.internal.telephony.CallForwardInfo;
+import com.android.internal.telephony.CommandsInterface;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.cdma.TtyIntent;
+import android.content.Context;
+
 public class CallFeaturesSetting extends PreferenceActivity
         implements DialogInterface.OnClickListener,
         Preference.OnPreferenceChangeListener,
@@ -73,9 +75,10 @@ public class CallFeaturesSetting extends PreferenceActivity
     private static final String BUTTON_FDN_KEY   = "button_fdn_key";
 
     // used to store the state of expanded preferences
-    private static final String BUTTON_CF_EXPAND_KEY = "button_cf_expand_key";
-    private static final String BUTTON_MORE_EXPAND_KEY = "button_more_expand_key";
+    private static final String BUTTON_GSM_MORE_EXPAND_KEY = "button_gsm_more_expand_key";
+    private static final String BUTTON_CDMA_MORE_EXPAND_KEY = "button_cdma_more_expand_key";
 
+    private static final String BUTTON_CF_EXPAND_KEY = "button_cf_expand_key";
     private static final String SUMMARY_CFU_KEY   = "summary_cfu_key";
     private static final String SUMMARY_CFB_KEY   = "summary_cfb_key";
     private static final String SUMMARY_CFNRY_KEY = "summary_cfnry_key";
@@ -84,6 +87,9 @@ public class CallFeaturesSetting extends PreferenceActivity
     private static final String APP_STATE_KEY     = "app_state_key";
     private static final String DISPLAY_MODE_KEY  = "display_mode_key";
 
+    private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
+    private static final String BUTTON_VP_KEY = "button_voice_privacy_key";
+
     private Intent mContactListIntent;
     private Intent mFDNSettingIntent;
 
@@ -96,6 +102,19 @@ public class CallFeaturesSetting extends PreferenceActivity
     private static final int EVENT_VOICEMAIL_CHANGED     = 500;
     /** track the query cancel event. */
     private static final int EVENT_INITAL_QUERY_CANCELED = 600;
+    /** Event for TTY mode change */
+    private static final int EVENT_TTY_EXECUTED          = 700;
+    private static final int EVENT_ENHANCED_VP_EXECUTED  = 1000;
+    
+    // preferred TTY mode
+    // 0 = disabled
+    // 1 = enabled
+    static final int preferredTTYMode = 0;
+
+    // preferred VoicePrivacy mode
+    // 0 = disabled
+    // 1 = enabled
+    static final int preferredVPMode = 1;
 
     /** Handle to voicemail pref */
     private static final int VOICEMAIL_PREF_ID = CommandsInterface.CF_REASON_NOT_REACHABLE + 1;
@@ -161,7 +180,10 @@ public class CallFeaturesSetting extends PreferenceActivity
     private EditPhoneNumberPreference mButtonCFNRc;
     private EditPhoneNumberPreference mSubMenuVoicemailSettings;
     private PreferenceScreen mButtonCFExpand;
-    private PreferenceScreen mButtonMoreExpand;
+    private PreferenceScreen mButtonGSMMoreExpand;
+    private PreferenceScreen mButtonCDMAMoreExpand;
+    private CheckBoxPreference mButtonVoicePrivacy;
+    private CheckBoxPreference mButtonTTY;
 
     // cf number strings
     private String mDialingNumCFU;
@@ -212,8 +234,13 @@ public class CallFeaturesSetting extends PreferenceActivity
         } else if (preference == mButtonCFExpand){
             setDisplayMode(DISP_MODE_CF);
             return true;
-        } else if (preference == mButtonMoreExpand){
+        } else if (preference == mButtonGSMMoreExpand){
+            // TODO - should have handler for mButtonCDMAMoreExpand?
             setDisplayMode(DISP_MODE_MORE);
+        } else if (preference == mButtonVoicePrivacy) {
+            handleVoicePrivacyClickRequest(mButtonVoicePrivacy.isChecked());
+        } else if (preference == mButtonTTY) {
+            handleTTYClickRequest(mButtonTTY.isChecked());
         }
 
         if (nextState != AppState.INPUT_READY) {
@@ -255,33 +282,38 @@ public class CallFeaturesSetting extends PreferenceActivity
                 (mMoreDataStale && (displayMode == DISP_MODE_MORE))){
             if (DBG) log("setDisplayMode: performing requested expansion.");
 
-            // If airplane mode is on, do not bother querying.
-            if (Settings.System.getInt(getContentResolver(),
-                    Settings.System.AIRPLANE_MODE_ON, 0) <= 0) {
-                // query state if radio is available
-                //  if its out of service, just wait for the radio to be ready
-                //  if its neither of these states, throw up an error.
-                setAppState(AppState.INITIAL_QUERY);
-
-                int radioState = mPhone.getServiceState().getState();
-
-                if (radioState == ServiceState.STATE_IN_SERVICE) {
-                    // Query ONLY what we are currently expanding.
-                    if (displayMode == DISP_MODE_CF) {
-                        queryAllCFOptions();
+            // check for CDMA, if so just open without querying
+            if ( mPhone.getPhoneName().equals("CDMA") ) {
+                setAppState(AppState.INPUT_READY);
+            } else {
+                // If airplane mode is on, do not bother querying.
+                if (Settings.System.getInt(getContentResolver(),
+                        Settings.System.AIRPLANE_MODE_ON, 0) <= 0 ) {
+                    // query state if radio is available
+                    //  if its out of service, just wait for the radio to be ready
+                    //  if its neither of these states, throw up an error.
+                    setAppState(AppState.INITIAL_QUERY);
+
+                    int radioState = mPhone.getServiceState().getState();
+
+                    if (radioState == ServiceState.STATE_IN_SERVICE) {
+                        // Query ONLY what we are currently expanding.
+                        if (displayMode == DISP_MODE_CF) {
+                            queryAllCFOptions();
+                        } else {
+                            queryMoreOptions();
+                        }
+                    } else if (radioState == ServiceState.STATE_POWER_OFF){
+                        if (DBG) log("onCreate: radio not ready, waiting for signal.");
+                        mPhone.registerForServiceStateChanged(mNetworkServiceHandler,
+                                EVENT_SERVICE_STATE_CHANGED, null);
                     } else {
-                        queryMoreOptions();
+                        setAppState(AppState.NETWORK_ERROR, MSG_EXCEPTION);
                     }
-                } else if (radioState == ServiceState.STATE_POWER_OFF){
-                    if (DBG) log("onCreate: radio not ready, waiting for signal.");
-                    mPhone.registerForServiceStateChanged(mNetworkServiceHandler,
-                            EVENT_SERVICE_STATE_CHANGED, null);
                 } else {
-                    setAppState(AppState.NETWORK_ERROR, MSG_EXCEPTION);
+                    if (DBG) log("setDisplayMode: radio is off!");
+                    setAppState(AppState.NETWORK_ERROR, MSG_RADIO_OFF);
                 }
-            } else {
-                if (DBG) log("setDisplayMode: radio is off!");
-                setAppState(AppState.NETWORK_ERROR, MSG_RADIO_OFF);
             }
         }
     }
@@ -366,7 +398,7 @@ public class CallFeaturesSetting extends PreferenceActivity
             return null;
         }
 
-        String vmDisplay = PhoneFactory.getDefaultPhone().getVoiceMailNumber();
+        String vmDisplay = mPhone.getVoiceMailNumber();
         if (TextUtils.isEmpty(vmDisplay)) {
             // if there is no voicemail number, we just return null to
             // indicate no contribution.
@@ -578,7 +610,6 @@ public class CallFeaturesSetting extends PreferenceActivity
         updateVoiceNumberField();
     }
 
-
     /*
      * Callback to handle query completions
      */
@@ -644,6 +675,19 @@ public class CallFeaturesSetting extends PreferenceActivity
         return MSG_OK;
     }
 
+    // VP Object
+    private int handleGetVPMessage(AsyncResult ar, int voicePrivacyMode) {
+        if (ar.exception != null) {
+            if (DBG) log("handleGetVPMessage: Error getting VP enable state.");
+            return MSG_EXCEPTION;
+        } else {
+            Log.d(LOG_TAG, "voicePrivacyMode = " + voicePrivacyMode);
+            syncVPState((int[]) ar.result);
+        }
+
+        return MSG_OK;
+    }
+
     // CF Object
     private int handleGetCFMessage(AsyncResult ar, int reason) {
         // done with query, display the new settings.
@@ -683,7 +727,6 @@ public class CallFeaturesSetting extends PreferenceActivity
         return MSG_OK;
     }
 
-
     /*
      * Methods used to sync UI state with that of the network
      */
@@ -957,15 +1000,33 @@ public class CallFeaturesSetting extends PreferenceActivity
                     if (status != MSG_OK) {
                         setAppState(AppState.NETWORK_ERROR, status);
                     } else {
-                        mPhone.getCallWaiting(
-                                Message.obtain(mGetMoreOptionsComplete, EVENT_CW_EXECUTED));
+                        mPhone.getCallWaiting(Message.obtain(mGetMoreOptionsComplete, 
+                                EVENT_CW_EXECUTED));
                     }
                     break;
 
                 case EVENT_CW_EXECUTED:
                     status = handleGetCWMessage(ar);
                     if (DBG) {
-                        log("mGetAllOptionsComplete: CW query done, all call features queried.");
+                        log("mGetAllOptionsComplete: CW query done, querying VP.");
+                    }
+                    if (status != MSG_OK) {
+                        setAppState(AppState.NETWORK_ERROR, status);
+                    } else {
+                        if (mPhone.getPhoneName().equals("GSM")) {
+                            mMoreDataStale = false;
+                            setAppState(AppState.INPUT_READY);
+                        } else {
+                            mPhone.getEnhancedVoicePrivacy(Message.obtain(mGetMoreOptionsComplete,
+                                EVENT_ENHANCED_VP_EXECUTED));
+                        }
+                    }
+                    break;
+
+                case EVENT_ENHANCED_VP_EXECUTED:
+                    status = handleGetVPMessage(ar, msg.arg1);
+                    if (DBG) {
+                        log("mGetAllOptionsComplete: VP query done, all call features queried.");
                     }
                     if (status != MSG_OK) {
                         setAppState(AppState.NETWORK_ERROR, status);
@@ -1117,8 +1178,9 @@ public class CallFeaturesSetting extends PreferenceActivity
                 }
                 break;
             case DISP_MODE_MORE:
-                if (mButtonMoreExpand != null && mButtonMoreExpand.getDialog() != null) {
-                    mButtonMoreExpand.getDialog().dismiss();
+                if (mButtonGSMMoreExpand != null && mButtonGSMMoreExpand.getDialog() != null) {
+                    // TODO - check for mButtonCDMAMoreExpand symmetry
+                    mButtonGSMMoreExpand.getDialog().dismiss();
                 }
                 break;
         }
@@ -1261,6 +1323,34 @@ public class CallFeaturesSetting extends PreferenceActivity
         }
     }
 
+    @Override
+    protected void onResume() {
+        super.onResume();
+        mPhone = PhoneFactory.getDefaultPhone();
+        
+        // upon resumption from the sub-activity, make sure we re-enable the
+        // preferences.
+        getPreferenceScreen().setEnabled(true);
+
+        if (mPhone.getPhoneName().equals("CDMA")) {
+            // Set UI state in onResume because a user could go home, launch some
+            // app to change this setting's backend, and re-launch this settings app
+            // and the UI state would be inconsistent with actual state
+            handleSetVPMessage();
+            mPhone.queryTTYModeEnabled(Message.obtain(mQueryTTYComplete, EVENT_TTY_EXECUTED));
+            mButtonCFExpand.setEnabled(false);
+            mButtonCLIR.setEnabled(false);
+            mButtonCW.setChecked(false);
+            mButtonCW.setEnabled(false);
+        } else {
+            mButtonTTY.setChecked(false);
+            mButtonTTY.setEnabled(false);
+            mButtonVoicePrivacy.setChecked(false);
+            mButtonVoicePrivacy.setEnabled(false);
+        }
+
+    }
+    
     /*
      * Activity class methods
      */
@@ -1268,6 +1358,7 @@ public class CallFeaturesSetting extends PreferenceActivity
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
+        mPhone = PhoneFactory.getDefaultPhone();
 
         addPreferencesFromResource(R.xml.call_feature_setting);
 
@@ -1285,7 +1376,16 @@ public class CallFeaturesSetting extends PreferenceActivity
 
         // get a reference to the Preference Screens for Call Forwarding and "More" settings.
         mButtonCFExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_CF_EXPAND_KEY);
-        mButtonMoreExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_MORE_EXPAND_KEY);
+        mButtonGSMMoreExpand = (PreferenceScreen) prefSet.findPreference(
+                BUTTON_GSM_MORE_EXPAND_KEY);
+        mButtonCDMAMoreExpand = (PreferenceScreen) prefSet.findPreference(
+                BUTTON_CDMA_MORE_EXPAND_KEY);
+
+        mButtonTTY = (CheckBoxPreference) findPreference(BUTTON_TTY_KEY);
+        mButtonVoicePrivacy = (CheckBoxPreference) findPreference(BUTTON_VP_KEY);
+        if (mPhone.getPhoneName().equals("GSM")) {
+            mButtonVoicePrivacy.setEnabled(false);
+        }
 
         // Set links to the current activity and any UI settings that
         // effect the dialog for each preference.  Also set the
@@ -1341,7 +1441,6 @@ public class CallFeaturesSetting extends PreferenceActivity
         mFDNSettingIntent.setClassName(this, FdnSetting.class.getName());
         mSubMenuFDNSettings.setIntent (mFDNSettingIntent);
 
-        mPhone = PhoneFactory.getDefaultPhone();
         mAppState = AppState.INPUT_READY;
 
         if (icicle != null) {
@@ -1365,12 +1464,21 @@ public class CallFeaturesSetting extends PreferenceActivity
             setButtonCLIRValue(icicle.getInt(BUTTON_CLIR_KEY));
             if (mButtonCW != null) {
                 mButtonCW.setChecked(icicle.getBoolean(BUTTON_CW_KEY));
+        }
+        if (mButtonVoicePrivacy != null) {
+                mButtonVoicePrivacy.setChecked(icicle.getBoolean(BUTTON_VP_KEY));
+                if (mPhone.getPhoneName().equals("GSM")) {
+                    mButtonVoicePrivacy.setEnabled(false);
+                }
+            }
+            if (mButtonTTY != null) {
+                mButtonTTY.setChecked(icicle.getBoolean(BUTTON_TTY_KEY));
             }
 
             // set app state
             mAppState = (AppState) icicle.getSerializable(APP_STATE_KEY);
             mCFDataStale = icicle.getBoolean(BUTTON_CF_EXPAND_KEY);
-            mMoreDataStale = icicle.getBoolean(BUTTON_MORE_EXPAND_KEY);
+            mMoreDataStale = icicle.getBoolean(BUTTON_GSM_MORE_EXPAND_KEY);
             mDisplayMode = icicle.getInt(DISPLAY_MODE_KEY);
 
         } else {
@@ -1415,6 +1523,12 @@ public class CallFeaturesSetting extends PreferenceActivity
         if (mButtonCFNRc != null) {
             outState.putBoolean(BUTTON_CFNRC_KEY, mButtonCFNRc.isToggled());
         }
+        if (mButtonVoicePrivacy != null) {
+            outState.putBoolean(BUTTON_VP_KEY, mButtonVoicePrivacy.isChecked());
+        }
+        if (mButtonTTY != null) {
+            outState.putBoolean(BUTTON_TTY_KEY, mButtonTTY.isChecked());
+        }
 
         // save number state
         outState.putString(SUMMARY_CFU_KEY, mDialingNumCFU);
@@ -1425,10 +1539,179 @@ public class CallFeaturesSetting extends PreferenceActivity
         // save state of the app
         outState.putSerializable(APP_STATE_KEY, mAppState);
         outState.putBoolean(BUTTON_CF_EXPAND_KEY, mCFDataStale);
-        outState.putBoolean(BUTTON_MORE_EXPAND_KEY, mMoreDataStale);
+        outState.putBoolean(BUTTON_GSM_MORE_EXPAND_KEY, mMoreDataStale);
         outState.putInt(DISPLAY_MODE_KEY, mDisplayMode);
     }
 
+    // TTY object
+    private void handleTTYClickRequest(boolean b) {
+        if (DBG) log("handleTTYClickRequest: requesting set TTY mode enable (TTY) to" +
+                Boolean.toString(b));
+        mPhone.setTTYModeEnabled(b, Message.obtain(mSetTTYComplete, EVENT_TTY_EXECUTED));
+    }
+
+    /*
+     * Callback to handle TTY mode update completions
+     */
+
+    // **Callback on TTY mode when complete.
+    private Handler mSetTTYComplete = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            // query to make sure we're looking at the same data as that in the network.
+            switch (msg.what) {
+                case EVENT_TTY_EXECUTED:
+                    handleSetTTYMessage();
+                    break;
+                default:
+                    // TODO: should never reach this, may want to throw exception
+            }
+        }
+    };
+
+    // TTY Object
+    private void handleSetTTYMessage() {
+        if (DBG) {
+            log("handleSetTTYMessage: set TTY request complete, reading value from network.");
+        }
+        mPhone.queryTTYModeEnabled(Message.obtain(mQueryTTYComplete, EVENT_TTY_EXECUTED));
+        android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Secure.TTY_MODE_ENABLED, preferredTTYMode );
+    }
+
+    /*
+     * Callback to handle query completions
+     */
+
+    // **Callback on option getting when complete.
+    private Handler mQueryTTYComplete = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case EVENT_TTY_EXECUTED:
+                    handleQueryTTYModeMessage((AsyncResult) msg.obj);
+                    break;
+                default:
+                    // TODO: should never reach this, may want to throw exception
+            }
+        }
+    };
+
+    // TTY Object
+    private int handleQueryTTYModeMessage(AsyncResult ar) {
+        if (ar.exception != null) {
+            if (DBG) log("handleQueryTTYModeMessage: Error getting TTY enable state.");
+            return MSG_EXCEPTION;
+        } else {
+            if (DBG) log("handleQueryTTYModeMessage: TTY enable state successfully queried.");
+            syncTTYState((int[]) ar.result);
+            android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.TTY_MODE_ENABLED, preferredTTYMode );
+        }
+        return MSG_OK;
+    }
+
+    // set the state of the UI based on TTY State
+    private void syncTTYState(int ttyArray[]) {
+        if (DBG) log("syncTTYState: Setting UI state consistent with TTY enable state of " +
+                ((ttyArray[0] != 0) ? "ENABLED" : "DISABLED"));
+
+        mButtonTTY.setChecked(ttyArray[0] != 0);
+
+        Context context = this;
+
+        if (ttyArray[0] == 1) {
+            //display TTY icon at StatusBar
+            setStatusBarIcon(context, true);
+        }
+        else {
+            // turn off TTY icon at StatusBar
+            setStatusBarIcon(context, false);
+        }
+    }
+
+    /**
+     * Tells the StatusBar whether the TTY mode is enabled or disabled
+     */
+    private static void setStatusBarIcon(Context context, boolean enabled) {
+        Intent ttyModeChanged = new Intent(TtyIntent.TTY_ENABLED_CHANGE_ACTION);
+        ttyModeChanged.putExtra("ttyEnabled", enabled);
+        context.sendBroadcast(ttyModeChanged);
+    }
+
+    //VP object click
+    private void handleVoicePrivacyClickRequest(boolean value) {
+        mPhone.enableEnhancedVoicePrivacy(value, Message.obtain(mSetVoicePrivacyComplete, 
+                EVENT_ENHANCED_VP_EXECUTED));
+    }
+
+    // **Callback on VP mode when complete.
+    private Handler mSetVoicePrivacyComplete = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            // query to make sure we're looking at the same data as that in the network.
+            switch (msg.what) {
+                case EVENT_ENHANCED_VP_EXECUTED:
+                    handleSetVPMessage();
+                    break;
+                default:
+                    // TODO: should never reach this, may want to throw exception
+            }
+        }
+    };
+
+    // VP Object Set
+    private void handleSetVPMessage() {
+        mPhone.getEnhancedVoicePrivacy(Message.obtain(mQueryVoicePrivacyComplete, 
+                EVENT_ENHANCED_VP_EXECUTED));
+        android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED, preferredVPMode);
+    }
+
+    /*
+     * Callback to handle VP query completions
+     */
+
+    // **Callback on option getting when complete.
+    private Handler mQueryVoicePrivacyComplete = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case EVENT_ENHANCED_VP_EXECUTED:
+                    handleQueryVPModeMessage((AsyncResult) msg.obj);
+                    break;
+                default:
+                    // TODO: should never reach this, may want to throw exception
+            }
+        }
+    };
+
+    // VP Object Query
+    private int handleQueryVPModeMessage(AsyncResult ar) {
+        if (ar.exception != null) {
+            if (DBG) {
+                log("handleQueryVPModeMessage: Error getting VoicePrivacy enable state.");
+            }
+            return MSG_EXCEPTION;
+        } else {
+            if (DBG) {
+                log("handleQueryVPModeMessage: VoicePrivacy enable state successfully queried.");
+            }
+            syncVPState((int[]) ar.result);
+            android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.ENHANCED_VOICE_PRIVACY_ENABLED, 
+                    preferredVPMode );
+        }
+        return MSG_OK;
+    }
+
+    // set the state of the UI based on VP state
+    private void syncVPState(int vpArray[]) {
+        Log.d(LOG_TAG, "syncVPState: Setting UI state consistent with VP enable state of"
+                + ((vpArray[0] != 0) ? "ENABLED" : "DISABLED"));
+        mButtonVoicePrivacy.setChecked(vpArray[0] != 0);
+    }
+
     private static void log(String msg) {
         Log.d(LOG_TAG, msg);
     }
index 7bd8fd2..da49d77 100644 (file)
@@ -431,6 +431,23 @@ public class CallNotifier extends Handler
         }
     }
 
+    void updateCallNotifierRegistrationsAfterRadioTechnologyChange() {
+        if(DBG) Log.d(LOG_TAG, "updateCallNotifierRegistrationsAfterRadioTechnologyChange...");
+        //Unregister all events from the old obsolete phone
+        mPhone.unregisterForNewRingingConnection(this);
+        mPhone.unregisterForPhoneStateChanged(this);
+        mPhone.unregisterForDisconnect(this);
+        mPhone.unregisterForUnknownConnection(this);
+        mPhone.unregisterForIncomingRing(this);
+
+        //Register all events new to the new active phone
+        mPhone.registerForNewRingingConnection(this, PHONE_NEW_RINGING_CONNECTION, null);
+        mPhone.registerForPhoneStateChanged(this, PHONE_STATE_CHANGED, null);
+        mPhone.registerForDisconnect(this, PHONE_DISCONNECT, null);
+        mPhone.registerForUnknownConnection(this, PHONE_UNKNOWN_CONNECTION_APPEARED, null);
+        mPhone.registerForIncomingRing(this, PHONE_INCOMING_RING, null);
+    }
+
     /**
      * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface.
      * refreshes the CallCard data when it called.  If called with this
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
new file mode 100644 (file)
index 0000000..c63ab31
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.phone;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.AsyncResult;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+import android.util.Log;
+
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
+/**
+ * List of Phone-specific settings screens.
+ */
+public class CdmaOptions extends PreferenceActivity implements Preference.OnPreferenceChangeListener{
+    
+    // debug data
+    private static final String LOG_TAG = "CdmaOptions";
+    private static final boolean DBG = true;
+    
+    //String keys for preference lookup
+    private static final String BUTTON_CDMA_ROAMING_KEY = "cdma_roaming_mode_key";
+    private static final String BUTTON_CDMA_NW_PREFERENCE_KEY = "cdma_network_prefernces_key";
+    private static final String BUTTON_CDMA_SUBSCRIPTION_KEY = "subscription_key";
+    private static final String BUTTON_CB_SMS_EXPAND_KEY = "cdma_cell_broadcast_sms_key";
+    
+    // Used for CDMA roaming mode
+    private static final int CDMA_ROAMING_MODE_HOME = 0;
+    private static final int CDMA_ROAMING_MODE_AFFILIATED = 1;
+    private static final int CDMA_ROAMING_MODE_ANY = 2;
+    
+    //preferredCdmaRoamingMode  0 - Home Networks only, preferred
+    //                          1 - Roaming on affiliated networks
+    //                          2 - Roaming on any network
+    static final int preferredCdmaRoamingMode = 0;
+    
+    // Used for CDMA subscription mode
+    private static final int CDMA_SUBSCRIPTION_RUIM_SIM = 0;
+    private static final int CDMA_SUBSCRIPTION_NV = 1;
+    
+    //preferredSubscriptionMode  0 - RUIM/SIM, preferred
+    //                           1 - NV
+    static final int preferredSubscriptionMode = 0;
+    
+    //UI objects
+    private ListPreference mButtonCdmaRoam;
+    private ListPreference mButtonCdmaNwPreference;
+    private ListPreference mButtonCdmaSubscription;
+    private PreferenceScreen mButtonCbSmsExpand;
+    
+    private Phone mPhone;
+    private MyHandler mHandler;
+
+    
+    /** 
+     * Invoked on each preference click in this hierarchy, overrides 
+     * PreferenceActivity's implementation.  Used to make sure we track the
+     * preference click events.
+     */
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+        if (preference == mButtonCdmaRoam) {
+            if (DBG) log("onPreferenceTreeClick: preference == mButtonCdmaRoam.");
+            //displays the value taken from the Settings.System
+            int cdmaRoamingMode = android.provider.Settings.Secure.getInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_ROAMING_MODE, preferredCdmaRoamingMode);            
+            mButtonCdmaRoam.setValue(Integer.toString(cdmaRoamingMode));
+            return true;
+        } 
+        else if (preference == mButtonCdmaNwPreference) {
+            if (DBG) log("onPreferenceTreeClick: preference == mButtonCdmaNwPreference.");
+            return true;
+        }
+        else if (preference == mButtonCdmaSubscription) {
+            if (DBG) log("onPreferenceTreeClick: preference == mButtonCdmaSubscription.");
+            int cdmaSubscriptionMode = android.provider.Settings.Secure.getInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_SUBSCRIPTION_MODE, preferredSubscriptionMode);            
+            mButtonCdmaSubscription.setValue(Integer.toString(cdmaSubscriptionMode));
+            return true;
+        }
+        else {
+            // if the button is anything but the simple toggle preference,
+            // we'll need to disable all preferences to reject all click
+            // events until the sub-activity's UI comes up.
+            preferenceScreen.setEnabled(false);
+            // Let the intents be launched by the Preference manager
+            return false;
+        }
+    }
+
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        addPreferencesFromResource(R.xml.cdma_options);
+        
+        mPhone = PhoneFactory.getDefaultPhone();
+        mHandler = new MyHandler();
+
+        //get UI object references
+        PreferenceScreen prefSet = getPreferenceScreen();
+
+        mButtonCdmaRoam = (ListPreference) prefSet.findPreference(BUTTON_CDMA_ROAMING_KEY);
+        mButtonCdmaSubscription = 
+                (ListPreference) prefSet.findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY);
+        mButtonCdmaNwPreference = 
+                (ListPreference) prefSet.findPreference(BUTTON_CDMA_NW_PREFERENCE_KEY);
+        mButtonCbSmsExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_CB_SMS_EXPAND_KEY);
+
+        if (mPhone.getPhoneName().equals("CDMA")) {
+            // set the listener for the mButtonCdmaRoam list preference so we can issue 
+            // change CDMA Roaming Mode.
+            mButtonCdmaRoam.setOnPreferenceChangeListener(this);
+            // set the listener for the mButtonCdmaRoam list preference so we can issue 
+            // change CDMA Roaming Mode.
+            mButtonCdmaSubscription.setOnPreferenceChangeListener(this);
+
+            //Get the settingsCdmaRoamingMode from Settings.System and displays it
+            int settingsCdmaRoamingMode = android.provider.Settings.Secure.getInt(
+                    mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_ROAMING_MODE, 
+                    preferredCdmaRoamingMode);
+            mButtonCdmaRoam.setValue(Integer.toString(settingsCdmaRoamingMode));
+
+            //Get the settingsCdmaSubscriptionMode from Settings.System and displays it
+            int settingsCdmaSubscriptionMode = android.provider.Settings.Secure.getInt(
+                    mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_SUBSCRIPTION_MODE, 
+                    preferredSubscriptionMode);
+            mButtonCdmaSubscription.setValue(Integer.toString(settingsCdmaSubscriptionMode));
+        } else {
+            mButtonCdmaRoam.setEnabled(false);
+            mButtonCdmaSubscription.setEnabled(false);
+            mButtonCbSmsExpand.setEnabled(false);
+        }
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        mPhone = PhoneFactory.getDefaultPhone();
+        // upon resumption from the sub-activity, make sure we re-enable the
+        // preferences.
+        getPreferenceScreen().setEnabled(true);
+
+        if (mPhone.getPhoneName().equals("CDMA")) {
+            mPhone.queryCdmaRoamingPreference(
+                    mHandler.obtainMessage(MyHandler.MESSAGE_QUERY_ROAMING_PREFERENCE));
+        } else {
+            mButtonCdmaRoam.setEnabled(false);
+            mButtonCdmaSubscription.setEnabled(false);
+            mButtonCbSmsExpand.setEnabled(false);
+        }
+    }
+
+    /**
+     * Implemented to support onPreferenceChangeListener to look for preference
+     * changes specifically on CLIR.
+     *
+     * @param preference is the preference to be changed, should be mButtonCdmaRoam.
+     * @param objValue should be the value of the selection, NOT its localized
+     * display value.
+     */
+    public boolean onPreferenceChange(Preference preference, Object objValue) {
+        mPhone = PhoneFactory.getDefaultPhone();
+        if (preference == mButtonCdmaRoam) {
+            //NOTE onPreferenceChange seems to be called even if there is no change
+            //Check if the button value is changed from the System.Setting
+            mButtonCdmaRoam.setValue((String) objValue);
+            int buttonCdmaRoamingMode;
+            buttonCdmaRoamingMode = Integer.valueOf((String) objValue).intValue();
+            int settingsCdmaRoamingMode = android.provider.Settings.Secure.getInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_ROAMING_MODE, preferredCdmaRoamingMode);
+            if (buttonCdmaRoamingMode != settingsCdmaRoamingMode) {
+                int statusCdmaRoamingMode; 
+                switch(buttonCdmaRoamingMode) {
+                    case CDMA_ROAMING_MODE_ANY:
+                        statusCdmaRoamingMode = Phone.CDMA_RM_ANY;
+                        break;
+                    case CDMA_ROAMING_MODE_AFFILIATED:
+                        statusCdmaRoamingMode = Phone.CDMA_RM_AFFILIATED;
+                        break;
+                    case CDMA_ROAMING_MODE_HOME:
+                    default:
+                        statusCdmaRoamingMode = Phone.CDMA_RM_HOME;
+                }
+                //Set the Settings.Secure network mode       
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_ROAMING_MODE, 
+                        buttonCdmaRoamingMode );
+                //Set the roaming preference mode
+                mPhone.setCdmaRoamingPreference(statusCdmaRoamingMode, mHandler
+                        .obtainMessage(MyHandler.MESSAGE_SET_ROAMING_PREFERENCE));
+            }
+        }
+        if (preference == mButtonCdmaSubscription) {
+            //NOTE onPreferenceChange seems to be called even if there is no change
+            //Check if the button value is changed from the System.Setting
+            mButtonCdmaSubscription.setValue((String) objValue);
+            int buttonCdmaSubscriptionMode;
+            buttonCdmaSubscriptionMode = Integer.valueOf((String) objValue).intValue();
+            int settingsCdmaSubscriptionMode = android.provider.Settings.Secure.getInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_SUBSCRIPTION_MODE, preferredSubscriptionMode);
+            if (buttonCdmaSubscriptionMode != settingsCdmaSubscriptionMode) {
+                int statusCdmaSubscriptionMode; 
+                switch(buttonCdmaSubscriptionMode) {
+                    case CDMA_SUBSCRIPTION_NV:
+                        statusCdmaSubscriptionMode = Phone.CDMA_SUBSCRIPTION_NV;
+                        break;
+                    case CDMA_SUBSCRIPTION_RUIM_SIM:
+                    default:
+                        statusCdmaSubscriptionMode = Phone.CDMA_SUBSCRIPTION_RUIM_SIM;
+                } 
+                //Set the Settings.System network mode        
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_SUBSCRIPTION_MODE, 
+                        buttonCdmaSubscriptionMode );
+                //Set the CDMA subscription mode
+                mPhone.setCdmaSubscription(statusCdmaSubscriptionMode, mHandler
+                        .obtainMessage(MyHandler.MESSAGE_SET_CDMA_SUBSCRIPTION));
+            }
+        }
+
+        // always let the preference setting proceed.
+        return true;
+    }
+
+    private class MyHandler extends Handler {
+
+        private static final int MESSAGE_QUERY_ROAMING_PREFERENCE = 0;
+        private static final int MESSAGE_SET_ROAMING_PREFERENCE = 1;
+        private static final int MESSAGE_SET_CDMA_SUBSCRIPTION = 2;
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case MESSAGE_QUERY_ROAMING_PREFERENCE:
+                    handleQueryCdmaRoamingPreference(msg);
+                    break;
+                    
+                case MESSAGE_SET_ROAMING_PREFERENCE:
+                    handleSetCdmaRoamingPreference(msg);
+                    break;
+                case MESSAGE_SET_CDMA_SUBSCRIPTION:
+                    handleSetCdmaSubscriptionMode(msg);
+                    break;
+            }
+        }
+
+        private void handleQueryCdmaRoamingPreference(Message msg) {
+            mPhone = PhoneFactory.getDefaultPhone();
+            AsyncResult ar = (AsyncResult) msg.obj;
+            
+            if (ar.exception == null) {
+                int statusCdmaRoamingMode = ((int[])ar.result)[0];
+                int settingsRoamingMode = android.provider.Settings.Secure.getInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_ROAMING_MODE, preferredCdmaRoamingMode);
+                //check that statusCdmaRoamingMode is from an accepted value
+                if (statusCdmaRoamingMode == Phone.CDMA_RM_HOME ||  
+                        statusCdmaRoamingMode == Phone.CDMA_RM_AFFILIATED ||
+                        statusCdmaRoamingMode == Phone.CDMA_RM_ANY ) {
+                    //check changes in statusCdmaRoamingMode and updates settingsRoamingMode 
+                    if (statusCdmaRoamingMode != settingsRoamingMode) {
+                        settingsRoamingMode = statusCdmaRoamingMode;
+                        //changes the Settings.Secure accordingly to statusCdmaRoamingMode
+                        android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                                android.provider.Settings.Secure.CDMA_ROAMING_MODE, 
+                                settingsRoamingMode );
+                    }
+                    //changes the mButtonPreferredNetworkMode accordingly to modemNetworkMode
+                    mButtonCdmaRoam.setValue(
+                            Integer.toString(statusCdmaRoamingMode));
+                }
+                else {
+                    resetCdmaRoamingModeToDefault();
+                } 
+            } 
+        }
+
+        private void handleSetCdmaRoamingPreference(Message msg) {
+            mPhone = PhoneFactory.getDefaultPhone();
+            AsyncResult ar = (AsyncResult) msg.obj;
+            
+            if (ar.exception == null) {
+                int cdmaRoamingMode = Integer.valueOf(mButtonCdmaRoam.getValue()).intValue();
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_ROAMING_MODE, 
+                        cdmaRoamingMode );
+            } else {
+                mPhone.queryCdmaRoamingPreference(obtainMessage(MESSAGE_QUERY_ROAMING_PREFERENCE));
+            }
+        }
+
+        private void resetCdmaRoamingModeToDefault() {
+            mPhone = PhoneFactory.getDefaultPhone();
+            //set cdmaRoamingMode to default
+            int cdmaRoamingMode = preferredCdmaRoamingMode;
+            int statusCdmaRoamingMode = Phone.CDMA_RM_HOME;
+            //set the mButtonCdmaRoam
+            mButtonCdmaRoam.setValue(Integer.toString(cdmaRoamingMode));
+            //set the Settings.System 
+            android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_ROAMING_MODE, 
+                        cdmaRoamingMode );            
+            //Set the Status
+            mPhone.setCdmaRoamingPreference(statusCdmaRoamingMode, 
+                    this.obtainMessage(MyHandler.MESSAGE_SET_ROAMING_PREFERENCE));
+        }
+    }
+
+    private void handleSetCdmaSubscriptionMode(Message msg) {
+        mPhone = PhoneFactory.getDefaultPhone();
+        AsyncResult ar = (AsyncResult) msg.obj;
+
+        if (ar.exception == null) {
+            int cdmaSubscriptionMode = Integer.valueOf(mButtonCdmaSubscription.getValue()).intValue();
+            android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.CDMA_SUBSCRIPTION_MODE, 
+                    cdmaSubscriptionMode );
+        } 
+    }
+
+    private static void log(String msg) {
+        Log.d(LOG_TAG, msg);
+    }
+}
+
+
diff --git a/src/com/android/phone/CellBroadcastSms.java b/src/com/android/phone/CellBroadcastSms.java
new file mode 100644 (file)
index 0000000..8b17c69
--- /dev/null
@@ -0,0 +1,658 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.phone;
+
+import android.os.Bundle;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.preference.PreferenceActivity;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.RILConstants;
+
+import android.os.AsyncResult;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+
+
+/**
+ * List of Phone-specific settings screens.
+ */
+public class CellBroadcastSms extends PreferenceActivity
+        implements Preference.OnPreferenceChangeListener{
+    // debug data
+    private static final String LOG_TAG = "CellBroadcastSms";
+    private static final boolean DBG = true;
+
+    //String keys for preference lookup
+    private static final String BUTTON_ENABLE_DISABLE_BC_SMS_KEY =
+        "button_enable_disable_cell_bc_sms";
+    private static final String LIST_LANGUAGE_KEY =
+        "list_language";
+    private static final String BUTTON_EMERGENCY_BROADCAST_KEY =
+        "button_emergency_broadcast";
+    private static final String BUTTON_ADMINISTRATIVE_KEY =
+        "button_administrative";
+    private static final String BUTTON_MAINTENANCE_KEY =
+        "button_maintenance";
+    private static final String BUTTON_LOCAL_WEATHER_KEY =
+        "button_local_weather";
+    private static final String BUTTON_ATR_KEY =
+        "button_atr";
+    private static final String BUTTON_LAFS_KEY =
+        "button_lafs";
+    private static final String BUTTON_RESTAURANTS_KEY =
+        "button_restaurants";
+    private static final String BUTTON_LODGINGS_KEY =
+        "button_lodgings";
+    private static final String BUTTON_RETAIL_DIRECTORY_KEY =
+        "button_retail_directory";
+    private static final String BUTTON_ADVERTISEMENTS_KEY =
+        "button_advertisements";
+    private static final String BUTTON_STOCK_QUOTES_KEY =
+        "button_stock_quotes";
+    private static final String BUTTON_EO_KEY =
+        "button_eo";
+    private static final String BUTTON_MHH_KEY =
+        "button_mhh";
+    private static final String BUTTON_TECHNOLOGY_NEWS_KEY =
+        "button_technology_news";
+    private static final String BUTTON_MULTI_CATEGORY_KEY =
+        "button_multi_category";
+
+    private static final String BUTTON_LOCAL_GENERAL_NEWS_KEY =
+        "button_local_general_news";
+    private static final String BUTTON_REGIONAL_GENERAL_NEWS_KEY =
+        "button_regional_general_news";
+    private static final String BUTTON_NATIONAL_GENERAL_NEWS_KEY =
+        "button_national_general_news";
+    private static final String BUTTON_INTERNATIONAL_GENERAL_NEWS_KEY =
+        "button_international_general_news";
+    
+    private static final String BUTTON_LOCAL_BF_NEWS_KEY =
+        "button_local_bf_news";
+    private static final String BUTTON_REGIONAL_BF_NEWS_KEY =
+        "button_regional_bf_news";
+    private static final String BUTTON_NATIONAL_BF_NEWS_KEY =
+        "button_national_bf_news";
+    private static final String BUTTON_INTERNATIONAL_BF_NEWS_KEY =
+        "button_international_bf_news";
+    
+    private static final String BUTTON_LOCAL_SPORTS_NEWS_KEY =
+        "button_local_sports_news";
+    private static final String BUTTON_REGIONAL_SPORTS_NEWS_KEY =
+        "button_regional_sports_news";
+    private static final String BUTTON_NATIONAL_SPORTS_NEWS_KEY =
+        "button_national_sports_news";
+    private static final String BUTTON_INTERNATIONAL_SPORTS_NEWS_KEY =
+        "button_international_sports_news";
+    
+    private static final String BUTTON_LOCAL_ENTERTAINMENT_NEWS_KEY =
+        "button_local_entertainment_news";
+    private static final String BUTTON_REGIONAL_ENTERTAINMENT_NEWS_KEY =
+        "button_regional_entertainment_news";
+    private static final String BUTTON_NATIONAL_ENTERTAINMENT_NEWS_KEY =
+        "button_national_entertainment_news";
+    private static final String BUTTON_INTERNATIONAL_ENTERTAINMENT_NEWS_KEY =
+        "button_international_entertainment_news";
+
+    //Class constants
+    //These values are related to the C structs. See the comments in  method
+    //setCbSmsConfig for more information.
+    private static final int NO_OF_SERVICE_CATEGORIES = 31;
+    private static final int NO_OF_INTS_STRUCT_1 = 3;
+    private static final int MAX_LENGTH_RESULT = NO_OF_SERVICE_CATEGORIES * NO_OF_INTS_STRUCT_1 + 1;
+    //Handler keys
+    private static final int MESSAGE_ACTIVATE_CB_SMS = 1;
+    private static final int MESSAGE_GET_CB_SMS_CONFIG = 2;
+    private static final int MESSAGE_SET_CB_SMS_CONFIG = 3;
+
+    //UI objects
+    private CheckBoxPreference mButtonBcSms;
+    
+    private ListPreference mListLanguage;
+    
+    private CheckBoxPreference mButtonEmergencyBroadcast;
+    private CheckBoxPreference mButtonAdministrative;
+    private CheckBoxPreference mButtonMaintenance;
+    private CheckBoxPreference mButtonLocalWeather;
+    private CheckBoxPreference mButtonAtr;
+    private CheckBoxPreference mButtonLafs;
+    private CheckBoxPreference mButtonRestaurants;
+    private CheckBoxPreference mButtonLodgings;
+    private CheckBoxPreference mButtonRetailDirectory;
+    private CheckBoxPreference mButtonAdvertisements;
+    private CheckBoxPreference mButtonStockQuotes;
+    private CheckBoxPreference mButtonEo;
+    private CheckBoxPreference mButtonMhh;
+    private CheckBoxPreference mButtonTechnologyNews;
+    private CheckBoxPreference mButtonMultiCategory;
+
+    private CheckBoxPreference mButtonLocal1;
+    private CheckBoxPreference mButtonRegional1;
+    private CheckBoxPreference mButtonNational1;
+    private CheckBoxPreference mButtonInternational1;
+    
+    private CheckBoxPreference mButtonLocal2;
+    private CheckBoxPreference mButtonRegional2;
+    private CheckBoxPreference mButtonNational2;
+    private CheckBoxPreference mButtonInternational2;
+    
+    private CheckBoxPreference mButtonLocal3;
+    private CheckBoxPreference mButtonRegional3;
+    private CheckBoxPreference mButtonNational3;
+    private CheckBoxPreference mButtonInternational3;
+    
+    private CheckBoxPreference mButtonLocal4;
+    private CheckBoxPreference mButtonRegional4;
+    private CheckBoxPreference mButtonNational4;
+    private CheckBoxPreference mButtonInternational4;
+    
+    
+    //Member variables
+    private Phone mPhone;
+    private MyHandler mHandler;
+
+    /** 
+     * Invoked on each preference click in this hierarchy, overrides 
+     * PreferenceActivity's implementation.  Used to make sure we track the
+     * preference click events.
+     */
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
+            Preference preference) {
+        if (preference == mButtonBcSms) {
+            if (DBG) Log.d(LOG_TAG, "onPreferenceTreeClick: preference == mButtonBcSms.");
+            if(mButtonBcSms.isChecked()) {
+                mPhone.activateCellBroadcastSms(RILConstants.CDMA_CELL_BROADCAST_SMS_ENABLED,
+                        Message.obtain(mHandler, MESSAGE_ACTIVATE_CB_SMS));
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_CELL_BROADCAST_SMS,
+                        RILConstants.CDMA_CELL_BROADCAST_SMS_ENABLED);
+                enableDisableAllCbConfigButtons(true);
+            } else {
+                mPhone.activateCellBroadcastSms(RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED,
+                        Message.obtain(mHandler, MESSAGE_ACTIVATE_CB_SMS));
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.CDMA_CELL_BROADCAST_SMS,
+                        RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED);
+                enableDisableAllCbConfigButtons(false);
+            }
+        } else if (preference == mListLanguage) {
+            //Do nothing here, because this click will be handled in onPreferenceChange
+        } else if (preference == mButtonEmergencyBroadcast) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonEmergencyBroadcast.isChecked(), 1);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(
+                    mButtonEmergencyBroadcast.isChecked(), 1);
+        } else if (preference == mButtonAdministrative) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonAdministrative.isChecked(), 2);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonAdministrative.isChecked(), 2);
+        } else if (preference == mButtonMaintenance) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonMaintenance.isChecked(), 3);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonMaintenance.isChecked(), 3);
+        } else if (preference == mButtonLocalWeather) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonLocalWeather.isChecked(), 4);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLocalWeather.isChecked(), 4);
+        } else if (preference == mButtonAtr) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonAtr.isChecked(), 5);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonAtr.isChecked(), 5);
+        } else if (preference == mButtonLafs) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLafs.isChecked(), 6);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLafs.isChecked(), 6);
+        } else if (preference == mButtonRestaurants) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRestaurants.isChecked(), 7);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRestaurants.isChecked(), 7);
+        } else if (preference == mButtonLodgings) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLodgings.isChecked(), 8);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLodgings.isChecked(), 8);
+        } else if (preference == mButtonRetailDirectory) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRetailDirectory.isChecked(), 9);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRetailDirectory.isChecked(), 9);
+        } else if (preference == mButtonAdvertisements) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonAdvertisements.isChecked(), 10);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonAdvertisements.isChecked(), 10);
+        } else if (preference == mButtonStockQuotes) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonStockQuotes.isChecked(), 11);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonStockQuotes.isChecked(), 11);
+        } else if (preference == mButtonEo) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonEo.isChecked(), 12);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonEo.isChecked(), 12);
+        } else if (preference == mButtonMhh) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonMhh.isChecked(), 13);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonMhh.isChecked(), 13);
+        } else if (preference == mButtonTechnologyNews) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonTechnologyNews.isChecked(), 14);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonTechnologyNews.isChecked(), 14);
+        } else if (preference == mButtonMultiCategory) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonMultiCategory.isChecked(), 15);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonMultiCategory.isChecked(), 15);
+        } else if (preference == mButtonLocal1) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLocal1.isChecked(), 16);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLocal1.isChecked(), 16);
+        } else if (preference == mButtonRegional1) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRegional1.isChecked(), 17);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRegional1.isChecked(), 17);
+        } else if (preference == mButtonNational1) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonNational1.isChecked(), 18);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonNational1.isChecked(), 18);
+        } else if (preference == mButtonInternational1) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonInternational1.isChecked(), 19);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonInternational1.isChecked(), 19);
+        } else if (preference == mButtonLocal2) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLocal2.isChecked(), 20);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLocal2.isChecked(), 20);
+        } else if (preference == mButtonRegional2) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRegional2.isChecked(), 21);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRegional2.isChecked(), 21);
+        } else if (preference == mButtonNational2) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonNational2.isChecked(), 22);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonNational2.isChecked(), 22);
+        } else if (preference == mButtonInternational2) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonInternational2.isChecked(), 23);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonInternational2.isChecked(), 23);
+        } else if (preference == mButtonLocal3) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLocal3.isChecked(), 24);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLocal3.isChecked(), 24);
+        } else if (preference == mButtonRegional3) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRegional3.isChecked(), 25);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRegional3.isChecked(), 25);
+        } else if (preference == mButtonNational3) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonNational3.isChecked(), 26);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonNational3.isChecked(), 26);
+        } else if (preference == mButtonInternational3) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonInternational3.isChecked(), 27);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonInternational3.isChecked(), 27);
+        } else if (preference == mButtonLocal4) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(mButtonLocal4.isChecked(), 28);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonLocal4.isChecked(), 28);
+        } else if (preference == mButtonRegional4) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonRegional4.isChecked(), 29);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonRegional4.isChecked(), 29);
+        } else if (preference == mButtonNational4) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonNational4.isChecked(), 30);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonNational4.isChecked(), 30);
+        } else if (preference == mButtonInternational4) {
+            CellBroadcastSmsConfig.setConfigDataCompleteBSelected(
+                    mButtonInternational4.isChecked(), 31);
+            CellBroadcastSmsConfig.setCbSmsBSelectedValue(mButtonInternational4.isChecked(), 31);
+        } else {
+            preferenceScreen.setEnabled(false);
+            return false;
+        }
+
+        return true;
+    }
+    
+    public boolean onPreferenceChange(Preference preference, Object objValue) {
+        if (preference == mListLanguage) {
+            // set the new language to the array which will be transmitted later
+            CellBroadcastSmsConfig.setConfigDataCompleteLanguage(
+                    mListLanguage.findIndexOfValue((String) objValue) + 1);
+        }
+
+        // always let the preference setting proceed.
+        return true;
+    }
+
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        addPreferencesFromResource(R.xml.cell_broadcast_sms);
+
+        mPhone = PhoneFactory.getDefaultPhone();
+        mHandler = new MyHandler();
+
+        PreferenceScreen prefSet = getPreferenceScreen();
+
+        mButtonBcSms = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_ENABLE_DISABLE_BC_SMS_KEY);
+        mListLanguage = (ListPreference) prefSet.findPreference(
+                LIST_LANGUAGE_KEY);
+        // set the listener for the language list preference
+        mListLanguage.setOnPreferenceChangeListener(this);
+        mButtonEmergencyBroadcast = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_EMERGENCY_BROADCAST_KEY);
+        mButtonAdministrative = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_ADMINISTRATIVE_KEY);
+        mButtonMaintenance = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_MAINTENANCE_KEY);
+        mButtonLocalWeather = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LOCAL_WEATHER_KEY);
+        mButtonAtr = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_ATR_KEY);
+        mButtonLafs = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LAFS_KEY);
+        mButtonRestaurants = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_RESTAURANTS_KEY);
+        mButtonLodgings = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LODGINGS_KEY);
+        mButtonRetailDirectory = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_RETAIL_DIRECTORY_KEY);
+        mButtonAdvertisements = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_ADVERTISEMENTS_KEY);
+        mButtonStockQuotes = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_STOCK_QUOTES_KEY);
+        mButtonEo = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_EO_KEY);
+        mButtonMhh = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_MHH_KEY);
+        mButtonTechnologyNews = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_TECHNOLOGY_NEWS_KEY);
+        mButtonMultiCategory = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_MULTI_CATEGORY_KEY);
+        
+        mButtonLocal1 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LOCAL_GENERAL_NEWS_KEY);
+        mButtonRegional1 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_REGIONAL_GENERAL_NEWS_KEY);
+        mButtonNational1 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_NATIONAL_GENERAL_NEWS_KEY);
+        mButtonInternational1 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_INTERNATIONAL_GENERAL_NEWS_KEY);
+        
+        mButtonLocal2 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LOCAL_BF_NEWS_KEY);
+        mButtonRegional2 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_REGIONAL_BF_NEWS_KEY);
+        mButtonNational2 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_NATIONAL_BF_NEWS_KEY);
+        mButtonInternational2 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_INTERNATIONAL_BF_NEWS_KEY);
+        
+        mButtonLocal3 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LOCAL_SPORTS_NEWS_KEY);
+        mButtonRegional3 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_REGIONAL_SPORTS_NEWS_KEY);
+        mButtonNational3 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_NATIONAL_SPORTS_NEWS_KEY);
+        mButtonInternational3 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_INTERNATIONAL_SPORTS_NEWS_KEY);
+        
+        mButtonLocal4 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_LOCAL_ENTERTAINMENT_NEWS_KEY);
+        mButtonRegional4 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_REGIONAL_ENTERTAINMENT_NEWS_KEY);
+        mButtonNational4 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_NATIONAL_ENTERTAINMENT_NEWS_KEY);
+        mButtonInternational4 = (CheckBoxPreference) prefSet.findPreference(
+                BUTTON_INTERNATIONAL_ENTERTAINMENT_NEWS_KEY);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+
+        getPreferenceScreen().setEnabled(true);
+
+        int settingCbSms = android.provider.Settings.Secure.getInt(
+                mPhone.getContext().getContentResolver(),
+                android.provider.Settings.Secure.CDMA_CELL_BROADCAST_SMS,
+                RILConstants.CDMA_CELL_BROADCAST_SMS_DISABLED);            
+        mButtonBcSms.setChecked(settingCbSms == RILConstants.CDMA_CELL_BROADCAST_SMS_ENABLED);
+
+        if(mButtonBcSms.isChecked()) {
+            enableDisableAllCbConfigButtons(true);
+        } else {
+            enableDisableAllCbConfigButtons(false);
+        }
+
+        mPhone.getCellBroadcastSmsConfig(Message.obtain(mHandler, MESSAGE_GET_CB_SMS_CONFIG));
+    }
+
+    @Override
+    protected void onStop() {
+        if (DBG) Log.d(LOG_TAG, "OnStop-Metthod reached in class CellBroadcastSms");
+        
+        CellBroadcastSmsConfig.setCbSmsNoOfStructs(NO_OF_SERVICE_CATEGORIES);
+        
+        mPhone.setCellBroadcastSmsConfig(CellBroadcastSmsConfig.getCbSmsAllValues(),
+                Message.obtain(mHandler, MESSAGE_SET_CB_SMS_CONFIG));
+        
+        super.onStop();
+    }
+
+    private void enableDisableAllCbConfigButtons(boolean enable) {
+        mButtonEmergencyBroadcast.setEnabled(enable);
+        mListLanguage.setEnabled(enable);
+        mButtonAdministrative.setEnabled(enable);
+        mButtonMaintenance.setEnabled(enable);
+        mButtonLocalWeather.setEnabled(enable);
+        mButtonAtr.setEnabled(enable);
+        mButtonLafs.setEnabled(enable);
+        mButtonRestaurants.setEnabled(enable);
+        mButtonLodgings.setEnabled(enable);
+        mButtonRetailDirectory.setEnabled(enable);
+        mButtonAdvertisements.setEnabled(enable);
+        mButtonStockQuotes.setEnabled(enable);
+        mButtonEo.setEnabled(enable);
+        mButtonMhh.setEnabled(enable);
+        mButtonTechnologyNews.setEnabled(enable);
+        mButtonMultiCategory.setEnabled(enable);
+        
+        mButtonLocal1.setEnabled(enable);
+        mButtonRegional1.setEnabled(enable);
+        mButtonNational1.setEnabled(enable);
+        mButtonInternational1.setEnabled(enable);
+        
+        mButtonLocal2.setEnabled(enable);
+        mButtonRegional2.setEnabled(enable);
+        mButtonNational2.setEnabled(enable);
+        mButtonInternational2.setEnabled(enable);
+        
+        mButtonLocal3.setEnabled(enable);
+        mButtonRegional3.setEnabled(enable);
+        mButtonNational3.setEnabled(enable);
+        mButtonInternational3.setEnabled(enable);
+        
+        mButtonLocal4.setEnabled(enable);
+        mButtonRegional4.setEnabled(enable);
+        mButtonNational4.setEnabled(enable);
+        mButtonInternational4.setEnabled(enable);
+    }
+    
+    private void setAllCbConfigButtons(int[] configArray) {
+        //These buttons are in a well defined sequence. If you want to change it,
+        //be sure to map the buttons to their corresponding slot in the configArray !
+        mButtonEmergencyBroadcast.setChecked(configArray[1] != 0);
+        //subtract 1, because the values are handled in an array which starts with 0 and not with 1
+        mListLanguage.setValueIndex(CellBroadcastSmsConfig.getConfigDataLanguage() - 1);
+        mButtonAdministrative.setChecked(configArray[2] != 0);
+        mButtonMaintenance.setChecked(configArray[3] != 0);
+        mButtonLocalWeather.setChecked(configArray[4] != 0);
+        mButtonAtr.setChecked(configArray[5] != 0);
+        mButtonLafs.setChecked(configArray[6] != 0);
+        mButtonRestaurants.setChecked(configArray[7] != 0);
+        mButtonLodgings.setChecked(configArray[8] != 0);
+        mButtonRetailDirectory.setChecked(configArray[9] != 0);
+        mButtonAdvertisements.setChecked(configArray[10] != 0);
+        mButtonStockQuotes.setChecked(configArray[11] != 0);
+        mButtonEo.setChecked(configArray[12] != 0);
+        mButtonMhh.setChecked(configArray[13] != 0);
+        mButtonTechnologyNews.setChecked(configArray[14] != 0);
+        mButtonMultiCategory.setChecked(configArray[15] != 0);
+        
+        mButtonLocal1.setChecked(configArray[16] != 0);
+        mButtonRegional1.setChecked(configArray[17] != 0);
+        mButtonNational1.setChecked(configArray[18] != 0);
+        mButtonInternational1.setChecked(configArray[19] != 0);
+        
+        mButtonLocal2.setChecked(configArray[20] != 0);
+        mButtonRegional2.setChecked(configArray[21] != 0);
+        mButtonNational2.setChecked(configArray[22] != 0);
+        mButtonInternational2.setChecked(configArray[23] != 0);
+        
+        mButtonLocal3.setChecked(configArray[24] != 0);
+        mButtonRegional3.setChecked(configArray[25] != 0);
+        mButtonNational3.setChecked(configArray[26] != 0);
+        mButtonInternational3.setChecked(configArray[27] != 0);
+        
+        mButtonLocal4.setChecked(configArray[28] != 0);
+        mButtonRegional4.setChecked(configArray[29] != 0);
+        mButtonNational4.setChecked(configArray[30] != 0);
+        mButtonInternational4.setChecked(configArray[31] != 0);
+    }
+
+    private class MyHandler extends Handler {
+
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+            case MESSAGE_ACTIVATE_CB_SMS:
+                //Only a log message here, because the received response is always null
+                if (DBG) Log.d(LOG_TAG, "Cell Broadcast SMS enabled/disabled.");
+                break;
+            case MESSAGE_GET_CB_SMS_CONFIG:
+                int result[] = (int[])((AsyncResult)msg.obj).result;
+                
+                CellBroadcastSmsConfig.setCbSmsConfig(result);
+                setAllCbConfigButtons(CellBroadcastSmsConfig.getCbSmsBselectedValues());
+                
+                break;
+            case MESSAGE_SET_CB_SMS_CONFIG:
+                //Only a log message here, because the received response is always null
+                if (DBG) Log.d(LOG_TAG, "Set Cell Broadcast SMS values.");
+                break;
+            default:
+                Log.e(LOG_TAG, "Error! Unhandled message in CellBroadcastSms.java. Message: "
+                        + msg.what);
+            break;
+            }
+        }
+    }
+
+    private static final class CellBroadcastSmsConfig {
+
+        //The values in this array are stored in a particular order. This order
+        //is calculated in the setCbSmsConfig method of this class.
+        //For more information see comments below...
+        //NO_OF_SERVICE_CATEGORIES +1 is used, because we will leave the first array entry 0
+        private static int mBSelected[] = new int[NO_OF_SERVICE_CATEGORIES + 1];
+        private static int mConfigDataComplete[] = new int[MAX_LENGTH_RESULT];
+
+        private static void setCbSmsConfig(int[] configData) {
+            if(configData == null) {
+                Log.e(LOG_TAG, "Error! No cell broadcast service categories returned.");
+                return;
+            }
+
+            if(configData[0] > MAX_LENGTH_RESULT) {
+                Log.e(LOG_TAG, "Error! Wrong number of service categories returned from RIL");
+                return;
+            }
+            
+            //The required config values for broadcast SMS are stored in a C struct:
+            //
+            //  typedef struct {
+            //      int size;
+            //      RIL_CDMA_BcServiceInfo *entries;
+            //  } RIL_CDMA_BcSMSConfig;
+            //
+            //  typedef struct {
+            //      int uServiceCategory;
+            //      int uLanguage;
+            //      unsigned char bSelected;
+            //  } RIL_CDMA_BcServiceInfo;
+            //
+            // This means, that we have to ignore the first value and check every
+            // 3rd value starting with the 2nd of all. This value indicates, where we
+            // will store the appropriate bSelected value, which is 2 values behind it.
+            for(int i = 1; i < configData.length; i += NO_OF_INTS_STRUCT_1) {
+                mBSelected[configData[i]] = configData[i +2];
+            }
+            
+            //Store all values in an extra array
+            mConfigDataComplete = configData;
+        }
+        
+        private static void setCbSmsBSelectedValue(boolean value, int pos) {
+            if(pos < mBSelected.length) {
+                mBSelected[pos] = (value == true ? 1 : 0);
+            } else {
+                Log.e(LOG_TAG,"Error! Invalid value position.");
+            }
+        }
+        
+        private static int[] getCbSmsBselectedValues() {
+            return(mBSelected);
+        }
+        
+        private static int[] getCbSmsAllValues() {
+            return(mConfigDataComplete);
+        }
+        
+        private static void setCbSmsNoOfStructs(int value) {
+            //Sets the size parameter, which contains the number of structs
+            //that will be transmitted
+            mConfigDataComplete[0] = value;
+        }
+        
+        private static void setConfigDataCompleteBSelected(boolean value, int serviceCategory) {
+            //Sets the bSelected value for a specific serviceCategory
+            for(int i = 1; i < mConfigDataComplete.length; i += NO_OF_INTS_STRUCT_1) {
+                if(mConfigDataComplete[i] == serviceCategory) {
+                    mConfigDataComplete[i + 2] = value == true ? 1 : 0;
+                    break;
+                }
+            }
+        }
+        
+        private static void setConfigDataCompleteLanguage(int language) {
+            //It is only possible to set the same language for all entries 
+            for(int i = 2; i < mConfigDataComplete.length; i += NO_OF_INTS_STRUCT_1) {
+                mConfigDataComplete[i] = language;
+            }
+        }
+        
+        private static int getConfigDataLanguage() {
+            int language = mConfigDataComplete[2];
+            //2 is the language value of the first entry
+            //It is only possible to set the same language for all entries 
+            if (language < 1 || language > 7) {
+                Log.e(LOG_TAG, "Error! Wrong language returned from RIL...defaulting to 1, english");
+                return 1;
+            }
+            else {
+                return language;
+            }
+        }
+    }
+}
@@ -18,17 +18,12 @@ package com.android.phone;
 
 import android.app.Activity;
 import android.app.AlertDialog;
-import android.app.NotificationManager;
 import android.content.Intent;
 import android.content.res.Resources;
 import android.os.AsyncResult;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.SimCard;
-import com.android.internal.telephony.gsm.CommandException;
 import android.text.method.DigitsKeyListener;
 import android.util.Log;
 import android.view.View;
@@ -39,10 +34,15 @@ import android.widget.ScrollView;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.IccCard;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
 /**
- * "Change SIM PIN" UI for the Phone app.
+ * "Change ICC PIN" UI for the Phone app.
  */
-public class ChangeSimPinScreen extends Activity {
+public class ChangeIccPinScreen extends Activity {
     private static final String LOG_TAG = PhoneApp.LOG_TAG;
     private static final boolean DBG = false;
 
@@ -73,8 +73,8 @@ public class ChangeSimPinScreen extends Activity {
     private Button mButton;
     private Button mPUKSubmit;
     private ScrollView mScrollView;
-    
-    private LinearLayout mSimPUKPanel;
+
+    private LinearLayout mIccPUKPanel;
 
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
@@ -129,7 +129,7 @@ public class ChangeSimPinScreen extends Activity {
         mPUKSubmit = (Button) findViewById(R.id.puk_submit);
         mPUKSubmit.setOnClickListener(mClicked);
 
-        mSimPUKPanel = (LinearLayout) findViewById(R.id.puk_panel);
+        mIccPUKPanel = (LinearLayout) findViewById(R.id.puk_panel);
 
         int id = mChangePin2 ? R.string.change_pin2 : R.string.change_pin;
         setTitle(getResources().getText(id));
@@ -175,8 +175,8 @@ public class ChangeSimPinScreen extends Activity {
             } else if (v == mNewPin2) {
                 mButton.requestFocus();
             } else if (v == mButton) {
-                SimCard simCardInterface = mPhone.getSimCard();
-                if (simCardInterface != null) {
+                IccCard iccCardInterface = mPhone.getIccCard();
+                if (iccCardInterface != null) {
                     String oldPin = mOldPin.getText().toString();
                     String newPin1 = mNewPin1.getText().toString();
                     String newPin2 = mNewPin2.getText().toString();
@@ -212,10 +212,10 @@ public class ChangeSimPinScreen extends Activity {
                             reset();
 
                             if (mChangePin2) {
-                                simCardInterface.changeSimFdnPassword(oldPin,
+                                iccCardInterface.changeIccFdnPassword(oldPin,
                                         newPin1, callBack);
                             } else {
-                                simCardInterface.changeSimLockPassword(oldPin,
+                                iccCardInterface.changeIccLockPassword(oldPin,
                                         newPin1, callBack);
                             }
 
@@ -225,7 +225,7 @@ public class ChangeSimPinScreen extends Activity {
             } else if (v == mPUKCode) {
                 mPUKSubmit.requestFocus();
             } else if (v == mPUKSubmit) {
-                mPhone.getSimCard().supplyPuk2(mPUKCode.getText().toString(), 
+                mPhone.getIccCard().supplyPuk2(mPUKCode.getText().toString(), 
                         mNewPin1.getText().toString(), 
                         Message.obtain(mHandler, EVENT_PIN_CHANGED));
             }
@@ -238,7 +238,7 @@ public class ChangeSimPinScreen extends Activity {
 
             if (mState == EntryState.ES_PUK) {
                 mScrollView.setVisibility(View.VISIBLE);
-                mSimPUKPanel.setVisibility(View.GONE);
+                mIccPUKPanel.setVisibility(View.GONE);
             }            
             // TODO: show success feedback
             showConfirmation();
@@ -262,7 +262,7 @@ public class ChangeSimPinScreen extends Activity {
                     mState = EntryState.ES_PUK;
                     displayPUKAlert();
                     mScrollView.setVisibility(View.GONE);
-                    mSimPUKPanel.setVisibility(View.VISIBLE);
+                    mIccPUKPanel.setVisibility(View.VISIBLE);
                     mPUKCode.requestFocus();
                 }
             } else if (mState == EntryState.ES_PUK) {
index c38163e..98b5e64 100644 (file)
@@ -108,7 +108,7 @@ public class DeleteFdnContactScreen extends Activity {
         buf.append(mPin2);
         buf.append("'");
 
-        Uri uri = Uri.parse("content://sim/fdn");
+        Uri uri = Uri.parse("content://icc/fdn");
 
         mQueryHandler = new QueryHandler(getContentResolver());
         mQueryHandler.startDelete(0, null, uri, buf.toString(), null);
index 496c691..ccd1448 100644 (file)
@@ -257,7 +257,7 @@ public class EditFdnContactScreen extends Activity {
     }
 
     private Uri getContentURI() {
-        return Uri.parse("content://sim/fdn");
+        return Uri.parse("content://icc/fdn");
     }
 
     /**
index 9b031d6..947f877 100644 (file)
@@ -21,9 +21,6 @@ import android.os.AsyncResult;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.gsm.CommandException;
 import android.text.TextUtils;
 import android.text.method.DigitsKeyListener;
 import android.util.Log;
@@ -32,6 +29,10 @@ import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
 /**
  * UI to enable/disable FDN.
  */
@@ -68,7 +69,7 @@ public class EnableFdnScreen extends Activity {
         setupView();
 
         mPhone = PhoneFactory.getDefaultPhone();
-        mEnable = !mPhone.getSimCard().getSimFdnEnabled();
+        mEnable = !mPhone.getIccCard().getIccFdnEnabled();
 
         int id = mEnable ? R.string.enable_fdn : R.string.disable_fdn;
         setTitle(getResources().getText(id));
@@ -77,6 +78,7 @@ public class EnableFdnScreen extends Activity {
     @Override
     protected void onResume() {
         super.onResume();
+        mPhone = PhoneFactory.getDefaultPhone();
     }
 
     private void setupView() {
@@ -106,7 +108,7 @@ public class EnableFdnScreen extends Activity {
 
     private void enableFdn() {
         Message callback = Message.obtain(mHandler, ENABLE_FDN_COMPLETE);
-        mPhone.getSimCard().setSimFdnEnabled(mEnable, getPin2(), callback);
+        mPhone.getIccCard().setIccFdnEnabled(mEnable, getPin2(), callback);
         if (DBG) log("enableFdn: please wait...");
     }
 
@@ -21,9 +21,6 @@ import android.os.AsyncResult;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.gsm.CommandException;
 import android.text.TextUtils;
 import android.text.method.DigitsKeyListener;
 import android.util.Log;
@@ -32,13 +29,17 @@ import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
 /**
- * UI to enable/disable the SIM PIN.
+ * UI to enable/disable the ICC PIN.
  */
-public class EnableSimPinScreen extends Activity {
+public class EnableIccPinScreen extends Activity {
     private static final String LOG_TAG = PhoneApp.LOG_TAG;
 
-    private static final int ENABLE_SIM_PIN_COMPLETE = 100;
+    private static final int ENABLE_ICC_PIN_COMPLETE = 100;
     private static final boolean DBG = false;
 
     private LinearLayout mPinFieldContainer;
@@ -50,7 +51,7 @@ public class EnableSimPinScreen extends Activity {
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
             switch (msg.what) {
-                case ENABLE_SIM_PIN_COMPLETE:
+                case ENABLE_ICC_PIN_COMPLETE:
                     AsyncResult ar = (AsyncResult) msg.obj;
                     handleResult(ar);
                     break;
@@ -68,7 +69,7 @@ public class EnableSimPinScreen extends Activity {
         setupView();
 
         mPhone = PhoneFactory.getDefaultPhone();
-        mEnable = !mPhone.getSimCard().getSimLockEnabled();
+        mEnable = !mPhone.getIccCard().getIccLockEnabled();
 
         int id = mEnable ? R.string.enable_sim_pin : R.string.disable_sim_pin;
         setTitle(getResources().getText(id));
@@ -99,11 +100,11 @@ public class EnableSimPinScreen extends Activity {
         return mPinField.getText().toString();
     }
 
-    private void enableSimPin() {
-        Message callback = Message.obtain(mHandler, ENABLE_SIM_PIN_COMPLETE);
-        if (DBG) log("enableSimPin:");
-        mPhone.getSimCard().setSimLockEnabled(mEnable, getPin(), callback);
-        if (DBG) log("enableSimPin: please wait...");
+    private void enableIccPin() {
+        Message callback = Message.obtain(mHandler, ENABLE_ICC_PIN_COMPLETE);
+        if (DBG) log("enableIccPin:");
+        mPhone.getIccCard().setIccLockEnabled(mEnable, getPin(), callback);
+        if (DBG) log("enableIccPin: please wait...");
     }
 
     private void handleResult(AsyncResult ar) {
@@ -135,11 +136,11 @@ public class EnableSimPinScreen extends Activity {
             showStatus(getResources().getText(
                     R.string.enable_in_progress));
 
-            enableSimPin();
+            enableIccPin();
         }
     };
 
     private void log(String msg) {
-        Log.d(LOG_TAG, "[EnableSimPin] " + msg);
+        Log.d(LOG_TAG, "[EnableIccPin] " + msg);
     }
 }
index caeec33..b03281e 100644 (file)
@@ -39,7 +39,7 @@ public class FdnList extends ADNList {
     @Override
     protected Uri resolveIntent() {
         Intent intent = getIntent();
-        intent.setData(Uri.parse("content://sim/fdn"));
+        intent.setData(Uri.parse("content://icc/fdn"));
         return intent.getData();
     }
 
index b5295d1..b1146a8 100644 (file)
 
 package com.android.phone;
 
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.gsm.CommandException;
-
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.os.AsyncResult;
@@ -31,6 +27,10 @@ import android.preference.PreferenceScreen;
 import android.view.WindowManager;
 import android.widget.Toast;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
 /**
  * FDN settings UI for the Phone app.
  * Rewritten to look and behave closer to the other preferences.
@@ -99,12 +99,12 @@ public class FdnSetting extends PreferenceActivity
         // validate the pin first, before submitting it to the RIL for FDN enable.
         String password = mButtonEnableFDN.getText();
         if (validatePin (password, false)) {
-            // get the relevant data for the sim call
-            boolean isEnabled = mPhone.getSimCard().getSimFdnEnabled();
+            // get the relevant data for the icc call
+            boolean isEnabled = mPhone.getIccCard().getIccFdnEnabled();
             Message onComplete = mFDNHandler.obtainMessage(EVENT_PIN2_ENTRY_COMPLETE);
 
             // make fdn request
-            mPhone.getSimCard().setSimFdnEnabled(!isEnabled, password, onComplete);
+            mPhone.getIccCard().setIccFdnEnabled(!isEnabled, password, onComplete);
         } else {
             // throw up error if the pin is invalid.
             displayMessage(R.string.invalidPin2);
@@ -171,7 +171,7 @@ public class FdnSetting extends PreferenceActivity
                     mButtonChangePin2.setText("");
                     if (!mSkipOldPin) {
                         Message onComplete = mFDNHandler.obtainMessage(EVENT_PIN2_CHANGE_COMPLETE);
-                        mPhone.getSimCard().changeSimFdnPassword(mOldPin, mNewPin, onComplete);
+                        mPhone.getIccCard().changeIccFdnPassword(mOldPin, mNewPin, onComplete);
                     } else {
                         mPinChangeState = PIN_CHANGE_PUK;
                         displayPinChangeDialog();
@@ -186,7 +186,7 @@ public class FdnSetting extends PreferenceActivity
                     // make sure that the puk is valid before submitting it.
                     if (validatePin (puk2, true)) {
                         Message onComplete = mFDNHandler.obtainMessage(EVENT_PIN2_CHANGE_COMPLETE);
-                        mPhone.getSimCard().supplyPuk2(puk2, mNewPin, onComplete);
+                        mPhone.getIccCard().supplyPuk2(puk2, mNewPin, onComplete);
                     } else {
                         displayPinChangeDialog(R.string.invalidPuk2, true);
                     }
@@ -367,7 +367,7 @@ public class FdnSetting extends PreferenceActivity
      * Reflect the updated FDN state in the UI.
      */
     private void updateEnableFDN() {
-        if (mPhone.getSimCard().getSimFdnEnabled()) {
+        if (mPhone.getIccCard().getIccFdnEnabled()) {
             mButtonEnableFDN.setTitle(R.string.enable_fdn_ok);
             mButtonEnableFDN.setSummary(R.string.fdn_enabled);
             mButtonEnableFDN.setDialogTitle(R.string.disable_fdn);
@@ -413,6 +413,7 @@ public class FdnSetting extends PreferenceActivity
     @Override
     protected void onResume() {
         super.onResume();
+        mPhone = PhoneFactory.getDefaultPhone();
         updateEnableFDN();
     }
 
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
new file mode 100644 (file)
index 0000000..254cf52
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package com.android.phone;
+
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceScreen;
+
+import com.android.internal.telephony.PhoneFactory;
+
+/**
+ * List of Network-specific settings screens.
+ */
+public class GsmUmtsOptions extends PreferenceActivity {
+
+    private PreferenceScreen mButtonAPNExpand;
+    private PreferenceScreen mButtonOperatorSelectionExpand;
+
+    private static final String BUTTON_APN_EXPAND_KEY = "button_apn_key";
+    private static final String BUTTON_OPERATOR_SELECTION_EXPAND_KEY = "button_carrier_sel_key";
+
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        addPreferencesFromResource(R.xml.gsm_umts_options);
+        PreferenceScreen prefSet = getPreferenceScreen();
+        mButtonAPNExpand = (PreferenceScreen) prefSet.findPreference(BUTTON_APN_EXPAND_KEY);
+        mButtonOperatorSelectionExpand = 
+                (PreferenceScreen) prefSet.findPreference(BUTTON_OPERATOR_SELECTION_EXPAND_KEY);
+        if (PhoneFactory.getDefaultPhone().getPhoneName().equals("CDMA")) {
+            mButtonAPNExpand.setEnabled(false);
+            mButtonOperatorSelectionExpand.setEnabled(false);
+        }
+    }
+}
similarity index 89%
rename from src/com/android/phone/SimMissingPanel.java
rename to src/com/android/phone/IccMissingPanel.java
index ff1f423..5b4b350 100644 (file)
@@ -22,11 +22,11 @@ import android.widget.Button;
 import android.os.Bundle;
 
 /**
- * Panel which displays the "SIM missing" message.
+ * Panel which displays the "ICC missing" message.
  */
-public class SimMissingPanel extends SimPanel {
+public class IccMissingPanel extends IccPanel {
 
-    public SimMissingPanel(Context context) {
+    public IccMissingPanel(Context context) {
         super(context);
     }
 
@@ -21,8 +21,6 @@ import android.os.AsyncResult;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
 import android.text.Editable;
 import android.text.Spannable;
 import android.text.TextUtils;
@@ -36,17 +34,16 @@ import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
 
-/**
- * "SIM network unlock" PIN entry screen.
- *
- * @see PhoneApp.EVENT_SIM_NETWORK_LOCKED
- */
-public class SimNetworkDepersonalizationPanel extends SimPanel {
+public class IccNetworkDepersonalizationPanel extends IccPanel{
+
+    //debug constants
     private static final boolean DBG = false;
 
     //events
-    private static final int EVENT_SIM_NTWRK_DEPERSONALIZATION_RESULT = 100;
+    private static final int EVENT_ICC_NTWRK_DEPERSONALIZATION_RESULT = 100;
 
     private Phone mPhone;
 
@@ -57,6 +54,7 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
     private TextView     mStatusText;
 
     private Button       mUnlockButton;
+    private Button       mDismissButton;
 
     //private textwatcher to control text entry.
     private TextWatcher mPinEntryWatcher = new TextWatcher() {
@@ -73,11 +71,11 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
             }
         }
     };
-    
+
     //handler for unlock function results
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
-            if (msg.what == EVENT_SIM_NTWRK_DEPERSONALIZATION_RESULT) {
+            if (msg.what == EVENT_ICC_NTWRK_DEPERSONALIZATION_RESULT) {
                 AsyncResult res = (AsyncResult) msg.obj;
                 if (res.exception != null) {
                     if (DBG) log("network depersonalization request failure.");
@@ -101,36 +99,40 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
             }
         }
     };
-    
+
     //constructor
-    public SimNetworkDepersonalizationPanel(Context context) {
+    public IccNetworkDepersonalizationPanel(Context context) {
         super(context);
     }
-    
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         setContentView(R.layout.sim_ndp);
 
-        // PIN entry text field
+        //set up pin entry text field
         mPinEntry = (EditText) findViewById(R.id.pin_entry);
         mPinEntry.setKeyListener(DialerKeyListener.getInstance());
+        mPinEntry.setMovementMethod(null);
         mPinEntry.setOnClickListener(mUnlockListener);
 
-        // Attach the textwatcher
+        //attach the textwatcher
         CharSequence text = mPinEntry.getText();
         Spannable span = (Spannable) text;
         span.setSpan(mPinEntryWatcher, 0, text.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
-        
+
         mEntryPanel = (LinearLayout) findViewById(R.id.entry_panel);
 
         mUnlockButton = (Button) findViewById(R.id.ndp_unlock);
         mUnlockButton.setOnClickListener(mUnlockListener);
 
+        mDismissButton = (Button) findViewById(R.id.ndp_dismiss);
+        mDismissButton.setOnClickListener(mDismissListener);
+
         //status panel is used since we're having problems with the alert dialog.
         mStatusPanel = (LinearLayout) findViewById(R.id.status_panel);
         mStatusText = (TextView) findViewById(R.id.status_text);
-        
+
         mPhone = PhoneFactory.getDefaultPhone();
     }
 
@@ -138,8 +140,8 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
     protected void onStart() {
         super.onStart();
     }
-    
-    //Mirrors SimPinUnlockPanel.onKeyDown().
+
+    //Mirrors IccPinUnlockPanel.onKeyDown().
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (keyCode == KeyEvent.KEYCODE_BACK) {
             return true;
@@ -155,10 +157,10 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
             if (TextUtils.isEmpty(pin)) {
                 return;
             }
-
+            
             if (DBG) log("requesting network depersonalization with code " + pin);
-            mPhone.getSimCard().supplyNetworkDepersonalization(pin,
-                    Message.obtain(mHandler, EVENT_SIM_NTWRK_DEPERSONALIZATION_RESULT));
+            mPhone.getIccCard().supplyNetworkDepersonalization(pin, 
+                    Message.obtain(mHandler, EVENT_ICC_NTWRK_DEPERSONALIZATION_RESULT));
             indicateBusy();
         }
     };
@@ -186,7 +188,14 @@ public class SimNetworkDepersonalizationPanel extends SimPanel {
         mStatusPanel.setVisibility(View.GONE);
     }
 
+    View.OnClickListener mDismissListener = new View.OnClickListener() {
+        public void onClick(View v) {
+            if (DBG) log("network depersonalization skipped.");
+            dismiss();
+        }
+    };
+
     private void log(String msg) {
-        Log.v(TAG, "[SimNetworkDepersonalizationPanel] " + msg);
+        Log.v(TAG, "[IccNetworkUnlock] " + msg);
     }
 }
similarity index 93%
rename from src/com/android/phone/SimPanel.java
rename to src/com/android/phone/IccPanel.java
index b43a776..04814fa 100644 (file)
@@ -26,15 +26,15 @@ import android.view.Window;
 import android.os.Bundle;
 
 /**
- * Base class for SIM-related panels in the Phone UI.
+ * Base class for ICC-related panels in the Phone UI.
  */
-public class SimPanel extends Dialog {
+public class IccPanel extends Dialog {
     protected static final String TAG = PhoneApp.LOG_TAG;
 
     private KeyguardManager.KeyguardLock mKeyguardLock;
 
-    public SimPanel(Context context) {
-        super(context, R.style.SimPanel);
+    public IccPanel(Context context) {
+        super(context, R.style.IccPanel);
     }
 
     @Override
similarity index 86%
rename from src/com/android/phone/SimPinUnlockPanel.java
rename to src/com/android/phone/IccPinUnlockPanel.java
index ff9bfea..992b6ac 100644 (file)
@@ -21,8 +21,6 @@ import android.os.AsyncResult;
 import android.os.Handler;
 import android.os.Message;
 import android.os.Bundle;
-import com.android.internal.telephony.SimCard;
-import com.android.internal.telephony.gsm.CommandException;
 import android.text.Editable;
 import android.text.Spannable;
 import android.text.TextUtils;
@@ -36,15 +34,18 @@ import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.android.internal.telephony.CommandException;
+import com.android.internal.telephony.IccCard;
+
 /**
  * Panel where you enter your PIN to unlock the SIM card.
  */
-public class SimPinUnlockPanel extends SimPanel {
+public class IccPinUnlockPanel extends IccPanel {
     private static final boolean DBG = false;
 
-    private static final int EVENT_SIM_UNLOCKED_RESULT = 100;
+    private static final int EVENT_ICC_UNLOCKED_RESULT = 100;
 
-    private enum SimLockState {
+    private enum IccLockState {
         UNLOCKED,
         REQUIRE_PIN,
         REQUIRE_PUK,
@@ -53,7 +54,7 @@ public class SimPinUnlockPanel extends SimPanel {
         VERIFY_NEW_PIN_FAILED
     };
 
-    private SimLockState mState;
+    private IccLockState mState;
     private String mPUKCode;
     private String mNewPinCode;
 
@@ -69,7 +70,7 @@ public class SimPinUnlockPanel extends SimPanel {
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
             switch (msg.what) {
-                case EVENT_SIM_UNLOCKED_RESULT:
+                case EVENT_ICC_UNLOCKED_RESULT:
                     AsyncResult ar = (AsyncResult) msg.obj;
                     handleUnlockResult(ar);
                     break;
@@ -100,7 +101,7 @@ public class SimPinUnlockPanel extends SimPanel {
         }
     }
 
-    public SimPinUnlockPanel(Context context) {
+    public IccPinUnlockPanel(Context context) {
         super(context);
     }
 
@@ -126,16 +127,16 @@ public class SimPinUnlockPanel extends SimPanel {
      */
     boolean updateState() {
         PhoneApp app = PhoneApp.getInstance();
-        SimCard simCardInterface = app.phone.getSimCard();
+        IccCard iccCardInterface = app.phone.getIccCard();
 
         try {
-            if (simCardInterface.getState() == SimCard.State.PUK_REQUIRED) {
-                if (getState() != SimLockState.REQUIRE_PUK) {
-                    setState(SimLockState.REQUIRE_PUK);
+            if (iccCardInterface.getState() == IccCard.State.PUK_REQUIRED) {
+                if (getState() != IccLockState.REQUIRE_PUK) {
+                    setState(IccLockState.REQUIRE_PUK);
                     return true;
                 }
-            } else if (getState() != SimLockState.REQUIRE_PIN){
-                setState(SimLockState.REQUIRE_PIN);
+            } else if (getState() != IccLockState.REQUIRE_PIN){
+                setState(IccLockState.REQUIRE_PIN);
                 return true;
             }
         } catch (Exception ex) {
@@ -143,11 +144,11 @@ public class SimPinUnlockPanel extends SimPanel {
         return false;
     }
 
-    void setState(SimLockState state) {
+    void setState(IccLockState state) {
         mState = state;
     }
 
-    SimLockState getState() {
+    IccLockState getState() {
         return mState;
     }
 
@@ -175,7 +176,7 @@ public class SimPinUnlockPanel extends SimPanel {
 
         mDismissButton = (Button) findViewById(R.id.dismiss);
 
-        // if we are using the SIM pin for keyguard password, force the
+        // if we are using the ICC pin for keyguard password, force the
         // user to enter the correct PIN to proceed. Otherwise, we won't
         // know what the correct keyguard password is.
         mDismissButton.setOnClickListener(mDismissListener);
@@ -206,7 +207,7 @@ public class SimPinUnlockPanel extends SimPanel {
 
             case VERIFY_NEW_PIN_FAILED:
                 mLabel.setText(context.getText(R.string.verifyFailed));
-                setState(SimLockState.REQUIRE_NEW_PIN);
+                setState(IccLockState.REQUIRE_NEW_PIN);
                 break;
         }
 
@@ -229,7 +230,7 @@ public class SimPinUnlockPanel extends SimPanel {
         }
 
         // pin/puk unlock failed!
-        if (ar.exception instanceof com.android.internal.telephony.gsm.CommandException &&
+        if (ar.exception instanceof com.android.internal.telephony.CommandException &&
                 ((CommandException) ar.exception).getCommandError() ==
                     CommandException.Error.PASSWORD_INCORRECT) {
             hidePinUnlockInProgress();
@@ -243,9 +244,9 @@ public class SimPinUnlockPanel extends SimPanel {
         if (DBG) log("unlock successful!");
         showUnlockSuccess();
 
-        // store the SIM pin in memory, to be used later for keyguard lock
+        // store the ICC pin in memory, to be used later for keyguard lock
         // and radio reboots.
-        PhoneApp.getInstance().setCachedSimPin(mEntry.getText().toString());
+        PhoneApp.getInstance().setCachedSimPin(mEntry.getText().toString()); 
     }
 
     void handleFailure() {
@@ -260,7 +261,7 @@ public class SimPinUnlockPanel extends SimPanel {
         CharSequence msg;
         Context context = getContext();
 
-        if (getState() == SimLockState.REQUIRE_PIN) {
+        if (getState() == IccLockState.REQUIRE_PIN) {
             msg = context.getText(R.string.badPin);
         } else {
             msg = context.getText(R.string.badPuk);
@@ -313,30 +314,30 @@ public class SimPinUnlockPanel extends SimPanel {
             }
 
             PhoneApp app = PhoneApp.getInstance();
-            SimCard simCardInterface = app.phone.getSimCard();
-            if (simCardInterface != null) {
+            IccCard iccCardInterface = app.phone.getIccCard();
+            if (iccCardInterface != null) {
                 Message callBack = Message.obtain(mHandler,
-                        EVENT_SIM_UNLOCKED_RESULT);
+                        EVENT_ICC_UNLOCKED_RESULT);
 
                 switch (mState) {
                     case REQUIRE_PIN:
                         if (DBG) log("unlock attempt: PIN code entered = " +
                                 code);
                         showUnlockInProgress();
-                        simCardInterface.supplyPin(code, callBack);
+                        iccCardInterface.supplyPin(code, callBack);
                         break;
 
                     case REQUIRE_PUK:
                         if (DBG) log("puk code entered, request for new pin");
                         mPUKCode = code;
-                        setState(SimLockState.REQUIRE_NEW_PIN);
+                        setState(IccLockState.REQUIRE_NEW_PIN);
                         updateView();
                         break;
 
                     case REQUIRE_NEW_PIN:
                         if (DBG) log("new pin code entered, verify pin");
                         mNewPinCode = code;
-                        setState(SimLockState.VERIFY_NEW_PIN);
+                        setState(IccLockState.VERIFY_NEW_PIN);
                         updateView();
                         break;
 
@@ -346,10 +347,10 @@ public class SimPinUnlockPanel extends SimPanel {
                         if (verifyNewPin(code)) {
                             // proceed
                             showUnlockInProgress();
-                            simCardInterface.supplyPuk(mPUKCode, mNewPinCode,
+                            iccCardInterface.supplyPuk(mPUKCode, mNewPinCode,
                                     callBack);
                         } else {
-                            setState(SimLockState.VERIFY_NEW_PIN_FAILED);
+                            setState(IccLockState.VERIFY_NEW_PIN_FAILED);
                             updateView();
                         }
 
similarity index 82%
rename from src/com/android/phone/SimProvider.java
rename to src/com/android/phone/IccProvider.java
index 6d2d2a2..827d500 100644 (file)
 package com.android.phone;
 
 /**
- * SIM address book content provider.
+ * ICC address book content provider.
  */
-public class SimProvider extends com.android.internal.telephony.gsm.SimProvider {
-    public SimProvider() {
+public class IccProvider extends com.android.internal.telephony.IccProvider {
+    public IccProvider() {
         super();
     }
 }
index 5edc0ca..f183961 100644 (file)
@@ -1032,50 +1032,66 @@ public class InCallScreen extends Activity
         final boolean hasActiveCall = !mForegroundCall.isIdle();
         final boolean hasHoldingCall = !mBackgroundCall.isIdle();
 
-        if (hasRingingCall) {
-            // If an incoming call is ringing, the CALL button is actually
-            // handled by the PhoneWindowManager.  (We do this to make
-            // sure that we'll respond to the key even if the InCallScreen
-            // hasn't come to the foreground yet.)
-            //
-            // We'd only ever get here in the extremely rare case that the
-            // incoming call started ringing *after*
-            // PhoneWindowManager.interceptKeyTq() but before the event
-            // got here, or else if the PhoneWindowManager had some
-            // problem connecting to the ITelephony service.
-            Log.w(LOG_TAG, "handleCallKey: incoming call is ringing!"
-                  + " (PhoneWindowManager should have handled this key.)");
-            // But go ahead and handle the key as normal, since the
-            // PhoneWindowManager presumably did NOT handle it:
-
-            // There's an incoming ringing call: CALL means "Answer".
-            if (hasActiveCall && hasHoldingCall) {
-                if (DBG) log("handleCallKey: ringing (both lines in use) ==> answer!");
-                internalAnswerCallBothLinesInUse();
-            } else {
-                if (DBG) log("handleCallKey: ringing ==> answer!");
+        if (mPhone.getPhoneName() == "CDMA") {
+            // WINK:TODO Teleca is this enough?
+
+            // The green CALL button means either "Answer", "Swap calls/On Hold", or
+            // "Add to 3WC", depending on the current state of the Phone.
+
+            if (hasRingingCall) {
+                if (VDBG) log("handleCallKey: ringing ==> answer!");
                 internalAnswerCall();  // Automatically holds the current active call,
                                        // if there is one
+            } else {
+                // send an empty CDMA flash string
+                PhoneUtils.switchHoldingAndActive(mPhone);
             }
-        } else if (hasActiveCall && hasHoldingCall) {
-            // Two lines are in use: CALL means "Swap calls".
-            if (DBG) log("handleCallKey: both lines in use ==> swap calls.");
-            internalSwapCalls();
-        } else if (hasHoldingCall) {
-            // There's only one line in use, AND it's on hold.
-            // In this case CALL is a shortcut for "unhold".
-            if (DBG) log("handleCallKey: call on hold ==> unhold.");
-            PhoneUtils.switchHoldingAndActive(mPhone);  // Really means "unhold" in this state
         } else {
-            // The most common case: there's only one line in use, and
-            // it's an active call (i.e. it's not on hold.)
-            // In this case CALL is a no-op.
-            // (This used to be a shortcut for "add call", but that was a
-            // bad idea because "Add call" is so infrequently-used, and
-            // because the user experience is pretty confusing if you
-            // inadvertently trigger it.)
-            if (VDBG) log("handleCallKey: call in foregound ==> ignoring.");
-            // But note we still consume this key event; see below.
+            if (hasRingingCall) {
+                // If an incoming call is ringing, the CALL button is actually
+                // handled by the PhoneWindowManager.  (We do this to make
+                // sure that we'll respond to the key even if the InCallScreen
+                // hasn't come to the foreground yet.)
+                //
+                // We'd only ever get here in the extremely rare case that the
+                // incoming call started ringing *after*
+                // PhoneWindowManager.interceptKeyTq() but before the event
+                // got here, or else if the PhoneWindowManager had some
+                // problem connecting to the ITelephony service.
+                Log.w(LOG_TAG, "handleCallKey: incoming call is ringing!"
+                      + " (PhoneWindowManager should have handled this key.)");
+                // But go ahead and handle the key as normal, since the
+                // PhoneWindowManager presumably did NOT handle it:
+
+                // There's an incoming ringing call: CALL means "Answer".
+                if (hasActiveCall && hasHoldingCall) {
+                    if (DBG) log("handleCallKey: ringing (both lines in use) ==> answer!");
+                    internalAnswerCallBothLinesInUse();
+                } else {
+                    if (DBG) log("handleCallKey: ringing ==> answer!");
+                    internalAnswerCall();  // Automatically holds the current active call,
+                                           // if there is one
+                }
+            } else if (hasActiveCall && hasHoldingCall) {
+                // Two lines are in use: CALL means "Swap calls".
+                if (DBG) log("handleCallKey: both lines in use ==> swap calls.");
+                internalSwapCalls();
+            } else if (hasHoldingCall) {
+                // There's only one line in use, AND it's on hold.
+                // In this case CALL is a shortcut for "unhold".
+                if (DBG) log("handleCallKey: call on hold ==> unhold.");
+                PhoneUtils.switchHoldingAndActive(mPhone);  // Really means "unhold" in this state
+            } else {
+                // The most common case: there's only one line in use, and
+                // it's an active call (i.e. it's not on hold.)
+                // In this case CALL is a no-op.
+                // (This used to be a shortcut for "add call", but that was a
+                // bad idea because "Add call" is so infrequently-used, and
+                // because the user experience is pretty confusing if you
+                // inadvertently trigger it.)
+                if (VDBG) log("handleCallKey: call in foregound ==> ignoring.");
+                // But note we still consume this key event; see below.
+            }
         }
 
         // We *always* consume the CALL key, since the system-wide default
@@ -3250,7 +3266,7 @@ public class InCallScreen extends Activity
          */
         static void initConfiguration(Configuration config) {
             if (VDBG) Log.d(LOG_TAG, "[InCallScreen.ConfigurationHelper] "
-                            + "initConfiguration(" + config + ")...");
+                           + "initConfiguration(" + config + ")...");
             sOrientation = config.orientation;
         }
 
index d525b20..3493b74 100644 (file)
@@ -401,3 +401,4 @@ public class NetworkSetting extends PreferenceActivity
         Log.d(LOG_TAG, "[NetworksList] " + msg);
     }
 }
+
index f1dd160..8adb554 100644 (file)
@@ -27,27 +27,52 @@ import android.content.Intent;
 import android.database.Cursor;
 import android.media.AudioManager;
 import android.net.Uri;
+import android.os.Handler;
 import android.os.IBinder;
+import android.os.Message;
 import android.os.SystemClock;
 import android.provider.CallLog.Calls;
 import android.provider.Contacts.Phones;
-import com.android.internal.telephony.Call;
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
-import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.Phone;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 import android.util.Log;
 import android.widget.RemoteViews;
 import android.widget.Toast;
 
+import com.android.internal.telephony.Call;
+import com.android.internal.telephony.CallerInfo;
+import com.android.internal.telephony.CallerInfoAsyncQuery;
+import com.android.internal.telephony.Connection;
+import com.android.internal.telephony.Phone;
+
+
 /**
  * NotificationManager-related utility code for the Phone app.
  */
 public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteListener{
     private static final String LOG_TAG = PhoneApp.LOG_TAG;
     private static final boolean DBG = false;
+    private static final int EVENT_ENHANCED_VP_ON  = 1;
+    private static final int EVENT_ENHANCED_VP_OFF = 2;
+
+    // **Callback for enhanced voice privacy return value
+    private Handler mEnhancedVPHandler = new Handler() {
+        boolean enhancedVoicePrivacy = false;
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+            case EVENT_ENHANCED_VP_ON:
+                enhancedVoicePrivacy = true;
+                break;
+            case EVENT_ENHANCED_VP_OFF:
+                enhancedVoicePrivacy = false;
+                break;
+            default:
+                // We should never reach this
+            }
+            updateInCallNotification(enhancedVoicePrivacy);
+        }
+    };
 
     private static final String[] CALL_LOG_PROJECTION = new String[] {
         Calls._ID,
@@ -103,6 +128,8 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
 
         PhoneApp app = PhoneApp.getInstance();
         mPhone = app.phone;
+        mPhone.registerForInCallVoicePrivacyOn(mEnhancedVPHandler,  EVENT_ENHANCED_VP_ON,  null);
+        mPhone.registerForInCallVoicePrivacyOff(mEnhancedVPHandler, EVENT_ENHANCED_VP_OFF, null);
     }
 
     static void init(Context context) {
@@ -467,7 +494,9 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
         }
     }
 
-    void updateInCallNotification() {
+    private void updateInCallNotification(boolean enhancedVoicePrivacy) {
+        // WINK:TODO: Teleca, what is the correct code here.
+        int resId;
         if (DBG) log("updateInCallNotification()...");
 
         if (mPhone.getState() != Phone.State.OFFHOOK) {
@@ -479,10 +508,19 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
 
         // Display the appropriate "in-call" icon in the status bar,
         // which depends on the current phone and/or bluetooth state.
-        int resId = android.R.drawable.stat_sys_phone_call;
+        resId = 0;
+        if (enhancedVoicePrivacy) {
+            resId = android.R.drawable.stat_sys_vp_phone_call;
+        } else {
+            resId = android.R.drawable.stat_sys_phone_call;
+        }
         if (!hasActiveCall && hasHoldingCall) {
             // There's only one call, and it's on hold.
-            resId = android.R.drawable.stat_sys_phone_call_on_hold;
+            if (enhancedVoicePrivacy) {
+                resId = android.R.drawable.stat_sys_vp_phone_call_on_hold;
+            } else {
+                resId = android.R.drawable.stat_sys_phone_call_on_hold;
+            }
         } else if (PhoneApp.getInstance().showBluetoothIndication()) {
             // Bluetooth is active.
             resId = com.android.internal.R.drawable.stat_sys_phone_call_bluetooth;
@@ -613,6 +651,10 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
         updateMuteNotification();
     }
 
+    void updateInCallNotification() {
+        updateInCallNotification(false);
+    }
+
     /**
      * Implemented for CallerInfoAsyncQuery.OnQueryCompleteListener interface.
      * refreshes the contentView when called. 
@@ -681,7 +723,7 @@ public class NotificationMgr implements CallerInfoAsyncQuery.OnQueryCompleteList
             // So handle case (2) by retrying the lookup after a short
             // delay.
 
-            if ((vmNumber == null) && !mPhone.getSimRecordsLoaded()) {
+            if ((vmNumber == null) && !mPhone.getIccRecordsLoaded()) {
                 if (DBG) log("- Null vm number: SIM records not loaded (yet)...");
 
                 // TODO: rather than retrying after an arbitrary delay, it
index c7fdf13..2c294bc 100644 (file)
 
 package com.android.phone;
 
-import com.android.internal.telephony.MmiCode;
-import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.PhoneFactory;
-import com.android.internal.telephony.SimCard;
-import com.android.internal.telephony.TelephonyIntents;
+
 
 import android.app.Activity;
 import android.app.Application;
@@ -54,6 +50,12 @@ import android.util.Log;
 import android.view.KeyEvent;
 import android.widget.Toast;
 
+import com.android.internal.telephony.IccCard;
+import com.android.internal.telephony.MmiCode;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.TelephonyIntents;
+
 /**
  * Top-level Application class for the Phone app.
  */
@@ -214,8 +216,8 @@ public class PhoneApp extends Application {
 
                 case EVENT_SIM_NETWORK_LOCKED:
                     if (Config.LOGV) Log.v(LOG_TAG, "show sim depersonal panel");
-                    SimNetworkDepersonalizationPanel ndpPanel =
-                        new SimNetworkDepersonalizationPanel(PhoneApp.getInstance());
+                    IccNetworkDepersonalizationPanel ndpPanel =
+                        new IccNetworkDepersonalizationPanel(PhoneApp.getInstance());
                     ndpPanel.show();
                     break;
 
@@ -261,7 +263,7 @@ public class PhoneApp extends Application {
                     // Marks the event where the SIM goes into ready state.
                     // Right now, this is only used for the PUK-unlocking
                     // process.
-                    if (msg.obj.equals(SimCard.INTENT_VALUE_SIM_READY)) {
+                    if (msg.obj.equals(IccCard.INTENT_VALUE_ICC_READY)) {
                         // when the right event is triggered and there
                         // are UI objects in the foreground, we close
                         // them to display the lock panel.
@@ -329,10 +331,10 @@ public class PhoneApp extends Application {
 
             notifier = new CallNotifier(this, phone, ringer, mBtHandsfree);
 
-            // register for SIM status
-            SimCard sim = phone.getSimCard();
+            // register for ICC status
+            IccCard sim = phone.getIccCard();
             if (sim != null) {
-                if (Config.LOGV) Log.v(LOG_TAG, "register for SIM status");
+                if (Config.LOGV) Log.v(LOG_TAG, "register for ICC status");
                 sim.registerForAbsent(mHandler, EVENT_SIM_ABSENT, null);
                 sim.registerForLocked(mHandler, EVENT_SIM_LOCKED, null);
                 sim.registerForNetworkLocked(mHandler, EVENT_SIM_NETWORK_LOCKED, null);
@@ -353,6 +355,7 @@ public class PhoneApp extends Application {
             intentFilter.addAction(Intent.ACTION_HEADSET_PLUG);
             intentFilter.addAction(Intent.ACTION_BATTERY_LOW);
             intentFilter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
+            intentFilter.addAction(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
             registerReceiver(mReceiver, intentFilter);
 
             // Use a separate receiver for ACTION_MEDIA_BUTTON broadcasts,
@@ -395,7 +398,7 @@ public class PhoneApp extends Application {
         }
 
         // XXX pre-load the SimProvider so that it's ready
-        resolver.getType(Uri.parse("content://sim/adn"));
+        resolver.getType(Uri.parse("content://icc/adn"));
 
         // start with the default value to set the mute state.
         mShouldRestoreMuteOnInCallResume = false;
@@ -889,6 +892,27 @@ public class PhoneApp extends Application {
         PhoneUtils.displayMMIComplete(phone, getInstance(), mmiCode, null, null);
     }
 
+    private void initForNewRadioTechnology() {
+        if(DBG) Log.d(LOG_TAG, "initForNewRadioTechnology...");
+
+        ringer.updateRingerContextAfterRadioTechnologyChange(this.phone);
+        notifier.updateCallNotifierRegistrationsAfterRadioTechnologyChange();
+        if(mBtHandsfree != null) {
+            mBtHandsfree.updateBtHandsfreeAfterRadioTechnologyChange();
+        }
+
+        //Update registration for ICC status after radio technology change
+        IccCard sim = phone.getIccCard();
+        if (sim != null) {
+            if(DBG) Log.d(LOG_TAG, "Update registration for ICC status...");
+
+            //Register all events new to the new active phone
+            sim.registerForAbsent(mHandler, EVENT_SIM_ABSENT, null);
+            sim.registerForLocked(mHandler, EVENT_SIM_LOCKED, null);
+            sim.registerForNetworkLocked(mHandler, EVENT_SIM_NETWORK_LOCKED, null);
+        }
+    }
+
     /**
      * @return true if a wired headset is currently plugged in.
      *
@@ -1042,7 +1066,11 @@ public class PhoneApp extends Application {
                 // NOTE: This is ONLY triggered if an attempt to un-PUK-lock has
                 // been attempted.
                 mHandler.sendMessage(mHandler.obtainMessage(EVENT_SIM_STATE_CHANGED,
-                        intent.getStringExtra(SimCard.INTENT_KEY_SIM_STATE)));
+                        intent.getStringExtra(IccCard.INTENT_KEY_ICC_STATE)));
+            } else if (action.equals(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED)) {
+                String newPhone = intent.getStringExtra(Phone.PHONE_NAME_KEY);
+                Log.d(LOG_TAG, "Radio technology switched. Now " + newPhone + " is active.");
+                initForNewRadioTechnology();
             }
         }
     }
@@ -1084,3 +1112,6 @@ public class PhoneApp extends Application {
         }
     }
 }
+
+
+
index 9b9e5f3..6ecc69c 100644 (file)
@@ -27,12 +27,16 @@ import android.os.Message;
 import android.os.ServiceManager;
 import android.telephony.NeighboringCellInfo;
 import android.telephony.ServiceState;
+import android.text.TextUtils;
+import android.util.Log;
+
 import com.android.internal.telephony.DefaultPhoneNotifier;
+import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.ITelephony;
 import com.android.internal.telephony.Phone;
-import com.android.internal.telephony.SimCard;
-import android.text.TextUtils;
-import android.util.Log;
+
+import static com.android.internal.telephony.RILConstants.GSM_PHONE;
+import static com.android.internal.telephony.RILConstants.CDMA_PHONE;
 
 import java.util.List;
 import java.util.ArrayList;
@@ -366,7 +370,7 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
 
     public boolean supplyPin(String pin) {
         enforceModifyPermission();
-        final CheckSimPin checkSimPin = new CheckSimPin(mPhone.getSimCard());
+        final CheckSimPin checkSimPin = new CheckSimPin(mPhone.getIccCard());
         checkSimPin.start();
         return checkSimPin.checkPin(pin);
     }
@@ -377,7 +381,7 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
      */
     private static class CheckSimPin extends Thread {
 
-        private final SimCard mSimCard;
+        private final IccCard mSimCard;
 
         private boolean mDone = false;
         private boolean mResult = false;
@@ -388,7 +392,7 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
         // For async handler to identify request type
         private static final int SUPPLY_PIN_COMPLETE = 100;
 
-        public CheckSimPin(SimCard simCard) {
+        public CheckSimPin(IccCard simCard) {
             mSimCard = simCard;
         }
 
@@ -612,4 +616,14 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
     private void log(String msg) {
         Log.d(LOG_TAG, "[PhoneIntfMgr] " + msg);
     }
+
+    public int getActivePhoneType() {
+        if(mPhone.getPhoneName().equals("CDMA")) {
+            return CDMA_PHONE;
+        } else {
+            return GSM_PHONE;
+        }
+    }
 }
+
+
index c476598..d8621e2 100644 (file)
 
 package com.android.phone;
 
-import com.android.internal.telephony.Call;
-import com.android.internal.telephony.CallStateException;
-import com.android.internal.telephony.CallerInfo;
-import com.android.internal.telephony.CallerInfoAsyncQuery;
-import com.android.internal.telephony.Connection;
-import com.android.internal.telephony.MmiCode;
-import com.android.internal.telephony.Phone;
-
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.KeyguardManager;
@@ -47,6 +39,14 @@ import android.view.WindowManager;
 import android.widget.EditText;
 import android.widget.Toast;
 
+import com.android.internal.telephony.Call;
+import com.android.internal.telephony.CallStateException;
+import com.android.internal.telephony.CallerInfo;
+import com.android.internal.telephony.CallerInfoAsyncQuery;
+import com.android.internal.telephony.Connection;
+import com.android.internal.telephony.MmiCode;
+import com.android.internal.telephony.Phone;
+
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
@@ -1365,7 +1365,8 @@ public class PhoneUtils {
         }
 
         if (!ignore) {
-            AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
+            AudioManager audioManager = 
+                    (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
             // Enable stack dump only when actively debugging ("new Throwable()" is expensive!)
             if (DBG_SETAUDIOMODE_STACK) Log.d(LOG_TAG, "Stack:", new Throwable("stack dump"));
             audioManager.setMode(mode);
@@ -1469,7 +1470,7 @@ public class PhoneUtils {
      *
      * @return true if we find a connection that is disconnected, and
      * pending removal via
-     * {@link com.android.internal.telephony.gsm.GSMCall#clearDisconnected()}.
+     * {@link com.android.internal.telephony.gsm.GsmCall#clearDisconnected()}.
      */
     private static final boolean hasDisconnectedConnections(Call call) {
         // look through all connections for non-active ones.
index 15bdba0..25dad0e 100644 (file)
@@ -69,6 +69,18 @@ public class Ringer {
     }
 
     /**
+     * After a radio technology change, e.g. from CDMA to GSM or vice versa,
+     * the Context of the Ringer has to be updated. This is done by that function.
+     * 
+     * @parameter Phone, the new active phone for the appropriate radio
+     * technology
+     */
+    void updateRingerContextAfterRadioTechnologyChange(Phone phone) {
+        if(DBG) Log.d(LOG_TAG, "updateRingerContextAfterRadioTechnologyChange...");
+        mContext = phone.getContext();
+    }
+
+    /**
      * @return true if we're playing a ringtone and/or vibrating
      *     to indicate that there's an incoming call.
      *     ("Ringing" here is used in the general sense.  If you literally
index d53122e..7c5ff67 100644 (file)
@@ -18,14 +18,17 @@ package com.android.phone;
 
 import android.app.AlertDialog;
 import android.content.DialogInterface;
-import android.os.AsyncResult;
-import android.os.Bundle;
-import android.os.Handler;
 import android.os.Message;
+import android.os.Handler;
+import android.os.Bundle;
+import android.os.AsyncResult;
+import android.preference.CheckBoxPreference;
+import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceScreen;
-import android.preference.CheckBoxPreference;
+import android.util.Log;
+
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneFactory;
 
@@ -33,21 +36,26 @@ import com.android.internal.telephony.PhoneFactory;
  * List of Phone-specific settings screens.
  */
 public class Settings extends PreferenceActivity implements DialogInterface.OnClickListener,
-        DialogInterface.OnDismissListener {
+        DialogInterface.OnDismissListener, Preference.OnPreferenceChangeListener{
+    
+    // debug data
+    private static final String LOG_TAG = "NetworkSettings";
+    private static final boolean DBG = true;
 
     //String keys for preference lookup
+    private static final String BUTTON_PREFERED_NETWORK_MODE = "preferred_network_mode_key";
     private static final String BUTTON_ROAMING_KEY = "button_roaming_key";
-    private static final String BUTTON_PREFER_2G_KEY = "button_prefer_2g_key";
+    
+    static final int preferredNetworkMode = Phone.PREFERRED_NT_MODE;
     
     //UI objects
+    private ListPreference mButtonPreferredNetworkMode;
     private CheckBoxPreference mButtonDataRoam;
-    private CheckBoxPreference mButtonPrefer2g;
     
     private Phone mPhone;
-    
+    private MyHandler mHandler;
     private boolean mOkClicked;
         
-    private MyHandler mHandler;
     
     //This is a method implemented for DialogInterface.OnClickListener.
     //  Used to dismiss the dialogs when they come up.
@@ -75,7 +83,17 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
      */
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
-        if (preference == mButtonDataRoam) {
+        if (preference == mButtonPreferredNetworkMode) {
+            //displays the value taken from the Settings.System
+            int settingsNetworkMode = android.provider.Settings.Secure.getInt(mPhone.getContext().
+                    getContentResolver(), android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                    preferredNetworkMode);            
+            mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
+            return true;
+        }
+        else if (preference == mButtonDataRoam) {
+            if (DBG) log("onPreferenceTreeClick: preference == mButtonDataRoam.");
+        
             //normally called on the toggle click
             if (mButtonDataRoam.isChecked()) {
                 // First confirm with a warning dialog about charges
@@ -88,16 +106,13 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
                         .setNegativeButton(android.R.string.no, this)
                         .show()
                         .setOnDismissListener(this);
-            } else {
+            } 
+            else {
                 mPhone.setDataRoamingEnabled(false);
             }
             return true;
-        } else if (preference == mButtonPrefer2g) {
-            int networkType = mButtonPrefer2g.isChecked() ? Phone.NT_GSM_TYPE : Phone.NT_AUTO_TYPE;
-            mPhone.setPreferredNetworkType(networkType, mHandler
-                    .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE));
-            return true;
-        } else {
+        } 
+        else {
             // if the button is anything but the simple toggle preference,
             // we'll need to disable all preferences to reject all click
             // events until the sub-activity's UI comes up.
@@ -107,7 +122,8 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
         }
     }
     
-    public void onCreate(Bundle icicle) {
+    @Override
+    protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
         addPreferencesFromResource(R.xml.network_setting);
@@ -119,8 +135,18 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
         PreferenceScreen prefSet = getPreferenceScreen();
 
         mButtonDataRoam = (CheckBoxPreference) prefSet.findPreference(BUTTON_ROAMING_KEY);
-        mButtonPrefer2g = (CheckBoxPreference) prefSet.findPreference(BUTTON_PREFER_2G_KEY);
+        mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference(
+                BUTTON_PREFERED_NETWORK_MODE);
         
+        // set the listener for the mButtonPreferredNetworkMode list preference so we can issue 
+        // change Preferred Network Mode.
+        mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
+        
+        //Get the networkMode from Settings.System and displays it
+        int settingsNetworkMode = android.provider.Settings.Secure.getInt(mPhone.getContext().
+                getContentResolver(),android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                preferredNetworkMode);
+        mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
         // The intent code that resided here in the past has been moved into the
         // more conventional location in network_setting.xml
     }
@@ -128,6 +154,7 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
     @Override
     protected void onResume() {
         super.onResume();
+        
         // upon resumption from the sub-activity, make sure we re-enable the
         // preferences.
         getPreferenceScreen().setEnabled(true);
@@ -136,11 +163,58 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
         // app to change this setting's backend, and re-launch this settings app
         // and the UI state would be inconsistent with actual state
         mButtonDataRoam.setChecked(mPhone.getDataRoamingEnabled());
-
-        // Get the state for 'prefer 2g' setting
-        mPhone.getPreferredNetworkType(mHandler.obtainMessage(MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
+        mPhone.getPreferredNetworkType(mHandler.obtainMessage(
+                MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
     }
     
+    /**
+     * Implemented to support onPreferenceChangeListener to look for preference
+     * changes specifically on CLIR.
+     *
+     * @param preference is the preference to be changed, should be mButtonCLIR.
+     * @param objValue should be the value of the selection, NOT its localized
+     * display value.
+     */
+    public boolean onPreferenceChange(Preference preference, Object objValue) {
+        if (preference == mButtonPreferredNetworkMode) {
+            //NOTE onPreferenceChange seems to be called even if there is no change
+            //Check if the button value is changed from the System.Setting
+            mButtonPreferredNetworkMode.setValue((String) objValue);
+            int buttonNetworkMode;
+            buttonNetworkMode = Integer.valueOf((String) objValue).intValue();
+            int settingsNetworkMode = android.provider.Settings.Secure.getInt(
+                    mPhone.getContext().getContentResolver(),
+                    android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode);
+            if (buttonNetworkMode != settingsNetworkMode) {
+                int modemNetworkMode; 
+                switch(buttonNetworkMode) { //Extend to enable user choise of other network modes
+                    case Phone.NT_MODE_GSM_UMTS:
+                        modemNetworkMode = Phone.NT_MODE_GSM_UMTS;
+                        break;
+                    case Phone.NT_MODE_CDMA:
+                        modemNetworkMode = Phone.NT_MODE_CDMA;
+                        break;
+                    case Phone.NT_MODE_GLOBAL:
+                        modemNetworkMode = Phone.NT_MODE_GLOBAL;
+                        break;
+                    default:
+                        modemNetworkMode = Phone.PREFERRED_NT_MODE;
+                } 
+                UpdatePreferredNetworkModeSummary(buttonNetworkMode);
+
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                        buttonNetworkMode );
+                //Set the modem network moode
+                mPhone.setPreferredNetworkType(modemNetworkMode, mHandler
+                        .obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE));
+            }
+        }
+
+        // always let the preference setting proceed.
+        return true;
+    }
+
     private class MyHandler extends Handler {
 
         private static final int MESSAGE_GET_PREFERRED_NETWORK_TYPE = 0;
@@ -163,26 +237,115 @@ public class Settings extends PreferenceActivity implements DialogInterface.OnCl
             AsyncResult ar = (AsyncResult) msg.obj;
             
             if (ar.exception == null) {
-                int type = ((int[])ar.result)[0];
-                mButtonPrefer2g.setChecked(type == Phone.NT_GSM_TYPE);
+                int modemNetworkMode = ((int[])ar.result)[0];
                 
-            } else {
-                // Weird state, disable the setting
-                mButtonPrefer2g.setEnabled(false);
+                if (DBG) {
+                    log ("handleGetPreferredNetworkTypeResponse: modemNetworkMode = " + 
+                            modemNetworkMode);
+                }
+                
+                int settingsNetworkMode = android.provider.Settings.Secure.getInt(
+                        mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                        preferredNetworkMode);
+                
+                if (DBG) {
+                    log("handleGetPreferredNetworkTypeReponse: settingsNetworkMode = " + 
+                            settingsNetworkMode);
+                }
+                
+                //check that modemNetworkMode is from an accepted value
+                if (modemNetworkMode == Phone.NT_MODE_WCDMA_PREF ||  
+                        modemNetworkMode == Phone.NT_MODE_GSM_ONLY ||
+                        modemNetworkMode == Phone.NT_MODE_WCDMA_ONLY ||
+                        modemNetworkMode == Phone.NT_MODE_GSM_UMTS ||
+                        modemNetworkMode == Phone.NT_MODE_CDMA ||
+                        modemNetworkMode == Phone.NT_MODE_CDMA_NO_EVDO ||
+                        modemNetworkMode == Phone.NT_MODE_EVDO_NO_CDMA ||
+                        modemNetworkMode == Phone.NT_MODE_GLOBAL ) {
+                    if (DBG) {
+                        log("handleGetPreferredNetworkTypeResponse: if 1: modemNetworkMode = " + 
+                                modemNetworkMode);
+                    }
+                
+                    //check changes in modemNetworkMode and updates settingsNetworkMode 
+                    if (modemNetworkMode != settingsNetworkMode) {
+                        if (DBG) {
+                            log("handleGetPreferredNetworkTypeResponse: if 2: " +
+                                    "modemNetworkMode != settingsNetworkMode");
+                        }
+                        
+                        settingsNetworkMode = modemNetworkMode;
+                        
+                        if (DBG) { log("handleGetPreferredNetworkTypeResponse: if 2: " + 
+                                "settingsNetworkMode = " + settingsNetworkMode);
+                        }
+                        
+                        //changes the Settings.System accordingly to modemNetworkMode
+                        android.provider.Settings.Secure.putInt(
+                                mPhone.getContext().getContentResolver(),
+                                android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                                settingsNetworkMode );
+                    }
+
+                    UpdatePreferredNetworkModeSummary(modemNetworkMode);
+                    // changes the mButtonPreferredNetworkMode accordingly to modemNetworkMode
+                    mButtonPreferredNetworkMode.setValue(Integer.toString(modemNetworkMode)); 
+                } else {
+                    if (DBG) log("handleGetPreferredNetworkTypeResponse: else: reset to default");
+                    resetNetworkModeToDefault();
+                }
             }
         }
 
         private void handleSetPreferredNetworkTypeResponse(Message msg) {
             AsyncResult ar = (AsyncResult) msg.obj;
 
-            if (ar.exception != null) {
-                // Yikes, error, disable the setting
-                mButtonPrefer2g.setEnabled(false);
-                // Set UI to current state
+            if (ar.exception == null) {
+                int networkMode = Integer.valueOf(
+                        mButtonPreferredNetworkMode.getValue()).intValue();
+                android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                        networkMode );
+            } else {
                 mPhone.getPreferredNetworkType(obtainMessage(MESSAGE_GET_PREFERRED_NETWORK_TYPE));
             }
         }
+        
+        private void resetNetworkModeToDefault() {
+            //set the mButtonPreferredNetworkMode
+            mButtonPreferredNetworkMode.setValue(Integer.toString(preferredNetworkMode));
+            //set the Settings.System 
+            android.provider.Settings.Secure.putInt(mPhone.getContext().getContentResolver(),
+                        android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, 
+                        preferredNetworkMode );            
+            //Set the Modem
+            mPhone.setPreferredNetworkType(preferredNetworkMode, 
+                    this.obtainMessage(MyHandler.MESSAGE_SET_PREFERRED_NETWORK_TYPE));
+        }
+    }
+        
+    private void UpdatePreferredNetworkModeSummary(int NetworkMode) {
+        switch(NetworkMode) { //Extend to enable log of other network modes
+            case Phone.NT_MODE_WCDMA_PREF:
+            case Phone.NT_MODE_GSM_ONLY:
+            case Phone.NT_MODE_WCDMA_ONLY:
+            case Phone.NT_MODE_GSM_UMTS:
+                mButtonPreferredNetworkMode.setSummary("Preferred network mode: GSM");
+                break;
+            case Phone.NT_MODE_CDMA:
+            case Phone.NT_MODE_CDMA_NO_EVDO:
+            case Phone.NT_MODE_EVDO_NO_CDMA:
+                mButtonPreferredNetworkMode.setSummary("Preferred network mode: CDMA");
+                break;
+            case Phone.NT_MODE_GLOBAL:
+            default:
+                mButtonPreferredNetworkMode.setSummary("Preferred network mode: Global");
+        }
     }
     
+    private static void log(String msg) {
+        Log.d(LOG_TAG, msg);
+    }
 }
     
index 4ece1de..f77839d 100644 (file)
@@ -127,7 +127,7 @@ public class SimContacts extends ADNList {
     @Override
     protected Uri resolveIntent() {
         Intent intent = getIntent();
-        intent.setData(Uri.parse("content://sim/adn"));
+        intent.setData(Uri.parse("content://icc/adn"));
         if (Intent.ACTION_PICK.equals(intent.getAction())) {
             // "index" is 1-based
             mInitialSelection = intent.getIntExtra("index", 0) - 1;