1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  * Copyright (c) 2013, The Linux Foundation. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package com.android.internal.telephony;
19 
20 
21 import android.app.ActivityManagerNative;
22 import android.content.Context;
23 import android.content.Intent;
24 import android.net.LinkProperties;
25 import android.net.NetworkCapabilities;
26 import android.os.AsyncResult;
27 import android.os.Handler;
28 import android.os.Message;
29 import android.os.SystemProperties;
30 import android.os.UserHandle;
31 import android.telephony.CellInfo;
32 import android.telephony.CellLocation;
33 import android.telephony.Rlog;
34 import android.telephony.ServiceState;
35 import android.telephony.SignalStrength;
36 import android.telephony.SubscriptionManager;
37 
38 import com.android.internal.telephony.cdma.CDMAPhone;
39 import com.android.internal.telephony.gsm.GSMPhone;
40 import com.android.internal.telephony.imsphone.ImsPhone;
41 import com.android.internal.telephony.test.SimulatedRadioControl;
42 import com.android.internal.telephony.cdma.CDMALTEPhone;
43 import com.android.internal.telephony.RadioCapability;
44 import com.android.internal.telephony.uicc.IccCardProxy;
45 import com.android.internal.telephony.uicc.IccFileHandler;
46 import com.android.internal.telephony.uicc.IsimRecords;
47 import com.android.internal.telephony.uicc.UiccCard;
48 import com.android.internal.telephony.uicc.UsimServiceTable;
49 
50 import java.io.FileDescriptor;
51 import java.io.PrintWriter;
52 import java.util.List;
53 import java.util.Set;
54 
55 import com.android.internal.telephony.dataconnection.DctController;
56 
57 public class PhoneProxy extends Handler implements Phone {
58     public final static Object lockForRadioTechnologyChange = new Object();
59 
60     private Phone mActivePhone;
61     private CommandsInterface mCommandsInterface;
62     private IccSmsInterfaceManager mIccSmsInterfaceManager;
63     private IccPhoneBookInterfaceManagerProxy mIccPhoneBookInterfaceManagerProxy;
64     private PhoneSubInfoProxy mPhoneSubInfoProxy;
65     private IccCardProxy mIccCardProxy;
66 
67     private boolean mResetModemOnRadioTechnologyChange = false;
68 
69     private int mRilVersion;
70 
71     private static final int EVENT_VOICE_RADIO_TECH_CHANGED = 1;
72     private static final int EVENT_RADIO_ON = 2;
73     private static final int EVENT_REQUEST_VOICE_RADIO_TECH_DONE = 3;
74     private static final int EVENT_RIL_CONNECTED = 4;
75     private static final int EVENT_UPDATE_PHONE_OBJECT = 5;
76     private static final int EVENT_SIM_RECORDS_LOADED = 6;
77 
78     private int mPhoneId = 0;
79 
80     private static final String LOG_TAG = "PhoneProxy";
81 
82     //***** Class Methods
PhoneProxy(PhoneBase phone)83     public PhoneProxy(PhoneBase phone) {
84         mActivePhone = phone;
85         mResetModemOnRadioTechnologyChange = SystemProperties.getBoolean(
86                 TelephonyProperties.PROPERTY_RESET_ON_RADIO_TECH_CHANGE, false);
87         mIccPhoneBookInterfaceManagerProxy = new IccPhoneBookInterfaceManagerProxy(
88                 phone.getIccPhoneBookInterfaceManager());
89         mPhoneSubInfoProxy = new PhoneSubInfoProxy(phone.getPhoneSubInfo());
90         mCommandsInterface = ((PhoneBase)mActivePhone).mCi;
91 
92         mCommandsInterface.registerForRilConnected(this, EVENT_RIL_CONNECTED, null);
93         mCommandsInterface.registerForOn(this, EVENT_RADIO_ON, null);
94         mCommandsInterface.registerForVoiceRadioTechChanged(
95                              this, EVENT_VOICE_RADIO_TECH_CHANGED, null);
96         mPhoneId = phone.getPhoneId();
97         mIccSmsInterfaceManager =
98                 new IccSmsInterfaceManager((PhoneBase)this.mActivePhone);
99         mIccCardProxy = new IccCardProxy(mActivePhone.getContext(), mCommandsInterface, mActivePhone.getPhoneId());
100 
101         if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
102             // For the purpose of IccCardProxy we only care about the technology family
103             mIccCardProxy.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
104         } else if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
105             mIccCardProxy.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
106         }
107     }
108 
109     @Override
handleMessage(Message msg)110     public void handleMessage(Message msg) {
111         AsyncResult ar = (AsyncResult) msg.obj;
112         switch(msg.what) {
113         case EVENT_RADIO_ON:
114             /* Proactively query voice radio technologies */
115             mCommandsInterface.getVoiceRadioTechnology(
116                     obtainMessage(EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
117             break;
118 
119         case EVENT_RIL_CONNECTED:
120             if (ar.exception == null && ar.result != null) {
121                 mRilVersion = (Integer) ar.result;
122             } else {
123                 logd("Unexpected exception on EVENT_RIL_CONNECTED");
124                 mRilVersion = -1;
125             }
126             break;
127 
128         case EVENT_VOICE_RADIO_TECH_CHANGED:
129         case EVENT_REQUEST_VOICE_RADIO_TECH_DONE:
130             String what = (msg.what == EVENT_VOICE_RADIO_TECH_CHANGED) ?
131                     "EVENT_VOICE_RADIO_TECH_CHANGED" : "EVENT_REQUEST_VOICE_RADIO_TECH_DONE";
132             if (ar.exception == null) {
133                 if ((ar.result != null) && (((int[]) ar.result).length != 0)) {
134                     int newVoiceTech = ((int[]) ar.result)[0];
135                     logd(what + ": newVoiceTech=" + newVoiceTech);
136                     phoneObjectUpdater(newVoiceTech);
137                 } else {
138                     loge(what + ": has no tech!");
139                 }
140             } else {
141                 loge(what + ": exception=" + ar.exception);
142             }
143             break;
144 
145         case EVENT_UPDATE_PHONE_OBJECT:
146             phoneObjectUpdater(msg.arg1);
147             break;
148 
149         case EVENT_SIM_RECORDS_LOADED:
150             // Only check for the voice radio tech if it not going to be updated by the voice
151             // registration changes.
152             if (!mActivePhone.getContext().getResources().getBoolean(
153                     com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
154                 mCommandsInterface.getVoiceRadioTechnology(obtainMessage(
155                         EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
156             }
157             break;
158 
159         default:
160             loge("Error! This handler was not registered for this message type. Message: "
161                     + msg.what);
162             break;
163         }
164         super.handleMessage(msg);
165     }
166 
logd(String msg)167     private static void logd(String msg) {
168         Rlog.d(LOG_TAG, "[PhoneProxy] " + msg);
169     }
170 
loge(String msg)171     private void loge(String msg) {
172         Rlog.e(LOG_TAG, "[PhoneProxy] " + msg);
173     }
174 
phoneObjectUpdater(int newVoiceRadioTech)175     private void phoneObjectUpdater(int newVoiceRadioTech) {
176         logd("phoneObjectUpdater: newVoiceRadioTech=" + newVoiceRadioTech);
177 
178         if (mActivePhone != null) {
179             // Check for a voice over lte replacement
180             if ((newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
181                     (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN)) {
182                 int volteReplacementRat = mActivePhone.getContext().getResources().getInteger(
183                         com.android.internal.R.integer.config_volte_replacement_rat);
184                 logd("phoneObjectUpdater: volteReplacementRat=" + volteReplacementRat);
185                 if (volteReplacementRat != ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
186                     newVoiceRadioTech = volteReplacementRat;
187                 }
188             }
189 
190             if(mRilVersion == 6 && getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
191                 /*
192                  * On v6 RIL, when LTE_ON_CDMA is TRUE, always create CDMALTEPhone
193                  * irrespective of the voice radio tech reported.
194                  */
195                 if (mActivePhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
196                     logd("phoneObjectUpdater: LTE ON CDMA property is set. Use CDMA Phone" +
197                             " newVoiceRadioTech=" + newVoiceRadioTech +
198                             " mActivePhone=" + mActivePhone.getPhoneName());
199                     return;
200                 } else {
201                     logd("phoneObjectUpdater: LTE ON CDMA property is set. Switch to CDMALTEPhone" +
202                             " newVoiceRadioTech=" + newVoiceRadioTech +
203                             " mActivePhone=" + mActivePhone.getPhoneName());
204                     newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
205                 }
206             } else {
207                 boolean matchCdma = ServiceState.isCdma(newVoiceRadioTech);
208                 boolean matchGsm = ServiceState.isGsm(newVoiceRadioTech);
209                 if ((matchCdma  &&
210                         mActivePhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) ||
211                         (matchGsm &&
212                                 mActivePhone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM)) {
213                     // Nothing changed. Keep phone as it is.
214                     logd("phoneObjectUpdater: No change ignore," +
215                             " newVoiceRadioTech=" + newVoiceRadioTech +
216                             " mActivePhone=" + mActivePhone.getPhoneName());
217                     return;
218                 }
219                 if (!matchCdma && !matchGsm) {
220                     loge("phoneObjectUpdater: newVoiceRadioTech=" + newVoiceRadioTech +
221                         " doesn't match either CDMA or GSM - error! No phone change");
222                     return;
223                 }
224             }
225         }
226 
227         if (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
228             // We need some voice phone object to be active always, so never
229             // delete the phone without anything to replace it with!
230             logd("phoneObjectUpdater: Unknown rat ignore, "
231                     + " newVoiceRadioTech=Unknown. mActivePhone=" + mActivePhone.getPhoneName());
232             return;
233         }
234 
235         boolean oldPowerState = false; // old power state to off
236         if (mResetModemOnRadioTechnologyChange) {
237             if (mCommandsInterface.getRadioState().isOn()) {
238                 oldPowerState = true;
239                 logd("phoneObjectUpdater: Setting Radio Power to Off");
240                 mCommandsInterface.setRadioPower(false, null);
241             }
242         }
243 
244         deleteAndCreatePhone(newVoiceRadioTech);
245 
246         if (mResetModemOnRadioTechnologyChange && oldPowerState) { // restore power state
247             logd("phoneObjectUpdater: Resetting Radio");
248             mCommandsInterface.setRadioPower(oldPowerState, null);
249         }
250 
251         // Set the new interfaces in the proxy's
252         mIccSmsInterfaceManager.updatePhoneObject((PhoneBase) mActivePhone);
253         mIccPhoneBookInterfaceManagerProxy.setmIccPhoneBookInterfaceManager(mActivePhone
254                 .getIccPhoneBookInterfaceManager());
255         mPhoneSubInfoProxy.setmPhoneSubInfo(mActivePhone.getPhoneSubInfo());
256 
257         mCommandsInterface = ((PhoneBase)mActivePhone).mCi;
258         mIccCardProxy.setVoiceRadioTech(newVoiceRadioTech);
259 
260         // Send an Intent to the PhoneApp that we had a radio technology change
261         Intent intent = new Intent(TelephonyIntents.ACTION_RADIO_TECHNOLOGY_CHANGED);
262         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
263         intent.putExtra(PhoneConstants.PHONE_NAME_KEY, mActivePhone.getPhoneName());
264         SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhoneId);
265         ActivityManagerNative.broadcastStickyIntent(intent, null, UserHandle.USER_ALL);
266 
267         DctController.getInstance().updatePhoneObject(this);
268 
269     }
270 
deleteAndCreatePhone(int newVoiceRadioTech)271     private void deleteAndCreatePhone(int newVoiceRadioTech) {
272 
273         String outgoingPhoneName = "Unknown";
274         Phone oldPhone = mActivePhone;
275         ImsPhone imsPhone = null;
276 
277         if (oldPhone != null) {
278             outgoingPhoneName = ((PhoneBase) oldPhone).getPhoneName();
279             oldPhone.unregisterForSimRecordsLoaded(this);
280         }
281 
282         logd("Switching Voice Phone : " + outgoingPhoneName + " >>> "
283                 + (ServiceState.isGsm(newVoiceRadioTech) ? "GSM" : "CDMA"));
284 
285         if (ServiceState.isCdma(newVoiceRadioTech)) {
286             mActivePhone = PhoneFactory.getCdmaPhone(mPhoneId);
287         } else if (ServiceState.isGsm(newVoiceRadioTech)) {
288             mActivePhone = PhoneFactory.getGsmPhone(mPhoneId);
289         } else {
290             loge("deleteAndCreatePhone: newVoiceRadioTech=" + newVoiceRadioTech +
291                 " is not CDMA or GSM (error) - aborting!");
292             return;
293         }
294 
295         if (oldPhone != null) {
296             imsPhone = oldPhone.relinquishOwnershipOfImsPhone();
297         }
298 
299         if(mActivePhone != null) {
300             CallManager.getInstance().registerPhone(mActivePhone);
301             if (imsPhone != null) {
302                 mActivePhone.acquireOwnershipOfImsPhone(imsPhone);
303             }
304             mActivePhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
305         }
306 
307         if (oldPhone != null) {
308             CallManager.getInstance().unregisterPhone(oldPhone);
309             logd("Disposing old phone..");
310             oldPhone.dispose();
311             // Potential GC issues: however, callers may have references to old
312             // phone on which they perform hierarchical funcs: phone.getA().getB()
313             // HENCE: do not delete references.
314             //oldPhone.removeReferences();
315         }
316         oldPhone = null;
317     }
318 
getIccSmsInterfaceManager()319     public IccSmsInterfaceManager getIccSmsInterfaceManager(){
320         return mIccSmsInterfaceManager;
321     }
322 
getPhoneSubInfoProxy()323     public PhoneSubInfoProxy getPhoneSubInfoProxy(){
324         return mPhoneSubInfoProxy;
325     }
326 
getIccPhoneBookInterfaceManagerProxy()327     public IccPhoneBookInterfaceManagerProxy getIccPhoneBookInterfaceManagerProxy() {
328         return mIccPhoneBookInterfaceManagerProxy;
329     }
330 
getIccFileHandler()331     public IccFileHandler getIccFileHandler() {
332         return ((PhoneBase)mActivePhone).getIccFileHandler();
333     }
334 
335     @Override
updatePhoneObject(int voiceRadioTech)336     public void updatePhoneObject(int voiceRadioTech) {
337         logd("updatePhoneObject: radioTechnology=" + voiceRadioTech);
338         sendMessage(obtainMessage(EVENT_UPDATE_PHONE_OBJECT, voiceRadioTech, 0, null));
339     }
340 
341     @Override
getServiceState()342     public ServiceState getServiceState() {
343         return mActivePhone.getServiceState();
344     }
345 
346     @Override
getCellLocation()347     public CellLocation getCellLocation() {
348         return mActivePhone.getCellLocation();
349     }
350 
351     /**
352      * @return all available cell information or null if none.
353      */
354     @Override
getAllCellInfo()355     public List<CellInfo> getAllCellInfo() {
356         return mActivePhone.getAllCellInfo();
357     }
358 
359     /**
360      * {@inheritDoc}
361      */
362     @Override
setCellInfoListRate(int rateInMillis)363     public void setCellInfoListRate(int rateInMillis) {
364         mActivePhone.setCellInfoListRate(rateInMillis);
365     }
366 
367     @Override
getDataConnectionState()368     public PhoneConstants.DataState getDataConnectionState() {
369         return mActivePhone.getDataConnectionState(PhoneConstants.APN_TYPE_DEFAULT);
370     }
371 
372     @Override
getDataConnectionState(String apnType)373     public PhoneConstants.DataState getDataConnectionState(String apnType) {
374         return mActivePhone.getDataConnectionState(apnType);
375     }
376 
377     @Override
getDataActivityState()378     public DataActivityState getDataActivityState() {
379         return mActivePhone.getDataActivityState();
380     }
381 
382     @Override
getContext()383     public Context getContext() {
384         return mActivePhone.getContext();
385     }
386 
387     @Override
disableDnsCheck(boolean b)388     public void disableDnsCheck(boolean b) {
389         mActivePhone.disableDnsCheck(b);
390     }
391 
392     @Override
isDnsCheckDisabled()393     public boolean isDnsCheckDisabled() {
394         return mActivePhone.isDnsCheckDisabled();
395     }
396 
397     @Override
getState()398     public PhoneConstants.State getState() {
399         return mActivePhone.getState();
400     }
401 
402     @Override
getPhoneName()403     public String getPhoneName() {
404         return mActivePhone.getPhoneName();
405     }
406 
407     @Override
getPhoneType()408     public int getPhoneType() {
409         return mActivePhone.getPhoneType();
410     }
411 
412     @Override
getActiveApnTypes()413     public String[] getActiveApnTypes() {
414         return mActivePhone.getActiveApnTypes();
415     }
416 
417     @Override
hasMatchedTetherApnSetting()418     public boolean hasMatchedTetherApnSetting() {
419         return mActivePhone.hasMatchedTetherApnSetting();
420     }
421 
422     @Override
getActiveApnHost(String apnType)423     public String getActiveApnHost(String apnType) {
424         return mActivePhone.getActiveApnHost(apnType);
425     }
426 
427     @Override
getLinkProperties(String apnType)428     public LinkProperties getLinkProperties(String apnType) {
429         return mActivePhone.getLinkProperties(apnType);
430     }
431 
432     @Override
getNetworkCapabilities(String apnType)433     public NetworkCapabilities getNetworkCapabilities(String apnType) {
434         return mActivePhone.getNetworkCapabilities(apnType);
435     }
436 
437     @Override
getSignalStrength()438     public SignalStrength getSignalStrength() {
439         return mActivePhone.getSignalStrength();
440     }
441 
442     @Override
registerForUnknownConnection(Handler h, int what, Object obj)443     public void registerForUnknownConnection(Handler h, int what, Object obj) {
444         mActivePhone.registerForUnknownConnection(h, what, obj);
445     }
446 
447     @Override
unregisterForUnknownConnection(Handler h)448     public void unregisterForUnknownConnection(Handler h) {
449         mActivePhone.unregisterForUnknownConnection(h);
450     }
451 
452     @Override
registerForHandoverStateChanged(Handler h, int what, Object obj)453     public void registerForHandoverStateChanged(Handler h, int what, Object obj) {
454         mActivePhone.registerForHandoverStateChanged(h, what, obj);
455     }
456 
457     @Override
unregisterForHandoverStateChanged(Handler h)458     public void unregisterForHandoverStateChanged(Handler h) {
459         mActivePhone.unregisterForHandoverStateChanged(h);
460     }
461 
462     @Override
registerForPreciseCallStateChanged(Handler h, int what, Object obj)463     public void registerForPreciseCallStateChanged(Handler h, int what, Object obj) {
464         mActivePhone.registerForPreciseCallStateChanged(h, what, obj);
465     }
466 
467     @Override
unregisterForPreciseCallStateChanged(Handler h)468     public void unregisterForPreciseCallStateChanged(Handler h) {
469         mActivePhone.unregisterForPreciseCallStateChanged(h);
470     }
471 
472     @Override
registerForNewRingingConnection(Handler h, int what, Object obj)473     public void registerForNewRingingConnection(Handler h, int what, Object obj) {
474         mActivePhone.registerForNewRingingConnection(h, what, obj);
475     }
476 
477     @Override
unregisterForNewRingingConnection(Handler h)478     public void unregisterForNewRingingConnection(Handler h) {
479         mActivePhone.unregisterForNewRingingConnection(h);
480     }
481 
482     @Override
registerForIncomingRing(Handler h, int what, Object obj)483     public void registerForIncomingRing(Handler h, int what, Object obj) {
484         mActivePhone.registerForIncomingRing(h, what, obj);
485     }
486 
487     @Override
unregisterForIncomingRing(Handler h)488     public void unregisterForIncomingRing(Handler h) {
489         mActivePhone.unregisterForIncomingRing(h);
490     }
491 
492     @Override
registerForDisconnect(Handler h, int what, Object obj)493     public void registerForDisconnect(Handler h, int what, Object obj) {
494         mActivePhone.registerForDisconnect(h, what, obj);
495     }
496 
497     @Override
unregisterForDisconnect(Handler h)498     public void unregisterForDisconnect(Handler h) {
499         mActivePhone.unregisterForDisconnect(h);
500     }
501 
502     @Override
registerForMmiInitiate(Handler h, int what, Object obj)503     public void registerForMmiInitiate(Handler h, int what, Object obj) {
504         mActivePhone.registerForMmiInitiate(h, what, obj);
505     }
506 
507     @Override
unregisterForMmiInitiate(Handler h)508     public void unregisterForMmiInitiate(Handler h) {
509         mActivePhone.unregisterForMmiInitiate(h);
510     }
511 
512     @Override
registerForMmiComplete(Handler h, int what, Object obj)513     public void registerForMmiComplete(Handler h, int what, Object obj) {
514         mActivePhone.registerForMmiComplete(h, what, obj);
515     }
516 
517     @Override
unregisterForMmiComplete(Handler h)518     public void unregisterForMmiComplete(Handler h) {
519         mActivePhone.unregisterForMmiComplete(h);
520     }
521 
522     @Override
getPendingMmiCodes()523     public List<? extends MmiCode> getPendingMmiCodes() {
524         return mActivePhone.getPendingMmiCodes();
525     }
526 
527     @Override
sendUssdResponse(String ussdMessge)528     public void sendUssdResponse(String ussdMessge) {
529         mActivePhone.sendUssdResponse(ussdMessge);
530     }
531 
532     @Override
registerForServiceStateChanged(Handler h, int what, Object obj)533     public void registerForServiceStateChanged(Handler h, int what, Object obj) {
534         mActivePhone.registerForServiceStateChanged(h, what, obj);
535     }
536 
537     @Override
unregisterForServiceStateChanged(Handler h)538     public void unregisterForServiceStateChanged(Handler h) {
539         mActivePhone.unregisterForServiceStateChanged(h);
540     }
541 
542     @Override
registerForSuppServiceNotification(Handler h, int what, Object obj)543     public void registerForSuppServiceNotification(Handler h, int what, Object obj) {
544         mActivePhone.registerForSuppServiceNotification(h, what, obj);
545     }
546 
547     @Override
unregisterForSuppServiceNotification(Handler h)548     public void unregisterForSuppServiceNotification(Handler h) {
549         mActivePhone.unregisterForSuppServiceNotification(h);
550     }
551 
552     @Override
registerForSuppServiceFailed(Handler h, int what, Object obj)553     public void registerForSuppServiceFailed(Handler h, int what, Object obj) {
554         mActivePhone.registerForSuppServiceFailed(h, what, obj);
555     }
556 
557     @Override
unregisterForSuppServiceFailed(Handler h)558     public void unregisterForSuppServiceFailed(Handler h) {
559         mActivePhone.unregisterForSuppServiceFailed(h);
560     }
561 
562     @Override
registerForInCallVoicePrivacyOn(Handler h, int what, Object obj)563     public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj){
564         mActivePhone.registerForInCallVoicePrivacyOn(h,what,obj);
565     }
566 
567     @Override
unregisterForInCallVoicePrivacyOn(Handler h)568     public void unregisterForInCallVoicePrivacyOn(Handler h){
569         mActivePhone.unregisterForInCallVoicePrivacyOn(h);
570     }
571 
572     @Override
registerForInCallVoicePrivacyOff(Handler h, int what, Object obj)573     public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj){
574         mActivePhone.registerForInCallVoicePrivacyOff(h,what,obj);
575     }
576 
577     @Override
unregisterForInCallVoicePrivacyOff(Handler h)578     public void unregisterForInCallVoicePrivacyOff(Handler h){
579         mActivePhone.unregisterForInCallVoicePrivacyOff(h);
580     }
581 
582     @Override
registerForCdmaOtaStatusChange(Handler h, int what, Object obj)583     public void registerForCdmaOtaStatusChange(Handler h, int what, Object obj) {
584         mActivePhone.registerForCdmaOtaStatusChange(h,what,obj);
585     }
586 
587     @Override
unregisterForCdmaOtaStatusChange(Handler h)588     public void unregisterForCdmaOtaStatusChange(Handler h) {
589          mActivePhone.unregisterForCdmaOtaStatusChange(h);
590     }
591 
592     @Override
registerForSubscriptionInfoReady(Handler h, int what, Object obj)593     public void registerForSubscriptionInfoReady(Handler h, int what, Object obj) {
594         mActivePhone.registerForSubscriptionInfoReady(h, what, obj);
595     }
596 
597     @Override
unregisterForSubscriptionInfoReady(Handler h)598     public void unregisterForSubscriptionInfoReady(Handler h) {
599         mActivePhone.unregisterForSubscriptionInfoReady(h);
600     }
601 
602     @Override
registerForEcmTimerReset(Handler h, int what, Object obj)603     public void registerForEcmTimerReset(Handler h, int what, Object obj) {
604         mActivePhone.registerForEcmTimerReset(h,what,obj);
605     }
606 
607     @Override
unregisterForEcmTimerReset(Handler h)608     public void unregisterForEcmTimerReset(Handler h) {
609         mActivePhone.unregisterForEcmTimerReset(h);
610     }
611 
612     @Override
registerForRingbackTone(Handler h, int what, Object obj)613     public void registerForRingbackTone(Handler h, int what, Object obj) {
614         mActivePhone.registerForRingbackTone(h,what,obj);
615     }
616 
617     @Override
unregisterForRingbackTone(Handler h)618     public void unregisterForRingbackTone(Handler h) {
619         mActivePhone.unregisterForRingbackTone(h);
620     }
621 
622     @Override
registerForOnHoldTone(Handler h, int what, Object obj)623     public void registerForOnHoldTone(Handler h, int what, Object obj) {
624         mActivePhone.registerForOnHoldTone(h,what,obj);
625     }
626 
627     @Override
unregisterForOnHoldTone(Handler h)628     public void unregisterForOnHoldTone(Handler h) {
629         mActivePhone.unregisterForOnHoldTone(h);
630     }
631 
632     @Override
registerForResendIncallMute(Handler h, int what, Object obj)633     public void registerForResendIncallMute(Handler h, int what, Object obj) {
634         mActivePhone.registerForResendIncallMute(h,what,obj);
635     }
636 
637     @Override
unregisterForResendIncallMute(Handler h)638     public void unregisterForResendIncallMute(Handler h) {
639         mActivePhone.unregisterForResendIncallMute(h);
640     }
641 
642     @Override
registerForSimRecordsLoaded(Handler h, int what, Object obj)643     public void registerForSimRecordsLoaded(Handler h, int what, Object obj) {
644         mActivePhone.registerForSimRecordsLoaded(h,what,obj);
645     }
646 
unregisterForSimRecordsLoaded(Handler h)647     public void unregisterForSimRecordsLoaded(Handler h) {
648         mActivePhone.unregisterForSimRecordsLoaded(h);
649     }
650 
651     @Override
registerForTtyModeReceived(Handler h, int what, Object obj)652     public void registerForTtyModeReceived(Handler h, int what, Object obj) {
653         mActivePhone.registerForTtyModeReceived(h, what, obj);
654     }
655 
656     @Override
unregisterForTtyModeReceived(Handler h)657     public void unregisterForTtyModeReceived(Handler h) {
658         mActivePhone.unregisterForTtyModeReceived(h);
659     }
660 
661     @Override
getIccRecordsLoaded()662     public boolean getIccRecordsLoaded() {
663         return mIccCardProxy.getIccRecordsLoaded();
664     }
665 
666     @Override
getIccCard()667     public IccCard getIccCard() {
668         return mIccCardProxy;
669     }
670 
671     @Override
acceptCall(int videoState)672     public void acceptCall(int videoState) throws CallStateException {
673         mActivePhone.acceptCall(videoState);
674     }
675 
676     @Override
rejectCall()677     public void rejectCall() throws CallStateException {
678         mActivePhone.rejectCall();
679     }
680 
681     @Override
switchHoldingAndActive()682     public void switchHoldingAndActive() throws CallStateException {
683         mActivePhone.switchHoldingAndActive();
684     }
685 
686     @Override
canConference()687     public boolean canConference() {
688         return mActivePhone.canConference();
689     }
690 
691     @Override
conference()692     public void conference() throws CallStateException {
693         mActivePhone.conference();
694     }
695 
696     @Override
enableEnhancedVoicePrivacy(boolean enable, Message onComplete)697     public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) {
698         mActivePhone.enableEnhancedVoicePrivacy(enable, onComplete);
699     }
700 
701     @Override
getEnhancedVoicePrivacy(Message onComplete)702     public void getEnhancedVoicePrivacy(Message onComplete) {
703         mActivePhone.getEnhancedVoicePrivacy(onComplete);
704     }
705 
706     @Override
canTransfer()707     public boolean canTransfer() {
708         return mActivePhone.canTransfer();
709     }
710 
711     @Override
explicitCallTransfer()712     public void explicitCallTransfer() throws CallStateException {
713         mActivePhone.explicitCallTransfer();
714     }
715 
716     @Override
clearDisconnected()717     public void clearDisconnected() {
718         mActivePhone.clearDisconnected();
719     }
720 
721     @Override
getForegroundCall()722     public Call getForegroundCall() {
723         return mActivePhone.getForegroundCall();
724     }
725 
726     @Override
getBackgroundCall()727     public Call getBackgroundCall() {
728         return mActivePhone.getBackgroundCall();
729     }
730 
731     @Override
getRingingCall()732     public Call getRingingCall() {
733         return mActivePhone.getRingingCall();
734     }
735 
736     @Override
dial(String dialString, int videoState)737     public Connection dial(String dialString, int videoState) throws CallStateException {
738         return mActivePhone.dial(dialString, videoState);
739     }
740 
741     @Override
dial(String dialString, UUSInfo uusInfo, int videoState)742     public Connection dial(String dialString, UUSInfo uusInfo, int videoState) throws CallStateException {
743         return mActivePhone.dial(dialString, uusInfo, videoState);
744     }
745 
746     @Override
handlePinMmi(String dialString)747     public boolean handlePinMmi(String dialString) {
748         return mActivePhone.handlePinMmi(dialString);
749     }
750 
751     @Override
handleInCallMmiCommands(String command)752     public boolean handleInCallMmiCommands(String command) throws CallStateException {
753         return mActivePhone.handleInCallMmiCommands(command);
754     }
755 
756     @Override
sendDtmf(char c)757     public void sendDtmf(char c) {
758         mActivePhone.sendDtmf(c);
759     }
760 
761     @Override
startDtmf(char c)762     public void startDtmf(char c) {
763         mActivePhone.startDtmf(c);
764     }
765 
766     @Override
stopDtmf()767     public void stopDtmf() {
768         mActivePhone.stopDtmf();
769     }
770 
771     @Override
setRadioPower(boolean power)772     public void setRadioPower(boolean power) {
773         mActivePhone.setRadioPower(power);
774     }
775 
776     @Override
getMessageWaitingIndicator()777     public boolean getMessageWaitingIndicator() {
778         return mActivePhone.getMessageWaitingIndicator();
779     }
780 
781     @Override
getCallForwardingIndicator()782     public boolean getCallForwardingIndicator() {
783         return mActivePhone.getCallForwardingIndicator();
784     }
785 
786     @Override
getLine1Number()787     public String getLine1Number() {
788         return mActivePhone.getLine1Number();
789     }
790 
791     @Override
getCdmaMin()792     public String getCdmaMin() {
793         return mActivePhone.getCdmaMin();
794     }
795 
796     @Override
isMinInfoReady()797     public boolean isMinInfoReady() {
798         return mActivePhone.isMinInfoReady();
799     }
800 
801     @Override
getCdmaPrlVersion()802     public String getCdmaPrlVersion() {
803         return mActivePhone.getCdmaPrlVersion();
804     }
805 
806     @Override
getLine1AlphaTag()807     public String getLine1AlphaTag() {
808         return mActivePhone.getLine1AlphaTag();
809     }
810 
811     @Override
setLine1Number(String alphaTag, String number, Message onComplete)812     public boolean setLine1Number(String alphaTag, String number, Message onComplete) {
813         return mActivePhone.setLine1Number(alphaTag, number, onComplete);
814     }
815 
816     @Override
getVoiceMailNumber()817     public String getVoiceMailNumber() {
818         return mActivePhone.getVoiceMailNumber();
819     }
820 
821      /** @hide */
822     @Override
getVoiceMessageCount()823     public int getVoiceMessageCount(){
824         return mActivePhone.getVoiceMessageCount();
825     }
826 
827     @Override
getVoiceMailAlphaTag()828     public String getVoiceMailAlphaTag() {
829         return mActivePhone.getVoiceMailAlphaTag();
830     }
831 
832     @Override
setVoiceMailNumber(String alphaTag,String voiceMailNumber, Message onComplete)833     public void setVoiceMailNumber(String alphaTag,String voiceMailNumber,
834             Message onComplete) {
835         mActivePhone.setVoiceMailNumber(alphaTag, voiceMailNumber, onComplete);
836     }
837 
838     @Override
getCallForwardingOption(int commandInterfaceCFReason, Message onComplete)839     public void getCallForwardingOption(int commandInterfaceCFReason,
840             Message onComplete) {
841         mActivePhone.getCallForwardingOption(commandInterfaceCFReason,
842                 onComplete);
843     }
844 
845     @Override
setCallForwardingOption(int commandInterfaceCFReason, int commandInterfaceCFAction, String dialingNumber, int timerSeconds, Message onComplete)846     public void setCallForwardingOption(int commandInterfaceCFReason,
847             int commandInterfaceCFAction, String dialingNumber,
848             int timerSeconds, Message onComplete) {
849         mActivePhone.setCallForwardingOption(commandInterfaceCFReason,
850             commandInterfaceCFAction, dialingNumber, timerSeconds, onComplete);
851     }
852 
853     @Override
getOutgoingCallerIdDisplay(Message onComplete)854     public void getOutgoingCallerIdDisplay(Message onComplete) {
855         mActivePhone.getOutgoingCallerIdDisplay(onComplete);
856     }
857 
858     @Override
setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete)859     public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
860             Message onComplete) {
861         mActivePhone.setOutgoingCallerIdDisplay(commandInterfaceCLIRMode,
862                 onComplete);
863     }
864 
865     @Override
getCallWaiting(Message onComplete)866     public void getCallWaiting(Message onComplete) {
867         mActivePhone.getCallWaiting(onComplete);
868     }
869 
870     @Override
setCallWaiting(boolean enable, Message onComplete)871     public void setCallWaiting(boolean enable, Message onComplete) {
872         mActivePhone.setCallWaiting(enable, onComplete);
873     }
874 
875     @Override
getAvailableNetworks(Message response)876     public void getAvailableNetworks(Message response) {
877         mActivePhone.getAvailableNetworks(response);
878     }
879 
880     @Override
setNetworkSelectionModeAutomatic(Message response)881     public void setNetworkSelectionModeAutomatic(Message response) {
882         mActivePhone.setNetworkSelectionModeAutomatic(response);
883     }
884 
885     @Override
getNetworkSelectionMode(Message response)886     public void getNetworkSelectionMode(Message response) {
887         mActivePhone.getNetworkSelectionMode(response);
888     }
889 
890     @Override
selectNetworkManually(OperatorInfo network, Message response)891     public void selectNetworkManually(OperatorInfo network, Message response) {
892         mActivePhone.selectNetworkManually(network, response);
893     }
894 
895     @Override
setPreferredNetworkType(int networkType, Message response)896     public void setPreferredNetworkType(int networkType, Message response) {
897         mActivePhone.setPreferredNetworkType(networkType, response);
898     }
899 
900     @Override
getPreferredNetworkType(Message response)901     public void getPreferredNetworkType(Message response) {
902         mActivePhone.getPreferredNetworkType(response);
903     }
904 
905     @Override
getNeighboringCids(Message response)906     public void getNeighboringCids(Message response) {
907         mActivePhone.getNeighboringCids(response);
908     }
909 
910     @Override
setOnPostDialCharacter(Handler h, int what, Object obj)911     public void setOnPostDialCharacter(Handler h, int what, Object obj) {
912         mActivePhone.setOnPostDialCharacter(h, what, obj);
913     }
914 
915     @Override
setMute(boolean muted)916     public void setMute(boolean muted) {
917         mActivePhone.setMute(muted);
918     }
919 
920     @Override
getMute()921     public boolean getMute() {
922         return mActivePhone.getMute();
923     }
924 
925     @Override
setEchoSuppressionEnabled()926     public void setEchoSuppressionEnabled() {
927         mActivePhone.setEchoSuppressionEnabled();
928     }
929 
930     @Override
invokeOemRilRequestRaw(byte[] data, Message response)931     public void invokeOemRilRequestRaw(byte[] data, Message response) {
932         mActivePhone.invokeOemRilRequestRaw(data, response);
933     }
934 
935     @Override
invokeOemRilRequestStrings(String[] strings, Message response)936     public void invokeOemRilRequestStrings(String[] strings, Message response) {
937         mActivePhone.invokeOemRilRequestStrings(strings, response);
938     }
939 
940     @Override
getDataCallList(Message response)941     public void getDataCallList(Message response) {
942         mActivePhone.getDataCallList(response);
943     }
944 
945     @Override
updateServiceLocation()946     public void updateServiceLocation() {
947         mActivePhone.updateServiceLocation();
948     }
949 
950     @Override
enableLocationUpdates()951     public void enableLocationUpdates() {
952         mActivePhone.enableLocationUpdates();
953     }
954 
955     @Override
disableLocationUpdates()956     public void disableLocationUpdates() {
957         mActivePhone.disableLocationUpdates();
958     }
959 
960     @Override
setUnitTestMode(boolean f)961     public void setUnitTestMode(boolean f) {
962         mActivePhone.setUnitTestMode(f);
963     }
964 
965     @Override
getUnitTestMode()966     public boolean getUnitTestMode() {
967         return mActivePhone.getUnitTestMode();
968     }
969 
970     @Override
setBandMode(int bandMode, Message response)971     public void setBandMode(int bandMode, Message response) {
972         mActivePhone.setBandMode(bandMode, response);
973     }
974 
975     @Override
queryAvailableBandMode(Message response)976     public void queryAvailableBandMode(Message response) {
977         mActivePhone.queryAvailableBandMode(response);
978     }
979 
980     @Override
getDataRoamingEnabled()981     public boolean getDataRoamingEnabled() {
982         return mActivePhone.getDataRoamingEnabled();
983     }
984 
985     @Override
setDataRoamingEnabled(boolean enable)986     public void setDataRoamingEnabled(boolean enable) {
987         mActivePhone.setDataRoamingEnabled(enable);
988     }
989 
990     @Override
getDataEnabled()991     public boolean getDataEnabled() {
992         return mActivePhone.getDataEnabled();
993     }
994 
995     @Override
setDataEnabled(boolean enable)996     public void setDataEnabled(boolean enable) {
997         mActivePhone.setDataEnabled(enable);
998     }
999 
1000     @Override
queryCdmaRoamingPreference(Message response)1001     public void queryCdmaRoamingPreference(Message response) {
1002         mActivePhone.queryCdmaRoamingPreference(response);
1003     }
1004 
1005     @Override
setCdmaRoamingPreference(int cdmaRoamingType, Message response)1006     public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) {
1007         mActivePhone.setCdmaRoamingPreference(cdmaRoamingType, response);
1008     }
1009 
1010     @Override
setCdmaSubscription(int cdmaSubscriptionType, Message response)1011     public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
1012         mActivePhone.setCdmaSubscription(cdmaSubscriptionType, response);
1013     }
1014 
1015     @Override
getSimulatedRadioControl()1016     public SimulatedRadioControl getSimulatedRadioControl() {
1017         return mActivePhone.getSimulatedRadioControl();
1018     }
1019 
1020     @Override
isDataConnectivityPossible()1021     public boolean isDataConnectivityPossible() {
1022         return mActivePhone.isDataConnectivityPossible(PhoneConstants.APN_TYPE_DEFAULT);
1023     }
1024 
1025     @Override
isDataConnectivityPossible(String apnType)1026     public boolean isDataConnectivityPossible(String apnType) {
1027         return mActivePhone.isDataConnectivityPossible(apnType);
1028     }
1029 
1030     @Override
getDeviceId()1031     public String getDeviceId() {
1032         return mActivePhone.getDeviceId();
1033     }
1034 
1035     @Override
getDeviceSvn()1036     public String getDeviceSvn() {
1037         return mActivePhone.getDeviceSvn();
1038     }
1039 
1040     @Override
getSubscriberId()1041     public String getSubscriberId() {
1042         return mActivePhone.getSubscriberId();
1043     }
1044 
1045     @Override
getGroupIdLevel1()1046     public String getGroupIdLevel1() {
1047         return mActivePhone.getGroupIdLevel1();
1048     }
1049 
1050     @Override
getIccSerialNumber()1051     public String getIccSerialNumber() {
1052         return mActivePhone.getIccSerialNumber();
1053     }
1054 
1055     @Override
getEsn()1056     public String getEsn() {
1057         return mActivePhone.getEsn();
1058     }
1059 
1060     @Override
getMeid()1061     public String getMeid() {
1062         return mActivePhone.getMeid();
1063     }
1064 
1065     @Override
getMsisdn()1066     public String getMsisdn() {
1067         return mActivePhone.getMsisdn();
1068     }
1069 
1070     @Override
getImei()1071     public String getImei() {
1072         return mActivePhone.getImei();
1073     }
1074 
1075     @Override
getNai()1076     public String getNai() {
1077         return mActivePhone.getNai();
1078     }
1079 
1080     @Override
getPhoneSubInfo()1081     public PhoneSubInfo getPhoneSubInfo(){
1082         return mActivePhone.getPhoneSubInfo();
1083     }
1084 
1085     @Override
getIccPhoneBookInterfaceManager()1086     public IccPhoneBookInterfaceManager getIccPhoneBookInterfaceManager(){
1087         return mActivePhone.getIccPhoneBookInterfaceManager();
1088     }
1089 
1090     @Override
setUiTTYMode(int uiTtyMode, Message onComplete)1091     public void setUiTTYMode(int uiTtyMode, Message onComplete) {
1092         mActivePhone.setUiTTYMode(uiTtyMode, onComplete);
1093     }
1094 
1095     @Override
setTTYMode(int ttyMode, Message onComplete)1096     public void setTTYMode(int ttyMode, Message onComplete) {
1097         mActivePhone.setTTYMode(ttyMode, onComplete);
1098     }
1099 
1100     @Override
queryTTYMode(Message onComplete)1101     public void queryTTYMode(Message onComplete) {
1102         mActivePhone.queryTTYMode(onComplete);
1103     }
1104 
1105     @Override
activateCellBroadcastSms(int activate, Message response)1106     public void activateCellBroadcastSms(int activate, Message response) {
1107         mActivePhone.activateCellBroadcastSms(activate, response);
1108     }
1109 
1110     @Override
getCellBroadcastSmsConfig(Message response)1111     public void getCellBroadcastSmsConfig(Message response) {
1112         mActivePhone.getCellBroadcastSmsConfig(response);
1113     }
1114 
1115     @Override
setCellBroadcastSmsConfig(int[] configValuesArray, Message response)1116     public void setCellBroadcastSmsConfig(int[] configValuesArray, Message response) {
1117         mActivePhone.setCellBroadcastSmsConfig(configValuesArray, response);
1118     }
1119 
1120     @Override
notifyDataActivity()1121     public void notifyDataActivity() {
1122          mActivePhone.notifyDataActivity();
1123     }
1124 
1125     @Override
getSmscAddress(Message result)1126     public void getSmscAddress(Message result) {
1127         mActivePhone.getSmscAddress(result);
1128     }
1129 
1130     @Override
setSmscAddress(String address, Message result)1131     public void setSmscAddress(String address, Message result) {
1132         mActivePhone.setSmscAddress(address, result);
1133     }
1134 
1135     @Override
getCdmaEriIconIndex()1136     public int getCdmaEriIconIndex() {
1137         return mActivePhone.getCdmaEriIconIndex();
1138     }
1139 
1140     @Override
getCdmaEriText()1141     public String getCdmaEriText() {
1142         return mActivePhone.getCdmaEriText();
1143     }
1144 
1145     @Override
getCdmaEriIconMode()1146     public int getCdmaEriIconMode() {
1147         return mActivePhone.getCdmaEriIconMode();
1148     }
1149 
getActivePhone()1150     public Phone getActivePhone() {
1151         return mActivePhone;
1152     }
1153 
1154     @Override
sendBurstDtmf(String dtmfString, int on, int off, Message onComplete)1155     public void sendBurstDtmf(String dtmfString, int on, int off, Message onComplete){
1156         mActivePhone.sendBurstDtmf(dtmfString, on, off, onComplete);
1157     }
1158 
1159     @Override
exitEmergencyCallbackMode()1160     public void exitEmergencyCallbackMode(){
1161         mActivePhone.exitEmergencyCallbackMode();
1162     }
1163 
1164     @Override
needsOtaServiceProvisioning()1165     public boolean needsOtaServiceProvisioning(){
1166         return mActivePhone.needsOtaServiceProvisioning();
1167     }
1168 
1169     @Override
isOtaSpNumber(String dialStr)1170     public boolean isOtaSpNumber(String dialStr){
1171         return mActivePhone.isOtaSpNumber(dialStr);
1172     }
1173 
1174     @Override
registerForCallWaiting(Handler h, int what, Object obj)1175     public void registerForCallWaiting(Handler h, int what, Object obj){
1176         mActivePhone.registerForCallWaiting(h,what,obj);
1177     }
1178 
1179     @Override
unregisterForCallWaiting(Handler h)1180     public void unregisterForCallWaiting(Handler h){
1181         mActivePhone.unregisterForCallWaiting(h);
1182     }
1183 
1184     @Override
registerForSignalInfo(Handler h, int what, Object obj)1185     public void registerForSignalInfo(Handler h, int what, Object obj) {
1186         mActivePhone.registerForSignalInfo(h,what,obj);
1187     }
1188 
1189     @Override
unregisterForSignalInfo(Handler h)1190     public void unregisterForSignalInfo(Handler h) {
1191         mActivePhone.unregisterForSignalInfo(h);
1192     }
1193 
1194     @Override
registerForDisplayInfo(Handler h, int what, Object obj)1195     public void registerForDisplayInfo(Handler h, int what, Object obj) {
1196         mActivePhone.registerForDisplayInfo(h,what,obj);
1197     }
1198 
1199     @Override
unregisterForDisplayInfo(Handler h)1200     public void unregisterForDisplayInfo(Handler h) {
1201         mActivePhone.unregisterForDisplayInfo(h);
1202     }
1203 
1204     @Override
registerForNumberInfo(Handler h, int what, Object obj)1205     public void registerForNumberInfo(Handler h, int what, Object obj) {
1206         mActivePhone.registerForNumberInfo(h, what, obj);
1207     }
1208 
1209     @Override
unregisterForNumberInfo(Handler h)1210     public void unregisterForNumberInfo(Handler h) {
1211         mActivePhone.unregisterForNumberInfo(h);
1212     }
1213 
1214     @Override
registerForRedirectedNumberInfo(Handler h, int what, Object obj)1215     public void registerForRedirectedNumberInfo(Handler h, int what, Object obj) {
1216         mActivePhone.registerForRedirectedNumberInfo(h, what, obj);
1217     }
1218 
1219     @Override
unregisterForRedirectedNumberInfo(Handler h)1220     public void unregisterForRedirectedNumberInfo(Handler h) {
1221         mActivePhone.unregisterForRedirectedNumberInfo(h);
1222     }
1223 
1224     @Override
registerForLineControlInfo(Handler h, int what, Object obj)1225     public void registerForLineControlInfo(Handler h, int what, Object obj) {
1226         mActivePhone.registerForLineControlInfo( h, what, obj);
1227     }
1228 
1229     @Override
unregisterForLineControlInfo(Handler h)1230     public void unregisterForLineControlInfo(Handler h) {
1231         mActivePhone.unregisterForLineControlInfo(h);
1232     }
1233 
1234     @Override
registerFoT53ClirlInfo(Handler h, int what, Object obj)1235     public void registerFoT53ClirlInfo(Handler h, int what, Object obj) {
1236         mActivePhone.registerFoT53ClirlInfo(h, what, obj);
1237     }
1238 
1239     @Override
unregisterForT53ClirInfo(Handler h)1240     public void unregisterForT53ClirInfo(Handler h) {
1241         mActivePhone.unregisterForT53ClirInfo(h);
1242     }
1243 
1244     @Override
registerForT53AudioControlInfo(Handler h, int what, Object obj)1245     public void registerForT53AudioControlInfo(Handler h, int what, Object obj) {
1246         mActivePhone.registerForT53AudioControlInfo( h, what, obj);
1247     }
1248 
1249     @Override
unregisterForT53AudioControlInfo(Handler h)1250     public void unregisterForT53AudioControlInfo(Handler h) {
1251         mActivePhone.unregisterForT53AudioControlInfo(h);
1252     }
1253 
registerForRadioOffOrNotAvailable(Handler h, int what, Object obj)1254     public void registerForRadioOffOrNotAvailable(Handler h, int what, Object obj) {
1255         mActivePhone.registerForRadioOffOrNotAvailable( h, what, obj);
1256     }
1257 
unregisterForRadioOffOrNotAvailable(Handler h)1258     public void unregisterForRadioOffOrNotAvailable(Handler h) {
1259         mActivePhone.unregisterForRadioOffOrNotAvailable(h);
1260     }
1261 
1262     @Override
setOnEcbModeExitResponse(Handler h, int what, Object obj)1263     public void setOnEcbModeExitResponse(Handler h, int what, Object obj){
1264         mActivePhone.setOnEcbModeExitResponse(h,what,obj);
1265     }
1266 
1267     @Override
unsetOnEcbModeExitResponse(Handler h)1268     public void unsetOnEcbModeExitResponse(Handler h){
1269         mActivePhone.unsetOnEcbModeExitResponse(h);
1270     }
1271 
1272     @Override
isCspPlmnEnabled()1273     public boolean isCspPlmnEnabled() {
1274         return mActivePhone.isCspPlmnEnabled();
1275     }
1276 
1277     @Override
getIsimRecords()1278     public IsimRecords getIsimRecords() {
1279         return mActivePhone.getIsimRecords();
1280     }
1281 
1282     /**
1283      * {@inheritDoc}
1284      */
1285     @Override
getLteOnCdmaMode()1286     public int getLteOnCdmaMode() {
1287         return mActivePhone.getLteOnCdmaMode();
1288     }
1289 
1290     @Override
setVoiceMessageWaiting(int line, int countWaiting)1291     public void setVoiceMessageWaiting(int line, int countWaiting) {
1292         mActivePhone.setVoiceMessageWaiting(line, countWaiting);
1293     }
1294 
1295     @Override
getUsimServiceTable()1296     public UsimServiceTable getUsimServiceTable() {
1297         return mActivePhone.getUsimServiceTable();
1298     }
1299 
1300     @Override
getUiccCard()1301     public UiccCard getUiccCard() {
1302         return mActivePhone.getUiccCard();
1303     }
1304 
1305     @Override
nvReadItem(int itemID, Message response)1306     public void nvReadItem(int itemID, Message response) {
1307         mActivePhone.nvReadItem(itemID, response);
1308     }
1309 
1310     @Override
nvWriteItem(int itemID, String itemValue, Message response)1311     public void nvWriteItem(int itemID, String itemValue, Message response) {
1312         mActivePhone.nvWriteItem(itemID, itemValue, response);
1313     }
1314 
1315     @Override
nvWriteCdmaPrl(byte[] preferredRoamingList, Message response)1316     public void nvWriteCdmaPrl(byte[] preferredRoamingList, Message response) {
1317         mActivePhone.nvWriteCdmaPrl(preferredRoamingList, response);
1318     }
1319 
1320     @Override
nvResetConfig(int resetType, Message response)1321     public void nvResetConfig(int resetType, Message response) {
1322         mActivePhone.nvResetConfig(resetType, response);
1323     }
1324 
1325     @Override
dispose()1326     public void dispose() {
1327         if (mActivePhone != null) {
1328             mActivePhone.unregisterForSimRecordsLoaded(this);
1329         }
1330         mCommandsInterface.unregisterForOn(this);
1331         mCommandsInterface.unregisterForVoiceRadioTechChanged(this);
1332         mCommandsInterface.unregisterForRilConnected(this);
1333     }
1334 
1335     @Override
removeReferences()1336     public void removeReferences() {
1337         mActivePhone = null;
1338         mCommandsInterface = null;
1339     }
1340 
updateCurrentCarrierInProvider()1341     public boolean updateCurrentCarrierInProvider() {
1342         if (mActivePhone instanceof CDMALTEPhone) {
1343             return ((CDMALTEPhone)mActivePhone).updateCurrentCarrierInProvider();
1344         } else if (mActivePhone instanceof GSMPhone) {
1345             return ((GSMPhone)mActivePhone).updateCurrentCarrierInProvider();
1346         } else {
1347            loge("Phone object is not MultiSim. This should not hit!!!!");
1348            return false;
1349         }
1350     }
1351 
updateDataConnectionTracker()1352     public void updateDataConnectionTracker() {
1353         logd("Updating Data Connection Tracker");
1354         if (mActivePhone instanceof CDMALTEPhone) {
1355             ((CDMALTEPhone)mActivePhone).updateDataConnectionTracker();
1356         } else if (mActivePhone instanceof GSMPhone) {
1357             ((GSMPhone)mActivePhone).updateDataConnectionTracker();
1358         } else {
1359            loge("Phone object is not MultiSim. This should not hit!!!!");
1360         }
1361     }
1362 
setInternalDataEnabled(boolean enable)1363     public void setInternalDataEnabled(boolean enable) {
1364         setInternalDataEnabled(enable, null);
1365     }
1366 
setInternalDataEnabledFlag(boolean enable)1367     public boolean setInternalDataEnabledFlag(boolean enable) {
1368         boolean flag = false;
1369         if (mActivePhone instanceof CDMALTEPhone) {
1370             flag = ((CDMALTEPhone)mActivePhone).setInternalDataEnabledFlag(enable);
1371         } else if (mActivePhone instanceof GSMPhone) {
1372             flag = ((GSMPhone)mActivePhone).setInternalDataEnabledFlag(enable);
1373         } else {
1374            loge("Phone object is not MultiSim. This should not hit!!!!");
1375         }
1376         return flag;
1377     }
1378 
setInternalDataEnabled(boolean enable, Message onCompleteMsg)1379     public void setInternalDataEnabled(boolean enable, Message onCompleteMsg) {
1380         if (mActivePhone instanceof CDMALTEPhone) {
1381             ((CDMALTEPhone)mActivePhone).setInternalDataEnabled(enable, onCompleteMsg);
1382         } else if (mActivePhone instanceof GSMPhone) {
1383             ((GSMPhone)mActivePhone).setInternalDataEnabled(enable, onCompleteMsg);
1384         } else {
1385            loge("Phone object is not MultiSim. This should not hit!!!!");
1386         }
1387     }
1388 
registerForAllDataDisconnected(Handler h, int what, Object obj)1389     public void registerForAllDataDisconnected(Handler h, int what, Object obj) {
1390         if (mActivePhone instanceof CDMALTEPhone) {
1391             ((CDMALTEPhone)mActivePhone).registerForAllDataDisconnected(h, what, obj);
1392         } else if (mActivePhone instanceof GSMPhone) {
1393             ((GSMPhone)mActivePhone).registerForAllDataDisconnected(h, what, obj);
1394         } else {
1395            loge("Phone object is not MultiSim. This should not hit!!!!");
1396         }
1397     }
1398 
unregisterForAllDataDisconnected(Handler h)1399     public void unregisterForAllDataDisconnected(Handler h) {
1400         if (mActivePhone instanceof CDMALTEPhone) {
1401             ((CDMALTEPhone)mActivePhone).unregisterForAllDataDisconnected(h);
1402         } else if (mActivePhone instanceof GSMPhone) {
1403             ((GSMPhone)mActivePhone).unregisterForAllDataDisconnected(h);
1404         } else {
1405            loge("Phone object is not MultiSim. This should not hit!!!!");
1406         }
1407     }
1408 
1409 
getSubId()1410     public int getSubId() {
1411         return mActivePhone.getSubId();
1412     }
1413 
getPhoneId()1414     public int getPhoneId() {
1415         return mActivePhone.getPhoneId();
1416     }
1417 
1418     @Override
getPcscfAddress(String apnType)1419     public String[] getPcscfAddress(String apnType) {
1420         return mActivePhone.getPcscfAddress(apnType);
1421     }
1422 
1423     @Override
setImsRegistrationState(boolean registered)1424     public void setImsRegistrationState(boolean registered){
1425         logd("setImsRegistrationState - registered: " + registered);
1426 
1427         mActivePhone.setImsRegistrationState(registered);
1428 
1429         if ((mActivePhone.getPhoneName()).equals("GSM")) {
1430             GSMPhone GP = (GSMPhone)mActivePhone;
1431             GP.getServiceStateTracker().setImsRegistrationState(registered);
1432         } else if ((mActivePhone.getPhoneName()).equals("CDMA")) {
1433             CDMAPhone CP = (CDMAPhone)mActivePhone;
1434             CP.getServiceStateTracker().setImsRegistrationState(registered);
1435         }
1436     }
1437 
1438     @Override
getImsPhone()1439     public Phone getImsPhone() {
1440         return mActivePhone.getImsPhone();
1441     }
1442 
1443     @Override
relinquishOwnershipOfImsPhone()1444     public ImsPhone relinquishOwnershipOfImsPhone() { return null; }
1445 
1446     @Override
acquireOwnershipOfImsPhone(ImsPhone imsPhone)1447     public void acquireOwnershipOfImsPhone(ImsPhone imsPhone) { }
1448 
1449     @Override
getVoicePhoneServiceState()1450     public int getVoicePhoneServiceState() {
1451         return mActivePhone.getVoicePhoneServiceState();
1452     }
1453 
1454     @Override
setOperatorBrandOverride(String brand)1455     public boolean setOperatorBrandOverride(String brand) {
1456         return mActivePhone.setOperatorBrandOverride(brand);
1457     }
1458 
1459     @Override
setRoamingOverride(List<String> gsmRoamingList, List<String> gsmNonRoamingList, List<String> cdmaRoamingList, List<String> cdmaNonRoamingList)1460     public boolean setRoamingOverride(List<String> gsmRoamingList,
1461             List<String> gsmNonRoamingList, List<String> cdmaRoamingList,
1462             List<String> cdmaNonRoamingList) {
1463         return mActivePhone.setRoamingOverride(gsmRoamingList, gsmNonRoamingList,
1464                 cdmaRoamingList, cdmaNonRoamingList);
1465     }
1466 
1467     @Override
isRadioAvailable()1468     public boolean isRadioAvailable() {
1469         return mCommandsInterface.getRadioState().isAvailable();
1470     }
1471 
1472     @Override
shutdownRadio()1473     public void shutdownRadio() {
1474         mActivePhone.shutdownRadio();
1475     }
1476 
1477     @Override
setRadioCapability(RadioCapability rc, Message response)1478     public void setRadioCapability(RadioCapability rc, Message response) {
1479         mActivePhone.setRadioCapability(rc, response);
1480     }
1481 
1482     @Override
getRadioAccessFamily()1483     public int getRadioAccessFamily() {
1484         return mActivePhone.getRadioAccessFamily();
1485     }
1486 
1487     @Override
getSupportedRadioAccessFamily()1488     public int getSupportedRadioAccessFamily() {
1489         return mCommandsInterface.getSupportedRadioAccessFamily();
1490     }
1491 
1492     @Override
registerForRadioCapabilityChanged(Handler h, int what, Object obj)1493     public void registerForRadioCapabilityChanged(Handler h, int what, Object obj) {
1494         mActivePhone.registerForRadioCapabilityChanged(h, what, obj);
1495     }
1496 
1497     @Override
unregisterForRadioCapabilityChanged(Handler h)1498     public void unregisterForRadioCapabilityChanged(Handler h) {
1499         mActivePhone.unregisterForRadioCapabilityChanged(h);
1500     }
1501 
getPhoneIccCardProxy()1502     public IccCardProxy getPhoneIccCardProxy() {
1503         return mIccCardProxy;
1504     }
1505 
isImsRegistered()1506     public boolean isImsRegistered() {
1507         return mActivePhone.isImsRegistered();
1508     }
1509 
dump(FileDescriptor fd, PrintWriter pw, String[] args)1510     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
1511         try {
1512             ((PhoneBase)mActivePhone).dump(fd, pw, args);
1513         } catch (Exception e) {
1514             e.printStackTrace();
1515         }
1516         pw.flush();
1517         pw.println("++++++++++++++++++++++++++++++++");
1518 
1519         try {
1520             mPhoneSubInfoProxy.dump(fd, pw, args);
1521         } catch (Exception e) {
1522             e.printStackTrace();
1523         }
1524         pw.flush();
1525         pw.println("++++++++++++++++++++++++++++++++");
1526 
1527         try {
1528             mIccCardProxy.dump(fd, pw, args);
1529         } catch (Exception e) {
1530             e.printStackTrace();
1531         }
1532         pw.flush();
1533         pw.println("++++++++++++++++++++++++++++++++");
1534     }
1535 }
1536