calyxos-scripts/carriersettings-extractor
SGCMarkus 501943ad18
carriersettings-extractor: ignore threshold arrays with size > 4
These cause com.android.phone to crash:
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.android.phone, PID: 4429
E AndroidRuntime: java.lang.IllegalArgumentException: thresholds length must between 1 and 4
E AndroidRuntime: 	at android.telephony.SignalThresholdInfo$Builder.setThresholds(SignalThresholdInfo.java:422)

Change-Id: I1a2721063bc7dae0d3415a59883a5470518c47a1
2023-10-24 03:57:24 +03:00
..
.gitignore carriersettings-extractor: Modify for usage in AOSP 2021-12-23 02:12:12 +05:30
LICENSE Import carriersettings-extractor 2021-12-23 02:12:12 +05:30
Makefile carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
README.md carriersettings-extractor: Update README 2022-10-11 17:35:25 +03:00
carrierId.proto carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
carrierId_pb2.py carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
carrier_list.pb carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
carrier_list.proto carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
carrier_list_pb2.py carriersettings-extractor Update to 12 2022-01-11 22:00:26 +05:30
carrier_settings.proto carriersettings-extractor: Update for 13 2022-08-19 15:20:58 +03:00
carrier_settings_pb2.py carriersettings-extractor: Update for 13 2022-08-19 15:20:58 +03:00
carriersettings_extractor.py carriersettings-extractor: ignore threshold arrays with size > 4 2023-10-24 03:57:24 +03:00

README.md

carriersettings-extractor

Android Open Source Project (AOSP) includes APN settings (apns-full-conf.xml) and carrier settings (carrier_config_*.xml + vendor.xml) in human-readable XML format. However, Google Pixel device images instead include APN and carrier settings as binary protobuf files for use by the CarrierSettings system app.

This script converts the CarrierSettings protobuf files (e.g., carrier_list.pb, others.pb) to XML format compatible with AOSP. This may be helpful for Android-based systems that do not bundle CarrierSettings, but wish to support carriers that are not included in AOSP.

For a description of each APN and carrier setting, refer to the doc comments in Telephony.java and CarrierConfigManager.java, respectively.

Dependencies

  • protobuf-compiler (protoc) - optional, see below
  • python3-protobuf - required

Usage

Download a Pixel factory image and extract the CarrierSettings protobuf files. Convert CarrierSettings/*.pb to apns-full-conf.xml and vendor.xml.

./carriersettings_extractor.py -i CarrierSettings -a apns-conf.xml -v vendor.xml

Protobuf definitions

The definitions in carrier_list.proto and carrier_settings.proto are useful for inspecting the CarrierSettings protobuf files.

protoc --decode=com.google.carrier.CarrierList carrier_list.proto < CarrierSettings/carrier_list.pb
protoc --decode=com.google.carrier.CarrierSettings carrier_settings.proto < CarrierSettings/verizon_us.pb
protoc --decode=com.google.carrier.MultiCarrierSettings carrier_settings.proto < CarrierSettings/others.pb

To check schema or otherwise inspect the protobuf files without applying definitions, use the --decode_raw argument.

protoc --decode_raw < CarrierSettings/carrier_list.pb
protoc --decode_raw < CarrierSettings/verizon_us.pb
protoc --decode_raw < CarrierSettings/others.pb