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
17package com.android.internal.telephony;
18
19import android.os.ServiceManager;
20import com.android.internal.telephony.uicc.AdnRecord;
21
22
23import java.util.List;
24
25
26/**
27 * SimPhoneBookInterfaceManager to provide an inter-process communication to
28 * access ADN-like SIM records.
29 */
30public class IccPhoneBookInterfaceManagerProxy extends IIccPhoneBook.Stub {
31    private IccPhoneBookInterfaceManager mIccPhoneBookInterfaceManager;
32
33    public IccPhoneBookInterfaceManagerProxy(IccPhoneBookInterfaceManager
34            iccPhoneBookInterfaceManager) {
35        mIccPhoneBookInterfaceManager = iccPhoneBookInterfaceManager;
36        if(ServiceManager.getService("simphonebook") == null) {
37            ServiceManager.addService("simphonebook", this);
38        }
39    }
40
41    public void setmIccPhoneBookInterfaceManager(
42            IccPhoneBookInterfaceManager iccPhoneBookInterfaceManager) {
43        mIccPhoneBookInterfaceManager = iccPhoneBookInterfaceManager;
44    }
45
46    @Override
47    public boolean
48    updateAdnRecordsInEfBySearch (int efid,
49            String oldTag, String oldPhoneNumber,
50            String newTag, String newPhoneNumber,
51            String pin2) {
52        return mIccPhoneBookInterfaceManager.updateAdnRecordsInEfBySearch(
53                efid, oldTag, oldPhoneNumber, newTag, newPhoneNumber, pin2);
54    }
55
56    @Override
57    public boolean
58    updateAdnRecordsInEfByIndex(int efid, String newTag,
59            String newPhoneNumber, int index, String pin2) {
60        return mIccPhoneBookInterfaceManager.updateAdnRecordsInEfByIndex(efid,
61                newTag, newPhoneNumber, index, pin2);
62    }
63
64    @Override
65    public int[] getAdnRecordsSize(int efid) {
66        return mIccPhoneBookInterfaceManager.getAdnRecordsSize(efid);
67    }
68
69    @Override
70    public List<AdnRecord> getAdnRecordsInEf(int efid) {
71        return mIccPhoneBookInterfaceManager.getAdnRecordsInEf(efid);
72    }
73}
74