AOSP builds and development for Sony devices
The Sony Open Devices Project (“SODP”) is very unique. We strive to create as much open-source components as possible. As opposed to other vendors - who turn a blind eye but could shut down custom ROM projects any time - the work happens with full legal backing from Sony Mobile.
In regognition of my contributions, Sony named me "Hero Open Source Developer" in 2019.Build and Project Work
- Feature and bug list management
- Policing issue tracker, triage
- Changelog and SODP-wide security bulletin
- Merging and testing of security patches
- Support at xda-developers, maintaining chat support groups
- Introducing and teaching new developers
- Treble compatibility
- SELinux policy (see down below)
- Restructuring, getting the device trees in orderly shape for faster iteration
- Improving the
- Kernel commits
- Adaptation to newer Android releases
- Tweaking performance settings and improving reliablitiy
I contribute to the Google-led Android Open Source Project (AOSP), OmniROM, LineageOS and many more. It's pretty fun to type your email into GitHub search and see how many hundreds of projects all have your changes.
If you have a device running Android 10 or higher, you already have some of my changes inside!AOSP Gerrit:
- packages/apps/Camera2: Rework permissions request flow ← major
- hardware/interfaces: Add interface info to .rc files ← major
- system/core: ld.config: Permit legacy /system/vendor paths
- build: soong_config: Include BOARD_VENDOR_SEPOLICY_DIRS
- build: fs_config: Fix cases without vendor/oem partition
- build: core/main: Strip bitness before existence check
- system/sepolicy: file_contexts: Include legacy /system/vendor paths
- hardware/interfaces: health: Add CAP_WAKE_ALARM to service
- packages/apps/Camera2: Dismiss keyguard when opening settings
- frameworks/base: topic: Add camera button long-press handling (pending)
- Expose Camera Lift Trigger in Gesture Settings: New setting, fwb: Enum, test coverage (pending)
- sepolicy+build+soong: topic: Support BOARD_SYSTEM_EXT* sepolicy
It can take months and tens of revisions to get a change accepted into AOSP. But it is quite rewarding to have your code running on potentially billions of devices!
I try to document as much of our work as possible so that we have a working form of knowledge management.
There is a Documentation section with more in-depth articles but also some references like an overview of all currently supported devices, and a Developer Diary section where smaller and day-to-day findings are noted down.Sample selection
- Building Android - The quintessential Open Devices intro
- Build Structure
- Security - Explaining some Android security concepts
- GPS HAL Adaptation - Porting log, helpful for would-be device maintainers
- Android Q: Compiling Kernels in-tree
- Android Q Changes
- Bluetooth Audio Debugging
- Debugging DAC_OVERRIDE
- Android Kernel Suspend Debugging and Tracing
- Debugging suspend ideas
One big issue is handling confidential information. Before any post goes public, it has to be cleared with the people whose work is mentioned, and anything touching non-public information and closed-source components has to have Sony eyes on it before release.
“Project Treble”-enabled AOSP builds
Project Treble is an initiative to allow vendors to more easily keep their devices updated with the latest Android versions, and thus keep their users secure. The device maker provides low-level interfaces from which the Android "system" can run, sort of like a container ship accepting any spec-conforming container. For more information, see this ArsTechnica article.
- Releases for Xperia XZ, XZs and Xperia X
- For a more technical explanation, read the Fake Treble for Xperia XZ article.
- Credit goes to @sjllls for the initial idea and implementation. I am using re-packaged oem binaries into a combined vendor and oem image, while sjllls re-purposes the cache partition as a vendor partition.
- Based on my work, people have started work on independent suzu builds, see the @suzu-treble project
Thanks to my contributions, SODP devices can run GSIs flawlessly, and my Treble builds allowed for running Android Q on the Xperia XZ on the day the first public GSI of Android Q was released.Sample commits
- device-sony-common: init: Update vendor services
- hardware-qcom-wlan: wcnss_service: Drop vendor build guard
- ExtendedSettings: Declare as PROPRIETARY_MODULE
- ExtendedSettings: adb & DRS: Use vendor-prefixed "compatible" props
- device-sony-common: common: Force split sepolicy on all shippping APIs
- device-sony-common: common.mk: Force split props for all devices
- device-sony-common: common: Simplify treble buildvars, add VNDK pkg
Part of the success of a great open source project is reaching new users and contributors. For that purpose, and because the official Sony pages tended not to be very inviting or were out of date, I set up a community page to encourage people to learn more about Open Devices. It acts as a central landing page for all people interested in the project and motivates them to actively participate.
The site is available at Open Devices Community Page and offers visitors the opportunity to discover builds for their devices, helps and encourages them to build AOSP for themselves and join the project, links to sister projects and guides people throughout the whole SODP ecosystem.Key points of interest:
SailfishOS for Xperia XZ
It was a lot of hard work figuring out the byzantine structure of the Sailfish project, but I managed to develop a working port for the Xperia XZ. The build system is not really aimed at hobbyists, but rather at vendors.
Instructions at sx.ix5.org: SailfishOS Installation on Xperia XZ.
Version: 22.214.171.124, using AOSP 8.1 and Kernel 4.4 as a base.
RIL, mobile data, bluetooth, sound, camera, sensors, video acceleration - all working.
Broadly speaking, SELinux policy is a mechanism to describe what programs are to be allowed which sets of actions. It helps make a lot of vulnerabilities less exploitable, but a bit of work is involved to observe and decide which actions are really necessary.
I got the SODP sepolicy ready for Android Pie, and subsequently Android 10. There were some dirty hacks and lots of mistakes in the process, but it is in a good state now.
- Vendor updates for Pie: ipacm, (vendor_)init, file labeling, misc
- PeripheralManager: Re-label as non-vendor type (temporarily), fix denials
- Vendor updates for Pie: Bluetooth, own domain for SODP apps
- Vendor updates for Pie: Sensors, Wi-Fi, properties
- PeripheralManager: Re-label as non-vendor type
- vendor_init: Fix /mnt/vendor/persist/ labels
SailfishOS documentation at foresail
Available at sx.ix5.org/foresail.
An effort to improve the horrendous documentation available for SailfishOS builders. Tries to cover Sailfish, mer, mer-hybris, halium, Android parts, Sailfish build tools and more.
Using a customized sphinx theme that resembles the "Just the Docs" jekyll theme.
Various commits. I've used marina-bay as an organization to gather repos for a quick Xperia XZ SailfishOS port.
- sailfishos/sdk-setup: sdk-manage: Compare snapshot to recent uninstalled
- mer-hybris/droid-hal-device: Rework buildmw() to use named arguments
- mer-hybris/droid-hal-device: helpers: Try to use $HABUILD_DEVICE for droidmedia and audioflingerglue
- mer-hybris/droid-hal-device: Add build_bootimg helper script (even featured in a Thesis...)
- mer-hybris/droid-hal-device: Omit droidmedia+audioflingerglue from libexec
Ubuntu Touch & Halium
Ubuntu Touch and the whole ubports project are great to work with. A vibrant and friendly community with a great focus on users. I've contributed to the installer and various other parts.
- ubports-installer: plugins: manual_download: Resolve copyFile promise
- installer-configs: v1/v2: dora,kagura: Add oem steps, cleanup
- devices.ubuntu-touch.io: Add kagura, kugo
Ubuntu Touch runs atop the Halium project, to which I've also contributed.
LineageOS contribs & builds
For testing, I built and distributed unofficial LineageOS test builds.
I've used afstamming as an organization to gather repos for an Xperia XZ LineageOS port.LineageOS Gerrit:
At SODP we try not to maintain forks of upstream repositories, we rather use a script to patch them. This saves resoures (less time wasted with merges) and explicitly helps keep track of what we've patched.
I made the script more accessible to newcomers and contributed a patch to allow developers to work fully offline, re-using downloaded data.
Lots of times, you need to write glue code to bridge layers of abstractions. I wrote a health HAL that reports battery and storage status to the higher layers in a HIDL-standardized way over the binder protocol.
With persistent storage for battery wear, measured in cycles and drop in capacity.
Universal Dual-SIM patcher for Sony devices
Saves bandwidth and storage by only having to create one build for both single- and dual-SIM devices.
Download and discussion at the Dual-SIM information page.
Big thanks to @oshmoun for the regex crafting!
ODM Version Checker
Contributed to ODMVersionCheck,
a small app for SODP which ensures the Software Binaries flashed to the
are always up to date.
New Android version bringsups
Commits that fix compatibility with newer revisions of Android.Android 10 bringup
- device-sony-sepolicy: Q compatibility and cleanup
- device-sony-common: Power: Add interface info to .rc
- device-sony-common: Change toybox run context, update selinux xattr
- device-sony-common: Move kernel includes to common.mk
- device-sony-common: common: Set BUILD_RECOVERY_IMAGE true
- repo_update: Update for Android Q/master, see also AOSP Gerrit: sodp-q-compat
- repo_update: fwb: Add ro.system fingerprint patch
- vendor-qcom-opensource-core-utils: fwk-detect: Drop libnativehelper includes
- device-sony-common: treewide: Replace COPY_HEADERS
- device-sony-common: Explicitly enable traditional boot.img
- device-sony-common: packages: Add protobuf vendorcompat lib
- device-sony-common: rootdir: usb.rc: Drop load_system_props
- device-sony-common: common-prop: Sync SurfaceFlinger props
- vendor-sony-oss-cash: Android.mk: Replace LOCAL_COPY_HEADERS
- local_manifests: qcom: Update CAF telephony to LA.UM.8.2.1.r1
Other Commits across SODP
These don't fit in anywhere else:
- vendor-sony-oss-cash: cash_input_common: Properly close threads
- kernel: [2.3.2.r1.4] tone: dts: Convert i2c_3 GPIOs to pinctrl
- kernel: [2.3.2.r1.4] dts: tone: Set sound gpio to low by default
- kernel: [2.3.2.r1.4] msm-jpegdma: Add V4L2_CAP_DEVICE_CAPS to caps
- kernel: [7.1.r1] Android.mk: 4.14 SOMC_KERNEL_VERSION guard
- kernel: [2.3.2.r1.4] dts: tone: Fix gpio_11 to 12 in somc_pinctrl_pmic
- kernel: (picked) [7.1.r1] dts: lilac: Add missing battery profiles
- kernel: (picked) fs: Improve eventpoll logging to stop indicting timerfd
- kernel: (picked) [126.96.36.199.r1.4] arm64: DT: Tone: Fix custom mapping for PM(I)8994 MPPs
- kernel: (picked) [LE.UM.2.3.2.r1.4] [SECURITY] perf: core: Avoid race condition when releasing perf-events
- kernel: (picked) [2.3.2.r1.4] msm: kgsl: Three patches from the Feb Android bulletin
- kernel: (picked) [7.1.r1] arm64: vdso32: Use full path to Clang instead of relying on PATH
- kernel-defconfig: [LA.UM.7.1.r1] base_msm8956: Enable MSMB_CAMERA
- kernel-techpack-audio: [LA.UM.7.1.r1] Kconfig: AVTIMER_LEGACY dep on MSMB_CAMERA AVTIMER
- kernel-defconfig: [LA.UM.7.1.r1] base_msm8996: Enable MSMB_CAMERA
- device-sony-common: init: Boot DSP before SLPI again
- device-sony-common: init: Enable adsprpcd instead of starting
- device-sony-common: init: Force restorecon for /mnt/vendor/persist
- device-sony-common: common-perm: Remove obsolete extension perm xml
- device-sony-tone: init: Limit MTP rx/tx buffers to 16384
- device-sony-common: vintf: Align NFC
- device-sony-common: tftp_symlinks: Use updated persist and fw targets
- device-sony-common: General cleanup
- QcRilAm: QcRilAmService: Wait for IQcRilAudio to be up
- device-sony-common: odm: Add build.prop cleaner, odm: Only leave ro.odm.expect in build.prop
- harware-qcom-display: [LA.UM.8.1.r1] No more COPY_HEADERS, default c++ std, CleanSpec, cleanups
- device-sony-sepolicy: New BSP fixes
- device-sony-sepolicy: radio: Allow finding qti uce service
All pull requests by me: author:ix5.
Debloating scripts for Stock Oreo
Credits to the AROMA creator and @korom42 for creating the base Stock Light ROM Patch.
Available for Xperia XZ on .184 and .192 stock firmware.