• 3 Posts
  • 94 Comments
Joined 2 years ago
cake
Cake day: July 5th, 2023

help-circle

















  • Still sounds like it could get quite messy if Google adds a feature

    Of course it can, the point is how difficult it is to get out of the mess. Patching upstream source directly is magnitudes worse. Unfortunately, when you want to add one button to SystemUI somewhere, going straight to the layout and adding it in is most tempting.

    In practice, an upstream merge would typically be completed in a few days to several weeks at worst with little to no breakage. These days that’s even easier because a lot of pieces got modularised and separated as part of the work done in Project Treble.


  • It depends on the problem, language, framework and what the options are. If at all possible, write stuff without touching upstream code. If you’re working in a modular, pluggable system, there’s a lot you can do this way. In Android specifically, you can do a lot by writing components that plug into the Intent framework. When it comes to modifying upstream code, you use whatever facilities the programming language offers to minimize the lines of code changes. Ideally only modify upstream code by adding a single line in a module. E.g. write a separate Java module, import it into the upstream code and call it in a single new line in the appropriate block. Then do your work in your module, import and call additional things as needed. Surround the added line with consistent labels in comments. Enforce this in code review and ideally automation. When a code drop comes, git can often automerge such additions. When it can’t, the merge tools make it very clear where your changes are as they aren’t intermixed all over the upstream code, making the merge work easier. There were some clever tricks with branching that I don’t recall. You could even write your own tooling to help with any of this. There’s clever things you can do with the build systems too. None of this is too complicated that a competent software team can’t figure out if given the direction and time to do it.



  • There’s also difference in how much work the maintenance of forks is depending on how they implement new features. There are many ways and the easiest ones are typically the least maintainable. Designing those features in order to minimize maintenance work when new code drops from upstream can dramatically change the equation and therefore the fork viability. I’ve worked at an Android mobile OEM and dealt with code drops from Google and Qualcomm. Every OEM essentially maintains a fork of Android and deals with a massive set of changes with every Android release. Implementing stuff by straight modifying Android source files lead to huge maintenance workload. After going through a few code drop cycles we devised a set of strategies that drastically decreased the effort needed.