1====== carrier_list.textpb ======
2
3DO NOT MANUALLY EDIT THIS FILE
4
5This file is the textpb verion of carrier_list.pb files under assets/, for readability purpose only.
6
7This file is not build into pb, thus modification of this file won't take any effect.
8
9===== carrier_list.pb =====
10DO NOT MANUALLY EDIT THIS FILE
11
12This file defines carrier id and should be single versioned.
13
14===== How to test carrier id locally =====
15
16If you want to make change locally during testing, currently there are two ways:
17
181. Modify carrierIdentification.db database by SQL command
19
20For example (Insert MCCMNC '12345' and gid1 'test' to carrier id 20000):
21```
22$ adb shell
23device:/ $ su
24device:/ # DB='/data/user_de/0/com.android.providers.telephony/databases/carrierIdentification.db'
25device:/ # sqlite3 $DB "INSERT INTO carrier_id(mccmnc, gid1, carrier_id, carrier_name) VALUES (12345, 'test', 20000, 'test_carrier')"
26device:/ # reboot
27```
28
292. Override carrier_list.pb
30
31- Modify carrier_list.textpb directly (Note: You should also bump the version
32  number to let TelephonyProvider reload the carrier_list.pb)
33- Generate class file by using the carrier id proto(TelephonyProvider/proto/src/carrierId.proto)
34  (See https://developers.google.com/protocol-buffers/docs/overview#generating)
35- Create a converter by using TextFormat tool to convert textpb to pb
36  (Text Format: https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/TextFormat)
37- Rename file to carrier_list_test.pb and push the output file to
38    /data/user_de/0/com.android.providers.telephony/files/carrier_list_test.pb
39- Reboot the device
40
41Converter example:
42```
43#!/usr/bin/env python3
44from google.protobuf import text_format
45
46# Generated by: protoc -I=./ --python_out=./ ./carrierId.proto
47from carrierId_pb2 import CarrierList
48
49def main():
50  with open("carrier_list.textpb", "r") as rd:
51    carrierList = CarrierList()
52    text_format.Merge(rd.read(), carrierList)
53
54    with open("carrier_list.pb", "wb") as wf:
55      wf.write(carrierList.SerializeToString())
56
57if __name__ == '__main__':
58  main()
59```
60