A data table is used in Androidl to save SIM card information: There is a table in telephony.db that records the SIM card information, Siminfo:
CREATE TABLE siminfo (_id integer PRIMARY KEY autoincrement,icc_id TEXT not null,sim_id INTEGER default-1,display_name TEX T,carrier_name text,name_source integer default 0,color integer default 0,number text,display_number_format integer not N ULL default 1,data_roaming integer default 0,MCC integer default 0,MNC integer default 0);
A single row of record instances is as follows:
INSERT into "Siminfo" VALUES (1, ' 89860114831010865147 ', 0, ' China Unicom ', ' China Unicom 3G ', 0,-16746133, ' +8618516657794 ', 1,0,460,1);
Where the primary key _id is similar to the ID of the SIM card, the value is incremented from 1, sim_id is similar to the slot ID, in the dual-SIM version generally only -1/0/1 three values; the rest of the properties are well understood.
So how to correspond to _id and sim_id? such as functions:
Subscriptioncontroller.getphoneid (SUBID)://According to SUBID acquisition Phoneid
foreach Entry:mSlotIdxToSubId.entrySet ()//specific code, traversing Mslotidxtosubid
int sim = Entry.getkey (); Corresponds to the sim_id field in the Siminfo table
int sub = Entry.getvalue (); Corresponds to the _id field in the Siminfo table
if (subId = = Sub) {return sim;}//Normal process, the value returned here will be as Phoneid;
This means that the passed-in parameter SubID value equals the _id value of a row sim in the Siminfo table, returning its sim_id field, which represents the phone ID.
You can refer to the elements in mslotidxtosubid that are populated like this:
Mslotidxtosubid.put (SlotID, subId); Slotid:the slot which the SIM is inserted; Subid:siminfo table in the _id field, an example:
_id = 3
icc_id = 89860114831010865147
sim_id = 1
How to get Phoneid through SubID?