60 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
====== carrier_list.textpb ======
 | 
						|
 | 
						|
DO NOT MANUALLY EDIT THIS FILE
 | 
						|
 | 
						|
This file is the textpb verion of carrier_list.pb files under assets/, for readability purpose only.
 | 
						|
 | 
						|
This file is not build into pb, thus modification of this file won't take any effect.
 | 
						|
 | 
						|
===== carrier_list.pb =====
 | 
						|
DO NOT MANUALLY EDIT THIS FILE
 | 
						|
 | 
						|
This file defines carrier id and should be single versioned.
 | 
						|
 | 
						|
===== How to test carrier id locally =====
 | 
						|
 | 
						|
If you want to make change locally during testing, currently there are two ways:
 | 
						|
 | 
						|
1. Modify carrierIdentification.db database by SQL command
 | 
						|
 | 
						|
For example (Insert MCCMNC '12345' and gid1 'test' to carrier id 20000):
 | 
						|
```
 | 
						|
$ adb shell
 | 
						|
device:/ $ su
 | 
						|
device:/ # DB='/data/user_de/0/com.android.providers.telephony/databases/carrierIdentification.db'
 | 
						|
device:/ # sqlite3 $DB "INSERT INTO carrier_id(mccmnc, gid1, carrier_id, carrier_name) VALUES (12345, 'test', 20000, 'test_carrier')"
 | 
						|
device:/ # reboot
 | 
						|
```
 | 
						|
 | 
						|
2. Override carrier_list.pb
 | 
						|
 | 
						|
- Modify carrier_list.textpb directly (Note: You should also bump the version
 | 
						|
  number to let TelephonyProvider reload the carrier_list.pb)
 | 
						|
- Generate class file by using the carrier id proto(TelephonyProvider/proto/src/carrierId.proto)
 | 
						|
  (See https://developers.google.com/protocol-buffers/docs/overview#generating)
 | 
						|
- Create a converter by using TextFormat tool to convert textpb to pb
 | 
						|
  (Text Format: https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/TextFormat)
 | 
						|
- Rename file to carrier_list_test.pb and push the output file to
 | 
						|
    /data/user_de/0/com.android.providers.telephony/files/carrier_list_test.pb
 | 
						|
- Reboot the device
 | 
						|
 | 
						|
Converter example:
 | 
						|
```
 | 
						|
#!/usr/bin/env python3
 | 
						|
from google.protobuf import text_format
 | 
						|
 | 
						|
# Generated by: protoc -I=./ --python_out=./ ./carrierId.proto
 | 
						|
from carrierId_pb2 import CarrierList
 | 
						|
 | 
						|
def main():
 | 
						|
  with open("carrier_list.textpb", "r") as rd:
 | 
						|
    carrierList = CarrierList()
 | 
						|
    text_format.Merge(rd.read(), carrierList)
 | 
						|
 | 
						|
    with open("carrier_list.pb", "wb") as wf:
 | 
						|
      wf.write(carrierList.SerializeToString())
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
  main()
 | 
						|
```
 |