Android--Pin流程,飞行模式相关流程总结【工作日记一】

Radio 对应相关的Log:
Logcat对应的Log:
KeyguardUpdateMonitor:ACTION_SIM_STATE_CHANGED
KeyguardUpdateMonitor:handleSimStateChange:intentValue=PIN_REQUI
MSimLockPatternKeyguardView:createUnlockScreenFor(SimPin);
MSimLockPatternKeyguardView:Display SimUnlockScreen for sub:

1、流程:
MSimIccCardProxy.java
发送广播 broadcastStickyIntent(,)(reason=PIN 参数)
接受广播的类:
  KeyguardUpdateMonitor.java
   TelephonyIntents.ACTION_SIM_STATE_CHANGED
    SimArgs.fromIntent(intent)
  obtainMessage:MSG_SIM_STATE_CHANGED   //334 Line
   handleSimStateChange((SimArgs) msg.obj);  //211 Line
    onSimStateChanged(state, subscription);
     KeyguardViewMediator.java
      onSimStateChanged( , );
        !isShowing() 
           doKeyguardLocked( )
           resetStateLocked( )

2、PIN是否在Settings中选中的流程:
   IccLockSettings.java
     getIccLockEnabled()
     IccCardProxy.java
       getIccLockEnabled()
       mUiccApplication.getIccLockEnabled()
         getPin1State()
             mPin1State
             return  true/false
 

3、查PIN的状态:GET_SIM_STATUS这个状态查询sim卡PIN的状态
PIN的次数,在SimUnlockScreen.java类中:
     checkPin() atteptsRemaining = ITelephony.stub.asInterface(ServiceManager.
                   checkService("phone")).getIccPin1RetryCount();
                 mHeaderText.setText(displayMessage);

查PIN的剩余次数:+EPINC:2,3,10,10
对应的结构体: +EPINC:, , , 返回可用的次数
PIN次数相关知识:
static final int PIN_RESULT_SUCCESS = 0;
Phone.java static final int PIN_PASSWORD_INCORRECT = 1;
static final int PIN_GENERAL_FAILURE = 2;
4、PIN PUK输入错误查询:
卡一 卡二:AT+CPIN=" "
PUK码:发送指令:command=AT+EPIN1=" "
5、PIN设置可用不可用的流程
在Setting包中的
 IccLockSettings.java
      tryChangeIccLockState()
      UiccCardLockEnabled
        setIccLockEnabled( , , )
        RIL.java
         setFacilityLockForApp( , , , , , )
           lockString = (lockState) ? "1":"0";
           rr.mp.writeString(lockString);

通过这个lockString来设置到ril层,以后上层framework层查状态,相应的ril层返回相应的状态
6、关闭分行模式:GET_SIM_STATUS查状态时,sub0返回10个参数
sub0 num_apps1,
gsm_id=0 {APPTYPE_USIM, APPSTATE_PIN, pin1=PINSTATE_ENABLED_NOT_VERIFIED
cmda_id=01, ism_id=-1}[sub0]
sub1 num_apps=1,
gsm_id=0 {APPTYPE_SIM, APPSTATE_PIN}, cdma_id=8, ism_id=-1}[sub1]
mtk的猫,sub1 返回8个参数
锁定SIM卡是否勾选上:
PIN选中状态,报状态:APPSTATE_READY, pin1=PINSTATE_ENABLED_VERIEIED
PIN去掉选中的状态:报状态:APPSTATE_READY, pin1=PINSTATE_DISABLED
1、飞行模式对应的类在framework层,路径如下:
framework/base/policy/src/com/android/internal/policy/impl/GlobalAction.java
有个方法changeAirplaneModeSystemSetting(boolean on) 会根据这个on为true/false写值
Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, on ? 1:0);
然后发送广播:
 Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
           intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
           intent.putExtra("state", on);
           mContext.sendBroadcast(intent);

2、飞行模式置灰不置灰的流程分析:
   PhoneWindowManager.java
     mGlobalActions.showDialog(KeyguardShowing, isDeviceProvisioned());
     GlobalActions.java
       showDialog( , );
          mAirplaneModeOn.updateState(mAirplaneState)
          mAdapter.notifyDataSetChanged();
 
    PhoneStateListener  mPhoneStateListener = new PhoneStateListener {
         mAirplaneModeOn.updateState(mAirplaneState);
         mAdapter.notifyDataSetChanged();
    }
 

点击后变为不可用
可用状态是由PhoneStateListener监听而改变的是否可用;
     onClick()
      mAdapter.getItem(which).onPress();
        changeStateFromPress(nowon);
          ? State.TurningOn : State.TurningOff;

你可能感兴趣的:(Android--Pin流程,飞行模式相关流程总结【工作日记一】)