[prjkt.io] nathanchance:
Introduction

Hello everyone! I am one of the members of the Substratum team and we constantly have people asking how to add support to ROMs. I have made a repo regarding all of our documentation here, in which I include steps to add support. Normally, it is easy to add support to most ROMs; however, Lineage has made some underlying changes to AssetManager and PackageManager that makes adding the patches a little difficult if you do not have some solid programming background. To help people who are familiar with building and git but not necessarily Java and C, I have created a series of reference repos that you can use to cherry pick the commits into your forks or local builds to easily have theme support! Please read this entire thread, I go over a lot of info and I will be upset if you do not read it all :) enjoy!

Information

Substratum currently uses OMS (Overlay Manager Service), Sony's theming framework, that allows for real time swapping of resources via overlays. This is accomplished through a series of commits, which include the core OMS framework, exposures so themes can overlay hardcoded resources, and a second set of framework commits to allow Substratum to do all of its operations without root access. You can read more about this in the main Substratum thread. We have made it so that it is easy to merge OMS and all of our exposures on AOSP or close to AOSP ROMs. Lineage is not one of those ROMs as they have based on CAF, which modifies AOSP to suit a large range of devices. Lineage has also modified core components like Package Manager for security reasons and some of those changes will conflict with OMS changes. I have merged the changes on top of Lineage and verified everything has worked properly. I will continue to maintain this as long as time permits. I plan to try and rebase the changes every day on Lineage updates but I may need to do it weekly depending on how much free time I have.

What do I have to do?

All you need to do is merge the changes from our repos into yours! Link: https://github.com/LineageOMS

This can be done in one of four ways (ONLY ONE):

1. Cherry-pick our changes

This will be the best option if you have forked Lineage and made any changes (basically basing a ROM on Lineage). Once you have merged these changes, you can track our progress on Gerrit and merge patches as they come down. The patches you need to pick will be either "committed with nathanchance" or "nathanchance committed".

git fetch <url> cm-14.1
git cherry-pick <first_sha1>^..<second_sha1>

Example:

git fetch https://github.com/LineageOMS/android_frameworks_base cm-14.1
git cherry-pick d6b3f93bec61769fab7ebf31e78bf0acb42bb2e6^..1e00bba63c5b6facec5a8beef1bb39863b251183

2. Pull our changes

This will be a good option if you have either forked Lineage and made no changes or do straight builds from their repos, as this will fetch and merge automatically. You can still cherry-pick if you want but this should result in no conflicts (basically a clean merge).

git pull <url> cm-14.1

Example:

git pull https://github.com/LineageOMS/android_frameworks_base cm-14.1

3. Sync using our manifest

This is good if you are just building straight from Lineage's sources. The one issue with this is you will be fully reliant on me for updates; Lineage often merges patches across a few repos and you may run into errors if ALL repos are not up to date.

From the top of your Lineage repo folder:

mkdir LineageOMS && cd LineageOMS
repo init -u https://github.com/LineageOMS/android -b cm-14.1 --no-clone-bundle --depth=1
repo sync -j$( nproc --all ) --force-sync -c --no-clone-bundle --no-tags --optimized-fetch --prune

4. Use the provided local manifest

This is good if you are just building straight from Lineage's sources. As with the above option, you MAY run into errors if a patch is merged across several repos and I have not update my repos with the proper changes.

From the top of your Lineage repo folder:

cd .repo
mkdir -p local_manifests
cd local_manifests
wget https://raw.githubusercontent.com/LineageOMS/local_manifest/master/substratum.xml
cd ../..
repo sync --force-sync

4. Use the provided local manifest

I would only recommend doing this if you are building straight from Lineage's sources and willing to build only when I rebase my changes. Lineage often merges patches across several repos and without every repo being up to date, you may get build errors.

From the top of your Lineage repo folder:

cd .repo
mkdir -p local_manifests
cd local_manifests
wget https://raw.githubusercontent.com/LineageOMS/local_manifest/master/substratum.xml
cd ../..
repo sync --force-sync

That's it! Super easy as it should be.

Support

If you run into any issues with merging patches, ask in this thread.

If you PM me on XDA... I will ignore you.

If you PM me on Hangouts... I will ignore you.

If you PM me on Telegram... I will ignore you.

See a pattern? :p This thread is the place for support, nowhere else.

If you run into issues with using Substratum itself, ask in the main thread.