UiccのUiccCardApplication(原)


UiccCardApplicationが担当するタスクは、主にIccFileHandlerの作成と外部への提供、IccRecordsオブジェクトの提供、SIMカードのステータスのリスニングの提供などです.
一、UiccCardApplicationの主な機能
UiccCardApplicationが提供するpublicメソッドから、主な機能を確認します.
        public void registerForReady(Handler h, int what, Object obj) {}
        public void registerForLocked(Handler h, int what, Object obj) {}
        public void registerForNetworkLocked(Handler h, int what, Object obj) {}
        public AppState getState() {}
        public AppType getType() {}
        public PersoSubState getPersoSubState() {}
        public String getAid() {}
        public PinState getPin1State() {}
        public IccFileHandler getIccFileHandler() {}
        public IccRecords getIccRecords() {}
        public void supplyPin (String pin, Message onComplete) {}
        public void supplyPuk (String puk, String newPin, Message onComplete) {}
        public void supplyPin2 (String pin2, Message onComplete) {}
        public void supplyPuk2 (String puk2, String newPin2, Message onComplete) {}
        public void supplyNetworkDepersonalization (String pin, Message onComplete) {}
        public boolean getIccLockEnabled() {}
        public boolean getIccFdnEnabled() {}
        public void setIccLockEnabled (boolean enabled, String password, Message onComplete) {}
        public void setIccFdnEnabled (boolean enabled, String password, Message onComplete) {}
        public void changeIccLockPassword(String oldPassword, String newPassword, Message onComplete) {}
        public void changeIccFdnPassword(String oldPassword, String newPassword, Message onComplete) {}
UiccCardApplicationの主な機能を見ることができます.
1.IccFileHandler、IccRecordsオブジェクト2、現在のUiccCardApplicationステータス情報を作成して外部に提供する.主にmAppState、mAppType 3、クエリー、Fdnのステータス設定4、クエリー、Pinの設定、Pukのステータスとパスワードを含む.
5、ネットワークロック、Pinロック、状態OKのリスナーを提供する
二、UiccCardApplicationの初期化過程
UiccCardを紹介したところ
UiccCardが更新されると、UiccCardApplicationオブジェクトが作成または更新されます.
まずUiccCardApplicationのプロパティを見てみましょう.
        public class UiccCardApplication {}
はUiccCardと似ています.親はありません.次に、コンストラクション関数を参照してください.
        UiccCardApplication(UiccCard uiccCard, IccCardApplicationStatus as, Context c, CommandsInterface ci) {
            mUiccCard = uiccCard;
            mAppState = as.app_state;
            mAppType = as.app_type;
            mPersoSubState = as.perso_substate;
            mAid = as.aid;
            mAppLabel = as.app_label;
            mPin1Replaced = (as.pin1_replaced != 0);
            mPin1State = as.pin1;
            mPin2State = as.pin2;
            mContext = c;
            mCi = ci;

            //  IccFileHandler  
            mIccFh = createIccFileHandler(as.app_type);
            //  IccRecords  
            mIccRecords = createIccRecords(as.app_type, mContext, mCi);
            if (mAppState == AppState.APPSTATE_READY) {
                //  fdn  
                queryFdn();
                //  Pin   
                queryPin1State();
            }
        }
は、コンストラクション関数で主に4つのタスクを完了しました.
1、SIMカードを作成するファイルシステム管理者IccFileHandlerのサブクラスオブジェクト:SIM FileHandler/RuimFileHandler/UsimFileHandler/Si mFileHandler/IsimFileHandler 2、SIMカード情報IccRecordsを作成するサブクラスオブジェクト:SIM Records/RuimRecords/IsimUiccRecords 3、Fdn番号の照会
4、Pinコードの状態を問い合わせる
三、UiccCardApplicationの更新過程
ModemのSIMカードまたはRadioステータスが変化すると、UiccControllerでUiccCardが更新され、UiccCardでUiccCardApplicationが更新され、update()メソッドが呼び出されます.
    void update (IccCardApplicationStatus as, Context c, CommandsInterface ci) {
        synchronized (mLock) {
            //    
            mContext = c;
            mCi = ci;
            AppType oldAppType = mAppType;
            AppState oldAppState = mAppState;
            PersoSubState oldPersoSubState = mPersoSubState;
            mAppType = as.app_type;
            mAppState = as.app_state;
            mPersoSubState = as.perso_substate;
            mAid = as.aid;
            mAppLabel = as.app_label;
            mPin1Replaced = (as.pin1_replaced != 0);
            mPin1State = as.pin1;
            mPin2State = as.pin2;

            if (mAppType != oldAppType) {
                if (mIccFh != null) { mIccFh.dispose();}
                if (mIccRecords != null) { mIccRecords.dispose();}
                //    IccFileHandler IccRecords
                mIccFh = createIccFileHandler(as.app_type);
                mIccRecords = createIccRecords(as.app_type, c, ci);
            }

            if (mPersoSubState != oldPersoSubState && mPersoSubState == PersoSubState.PERSOSUBSTATE_SIM_NETWORK) {
                //         
                notifyNetworkLockedRegistrantsIfNeeded(null);
            }

            if (mAppState != oldAppState) {
                if (mAppState == AppState.APPSTATE_READY) {
                    //    Fdn Pin
                    queryFdn();
                    queryPin1State();
                }
                //              
                notifyPinLockedRegistrantsIfNeeded(null);
                notifyReadyRegistrantsIfNeeded(null);
            }
        }
    }
UiccCardApplicationの更新中に3つのタスクが完了したことを示します.
1、現在の状態に関するメンバー変数の更新2、必要に応じてIccFileHandler、IccRecordsの再構築、FdnとPin 3の再問合せ、通知リスナー
次の章では、UiccCardApplicationによって作成されたIccFileHandlerオブジェクトとIccRecordsオブジェクトを分析します.