cyanogen platform sdk
TRANSCRIPT
![Page 1: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/1.jpg)
Cyanogen Inc. Proprietary & Confidential
Platform SDKby Adnan Begovic
![Page 2: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/2.jpg)
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.
![Page 3: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/3.jpg)
Cyanogen Inc. Proprietary & Confidential
Background
CyanogenMod User Base:● 50+ million users● Users in 190+ different countries● Localized to 50+ languages via automated crowdin
system
![Page 4: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/4.jpg)
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.
![Page 5: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/5.jpg)
Cyanogen Inc. Proprietary & Confidential
Developer Base
![Page 6: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/6.jpg)
Cyanogen Inc. Proprietary & Confidential
Crowdsourcing Android Development
![Page 7: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/7.jpg)
Cyanogen Inc. Proprietary & Confidential
An Example Community Contribution
![Page 8: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/8.jpg)
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
![Page 9: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/9.jpg)
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.
![Page 10: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/10.jpg)
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
![Page 11: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/11.jpg)
Cyanogen Inc. Proprietary & Confidential
Treehacks Experience
![Page 12: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/12.jpg)
Cyanogen Inc. Proprietary & Confidential
Treehacks FeedbackPositives 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
![Page 13: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/13.jpg)
Cyanogen Inc. Proprietary & Confidential
Treehacks Experience
- How to decrease the barrier to entry?
- How to extend the CM experience for 3rd party developers?
![Page 14: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/14.jpg)
Cyanogen Inc. Proprietary & Confidential
The Cyanogen Platform
![Page 15: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/15.jpg)
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
![Page 16: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/16.jpg)
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
![Page 17: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/17.jpg)
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
![Page 18: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/18.jpg)
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.
![Page 19: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/19.jpg)
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
![Page 20: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/20.jpg)
Cyanogen Inc. Proprietary & Confidential
Exploration for an API
Bike O’Clock● Using Quick Settings Tiles to surface commonly
used actions.
![Page 22: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/22.jpg)
Cyanogen Inc. Proprietary & Confidential
Using the SDK
Creating a CustomTile:
CustomTile customTile = new CustomTile.Builder(mContext)
.setLabel("custom label")
.setContentDescription("custom description")
.setOnClickIntent(pendingIntent)
.setOnSettingsClickIntent(intent)
.setOnClickUri(Uri.parse("custom uri"))
.setIcon(R.drawable.ic_launcher)
.build();
![Page 23: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/23.jpg)
Cyanogen Inc. Proprietary & Confidential
Using the SDK
![Page 24: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/24.jpg)
Cyanogen Inc. Proprietary & Confidential
Using the SDK
Publishing: CMStatusBarManager.getInstance(this)
.publishTile(CUSTOM_TILE_ID, mCustomTile);
Removing: CMStatusBarManager.getInstance(this)
.removeTile(CUSTOM_TILE_ID, mCustomTile);
Requires: <uses-permission android:name="cyanogenmod.permission.PUBLISH_CUSTOM_TILE" />
![Page 25: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/25.jpg)
Cyanogen Inc. Proprietary & Confidential
Contributing
![Page 26: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/26.jpg)
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
![Page 27: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/27.jpg)
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
![Page 28: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/28.jpg)
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
![Page 29: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/29.jpg)
Cyanogen Inc. Proprietary & Confidential
Contribute New APIs & Write More Functional Apps
![Page 30: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/30.jpg)
Cyanogen Inc. Proprietary & Confidential
Questions?
Join the G+ Community: http://bit.ly/1FC6lJI
![Page 31: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/31.jpg)
Cyanogen Inc. Proprietary & Confidential
Appendix for QA
![Page 32: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/32.jpg)
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
![Page 33: Cyanogen Platform SDK](https://reader034.vdocuments.us/reader034/viewer/2022042504/55cd25fbbb61eb62068b467a/html5/thumbnails/33.jpg)
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