Home | History | Annotate | Download | only in telephony
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.internal.telephony;
     18 
     19 
     20 import android.app.ActivityManagerNative;
     21 import android.content.Context;
     22 import android.content.Intent;
     23 import android.net.LinkCapabilities;
     24 import android.net.LinkProperties;
     25 import android.os.AsyncResult;
     26 import android.os.Handler;
     27 import android.os.Message;
     28 import android.os.SystemProperties;
     29 import android.telephony.CellLocation;
     30 import android.telephony.ServiceState;
     31 import android.telephony.SignalStrength;
     32 import android.util.Log;
     33 
     34 import com.android.internal.telephony.cdma.CDMAPhone;
     35 import com.android.internal.telephony.gsm.GSMPhone;
     36 import com.android.internal.telephony.gsm.UsimServiceTable;
     37 import com.android.internal.telephony.ims.IsimRecords;
     38 import com.android.internal.telephony.test.SimulatedRadioControl;
     39 import com.android.internal.telephony.CallManager;
     40 
     41 import java.util.List;
     42 
     43 public class PhoneProxy extends Handler implements Phone {
     44     public final static Object lockForRadioTechnologyChange = new Object();
     45 
     46     private Phone mActivePhone;
     47     private CommandsInterface mCommandsInterface;
     48     private IccSmsInterfaceManagerProxy mIccSmsInterfaceManagerProxy;
     49     private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy;
     50     private PhoneSubInfoProxy mPhoneSubInfoProxy;
     51 
     52     private boolean mResetModemOnRadioTechnologyChange = false;
     53 
     54     private int mRilVersion;
     55 
     56     private static final int EVENT_VOICE_RADIO_TECH_CHANGED = 1;
     57     private static final int EVENT_RADIO_ON = 2;
     58     private static final int EVENT_REQUEST_VOICE_RADIO_TECH_DONE = 3;
     59     private static final int EVENT_RIL_CONNECTED = 4;
     60 
     61     private static final String LOG_TAG = "PHONE";
     62 
     63     //***** Class Methods
     64     public PhoneProxy(Phone phone) {
     65         mActivePhone = phone;
     66         mResetModemOnRadioTechnologyChange = SystemProperties.getBoolean(
     67                 TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false);
     68         mIccSmsInterfaceManagerProxy = new IccSmsInterfaceManagerProxy(
     69                 phone.getIccSmsInterfaceManager());
     70         mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy(
     71                 phone.getIccPhoneBookInterfaceManager());
     72         mPhoneSubInfoProxy = new PhoneSubInfoProxy(phone.getPhoneSubInfo());
     73         mCommandsInterface = ((PhoneBase)mActivePhone).mCM;
     74 
     75         mCommandsInterface.registerForRilConnected(this, EVENT_RIL_CONNECTED, null);
     76         mCommandsInterface.registerForOn(this, EVENT_RADIO_ON, null);
     77         mCommandsInterface.registerForVoiceRadioTechChanged(
     78                              this, EVENT_VOICE_RADIO_TECH_CHANGED, null);
     79     }
     80 
     81     @Override
     82     public void handleMessage(Message msg) {
     83         AsyncResult ar = (AsyncResult) msg.obj;
     84         switch(msg.what) {
     85         case EVENT_RADIO_ON:
     86             /* Proactively query voice radio technologies */
     87             mCommandsInterface.getVoiceRadioTechnology(
     88                     this.obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
     89             break;
     90 
     91         case EVENT_RIL_CONNECTED:
     92             if (ar.exception == null && ar.result != null) {
     93                 mRilVersion = (Integer) ar.result;
     94             } else {
     95                 logd("Unexpected exception on EVENT_RIL_CONNECTED");
     96                 mRilVersion = -1;
     97             }
     98             break;
     99 
    100         case EVENT_VOICE_RADIO_TECH_CHANGED:
    101         case EVENT_REQUEST_VOICE_RADIO_TECH_DONE:
    102 
    103             if (ar.exception == null) {
    104                 if ((ar.result != null) && (((int[]) ar.result).length != 0)) {
    105                     int newVoiceTech = ((int[]) ar.result)[0];
    106                     updatePhoneObject(newVoiceTech);
    107                 } else {
    108                     loge("Voice Radio Technology event " + msg.what + " has no tech!");
    109                 }
    110             } else {
    111                 loge("Voice Radio Technology event " + msg.what + " exception!" + ar.exception);
    112             }
    113             break;
    114 
    115         default:
    116             loge("Error! This handler was not registered for this message type. Message: "
    117                     + msg.what);
    118             break;
    119         }
    120         super.handleMessage(msg);
    121     }
    122 
    123     private static void logd(String msg) {
    124         Log.d(LOG_TAG, "[PhoneProxy] " + msg);
    125     }
    126 
    127     private void logw(String msg) {
    128         Log.w(LOG_TAG, "[PhoneProxy] " + msg);
    129     }
    130 
    131     private void loge(String msg) {
    132         Log.e(LOG_TAG, "[PhoneProxy] " + msg);
    133     }
    134 
    135     private void updatePhoneObject(int newVoiceRadioTech) {
    136 
    137         if (mActivePhone != null) {
    138             if(mRilVersion == 6 && getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE) {
    139                 /*
    140                  * On v6 RIL, when LTE_ON_CDMA is TRUE, always create CDMALTEPhone
    141                  * irrespective of the voice radio tech reported.
    142                  */
    143                 if (mActivePhone.getPhoneType() == PHONE_TYPE_CDMA) {
    144                     logd("LTE ON CDMA property is set. Use CDMA Phone" +
    145                             " newVoiceRadioTech = " + newVoiceRadioTech +
    146                             " Active Phone = " + mActivePhone.getPhoneName());
    147                     return;
    148                 } else {
    149                     logd("LTE ON CDMA property is set. Switch to CDMALTEPhone" +
    150                             " newVoiceRadioTech = " + newVoiceRadioTech +
    151                             " Active Phone = " + mActivePhone.getPhoneName());
    152                     newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
    153                 }
    154             } else {
    155                 if ((ServiceState.isCdma(newVoiceRadioTech) &&
    156                         mActivePhone.getPhoneType() == PHONE_TYPE_CDMA) ||
    157                         (ServiceState.isGsm(newVoiceRadioTech) &&
    158                                 mActivePhone.getPhoneType() == PHONE_TYPE_GSM)) {
    159                     // Nothing changed. Keep phone as it is.
    160                     logd("Ignoring voice radio technology changed message." +
    161                             " newVoiceRadioTech = " + newVoiceRadioTech +
    162                             " Active Phone = " + mActivePhone.getPhoneName());
    163                     return;
    164                 }
    165             }
    166         }
    167 
    168         if (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
    169             // We need some voice phone object to be active always, so never
    170             // delete the phone without anything to replace it with!
    171             logd("Ignoring voice radio technology changed message. newVoiceRadioTech = Unknown."
    172                     + " Active Phone = " + mActivePhone.getPhoneName());
    173             return;
    174         }
    175 
    176         boolean oldPowerState = false; // old power state to off
    177         if (mResetModemOnRadioTechnologyChange) {
    178             if (mCommandsInterface.getRadioState().isOn()) {
    179                 oldPowerState = true;
    180                 logd("Setting Radio Power to Off");
    181                 mCommandsInterface.setRadioPower(false, null);
    182             }
    183         }
    184 
    185         deleteAndCreatePhone(newVoiceRadioTech);
    186 
    187         if (mResetModemOnRadioTechnologyChange && oldPowerState) { // restore power state
    188             logd("Resetting Radio");
    189             mCommandsInterface.setRadioPower(oldPowerState, null);
    190         }
    191 
    192         // Set the new interfaces in the proxy's
    193         mIccSmsInterfaceManagerProxy.setmIccSmsInterfaceManager(
    194                 mActivePhone.getIccSmsInterfaceManager());
    195         mIccPhoneBookInterfaceManagerProxy.setmIccPhoneBookInterfaceManager(mActivePhone
    196                 .getIccPhoneBookInterfaceManager());
    197         mPhoneSubInfoProxy.setmPhoneSubInfo(this.mActivePhone.getPhoneSubInfo());
    198 
    199         mCommandsInterface = ((PhoneBase)mActivePhone).mCM;
    200 
    201         // Send an Intent to the PhoneApp that we had a radio technology change
    202         Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
    203         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
    204         intent.putExtra(Phone.PHONE_NAME_KEY, mActivePhone.getPhoneName());
    205         ActivityManagerNative.broadcastStickyIntent(intent, null);
    206 
    207     }
    208 
    209     private void deleteAndCreatePhone(int newVoiceRadioTech) {
    210 
    211         String outgoingPhoneName = "Unknown";
    212         Phone oldPhone = mActivePhone;
    213 
    214         if (oldPhone != null) {
    215             outgoingPhoneName = ((PhoneBase) oldPhone).getPhoneName();
    216         }
    217 
    218         logd("Switching Voice Phone : " + outgoingPhoneName + " >>> "
    219                 + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA"));
    220 
    221         if (oldPhone != null) {
    222             CallManager.getInstance().unregisterPhone(oldPhone);
    223             logd("Disposing old phone..");
    224             oldPhone.dispose();
    225         }
    226 
    227         // Give the garbage collector a hint to start the garbage collection
    228         // asap NOTE this has been disabled since radio technology change could
    229         // happen during e.g. a multimedia playing and could slow the system.
    230         // Tests needs to be done to see the effects of the GC call here when
    231         // system is busy.
    232         // System.gc();
    233 
    234         if (ServiceState.isCdma(newVoiceRadioTech)) {
    235             mActivePhone = PhoneFactory.getCdmaPhone();
    236         } else if (ServiceState.isGsm(newVoiceRadioTech)) {
    237             mActivePhone = PhoneFactory.getGsmPhone();
    238         }
    239 
    240         if (oldPhone != null) {
    241             oldPhone.removeReferences();
    242         }
    243 
    244         if(mActivePhone != null) {
    245             CallManager.getInstance().registerPhone(mActivePhone);
    246         }
    247 
    248         oldPhone = null;
    249     }
    250 
    251     public ServiceState getServiceState() {
    252         return mActivePhone.getServiceState();
    253     }
    254 
    255     public CellLocation getCellLocation() {
    256         return mActivePhone.getCellLocation();
    257     }
    258 
    259     public DataState getDataConnectionState() {
    260         return mActivePhone.getDataConnectionState(Phone.APN_TYPE_DEFAULT);
    261     }
    262 
    263     public DataState getDataConnectionState(String apnType) {
    264         return mActivePhone.getDataConnectionState(apnType);
    265     }
    266 
    267     public DataActivityState getDataActivityState() {
    268         return mActivePhone.getDataActivityState();
    269     }
    270 
    271     public Context getContext() {
    272         return mActivePhone.getContext();
    273     }
    274 
    275     public void disableDnsCheck(boolean b) {
    276         mActivePhone.disableDnsCheck(b);
    277     }
    278 
    279     public boolean isDnsCheckDisabled() {
    280         return mActivePhone.isDnsCheckDisabled();
    281     }
    282 
    283     public State getState() {
    284         return mActivePhone.getState();
    285     }
    286 
    287     public String getPhoneName() {
    288         return mActivePhone.getPhoneName();
    289     }
    290 
    291     public int getPhoneType() {
    292         return mActivePhone.getPhoneType();
    293     }
    294 
    295     public String[] getActiveApnTypes() {
    296         return mActivePhone.getActiveApnTypes();
    297     }
    298 
    299     public String getActiveApnHost(String apnType) {
    300         return mActivePhone.getActiveApnHost(apnType);
    301     }
    302 
    303     public LinkProperties getLinkProperties(String apnType) {
    304         return mActivePhone.getLinkProperties(apnType);
    305     }
    306 
    307     public LinkCapabilities getLinkCapabilities(String apnType) {
    308         return mActivePhone.getLinkCapabilities(apnType);
    309     }
    310 
    311     public SignalStrength getSignalStrength() {
    312         return mActivePhone.getSignalStrength();
    313     }
    314 
    315     public void registerForUnknownConnection(Handler h, int what, Object obj) {
    316         mActivePhone.registerForUnknownConnection(h, what, obj);
    317     }
    318 
    319     public void unregisterForUnknownConnection(Handler h) {
    320         mActivePhone.unregisterForUnknownConnection(h);
    321     }
    322 
    323     public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
    324         mActivePhone.registerForPreciseCallStateChanged(h, what, obj);
    325     }
    326 
    327     public void unregisterForPreciseCallStateChanged(Handler h) {
    328         mActivePhone.unregisterForPreciseCallStateChanged(h);
    329     }
    330 
    331     public void registerForNewRingingConnection(Handler h, int what, Object obj) {
    332         mActivePhone.registerForNewRingingConnection(h, what, obj);
    333     }
    334 
    335     public void unregisterForNewRingingConnection(Handler h) {
    336         mActivePhone.unregisterForNewRingingConnection(h);
    337     }
    338 
    339     public void registerForIncomingRing(Handler h, int what, Object obj) {
    340         mActivePhone.registerForIncomingRing(h, what, obj);
    341     }
    342 
    343     public void unregisterForIncomingRing(Handler h) {
    344         mActivePhone.unregisterForIncomingRing(h);
    345     }
    346 
    347     public void registerForDisconnect(Handler h, int what, Object obj) {
    348         mActivePhone.registerForDisconnect(h, what, obj);
    349     }
    350 
    351     public void unregisterForDisconnect(Handler h) {
    352         mActivePhone.unregisterForDisconnect(h);
    353     }
    354 
    355     public void registerForMmiInitiate(Handler h, int what, Object obj) {
    356         mActivePhone.registerForMmiInitiate(h, what, obj);
    357     }
    358 
    359     public void unregisterForMmiInitiate(Handler h) {
    360         mActivePhone.unregisterForMmiInitiate(h);
    361     }
    362 
    363     public void registerForMmiComplete(Handler h, int what, Object obj) {
    364         mActivePhone.registerForMmiComplete(h, what, obj);
    365     }
    366 
    367     public void unregisterForMmiComplete(Handler h) {
    368         mActivePhone.unregisterForMmiComplete(h);
    369     }
    370 
    371     public List<? extends MmiCode> getPendingMmiCodes() {
    372         return mActivePhone.getPendingMmiCodes();
    373     }
    374 
    375     public void sendUssdResponse(String ussdMessge) {
    376         mActivePhone.sendUssdResponse(ussdMessge);
    377     }
    378 
    379     public void registerForServiceStateChanged(Handler h, int what, Object obj) {
    380         mActivePhone.registerForServiceStateChanged(h, what, obj);
    381     }
    382 
    383     public void unregisterForServiceStateChanged(Handler h) {
    384         mActivePhone.unregisterForServiceStateChanged(h);
    385     }
    386 
    387     public void registerForSuppServiceNotification(Handler h, int what, Object obj) {
    388         mActivePhone.registerForSuppServiceNotification(h, what, obj);
    389     }
    390 
    391     public void unregisterForSuppServiceNotification(Handler h) {
    392         mActivePhone.unregisterForSuppServiceNotification(h);
    393     }
    394 
    395     public void registerForSuppServiceFailed(Handler h, int what, Object obj) {
    396         mActivePhone.registerForSuppServiceFailed(h, what, obj);
    397     }
    398 
    399     public void unregisterForSuppServiceFailed(Handler h) {
    400         mActivePhone.unregisterForSuppServiceFailed(h);
    401     }
    402 
    403     public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
    404         mActivePhone.registerForInCallVoicePrivacyOn(h,what,obj);
    405     }
    406 
    407     public void unregisterForInCallVoicePrivacyOn(Handler h){
    408         mActivePhone.unregisterForInCallVoicePrivacyOn(h);
    409     }
    410 
    411     public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj){
    412         mActivePhone.registerForInCallVoicePrivacyOff(h,what,obj);
    413     }
    414 
    415     public void unregisterForInCallVoicePrivacyOff(Handler h){
    416         mActivePhone.unregisterForInCallVoicePrivacyOff(h);
    417     }
    418 
    419     public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
    420         mActivePhone.registerForCdmaOtaStatusChange(h,what,obj);
    421     }
    422 
    423     public void unregisterForCdmaOtaStatusChange(Handler h) {
    424          mActivePhone.unregisterForCdmaOtaStatusChange(h);
    425     }
    426 
    427     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
    428         mActivePhone.registerForSubscriptionInfoReady(h, what, obj);
    429     }
    430 
    431     public void unregisterForSubscriptionInfoReady(Handler h) {
    432         mActivePhone.unregisterForSubscriptionInfoReady(h);
    433     }
    434 
    435     public void registerForEcmTimerReset(Handler h, int what, Object obj) {
    436         mActivePhone.registerForEcmTimerReset(h,what,obj);
    437     }
    438 
    439     public void unregisterForEcmTimerReset(Handler h) {
    440         mActivePhone.unregisterForEcmTimerReset(h);
    441     }
    442 
    443     public void registerForRingbackTone(Handler h, int what, Object obj) {
    444         mActivePhone.registerForRingbackTone(h,what,obj);
    445     }
    446 
    447     public void unregisterForRingbackTone(Handler h) {
    448         mActivePhone.unregisterForRingbackTone(h);
    449     }
    450 
    451     public void registerForResendIncallMute(Handler h, int what, Object obj) {
    452         mActivePhone.registerForResendIncallMute(h,what,obj);
    453     }
    454 
    455     public void unregisterForResendIncallMute(Handler h) {
    456         mActivePhone.unregisterForResendIncallMute(h);
    457     }
    458 
    459     public boolean getIccRecordsLoaded() {
    460         return mActivePhone.getIccRecordsLoaded();
    461     }
    462 
    463     public IccCard getIccCard() {
    464         return mActivePhone.getIccCard();
    465     }
    466 
    467     public void acceptCall() throws CallStateException {
    468         mActivePhone.acceptCall();
    469     }
    470 
    471     public void rejectCall() throws CallStateException {
    472         mActivePhone.rejectCall();
    473     }
    474 
    475     public void switchHoldingAndActive() throws CallStateException {
    476         mActivePhone.switchHoldingAndActive();
    477     }
    478 
    479     public boolean canConference() {
    480         return mActivePhone.canConference();
    481     }
    482 
    483     public void conference() throws CallStateException {
    484         mActivePhone.conference();
    485     }
    486 
    487     public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
    488         mActivePhone.enableEnhancedVoicePrivacy(enable, onComplete);
    489     }
    490 
    491     public void getEnhancedVoicePrivacy(Message onComplete) {
    492         mActivePhone.getEnhancedVoicePrivacy(onComplete);
    493     }
    494 
    495     public boolean canTransfer() {
    496         return mActivePhone.canTransfer();
    497     }
    498 
    499     public void explicitCallTransfer() throws CallStateException {
    500         mActivePhone.explicitCallTransfer();
    501     }
    502 
    503     public void clearDisconnected() {
    504         mActivePhone.clearDisconnected();
    505     }
    506 
    507     public Call getForegroundCall() {
    508         return mActivePhone.getForegroundCall();
    509     }
    510 
    511     public Call getBackgroundCall() {
    512         return mActivePhone.getBackgroundCall();
    513     }
    514 
    515     public Call getRingingCall() {
    516         return mActivePhone.getRingingCall();
    517     }
    518 
    519     public Connection dial(String dialString) throws CallStateException {
    520         return mActivePhone.dial(dialString);
    521     }
    522 
    523     public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {
    524         return mActivePhone.dial(dialString, uusInfo);
    525     }
    526 
    527     public boolean handlePinMmi(String dialString) {
    528         return mActivePhone.handlePinMmi(dialString);
    529     }
    530 
    531     public boolean handleInCallMmiCommands(String command) throws CallStateException {
    532         return mActivePhone.handleInCallMmiCommands(command);
    533     }
    534 
    535     public void sendDtmf(char c) {
    536         mActivePhone.sendDtmf(c);
    537     }
    538 
    539     public void startDtmf(char c) {
    540         mActivePhone.startDtmf(c);
    541     }
    542 
    543     public void stopDtmf() {
    544         mActivePhone.stopDtmf();
    545     }
    546 
    547     public void setRadioPower(boolean power) {
    548         mActivePhone.setRadioPower(power);
    549     }
    550 
    551     public boolean getMessageWaitingIndicator() {
    552         return mActivePhone.getMessageWaitingIndicator();
    553     }
    554 
    555     public boolean getCallForwardingIndicator() {
    556         return mActivePhone.getCallForwardingIndicator();
    557     }
    558 
    559     public String getLine1Number() {
    560         return mActivePhone.getLine1Number();
    561     }
    562 
    563     public String getCdmaMin() {
    564         return mActivePhone.getCdmaMin();
    565     }
    566 
    567     public boolean isMinInfoReady() {
    568         return mActivePhone.isMinInfoReady();
    569     }
    570 
    571     public String getCdmaPrlVersion() {
    572         return mActivePhone.getCdmaPrlVersion();
    573     }
    574 
    575     public String getLine1AlphaTag() {
    576         return mActivePhone.getLine1AlphaTag();
    577     }
    578 
    579     public void setLine1Number(String alphaTag, String number, Message onComplete) {
    580         mActivePhone.setLine1Number(alphaTag, number, onComplete);
    581     }
    582 
    583     public String getVoiceMailNumber() {
    584         return mActivePhone.getVoiceMailNumber();
    585     }
    586 
    587      /** @hide */
    588     public int getVoiceMessageCount(){
    589         return mActivePhone.getVoiceMessageCount();
    590     }
    591 
    592     public String getVoiceMailAlphaTag() {
    593         return mActivePhone.getVoiceMailAlphaTag();
    594     }
    595 
    596     public void setVoiceMailNumber(String alphaTag,String voiceMailNumber,
    597             Message onComplete) {
    598         mActivePhone.setVoiceMailNumber(alphaTag, voiceMailNumber, onComplete);
    599     }
    600 
    601     public void getCallForwardingOption(int commandInterfaceCFReason,
    602             Message onComplete) {
    603         mActivePhone.getCallForwardingOption(commandInterfaceCFReason,
    604                 onComplete);
    605     }
    606 
    607     public void setCallForwardingOption(int commandInterfaceCFReason,
    608             int commandInterfaceCFAction, String dialingNumber,
    609             int timerSeconds, Message onComplete) {
    610         mActivePhone.setCallForwardingOption(commandInterfaceCFReason,
    611             commandInterfaceCFAction, dialingNumber, timerSeconds, onComplete);
    612     }
    613 
    614     public void getOutgoingCallerIdDisplay(Message onComplete) {
    615         mActivePhone.getOutgoingCallerIdDisplay(onComplete);
    616     }
    617 
    618     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
    619             Message onComplete) {
    620         mActivePhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode,
    621                 onComplete);
    622     }
    623 
    624     public void getCallWaiting(Message onComplete) {
    625         mActivePhone.getCallWaiting(onComplete);
    626     }
    627 
    628     public void setCallWaiting(boolean enable, Message onComplete) {
    629         mActivePhone.setCallWaiting(enable, onComplete);
    630     }
    631 
    632     public void getAvailableNetworks(Message response) {
    633         mActivePhone.getAvailableNetworks(response);
    634     }
    635 
    636     public void setNetworkSelectionModeAutomatic(Message response) {
    637         mActivePhone.setNetworkSelectionModeAutomatic(response);
    638     }
    639 
    640     public void selectNetworkManually(OperatorInfo network, Message response) {
    641         mActivePhone.selectNetworkManually(network, response);
    642     }
    643 
    644     public void setPreferredNetworkType(int networkType, Message response) {
    645         mActivePhone.setPreferredNetworkType(networkType, response);
    646     }
    647 
    648     public void getPreferredNetworkType(Message response) {
    649         mActivePhone.getPreferredNetworkType(response);
    650     }
    651 
    652     public void getNeighboringCids(Message response) {
    653         mActivePhone.getNeighboringCids(response);
    654     }
    655 
    656     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
    657         mActivePhone.setOnPostDialCharacter(h, what, obj);
    658     }
    659 
    660     public void setMute(boolean muted) {
    661         mActivePhone.setMute(muted);
    662     }
    663 
    664     public boolean getMute() {
    665         return mActivePhone.getMute();
    666     }
    667 
    668     public void setEchoSuppressionEnabled(boolean enabled) {
    669         mActivePhone.setEchoSuppressionEnabled(enabled);
    670     }
    671 
    672     public void invokeOemRilRequestRaw(byte[] data, Message response) {
    673         mActivePhone.invokeOemRilRequestRaw(data, response);
    674     }
    675 
    676     public void invokeOemRilRequestStrings(String[] strings, Message response) {
    677         mActivePhone.invokeOemRilRequestStrings(strings, response);
    678     }
    679 
    680     public void getDataCallList(Message response) {
    681         mActivePhone.getDataCallList(response);
    682     }
    683 
    684     public void updateServiceLocation() {
    685         mActivePhone.updateServiceLocation();
    686     }
    687 
    688     public void enableLocationUpdates() {
    689         mActivePhone.enableLocationUpdates();
    690     }
    691 
    692     public void disableLocationUpdates() {
    693         mActivePhone.disableLocationUpdates();
    694     }
    695 
    696     public void setUnitTestMode(boolean f) {
    697         mActivePhone.setUnitTestMode(f);
    698     }
    699 
    700     public boolean getUnitTestMode() {
    701         return mActivePhone.getUnitTestMode();
    702     }
    703 
    704     public void setBandMode(int bandMode, Message response) {
    705         mActivePhone.setBandMode(bandMode, response);
    706     }
    707 
    708     public void queryAvailableBandMode(Message response) {
    709         mActivePhone.queryAvailableBandMode(response);
    710     }
    711 
    712     public boolean getDataRoamingEnabled() {
    713         return mActivePhone.getDataRoamingEnabled();
    714     }
    715 
    716     public void setDataRoamingEnabled(boolean enable) {
    717         mActivePhone.setDataRoamingEnabled(enable);
    718     }
    719 
    720     public void queryCdmaRoamingPreference(Message response) {
    721         mActivePhone.queryCdmaRoamingPreference(response);
    722     }
    723 
    724     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
    725         mActivePhone.setCdmaRoamingPreference(cdmaRoamingType, response);
    726     }
    727 
    728     public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
    729         mActivePhone.setCdmaSubscription(cdmaSubscriptionType, response);
    730     }
    731 
    732     public SimulatedRadioControl getSimulatedRadioControl() {
    733         return mActivePhone.getSimulatedRadioControl();
    734     }
    735 
    736     public int enableApnType(String type) {
    737         return mActivePhone.enableApnType(type);
    738     }
    739 
    740     public int disableApnType(String type) {
    741         return mActivePhone.disableApnType(type);
    742     }
    743 
    744     public boolean isDataConnectivityPossible() {
    745         return mActivePhone.isDataConnectivityPossible(Phone.APN_TYPE_DEFAULT);
    746     }
    747 
    748     public boolean isDataConnectivityPossible(String apnType) {
    749         return mActivePhone.isDataConnectivityPossible(apnType);
    750     }
    751 
    752     public String getDeviceId() {
    753         return mActivePhone.getDeviceId();
    754     }
    755 
    756     public String getDeviceSvn() {
    757         return mActivePhone.getDeviceSvn();
    758     }
    759 
    760     public String getSubscriberId() {
    761         return mActivePhone.getSubscriberId();
    762     }
    763 
    764     public String getIccSerialNumber() {
    765         return mActivePhone.getIccSerialNumber();
    766     }
    767 
    768     public String getEsn() {
    769         return mActivePhone.getEsn();
    770     }
    771 
    772     public String getMeid() {
    773         return mActivePhone.getMeid();
    774     }
    775 
    776     public String getMsisdn() {
    777         return mActivePhone.getMsisdn();
    778     }
    779 
    780     public String getImei() {
    781         return mActivePhone.getImei();
    782     }
    783 
    784     public PhoneSubInfo getPhoneSubInfo(){
    785         return mActivePhone.getPhoneSubInfo();
    786     }
    787 
    788     public IccSmsInterfaceManager getIccSmsInterfaceManager(){
    789         return mActivePhone.getIccSmsInterfaceManager();
    790     }
    791 
    792     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
    793         return mActivePhone.getIccPhoneBookInterfaceManager();
    794     }
    795 
    796     public void setTTYMode(int ttyMode, Message onComplete) {
    797         mActivePhone.setTTYMode(ttyMode, onComplete);
    798     }
    799 
    800     public void queryTTYMode(Message onComplete) {
    801         mActivePhone.queryTTYMode(onComplete);
    802     }
    803 
    804     public void activateCellBroadcastSms(int activate, Message response) {
    805         mActivePhone.activateCellBroadcastSms(activate, response);
    806     }
    807 
    808     public void getCellBroadcastSmsConfig(Message response) {
    809         mActivePhone.getCellBroadcastSmsConfig(response);
    810     }
    811 
    812     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
    813         mActivePhone.setCellBroadcastSmsConfig(configValuesArray, response);
    814     }
    815 
    816     public void notifyDataActivity() {
    817          mActivePhone.notifyDataActivity();
    818     }
    819 
    820     public void getSmscAddress(Message result) {
    821         mActivePhone.getSmscAddress(result);
    822     }
    823 
    824     public void setSmscAddress(String address, Message result) {
    825         mActivePhone.setSmscAddress(address, result);
    826     }
    827 
    828     public int getCdmaEriIconIndex() {
    829         return mActivePhone.getCdmaEriIconIndex();
    830     }
    831 
    832     public String getCdmaEriText() {
    833         return mActivePhone.getCdmaEriText();
    834     }
    835 
    836     public int getCdmaEriIconMode() {
    837         return mActivePhone.getCdmaEriIconMode();
    838     }
    839 
    840     public Phone getActivePhone() {
    841         return mActivePhone;
    842     }
    843 
    844     public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete){
    845         mActivePhone.sendBurstDtmf(dtmfString, on, off, onComplete);
    846     }
    847 
    848     public void exitEmergencyCallbackMode(){
    849         mActivePhone.exitEmergencyCallbackMode();
    850     }
    851 
    852     public boolean needsOtaServiceProvisioning(){
    853         return mActivePhone.needsOtaServiceProvisioning();
    854     }
    855 
    856     public boolean isOtaSpNumber(String dialStr){
    857         return mActivePhone.isOtaSpNumber(dialStr);
    858     }
    859 
    860     public void registerForCallWaiting(Handler h, int what, Object obj){
    861         mActivePhone.registerForCallWaiting(h,what,obj);
    862     }
    863 
    864     public void unregisterForCallWaiting(Handler h){
    865         mActivePhone.unregisterForCallWaiting(h);
    866     }
    867 
    868     public void registerForSignalInfo(Handler h, int what, Object obj) {
    869         mActivePhone.registerForSignalInfo(h,what,obj);
    870     }
    871 
    872     public void unregisterForSignalInfo(Handler h) {
    873         mActivePhone.unregisterForSignalInfo(h);
    874     }
    875 
    876     public void registerForDisplayInfo(Handler h, int what, Object obj) {
    877         mActivePhone.registerForDisplayInfo(h,what,obj);
    878     }
    879 
    880     public void unregisterForDisplayInfo(Handler h) {
    881         mActivePhone.unregisterForDisplayInfo(h);
    882     }
    883 
    884     public void registerForNumberInfo(Handler h, int what, Object obj) {
    885         mActivePhone.registerForNumberInfo(h, what, obj);
    886     }
    887 
    888     public void unregisterForNumberInfo(Handler h) {
    889         mActivePhone.unregisterForNumberInfo(h);
    890     }
    891 
    892     public void registerForRedirectedNumberInfo(Handler h, int what, Object obj) {
    893         mActivePhone.registerForRedirectedNumberInfo(h, what, obj);
    894     }
    895 
    896     public void unregisterForRedirectedNumberInfo(Handler h) {
    897         mActivePhone.unregisterForRedirectedNumberInfo(h);
    898     }
    899 
    900     public void registerForLineControlInfo(Handler h, int what, Object obj) {
    901         mActivePhone.registerForLineControlInfo( h, what, obj);
    902     }
    903 
    904     public void unregisterForLineControlInfo(Handler h) {
    905         mActivePhone.unregisterForLineControlInfo(h);
    906     }
    907 
    908     public void registerFoT53ClirlInfo(Handler h, int what, Object obj) {
    909         mActivePhone.registerFoT53ClirlInfo(h, what, obj);
    910     }
    911 
    912     public void unregisterForT53ClirInfo(Handler h) {
    913         mActivePhone.unregisterForT53ClirInfo(h);
    914     }
    915 
    916     public void registerForT53AudioControlInfo(Handler h, int what, Object obj) {
    917         mActivePhone.registerForT53AudioControlInfo( h, what, obj);
    918     }
    919 
    920     public void unregisterForT53AudioControlInfo(Handler h) {
    921         mActivePhone.unregisterForT53AudioControlInfo(h);
    922     }
    923 
    924     public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
    925         mActivePhone.setOnEcbModeExitResponse(h,what,obj);
    926     }
    927 
    928     public void unsetOnEcbModeExitResponse(Handler h){
    929         mActivePhone.unsetOnEcbModeExitResponse(h);
    930     }
    931 
    932     public boolean isCspPlmnEnabled() {
    933         return mActivePhone.isCspPlmnEnabled();
    934     }
    935 
    936     public IsimRecords getIsimRecords() {
    937         return mActivePhone.getIsimRecords();
    938     }
    939 
    940     public void requestIsimAuthentication(String nonce, Message response) {
    941         mActivePhone.requestIsimAuthentication(nonce, response);
    942     }
    943 
    944     /**
    945      * {@inheritDoc}
    946      */
    947     @Override
    948     public int getLteOnCdmaMode() {
    949         return mActivePhone.getLteOnCdmaMode();
    950     }
    951 
    952     @Override
    953     public void setVoiceMessageWaiting(int line, int countWaiting) {
    954         mActivePhone.setVoiceMessageWaiting(line, countWaiting);
    955     }
    956 
    957     @Override
    958     public UsimServiceTable getUsimServiceTable() {
    959         return mActivePhone.getUsimServiceTable();
    960     }
    961 
    962     public void dispose() {
    963         mCommandsInterface.unregisterForOn(this);
    964         mCommandsInterface.unregisterForVoiceRadioTechChanged(this);
    965         mCommandsInterface.unregisterForRilConnected(this);
    966     }
    967 
    968     public void removeReferences() {
    969         mActivePhone = null;
    970         mCommandsInterface = null;
    971     }
    972 }
    973