Full Code of sebaubuntu-python/aospdtgen for AI

master 17488e9fc1b8 cached
111 files
152.5 KB
42.9k tokens
153 symbols
1 requests
Download .txt
Repository: sebaubuntu-python/aospdtgen
Branch: master
Commit: 17488e9fc1b8
Files: 111
Total size: 152.5 KB

Directory structure:
gitextract_zr8fh6f7/

├── .github/
│   ├── dependabot.yml
│   └── workflows/
│       └── checks.yml
├── .gitignore
├── LICENSES/
│   └── Apache-2.0.txt
├── README.md
├── REUSE.toml
├── aospdtgen/
│   ├── __init__.py
│   ├── __main__.py
│   ├── device_tree.py
│   ├── main.py
│   ├── proprietary_files/
│   │   ├── elf.py
│   │   ├── get_vndk_libs.py
│   │   ├── ignore.py
│   │   ├── proprietary_files_list.py
│   │   ├── section.py
│   │   └── sections/
│   │       ├── acdb.py
│   │       ├── adsp.py
│   │       ├── alarm.py
│   │       ├── ant.py
│   │       ├── atrace.py
│   │       ├── audio.py
│   │       ├── authsecret.py
│   │       ├── automotive.py
│   │       ├── bluetooth.py
│   │       ├── boot.py
│   │       ├── broadcastradio.py
│   │       ├── camera.py
│   │       ├── cas.py
│   │       ├── cdsp.py
│   │       ├── cit.py
│   │       ├── cne.py
│   │       ├── configstore.py
│   │       ├── confirmationui.py
│   │       ├── contexthub.py
│   │       ├── cvp.py
│   │       ├── display.py
│   │       ├── dpm.py
│   │       ├── drm.py
│   │       ├── dsp.py
│   │       ├── dumpstate.py
│   │       ├── face.py
│   │       ├── fastboot.py
│   │       ├── fingerprint.py
│   │       ├── fm.py
│   │       ├── gatekeeper.py
│   │       ├── gnss.py
│   │       ├── health.py
│   │       ├── identity.py
│   │       ├── input.py
│   │       ├── ipa.py
│   │       ├── ir.py
│   │       ├── keymaster.py
│   │       ├── light.py
│   │       ├── local_time.py
│   │       ├── media.py
│   │       ├── miscellaneous.py
│   │       ├── neuralnetworks.py
│   │       ├── nfc.py
│   │       ├── nvram.py
│   │       ├── oemlock.py
│   │       ├── pasr.py
│   │       ├── payment.py
│   │       ├── perf.py
│   │       ├── power.py
│   │       ├── qcc.py
│   │       ├── qesd.py
│   │       ├── qspm.py
│   │       ├── qvr.py
│   │       ├── qxr.py
│   │       ├── radio.py
│   │       ├── rebootescrow.py
│   │       ├── renderscript.py
│   │       ├── secure_element.py
│   │       ├── security.py
│   │       ├── sensors.py
│   │       ├── servicetracker.py
│   │       ├── sla.py
│   │       ├── soter.py
│   │       ├── soundtrigger.py
│   │       ├── storage.py
│   │       ├── tetheroffload.py
│   │       ├── thermal.py
│   │       ├── time.py
│   │       ├── touch.py
│   │       ├── trusted_ui.py
│   │       ├── tv.py
│   │       ├── usb.py
│   │       ├── uwb.py
│   │       ├── vibrator.py
│   │       ├── vr.py
│   │       ├── weaver.py
│   │       ├── wifi.py
│   │       └── wifidisplay.py
│   ├── templates/
│   │   ├── Android.bp.jinja2
│   │   ├── Android.mk.jinja2
│   │   ├── AndroidProducts.mk.jinja2
│   │   ├── BoardConfig.mk.jinja2
│   │   ├── LICENSE.jinja2
│   │   ├── README.md.jinja2
│   │   ├── __init__.py
│   │   ├── device.mk.jinja2
│   │   ├── extract-files.py.jinja2
│   │   ├── lineage_device.mk.jinja2
│   │   ├── rootdir_Android.bp.jinja2
│   │   ├── rootdir_Android.mk.jinja2
│   │   └── setup-makefiles.py.jinja2
│   └── utils/
│       ├── boot_configuration.py
│       ├── format_props.py
│       └── ignored_props.py
├── pyproject.toml
└── ruff.toml

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/dependabot.yml
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
  - package-ecosystem: "pip" # See documentation for possible values
    directory: "/" # Location of package manifests
    schedule:
      interval: "daily"


================================================
FILE: .github/workflows/checks.yml
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

name: checks

on: [push, pull_request, workflow_dispatch]

jobs:
  ruff-check:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: ruff check
        uses: astral-sh/ruff-action@v3

  ruff-format:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: ruff check
        uses: astral-sh/ruff-action@v3
        with:
          args: "format --check --diff"

  pyright:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Install Poetry
        shell: bash
        run: pipx install poetry

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          cache: 'poetry'

      - name: Install dependencies
        shell: bash
        run: poetry install

      - name: Add Poetry to PATH
        shell: bash
        run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH

      - name: pyright
        uses: jakebailey/pyright-action@v2


================================================
FILE: .gitignore
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#   Usually these files are written by a python script from a template
#   before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
# Pipfile.lock

# UV
#   Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
# uv.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
# poetry.toml

# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#   pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
#   https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/

# pixi
#   Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
#   Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
#   in the .venv directory. It is recommended not to include this directory in version control.
.pixi

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# Redis
*.rdb
*.aof
*.pid

# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/

# ActiveMQ
activemq-data/

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
#   JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#   be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#   and can be added to the global gitignore or merged into this file.  For a more nuclear
#   option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/

# Abstra
#   Abstra is an AI-powered process automation framework.
#   Ignore directories containing user credentials, local state, and settings.
#   Learn more at https://abstra.io/docs
.abstra/

# Visual Studio Code
#   Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore 
#   that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
#   and can be added to the global gitignore or merged into this file. However, if you prefer, 
#   you could uncomment the following to ignore the entire vscode folder
.vscode/

# Ruff stuff:
.ruff_cache/

# PyPI configuration file
.pypirc

# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/

# Streamlit
.streamlit/secrets.toml

# aospdtgen rules

# Allow lib directory
!/aospdtgen/lib/

# Ignore output folder
/output


================================================
FILE: LICENSES/Apache-2.0.txt
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.

