尽量在方法调用链的深层修改
IMSI
获取
TelephonyManager#getSubscriberId,具体数据获取如下
PhoneSubInfoController#getSubscriberIdForSubscriber
GsmCdmaPhone#getSubscriberId,这个方法根据phone的不同,调用不用的方法(直接在这一步可以修改imsi)
Gsm的Phone调用 IccRecords#getIMSI
CDMA的Phone调用 ServiceStateTracker
设置
首先在handleMessage方法里面,执行switch条件为EVENT_UPDATE_PHONE_OBJECT的语句快,接着按照下面的方法链执行:phoneObjectUpdater => switchVoiceRadioTech => switchPhoneType => onUpdateIccAvailability
ICCID
获取
TelephonyManager#getSimSerialNumber,具体数据获取如下
PhoneSubInfoController#getSimSerialNumber
Phone#getIccSerialNumber(我们在GsmCdmaPhone里面的这个方法修改iccid)
IccRecords#getIccId(由于iccid会实时的根据插卡情况进行置空,因此不能在这个方法里修改)
手机号
获取
TelephonyManager#getLine1Number 这个方法从以下地方获取
PhoneInterfaceManager#getLine1NumberForDisplay,这个方法先使用subId获取iccid,然后在 sharedpreferences 获取键为 PREF_CARRIERS_NUMBER_PREFIX + iccId 的值(由于这个sharedpreference的值会实时的根据插卡情况进行更新,因此直接在这个方法里面进行修改)
phoneType
获取
TelephonyManager#getPhoneType 这个方法从以下地方获取
TelephonyManager#getCurrentPhoneType
TelephonyManager#getCurrentPhoneTypeForSlot
ITelephony#getActivePhoneTypeForSlot
PhoneInterfaceManager#getActivePhoneTypeForSlot
GsmCdmaPhone#getPhoneType
getNetworkOperator
获取
TelephonyManager#getNetworkOperator
TelephonyManager#getNetworkOperatorForPhone
TelephonyManager#getTelephonyProperty,这个方法实际调用的是 SystemProperties#get,参数是 gsm.operator.numeric
getNetworkOperatorName
获取
跟上面的那个类似,区别是参数为 gsm.operator.alpha
getNetworkCountryIso
获取
TelephonyManager#getNetworkCountryIso
TelephonyManager#getNetworkCountryIsoForPhone
TelephonyManager#getTelephonyProperty,这个方法实际调用的是 SystemProperties#get,参数是 gsm.operator.iso-country
getNetworkType
获取
TelephonyManager#getNetworkType
PhoneInterfaceManager#getNetworkType(直接在这里进行修改,只改默认的phone)
GsmCdmaPhone#getServiceState
ServiceState#getDataNetworkType
getDataNetworkType
获取
TelephonyManager#getDataNetworkType
PhoneInterfaceManager#getDataNetworkTypeForSubscriber(直接在这里进行修改,只改默认的phone)
ServiceState#getDataNetworkType
getSimState
获取
TelephonyManager#getSimState
SubscriptionManager#getSimStateForSlotIdx
SubscriptionController#getSimStateForSlotIdx(在这里修改)
IccCard#getState
getSimCountryIso
获取
TelephonyManager#getSimCountryIso
TelephonyManager#getSimCountryIsoForPhone
TelephonyManager#getTelephonyProperty,参数名是 gsm.sim.operator.iso-country
getSimOperator
获取
TelephonyManager#getSimOperator
TelephonyManager#getSimOperatorNumeric
TelephonyManager#getSimOperatorNumericForPhone
TelephonyManager#getTelephonyProperty,参数名是 gsm.sim.operator.numeric
getSimOperatorName
获取
TelephonyManager#getSimOperatorName
TelephonyManager#getSimOperatorNameForPhone
TelephonyManager#getTelephonyProperty,参数名是 gsm.sim.operator.alpha
getDeviceSoftwareVersion
获取
TelephonyManager#getDeviceSoftwareVersion
PhoneInterfaceManager#getDeviceSoftwareVersionForSlot
GsmCdmaPhone#getDeviceSvn
getNeighboringCellInfo
获取
TelephonyManager#getNeighboringCellInfo 1 PhoneInterfaceMangaer#getNeighboringCellInfo(在这里修改) 2. PhoneInterfaceManager#sendRequest,参数分别为2、null、-1
getAllCellInfo
获取
TelephonyManager#getAllCellInfo
PhoneInterfaceManager#getAllCellInfo(在这里修改)
Phone#getAllCellInfo
getCellLocation(这个方法需要先使用Settings.Global.putInt(utils.ctx.getContentResolver(), Settings.Global.MULTI_SIM_DATA_CALL_SUBSCRIPTION, 0),将插卡槽设置为第一个,不插卡的话,此值为-1)
获取
TelephonyManager#getCellLocation
PhoneInterfaceManager#getCellLocation(在这里修改)
GsmCdmaPhone#getCellLocation
hasIccCard
获取
TelephonyManager#hasIccCard
PhoneInterfaceManager#hasIccCard
PhoneInterfaceManager#hasIccCardUsingSlotId(在这里修改)