1.查看
1>导出telephony.db用数据库工具查看
位于data/user_de/0/com.android.providers.telephony/databases/telephony.db
工具推荐使用SQLiteSpy
2>使用sqllite3 查看
3>. 使用content命令查询
content query --uri content://telephony/siminfo
content query --uri content://telephony/carriers //查询carrier表格
content 命令帮助(增删改查)
usage: adb shell content insert --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...]
<URI> a content provider URI.
<BINDING> binds a typed value to a column and is formatted:
<COLUMN_NAME>:<TYPE>:<COLUMN_VALUE> where:
<TYPE> specifies data type such as:
b - boolean, s - string, i - integer, l - long, f - float, d - double, n - null
Note: Omit the value for passing an empty string, e.g column:s:
Example:
# Add "new_setting" secure setting with value "new_value".
adb shell content insert --uri content://settings/secure --bind name:s:new_setting --bind value:s:new_value
usage: adb shell content update --uri <URI> [--user <USER_ID>] [--where <WHERE>]
<WHERE> is a SQL style where clause in quotes (You have to escape single quotes - see example below).
Example:
# Change "new_setting" secure setting to "newer_value".
adb shell content update --uri content://settings/secure --bind value:s:newer_value --where "name='new_setting'"
usage: adb shell content delete --uri <URI> [--user <USER_ID>] --bind <BINDING> [--bind <BINDING>...] [--where <WHERE>]
Example:
# Remove "new_setting" secure setting.
adb shell content delete --uri content://settings/secure --where "name='new_setting'"
usage: adb shell content query --uri <URI> [--user <USER_ID>] [--projection <PROJECTION>] [--where <WHERE>] [--sort <SORT_ORDER>]
<PROJECTION> is a list of colon separated column names and is formatted:
<COLUMN_NAME>[:<COLUMN_NAME>...]
<SORT_ORDER> is the order in which rows in the result should be sorted.
Example:
# Select "name" and "value" columns from secure settings where "name" is equal to "new_setting" and sort the result by name in ascending order.
adb shell content query --uri content://settings/secure --projection name:value --where "name='new_setting'" --sort "name ASC"
usage: adb shell content call --uri <URI> --method <METHOD> [--arg <ARG>]
[--extra <BINDING> ...]
<METHOD> is the name of a provider-defined method
<ARG> is an optional string argument
<BINDING> is like --bind above, typed data of the form <KEY>:{b,s,i,l,f,d}:<VAL>
usage: adb shell content read --uri <URI> [--user <USER_ID>]
Example:
adb shell 'content read --uri content://settings/system/ringtone_cache' > host.ogg
usage: adb shell content write --uri <URI> [--user <USER_ID>]
Example:
adb shell 'content write --uri content://settings/system/ringtone_cache' < host.ogg
usage: adb shell content gettype --uri <URI> [--user <USER_ID>]
Example:
adb shell content gettype --uri content://media/internal/audio/media/
- SubscriptionManager和SubscriptionInfo使用
官方文档参考https://developer.android.google.cn/reference/android/telephony/SubscriptionManager
https://developer.android.google.cn/reference/android/telephony/SubscriptionInfo
常见方法
addOnSubscriptionsChangedListener //添加subinfo改变的监听,重写onSubscriptionsChanged方法
getActiveSubscriptionInfoList() //获取当前已经激活的卡的subinfo列表,实际为siminfo表格中sim_id大于0的记录
getAllSubscriptionInfoList() //获取所有的subinfo列表,包括之前插入的卡,即siminfo表格中所有的记录
getActiveSubscriptionInfo(int subId) //siminfo表格中sim_id大于0的记录且_id字段等于subID (_id从1开始,插入一张卡就加1,不与卡一卡二相对应)
getActiveSubscriptionInfoForSimSlotIndex(int slotIndex) //通过slotIndex获取到subinfo,slotIndex为卡槽序列(0或者1),对应siminfo表格中的sim_id,切卡并不会改变sim_id,注意log中GsmCdmaPhone,SST,RILJ后面带的序号和slotID对应
getDefaultDataSubscriptionId() //获取默认数据卡的subid, 对应Settings数据库中Global中的multi_sim_data_call
getDefaultSmsSubscriptionId() //Settings数据库中Global中的multi_sim_sms
getDefaultVoiceSubscriptionId() //Settings数据库中Global中的multi_sim_voice_call
getActiveDataSubscriptionId() //android11上新增,android11对比之前的settings界面发生了变化,暂不分析
getPhoneNumber(int subscriptionId) //获取手机号码,为android13上新增,暂不分析
setCarrierPhoneNumber(int subscriptionId, String number) //android13上新增
SubscriptionInfo中常用方法
getNumber()
getIccId()
getDisplayName()
getDataRoaming()
getSimSlotIndex()
getSubscriptionId()