1 /*
2  * Copyright (C) 2006 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 import java.io.FileDescriptor;
20 import java.io.PrintWriter;
21 
22 import android.os.RemoteException;
23 import android.os.ServiceManager;
24 
25 
26 public class PhoneSubInfoProxy extends IPhoneSubInfo.Stub {
27     private PhoneSubInfo mPhoneSubInfo;
28 
PhoneSubInfoProxy(PhoneSubInfo phoneSubInfo)29     public PhoneSubInfoProxy(PhoneSubInfo phoneSubInfo) {
30         mPhoneSubInfo = phoneSubInfo;
31     }
32 
setmPhoneSubInfo(PhoneSubInfo phoneSubInfo)33     public void setmPhoneSubInfo(PhoneSubInfo phoneSubInfo) {
34         mPhoneSubInfo = phoneSubInfo;
35     }
36 
37     @Override
getDeviceId(String callingPackage)38     public String getDeviceId(String callingPackage) {
39         return mPhoneSubInfo.getDeviceId(callingPackage);
40     }
41 
getImei(String callingPackage)42     public String getImei(String callingPackage) {
43         return mPhoneSubInfo.getImei(callingPackage);
44     }
45 
getNai(String callingPackage)46     public String getNai(String callingPackage) {
47         return mPhoneSubInfo.getNai(callingPackage);
48     }
49 
50     @Override
getDeviceSvn(String callingPackage)51     public String getDeviceSvn(String callingPackage) {
52         return mPhoneSubInfo.getDeviceSvn(callingPackage);
53     }
54 
55     /**
56      * Retrieves the unique subscriber ID, e.g., IMSI for GSM phones.
57      */
58     @Override
getSubscriberId(String callingPackage)59     public String getSubscriberId(String callingPackage) {
60         return mPhoneSubInfo.getSubscriberId(callingPackage);
61     }
62 
63     /**
64      * Retrieves the Group Identifier Level1 for GSM phones.
65      */
getGroupIdLevel1(String callingPackage)66     public String getGroupIdLevel1(String callingPackage) {
67         return mPhoneSubInfo.getGroupIdLevel1(callingPackage);
68     }
69 
70     /**
71      * Retrieves the serial number of the ICC, if applicable.
72      */
73     @Override
getIccSerialNumber(String callingPackage)74     public String getIccSerialNumber(String callingPackage) {
75         return mPhoneSubInfo.getIccSerialNumber(callingPackage);
76     }
77 
78     /**
79      * Retrieves the phone number string for line 1.
80      */
81     @Override
getLine1Number(String callingPackage)82     public String getLine1Number(String callingPackage) {
83         return mPhoneSubInfo.getLine1Number(callingPackage);
84     }
85 
86     /**
87      * Retrieves the alpha identifier for line 1.
88      */
89     @Override
getLine1AlphaTag(String callingPackage)90     public String getLine1AlphaTag(String callingPackage) {
91         return mPhoneSubInfo.getLine1AlphaTag(callingPackage);
92     }
93 
94     /**
95      * Retrieves the MSISDN Number.
96      */
97     @Override
getMsisdn(String callingPackage)98     public String getMsisdn(String callingPackage) {
99         return mPhoneSubInfo.getMsisdn(callingPackage);
100     }
101 
102     /**
103      * Retrieves the voice mail number.
104      */
105     @Override
getVoiceMailNumber(String callingPackage)106     public String getVoiceMailNumber(String callingPackage) {
107         return mPhoneSubInfo.getVoiceMailNumber(callingPackage);
108     }
109 
110     /**
111      * Retrieves the complete voice mail number.
112      */
113     @Override
getCompleteVoiceMailNumber()114     public String getCompleteVoiceMailNumber() {
115         return mPhoneSubInfo.getCompleteVoiceMailNumber();
116     }
117 
118     /**
119      * Retrieves the alpha identifier associated with the voice mail number.
120      */
121     @Override
getVoiceMailAlphaTag(String callingPackage)122     public String getVoiceMailAlphaTag(String callingPackage) {
123         return mPhoneSubInfo.getVoiceMailAlphaTag(callingPackage);
124     }
125 
126     /**
127      * Returns the IMS private user identity (IMPI) that was loaded from the ISIM.
128      * @return the IMPI, or null if not present or not loaded
129      */
130     @Override
getIsimImpi()131     public String getIsimImpi() {
132         return mPhoneSubInfo.getIsimImpi();
133     }
134 
135     /**
136      * Returns the IMS home network domain name that was loaded from the ISIM.
137      * @return the IMS domain name, or null if not present or not loaded
138      */
139     @Override
getIsimDomain()140     public String getIsimDomain() {
141         return mPhoneSubInfo.getIsimDomain();
142     }
143 
144     /**
145      * Returns the IMS public user identities (IMPU) that were loaded from the ISIM.
146      * @return an array of IMPU strings, with one IMPU per string, or null if
147      *      not present or not loaded
148      */
149     @Override
getIsimImpu()150     public String[] getIsimImpu() {
151         return mPhoneSubInfo.getIsimImpu();
152     }
153 
154     @Override
getDeviceIdForPhone(int phoneId)155     public String getDeviceIdForPhone(int phoneId) throws RemoteException {
156         // FIXME: getDeviceIdForPhone
157         return null;
158     }
159 
160     @Override
getImeiForSubscriber(int subId, String callingPackage)161     public String getImeiForSubscriber(int subId, String callingPackage) throws RemoteException {
162         // FIXME: getImeiForSubscriber
163         return null;
164     }
165 
166     @Override
getDeviceSvnUsingSubId(int subId, String callingPackage)167     public String getDeviceSvnUsingSubId(int subId, String callingPackage) throws RemoteException {
168         // FIXME: getDeviceSvnUsingSubId
169         return null;
170     }
171 
172     @Override
getNaiForSubscriber(int subId, String callingPackage)173     public String getNaiForSubscriber(int subId, String callingPackage) throws RemoteException {
174         // FIXME: NaiForSubscriber
175         return null;
176     }
177 
178     @Override
getSubscriberIdForSubscriber(int subId, String callingPackage)179     public String getSubscriberIdForSubscriber(int subId, String callingPackage)
180             throws RemoteException {
181         // FIXME: getSubscriberIdForSubscriber
182         return null;
183     }
184 
185     @Override
getGroupIdLevel1ForSubscriber(int subId, String callingPackage)186     public String getGroupIdLevel1ForSubscriber(int subId, String callingPackage)
187             throws RemoteException {
188         // FIXME: getGroupIdLevel1ForSubscriber
189         return null;
190     }
191 
192     @Override
getIccSerialNumberForSubscriber(int subId, String callingPackage)193     public String getIccSerialNumberForSubscriber(int subId, String callingPackage)
194             throws RemoteException {
195         // FIXME: getIccSerialNumberForSubscriber
196         return null;
197     }
198 
199     @Override
getLine1NumberForSubscriber(int subId, String callingPackage)200     public String getLine1NumberForSubscriber(int subId, String callingPackage) throws RemoteException {
201         // FIXME: getLine1NumberForSubscriber
202         return null;
203     }
204 
205     @Override
getLine1AlphaTagForSubscriber(int subId, String callingPackage)206     public String getLine1AlphaTagForSubscriber(int subId, String callingPackage) throws RemoteException {
207         // FIXME: getLine1AlphaTagForSubscriber
208         return null;
209     }
210 
211     @Override
getMsisdnForSubscriber(int subId, String callingPackage)212     public String getMsisdnForSubscriber(int subId, String callingPackage) throws RemoteException {
213         // FIXME: getMsisdnForSubscriber
214         return null;
215     }
216 
217     @Override
getVoiceMailNumberForSubscriber(int subId, String callingPackage)218     public String getVoiceMailNumberForSubscriber(int subId, String callingPackage) throws RemoteException {
219         // FIXME: getVoiceMailNumberForSubscriber
220         return null;
221     }
222 
223     @Override
getCompleteVoiceMailNumberForSubscriber(int subId)224     public String getCompleteVoiceMailNumberForSubscriber(int subId) throws RemoteException {
225         // FIXME: getCompleteVoiceMailNumberForSubscriber
226         return null;
227     }
228 
229     @Override
getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage)230     public String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage) throws RemoteException {
231         // FIXME: getVoiceMailAlphaTagForSubscriber
232         return null;
233     }
234 
235     /**
236      * Returns the IMS Service Table (IST) that was loaded from the ISIM.
237      * @return IMS Service Table or null if not present or not loaded
238      */
239     @Override
getIsimIst()240     public String getIsimIst() {
241         return mPhoneSubInfo.getIsimIst();
242     }
243 
244     /**
245      * Returns the IMS Proxy Call Session Control Function(PCSCF) that were loaded from the ISIM.
246      * @return an array of  PCSCF strings with one PCSCF per string, or null if
247      *      not present or not loaded
248      */
249     @Override
getIsimPcscf()250     public String[] getIsimPcscf() {
251         return mPhoneSubInfo.getIsimPcscf();
252     }
253 
254     /**
255      * Returns the response of ISIM Authetification through RIL.
256      * Returns null if the Authentification hasn't been successed or isn't present iphonesubinfo.
257      * @return the response of ISIM Authetification, or null if not available
258      * @deprecated
259      * @see #getIccSimChallengeResponse
260      */
getIsimChallengeResponse(String nonce)261     public String getIsimChallengeResponse(String nonce) {
262         return mPhoneSubInfo.getIsimChallengeResponse(nonce);
263     }
264 
265     /**
266      * Returns the response of the SIM application on the UICC to authentication
267      * challenge/response algorithm. The data string and challenge response are
268      * Base64 encoded Strings.
269      * Can support EAP-SIM, EAP-AKA with results encoded per 3GPP TS 31.102.
270      *
271      * @param appType ICC application type (@see com.android.internal.telephony.PhoneConstants#APPTYPE_xxx)
272      * @param data authentication challenge data
273      * @return challenge response
274      */
getIccSimChallengeResponse(int subId, int appType, String data)275     public String getIccSimChallengeResponse(int subId, int appType, String data) {
276         return mPhoneSubInfo.getIccSimChallengeResponse(subId, appType, data);
277     }
278 
279     @Override
dump(FileDescriptor fd, PrintWriter pw, String[] args)280     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
281         mPhoneSubInfo.dump(fd, pw, args);
282     }
283 }
284