Enhancing and modifying_the_core_android_os
-
Upload
arnav-gupta -
Category
Mobile
-
view
166 -
download
0
description
Transcript of Enhancing and modifying_the_core_android_os
![Page 1: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/1.jpg)
Modifying and Enhancing the Core Android OS
Arnav Gupta
Student, DTUAndroid Framework Engineer, Cube26
![Page 2: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/2.jpg)
A little about myself . . .
![Page 3: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/3.jpg)
College
•Undergrad student, Electronics and Electrical Engineering, Delhi Technological University.
• Expecting to graduate in 2016, (if I can survive college for another 2 years)
![Page 4: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/4.jpg)
Work – Cube26
• Joined - March ‘14• Android Framework Engineer•Working on projects of various clients like Micromax, LAVA, Intex•Developing and integrating smart gesture based interaction methods into Android OS.• Smart lockscreens, enhanced camera modes for phones like Micromax Canvas A290, A310.
![Page 5: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/5.jpg)
Work – Open Source Community
• Contributor and developer on community modded ROMs like CyanogenMod and AOKP•Open source development partner with Sony Mobile•Making latest open source Android stack work on Sony Xperia phones.•Developing various software-based features for these modified versions of Android.
![Page 6: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/6.jpg)
Understanding the Android OS
![Page 7: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/7.jpg)
![Page 8: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/8.jpg)
Applications
• Everything opened from an icon on the launcher is an app• Almost every user-facing
interface in Android is an app• Very generic in nature, and
rarely interdependent. • Bundled in the form of .apk
files, like we can get from the Play Store.
![Page 9: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/9.jpg)
Framework : SystemUI
• Lockscreen, Status bar, Notification pane, Navigation bar• Defines how Toasts, Dialog
boxes look like• Lays out the basic look and
feel of the UI. • Packaged as .apk, but is
device-dependent, and not 100% generic.
![Page 10: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/10.jpg)
• User’s do not interact directly.
• To be used by 3rd party apps
• Access to various data, hardware, sensors, media, audio, graphics etc of the device.
• Provides app developers uniform methods to interact with lower stacks of the OS.
• Media, graphics, audio etc implementation could be significantly different across different hardware.
• Provide and regulate access to contents and services present on the device.
Framework : Providers & APIs
![Page 11: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/11.jpg)
• An implementation much similar to the Java Virtual Machine.
• Dalvik – older runtime. Now being superseded by a newer Android Runtime from Android L.
• Executes bytecode. Dalvik bytecode very much similar to java bytecode.
• All applications, including the Framework, run on the Dalvik VM. Each process is a fork of zygote.
Dalvik / Android Runtime
![Page 12: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/12.jpg)
• Android contains a set of dynamically linkable libraries (.so files, much like .dll of Windows) which are required for various purposes.
• Libraries like libc contain core functions, used by almost every process. There are OpenGLES libs for graphics, security and cryptography related libs like libcrypto, libssl. Almost all hardware related subsystems are accessible by Hardware Abstraction Layer libs.
• Apps are provided the features of libraries via the APIs of the framework. Native code can link to them directly.
Libraries
![Page 13: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/13.jpg)
• Based on the Linux kernel, with a few differences in implementation of memory and power management.
• CPU, IO, Crypto, Audio, Video etc are all same as mainline Linux kernel.
• A major difference – absence of root rights to human users, and read-only mode of /data partition
• The directory structure is pretty different from usual Linux distros, divided into /system, /data, and /cache partitions.
Kernel
![Page 14: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/14.jpg)
Building Android for your Phone
![Page 15: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/15.jpg)
• 64-bit Linux or Mac, with minimum 4GB RAM. More the horsepower, faster the build.
• Upwards of 40GB of free space. SSD recommended over conventional HDD
• Sun/Oracle Java 6 JDK for building Android 4.4.4 or below. Android L can be built with OpenJDK 7
https://source.android.com/source/initializing.html
Getting a build machine ready
![Page 16: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/16.jpg)
• About 9GB of source code for Android Kitkat.
• Spread across 400+ separate git repositories.
• Each app is maintained independently. The framework is one large repository. All Apache licensed.
• Most library stacks are independently maintained. Many derived from original GNU/Linux libraries, and modified to suit needs of Android.
https://source.android.com/source/downloading.html
Downloading the source
![Page 17: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/17.jpg)
• The linux kernel, over 150 libraries, 30+ apps, and the android runtime and various framework packages built and compressed into a ~250MB package.
• A makefile driven process, with no role of any IDE.
• Device and platform specific builds ( staying true to it's embedded linux roots ) that are not cross-compatible with other devices.
https://source.android.com/source/building-running.html
Building the Android OS
![Page 18: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/18.jpg)
What can be modified ? And how ?
![Page 19: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/19.jpg)
• Basic apps like Phone, Contacts, Mms, Launcher, Browser, Settings, Camera are part of the base OS.
• Functional additions, visual changes, or improved UX in these apps are used as differentiating factor by OEM-built Android flavours like TouchWiz, Sense, MotoBlur or MIUI.
• App developers with few months of experience can start taking a crack at this.
Modifying Android : Apps
![Page 20: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/20.jpg)
• Improve UX by rethinking the core components like notifications, lockscreen, navigation bar, recents.
• Refresh the look and feel by redesigning the UI components and theme/style elements.
• Extend the ecosystem by adding your own APIs. Get 3rd party developers onto your ecosystem.
• More experiences Android developers with deeper understanding of underlying APIs can start off.
Modifying Android : Framework
![Page 21: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/21.jpg)
• Lower level feature addition – often accompanied with development of superior hardware technologies.
• Common examples include HDR mode photography, audio equalisers and enhancements, high senstivity touchscreens for glove mode.
• Improving algorithms for accuracy and sensitivity for sensors.
Modifying Android : HAL & Libraries
![Page 22: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/22.jpg)
• Interesting low-level implementations like ringing Alarm in switched-off phone.
• Add support for custom hardware like heart rate sensor, IR blaster etc.
• Improve performance, extend battery life – writing efficient CPU/GPU governors, schedulers.
• Typical playground for (Embedded) Linux enthusiasts.
Modifying Android : Kernel
![Page 23: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/23.jpg)
A look at Open Source Community maintained Custom Android
distributions : AOKP
CyanogenModParanoidAndroid
![Page 24: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/24.jpg)
![Page 25: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/25.jpg)
![Page 26: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/26.jpg)
![Page 27: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/27.jpg)
![Page 28: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/28.jpg)
![Page 29: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/29.jpg)
![Page 30: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/30.jpg)
![Page 31: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/31.jpg)
![Page 32: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/32.jpg)
![Page 33: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/33.jpg)
![Page 34: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/34.jpg)
![Page 35: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/35.jpg)
![Page 36: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/36.jpg)
![Page 37: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/37.jpg)
![Page 38: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/38.jpg)
![Page 39: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/39.jpg)
![Page 40: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/40.jpg)
![Page 41: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/41.jpg)
![Page 42: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/42.jpg)
![Page 43: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/43.jpg)
![Page 44: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/44.jpg)
![Page 45: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/45.jpg)
![Page 46: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/46.jpg)
![Page 47: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/47.jpg)
![Page 48: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/48.jpg)
![Page 49: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/49.jpg)
![Page 50: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/50.jpg)
![Page 51: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/51.jpg)
![Page 52: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/52.jpg)
![Page 53: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/53.jpg)
![Page 54: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/54.jpg)
![Page 55: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/55.jpg)
![Page 56: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/56.jpg)
![Page 57: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/57.jpg)
![Page 58: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/58.jpg)
![Page 59: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/59.jpg)
![Page 60: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/60.jpg)
![Page 61: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/61.jpg)
![Page 62: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/62.jpg)
![Page 63: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/63.jpg)
![Page 64: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/64.jpg)
![Page 65: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/65.jpg)
![Page 66: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/66.jpg)
![Page 67: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/67.jpg)
![Page 68: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/68.jpg)
![Page 69: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/69.jpg)
![Page 70: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/70.jpg)
![Page 71: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/71.jpg)
Cube26 feature preview
![Page 72: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/72.jpg)
![Page 73: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/73.jpg)
![Page 74: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/74.jpg)
![Page 75: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/75.jpg)
• Founded by three Indians who met while studying at Cornell University. Now operates out of Santa Clara and New Delhi.
• Vision : “Making smart devices smarter”
• Creating smart gesture based features for 6 leading Indian smartphone manufacturers, inculding Micromax, Intex.
• More than 1 million devices shipped with features developed by Cube26 integrated
Cube26 : The company
![Page 76: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/76.jpg)
Cube26 : The company
![Page 77: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/77.jpg)
• Currently working on integrating various natural gesture recognition and contextual action based features with Android.
• A growth stage startup. Hiring talented professionals in the fields of Android development and UI/UX design.
Reach out to : [email protected]
Cube26 : The company
![Page 78: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/78.jpg)
Contribute back to Google's Android Open Source Project
(AOSP)
![Page 79: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/79.jpg)
• Android is maintained across 400+ git repositories. Besides the platform, the ADT, Android Studio, the ARM GCC cross compiler are also part of the Android Open Source Project.
• Code submissions pass through a code review server called gerrit. Gerrit is a git code review software written by Google to manage projects like Android and Chromium.
https://android-review.googlesource.com
Source control in Android
![Page 80: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/80.jpg)
• Google tends to take only bugfixes from the community. UX/UI features are developed in-house, and code is dropped only during major releases. (there are exceptions)
• Patches must be verified by the automatic buildbot, and approved by at least one member from the Android team.
• Moderate to advanced knowledge of git and gerrit is essential to submit patches. (often involves rebasing and manual conflict resolving).
Submitting patches to Google
![Page 81: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/81.jpg)
![Page 82: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/82.jpg)
![Page 83: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/83.jpg)
Compatibility : A tiny caveat
![Page 84: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/84.jpg)
• Android can be modified to any extent wanted.
• Beyond certain constraints, modifications may not remain compatible.
• Compatibility is defined by Google as per the CDD (Compatibility Definition Document)
• Compatibility Test Suite and CTS Verifier - set of tests designed to test compatibility.
• Non-compliance with CDD disqualifies the OS to be called as “Android”.
Staying compatible with Android
![Page 85: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/85.jpg)
• Providing uniform and stable environment to 3rd party app developers.
• Level playing field across the whole ecosystem.
• Reduce fragmentation
• Quality control of the Android brand.
• Ease of use and familarity for users.
Goals of compatibility
![Page 86: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/86.jpg)
• Encash the brand value of Android
• Benefit from a rich ecosystem ( 1M+ apps, 50K+ developers )
• Benefit from using Google's APIs and services.
• Reduce cost of maintenance of code.
• Build a unique identity while remainging part of a larger family.
Why remain compatible ?
![Page 87: Enhancing and modifying_the_core_android_os](https://reader033.fdocuments.us/reader033/viewer/2022061207/548409f15806b5b3588b458a/html5/thumbnails/87.jpg)
Arnav Gupta
@championswimm
er
championswimmer.
in