Home | History | Annotate | Download | only in telephony
      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 android.os.Handler;
     20 import android.os.Message;
     21 
     22 import com.android.internal.telephony.IccCardConstants.State;
     23 
     24 /**
     25  * {@hide}
     26  * @Deprecated use UiccController.getUiccCard instead.
     27  *
     28  * Integrated Circuit Card (ICC) interface
     29  * An object of a class implementing this interface is used by external
     30  * apps (specifically PhoneApp) to perform icc card related functionality.
     31  *
     32  * Apps (those that have access to Phone object) can retrieve this object
     33  * by calling phone.getIccCard()
     34  *
     35  * This interface is implemented by IccCardProxy and the object PhoneApp
     36  * gets when it calls getIccCard is IccCardProxy.
     37  */
     38 public interface IccCard {
     39     /**
     40      * @return combined Card and current App state
     41      */
     42     public State getState();
     43 
     44     /**
     45      * @return IccRecords object belonging to current UiccCardApplication
     46      */
     47     public IccRecords getIccRecords();
     48 
     49     /**
     50      * @return IccFileHandler object belonging to current UiccCardApplication
     51      */
     52     public IccFileHandler getIccFileHandler();
     53 
     54     /**
     55      * Notifies handler of any transition into IccCardConstants.State.ABSENT
     56      */
     57     public void registerForAbsent(Handler h, int what, Object obj);
     58     public void unregisterForAbsent(Handler h);
     59 
     60     /**
     61      * Notifies handler of any transition into IccCardConstants.State.NETWORK_LOCKED
     62      */
     63     public void registerForNetworkLocked(Handler h, int what, Object obj);
     64     public void unregisterForNetworkLocked(Handler h);
     65 
     66     /**
     67      * Notifies handler of any transition into IccCardConstants.State.isPinLocked()
     68      */
     69     public void registerForLocked(Handler h, int what, Object obj);
     70     public void unregisterForLocked(Handler h);
     71 
     72     /**
     73      * Supply the ICC PIN to the ICC
     74      *
     75      * When the operation is complete, onComplete will be sent to its
     76      * Handler.
     77      *
     78      * onComplete.obj will be an AsyncResult
     79      *
     80      * ((AsyncResult)onComplete.obj).exception == null on success
     81      * ((AsyncResult)onComplete.obj).exception != null on fail
     82      *
     83      * If the supplied PIN is incorrect:
     84      * ((AsyncResult)onComplete.obj).exception != null
     85      * && ((AsyncResult)onComplete.obj).exception
     86      *       instanceof com.android.internal.telephony.gsm.CommandException)
     87      * && ((CommandException)(((AsyncResult)onComplete.obj).exception))
     88      *          .getCommandError() == CommandException.Error.PASSWORD_INCORRECT
     89      */
     90     public void supplyPin (String pin, Message onComplete);
     91 
     92     /**
     93      * Supply the ICC PUK to the ICC
     94      */
     95     public void supplyPuk (String puk, String newPin, Message onComplete);
     96 
     97     /**
     98      * Supply the ICC PIN2 to the ICC
     99      */
    100     public void supplyPin2 (String pin2, Message onComplete);
    101 
    102     /**
    103      * Supply the ICC PUK2 to the ICC
    104      */
    105     public void supplyPuk2 (String puk2, String newPin2, Message onComplete);
    106 
    107     /**
    108      * Supply Network depersonalization code to the RIL
    109      */
    110     public void supplyNetworkDepersonalization (String pin, Message onComplete);
    111 
    112     /**
    113      * Check whether ICC pin lock is enabled
    114      * This is a sync call which returns the cached pin enabled state
    115      *
    116      * @return true for ICC locked enabled
    117      *         false for ICC locked disabled
    118      */
    119     public boolean getIccLockEnabled();
    120 
    121     /**
    122      * Check whether ICC fdn (fixed dialing number) is enabled
    123      * This is a sync call which returns the cached pin enabled state
    124      *
    125      * @return true for ICC fdn enabled
    126      *         false for ICC fdn disabled
    127      */
    128     public boolean getIccFdnEnabled();
    129 
    130      /**
    131       * Set the ICC pin lock enabled or disabled
    132       * When the operation is complete, onComplete will be sent to its handler
    133       *
    134       * @param enabled "true" for locked "false" for unlocked.
    135       * @param password needed to change the ICC pin state, aka. Pin1
    136       * @param onComplete
    137       *        onComplete.obj will be an AsyncResult
    138       *        ((AsyncResult)onComplete.obj).exception == null on success
    139       *        ((AsyncResult)onComplete.obj).exception != null on fail
    140       */
    141      public void setIccLockEnabled (boolean enabled,
    142              String password, Message onComplete);
    143 
    144      /**
    145       * Set the ICC fdn enabled or disabled
    146       * When the operation is complete, onComplete will be sent to its handler
    147       *
    148       * @param enabled "true" for locked "false" for unlocked.
    149       * @param password needed to change the ICC fdn enable, aka Pin2
    150       * @param onComplete
    151       *        onComplete.obj will be an AsyncResult
    152       *        ((AsyncResult)onComplete.obj).exception == null on success
    153       *        ((AsyncResult)onComplete.obj).exception != null on fail
    154       */
    155      public void setIccFdnEnabled (boolean enabled,
    156              String password, Message onComplete);
    157 
    158      /**
    159       * Change the ICC password used in ICC pin lock
    160       * When the operation is complete, onComplete will be sent to its handler
    161       *
    162       * @param oldPassword is the old password
    163       * @param newPassword is the new password
    164       * @param onComplete
    165       *        onComplete.obj will be an AsyncResult
    166       *        ((AsyncResult)onComplete.obj).exception == null on success
    167       *        ((AsyncResult)onComplete.obj).exception != null on fail
    168       */
    169      public void changeIccLockPassword(String oldPassword, String newPassword,
    170              Message onComplete);
    171 
    172      /**
    173       * Change the ICC password used in ICC fdn enable
    174       * When the operation is complete, onComplete will be sent to its handler
    175       *
    176       * @param oldPassword is the old password
    177       * @param newPassword is the new password
    178       * @param onComplete
    179       *        onComplete.obj will be an AsyncResult
    180       *        ((AsyncResult)onComplete.obj).exception == null on success
    181       *        ((AsyncResult)onComplete.obj).exception != null on fail
    182       */
    183      public void changeIccFdnPassword(String oldPassword, String newPassword,
    184              Message onComplete);
    185 
    186     /**
    187      * Returns service provider name stored in ICC card.
    188      * If there is no service provider name associated or the record is not
    189      * yet available, null will be returned <p>
    190      *
    191      * Please use this value when display Service Provider Name in idle mode <p>
    192      *
    193      * Usage of this provider name in the UI is a common carrier requirement.
    194      *
    195      * Also available via Android property "gsm.sim.operator.alpha"
    196      *
    197      * @return Service Provider Name stored in ICC card
    198      *         null if no service provider name associated or the record is not
    199      *         yet available
    200      *
    201      */
    202     public String getServiceProviderName ();
    203 
    204     /**
    205      * Checks if an Application of specified type present on the card
    206      * @param type is AppType to look for
    207      */
    208     public boolean isApplicationOnIcc(IccCardApplicationStatus.AppType type);
    209 
    210     /**
    211      * @return true if a ICC card is present
    212      */
    213     public boolean hasIccCard();
    214 }
    215