"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

     (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and

     (b) You must cause any modified files to carry prominent notices stating that You changed the files; and

     (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and

     (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.

     You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!)  The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


================================================
FILE: README.md
================================================
# aospdtgen

[![PyPI version](https://img.shields.io/pypi/v/aospdtgen)](https://pypi.org/project/aospdtgen/)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/0ec14174bf9840458f27062444b1e375)](https://app.codacy.com/gh/sebaubuntu-python/aospdtgen/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)

Create a [LineageOS](https://github.com/LineageOS)-compatible device tree from an Android stock ROM dump (made with [dumpyara](https://github.com/SebaUbuntu/dumpyara)).
This script supports any Android firmware from a Treble-enabled device (Higher than Android 8.0 and with VNDK enabled, you can check it with [Treble Info](https://play.google.com/store/apps/details?id=tk.hack5.treblecheck) or with `adb shell getprop ro.treble.enabled`).
For pre-Treble devices please use [twrpdtgen](https://github.com/twrpdtgen/twrpdtgen).

Requires Python 3.9 or greater

## Installation

```sh
pip install aospdtgen
```

## Instructions

```
$ python -m aospdtgen --help
usage: python -m aospdtgen [-h] [-o OUTPUT] [--no-proprietary-files] dump_path

Android device tree generator

positional arguments:
  dump_path             path to an Android dump made with dumpyara

options:
  -h, --help            show this help message and exit
  -o, --output OUTPUT   custom output folder
  --no-proprietary-files
                        Don't generate the proprietary files list and the
                        extract-files script
```

## License

```
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
```


================================================
FILE: REUSE.toml
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

version = 1
SPDX-PackageName = "aospdtgen"
SPDX-PackageSupplier = "The LineageOS Project"
SPDX-PackageDownloadLocation = "https://github.com/sebaubuntu-python/aospdtgen"

[[annotations]]
path = ["aospdtgen/templates/*.jinja2", "poetry.lock"]
precedence = "aggregate"
SPDX-FileCopyrightText = "The LineageOS Project"
SPDX-License-Identifier = "Apache-2.0"


================================================
FILE: aospdtgen/__init__.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
"""aospdtgen module."""

from pathlib import Path

from aospdtgen.proprietary_files.section import register_sections

__version__ = "1.2.1"

module_path = Path(__file__).parent
sections_path = module_path / "proprietary_files" / "sections"
current_path = Path.cwd()

register_sections(sections_path)


================================================
FILE: aospdtgen/__main__.py
================================================
#!/usr/bin/python3
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.main import main

if __name__ == "__main__":
    main()


================================================
FILE: aospdtgen/device_tree.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from os import chmod
from pathlib import Path
from sebaubuntu_libs.libandroid.device_info import DeviceInfo
from sebaubuntu_libs.libandroid.fstab import Fstab
from sebaubuntu_libs.libandroid.partitions.partitions import Partitions
from sebaubuntu_libs.libandroid.props import BuildProp
from sebaubuntu_libs.liblogging import LOGI
from sebaubuntu_libs.libpath import is_relative_to
from sebaubuntu_libs.libreorder import strcoll_files_key
from shutil import rmtree
from stat import S_IRWXU, S_IRGRP, S_IROTH
from typing import Any, Optional

from aospdtgen.proprietary_files.proprietary_files_list import ProprietaryFilesList
from aospdtgen.templates import render_template
from aospdtgen.utils.boot_configuration import BootConfiguration
from aospdtgen.utils.format_props import dump_partition_build_prop


class DeviceTree:
    """Class representing an Android device tree."""

    def __init__(self, path: Path, no_proprietary_files: bool = False):
        """Given a path to a dumpyara dump path, generate a device tree by parsing it."""
        self.path = path

        LOGI("Figuring out partitions scheme")
        self.partitions = Partitions(self.path)

        self.system = self.partitions.system
        self.vendor = self.partitions.vendor

        LOGI("Parsing build props and device info")
        self.build_prop = BuildProp()
        for partition in self.partitions.get_all_partitions():
            self.build_prop.import_props(partition.build_prop)
        self.device_info = DeviceInfo(self.build_prop)

        LOGI("Parsing fstab")
        fstabs = [
            file
            for file in self.vendor.files
            if (
                is_relative_to(file.relative_to(self.vendor.path), "etc")
                and file.name.startswith("fstab.")
            )
        ]
        assert fstabs, "No fstab found"
        fstab = fstabs[0]
        self.fstab = Fstab(fstab)

        # Let the partitions know their fstab entries if any
        for partition in self.partitions.get_all_partitions():
            partition.fill_fstab_entry(self.fstab)

        LOGI("Extracting boot image")
        self.boot_configuration = BootConfiguration(self.path)

        LOGI("Getting list of rootdir files")
        self.rootdir_bin_files = [
            file
            for file in self.vendor.files
            if is_relative_to(file.relative_to(self.vendor.path), "bin") and file.suffix == ".sh"
        ]
        self.rootdir_bin_files.sort(key=strcoll_files_key)

        self.rootdir_etc_files = [
            file
            for file in self.vendor.files
            if is_relative_to(file.relative_to(self.vendor.path), "etc/init/hw")
        ]
        self.rootdir_etc_files.sort(key=strcoll_files_key)

        recovery_resources_location = (
            self.boot_configuration.recovery_aik_manager.ramdisk_path
            if self.boot_configuration.recovery_aik_manager
            else self.boot_configuration.boot_aik_manager.ramdisk_path
        )
        self.rootdir_recovery_etc_files = [
            file
            for file in recovery_resources_location.iterdir()
            if is_relative_to(file.relative_to(recovery_resources_location), ".")
            and file.suffix == ".rc"
        ]
        self.rootdir_recovery_etc_files.sort(key=strcoll_files_key)

        self.proprietary_files_list: Optional[ProprietaryFilesList] = None
        if not no_proprietary_files:
            LOGI("Generating proprietary files list")
            self.proprietary_files_list = ProprietaryFilesList(
                [value for value in self.partitions.get_all_partitions()]
            )

    def dump_to_folder(self, folder: Path):
        """Dump all makefiles, blueprint and prebuilts to a folder."""
        if folder.is_dir():
            rmtree(folder)
        folder.mkdir(parents=True)

        # Makefiles/blueprints
        self._render_template(folder, "Android.bp", comment_prefix="//")
        self._render_template(folder, "Android.mk")
        self._render_template(folder, "AndroidProducts.mk")
        self._render_template(folder, "BoardConfig.mk")
        self._render_template(folder, "device.mk")
        self._render_template(
            folder, "lineage_device.mk", out_file=f"lineage_{self.device_info.codename}.mk"
        )
        self._render_template(folder, "README.md")

        # Proprietary files list and extract utils
        if self.proprietary_files_list:
            self._render_template(folder, "extract-files.py")
            self._render_template(folder, "setup-makefiles.py")
            chmod(folder / "extract-files.py", S_IRWXU | S_IRGRP | S_IROTH)
            chmod(folder / "setup-makefiles.py", S_IRWXU | S_IRGRP | S_IROTH)

            (folder / "proprietary-files.txt").write_text(
                self.proprietary_files_list.get_formatted_list(self.device_info.build_description),
                encoding="utf-8",
            )

        # Dump build props
        for partition in self.partitions.get_all_partitions():
            dump_partition_build_prop(partition.build_prop, folder / f"{partition.model.name}.prop")

        # Dump boot image prebuilt files
        prebuilts_path = folder / "prebuilts"
        prebuilts_path.mkdir()

        self.boot_configuration.copy_files_to_folder(prebuilts_path)

        # Dump rootdir
        rootdir_path = folder / "rootdir"
        rootdir_path.mkdir()

        self._render_template(rootdir_path, "rootdir_Android.bp", "Android.bp", comment_prefix="//")
        self._render_template(rootdir_path, "rootdir_Android.mk", "Android.mk")

        # rootdir/bin
        rootdir_bin_path = rootdir_path / "bin"
        rootdir_bin_path.mkdir()

        for file in self.rootdir_bin_files:
            (rootdir_bin_path / file.name).write_bytes(file.read_bytes())

        # rootdir/etc
        rootdir_etc_path = rootdir_path / "etc"
        rootdir_etc_path.mkdir()

        for file in self.rootdir_etc_files + self.rootdir_recovery_etc_files:
            (rootdir_etc_path / file.name).write_bytes(file.read_bytes())

        (rootdir_etc_path / self.fstab.fstab.name).write_text(self.fstab.format(), encoding="utf-8")

        # Manifest
        (folder / "manifest.xml").write_text(str(self.vendor.manifest), encoding="utf-8")

    def cleanup(self) -> None:
        """
        Cleanup all the temporary files.

        After you call this, you should throw away this object and never use it anymore.
        """
        self.boot_configuration.cleanup()

    def _render_template(
        self,
        *args: Any,
        comment_prefix: str = "#",
        **kwargs: Any,
    ):
        return render_template(
            *args,
            boot_configuration=self.boot_configuration,
            comment_prefix=comment_prefix,
            device_info=self.device_info,
            fstab=self.fstab,
            proprietary_files_list=self.proprietary_files_list,
            rootdir_bin_files=self.rootdir_bin_files,
            rootdir_etc_files=self.rootdir_etc_files,
            rootdir_recovery_etc_files=self.rootdir_recovery_etc_files,
            partitions=self.partitions,
            **kwargs,
        )


================================================
FILE: aospdtgen/main.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from argparse import ArgumentParser
from pathlib import Path
from sebaubuntu_libs.liblocale import setup_locale
from sebaubuntu_libs.liblogging import setup_logging

from aospdtgen import current_path
from aospdtgen.device_tree import DeviceTree


def main():
    setup_logging()

    parser = ArgumentParser(description="Android device tree generator")
    parser.add_argument("dump_path", type=Path, help="path to an Android dump made with dumpyara")
    parser.add_argument(
        "-o", "--output", type=Path, default=current_path / "output", help="custom output folder"
    )
    parser.add_argument(
        "--no-proprietary-files",
        action="store_true",
        help="Don't generate the proprietary files list and the extract-files script",
    )

    args = parser.parse_args()

    setup_locale()

    dump = DeviceTree(args.dump_path, no_proprietary_files=args.no_proprietary_files)
    dump.dump_to_folder(args.output)
    dump.cleanup()

    print(f"\nDone! You can find the device tree in {str(args.output)}")


================================================
FILE: aospdtgen/proprietary_files/elf.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
from typing import List


def get_shared_libs(files: List[Path]):
    for lib in files:
        if not lib.suffix == ".so":
            continue

        yield lib


================================================
FILE: aospdtgen/proprietary_files/get_vndk_libs.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from base64 import b64decode
from typing import List, Set
from requests import get

from aospdtgen.proprietary_files.ignore import IGNORE_SHARED_LIBS

ARCHS = [
    "arm",
    "arm64",
    "x86",
    "x86_64",
]

FIRST_VNDK_VERSION = 29

# VNDK version, architecture, file name
FROZEN_VNDK_LIST_URL = (
    "https://android.googlesource.com/platform/prebuilts/vndk/v{}/+/main/{}/configs/{}?format=TEXT"
)

# VNDK version
GSI_VNDK_LIST_URL = (
    "https://android.googlesource.com/platform/build/+/main/target/product/gsi/{}.txt?format=TEXT"
)


def get_vndk_file_names(vndk_version: int) -> List[str]:
    return [
        "llndk.libraries.txt",
        f"vndkcore.libraries.{vndk_version}.txt",
        f"vndkprivate.libraries.{vndk_version}.txt",
        "vndkproduct.libraries.txt",
        "vndksp.libraries.txt",
    ]


def main():
    libs: Set[str] = set()

    # Add the currently known shared libraries
    libs.update(IGNORE_SHARED_LIBS)

    current_vndk_version = FIRST_VNDK_VERSION
    while True:
        print(f"Fetching VNDK libraries for version {current_vndk_version}")

        found_something = False

        # Get the GSI VNDK list
        response = get(GSI_VNDK_LIST_URL.format(current_vndk_version))
        if response.ok:
            found_something = True

            # We only need the library name
            for line in b64decode(response.content).decode("ascii").splitlines():
                lib = line.split()[-1]
                libs.add(lib)

        # Now get the VNDK list for each architecture
        for arch in ARCHS:
            for file in get_vndk_file_names(current_vndk_version):
                response = get(FROZEN_VNDK_LIST_URL.format(current_vndk_version, arch, file))
                if response.ok:
                    found_something = True

                    for line in b64decode(response.content).decode("ascii").splitlines():
                        libs.add(line)

        if not found_something:
            if current_vndk_version == FIRST_VNDK_VERSION:
                raise Exception(
                    "Failed to fetch the GSI VNDK list for"
                    f" version {current_vndk_version}, Google dropped it?"
                )

            print(f"Failed to fetch the VNDK list for version {current_vndk_version}, stopping")

            break

        current_vndk_version += 1

    # Print the list of libraries
    print("\n".join(f'"{lib}",' for lib in sorted(libs)))


main()


================================================
FILE: aospdtgen/proprietary_files/ignore.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
import re
from sebaubuntu_libs.libstring import removeprefix

IGNORE_BINARIES = (
    [
        "awk",  # https://cs.android.com/android/platform/superproject/main/+/main:external/one-true-awk/Android.bp
        "logwrapper",  # https://cs.android.com/android/platform/superproject/main/+/main:system/logging/logwrapper/Android.bp
        "newfs_msdos",  # https://cs.android.com/android/platform/superproject/main/+/main:external/newfs_msdos/Android.bp
        "sh",
        "vndservice",  # https://cs.android.com/android/platform/superproject/main/+/main:frameworks/native/cmds/service/Android.bp
        "vndservicemanager",  # https://cs.android.com/android/platform/superproject/main/+/main:frameworks/native/cmds/servicemanager/Android.bp
    ]
    + [
        # toolbox
        "toolbox",
        "toolbox_vendor",
    ]
    + [
        # toolbox symlinks
        # https://cs.android.com/android/platform/superproject/main/+/main:system/core/toolbox/Android.bp
        "getevent",
        "getprop",
        "modprobe",
        "setprop",
        "start",
        "stop",
    ]
    + [
        # toybox
        "toybox",
        "toybox_vendor",
    ]
    + [
        # toybox symlinks
        # https://cs.android.com/android/platform/superproject/main/+/main:external/toybox/Android.bp
        "[",
        "acpi",
        "base64",
        "basename",
        "blockdev",
        "brctl",
        "cal",
        "cat",
        "chattr",
        "chcon",
        "chgrp",
        "chmod",
        "chown",
        "chroot",
        "chrt",
        "cksum",
        "clear",
        "cmp",
        "comm",
        "cp",
        "cpio",
        "cut",
        "date",
        "dd",
        "devmem",
        "df",
        "diff",
        "dirname",
        "dmesg",
        "dos2unix",
        "du",
        "echo",
        "egrep",
        "env",
        "expand",
        "expr",
        "fallocate",
        "false",
        "fgrep",
        "file",
        "find",
        "flock",
        "fmt",
        "free",
        "fsync",
        "getconf",
        "getenforce",
        "gpiodetect",
        "gpiofind",
        "gpioget",
        "gpioinfo",
        "gpioset",
        "grep",
        "groups",
        "gunzip",
        "gzip",
        "head",
        "hostname",
        "hwclock",
        "i2cdetect",
        "i2cdump",
        "i2cget",
        "i2cset",
        "i2ctransfer",
        "iconv",
        "id",
        "ifconfig",
        "inotifyd",
        "insmod",
        "install",
        "ionice",
        "iorenice",
        "kill",
        "killall",
        "ln",
        "load_policy",
        "log",
        "logger",
        "logname",
        "losetup",
        "ls",
        "lsattr",
        "lsmod",
        "lsof",
        "lspci",
        "lsusb",
        "md5sum",
        "memeater",
        "microcom",
        "mkdir",
        "mkfifo",
        "mknod",
        "mkswap",
        "mktemp",
        "modinfo",
        "more",
        "mount",
        "mountpoint",
        "mv",
        "nc",
        "netcat",
        "netstat",
        "nice",
        "nl",
        "nohup",
        "nproc",
        "nsenter",
        "od",
        "paste",
        "patch",
        "pgrep",
        "pidof",
        "pkill",
        "pmap",
        "printenv",
        "printf",
        "ps",
        "pwd",
        "readelf",
        "readlink",
        "realpath",
        "renice",
        "restorecon",
        "rm",
        "rmdir",
        "rmmod",
        "rtcwake",
        "runcon",
        "sed",
        "sendevent",
        "seq",
        "setenforce",
        "setsid",
        "sha1sum",
        "sha224sum",
        "sha256sum",
        "sha384sum",
        "sha512sum",
        "sleep",
        "sort",
        "split",
        "stat",
        "strings",
        "stty",
        "swapoff",
        "swapon",
        "sync",
        "sysctl",
        "tac",
        "tail",
        "tar",
        "taskset",
        "tee",
        "test",
        "time",
        "timeout",
        "top",
        "touch",
        "tr",
        "true",
        "truncate",
        "tty",
        "uclampset",
        "ulimit",
        "umount",
        "uname",
        "uniq",
        "unix2dos",
        "unlink",
        "unshare",
        "uptime",
        "usleep",
        "uudecode",
        "uuencode",
        "uuidgen",
        "vi",
        "vmstat",
        "watch",
        "wc",
        "which",
        "whoami",
        "xargs",
        "xxd",
        "yes",
        "zcat",
    ]
)

"""
Use get_vndk_libs.py to update this list
"""
IGNORE_SHARED_LIBS = [
    "android.frameworks.automotive.display@1.0.so",
    "android.frameworks.cameraservice.common-V1-ndk.so",
    "android.frameworks.cameraservice.common@2.0.so",
    "android.frameworks.cameraservice.device-V1-ndk.so",
    "android.frameworks.cameraservice.device@2.0.so",
    "android.frameworks.cameraservice.service-V1-ndk.so",
    "android.frameworks.cameraservice.service@2.0.so",
    "android.frameworks.cameraservice.service@2.1.so",
    "android.frameworks.displayservice@1.0.so",
    "android.frameworks.schedulerservice@1.0.so",
    "android.frameworks.sensorservice@1.0.so",
    "android.frameworks.stats@1.0.so",
    "android.frameworks.vr.composer@1.0.so",
    "android.hardware.atrace@1.0.so",
    "android.hardware.audio.common-V1-ndk.so",
    "android.hardware.audio.common@2.0.so",
    "android.hardware.audio.common@4.0.so",
    "android.hardware.audio.common@5.0.so",
    "android.hardware.audio.common@6.0.so",
    "android.hardware.audio.effect@2.0.so",
    "android.hardware.audio.effect@4.0.so",
    "android.hardware.audio.effect@5.0.so",
    "android.hardware.audio.effect@6.0.so",
    "android.hardware.audio@2.0.so",
    "android.hardware.audio@4.0.so",
    "android.hardware.audio@5.0.so",
    "android.hardware.audio@6.0.so",
    "android.hardware.authsecret-V1-ndk.so",
    "android.hardware.authsecret-V1-ndk_platform.so",
    "android.hardware.authsecret@1.0.so",
    "android.hardware.automotive.audiocontrol@1.0.so",
    "android.hardware.automotive.audiocontrol@2.0.so",
    "android.hardware.automotive.can@1.0.so",
    "android.hardware.automotive.evs@1.0.so",
    "android.hardware.automotive.evs@1.1.so",
    "android.hardware.automotive.occupant_awareness-V1-ndk.so",
    "android.hardware.automotive.occupant_awareness-V1-ndk_platform.so",
    "android.hardware.automotive.sv@1.0.so",
    "android.hardware.automotive.vehicle@2.0.so",
    "android.hardware.biometrics.face@1.0.so",
    "android.hardware.biometrics.fingerprint@2.1.so",
    "android.hardware.biometrics.fingerprint@2.2.so",
    "android.hardware.bluetooth.a2dp@1.0.so",
    "android.hardware.bluetooth.audio-V2-ndk.so",
    "android.hardware.bluetooth.audio@2.0.so",
    "android.hardware.bluetooth@1.0.so",
    "android.hardware.bluetooth@1.1.so",
    "android.hardware.boot@1.0.so",
    "android.hardware.boot@1.1.so",
    "android.hardware.broadcastradio@1.0.so",
    "android.hardware.broadcastradio@1.1.so",
    "android.hardware.broadcastradio@2.0.so",
    "android.hardware.camera.common-V1-ndk.so",
    "android.hardware.camera.common@1.0.so",
    "android.hardware.camera.device-V1-ndk.so",
    "android.hardware.camera.device@1.0.so",
    "android.hardware.camera.device@3.2.so",
    "android.hardware.camera.device@3.3.so",
    "android.hardware.camera.device@3.4.so",
    "android.hardware.camera.device@3.5.so",
    "android.hardware.camera.device@3.6.so",
    "android.hardware.camera.metadata-V1-ndk.so",
    "android.hardware.camera.metadata@3.2.so",
    "android.hardware.camera.metadata@3.3.so",
    "android.hardware.camera.metadata@3.4.so",
    "android.hardware.camera.metadata@3.5.so",
    "android.hardware.camera.provider-V1-ndk.so",
    "android.hardware.camera.provider@2.4.so",
    "android.hardware.camera.provider@2.5.so",
    "android.hardware.camera.provider@2.6.so",
    "android.hardware.cas.native@1.0.so",
    "android.hardware.cas@1.0.so",
    "android.hardware.cas@1.1.so",
    "android.hardware.cas@1.2.so",
    "android.hardware.common-V1-ndk_platform.so",
    "android.hardware.common-V2-ndk.so",
    "android.hardware.common-V2-ndk_platform.so",
    "android.hardware.common.fmq-V1-ndk.so",
    "android.hardware.common.fmq-V1-ndk_platform.so",
    "android.hardware.configstore-utils.so",
    "android.hardware.configstore@1.0.so",
    "android.hardware.configstore@1.1.so",
    "android.hardware.confirmationui-support-lib.so",
    "android.hardware.confirmationui@1.0.so",
    "android.hardware.contexthub@1.0.so",
    "android.hardware.contexthub@1.1.so",
    "android.hardware.drm-V1-ndk.so",
    "android.hardware.drm@1.0.so",
    "android.hardware.drm@1.1.so",
    "android.hardware.drm@1.2.so",
    "android.hardware.drm@1.3.so",
    "android.hardware.dumpstate-V1-ndk.so",
    "android.hardware.dumpstate@1.0.so",
    "android.hardware.dumpstate@1.1.so",
    "android.hardware.fastboot@1.0.so",
    "android.hardware.gatekeeper@1.0.so",
    "android.hardware.gnss-V1-ndk_platform.so",
    "android.hardware.gnss-V2-ndk.so",
    "android.hardware.gnss.measurement_corrections@1.0.so",
    "android.hardware.gnss.measurement_corrections@1.1.so",
    "android.hardware.gnss.visibility_control@1.0.so",
    "android.hardware.gnss@1.0.so",
    "android.hardware.gnss@1.1.so",
    "android.hardware.gnss@2.0.so",
    "android.hardware.gnss@2.1.so",
    "android.hardware.graphics.allocator-V1-ndk.so",
    "android.hardware.graphics.allocator-V2-ndk.so",
    "android.hardware.graphics.allocator@2.0.so",
    "android.hardware.graphics.allocator@3.0.so",
    "android.hardware.graphics.allocator@4.0.so",
    "android.hardware.graphics.bufferqueue@1.0.so",
    "android.hardware.graphics.bufferqueue@2.0.so",
    "android.hardware.graphics.common-V1-ndk_platform.so",
    "android.hardware.graphics.common-V2-ndk_platform.so",
    "android.hardware.graphics.common-V3-ndk.so",
    "android.hardware.graphics.common-V4-ndk.so",
    "android.hardware.graphics.common@1.0.so",
    "android.hardware.graphics.common@1.1.so",
    "android.hardware.graphics.common@1.2.so",
    "android.hardware.graphics.composer3-V1-ndk.so",
    "android.hardware.graphics.composer@2.1.so",
    "android.hardware.graphics.composer@2.2.so",
    "android.hardware.graphics.composer@2.3.so",
    "android.hardware.graphics.composer@2.4.so",
    "android.hardware.graphics.mapper@2.0.so",
    "android.hardware.graphics.mapper@2.1.so",
    "android.hardware.graphics.mapper@3.0.so",
    "android.hardware.graphics.mapper@4.0.so",
    "android.hardware.health-V1-ndk.so",
    "android.hardware.health.storage-V1-ndk.so",
    "android.hardware.health.storage-V1-ndk_platform.so",
    "android.hardware.health.storage@1.0.so",
    "android.hardware.health@1.0.so",
    "android.hardware.health@2.0.so",
    "android.hardware.health@2.1.so",
    "android.hardware.identity-V2-ndk_platform.so",
    "android.hardware.identity-V3-ndk_platform.so",
    "android.hardware.identity-V4-ndk.so",
    "android.hardware.input.classifier@1.0.so",
    "android.hardware.input.common@1.0.so",
    "android.hardware.ir-V1-ndk.so",
    "android.hardware.ir@1.0.so",
    "android.hardware.keymaster-V2-ndk_platform.so",
    "android.hardware.keymaster-V3-ndk.so",
    "android.hardware.keymaster-V3-ndk_platform.so",
    "android.hardware.keymaster@3.0.so",
    "android.hardware.keymaster@4.0.so",
    "android.hardware.keymaster@4.1.so",
    "android.hardware.light-V1-ndk_platform.so",
    "android.hardware.light-V2-ndk.so",
    "android.hardware.light@2.0.so",
    "android.hardware.media.bufferpool@1.0.so",
    "android.hardware.media.bufferpool@2.0.so",
    "android.hardware.media.c2@1.0.so",
    "android.hardware.media.c2@1.1.so",
    "android.hardware.media.omx@1.0.so",
    "android.hardware.media@1.0.so",
    "android.hardware.memtrack-V1-ndk.so",
    "android.hardware.memtrack-V1-ndk_platform.so",
    "android.hardware.memtrack@1.0.so",
    "android.hardware.neuralnetworks@1.0.so",
    "android.hardware.neuralnetworks@1.1.so",
    "android.hardware.neuralnetworks@1.2.so",
    "android.hardware.neuralnetworks@1.3.so",
    "android.hardware.nfc-V1-ndk.so",
    "android.hardware.nfc@1.0.so",
    "android.hardware.nfc@1.1.so",
    "android.hardware.nfc@1.2.so",
    "android.hardware.oemlock-V1-ndk.so",
    "android.hardware.oemlock-V1-ndk_platform.so",
    "android.hardware.oemlock@1.0.so",
    "android.hardware.power-V1-ndk_platform.so",
    "android.hardware.power-V2-ndk_platform.so",
    "android.hardware.power-V3-ndk.so",
    "android.hardware.power.stats-V1-ndk.so",
    "android.hardware.power.stats-V1-ndk_platform.so",
    "android.hardware.power.stats@1.0.so",
    "android.hardware.power@1.0.so",
    "android.hardware.power@1.1.so",
    "android.hardware.power@1.2.so",
    "android.hardware.power@1.3.so",
    "android.hardware.radio-V1-ndk.so",
    "android.hardware.radio.config-V1-ndk.so",
    "android.hardware.radio.config@1.0.so",
    "android.hardware.radio.config@1.1.so",
    "android.hardware.radio.config@1.2.so",
    "android.hardware.radio.data-V1-ndk.so",
    "android.hardware.radio.deprecated@1.0.so",
    "android.hardware.radio.messaging-V1-ndk.so",
    "android.hardware.radio.modem-V1-ndk.so",
    "android.hardware.radio.network-V1-ndk.so",
    "android.hardware.radio.sim-V1-ndk.so",
    "android.hardware.radio.voice-V1-ndk.so",
    "android.hardware.radio@1.0.so",
    "android.hardware.radio@1.1.so",
    "android.hardware.radio@1.2.so",
    "android.hardware.radio@1.3.so",
    "android.hardware.radio@1.4.so",
    "android.hardware.radio@1.5.so",
    "android.hardware.rebootescrow-V1-ndk.so",
    "android.hardware.rebootescrow-V1-ndk_platform.so",
    "android.hardware.renderscript@1.0.so",
    "android.hardware.secure_element@1.0.so",
    "android.hardware.secure_element@1.1.so",
    "android.hardware.secure_element@1.2.so",
    "android.hardware.security.dice-V1-ndk.so",
    "android.hardware.security.keymint-V1-ndk_platform.so",
    "android.hardware.security.keymint-V2-ndk.so",
    "android.hardware.security.secureclock-V1-ndk.so",
    "android.hardware.security.secureclock-V1-ndk_platform.so",
    "android.hardware.security.sharedsecret-V1-ndk.so",
    "android.hardware.security.sharedsecret-V1-ndk_platform.so",
    "android.hardware.sensors-V1-ndk.so",
    "android.hardware.sensors@1.0.so",
    "android.hardware.sensors@2.0.so",
    "android.hardware.sensors@2.1.so",
    "android.hardware.soundtrigger3-V1-ndk.so",
    "android.hardware.soundtrigger@2.0-core.so",
    "android.hardware.soundtrigger@2.0.so",
    "android.hardware.soundtrigger@2.1.so",
    "android.hardware.soundtrigger@2.2.so",
    "android.hardware.soundtrigger@2.3.so",
    "android.hardware.tetheroffload.config@1.0.so",
    "android.hardware.tetheroffload.control@1.0.so",
    "android.hardware.thermal@1.0.so",
    "android.hardware.thermal@1.1.so",
    "android.hardware.thermal@2.0.so",
    "android.hardware.tv.cec@1.0.so",
    "android.hardware.tv.cec@2.0.so",
    "android.hardware.tv.input@1.0.so",
    "android.hardware.tv.tuner@1.0.so",
    "android.hardware.usb-V1-ndk.so",
    "android.hardware.usb.gadget@1.0.so",
    "android.hardware.usb.gadget@1.1.so",
    "android.hardware.usb@1.0.so",
    "android.hardware.usb@1.1.so",
    "android.hardware.usb@1.2.so",
    "android.hardware.uwb-V1-ndk.so",
    "android.hardware.vibrator-V1-ndk_platform.so",
    "android.hardware.vibrator-V2-ndk.so",
    "android.hardware.vibrator-V2-ndk_platform.so",
    "android.hardware.vibrator@1.0.so",
    "android.hardware.vibrator@1.1.so",
    "android.hardware.vibrator@1.2.so",
    "android.hardware.vibrator@1.3.so",
    "android.hardware.vr@1.0.so",
    "android.hardware.weaver-V1-ndk.so",
    "android.hardware.weaver-V1-ndk_platform.so",
    "android.hardware.weaver@1.0.so",
    "android.hardware.wifi.hostapd-V1-ndk.so",
    "android.hardware.wifi.hostapd@1.0.so",
    "android.hardware.wifi.hostapd@1.1.so",
    "android.hardware.wifi.hostapd@1.2.so",
    "android.hardware.wifi.offload@1.0.so",
    "android.hardware.wifi.supplicant-V1-ndk.so",
    "android.hardware.wifi.supplicant@1.0.so",
    "android.hardware.wifi.supplicant@1.1.so",
    "android.hardware.wifi.supplicant@1.2.so",
    "android.hardware.wifi.supplicant@1.3.so",
    "android.hardware.wifi@1.0.so",
    "android.hardware.wifi@1.1.so",
    "android.hardware.wifi@1.2.so",
    "android.hardware.wifi@1.3.so",
    "android.hardware.wifi@1.4.so",
    "android.hidl.allocator@1.0.so",
    "android.hidl.memory.block@1.0.so",
    "android.hidl.memory.token@1.0.so",
    "android.hidl.memory@1.0-impl.so",
    "android.hidl.memory@1.0.so",
    "android.hidl.safe_union@1.0.so",
    "android.hidl.token@1.0-utils.so",
    "android.hidl.token@1.0.so",
    "android.media.audio.common.types-V1-ndk.so",
    "android.media.soundtrigger.types-V1-ndk.so",
    "android.system.keystore2-V1-ndk_platform.so",
    "android.system.keystore2-V2-ndk.so",
    "android.system.net.netd@1.0.so",
    "android.system.net.netd@1.1.so",
    "android.system.suspend-V1-ndk.so",
    "android.system.suspend@1.0.so",
    "android.system.wifi.keystore@1.0.so",
    "audio.a2dp.default.so",
    "hidl.tests.vendor@1.0.so",
    "hidl.tests.vendor@1.1.so",
    "ld-android.so",
    "libEGL.so",
    "libETC1.so",
    "libFFTEm.so",
    "libGLESv1_CM.so",
    "libGLESv2.so",
    "libGLESv3.so",
    "libLLVM_android.so",
    "libOpenMAXAL.so",
    "libOpenSLES.so",
    "libRS.so",
    "libRSCacheDir.so",
    "libRSCpuRef.so",
    "libRSDriver.so",
    "libRS_internal.so",
    "libRScpp.so",
    "libaacextractor.so",
    "libaaudio.so",
    "libaaudioservice.so",
    "libadbconnection.so",
    "libadbconnectiond.so",
    "libadf.so",
    "libamrextractor.so",
    "libandroid.so",
    "libandroid_net.so",
    "libandroid_runtime.so",
    "libandroid_servers.so",
    "libandroidfw.so",
    "libappfuse.so",
    "libart-compiler.so",
    "libart-dexlayout.so",
    "libart-disassembler.so",
    "libart.so",
    "libartd-compiler.so",
    "libartd-dexlayout.so",
    "libartd.so",
    "libasyncio.so",
    "libaudioclient.so",
    "libaudioeffect_jni.so",
    "libaudioflinger.so",
    "libaudiohal.so",
    "libaudiohal@2.0.so",
    "libaudiohal_deathhandler.so",
    "libaudiomanager.so",
    "libaudiopolicyenginedefault.so",
    "libaudiopolicymanager.so",
    "libaudiopolicymanagerdefault.so",
    "libaudiopolicyservice.so",
    "libaudiopreprocessing.so",
    "libaudioprocessing.so",
    "libaudioroute.so",
    "libaudiospdif.so",
    "libaudioutils.so",
    "libavservices_minijail.so",
    "libavservices_minijail_vendor.so",
    "libbacktrace.so",
    "libbase.so",
    "libbcc.so",
    "libbcinfo.so",
    "libbinder.so",
    "libbinder_ndk.so",
    "libbinderthreadstate.so",
    "libbinderwrapper.so",
    "libblas.so",
    "libbluetooth-binder.so",
    "libbluetooth.so",
    "libbluetooth_jni.so",
    "libbootanimation.so",
    "libbrillo-binder.so",
    "libbrillo-stream.so",
    "libbrillo.so",
    "libbrotli.so",
    "libbufferhub.so",
    "libbufferhubqueue.so",
    "libbufferqueueconverter.so",
    "libbundlewrapper.so",
    "libbz.so",
    "libc++.so",
    "libc++_shared.so",
    "libc.so",
    "libc_malloc_debug.so",
    "libcamera2ndk.so",
    "libcamera_client.so",
    "libcamera_metadata.so",
    "libcameraservice.so",
    "libcap.so",
    "libcgrouprc.so",
    "libchrome.so",
    "libclang_rt.asan-aarch64-android.so",
    "libclang_rt.asan-arm-android.so",
    "libclang_rt.asan-i686-android.so",
    "libclang_rt.asan-mips-android.so",
    "libclang_rt.asan-mips64-android.so",
    "libclang_rt.asan-x86_64-android.so",
    "libclang_rt.hwasan-aarch64-android.so",
    "libclang_rt.scudo-aarch64-android.so",
    "libclang_rt.scudo-arm-android.so",
    "libclang_rt.scudo-i686-android.so",
    "libclang_rt.scudo-x86_64-android.so",
    "libclang_rt.scudo_minimal-aarch64-android.so",
    "libclang_rt.scudo_minimal-arm-android.so",
    "libclang_rt.scudo_minimal-i686-android.so",
    "libclang_rt.scudo_minimal-x86_64-android.so",
    "libclang_rt.ubsan_minimal-aarch64-android.so",
    "libclang_rt.ubsan_minimal-arm-android.so",
    "libclang_rt.ubsan_minimal-i686-android.so",
    "libclang_rt.ubsan_minimal-x86_64-android.so",
    "libclang_rt.ubsan_standalone-aarch64-android.so",
    "libclang_rt.ubsan_standalone-arm-android.so",
    "libclang_rt.ubsan_standalone-i686-android.so",
    "libclang_rt.ubsan_standalone-x86_64-android.so",
    "libcld80211.so",
    "libcn-cbor.so",
    "libcodec2.so",
    "libcodec2_hidl@1.0.so",
    "libcodec2_vndk.so",
    "libcom.android.tethering.connectivity_native.so",
    "libcompiler_rt.so",
    "libcrypto.so",
    "libcrypto_utils.so",
    "libcups.so",
    "libcurl.so",
    "libcutils.so",
    "libdebuggerd_client.so",
    "libdefcontainer_jni.so",
    "libdexfile.so",
    "libdiskconfig.so",
    "libdisplayservicehidl.so",
    "libdl.so",
    "libdl_android.so",
    "libdmabufheap.so",
    "libdng_sdk.so",
    "libdownmix.so",
    "libdrm.so",
    "libdrmframework.so",
    "libdrmframework_jni.so",
    "libdt_fd_forward.so",
    "libdt_socket.so",
    "libdumpstateaidl.so",
    "libdumpstateutil.so",
    "libeffectproxy.so",
    "libeffects.so",
    "libeffectsconfig.so",
    "libevent.so",
    "libexif.so",
    "libexpat.so",
    "libext2_blkid.so",
    "libext2_com_err.so",
    "libext2_e2p.so",
    "libext2_misc.so",
    "libext2_quota.so",
    "libext2_uuid.so",
    "libext2fs.so",
    "libext4_utils.so",
    "libf2fs_sparseblock.so",
    "libfilterfw.so",
    "libfilterpack_imageproc.so",
    "libflacextractor.so",
    "libfmq.so",
    "libframesequence.so",
    "libft2.so",
    "libfwdlockengine.so",
    "libgatekeeper.so",
    "libgiftranscode.so",
    "libgralloctypes.so",
    "libgraphicsenv.so",
    "libgtest_prod.so",
    "libgui.so",
    "libgui_vendor.so",
    "libhardware.so",
    "libhardware_legacy.so",
    "libharfbuzz_ng.so",
    "libheif.so",
    "libhidcommand_jni.so",
    "libhidl-gen-hash.so",
    "libhidl-gen-utils.so",
    "libhidlallocatorutils.so",
    "libhidlbase.so",
    "libhidlcache.so",
    "libhidlmemory.so",
    "libhidltransport.so",
    "libhwbinder.so",
    "libhwbinder_noltopgo.so",
    "libhwc2on1adapter.so",
    "libhwui.so",
    "libicui18n.so",
    "libicuuc.so",
    "libimg_utils.so",
    "libincident.so",
    "libinput.so",
    "libinputflinger.so",
    "libinputservice.so",
    "libion.so",
    "libiprouteutil.so",
    "libjavacore.so",
    "libjavacrypto.so",
    "libjdwp.so",
    "libjni_pacprocessor.so",
    "libjnigraphics.so",
    "libjpeg.so",
    "libjsoncpp.so",
    "libkeymaster4support.so",
    "libkeymaster_messages.so",
    "libkeymaster_portable.so",
    "libkeystore-engine.so",
    "libkeystore_aidl.so",
    "libkeystore_binder.so",
    "libkeystore_parcelables.so",
    "libkeyutils.so",
    "liblayers_proto.so",
    "libldacBT_abr.so",
    "libldacBT_enc.so",
    "libldnhncr.so",
    "liblog.so",
    "liblogwrap.so",
    "liblshal.so",
    "liblz4.so",
    "liblzma.so",
    "libm.so",
    "libmdnssd.so",
    "libmedia.so",
    "libmedia_helper.so",
    "libmedia_jni.so",
    "libmedia_omx.so",
    "libmediadrm.so",
    "libmediaextractorservice.so",
    "libmedialogservice.so",
    "libmediametrics.so",
    "libmediandk.so",
    "libmediaplayerservice.so",
    "libmediautils.so",
    "libmemtrack.so",
    "libmemunreachable.so",
    "libmetricslogger.so",
    "libmidiextractor.so",
    "libminijail.so",
    "libminikin.so",
    "libmkbootimg_abi_check.so",
    "libmkvextractor.so",
    "libmp3extractor.so",
    "libmp4extractor.so",
    "libmpeg2extractor.so",
    "libmtp.so",
    "libnativehelper.so",
    "libnativewindow.so",
    "libnbaio.so",
    "libnbaio_mono.so",
    "libnblog.so",
    "libnetd_client.so",
    "libnetdutils.so",
    "libnetlink.so",
    "libnetutils.so",
    "libneuralnetworks.so",
    "libnfc-nci.so",
    "libnfc_nci_jni.so",
    "libnl.so",
    "libnpt.so",
    "liboggextractor.so",
    "libopenjdk.so",
    "libopenjdkd.so",
    "libopenjdkjvm.so",
    "libopenjdkjvmd.so",
    "libopenjdkjvmti.so",
    "libopenjdkjvmtid.so",
    "libopus.so",
    "libpackagelistparser.so",
    "libpagemap.so",
    "libpcap.so",
    "libpcre2.so",
    "libpcrecpp.so",
    "libpdfium.so",
    "libpdx_default_transport.so",
    "libpiex.so",
    "libpixelflinger.so",
    "libpng.so",
    "libpower.so",
    "libpowermanager.so",
    "libprintspooler_jni.so",
    "libprocessgroup.so",
    "libprocinfo.so",
    "libprotobuf-cpp-full.so",
    "libprotobuf-cpp-lite.so",
    "libprotoutil.so",
    "libpuresoftkeymasterdevice.so",
    "libqtaguid.so",
    "libradio_metadata.so",
    "libreference-ril.so",
    "libresourcemanagerservice.so",
    "libreverbwrapper.so",
    "libril.so",
    "librilutils.so",
    "librs_jni.so",
    "librtp_jni.so",
    "libschedulerservicehidl.so",
    "libselinux.so",
    "libsensor.so",
    "libsensorservice.so",
    "libsensorservicehidl.so",
    "libsepol.so",
    "libservices.so",
    "libsigchain.so",
    "libsoftkeymasterdevice.so",
    "libsonic.so",
    "libsonivox.so",
    "libsoundpool.so",
    "libsoundtrigger.so",
    "libsoundtriggerservice.so",
    "libsparse.so",
    "libspeexresampler.so",
    "libsqlite.so",
    "libssl.so",
    "libstagefright.so",
    "libstagefright_amrnb_common.so",
    "libstagefright_bufferpool@2.0.so",
    "libstagefright_bufferqueue_helper.so",
    "libstagefright_enc_common.so",
    "libstagefright_flacdec.so",
    "libstagefright_foundation.so",
    "libstagefright_http_support.so",
    "libstagefright_httplive.so",
    "libstagefright_omx.so",
    "libstagefright_omx_utils.so",
    "libstagefright_soft_aacdec.so",
    "libstagefright_soft_aacenc.so",
    "libstagefright_soft_amrdec.so",
    "libstagefright_soft_amrnbenc.so",
    "libstagefright_soft_amrwbenc.so",
    "libstagefright_soft_avcdec.so",
    "libstagefright_soft_avcenc.so",
    "libstagefright_soft_flacdec.so",
    "libstagefright_soft_flacenc.so",
    "libstagefright_soft_g711dec.so",
    "libstagefright_soft_gsmdec.so",
    "libstagefright_soft_hevcdec.so",
    "libstagefright_soft_mp3dec.so",
    "libstagefright_soft_mpeg2dec.so",
    "libstagefright_soft_mpeg4dec.so",
    "libstagefright_soft_mpeg4enc.so",
    "libstagefright_soft_opusdec.so",
    "libstagefright_soft_rawdec.so",
    "libstagefright_soft_vorbisdec.so",
    "libstagefright_soft_vpxdec.so",
    "libstagefright_soft_vpxenc.so",
    "libstagefright_softomx.so",
    "libstagefright_xmlparser.so",
    "libstatslog.so",
    "libstdc++.so",
    "libsurfaceflinger.so",
    "libsuspend.so",
    "libsync.so",
    "libsysutils.so",
    "libtextclassifier.so",
    "libtextclassifier_hash.so",
    "libtinyalsa.so",
    "libtinycompress.so",
    "libtinyxml2.so",
    "libtombstoned_client.so",
    "libui.so",
    "libunwind.so",
    "libunwindstack.so",
    "libusbhost.so",
    "libutils.so",
    "libutilscallstack.so",
    "libvintf.so",
    "libvisualizer.so",
    "libvixl-arm.so",
    "libvixl-arm64.so",
    "libvndksupport.so",
    "libvorbisidec.so",
    "libvulkan.so",
    "libwavextractor.so",
    "libwebrtc_audio_preprocessing.so",
    "libwebviewchromium_loader.so",
    "libwebviewchromium_plat_support.so",
    "libwfds.so",
    "libwifi-service.so",
    "libwifi-system-iface.so",
    "libwifi-system.so",
    "libwifikeystorehal.so",
    "libwilhelm.so",
    "libxml2.so",
    "libyuv.so",
    "libz.so",
    "libziparchive.so",
]

IGNORE_FILENAMES = [
    # Property files
    "build.prop",
    "default.prop",
    # config.fs
    "fs_config_dirs",
    "fs_config_files",
    "group",
    # Licenses
    "NOTICE.xml.gz",
    "NOTICE_GPL.html.gz",
    "NOTICE_GPL.xml.gz",
    "passwd",
    # Recovery patch
    "recovery-from-boot.p",
    # Partition symlinks
    "odm",
    "product",
    "system",
    "system_ext",
    "vendor",
]

IGNORE_EXTENSIONS = [
    # Apps's odex/vdex
    "odex",
    "vdex",
]

IGNORE_FOLDERS = [
    # Hostapd config
    "etc/hostapd",
    # Device init scripts
    "etc/init/hw",
    # Permissions
    "etc/permissions",
    # SELinux
    "etc/selinux",
    # Kernel modules
    "lib/modules",
    # ADSP tests
    "lib/rfsa/adsp/tests",
    # RRO overlays
    "overlay",
    # RFS symlinks
    "rfs",
]

IGNORE_PATHS = [
    # VINTF
    "etc/vintf/compatibility_matrix.xml",
    "etc/vintf/manifest.xml",
]

IGNORE_PATTERNS = [
    re.compile(pattern)
    for pattern in [
        # Shell scripts
        "bin/.*\\.sh",
        # TODO: Find a cleaner way to exclude AOSP interfaces libs,
        # We're currently excluding all AOSP interfaces libs except impl
        "^(?!lib(64)?/(hw/)?android\\..*\\..*-impl.so)lib(64)?/(hw/)?android\\..*\\..*.so",
        # Versioned libprotobuf library
        "lib(64)?/libprotobuf-cpp-(full|lite)-.*.so",
    ]
]


def is_blob_allowed(file: Path) -> bool:
    """
    Check if the lib is not in the disallowed list.
    """
    if file.name in IGNORE_BINARIES:
        return False

    if file.name in IGNORE_SHARED_LIBS:
        return False

    if file.name in IGNORE_FILENAMES:
        return False

    if removeprefix(file.suffix, ".") in IGNORE_EXTENSIONS:
        return False

    for folder in [str(folder) for folder in file.parents]:
        if folder in IGNORE_FOLDERS:
            return False

    if str(file) in IGNORE_PATHS:
        return False

    for pattern in IGNORE_PATTERNS:
        if pattern.match(str(file)):
            return False

    return True


================================================
FILE: aospdtgen/proprietary_files/proprietary_files_list.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
from sebaubuntu_libs.libandroid.partitions.partition import AndroidPartition
from sebaubuntu_libs.libreorder import strcoll_files_key
from typing import Dict, List, Optional

from aospdtgen.proprietary_files.ignore import is_blob_allowed
from aospdtgen.proprietary_files.section import Section, sections


class ProprietaryFilesList:
    """Class representing a proprietary files list."""

    def __init__(self, partitions: List[AndroidPartition]):
        """Initialize a new ProprietaryFilesList object."""
        self.partitions = partitions

        self.section_to_files: Dict[Section, List[Path]] = {section: [] for section in sections}

        for partition in self.partitions:
            files: List[Path] = []

            for file in partition.files:
                file_relative = file.relative_to(partition.path)
                # Filter out ignored files
                if is_blob_allowed(file_relative):
                    files.append(file)

            for section in sections:
                matched, not_matched = section.add_files(files, partition)

                self.section_to_files[section].extend(
                    partition.model.proprietary_files_prefix / file.relative_to(partition.path)
                    for file in matched
                )

                files = not_matched

    def __str__(self) -> str:
        return self.get_formatted_list()

    def get_formatted_list(self, build_description: Optional[str] = None) -> str:
        result = ""
        if build_description:
            result += f"# Unpinned blobs from {build_description}\n"

        for section, files in self.section_to_files.items():
            if not files:
                continue

            result += f"\n# {section.name}\n"
            result += "\n".join(str(file) for file in self._sort_files(files))
            result += "\n"

        return result

    @staticmethod
    def _sort_files(files: List[Path]) -> List[Path]:
        return sorted(files, key=strcoll_files_key)


================================================
FILE: aospdtgen/proprietary_files/section.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from importlib import import_module
from pathlib import Path
from pkgutil import iter_modules
from re import match
from sebaubuntu_libs.libandroid.elf.elf import ELF
from sebaubuntu_libs.libandroid.partitions.partition import AndroidPartition
from sebaubuntu_libs.libexception import format_exception
from sebaubuntu_libs.liblogging import LOGE
from sebaubuntu_libs.libpath import is_relative_to
from sebaubuntu_libs.libstring import removesuffix
from typing import Dict, List, Tuple, Type

from aospdtgen.proprietary_files.elf import get_shared_libs


class Section:
    """Class representing a proprietary files list section."""

    name: str
    """Name of the section"""
    interfaces: List[str] = []
    """List of interfaces"""
    hardware_modules: List[str] = []
    """List of hardware modules IDs"""
    apexes: List[str] = []
    """List of APEXes"""
    apps: List[str] = []
    """List of app names"""
    binaries: List[str] = []
    """List of binaries/services"""
    libraries: List[str] = []
    """List of libraries (omit the .so)"""
    filenames: List[str] = []
    """List of exact file names"""
    folders: List[str] = []
    """List of folders"""
    patterns: List[str] = []
    """List of basic patterns (use regex)"""
    properties_prefixes: Dict[str, bool] = {}
    """List of properties prefix to whether it's an exact match"""

    @classmethod
    def add_files(
        cls,
        files: List[Path],
        partition: AndroidPartition,
    ) -> Tuple[List[Path], List[Path]]:
        """
        Return the list of files matching the section and the list of files not matching the section
        (after handling shared libs for the matched files).
        """
        matched: List[Path] = []
        not_matched: List[Path] = []

        for file in files:
            file_relative = file.relative_to(partition.path)
            (matched if cls.file_match(file_relative) else not_matched).append(file)

        # Handle shared libs
        for file in matched:
            file_relative = file.relative_to(partition.path)
            # Check only ELFs
            if (
                not is_relative_to(file_relative, "bin")
                and not is_relative_to(file_relative, "lib")
                and not is_relative_to(file_relative, "lib64")
            ):
                continue

            # Add shared libs used by the section ELFs
            needed_libs = ELF.get_needed_libs(file)
            for lib in needed_libs:
                # Skip the lib if it belongs to another section
                skip = False

                for interface in known_interfaces:
                    if match(f"{interface}(@[0-9]+\\.[0-9]+|-).*\\.so", lib):
                        skip = True
                        break

                if removesuffix(lib, ".so") in known_libraries:
                    skip = True

                if skip:
                    continue

                # Recursively handle shared libs' shared libs as well
                unmatched_shared_libs = get_shared_libs(not_matched)
                for file in unmatched_shared_libs:
                    if file.name != lib:
                        continue

                    # Move from unmatched to matched
                    not_matched.remove(file)
                    matched.append(file)

        return (matched, not_matched)

    @classmethod
    def file_match(cls, file: Path):
        # Interfaces
        for interface in cls.interfaces:
            # Service binary (we try)
            if is_relative_to(file, "bin") and interface in file.name:
                return True

            # Service init script (we try)
            if is_relative_to(file, "etc/init") and interface in file.name:
                return True

            # VINTF fragment (again, we try)
            if is_relative_to(file, "etc/vintf/manifest") and interface in file.name:
                return True

            # Passthrough impl (only HIDL)
            if (is_relative_to(file, "lib/hw") or is_relative_to(file, "lib64/hw")) and match(
                f"{interface}@[0-9]+\\.[0-9]+-impl\\.so", file.name
            ):
                return True

            # Interface libs (AIDL and HIDL)
            if (is_relative_to(file, "lib") or is_relative_to(file, "lib64")) and match(
                f"{interface}(@[0-9]+\\.[0-9]+|-).*\\.so", file.name
            ):
                return True

        # Hardware modules
        if is_relative_to(file, "lib/hw") or is_relative_to(file, "lib64/hw"):
            for hardware_module in cls.hardware_modules:
                if file.name.startswith(f"{hardware_module}.") and file.suffix == ".so":
                    return True

        # APEXes
        if is_relative_to(file, "apex") and file.suffix == ".apex" and file.stem in cls.apexes:
            return True

        # Apps
        if is_relative_to(file, "app") or is_relative_to(file, "priv-app"):
            if file.suffix == ".apk" and file.stem in cls.apps:
                return True

        # Binaries
        if is_relative_to(file, "bin") and file.name in cls.binaries:
            return True

        # Init scripts
        if is_relative_to(file, "etc/init"):
            for binary in cls.binaries:
                if match(f"(init)?(.)?{binary}\\.rc", file.name):
                    return True

        # Libraries
        if is_relative_to(file, "lib/") or is_relative_to(file, "lib64/"):
            if file.suffix == ".so" and file.stem in cls.libraries:
                return True

        # Filenames
        if file.name in cls.filenames:
            return True

        # Folders
        for folder in [str(folder) for folder in file.parents]:
            if folder in cls.folders:
                return True

        # Patterns
        if [pattern for pattern in cls.patterns if match(pattern, str(file))]:
            return True

        return False

    @classmethod
    def property_match(cls, prop: str):
        """Check if the property matches the prefixes."""
        for prefix, exact_match in cls.properties_prefixes.items():
            if prop == prefix if exact_match else prop.startswith(prefix):
                return True

        return False


sections: List[Section] = []
known_interfaces: List[str] = []
known_libraries: List[str] = []


def register_section(section: Type[Section]):
    sections.append(section())

    for interface in section.interfaces:
        assert interface not in known_interfaces, f"Duplicate interface: {interface}"
        known_interfaces.append(interface)

    for library in section.libraries:
        assert library not in known_libraries, f"Duplicate shared library: {library}"
        known_libraries.append(library)


def register_sections(sections_path: Path):
    """Import all the sections and let them execute register_section()."""
    for section_name in [name for _, name, _ in iter_modules([str(sections_path)])]:
        try:
            import_module(f"aospdtgen.proprietary_files.sections.{section_name}")
        except Exception as e:
            LOGE(f"Error importing section {section_name}:\n{format_exception(e)}")

    # After all sections are registered, now register miscellaneous section
    from aospdtgen.proprietary_files.sections.miscellaneous import MiscellaneousSection

    register_section(MiscellaneousSection)


================================================
FILE: aospdtgen/proprietary_files/sections/acdb.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AcdbSection(Section):
    name = "ACDB"
    folders = [
        "etc/acdbdata",
    ]


register_section(AcdbSection)


================================================
FILE: aospdtgen/proprietary_files/sections/adsp.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AdspSection(Section):
    name = "ADSP"
    interfaces = [
        "vendor.qti.adsprpc",
    ]
    binaries = [
        "adsprpcd",
    ]
    libraries = [
        "libadsprpc",
        "libadsp_default_listener",
    ]


class AdspModulesSection(Section):
    name = "ADSP modules"
    folders = [
        "lib/rfs/dsp",
        "lib/rfsa/adsp",
        "lib64/rfs/dsp",
        "lib64/rfsa/adsp",
    ]


register_section(AdspSection)
register_section(AdspModulesSection)


================================================
FILE: aospdtgen/proprietary_files/sections/alarm.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AlarmSection(Section):
    name = "Alarm"
    interfaces = [
        "vendor.qti.hardware.alarm",
    ]
    apps = [
        "PowerOffAlarm",
    ]
    binaries = [
        "power_off_alarm",
        "poweroffm64",
    ]


register_section(AlarmSection)


================================================
FILE: aospdtgen/proprietary_files/sections/ant.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AntSection(Section):
    name = "ANT"
    interfaces = [
        "com.dsi.ant",
        "com.qualcomm.qti.ant",
        "vendor.xiaomi.hardware.antdtx",
    ]


class AntFirmwareSection(Section):
    name = "ANT firmware"
    patterns = [
        r"(.*/)?firmware/antdtx\..*",
    ]


register_section(AntSection)
register_section(AntFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/atrace.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AtraceSection(Section):
    name = "Atrace"
    interfaces = [
        "android.hardware.atrace",
    ]


register_section(AtraceSection)


================================================
FILE: aospdtgen/proprietary_files/sections/audio.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AudioSection(Section):
    name = "Audio"
    interfaces = [
        "android.hardware.audio",
        "android.hardware.audio.common",
        "android.hardware.audio.effect",
        "vendor.oplus.hardware.binaural_record",
        "vendor.oplus.hardware.virtual_device.audio",
        "vendor.qti.hardware.audiohalext",
    ]
    hardware_modules = [
        "audio.binaural_record",
        "audio.primary",
        "audio.r_submix",
        "audio.usb",
        "audio.virtual",
    ]
    properties_prefixes = {
        "aaudio.": False,
        "af.fast_track_multiplier": True,
        "audio.": False,
        "persist.audio.": False,
        "persist.vendor.audio.": False,
        "ro.audio.": False,
        "ro.qc.sdk.audio.": False,
        "ro.vendor.audio.": False,
        "tunnel.audio.": False,
        "use.voice.path.for.pcm.voip": True,
        "vendor.audio.": False,
        "vendor.audio_hal.": False,
        "vendor.voice.path.for.pcm.voip": True,
    }


class AudioFxModulesSection(Section):
    name = "Audio (FX modules)"
    folders = [
        "lib/soundfx",
        "lib64/soundfx",
    ]


class AudioConfigsSection(Section):
    name = "Audio configs"
    filenames = [
        "audio_io_policy.conf",
        "audio_tuning_mixer.txt",
        "default_volume_tables.xml",
    ]
    folders = [
        "etc/audio",
    ]
    patterns = [
        r"etc/audio_configs.*\.xml",
        r"etc/audio_effects.*\.(conf|xml)",
        r"etc/audio_platform_info.*\.xml",
        r"etc/.*audio_policy.*\.xml",
        r"etc/mixer_paths.*\.xml",
        r"etc/sound_trigger_.*\.xml",
    ]


class AudioCalibrationSection(Section):
    name = "Audio calibration"
    folders = [
        "etc/audio_param",
        "etc/lvacfs_params",
        "etc/smartpa_param",
        "etc/spatializer",
    ]
    patterns = [
        r"(.*/)?firmware/tfa98xx\..*",
    ]


register_section(AudioSection)
register_section(AudioFxModulesSection)
register_section(AudioConfigsSection)
register_section(AudioCalibrationSection)


================================================
FILE: aospdtgen/proprietary_files/sections/authsecret.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AuthsecretSection(Section):
    name = "Authsecret"
    interfaces = [
        "android.hardware.authsecret",
    ]


register_section(AuthsecretSection)


================================================
FILE: aospdtgen/proprietary_files/sections/automotive.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class AutomotiveSection(Section):
    name = "Automotive"
    interfaces = [
        "android.hardware.automotive.audiocontrol",
        "android.hardware.automotive.can",
        "android.hardware.automotive.evs",
        "android.hardware.automotive.occupant_awareness",
        "android.hardware.automotive.sv",
        "android.hardware.automotive.vehicle",
        "vendor.qti.hardware.automotive.vehicle",
    ]


register_section(AutomotiveSection)


================================================
FILE: aospdtgen/proprietary_files/sections/bluetooth.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class BluetoothSection(Section):
    name = "Bluetooth"
    interfaces = [
        "android.hardware.bluetooth",
    ]
    hardware_modules = [
        "bluetooth",
    ]
    libraries = [
        "libbt-vendor",
    ]
    properties_prefixes = {
        "bluetooth.": False,
        "persist.bluetooth.": False,
        "persist.sys.btsatck.": False,  # Xiaomi...
        "persist.vendor.bt.": False,
        "persist.vendor.btsatck.": False,  # Xiaomi...
        "persist.vendor.btstack.": False,
        "persist.vendor.qcom.bluetooth.": False,
        "ro.bluetooth.": False,
        "ro.vendor.bluetooth.": False,
        "vendor.bluetooth.": False,
        "vendor.qcom.bluetooth.": False,
    }


class BluetoothA2dpSection(Section):
    name = "Bluetooth (A2DP)"
    interfaces = [
        "android.hardware.bluetooth.a2dp",
        "android.hardware.bluetooth.audio",
        "com.qualcomm.qti.bluetooth_audio",
        "vendor.mediatek.hardware.bluetooth.audio",
        "vendor.qti.hardware.bluetooth.audio",
        "vendor.qti.hardware.bluetooth_audio",
        "vendor.qti.hardware.bluetooth_sar",
        "vendor.qti.hardware.btconfigstore",
    ]
    hardware_modules = [
        "audio.bluetooth",
        "audio.bluetooth_qti",
    ]


register_section(BluetoothSection)
register_section(BluetoothA2dpSection)


================================================
FILE: aospdtgen/proprietary_files/sections/boot.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class BootSection(Section):
    name = "Boot"
    interfaces = [
        "android.hardware.boot",
    ]


register_section(BootSection)


================================================
FILE: aospdtgen/proprietary_files/sections/broadcastradio.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class BroadcastRadioSection(Section):
    name = "Broadcast radio"
    interfaces = [
        "android.hardware.broadcastradio",
    ]


register_section(BroadcastRadioSection)


================================================
FILE: aospdtgen/proprietary_files/sections/camera.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CameraSection(Section):
    name = "Camera"
    interfaces = [
        "android.hardware.camera.common",
        "android.hardware.camera.device",
        "android.hardware.camera.metadata",
        "android.hardware.camera.provider",
        "camera.device",
        "motorola.hardware.camera.imgtuner",
        "vendor.mediatek.hardware.camera.atms",
        "vendor.mediatek.hardware.camera.bgservice",
        "vendor.mediatek.hardware.camera.frhandler",
        "vendor.mediatek.hardware.camera.isphal",
        "vendor.mediatek.hardware.camera.lomoeffect",
        "vendor.mediatek.hardware.camera.postproc",
        "vendor.mediatek.hardware.camera.security",
        "vendor.oplus.hardware.camera_rfi",
        "vendor.oplus.hardware.cammidasservice",
        "vendor.oplus.hardware.extcamera",
        "vendor.oplus.hardware.virtual_device.camera.hal",
        "vendor.oplus.hardware.virtual_device.camera.manager",
        "vendor.oplus.hardware.virtual_device.camera.provider",
        "vendor.qti.camera.provider",
        "vendor.qti.hardware.camera.device",
        "vendor.qti.hardware.camera.offlinecamera",
        "vendor.qti.hardware.camera.postproc",
        "vendor.qti.hardware.scve.objecttracker",
        "vendor.qti.hardware.scve.panorama",
        "vendor.qti.hardware.seccam",
    ]
    hardware_modules = [
        "camera",
        "com.qti.chi",
    ]
    binaries = [
        "camerahalserver",
        "mm-qcamera-daemon",
        "virtualcameraprovider",
    ]
    libraries = [
        "libscveBlobDescriptor_stub",
        "libscveCommon",
        "libscveCommon_stub",
        "libscveObjectSegmentation",
        "libscveObjectSegmentation_stub",
        "libscveObjectTracker",
        "libscveObjectTracker_stub",
        "libscvePanorama",
        "libscvePanorama_lite",
        "libscvePanorama_stub",
    ]
    folders = [
        "lib/camera",
        "lib64/camera",
    ]
    patterns = [
        r"lib(64)?/com.qti.feature2\..*\.so",
        r"lib(64)?/libCamera_.*\.so",
        r"lib(64)?/libactuator_.*\.so",
        r"lib(64)?/libarcsoft_.*\.so",
        r"lib(64)?/libcamx.*\.so",
        r"lib(64)?/libchromatix_.*\.so",
        r"lib(64)?/libmmcamera_.*\.so",
        r"lib(64)?/libmmcamera2_.*\.so",
        r"lib(64)?/libmtkcam_.*\.so",
        r"lib(64)?/libois_.*\.so",
    ]
    properties_prefixes = {
        "camera.": False,
        "persist.vendor.camera.": False,
        "vendor.camera.": False,
    }


class CameraConfigsSection(Section):
    name = "Camera configs"
    folders = [
        "camera",
        "etc/camera",
    ]


class CameraFirmwareSection(Section):
    name = "Camera firmware"
    patterns = [
        r"(.*/)?firmware/CAMERA_ICP.*",
        r"bin/lib3a.*",
        r"bin/libccu_.*",
        r"firmware/lib3a.*",
        r"firmware/libccu_.*",
    ]


class CameraMotorSection(Section):
    name = "Camera motor"
    interfaces = [
        "vendor.xiaomi.hardware.motor",
    ]
    libraries = [
        "mi.motor.daemon",
    ]
    folders = [
        "etc/step_motor",
    ]
    patterns = [
        r"lib(64)?/libmivendor_module_.*\.so",
    ]


register_section(CameraSection)
register_section(CameraConfigsSection)
register_section(CameraFirmwareSection)
register_section(CameraMotorSection)


================================================
FILE: aospdtgen/proprietary_files/sections/cas.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CasSection(Section):
    name = "CAS"
    interfaces = [
        "android.hardware.cas",
        "android.hardware.cas.native",
    ]


register_section(CasSection)


================================================
FILE: aospdtgen/proprietary_files/sections/cdsp.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CdspSection(Section):
    name = "CDSP"
    interfaces = [
        "vendor.qti.cdsprpc",
    ]
    binaries = [
        "cdsprpcd",
    ]
    libraries = [
        "libcdsprpc",
        "libcdsp_default_listener",
        "libfastcvdsp_stub",
        "libfastcvopt",
    ]


register_section(CdspSection)


================================================
FILE: aospdtgen/proprietary_files/sections/cit.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CitSection(Section):
    name = "CIT"
    interfaces = [
        "vendor.xiaomi.cit.bluetooth",
        "vendor.xiaomi.cit.wifi",
        "vendor.xiaomi.hardware.citsensorservice",
        "vendor.xiaomi.hardware.citvendorservice",
    ]


register_section(CitSection)


================================================
FILE: aospdtgen/proprietary_files/sections/cne.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CneSection(Section):
    name = "CNE"
    interfaces = [
        "com.quicinc.cne.api",
        "com.quicinc.cne.constants",
        "com.quicinc.cne.server",
        "vendor.qti.data.factory",
        "vendor.qti.data.mwqem",
        "vendor.qti.data.slm",
        "vendor.qti.hardware.cacert",
        "vendor.qti.hardware.data.cne.internal.api",
        "vendor.qti.hardware.data.cne.internal.constants",
        "vendor.qti.hardware.data.cne.internal.server",
        "vendor.qti.hardware.data.connection",
        "vendor.qti.hardware.data.connectionaidl",
        "vendor.qti.hardware.data.connectionfactory",
        "vendor.qti.hardware.data.dataactivity",
        "vendor.qti.hardware.data.dynamicdds",
        "vendor.qti.hardware.data.flow",
        "vendor.qti.hardware.data.iwlan",
        "vendor.qti.hardware.data.iwlandata",
        "vendor.qti.hardware.data.ka",
        "vendor.qti.hardware.data.latency",
        "vendor.qti.hardware.data.lce",
        "vendor.qti.hardware.data.qmi",
        "vendor.qti.hardware.factory",
        "vendor.qti.hardware.mwqemadapter",
        "vendor.qti.hardware.slmadapter",
        "vendor.qti.latency",
    ]
    apps = [
        "CneApp",
    ]
    binaries = [
        "cnd",
    ]
    folders = [
        "etc/cne",
    ]
    properties_prefixes = {
        "persist.vendor.cne.": False,
    }


register_section(CneSection)


================================================
FILE: aospdtgen/proprietary_files/sections/configstore.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class ConfigstoreSection(Section):
    name = "Configstore"
    interfaces = [
        "android.hardware.configstore",
        "vendor.qti.hardware.capabilityconfigstore",
    ]
    folders = [
        "etc/configstore",
    ]


register_section(ConfigstoreSection)


================================================
FILE: aospdtgen/proprietary_files/sections/confirmationui.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class ConfirmationUISection(Section):
    name = "Confirmation UI"
    interfaces = [
        "android.hardware.confirmationui",
    ]


register_section(ConfirmationUISection)


================================================
FILE: aospdtgen/proprietary_files/sections/contexthub.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class ContextHubSection(Section):
    name = "Context hub"
    interfaces = [
        "android.hardware.contexthub",
    ]


register_section(ContextHubSection)


================================================
FILE: aospdtgen/proprietary_files/sections/cvp.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class CvpSection(Section):
    name = "CVP"
    interfaces = [
        "vendor.qti.hardware.cvp",
    ]


class CvpFirmwareSection(Section):
    name = "CVP firmware"
    patterns = [
        r"(.*/)?firmware/evass\..*",
        r"(.*/)?firmware/evass-lt\..*",
    ]


register_section(CvpSection)
register_section(CvpFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/display.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class DisplaySection(Section):
    name = "Display"
    interfaces = [
        "android.hardware.graphics.allocator",
        "android.hardware.graphics.bufferqueue",
        "android.hardware.graphics.common",
        "android.hardware.graphics.composer",
        "android.hardware.graphics.composer3",
        "android.hardware.graphics.mapper",
        "android.hardware.memtrack",
        "com.motorola.hardware.display.panel",
        "com.motorola.hardware.display.touch",
        "vendor.display.color",
        "vendor.display.config",
        "vendor.display.postproc",
        "vendor.mediatek.hardware.composer_ext",
        "vendor.mediatek.hardware.mms",
        "vendor.mediatek.hardware.pq",
        "vendor.oplus.hardware.displaycolorfeature",
        "vendor.oplus.hardware.displaypanelfeature",
        "vendor.qti.hardware.display.allocator",
        "vendor.qti.hardware.display.color",
        "vendor.qti.hardware.display.composer",
        "vendor.qti.hardware.display.config",
        "vendor.qti.hardware.display.mapper",
        "vendor.qti.hardware.display.mapperextensions",
        "vendor.qti.hardware.display.postproc",
        "vendor.qti.hardware.qdutils_disp",
        "vendor.xiaomi.hardware.displayfeature",
    ]
    hardware_modules = [
        "copybit",
        "displayfeature",
        "displaypanel",
        "gralloc",
        "hwcomposer",
        "memtrack",
        "vulkan",
    ]
    libraries = [
        "libsdedrm",
        "libsdm-color",
        "libsdm-diag",
        "libsdmextension",
    ]
    folders = [
        "lib/egl",
        "lib64/egl",
    ]
    properties_prefixes = {
        "debug.egl.": False,
        "debug.sf.": False,
        "persist.displayfeature.": False,
        "persist.sys.sf.": False,
        "persist.vendor.dc_backlight.": False,
        "persist.vendor.dfps.": False,
        "ro.gfx.driver.": False,
        "ro.hardware.egl": True,
        "ro.hardware.vulkan": True,
        "ro.hwui.": False,
        "ro.opengles.": False,
        "ro.surface_flinger.": False,
        "ro.vendor.cabc.": False,
        "ro.vendor.colorpick_adjust": True,
        "ro.vendor.dfps.": False,
        "ro.vendor.display.": False,
        "ro.vendor.fps.": False,
        "ro.vendor.hbm_backlight.": False,
        "ro.vendor.histogram.": False,
        "ro.vendor.mi_sf.": False,
        "ro.vendor.whitepoint_calibration_enable": True,
        "vendor.display.": False,
        "vendor.gralloc.": False,
    }


class DisplayPixelworksSection(Section):
    name = "Display (Pixelworks)"
    interfaces = [
        "vendor.pixelworks.hardware.display",
        "vendor.pixelworks.hardware.display.iris",
        "vendor.pixelworks.hardware.feature",
        "vendor.pixelworks.hardware.feature.irisfeature",
    ]
    patterns = [
        r"(.*/)?firmware/pxlw_.*\..*",
    ]


class DisplayConfigsSection(Section):
    name = "Display configs"
    folders = [
        "etc/display",
        "etc/inparm",
    ]
    patterns = [
        r"etc/ltm_*",
        r"etc/mdss_*",
        r"etc/qdcm_*",
    ]


class DisplayFirmwareSection(Section):
    name = "Display firmware"
    folders = [
        "gpu/kbc",
    ]
    patterns = [
        r"(.*/)?firmware/a[0-9]+_.*\..*",
        r"(.*/)?firmware/iris.*\..*",
    ]


register_section(DisplaySection)
register_section(DisplayPixelworksSection)
register_section(DisplayConfigsSection)
register_section(DisplayFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/dpm.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class DpmSection(Section):
    name = "DPM"
    interfaces = [
        "com.qualcomm.qti.dpm.api",
        "vendor.qti.diaghal",
        "vendor.qti.hardware.dpmaidlservice",
        "vendor.qti.hardware.dpmservice",
    ]
    binaries = [
        "dpmQmiMgr",
        "dpmd",
    ]
    folders = [
        "etc/dpm",
    ]
    properties_prefixes = {
        "persist.vendor.dpm.": False,
        "persist.vendor.dpmhalservice.": False,
    }


register_section(DpmSection)


================================================
FILE: aospdtgen/proprietary_files/sections/drm.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class DrmSection(Section):
    name = "DRM"
    interfaces = [
        "android.hardware.drm",
    ]
    apexes = [
        "com.google.android.widevine.nonupdatable",
    ]
    libraries = [
        "liboemcrypto",
    ]
    folders = [
        "lib/mediacas",
        "lib/mediadrm",
        "lib64/mediacas",
        "lib64/mediadrm",
    ]
    properties_prefixes = {
        "drm.service.enabled": True,
        "ro.netflix.bsp_rev": True,
    }


class DrmQseeSection(Section):
    name = "DRM (Qualcomm Secure Execution Environment)"
    interfaces = [
        "vendor.qti.hardware.qseecom",
    ]
    binaries = [
        "qseecomd",
    ]
    libraries = [
        "libQSEEComAPI",
    ]


class DrmQteeSection(Section):
    name = "DRM (Qualcomm Trusted Execution Environment)"
    interfaces = [
        "vendor.qti.hardware.qteeconnector",
    ]
    libraries = [
        "libGPQTEEC_vendor",
        "libGPTEE_vendor",
        "libQTEEConnector_vendor",
    ]


class DrmFirmwareSection(Section):
    name = "DRM firmware"
    folders = [
        "etc/firmware/drm",
    ]
    patterns = [
        r"(.*/)?firmware/widevine\..*",
    ]


register_section(DrmSection)
register_section(DrmQseeSection)
register_section(DrmQteeSection)
register_section(DrmFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/dsp.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class DspSection(Section):
    name = "DSP"
    interfaces = [
        "vendor.qti.hardware.dsp",
    ]
    binaries = [
        "dspservice",
    ]
    filenames = [
        "vendor.qti.hardware.dsp.policy",
    ]


register_section(DspSection)


================================================
FILE: aospdtgen/proprietary_files/sections/dumpstate.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class DumpstateSection(Section):
    name = "Dumpstate"
    interfaces = [
        "android.hardware.dumpstate",
    ]


register_section(DumpstateSection)


================================================
FILE: aospdtgen/proprietary_files/sections/face.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class FaceSection(Section):
    name = "Face"
    interfaces = [
        "android.hardware.biometrics.face",
        "vendor.oplus.hardware.biometrics.face",
    ]


register_section(FaceSection)


================================================
FILE: aospdtgen/proprietary_files/sections/fastboot.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class FastbootSection(Section):
    name = "Fastboot"
    interfaces = [
        "android.hardware.fastboot",
    ]


register_section(FastbootSection)


================================================
FILE: aospdtgen/proprietary_files/sections/fingerprint.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class FingerprintSection(Section):
    name = "Fingerprint"
    interfaces = [
        "android.hardware.biometrics.fingerprint",
        "vendor.goodix.hardware.biometrics.fingerprint",
        "vendor.oplus.hardware.biometrics.fingerprint",
        "vendor.qti.hardware.fingerprint",
        "vendor.xiaomi.hardware.fingerprintextension",
    ]
    hardware_modules = [
        "fingerprint",
        "gf_fingerprint",
    ]
    binaries = [
        "qfp-daemon",
    ]
    properties_prefixes = {
        "persist.vendor.qfp": True,
    }


register_section(FingerprintSection)


================================================
FILE: aospdtgen/proprietary_files/sections/fm.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class FmSection(Section):
    name = "FM"
    interfaces = [
        "vendor.qti.hardware.fm",
    ]


register_section(FmSection)


================================================
FILE: aospdtgen/proprietary_files/sections/gatekeeper.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class GatekeeperSection(Section):
    name = "Gatekeeper"
    interfaces = [
        "android.hardware.gatekeeper",
        "vendor.microtrust.hardware.thh",
        "vendor.qti.hardware.secureprocessor",
        "vendor.qti.spu",
        "vendor.trustonic.tee",
    ]
    binaries = [
        "teei_daemon",
    ]
    hardware_modules = [
        "gatekeeper",
        "libSoftGatekeeper",
    ]
    patterns = [
        r"etc/init/microtrust.*\.rc",
    ]
    properties_prefixes = {
        "vendor.gatekeeper.": False,
    }


class GatekeeperConfigsSection(Section):
    name = "Gatekeeper configs"
    folders = [
        "thh",
    ]


register_section(GatekeeperSection)
register_section(GatekeeperConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/gnss.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class GnssSection(Section):
    name = "GNSS"
    interfaces = [
        "android.hardware.gnss",
        "android.hardware.gnss.measurement_corrections",
        "android.hardware.gnss.visibility_control",
        "vendor.qti.gnss",
    ]
    hardware_modules = [
        "gps",
    ]
    binaries = [
        "loc_launcher",
        "lowi-server",
        "mnld",
        "mtk_agpsd",
        "slim_daemon",
        "xtra-daemon",
        "xtwifi-client",
        "xtwifi-inet-agent",
    ]
    patterns = [
        r"etc/init/mtk_agps.*\.rc",
    ]
    properties_prefixes = {
        "persist.sys.gps.": False,
        "persist.vendor.overlay.izat.": False,
    }


class GnssConfigsSection(Section):
    name = "GNSS configs"
    filenames = [
        "apdr.conf",
        "flp.conf",
        "gps.conf",
        "izat.conf",
        "lowi.conf",
        "sap.conf",
        "xtwifi.conf",
    ]
    folders = [
        "etc/gnss",
    ]


register_section(GnssSection)
register_section(GnssConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/health.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class HealthSection(Section):
    name = "Health"
    interfaces = [
        "android.hardware.health",
        "android.hardware.health.storage",
        "motorola.hardware.health",
        "motorola.hardware.health.storage",
        "motorola.hardware.wireless.wlc",
        "vendor.oplus.hardware.charger",
        "vendor-oplus-hardware-charger",
        "vendor.qti.hardware.charger_monitor",
        "vendor.xiaomi.hardware.micharge",
    ]
    binaries = [
        "batterysecret",
        "fuelgauged",
        "hvdcp_opti",
        "init.qti.chg_policy.sh",
        "wlschgd",
    ]
    filenames = [
        "charger_fstab.qti",
        "fuelgauged_init.rc",
    ]
    properties_prefixes = {
        "ro.charger.": False,
    }


class HealthFirmwareSection(Section):
    name = "Health firmware"
    folders = [
        "firmware/fastchg",
    ]


register_section(HealthSection)
register_section(HealthFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/identity.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class IdentitySection(Section):
    name = "Identity"
    interfaces = [
        "android.hardware.identity",
    ]


register_section(IdentitySection)


================================================
FILE: aospdtgen/proprietary_files/sections/input.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class InputSection(Section):
    name = "Input"
    interfaces = [
        "android.hardware.input.classifier",
        "android.hardware.input.common",
        "android.hardware.input.processor",
    ]


class InputMotorolaSection(Section):
    name = "Input (Motorola)"
    interfaces = [
        "motorola.hardware.input",
    ]


register_section(InputSection)
register_section(InputMotorolaSection)


================================================
FILE: aospdtgen/proprietary_files/sections/ipa.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class IpaSection(Section):
    name = "IPA"
    binaries = [
        "ipacm",
        "ipacm-diag",
    ]
    libraries = [
        "libipanat",
        "liboffloadhal",
    ]
    filenames = [
        "IPACM_cfg.xml",
    ]


class IpaFirmwareSection(Section):
    name = "IPA firmware"
    filenames = [
        "ipa_fws.rc",
    ]
    patterns = [
        r"(.*/)?firmware/.*ipa_(fws|uc)*.",
    ]


register_section(IpaSection)
register_section(IpaFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/ir.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class IrSection(Section):
    name = "IR"
    interfaces = [
        "android.hardware.ir",
    ]
    hardware_modules = [
        "consumerir",
    ]


register_section(IrSection)


================================================
FILE: aospdtgen/proprietary_files/sections/keymaster.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class KeymasterSection(Section):
    name = "Keymaster"
    interfaces = [
        "android.hardware.keymaster",
        "vendor.mediatek.hardware.keymaster_attestation",
    ]
    binaries = [
        "bp_kmsetkey_ca",
    ]
    hardware_modules = [
        "keystore",
        "kmsetkey",
    ]


register_section(KeymasterSection)


================================================
FILE: aospdtgen/proprietary_files/sections/light.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class LightSection(Section):
    name = "Light"
    interfaces = [
        "android.hardware.light",
    ]
    hardware_modules = [
        "lights",
    ]


register_section(LightSection)


================================================
FILE: aospdtgen/proprietary_files/sections/local_time.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class LocalTimeSection(Section):
    name = "Local time"
    hardware_modules = [
        "local_time",
    ]


register_section(LocalTimeSection)


================================================
FILE: aospdtgen/proprietary_files/sections/media.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class MediaSection(Section):
    name = "Media"
    interfaces = [
        "android.hardware.media",
        "android.hardware.media.bufferpool",
        "android.hardware.media.c2",
        "android.hardware.media.omx",
        "vendor.qti.hardware.qconfig",
        "vendor.qti.hardware.vpp",
        "vendor.qti.media.c2",
    ]
    binaries = [
        "qconfigservice",
        "vppservice",
        "vpud",
    ]
    filenames = [
        "c2_manifest_vendor.xml",
        "mediacodec.policy",
    ]
    patterns = [
        r"etc/seccomp_policy/codec2.vendor.*.-arm\.policy",
        r"lib(64)?/libMtkOmx.*\.so",
        r"lib(64)?/libOmx.*\.so",
        r"lib(64)?/libstagefright.*\.so",
    ]
    properties_prefixes = {
        "debug.stagefright.": False,
        "media.": False,
    }


class MediaDolbySection(Section):
    name = "Media (Dolby)"
    interfaces = [
        "vendor.dolby.dms",
        "vendor.dolby.hardware.dms",
        "vendor.dolby.media.c2",
        "vendor.dolby_sp.hardware.dmssp",
        "vendor.dolby_sp.media.c2",
    ]
    libraries = [
        "libdapparamstorage",
        "libdeccfg",
    ]
    filenames = [
        "dolby_vision.cfg",
    ]
    folders = [
        "etc/dolby",
    ]
    patterns = [
        r"lib(64)?/libdolby.*\.so",
    ]
    properties_prefixes = {
        "ro.vendor.dolby.": False,
    }


class MediaOZOAudioSection(Section):
    name = "Media (OZO Audio)"
    interfaces = [
        "vendor.ozoaudio.media.c2",
    ]


class MediaConfigsSection(Section):
    name = "Media configs"
    patterns = [
        r"etc/media_codecs.*\.xml",
        r"etc/media_profiles.*\.xml",
    ]


register_section(MediaSection)
register_section(MediaDolbySection)
register_section(MediaOZOAudioSection)
register_section(MediaConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/miscellaneous.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
from sebaubuntu_libs.libandroid.partitions.partition import AndroidPartition
from sebaubuntu_libs.libandroid.partitions.partition_model import PartitionGroup
from typing import List, Tuple

from aospdtgen.proprietary_files.section import Section


class MiscellaneousSection(Section):
    """This section must not be registered."""

    name = "Miscellaneous"

    @classmethod
    def add_files(
        cls,
        files: List[Path],
        partition: AndroidPartition,
    ) -> Tuple[List[Path], List[Path]]:
        if partition.model.group != PartitionGroup.TREBLE:
            return ([], files)

        return (files, [])

    @classmethod
    def file_match(cls, file: Path) -> bool:
        raise NotImplementedError("MiscellaneousSection should not be used for matching files")

    @classmethod
    def property_match(cls, prop: str):
        return True


================================================
FILE: aospdtgen/proprietary_files/sections/neuralnetworks.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class NeuralNetworksSection(Section):
    name = "Neural networks"
    interfaces = [
        "android.hardware.neuralnetworks",
        "vendor.mediatek.hardware.mmagent",
    ]
    binaries = [
        "nn_device_test",
        "npu_launcher",
    ]
    libraries = [
        "libhexagon_nn_stub",
    ]
    patterns = [
        r"lib(64)?/libhta(_.*.)?\.so",
        r"lib(64)?/unnhal.*.\.so",
    ]


register_section(NeuralNetworksSection)


================================================
FILE: aospdtgen/proprietary_files/sections/nfc.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class NfcSection(Section):
    name = "NFC"
    interfaces = [
        "android.hardware.nfc",
        "vendor.nxp.hardware.nfc",
        "vendor.oplus.hardware.nfcExtns",
        "vendor.oplus.hardware.nfc_aidl",
    ]
    hardware_modules = [
        "nfc",
    ]
    properties_prefixes = {
        "ro.nfc.": False,
    }


class NfcConfigsSection(Section):
    name = "NFC configs"
    folders = [
        "etc/nfc",
    ]
    patterns = [
        r"etc/libnfc-.*\.conf",
        r"etc/sn100u_.*\.pnscr",
    ]


register_section(NfcSection)
register_section(NfcConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/nvram.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class NVRAMSection(Section):
    name = "NVRAM"
    interfaces = [
        "vendor.mediatek.hardware.nvram",
    ]
    binaries = [
        "fuelgauged_nvram",
        "nvram_daemon",
    ]
    filenames = [
        "fuelgauged_nvram_init.rc",
    ]


register_section(NVRAMSection)


================================================
FILE: aospdtgen/proprietary_files/sections/oemlock.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class OemLockSection(Section):
    name = "OEM lock"
    interfaces = [
        "android.hardware.oemlock",
    ]


register_section(OemLockSection)


================================================
FILE: aospdtgen/proprietary_files/sections/pasr.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class PasrSection(Section):
    name = "PASR"
    interfaces = [
        "vendor.qti.memory.pasrmanager",
        "vendor.qti.power.pasrmanager",
    ]
    apps = [
        "pasrservice",
    ]


register_section(PasrSection)


================================================
FILE: aospdtgen/proprietary_files/sections/payment.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class PaymentEIDSection(Section):
    name = "Payment (eID)"
    interfaces = [
        "vendor.qti.hardware.eid",
    ]


class PaymentIFAASection(Section):
    name = "Payment (IFAA)"
    interfaces = [
        "vendor.qti.hardware.ifaa",
    ]
    apps = [
        "IFAAService",
    ]


class PaymentOplusSection(Section):
    name = "Payment (oplus)"
    interfaces = [
        "vendor.oplus.hardware.biometrics.fingerprintpay",
        "vendor.oplus.hardware.fido.fido2ca",
        "vendor.oplus.hardware.fido.fidoca",
    ]


class PaymentXiaomiSection(Section):
    name = "Payment (Xiaomi)"
    interfaces = [
        "vendor.fido.fidoca",
        "vendor.xiaomi.hardware.mfidoca",
        "vendor.xiaomi.hardware.mlipay",
        "vendor.xiaomi.hardware.mtdservice",
        "vendor.xiaomi.hardware.tidaservice",
    ]
    patterns = [
        r"bin/fidoca(@[0-9]+\.[0-9]+)?$",
        r"bin/mlipayd(@[0-9]+\.[0-9]+)?$",
        r"bin/mtd(@[0-9]+\.[0-9]+)?$",
        r"bin/tidad(@[0-9]+\.[0-9]+)?$",
    ]


class PaymentFirmwareSection(Section):
    name = "Payment firmware"
    patterns = [
        r"(.*/)?firmware/alipay\..*",
        r"(.*/)?firmware/fidoctap\..*",
        r"(.*/)?firmware/fidotap\..*",
    ]


register_section(PaymentEIDSection)
register_section(PaymentIFAASection)
register_section(PaymentOplusSection)
register_section(PaymentXiaomiSection)
register_section(PaymentFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/perf.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class PerfSection(Section):
    name = "Perf"
    interfaces = [
        "vendor.qti.hardware.perf",
    ]
    libraries = [
        "libqti-perfd-client",
    ]
    filenames = [
        "powerhint.xml",
    ]
    folders = [
        "etc/perf",
    ]
    properties_prefixes = {
        "ro.vendor.extension_library": True,
    }


class PerfIopSection(Section):
    name = "Perf IOP"
    interfaces = [
        "vendor.qti.hardware.iop",
    ]
    libraries = [
        "libqti-iopd-client",
    ]


register_section(PerfSection)
register_section(PerfIopSection)


================================================
FILE: aospdtgen/proprietary_files/sections/power.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class PowerSection(Section):
    name = "Power"
    interfaces = [
        "android.hardware.power",
        "vendor-oplus-hardware-power-powermonitor",
        "vendor.qti.hardware.power.powermodule",
        "vendor.mediatek.hardware.mtkpower",
    ]
    hardware_modules = [
        "power",
    ]
    properties_prefixes = {
        "vendor.power.": False,
    }


class PowerConfigsSection(Section):
    name = "Power configs"
    folders = [
        "etc/pwr",
    ]


register_section(PowerSection)
register_section(PowerConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/qcc.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class QccSection(Section):
    name = "QCC"
    interfaces = [
        "vendor.qti.hardware.qccsyshal",
        "vendor.qti.hardware.qccvndhal",
        "vendor.qti.qccvndhal_aidl",
    ]
    binaries = [
        "qcc-vendor",
    ]


register_section(QccSection)


================================================
FILE: aospdtgen/proprietary_files/sections/qesd.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class QesdSection(Section):
    name = "QESD"
    interfaces = [
        "vendor.qti.qesdhal",
        "vendor.qti.qesdhalaidl",
        "vendor.qti.qesdsys",
    ]
    binaries = [
        "perf_qesdk_client",
        "qesdk-manager",
        "sensors-qesdk",
    ]


register_section(QesdSection)


================================================
FILE: aospdtgen/proprietary_files/sections/qspm.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class QspmSection(Section):
    name = "QSPM"
    interfaces = [
        "vendor.qti.qspmhal",
    ]
    filenames = [
        "qspm.policy",
    ]


register_section(QspmSection)


================================================
FILE: aospdtgen/proprietary_files/sections/qvr.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class QvrSection(Section):
    name = "QVR"
    interfaces = [
        "vendor.qti.hardware.qvr",
    ]
    binaries = [
        "qvrdatalogger",
        "qvrservice",
        "qvrservicetest",
        "qvrservicetest64",
    ]
    folders = [
        "etc/qvr",
    ]


register_section(QvrSection)


================================================
FILE: aospdtgen/proprietary_files/sections/qxr.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class QxrSection(Section):
    name = "QXR"
    interfaces = [
        "vendor.qti.hardware.qxr",
    ]


register_section(QxrSection)


================================================
FILE: aospdtgen/proprietary_files/sections/radio.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class RadioSection(Section):
    name = "Radio"
    interfaces = [
        "android.hardware.radio",
        "mtkfusionrild",
        "qcrild",
        "qcrilNrd",
        "rild",
        "vendor.mediatek.hardware.mtkradioex",
        "vendor.mediatek.hardware.nwk_opt",
        "vendor.mediatek.hardware.radio",
        "vendor.oplus.hardware.appradioaidl",
        "vendor.oplus.hardware.esim",
        "vendor.oplus.hardware.radio",
        "vendor.qti.hardware.embmssl",
        "vendor.qti.hardware.embmsslaidl",
        "vendor.qti.hardware.radio.am",
        "vendor.qti.hardware.radio.atcmdfwd",
        "vendor.qti.hardware.radio.common",
        "vendor.qti.hardware.radio.internal.deviceinfo",
        "vendor.qti.hardware.radio.lpa",
        "vendor.qti.hardware.radio.qcrilhook",
        "vendor.qti.hardware.radio.qtiradio",
        "vendor.qti.hardware.radio.qtiradioconfig",
        "vendor.qti.hardware.radio.uim",
        "vendor.qti.hardware.radio.uim_remote_client",
        "vendor.qti.hardware.radio.uim_remote_server",
        "vendor.qti.rmt_storage",
        "vendor.qti.tftp",
    ]
    hardware_modules = [
        "radio",
    ]
    apps = [
        "IWlanService",
        "QtiTelephonyService",
        "qcrilmsgtunnel",
    ]
    binaries = [
        "ATFWD-daemon",
        "adpl",
        "ccci_mdinit",
        "ccci_rpcd",
        "gsm0710muxd",
        "ks",
        "mdm_helper",
        "netmgrd",
        "pd-mapper",
        "port-bridge",
        "qrtr-cfg",
        "qrtr-lookup",
        "qrtr-ns",
        "qti",
        "rmt_storage",
        "ssgtzd",
        "tftp_server",
        "xcap",
    ]
    filenames = [
        "init-qcril-data.rc",
        "init.md_apps.rc",
    ]
    folders = [
        "etc/qcril_database",
        "radio/qcril_database",
    ]
    patterns = [
        r"etc/init/init.ccci.*\.rc",
        r"etc/init/data.*.\.rc",
        r"etc/seccomp_policy/atfwd(@[0-9]+\.[0-9]+)?.policy",
    ]
    properties_prefixes = {
        "persist.radio.": False,
        "persist.rild.": False,
        "persist.vendor.mdm_helper.": False,
        "persist.vendor.radio.": False,
        "ril.": False,
        "rild.": False,
        "ro.radio.": False,
        "ro.telephony.": False,
        "telephony.": False,
    }


class RadioImsSection(Section):
    name = "Radio (IMS)"
    interfaces = [
        "com.qualcomm.qti.imscmservice",
        "com.qualcomm.qti.uceservice",
        "vendor.mediatek.hardware.rcs",
        "vendor.mediatek.hardware.videotelephony",
        "vendor.oplus.hardware.ims",
        "vendor.qti.hardware.radio.ims",
        "vendor.qti.ims.callcapability",
        "vendor.qti.ims.callinfo",
        "vendor.qti.ims.factory",
        "vendor.qti.ims.rcsconfig",
        "vendor.qti.imsrtpservice",
    ]
    apps = [
        "ims",
    ]
    binaries = [
        "bip",
        "charon",
        "epdg_wod",
        "ims_rtp_daemon",
        "imsdatadaemon",
        "imsqmidaemon",
        "imsrcsd",
        "ipsec_mon",
        "rcs_volte_stack",
        "starter",
        "stroke",
        "volte_clientapi_ua",
        "volte_imcb",
        "volte_imsm_93",
        "volte_md_status",
        "volte_rcs_ua",
        "volte_stack",
        "volte_ua",
        "vtservice_hidl",
    ]
    libraries = [
        "lib-rcsconfig",
        "lib-siputility",
        "lib-uceservice",
    ]
    filenames = [
        "imsrtp.policy",
        "init.wod.rc",
    ]
    patterns = [
        r"lib(64)?/lib-ims.*.\.so",
    ]
    properties_prefixes = {
        "persist.vendor.ims.": False,
    }


register_section(RadioSection)
register_section(RadioImsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/rebootescrow.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class RebootEscrowSection(Section):
    name = "Reboot escrow"
    interfaces = [
        "android.hardware.rebootescrow",
    ]


register_section(RebootEscrowSection)


================================================
FILE: aospdtgen/proprietary_files/sections/renderscript.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class RenderscriptSection(Section):
    name = "RenderScript"
    interfaces = [
        "android.hardware.renderscript",
    ]
    libraries = [
        "libRSDriver_adreno",
        "librs_adreno",
        "librs_adreno_sha1",
    ]


register_section(RenderscriptSection)


================================================
FILE: aospdtgen/proprietary_files/sections/secure_element.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SecureElementSection(Section):
    name = "Secure element"
    interfaces = [
        "android.hardware.secure_element",
        "vendor.qti.secure_element",
    ]


class SecureElementPowerManagerSection(Section):
    name = "Secure element (power manager)"
    interfaces = [
        "vendor.qti.esepowermanager",
    ]


register_section(SecureElementSection)
register_section(SecureElementPowerManagerSection)


================================================
FILE: aospdtgen/proprietary_files/sections/security.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SecuritySection(Section):
    name = "Security"
    interfaces = [
        "android.hardware.security.keymint",
        "android.hardware.security.rkp",
        "android.hardware.security.secureclock",
        "android.hardware.security.sharedsecret",
    ]


register_section(SecuritySection)


================================================
FILE: aospdtgen/proprietary_files/sections/sensors.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SensorsSection(Section):
    name = "Sensors"
    interfaces = [
        "android.hardware.sensors",
        "motorola.hardware.sensorscalibrate",
        "vendor-oplus-hardware-oplusSensor",
        "vendor.qti.hardware.sensorscalibrate",
    ]
    hardware_modules = [
        "sensors",
    ]
    binaries = [
        "init.qcom.sensors.sh",
        "sensors.qti",
        "sscrpcd",
    ]
    patterns = [
        r"lib(64)?/sensors\..*\.so",
    ]
    properties_prefixes = {
        "persist.vendor.sensor.": False,
        "persist.vendor.sensors.": False,
    }


class SensorsConfigsSection(Section):
    name = "Sensors configs"
    folders = [
        "etc/motorola/sensors",
        "etc/sensor",
        "etc/sensors",
    ]


register_section(SensorsSection)
register_section(SensorsConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/servicetracker.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class ServicetrackerSection(Section):
    name = "Service tracker"
    interfaces = [
        "vendor.qti.hardware.servicetracker",
    ]


register_section(ServicetrackerSection)


================================================
FILE: aospdtgen/proprietary_files/sections/sla.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SlaSection(Section):
    name = "SLA"
    interfaces = [
        "vendor.qti.sla.service",
    ]


register_section(SlaSection)


================================================
FILE: aospdtgen/proprietary_files/sections/soter.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SoterSection(Section):
    name = "Soter"
    interfaces = [
        "vendor.microtrust.hardware.soter",
        "vendor.qti.hardware.soter",
    ]
    apps = [
        "SoterService",
    ]


register_section(SoterSection)


================================================
FILE: aospdtgen/proprietary_files/sections/soundtrigger.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class SoundtriggerSection(Section):
    name = "Soundtrigger"
    interfaces = [
        "android.hardware.soundtrigger",
        "android.hardware.soundtrigger3",
        "vendor.qti.voiceprint",
    ]
    hardware_modules = [
        "sound_trigger",
    ]
    properties_prefixes = {
        "ro.vendor.audio.soundtrigger": False,
    }


register_section(SoundtriggerSection)


================================================
FILE: aospdtgen/proprietary_files/sections/storage.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class StorageFirmwareSection(Section):
    name = "Storage firmware"
    folders = [
        "firmware/ufs",
    ]


register_section(StorageFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/tetheroffload.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class TetherOffloadSection(Section):
    name = "Tether offload"
    interfaces = [
        "android.hardware.tetheroffload",
        "android.hardware.tetheroffload.config",
        "android.hardware.tetheroffload.control",
    ]
    binaries = [
        "tetheroffloadservice",
    ]


register_section(TetherOffloadSection)


================================================
FILE: aospdtgen/proprietary_files/sections/thermal.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class ThermalSection(Section):
    name = "Thermal"
    interfaces = [
        "android.hardware.thermal",
    ]
    hardware_modules = [
        "thermal",
    ]
    properties_prefixes = {
        "vendor.sys.thermal.": False,
    }


class ThermalQcomSection(Section):
    name = "Thermal (Qualcomm)"
    interfaces = [
        "vendor.qti.hardware.limits",
    ]
    binaries = [
        "thermal-engine",
    ]
    libraries = [
        "libthermalclient",
    ]


class ThermalXiaomiSection(Section):
    name = "Thermal (Xiaomi)"
    binaries = [
        "mi_thermald",
    ]


class ThermalConfigsSection(Section):
    name = "Thermal configs"
    folders = ["etc/temperature_profile"]
    patterns = [
        r"etc/thermal.*.\.conf",
    ]


register_section(ThermalSection)
register_section(ThermalQcomSection)
register_section(ThermalXiaomiSection)
register_section(ThermalConfigsSection)


================================================
FILE: aospdtgen/proprietary_files/sections/time.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class TimeSection(Section):
    name = "Time services"
    apps = [
        "TimeService",
    ]
    binaries = [
        "time_daemon",
    ]
    libraries = [
        "libtime_genoff",
    ]


register_section(TimeSection)


================================================
FILE: aospdtgen/proprietary_files/sections/touch.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class TouchHbtpSection(Section):
    name = "Touch (HBTP)"
    interfaces = [
        "vendor.qti.hardware.improvetouch.touchcompanion",
    ]
    binaries = [
        "hbtp_daemon",
    ]
    folders = [
        "etc/hbtp",
    ]


class TouchOplusSection(Section):
    name = "Touch (oplus)"
    interfaces = [
        "vendor-oplus-hardware-touch",
    ]


class TouchXiaomiSection(Section):
    name = "Touch (Xiaomi)"
    interfaces = [
        "vendor.xiaomi.hardware.touchfeature",
    ]
    properties_prefixes = {
        "ro.vendor.touchfeature.": False,
    }


class TouchFirmwareSection(Section):
    name = "Touch firmware"
    folders = [
        "firmware/tp",
    ]


register_section(TouchHbtpSection)
register_section(TouchOplusSection)
register_section(TouchXiaomiSection)
register_section(TouchFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/trusted_ui.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class TrustedUiSection(Section):
    name = "Trusted UI"
    interfaces = [
        "vendor.qti.hardware.trustedui",
        "vendor.qti.hardware.tui_comm",
        "vendor.trustonic.tee.tui",
    ]
    binaries = [
        "TrustedUISampleTest",
    ]
    libraries = [
        "libTrustedUI",
        "libTrustedUIAIDL",
        "libTrustedUITZ",
        "libTrustedUIVM",
    ]


register_section(TrustedUiSection)


================================================
FILE: aospdtgen/proprietary_files/sections/tv.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class TvSection(Section):
    name = "TV"
    interfaces = [
        "android.hardware.tv.cec",
        "android.hardware.tv.input",
        "android.hardware.tv.tuner",
    ]
    hardware_modules = [
        "tv_input",
    ]


register_section(TvSection)


================================================
FILE: aospdtgen/proprietary_files/sections/usb.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class UsbSection(Section):
    name = "USB"
    interfaces = [
        "android.hardware.usb",
    ]
    properties_prefixes = {
        "vendor.usb.": False,
    }


register_section(UsbSection)


================================================
FILE: aospdtgen/proprietary_files/sections/uwb.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class UwbSection(Section):
    name = "UWB"
    interfaces = [
        "android.hardware.uwb",
        "android.hardware.uwb.fira_android",
    ]


register_section(UwbSection)


================================================
FILE: aospdtgen/proprietary_files/sections/vibrator.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class VibratorSection(Section):
    name = "Vibrator"
    interfaces = [
        "android.hardware.vibrator",
        "motorola.hardware.vibrator",
        "vendor.asus.vibrator.vibratorgovern",
        "vendor.oplus.hardware.vibrator",
        "vendor.qti.hardware.vibrator",
        "vendor.xiaomi.hardware.vibratorfeature",
    ]
    hardware_modules = [
        "vibrator",
    ]


class VibratorFirmwareSection(Section):
    name = "Vibrator firmware"
    folders = [
        "etc/vibrator",
    ]
    patterns = [
        r"(.*/)?firmware/.*(rtp|RTP)\.bin",
        r"(.*/)?firmware/aw8622x.*\.bin",
        r"(.*/)?firmware/aw8697.*\.bin",
    ]


register_section(VibratorSection)
register_section(VibratorFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/vr.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class VrSection(Section):
    name = "VR"
    interfaces = [
        "android.hardware.vr",
    ]
    hardware_modules = [
        "vr",
    ]


register_section(VrSection)


================================================
FILE: aospdtgen/proprietary_files/sections/weaver.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class WeaverSection(Section):
    name = "Weaver"
    interfaces = [
        "android.hardware.weaver",
    ]


register_section(WeaverSection)


================================================
FILE: aospdtgen/proprietary_files/sections/wifi.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class WifiSection(Section):
    name = "Wi-Fi"
    interfaces = [
        "android.hardware.wifi",
        "vendor.asus.wifi.netutil",
        "vendor.asus.wifi.rttutil",
        "vendor.ims.wifiantennamode",
        "vendor.mediatek.hardware.wifi.hostapd",
        "vendor.mediatek.hardware.wifi.supplicant",
        "vendor.oplus.hardware.wifi",
        "vendor.oplus.hardware.wifi-aidl",
        "vendor.qti.hardware.fstman",
        "vendor.qti.hardware.wifi.hostapd",
        "vendor.qti.hardware.wifi.keystore",
        "vendor.qti.hardware.wifi.supplicant",
        "vendor.qti.hardware.wifi.wifilearner",
        "vendor.qti.hardware.wigig.netperftuner",
        "vendor.qti.hardware.wigig.supptunnel",
    ]
    binaries = [
        "cnss-daemon",
        "hostapd",
        "hostapd_cli",
        "wcnss_service",
        "wlan_assistant",
        "wmt_launcher",
        "wmt_loader",
        "wpa_cli",
        "wpa_supplicant",
    ]
    filenames = [
        "init.wlan_drv.rc",
    ]
    libraries = [
        "libwifi-hal-qcom",
    ]
    properties_prefixes = {
        "ro.hardware.wlan.": False,
        "ro.wifi.": False,
        "ro.wlan.": False,
        "wifi.": False,
    }


class WifiConfigsSection(Section):
    name = "Wi-Fi configs"
    folders = [
        "etc/wifi",
    ]


class WifiFirmwareSection(Section):
    name = "Wi-Fi firmware"
    folders = [
        "firmware/wigig",
        "firmware/wlan",
    ]


register_section(WifiSection)
register_section(WifiConfigsSection)
register_section(WifiFirmwareSection)


================================================
FILE: aospdtgen/proprietary_files/sections/wifidisplay.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from aospdtgen.proprietary_files.section import Section, register_section


class WifiDisplaySection(Section):
    name = "Wi-Fi Display"
    interfaces = [
        "com.qualcomm.qti.wifidisplayhal",
        "vendor.qti.hardware.sigma_miracast",
        "vendor.qti.hardware.wifidisplaysession",
    ]
    apps = [
        "WfdService",
    ]
    binaries = [
        "wfdhdcphalservice",
        "wfdservice",
        "wfdvndservice",
        "wifidisplayhalservice",
    ]
    libraries = [
        "libmiracast",
    ]
    filenames = [
        "wfdconfig.xml",
        "wifidisplayhalservice.policy",
    ]
    patterns = [
        r"etc/seccomp_policy/wfd.*.service\.policy",
    ]
    properties_prefixes = {
        "persist.debug.wfd.": False,
        "persist.sys.wfd.": False,
    }


register_section(WifiDisplaySection)


================================================
FILE: aospdtgen/templates/Android.bp.jinja2
================================================
{% include 'LICENSE.jinja2' %}

soong_namespace {
}



================================================
FILE: aospdtgen/templates/Android.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_DEVICE),{{ device_info.codename }})
include $(call all-subdir-makefiles,$(LOCAL_PATH))
endif



================================================
FILE: aospdtgen/templates/AndroidProducts.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

PRODUCT_MAKEFILES := \
    $(LOCAL_DIR)/lineage_{{ device_info.codename }}.mk

COMMON_LUNCH_CHOICES := \
    lineage_{{ device_info.codename }}-user \
    lineage_{{ device_info.codename }}-userdebug \
    lineage_{{ device_info.codename }}-eng



================================================
FILE: aospdtgen/templates/BoardConfig.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

DEVICE_PATH := device/{{ device_info.manufacturer }}/{{ device_info.codename }}

{% if device_info.device_is_ab %}
# A/B
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS +=
{%- for partition in fstab.get_ab_partitions_models() %} \
    {{ partition.name }}
{%- endfor %}

BOARD_USES_RECOVERY_AS_BOOT := true

{% endif %}
# Architecture
TARGET_ARCH := {{ device_info.arch.arch }}
TARGET_ARCH_VARIANT := {{ device_info.arch.arch_variant }}
TARGET_CPU_ABI := {{ device_info.arch.cpu_abi }}
TARGET_CPU_ABI2 := {{ device_info.arch.cpu_abi2 }}
TARGET_CPU_VARIANT := generic
TARGET_CPU_VARIANT_RUNTIME := {{ device_info.cpu_variant }}

{% if device_info.second_arch %}
TARGET_2ND_ARCH := {{ device_info.second_arch.arch }}
TARGET_2ND_ARCH_VARIANT := {{ device_info.second_arch.arch_variant }}
TARGET_2ND_CPU_ABI := {{ device_info.second_arch.cpu_abi }}
TARGET_2ND_CPU_ABI2 := {{ device_info.second_arch.cpu_abi2 }}
TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_VARIANT_RUNTIME := {{ device_info.second_cpu_variant }}

{% endif %}
{% if device_info.arch.bitness != 64 %}
TARGET_USES_64_BIT_BINDER := true

{% endif %}
{% if not device_info.device_uses_updatable_apex %}
# APEX
OVERRIDE_TARGET_FLATTEN_APEX := true

{% endif %}
# Bootloader
{% if device_info.bootloader_board_name %}
TARGET_BOOTLOADER_BOARD_NAME := {{ device_info.bootloader_board_name }}
{% endif %}
TARGET_NO_BOOTLOADER := true

{% if device_info.screen_density or device_info.use_vulkan %}
# Display
{% if device_info.screen_density %}
TARGET_SCREEN_DENSITY := {{ device_info.screen_density }}
{% endif %}
{% if device_info.use_vulkan %}
TARGET_USES_VULKAN := true
{% endif %}

{% endif %}
# Kernel
{% if boot_configuration.boot_image_info.header_version != "0" %}
BOARD_BOOT_HEADER_VERSION := {{ boot_configuration.boot_image_info.header_version }}
{% endif %}
{% if boot_configuration.base_address %}
BOARD_KERNEL_BASE := {{ boot_configuration.base_address }}
{% endif %}
{% if boot_configuration.cmdline %}
BOARD_KERNEL_CMDLINE := {{ boot_configuration.cmdline }}
{% endif %}
{% if boot_configuration.pagesize %}
BOARD_KERNEL_PAGESIZE := {{ boot_configuration.pagesize }}
{% endif %}
{% if boot_configuration.boot_image_info.header_version != "0" %}
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
{% endif %}
BOARD_KERNEL_IMAGE_NAME := Image
{% if boot_configuration.dt %}
BOARD_KERNEL_SEPARATED_DT := true
{% endif %}
{% if boot_configuration.dtb %}
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
{% endif %}
{% if boot_configuration.dtbo %}
BOARD_KERNEL_SEPARATED_DTBO := true
{% endif %}
TARGET_KERNEL_CONFIG := {{ device_info.codename }}_defconfig
TARGET_KERNEL_SOURCE := kernel/{{ device_info.manufacturer }}/{{ device_info.codename }}

# Kernel - prebuilt
TARGET_FORCE_PREBUILT_KERNEL := true
ifeq ($(TARGET_FORCE_PREBUILT_KERNEL),true)
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilts/kernel
{% if boot_configuration.dt %}
TARGET_PREBUILT_DT := $(DEVICE_PATH)/prebuilts/dt.img
BOARD_MKBOOTIMG_ARGS += --dt $(TARGET_PREBUILT_DT)
BOARD_KERNEL_SEPARATED_DT := 
{% endif %}
{% if boot_configuration.dtb %}
TARGET_PREBUILT_DTB := $(DEVICE_PATH)/prebuilts/dtb.img
BOARD_MKBOOTIMG_ARGS += --dtb $(TARGET_PREBUILT_DTB)
BOARD_INCLUDE_DTB_IN_BOOTIMG := 
{% endif %}
{% if boot_configuration.dtbo %}
BOARD_PREBUILT_DTBOIMAGE := $(DEVICE_PATH)/prebuilts/dtbo.img
BOARD_KERNEL_SEPARATED_DTBO := 
{% endif %}
endif

# Partitions
{% if device_info.device_uses_system_as_root %}
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
{% endif %}
{% if boot_configuration.pagesize %}
BOARD_FLASH_BLOCK_SIZE := {{ boot_configuration.pagesize|int * 64 }} # (BOARD_KERNEL_PAGESIZE * 64)
{% endif %}
BOARD_BOOTIMAGE_PARTITION_SIZE := {{ boot_configuration.boot_image_info.origsize }}
{% if boot_configuration.dtbo %}
BOARD_DTBOIMG_PARTITION_SIZE := {{ boot_configuration.dtbo.stat().st_size }}
{% endif %}
{% if boot_configuration.recovery_image_info %}
BOARD_RECOVERYIMAGE_PARTITION_SIZE := {{ boot_configuration.recovery_image_info.origsize }}
{% endif %}
{% if boot_configuration.init_boot_image_info %}
BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE := {{ boot_configuration.init_boot_image_info.origsize }}
{% endif %}
{% if boot_configuration.vendor_boot_image_info %}
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := {{ boot_configuration.vendor_boot_image_info.origsize }}
{% endif %}
{% if boot_configuration.vendor_kernel_boot_image_info %}
BOARD_VENDOR_KERNEL_BOOTIMAGE_PARTITION_SIZE := {{ boot_configuration.vendor_kernel_boot_image_info.origsize }}
{% endif %}
{% if device_info.device_uses_dynamic_partitions %}
BOARD_SUPER_PARTITION_SIZE := 9126805504 # TODO: Fix hardcoded value
BOARD_SUPER_PARTITION_GROUPS := {{ device_info.manufacturer }}_dynamic_partitions
BOARD_{{ device_info.manufacturer|upper }}_DYNAMIC_PARTITIONS_PARTITION_LIST :=
{%- for partition in fstab.get_logical_partitions_models() %} \
    {{ partition.name }}
{%- endfor %}

BOARD_{{ device_info.manufacturer|upper }}_DYNAMIC_PARTITIONS_SIZE := 9122611200 # TODO: Fix hardcoded value
{% endif %}

# Platform
TARGET_BOARD_PLATFORM := {{ device_info.platform }}

# Properties{{ '\n' }}
{%- for partition in partitions.get_all_partitions() %}
{% if partition.build_prop %}
TARGET_{{ partition.model.name|upper }}_PROP += $(DEVICE_PATH)/{{ partition.model.name }}.prop
{% endif %}
{% endfor %}

# Recovery
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/rootdir/etc/{{ fstab.fstab.name }}
{% if boot_configuration.dtbo and not device_info.device_is_ab %}
BOARD_INCLUDE_RECOVERY_DTBO := true
{% endif %}
{% if device_info.device_pixel_format %}
TARGET_RECOVERY_PIXEL_FORMAT := {{ device_info.device_pixel_format }}
{% endif %}
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true

{% if device_info.vendor_build_security_patch %}
# Security patch level
VENDOR_SECURITY_PATCH := {{ device_info.vendor_build_security_patch }}

{% endif %}
{% if boot_configuration.boot_image_info.sigtype == "AVBv2" %}
# Verified Boot
BOARD_AVB_ENABLE := true
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3
{% if boot_configuration.recovery_image_info
      and boot_configuration.recovery_image_info.sigtype == "AVBv2" %}
BOARD_AVB_RECOVERY_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_RECOVERY_ALGORITHM := SHA256_RSA4096
BOARD_AVB_RECOVERY_ROLLBACK_INDEX := 1
BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION := 1
{% endif %}
{% if boot_configuration.vendor_boot_image_info
      and boot_configuration.vendor_boot_image_info.sigtype == "AVBv2" %}
BOARD_AVB_VENDOR_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_VENDOR_BOOT_ALGORITHM := SHA256_RSA4096
BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX := 1
BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION := 1
{% endif %}
{% if boot_configuration.vendor_kernel_boot_image_info
      and boot_configuration.vendor_kernel_boot_image_info.sigtype == "AVBv2" %}
BOARD_AVB_VENDOR_KERNEL_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_VENDOR_KERNEL_BOOT_ALGORITHM := SHA256_RSA4096
BOARD_AVB_VENDOR_KERNEL_BOOT_ROLLBACK_INDEX := 1
BOARD_AVB_VENDOR_KERNEL_BOOT_ROLLBACK_INDEX_LOCATION := 1
{% endif %}

{% endif %}
# VINTF
DEVICE_MANIFEST_FILE += $(DEVICE_PATH)/manifest.xml
{% if proprietary_files_list is not none %}

# Inherit the proprietary files
include vendor/{{ device_info.manufacturer }}/{{ device_info.codename }}/BoardConfigVendor.mk
{% endif %}



================================================
FILE: aospdtgen/templates/LICENSE.jinja2
================================================
{{ comment_prefix }}
{{ comment_prefix }} SPDX-FileCopyrightText: The LineageOS Project
{{ comment_prefix }} SPDX-License-Identifier: Apache-2.0
{{ comment_prefix }}



================================================
FILE: aospdtgen/templates/README.md.jinja2
================================================
# Android device tree for {{ device_info.brand }} {{ device_info.model }} ({{ device_info.codename }})

```
{% include 'LICENSE.jinja2' %}
```



================================================
FILE: aospdtgen/templates/__init__.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#
"""aospdtgen templates utils."""

from jinja2 import Environment, FileSystemLoader
from pathlib import Path
from typing import Any, Optional

from aospdtgen import module_path

jinja_env = Environment(
    loader=FileSystemLoader(module_path / "templates"),
    autoescape=True,
    trim_blocks=True,
    lstrip_blocks=True,
)


def render_template(
    path: Optional[Path],
    template_file: str,
    out_file: str = "",
    to_file: bool = True,
    **kwargs: Any,
):
    template = jinja_env.get_template(f"{template_file}.jinja2")
    rendered_template = template.render(**kwargs)

    if to_file:
        if not out_file:
            out_file = template_file

        with open(f"{path}/{out_file}", "w", encoding="utf-8") as out:
            out.write(rendered_template)

    return rendered_template


================================================
FILE: aospdtgen/templates/device.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

{% if device_info.device_uses_updatable_apex %}
# Enable updating of APEXes
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)

{% endif %}
{% if device_info.device_is_ab %}
# A/B
{% if device_info.device_uses_virtual_ab %}
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)

{% endif %}
PRODUCT_PACKAGES += \
    android.hardware.boot@1.2-impl \
    android.hardware.boot@1.2-impl.recovery \
    android.hardware.boot@1.2-service

PRODUCT_PACKAGES += \
    update_engine \
    update_engine_sideload \
    update_verifier

{% if partitions.system.fstab_entry and partitions.system.fstab_entry.is_slotselect() %}
AB_OTA_POSTINSTALL_CONFIG += \
    RUN_POSTINSTALL_system=true \
    POSTINSTALL_PATH_system=system/bin/otapreopt_script \
    FILESYSTEM_TYPE_system={{ partitions.system.fstab_entry.fs_type }} \
    POSTINSTALL_OPTIONAL_system=true

{% endif %}
{% if partitions.vendor.fstab_entry and partitions.vendor.fstab_entry.is_slotselect() %}
AB_OTA_POSTINSTALL_CONFIG += \
    RUN_POSTINSTALL_vendor=true \
    POSTINSTALL_PATH_vendor=bin/checkpoint_gc \
    FILESYSTEM_TYPE_vendor={{ partitions.vendor.fstab_entry.fs_type }} \
    POSTINSTALL_OPTIONAL_vendor=true

{% endif %}
PRODUCT_PACKAGES += \
    checkpoint_gc \
    otapreopt_script

{% endif %}
{% if device_info.board_shipping_api_level or device_info.first_api_level %}
# API levels
{% if device_info.board_shipping_api_level %}
BOARD_SHIPPING_API_LEVEL := {{ device_info.board_shipping_api_level }}
{% endif %}
{% if device_info.first_api_level %}
PRODUCT_SHIPPING_API_LEVEL := {{ device_info.first_api_level }}
{% endif %}

{% endif %}
{% if device_info.device_uses_dynamic_partitions %}
# fastbootd
PRODUCT_PACKAGES += \
    android.hardware.fastboot@1.1-impl-mock \
    fastbootd

{% endif %}
# Health
PRODUCT_PACKAGES += \
    android.hardware.health@2.1-impl \
{% if not device_info.device_is_ab %}
    android.hardware.health@2.1-impl.recovery \
{% endif %}
    android.hardware.health@2.1-service

{% if device_info.enable_uffd_gc is not none %}
# Kernel
PRODUCT_ENABLE_UFFD_GC := {{ device_info.enable_uffd_gc|string|lower }}

{% endif %}
# Overlays
PRODUCT_ENFORCE_RRO_TARGETS := *

{% if device_info.device_uses_dynamic_partitions %}
# Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true

{% endif %}
{% if device_info.product_characteristics %}
# Product characteristics
PRODUCT_CHARACTERISTICS := {{ device_info.product_characteristics }}

{% endif %}
# Rootdir
PRODUCT_PACKAGES += \{{ '\n' }}
{%- for file in rootdir_bin_files %}
    {{ file.name }} \
{% endfor %}

PRODUCT_PACKAGES += \
    {{ fstab.fstab.name }} \{{ '\n' }}
{%- for file in rootdir_etc_files %}
    {{ file.name }} \
{% endfor %}
{%- for file in rootdir_recovery_etc_files %}
    {{ file.name }} \
{% endfor %}

{% if device_info.device_uses_dynamic_partitions %}
PRODUCT_COPY_FILES += \
{% if device_info.device_uses_virtual_ab %}
    $(LOCAL_PATH)/rootdir/etc/{{ fstab.fstab.name }}:$(TARGET_VENDOR_RAMDISK_OUT)/first_stage_ramdisk/{{ fstab.fstab.name }}
{% else %}
    $(LOCAL_PATH)/rootdir/etc/{{ fstab.fstab.name }}:$(TARGET_COPY_OUT_RAMDISK)/{{ fstab.fstab.name }}
{% endif %}

{% endif %}
# Soong namespaces
PRODUCT_SOONG_NAMESPACES += \
    $(LOCAL_PATH)
{% if proprietary_files_list is not none %}

# Inherit the proprietary files
$(call inherit-product, vendor/{{ device_info.manufacturer }}/{{ device_info.codename }}/{{ device_info.codename }}-vendor.mk)
{% endif %}



================================================
FILE: aospdtgen/templates/extract-files.py.jinja2
================================================
#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from extract_utils.main import (
    ExtractUtils,
    ExtractUtilsModule,
)

namespace_imports = [
    'device/{{ device_info.manufacturer }}/{{ device_info.codename }}',
]

module = ExtractUtilsModule(
    '{{ device_info.codename }}',
    '{{ device_info.manufacturer }}',
    namespace_imports=namespace_imports,
)

if __name__ == '__main__':
    utils = ExtractUtils.device(module)
    utils.run()



================================================
FILE: aospdtgen/templates/lineage_device.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

# Inherit from those products. Most specific first.
{% if device_info.arch.bitness == 64 %}
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
{% endif %}
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)

# Inherit from {{ device_info.codename }} device
$(call inherit-product, device/{{ device_info.manufacturer }}/{{ device_info.codename }}/device.mk)

# Inherit some common Lineage stuff.
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)

PRODUCT_DEVICE := {{ device_info.codename }}
PRODUCT_NAME := lineage_{{ device_info.codename }}
{% if device_info.brand %}
PRODUCT_BRAND := {{ device_info.brand }}
{% endif %}
{% if device_info.model %}
PRODUCT_MODEL := {{ device_info.model }}
{% endif %}
PRODUCT_MANUFACTURER := {{ device_info.manufacturer }}

PRODUCT_GMS_CLIENTID_BASE := {{ device_info.gms_clientid_base }}
{% if device_info.build_description or device_info.build_fingerprint %}

PRODUCT_BUILD_PROP_OVERRIDES +=
{%- if device_info.build_description %} \
    BuildDesc="{{ device_info.build_description }}"
{%- endif %}
{%- if device_info.build_fingerprint %} \
    BuildFingerprint={{ device_info.build_fingerprint }}
{%- endif %}

{% endif %}



================================================
FILE: aospdtgen/templates/rootdir_Android.bp.jinja2
================================================
{% include 'LICENSE.jinja2' %}

// Init scripts{{ '\n' }}
{%- for file in rootdir_bin_files %}
sh_binary {
    name: "{{ file.name }}",
    src: "bin/{{ file.name }}",
    vendor: true,
}

{% endfor %}
// Init configuration files{{ '\n' }}
{%- for file in rootdir_etc_files %}
{% if not file.name.startswith('fstab.') %}
prebuilt_etc {
    name: "{{ file.name }}",
    src: "etc/{{ file.name }}",
    sub_dir: "init/hw",
    vendor: true,
}

{% endif %}
{% endfor %}
// fstab
prebuilt_etc {
    name: "{{ fstab.fstab.name }}",
    src: "etc/{{ fstab.fstab.name }}",
    vendor: true,
}



================================================
FILE: aospdtgen/templates/rootdir_Android.mk.jinja2
================================================
{% include 'LICENSE.jinja2' %}

LOCAL_PATH := $(call my-dir)

# Recovery init configuration files{{ '\n' }}
{%- for file in rootdir_recovery_etc_files %}
include $(CLEAR_VARS)
LOCAL_MODULE       := {{ file.name }}
LOCAL_MODULE_TAGS  := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES    := etc/{{ file.name }}
LOCAL_MODULE_PATH  := $(TARGET_ROOT_OUT)
include $(BUILD_PREBUILT)

{% endfor %}



================================================
FILE: aospdtgen/templates/setup-makefiles.py.jinja2
================================================
#!./extract-files.py --regenerate_makefiles
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#



================================================
FILE: aospdtgen/utils/boot_configuration.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
from sebaubuntu_libs.libaik import AIKImageInfo, AIKManager
from typing import Optional, Tuple, Union


class BootConfiguration:
    """Class representing a device's boot configuration."""

    def __init__(self, dump_path: Path):
        """
        Given the path to a dump, parse all the images
        and generate a boot configuration.
        """
        self.dump_path = dump_path

        self.boot = self._get_image_path("boot")
        self.dtbo = self._get_image_path("dtbo")
        self.init_boot = self._get_image_path("init_boot")
        self.recovery = self._get_image_path("recovery")
        self.vendor_boot = self._get_image_path("vendor_boot")
        self.vendor_kernel_boot = self._get_image_path("vendor_kernel_boot")

        assert self.boot, "No boot image found"

        self.boot_aik_manager = AIKManager()
        self.boot_image_info = self.boot_aik_manager.unpackimg(self.boot)

        self.init_boot_aik_manager, self.init_boot_image_info = self._extract_if_exists(
            self.init_boot
        )

        self.recovery_aik_manager, self.recovery_image_info = self._extract_if_exists(self.recovery)

        self.vendor_boot_aik_manager, self.vendor_boot_image_info = self._extract_if_exists(
            self.vendor_boot
        )

        self.vendor_kernel_boot_aik_manager, self.vendor_kernel_boot_image_info = (
            self._extract_if_exists(self.vendor_kernel_boot)
        )

        self.kernel = self.boot_image_info.kernel
        self.dt = self.boot_image_info.dt
        self.dtb = self.boot_image_info.dtb

        self.base_address = self.boot_image_info.base_address
        self.cmdline = self.boot_image_info.cmdline
        self.pagesize = self.boot_image_info.pagesize

        if self.vendor_boot_image_info:
            self.kernel = self.vendor_boot_image_info.kernel or self.kernel
            self.dt = self.vendor_boot_image_info.dt or self.dt
            self.dtb = self.vendor_boot_image_info.dtb or self.dtb
            self.dtbo = self.vendor_boot_image_info.dtbo or self.dtbo

            self.base_address = self.vendor_boot_image_info.base_address or self.base_address
            self.cmdline = self.vendor_boot_image_info.cmdline or self.cmdline
            self.pagesize = self.vendor_boot_image_info.pagesize or self.pagesize

        if self.init_boot_image_info:
            self.base_address = self.init_boot_image_info.base_address or self.base_address
            self.cmdline = self.init_boot_image_info.cmdline or self.cmdline
            self.pagesize = self.init_boot_image_info.pagesize or self.pagesize

        if self.vendor_kernel_boot_image_info:
            self.kernel = self.vendor_kernel_boot_image_info.kernel or self.kernel
            self.dt = self.vendor_kernel_boot_image_info.dt or self.dt
            self.dtb = self.vendor_kernel_boot_image_info.dtb or self.dtb
            self.dtbo = self.vendor_kernel_boot_image_info.dtbo or self.dtbo

            self.base_address = self.vendor_kernel_boot_image_info.base_address or self.base_address
            self.cmdline = self.vendor_kernel_boot_image_info.cmdline or self.cmdline
            self.pagesize = self.vendor_kernel_boot_image_info.pagesize or self.pagesize

    def _get_image_path(self, partition: str) -> Union[Path, None]:
        path = self.dump_path / f"{partition}.img"
        return path if path.is_file() else None

    @staticmethod
    def _extract_if_exists(
        image: Optional[Path],
    ) -> Tuple[Optional[AIKManager], Optional[AIKImageInfo]]:
        if not image:
            return None, None

        aik_manager = AIKManager()
        image_info = aik_manager.unpackimg(image, ignore_ramdisk_errors=True)

        return aik_manager, image_info

    def copy_files_to_folder(self, folder: Path) -> None:
        """Copy all prebuilts to a folder."""
        if self.kernel:
            (folder / "kernel").write_bytes(self.kernel.read_bytes())

        if self.dt:
            (folder / "dt.img").write_bytes(self.dt.read_bytes())

        if self.dtb:
            (folder / "dtb.img").write_bytes(self.dtb.read_bytes())

        if self.dtbo:
            (folder / "dtbo.img").write_bytes(self.dtbo.read_bytes())

    def cleanup(self):
        """Cleanup all the temporary files. Do not use this object anymore after calling this."""
        self.boot_aik_manager.cleanup()

        if self.init_boot_aik_manager:
            self.init_boot_aik_manager.cleanup()

        if self.recovery_aik_manager:
            self.recovery_aik_manager.cleanup()

        if self.vendor_boot_aik_manager:
            self.vendor_boot_aik_manager.cleanup()

        if self.vendor_kernel_boot_aik_manager:
            self.vendor_kernel_boot_aik_manager.cleanup()


================================================
FILE: aospdtgen/utils/format_props.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from pathlib import Path
from sebaubuntu_libs.libandroid.props import BuildProp
from typing import Dict

from aospdtgen.proprietary_files.section import sections
from aospdtgen.utils.ignored_props import IGNORED_PROPS


def dump_partition_build_prop(build_prop: BuildProp, destination_file_path: Path):
    """Filter, order and format the build properties and write to file."""
    filtered_build_props = BuildProp()
    filtered_build_props.import_props(build_prop)

    # Remove ignored properties
    for ignored_prop in IGNORED_PROPS:
        filtered_build_props.pop(ignored_prop, None)

    # Don't write the file if there are no properties
    if not filtered_build_props:
        return

    section_to_props: Dict[str, BuildProp] = {}

    for section in sections:
        section_props = BuildProp()

        # Check if the prop belongs to the section
        for key, value in filtered_build_props.items():
            if section.property_match(key):
                section_props.set_prop(key, value)

        # Remove the matched properties from the filtered build props
        for prop in section_props.keys():
            filtered_build_props.pop(prop, None)

        if section_props:
            section_to_props[section.name] = section_props

    # Write the properties to the file
    with destination_file_path.open("w", encoding="utf-8") as f:
        for section, props in section_to_props.items():
            f.write(f"# {section}\n")
            for prop in sorted(props.keys()):
                f.write(f"{prop}={build_prop.get_prop(prop)}\n")
            f.write("\n")


================================================
FILE: aospdtgen/utils/ignored_props.py
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

from sebaubuntu_libs.libandroid.props.utils import get_partition_props
from typing import List

IGNORED_PROPS: List[str] = []
"""A list of build props that should be ignored because automatically generated."""

# Build info
IGNORED_PROPS.extend(get_partition_props("ro.{}build.date", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.date.utc", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.description", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.display.id", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.fingerprint", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.flavor", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.host", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.id", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.keys", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.product", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.security_patch", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.tags", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.type", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.user", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.all_codenames", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.base_os", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.codename", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.incremental", add_empty=True))
IGNORED_PROPS.extend(
    get_partition_props("ro.{}build.version.min_supported_target_sdk", add_empty=True)
)
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.preview_sdk", add_empty=True))
IGNORED_PROPS.extend(
    get_partition_props("ro.{}build.version.preview_sdk_fingerprint", add_empty=True)
)
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.known_codenames", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.release", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.release_or_codename", add_empty=True))
IGNORED_PROPS.extend(
    get_partition_props("ro.{}build.version.release_or_preview_display", add_empty=True)
)
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.sdk", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}build.version.security_patch", add_empty=True))

# Product info
IGNORED_PROPS.extend(get_partition_props("ro.product.{}brand", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}brand_for_attestation", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}device", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}manufacturer", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}model", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}model_for_attestation", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}name", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.product.{}name_for_attestation", add_empty=True))

# ABI list
IGNORED_PROPS.extend(get_partition_props("ro.{}product.cpu.abi", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}product.cpu.abilist", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}product.cpu.abilist32", add_empty=True))
IGNORED_PROPS.extend(get_partition_props("ro.{}product.cpu.abilist64", add_empty=True))

# Screen density
IGNORED_PROPS.append("ro.sf.lcd_density")

# Treble/VNDK
IGNORED_PROPS.extend(get_partition_props("ro.{}vndk.version", add_empty=True))
IGNORED_PROPS.append("ro.treble.enabled")
IGNORED_PROPS.append("ro.vndk.lite")

# Bionic
IGNORED_PROPS.append("ro.bionic.arch")
IGNORED_PROPS.append("ro.bionic.cpu_variant")
IGNORED_PROPS.append("ro.bionic.2nd_arch")
IGNORED_PROPS.append("ro.bionic.2nd_cpu_variant")

# Platform
IGNORED_PROPS.append("ro.board.platform")

# Partitions
IGNORED_PROPS.append("ro.boot.dynamic_partitions")
IGNORED_PROPS.append("ro.build.ab_update")
IGNORED_PROPS.append("ro.build.system_root_image")
IGNORED_PROPS.append("ro.product.ab_ota_partitions")
IGNORED_PROPS.append("ro.virtual_ab.enabled")

# Pixel format
IGNORED_PROPS.append("ro.minui.pixel_format")

# API levels
IGNORED_PROPS.append("ro.board.api_level")
IGNORED_PROPS.append("ro.board.first_api_level")
IGNORED_PROPS.append("ro.product.first_api_level")

# Zygote
IGNORED_PROPS.append("ro.zygote")

# Dalvik
IGNORED_PROPS.append("dalvik.vm.isa.arm.features")
IGNORED_PROPS.append("dalvik.vm.isa.arm.variant")
IGNORED_PROPS.append("dalvik.vm.isa.arm64.features")
IGNORED_PROPS.append("dalvik.vm.isa.arm64.variant")
IGNORED_PROPS.append("dalvik.vm.isa.x86.features")
IGNORED_PROPS.append("dalvik.vm.isa.x86.variant")
IGNORED_PROPS.append("dalvik.vm.isa.x86_64.features")
IGNORED_PROPS.append("dalvik.vm.isa.x86_64.variant")
IGNORED_PROPS.append("ro.dalvik.vm.enable_uffd_gc")

# Characteristics
IGNORED_PROPS.append("ro.build.characteristics")

# Board
IGNORED_PROPS.append("ro.product.board")

# Locale
IGNORED_PROPS.append("ro.product.locale")

# APEX
IGNORED_PROPS.append("ro.apex.updatable")

# Vulkan
IGNORED_PROPS.append("ro.hwui.use_vulkan")

# ADB
IGNORED_PROPS.append("persist.sys.usb.config")
IGNORED_PROPS.append("ro.adb.secure")
IGNORED_PROPS.append("ro.debuggable")
IGNORED_PROPS.append("ro.force.debuggable")
IGNORED_PROPS.append("ro.secure")

# OEM customization
IGNORED_PROPS.append("ro.com.google.clientidbase")
IGNORED_PROPS.append("setupwizard.theme")


================================================
FILE: pyproject.toml
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

[tool.poetry]
name = "aospdtgen"
version = "1.2.1"
description = "Create an Android device tree from a device dump"
authors = ["Sebastiano Barezzi <seba@sebaubuntu.dev>"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/sebaubuntu-python/aospdtgen"

[tool.poetry.scripts]
aospdtgen = 'aospdtgen.main:main'

[tool.poetry.dependencies]
python = "^3.9"
Jinja2 = "^3.1.6"
GitPython = "^3.1.45"
sebaubuntu-libs = "^2.0.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"


================================================
FILE: ruff.toml
================================================
#
# SPDX-FileCopyrightText: The LineageOS Project
# SPDX-License-Identifier: Apache-2.0
#

line-length = 100

[format]
docstring-code-format = true
Download .txt
gitextract_zr8fh6f7/

├── .github/
│   ├── dependabot.yml
│   └── workflows/
│       └── checks.yml
├── .gitignore
├── LICENSES/
│   └── Apache-2.0.txt
├── README.md
├── REUSE.toml
├── aospdtgen/
│   ├── __init__.py
│   ├── __main__.py
│   ├── device_tree.py
│   ├── main.py
│   ├── proprietary_files/
│   │   ├── elf.py
│   │   ├── get_vndk_libs.py
│   │   ├── ignore.py
│   │   ├── proprietary_files_list.py
│   │   ├── section.py
│   │   └── sections/
│   │       ├── acdb.py
│   │       ├── adsp.py
│   │       ├── alarm.py
│   │       ├── ant.py
│   │       ├── atrace.py
│   │       ├── audio.py
│   │       ├── authsecret.py
│   │       ├── automotive.py
│   │       ├── bluetooth.py
│   │       ├── boot.py
│   │       ├── broadcastradio.py
│   │       ├── camera.py
│   │       ├── cas.py
│   │       ├── cdsp.py
│   │       ├── cit.py
│   │       ├── cne.py
│   │       ├── configstore.py
│   │       ├── confirmationui.py
│   │       ├── contexthub.py
│   │       ├── cvp.py
│   │       ├── display.py
│   │       ├── dpm.py
│   │       ├── drm.py
│   │       ├── dsp.py
│   │       ├── dumpstate.py
│   │       ├── face.py
│   │       ├── fastboot.py
│   │       ├── fingerprint.py
│   │       ├── fm.py
│   │       ├── gatekeeper.py
│   │       ├── gnss.py
│   │       ├── health.py
│   │       ├── identity.py
│   │       ├── input.py
│   │       ├── ipa.py
│   │       ├── ir.py
│   │       ├── keymaster.py
│   │       ├── light.py
│   │       ├── local_time.py
│   │       ├── media.py
│   │       ├── miscellaneous.py
│   │       ├── neuralnetworks.py
│   │       ├── nfc.py
│   │       ├── nvram.py
│   │       ├── oemlock.py
│   │       ├── pasr.py
│   │       ├── payment.py
│   │       ├── perf.py
│   │       ├── power.py
│   │       ├── qcc.py
│   │       ├── qesd.py
│   │       ├── qspm.py
│   │       ├── qvr.py
│   │       ├── qxr.py
│   │       ├── radio.py
│   │       ├── rebootescrow.py
│   │       ├── renderscript.py
│   │       ├── secure_element.py
│   │       ├── security.py
│   │       ├── sensors.py
│   │       ├── servicetracker.py
│   │       ├── sla.py
│   │       ├── soter.py
│   │       ├── soundtrigger.py
│   │       ├── storage.py
│   │       ├── tetheroffload.py
│   │       ├── thermal.py
│   │       ├── time.py
│   │       ├── touch.py
│   │       ├── trusted_ui.py
│   │       ├── tv.py
│   │       ├── usb.py
│   │       ├── uwb.py
│   │       ├── vibrator.py
│   │       ├── vr.py
│   │       ├── weaver.py
│   │       ├── wifi.py
│   │       └── wifidisplay.py
│   ├── templates/
│   │   ├── Android.bp.jinja2
│   │   ├── Android.mk.jinja2
│   │   ├── AndroidProducts.mk.jinja2
│   │   ├── BoardConfig.mk.jinja2
│   │   ├── LICENSE.jinja2
│   │   ├── README.md.jinja2
│   │   ├── __init__.py
│   │   ├── device.mk.jinja2
│   │   ├── extract-files.py.jinja2
│   │   ├── lineage_device.mk.jinja2
│   │   ├── rootdir_Android.bp.jinja2
│   │   ├── rootdir_Android.mk.jinja2
│   │   └── setup-makefiles.py.jinja2
│   └── utils/
│       ├── boot_configuration.py
│       ├── format_props.py
│       └── ignored_props.py
├── pyproject.toml
└── ruff.toml
Download .txt
SYMBOL INDEX (153 symbols across 88 files)

FILE: aospdtgen/device_tree.py
  class DeviceTree (line 25) | class DeviceTree:
    method __init__ (line 28) | def __init__(self, path: Path, no_proprietary_files: bool = False):
    method dump_to_folder (line 99) | def dump_to_folder(self, folder: Path):
    method cleanup (line 164) | def cleanup(self) -> None:
    method _render_template (line 172) | def _render_template(

FILE: aospdtgen/main.py
  function main (line 15) | def main():

FILE: aospdtgen/proprietary_files/elf.py
  function get_shared_libs (line 10) | def get_shared_libs(files: List[Path]):

FILE: aospdtgen/proprietary_files/get_vndk_libs.py
  function get_vndk_file_names (line 32) | def get_vndk_file_names(vndk_version: int) -> List[str]:
  function main (line 42) | def main():

FILE: aospdtgen/proprietary_files/ignore.py
  function is_blob_allowed (line 972) | def is_blob_allowed(file: Path) -> bool:

FILE: aospdtgen/proprietary_files/proprietary_files_list.py
  class ProprietaryFilesList (line 15) | class ProprietaryFilesList:
    method __init__ (line 18) | def __init__(self, partitions: List[AndroidPartition]):
    method __str__ (line 43) | def __str__(self) -> str:
    method get_formatted_list (line 46) | def get_formatted_list(self, build_description: Optional[str] = None) ...
    method _sort_files (line 62) | def _sort_files(files: List[Path]) -> List[Path]:

FILE: aospdtgen/proprietary_files/section.py
  class Section (line 21) | class Section:
    method add_files (line 48) | def add_files(
    method file_match (line 105) | def file_match(cls, file: Path):
    method property_match (line 178) | def property_match(cls, prop: str):
  function register_section (line 192) | def register_section(section: Type[Section]):
  function register_sections (line 204) | def register_sections(sections_path: Path):

FILE: aospdtgen/proprietary_files/sections/acdb.py
  class AcdbSection (line 9) | class AcdbSection(Section):

FILE: aospdtgen/proprietary_files/sections/adsp.py
  class AdspSection (line 9) | class AdspSection(Section):
  class AdspModulesSection (line 23) | class AdspModulesSection(Section):

FILE: aospdtgen/proprietary_files/sections/alarm.py
  class AlarmSection (line 9) | class AlarmSection(Section):

FILE: aospdtgen/proprietary_files/sections/ant.py
  class AntSection (line 9) | class AntSection(Section):
  class AntFirmwareSection (line 18) | class AntFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/atrace.py
  class AtraceSection (line 9) | class AtraceSection(Section):

FILE: aospdtgen/proprietary_files/sections/audio.py
  class AudioSection (line 9) | class AudioSection(Section):
  class AudioFxModulesSection (line 43) | class AudioFxModulesSection(Section):
  class AudioConfigsSection (line 51) | class AudioConfigsSection(Section):
  class AudioCalibrationSection (line 71) | class AudioCalibrationSection(Section):

FILE: aospdtgen/proprietary_files/sections/authsecret.py
  class AuthsecretSection (line 9) | class AuthsecretSection(Section):

FILE: aospdtgen/proprietary_files/sections/automotive.py
  class AutomotiveSection (line 9) | class AutomotiveSection(Section):

FILE: aospdtgen/proprietary_files/sections/bluetooth.py
  class BluetoothSection (line 9) | class BluetoothSection(Section):
  class BluetoothA2dpSection (line 35) | class BluetoothA2dpSection(Section):

FILE: aospdtgen/proprietary_files/sections/boot.py
  class BootSection (line 9) | class BootSection(Section):

FILE: aospdtgen/proprietary_files/sections/broadcastradio.py
  class BroadcastRadioSection (line 9) | class BroadcastRadioSection(Section):

FILE: aospdtgen/proprietary_files/sections/camera.py
  class CameraSection (line 9) | class CameraSection(Section):
  class CameraConfigsSection (line 83) | class CameraConfigsSection(Section):
  class CameraFirmwareSection (line 91) | class CameraFirmwareSection(Section):
  class CameraMotorSection (line 102) | class CameraMotorSection(Section):

FILE: aospdtgen/proprietary_files/sections/cas.py
  class CasSection (line 9) | class CasSection(Section):

FILE: aospdtgen/proprietary_files/sections/cdsp.py
  class CdspSection (line 9) | class CdspSection(Section):

FILE: aospdtgen/proprietary_files/sections/cit.py
  class CitSection (line 9) | class CitSection(Section):

FILE: aospdtgen/proprietary_files/sections/cne.py
  class CneSection (line 9) | class CneSection(Section):

FILE: aospdtgen/proprietary_files/sections/configstore.py
  class ConfigstoreSection (line 9) | class ConfigstoreSection(Section):

FILE: aospdtgen/proprietary_files/sections/confirmationui.py
  class ConfirmationUISection (line 9) | class ConfirmationUISection(Section):

FILE: aospdtgen/proprietary_files/sections/contexthub.py
  class ContextHubSection (line 9) | class ContextHubSection(Section):

FILE: aospdtgen/proprietary_files/sections/cvp.py
  class CvpSection (line 9) | class CvpSection(Section):
  class CvpFirmwareSection (line 16) | class CvpFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/display.py
  class DisplaySection (line 9) | class DisplaySection(Section):
  class DisplayPixelworksSection (line 85) | class DisplayPixelworksSection(Section):
  class DisplayConfigsSection (line 98) | class DisplayConfigsSection(Section):
  class DisplayFirmwareSection (line 111) | class DisplayFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/dpm.py
  class DpmSection (line 9) | class DpmSection(Section):

FILE: aospdtgen/proprietary_files/sections/drm.py
  class DrmSection (line 9) | class DrmSection(Section):
  class DrmQseeSection (line 32) | class DrmQseeSection(Section):
  class DrmQteeSection (line 45) | class DrmQteeSection(Section):
  class DrmFirmwareSection (line 57) | class DrmFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/dsp.py
  class DspSection (line 9) | class DspSection(Section):

FILE: aospdtgen/proprietary_files/sections/dumpstate.py
  class DumpstateSection (line 9) | class DumpstateSection(Section):

FILE: aospdtgen/proprietary_files/sections/face.py
  class FaceSection (line 9) | class FaceSection(Section):

FILE: aospdtgen/proprietary_files/sections/fastboot.py
  class FastbootSection (line 9) | class FastbootSection(Section):

FILE: aospdtgen/proprietary_files/sections/fingerprint.py
  class FingerprintSection (line 9) | class FingerprintSection(Section):

FILE: aospdtgen/proprietary_files/sections/fm.py
  class FmSection (line 9) | class FmSection(Section):

FILE: aospdtgen/proprietary_files/sections/gatekeeper.py
  class GatekeeperSection (line 9) | class GatekeeperSection(Section):
  class GatekeeperConfigsSection (line 33) | class GatekeeperConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/gnss.py
  class GnssSection (line 9) | class GnssSection(Section):
  class GnssConfigsSection (line 39) | class GnssConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/health.py
  class HealthSection (line 9) | class HealthSection(Section):
  class HealthFirmwareSection (line 38) | class HealthFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/identity.py
  class IdentitySection (line 9) | class IdentitySection(Section):

FILE: aospdtgen/proprietary_files/sections/input.py
  class InputSection (line 9) | class InputSection(Section):
  class InputMotorolaSection (line 18) | class InputMotorolaSection(Section):

FILE: aospdtgen/proprietary_files/sections/ipa.py
  class IpaSection (line 9) | class IpaSection(Section):
  class IpaFirmwareSection (line 24) | class IpaFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/ir.py
  class IrSection (line 9) | class IrSection(Section):

FILE: aospdtgen/proprietary_files/sections/keymaster.py
  class KeymasterSection (line 9) | class KeymasterSection(Section):

FILE: aospdtgen/proprietary_files/sections/light.py
  class LightSection (line 9) | class LightSection(Section):

FILE: aospdtgen/proprietary_files/sections/local_time.py
  class LocalTimeSection (line 9) | class LocalTimeSection(Section):

FILE: aospdtgen/proprietary_files/sections/media.py
  class MediaSection (line 9) | class MediaSection(Section):
  class MediaDolbySection (line 41) | class MediaDolbySection(Section):
  class MediaOZOAudioSection (line 68) | class MediaOZOAudioSection(Section):
  class MediaConfigsSection (line 75) | class MediaConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/miscellaneous.py
  class MiscellaneousSection (line 14) | class MiscellaneousSection(Section):
    method add_files (line 20) | def add_files(
    method file_match (line 31) | def file_match(cls, file: Path) -> bool:
    method property_match (line 35) | def property_match(cls, prop: str):

FILE: aospdtgen/proprietary_files/sections/neuralnetworks.py
  class NeuralNetworksSection (line 9) | class NeuralNetworksSection(Section):

FILE: aospdtgen/proprietary_files/sections/nfc.py
  class NfcSection (line 9) | class NfcSection(Section):
  class NfcConfigsSection (line 25) | class NfcConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/nvram.py
  class NVRAMSection (line 9) | class NVRAMSection(Section):

FILE: aospdtgen/proprietary_files/sections/oemlock.py
  class OemLockSection (line 9) | class OemLockSection(Section):

FILE: aospdtgen/proprietary_files/sections/pasr.py
  class PasrSection (line 9) | class PasrSection(Section):

FILE: aospdtgen/proprietary_files/sections/payment.py
  class PaymentEIDSection (line 9) | class PaymentEIDSection(Section):
  class PaymentIFAASection (line 16) | class PaymentIFAASection(Section):
  class PaymentOplusSection (line 26) | class PaymentOplusSection(Section):
  class PaymentXiaomiSection (line 35) | class PaymentXiaomiSection(Section):
  class PaymentFirmwareSection (line 52) | class PaymentFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/perf.py
  class PerfSection (line 9) | class PerfSection(Section):
  class PerfIopSection (line 28) | class PerfIopSection(Section):

FILE: aospdtgen/proprietary_files/sections/power.py
  class PowerSection (line 9) | class PowerSection(Section):
  class PowerConfigsSection (line 25) | class PowerConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/qcc.py
  class QccSection (line 9) | class QccSection(Section):

FILE: aospdtgen/proprietary_files/sections/qesd.py
  class QesdSection (line 9) | class QesdSection(Section):

FILE: aospdtgen/proprietary_files/sections/qspm.py
  class QspmSection (line 9) | class QspmSection(Section):

FILE: aospdtgen/proprietary_files/sections/qvr.py
  class QvrSection (line 9) | class QvrSection(Section):

FILE: aospdtgen/proprietary_files/sections/qxr.py
  class QxrSection (line 9) | class QxrSection(Section):

FILE: aospdtgen/proprietary_files/sections/radio.py
  class RadioSection (line 9) | class RadioSection(Section):
  class RadioImsSection (line 93) | class RadioImsSection(Section):

FILE: aospdtgen/proprietary_files/sections/rebootescrow.py
  class RebootEscrowSection (line 9) | class RebootEscrowSection(Section):

FILE: aospdtgen/proprietary_files/sections/renderscript.py
  class RenderscriptSection (line 9) | class RenderscriptSection(Section):

FILE: aospdtgen/proprietary_files/sections/secure_element.py
  class SecureElementSection (line 9) | class SecureElementSection(Section):
  class SecureElementPowerManagerSection (line 17) | class SecureElementPowerManagerSection(Section):

FILE: aospdtgen/proprietary_files/sections/security.py
  class SecuritySection (line 9) | class SecuritySection(Section):

FILE: aospdtgen/proprietary_files/sections/sensors.py
  class SensorsSection (line 9) | class SensorsSection(Section):
  class SensorsConfigsSection (line 34) | class SensorsConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/servicetracker.py
  class ServicetrackerSection (line 9) | class ServicetrackerSection(Section):

FILE: aospdtgen/proprietary_files/sections/sla.py
  class SlaSection (line 9) | class SlaSection(Section):

FILE: aospdtgen/proprietary_files/sections/soter.py
  class SoterSection (line 9) | class SoterSection(Section):

FILE: aospdtgen/proprietary_files/sections/soundtrigger.py
  class SoundtriggerSection (line 9) | class SoundtriggerSection(Section):

FILE: aospdtgen/proprietary_files/sections/storage.py
  class StorageFirmwareSection (line 9) | class StorageFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/tetheroffload.py
  class TetherOffloadSection (line 9) | class TetherOffloadSection(Section):

FILE: aospdtgen/proprietary_files/sections/thermal.py
  class ThermalSection (line 9) | class ThermalSection(Section):
  class ThermalQcomSection (line 22) | class ThermalQcomSection(Section):
  class ThermalXiaomiSection (line 35) | class ThermalXiaomiSection(Section):
  class ThermalConfigsSection (line 42) | class ThermalConfigsSection(Section):

FILE: aospdtgen/proprietary_files/sections/time.py
  class TimeSection (line 9) | class TimeSection(Section):

FILE: aospdtgen/proprietary_files/sections/touch.py
  class TouchHbtpSection (line 9) | class TouchHbtpSection(Section):
  class TouchOplusSection (line 22) | class TouchOplusSection(Section):
  class TouchXiaomiSection (line 29) | class TouchXiaomiSection(Section):
  class TouchFirmwareSection (line 39) | class TouchFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/trusted_ui.py
  class TrustedUiSection (line 9) | class TrustedUiSection(Section):

FILE: aospdtgen/proprietary_files/sections/tv.py
  class TvSection (line 9) | class TvSection(Section):

FILE: aospdtgen/proprietary_files/sections/usb.py
  class UsbSection (line 9) | class UsbSection(Section):

FILE: aospdtgen/proprietary_files/sections/uwb.py
  class UwbSection (line 9) | class UwbSection(Section):

FILE: aospdtgen/proprietary_files/sections/vibrator.py
  class VibratorSection (line 9) | class VibratorSection(Section):
  class VibratorFirmwareSection (line 24) | class VibratorFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/vr.py
  class VrSection (line 9) | class VrSection(Section):

FILE: aospdtgen/proprietary_files/sections/weaver.py
  class WeaverSection (line 9) | class WeaverSection(Section):

FILE: aospdtgen/proprietary_files/sections/wifi.py
  class WifiSection (line 9) | class WifiSection(Section):
  class WifiConfigsSection (line 53) | class WifiConfigsSection(Section):
  class WifiFirmwareSection (line 60) | class WifiFirmwareSection(Section):

FILE: aospdtgen/proprietary_files/sections/wifidisplay.py
  class WifiDisplaySection (line 9) | class WifiDisplaySection(Section):

FILE: aospdtgen/templates/__init__.py
  function render_template (line 21) | def render_template(

FILE: aospdtgen/utils/boot_configuration.py
  class BootConfiguration (line 11) | class BootConfiguration:
    method __init__ (line 14) | def __init__(self, dump_path: Path):
    method _get_image_path (line 80) | def _get_image_path(self, partition: str) -> Union[Path, None]:
    method _extract_if_exists (line 85) | def _extract_if_exists(
    method copy_files_to_folder (line 96) | def copy_files_to_folder(self, folder: Path) -> None:
    method cleanup (line 110) | def cleanup(self):

FILE: aospdtgen/utils/format_props.py
  function dump_partition_build_prop (line 14) | def dump_partition_build_prop(build_prop: BuildProp, destination_file_pa...
Condensed preview — 111 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (174K chars).
[
  {
    "path": ".github/dependabot.yml",
    "chars": 592,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\n# To get started with Dependa"
  },
  {
    "path": ".github/workflows/checks.yml",
    "chars": 1145,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nname: checks\n\non: [push, pull"
  },
  {
    "path": ".gitignore",
    "chars": 4742,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\n# Byte-compiled / optimized /"
  },
  {
    "path": "LICENSES/Apache-2.0.txt",
    "chars": 10280,
    "preview": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AN"
  },
  {
    "path": "README.md",
    "chars": 1572,
    "preview": "# aospdtgen\n\n[![PyPI version](https://img.shields.io/pypi/v/aospdtgen)](https://pypi.org/project/aospdtgen/)\n[![Codacy B"
  },
  {
    "path": "REUSE.toml",
    "chars": 446,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nversion = 1\nSPDX-PackageName "
  },
  {
    "path": "aospdtgen/__init__.py",
    "chars": 390,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\"\"\"aospdtgen module.\"\"\"\n\nfrom "
  },
  {
    "path": "aospdtgen/__main__.py",
    "chars": 181,
    "preview": "#!/usr/bin/python3\n#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospd"
  },
  {
    "path": "aospdtgen/device_tree.py",
    "chars": 7250,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom os import chmod\nfrom pat"
  },
  {
    "path": "aospdtgen/main.py",
    "chars": 1123,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom argparse import Argument"
  },
  {
    "path": "aospdtgen/proprietary_files/elf.py",
    "chars": 280,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nfrom"
  },
  {
    "path": "aospdtgen/proprietary_files/get_vndk_libs.py",
    "chars": 2553,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom base64 import b64decode\n"
  },
  {
    "path": "aospdtgen/proprietary_files/ignore.py",
    "chars": 29684,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nimpo"
  },
  {
    "path": "aospdtgen/proprietary_files/proprietary_files_list.py",
    "chars": 2127,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nfrom"
  },
  {
    "path": "aospdtgen/proprietary_files/section.py",
    "chars": 7454,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom importlib import import_"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/acdb.py",
    "chars": 291,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/adsp.py",
    "chars": 647,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/alarm.py",
    "chars": 427,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/ant.py",
    "chars": 524,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/atrace.py",
    "chars": 311,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/audio.py",
    "chars": 2211,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/authsecret.py",
    "chars": 327,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/automotive.py",
    "chars": 623,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/bluetooth.py",
    "chars": 1495,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/boot.py",
    "chars": 303,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/broadcastradio.py",
    "chars": 344,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/camera.py",
    "chars": 3459,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/cas.py",
    "chars": 338,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/cdsp.py",
    "chars": 478,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/cit.py",
    "chars": 442,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/cne.py",
    "chars": 1557,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/configstore.py",
    "chars": 433,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/confirmationui.py",
    "chars": 344,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/contexthub.py",
    "chars": 328,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/cvp.py",
    "chars": 502,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/display.py",
    "chars": 3618,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/dpm.py",
    "chars": 642,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/drm.py",
    "chars": 1450,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/dsp.py",
    "chars": 413,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/dumpstate.py",
    "chars": 323,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/face.py",
    "chars": 363,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/fastboot.py",
    "chars": 319,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/fingerprint.py",
    "chars": 748,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/fm.py",
    "chars": 298,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/gatekeeper.py",
    "chars": 889,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/gnss.py",
    "chars": 1179,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/health.py",
    "chars": 1099,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/identity.py",
    "chars": 319,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/input.py",
    "chars": 571,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/ipa.py",
    "chars": 636,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/ir.py",
    "chars": 348,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/keymaster.py",
    "chars": 501,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/light.py",
    "chars": 356,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/local_time.py",
    "chars": 314,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/media.py",
    "chars": 1966,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/miscellaneous.py",
    "chars": 985,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nfrom"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/neuralnetworks.py",
    "chars": 612,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/nfc.py",
    "chars": 750,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/nvram.py",
    "chars": 450,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/oemlock.py",
    "chars": 316,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/pasr.py",
    "chars": 393,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/payment.py",
    "chars": 1588,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/perf.py",
    "chars": 733,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/power.py",
    "chars": 711,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/qcc.py",
    "chars": 431,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/qesd.py",
    "chars": 466,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/qspm.py",
    "chars": 347,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/qvr.py",
    "chars": 467,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/qxr.py",
    "chars": 302,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/radio.py",
    "chars": 3822,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/rebootescrow.py",
    "chars": 336,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/renderscript.py",
    "chars": 442,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/secure_element.py",
    "chars": 587,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/security.py",
    "chars": 467,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/sensors.py",
    "chars": 986,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/servicetracker.py",
    "chars": 347,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/sla.py",
    "chars": 301,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/soter.py",
    "chars": 397,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/soundtrigger.py",
    "chars": 547,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/storage.py",
    "chars": 325,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/tetheroffload.py",
    "chars": 494,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/thermal.py",
    "chars": 1068,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/time.py",
    "chars": 392,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/touch.py",
    "chars": 999,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/trusted_ui.py",
    "chars": 585,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/tv.py",
    "chars": 424,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/usb.py",
    "chars": 363,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/uwb.py",
    "chars": 344,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/vibrator.py",
    "chars": 898,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/vr.py",
    "chars": 340,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/weaver.py",
    "chars": 311,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/wifi.py",
    "chars": 1718,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/proprietary_files/sections/wifidisplay.py",
    "chars": 923,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom aospdtgen.proprietary_fi"
  },
  {
    "path": "aospdtgen/templates/Android.bp.jinja2",
    "chars": 53,
    "preview": "{% include 'LICENSE.jinja2' %}\n\nsoong_namespace {\n}\n\n"
  },
  {
    "path": "aospdtgen/templates/Android.mk.jinja2",
    "chars": 171,
    "preview": "{% include 'LICENSE.jinja2' %}\n\nLOCAL_PATH := $(call my-dir)\n\nifeq ($(TARGET_DEVICE),{{ device_info.codename }})\ninclude"
  },
  {
    "path": "aospdtgen/templates/AndroidProducts.mk.jinja2",
    "chars": 278,
    "preview": "{% include 'LICENSE.jinja2' %}\n\nPRODUCT_MAKEFILES := \\\n    $(LOCAL_DIR)/lineage_{{ device_info.codename }}.mk\n\nCOMMON_LU"
  },
  {
    "path": "aospdtgen/templates/BoardConfig.mk.jinja2",
    "chars": 7378,
    "preview": "{% include 'LICENSE.jinja2' %}\n\nDEVICE_PATH := device/{{ device_info.manufacturer }}/{{ device_info.codename }}\n\n{% if d"
  },
  {
    "path": "aospdtgen/templates/LICENSE.jinja2",
    "chars": 167,
    "preview": "{{ comment_prefix }}\n{{ comment_prefix }} SPDX-FileCopyrightText: The LineageOS Project\n{{ comment_prefix }} SPDX-Licens"
  },
  {
    "path": "aospdtgen/templates/README.md.jinja2",
    "chars": 144,
    "preview": "# Android device tree for {{ device_info.brand }} {{ device_info.model }} ({{ device_info.codename }})\n\n```\n{% include '"
  },
  {
    "path": "aospdtgen/templates/__init__.py",
    "chars": 899,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\"\"\"aospdtgen templates utils.\""
  },
  {
    "path": "aospdtgen/templates/device.mk.jinja2",
    "chars": 3496,
    "preview": "{% include 'LICENSE.jinja2' %}\n\n{% if device_info.device_uses_updatable_apex %}\n# Enable updating of APEXes\n$(call inher"
  },
  {
    "path": "aospdtgen/templates/extract-files.py.jinja2",
    "chars": 561,
    "preview": "#!/usr/bin/env -S PYTHONPATH=../../../tools/extract-utils python3\n#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SP"
  },
  {
    "path": "aospdtgen/templates/lineage_device.mk.jinja2",
    "chars": 1248,
    "preview": "{% include 'LICENSE.jinja2' %}\n\n# Inherit from those products. Most specific first.\n{% if device_info.arch.bitness == 64"
  },
  {
    "path": "aospdtgen/templates/rootdir_Android.bp.jinja2",
    "chars": 587,
    "preview": "{% include 'LICENSE.jinja2' %}\n\n// Init scripts{{ '\\n' }}\n{%- for file in rootdir_bin_files %}\nsh_binary {\n    name: \"{{"
  },
  {
    "path": "aospdtgen/templates/rootdir_Android.mk.jinja2",
    "chars": 395,
    "preview": "{% include 'LICENSE.jinja2' %}\n\nLOCAL_PATH := $(call my-dir)\n\n# Recovery init configuration files{{ '\\n' }}\n{%- for file"
  },
  {
    "path": "aospdtgen/templates/setup-makefiles.py.jinja2",
    "chars": 135,
    "preview": "#!./extract-files.py --regenerate_makefiles\n#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier:"
  },
  {
    "path": "aospdtgen/utils/boot_configuration.py",
    "chars": 4865,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nfrom"
  },
  {
    "path": "aospdtgen/utils/format_props.py",
    "chars": 1688,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom pathlib import Path\nfrom"
  },
  {
    "path": "aospdtgen/utils/ignored_props.py",
    "chars": 5815,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nfrom sebaubuntu_libs.libandro"
  },
  {
    "path": "pyproject.toml",
    "chars": 628,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\n[tool.poetry]\nname = \"aospdtg"
  },
  {
    "path": "ruff.toml",
    "chars": 148,
    "preview": "#\n# SPDX-FileCopyrightText: The LineageOS Project\n# SPDX-License-Identifier: Apache-2.0\n#\n\nline-length = 100\n\n[format]\nd"
  }
]

About this extraction

This page contains the full source code of the sebaubuntu-python/aospdtgen GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 111 files (152.5 KB), approximately 42.9k tokens, and a symbol index with 153 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!