/carriersettings-extractor

Converts the CarrierSettings binary protobuf files in Google Pixel device images to XML format compatible with AOSP

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

carriersettings-extractor

Introduction

This project is designed to automate the processing of protobufs shipped on Google Pixel devices which are used by the proprietary CarrierSettings app and are generated by the open source https://android.googlesource.com/platform/tools/carrier_settings/ project.

2 XMLs are generated, an APN XML and a CarrierConfig XML, which can be used within the AOSP project.

This is the continuation of the project from the original author daradib.

Build

m carriersettings_extractor

Standalone usage

out/host/linux-x86/bin/carriersettings_extractor vendor/google_devices/<codename>/proprietary/product/etc/CarrierSettings/ /root/dir/of/aosp/tree/ /output/path/of/apns-conf.xml /output/path/of/carrierconfig-vendor.xml <codename>

For example, on the Pixel 6 (oriole) whilst in the root of the AOSP tree, you would run the below to produce apns-conf.xml and carrierconfig-vendor.xml in the root of your AOSP tree.

out/host/linux-x86/bin/carriersettings_extractor vendor/google_devices/oriole/proprietary/product/etc/CarrierSettings/ . apns-conf.xml carrierconfig-vendor.xml oriole

Inline usage

Add the below to the device.mk of a new Pixel device

PRODUCT_PACKAGES += \
    extracted-carrierconfig \
    extracted-apns

Add the below to the BoardConfig.mk of a new Pixel device

PRODUCT_SOONG_NAMESPACES += \
	vendor/carriersettings-extractor

Legacy devices which use APV use a custom soong variable

SOONG_CONFIG_NAMESPACES += carriers-apv
SOONG_CONFIG_carriers-apv += apv
SOONG_CONFIG_carriers-apv_apv:= true

Development

Set up your virtual environment for the project:

$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install pip-tools
$ pip-sync

To format the Python code:

$ black carriersettings_extractor.py

To lint the Python code:

$ ruff check carriersettings_extractor.py