2. Cyanogen Inc. Proprietary & Confidential
Background
What is CyanogenMod?
CyanogenMod (pronounced /saɪ.ˈæn.oʊ.ˌdʒɛn.mɒd/),
usually abbreviated to CM, is an open-source operating
system for smartphones and tablet computers, based on
the Android mobile platform. It is developed as free and
open source software based on the official releases of
Android by Google, with added original and third-party
code. It is based on a rolling release development model.
3. Cyanogen Inc. Proprietary & Confidential
Background
CyanogenMod User Base:
● 50+ million users
● Users in 190+ different countries
● Localized to 50+ languages via automated crowdin
system
4. Cyanogen Inc. Proprietary & Confidential
Background
CyanogenMod Developer base:
● Numerous active core developers/maintainers
○ Maintain devices
○ Maintain documentation for features and device specs
○ Maintain and manage their own user bases
○ Maintain crowdin
○ File and resolve bugs reported by community users
● ~163 devices supported
● Receive a substantial amount of OSS contributions
from outside sources.
8. Cyanogen Inc. Proprietary & Confidential
Topics
● OS development is intimidating
● Treehacks Hackathon learnings
● Cyanogen Platform
○ Infrastructure
○ Framework library
○ SDK
○ Resource Package
● Using the SDK (QST examples)
● Contributing API’s
9. Cyanogen Inc. Proprietary & Confidential
Contributing to an OS
The Treehacks experience
Treehacks:
● 500+ person hackathon with students from all over the country.
● Workshops to get a meaningful contribution to the OSS project
CyanogenMod.
● Open to Stanford students, external students, and outside developers.
10. Cyanogen Inc. Proprietary & Confidential
Treehacks Experience
Winning Project: CyanTranslate
Using CyanogenMod, the winners modified the Android operating system and
created several new built-in features for manipulating text. By highlighting text
and hitting a button, the user can take advantage of these features. The new
features include:
Automatic translation between languages
● One-tap Google search
● UrbanDictionary definition lookup
● Book information lookup
12. Cyanogen Inc. Proprietary & Confidential
Treehacks Feedback
Positives Negatives
Open platform High ramp up time
Good infrastructure
● Gerrit Code Review
● Github mirroring
Massive code base
● ~1281 github repos
● 100+ android packages
● 25+ Gb repo size
Build environment documentation
● https://wiki.cyanogenmod.org
High barrier of entry in understanding
Android’s core implementations
13. Cyanogen Inc. Proprietary & Confidential
Treehacks Experience
- How to decrease the barrier to entry?
- How to extend the CM experience for 3rd party
developers?
15. Cyanogen Inc. Proprietary & Confidential
Cyanogen Platform
The new, more approachable, infrastructure:
● CyanogenMod Platform Library
● CyanogenMod Resource Package
● CyanogenMod Platform SDK
Application
Cyanogen
Platform SDK
Platform API
Core
Resource
Package
Android OS
16. Cyanogen Inc. Proprietary & Confidential
Cyanogen Platform Library
Framework library similar to Android’s Framework
JAR.
● Contains System Binder Services that get spun up and managed by
Android’s SystemServer.
● Contains the implementation, state management, and persisting of
data for a specific API feature.
● Leveraging Android’s powerful IPC framework for interaction between
an application and the system process.
Further information: Understanding the Structure
17. Cyanogen Inc. Proprietary & Confidential
Cyanogen Resource Package
Contains exported resources and CyanogenMod specific
permissions to be leveraged by the Application and
framework.
● ex:
○ cyanogenmod.permission.PUBLISH_CUSTOM_TILE
○ cyanogenmod_system_label
18. Cyanogen Inc. Proprietary & Confidential
Cyanogen Platform SDK
A library that can be included in your application to interact
with CM specific binder services to gain extra functionality.
● Provides objects, object builder’s, helper methods, and simple
interfaces to push or receive data from the platform library.
19. Cyanogen Inc. Proprietary & Confidential
Using the SDK
Custom Quick Tiles API Example:
● Allows your application to publish a Quick Tile to be hosted in the QS
Panel.
○ Patterns similar to Notification and NotificationManager
20. Cyanogen Inc. Proprietary & Confidential
Exploration for an API
Bike O’Clock
● Using Quick Settings Tiles to surface commonly
used actions.
26. Cyanogen Inc. Proprietary & Confidential
Making a change
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.1
repo sync
repo start changes vendor/cmsdk
https://www.github.com/CyanogenMod/cm_platform_sdk
27. Cyanogen Inc. Proprietary & Confidential
Contributing
Application
Cyanogen
Platform SDK
Platform API
Core
Community
API Core
gerrit (code review, unit tests)
Interface Changes
Unit Tests
SDK Methods
CTS
SDK methods
added to Platform
SDK project
API added along
side core
Interfaces added to
nightly builds
API Council (Change Control Board)
API Check-API
Android OS
28. Cyanogen Inc. Proprietary & Confidential
Contributing
Documentation generation is automated!
● make org.cyanogenmod.platform.sdk-docs
● Published directly from gerrit merge to github pages
Docs: http://cyanogenmod.github.io/cm_platform_sdk/reference/packages.html
32. Cyanogen Inc. Proprietary & Confidential
Security
vendor/cm/overlay
<!-- Defines external services to be started by the SystemServer at boot. The service itself
should publish as a binder services in its onStart -->
<string-array name="config_externalCMServices">
<item>org.cyanogenmod.platform.internal.CMStatusBarManagerService</item>
</string-array>
vendor/cm/sepolicy/servicecontexts
cmstatusbar u:object_r:system_server_service:s0
33. Cyanogen Inc. Proprietary & Confidential
Security
Selinux service_contexts
● service_contexts is used for translating service names into selinux labels.
● MAC check to the svc_can_register function in
service_manager.
https://android.googlesource.com/platform/frameworks/native/+/69154df