SlideShare a Scribd company logo
How to Customize Android Framework&System
Noritsuna Imamura
noritsuna@siprop.org

©SIProp Project, 2006-2008

1
Agenda
How to Customize Android Framework&System
Add Own API to Android Framework&System
Make Own SDK

©SIProp Project, 2006-2008

2
About Android
Android Framework has 3 Layer Stack for
SmartPhone & Tablet PC.
Application Framework Layer (Java)
Library Layer (Linux C/C++)
Kernel/Driver Layer (Linux Kernel C/ASM)

©SIProp Project, 2006-2008

3
Structure of out dir
target/common/obj/
APPS
APK

JAVA_LIBRARIES
API

PACKAGING
Files Nothing...

target/product/flo/
boot.img
kernel
ramdisk.img
root

ramdisk-recovery.img
recovery.img
recovery

system.img
system

userdata.img
data

cache.img
cache

©SIProp Project, 2006-2008

4
What’s Fastboot?
Fastboot is ROM Manager for eMMC.
eMMC is managed by Address in Low Lovel.
When you write your Kernel, you MUST point kernel address.
If you mistake kernel address, your system is broken…

Separated by
Address

©SIProp Project, 2006-2008

5
About Android Source Code
packages
App for Android

frameworks
Lib for Android Apps

system
Sys Lib for Framework

docs
Java Doc for Android

developers
Sample, Demos

build
Tool for Android Build

prebuilts
Toolchain

sdk
Android SDK

ndk
Native SDK

pdk
for 3rd Party SDK

cts
Compatibility Test

tools
Tools for External 2006-2008
©SIProp Project,

6
About Android Source Code
external
Linux Lib

libcore
Lib for Android

bionic
libc for Android

device
Diff for Devices

hardware
Drivers

bootable
BootLoader

libnativehelper
Helper for JNI

abi
Application Binary Interface

dalvik
Java VM

art
Next Generation VM

©SIProp Project, 2006-2008

7
Customized Android System(ROM)

©SIProp Project, 2006-2008

8
What’s Nexus7?
Target
Tablet
Nexus7(2013)
http://www.google.com/
nexus/7/

OS
JCROM
With Build Manual
https://sites.google.com/
site/jcromproject/

©SIProp Project, 2006-2008

9
Customized UI/UX
Modify Android System
View
Animation
SystemUI
Home
Widget
Notification
Settings
etc…

©SIProp Project, 2006-2008

10
Application Framework Layer
APIs
App Components
User Interface
App Resources
Animation and
Graphics
Computation
Media and Camera
Location and Sensors
Connectivity
Text and Input

Data Storage
Administration
Web Apps
Best Practices

©SIProp Project, 2006-2008

11
How to Develop?
ADT
Standard Android
Application
Only Java on Application
Framework Layer

Advantage
Use All Android Tools
Many Docs from Google
Developer Site & Blogs

Call Stack
APK File(Your Application)
(Java)
Call as Java API

Application Framework
Layer (Java)
Call as JNI(C/C++)

Library Layer
(C/C++)
Call as SysCall(C/ASM
Kernel/Driver Layer
(C/ASM)Project, 2006-2008
©SIProp

12
How to Develop?
NDK w/ADT
Standard Android
Application for C/C++
Java on Application
Framework Layer
C/C++ on Limited Library
Layer

Call Stack
APK File(Your Application)
(Java & C/C++)
Call as Java API

Application Framework
Layer (Java)
Call as JNI(C/C++)

Advantage
Use Java&C/C++

Dis-Advantage
Must Use UI Framework
on Java Layer

Library Layer
(C/C++)
Call as SysCall(C/ASM
Kernel/Driver Layer
(C/ASM)Project, 2006-2008
©SIProp

13
How to Add New APIs

©SIProp Project, 2006-2008

14
Application Framework Layer
Packages by Android Framework
android.accessibilityservice
android.accounts
android.animation
android.app
android.app.admin
android.app.backup
android.appwidget
android.bluetooth
android.content
android.content.pm
android.content.res
android.database
android.database.sqlite
android.drm
android.gesture
android.graphics
android.graphics.drawable
android.graphics.drawable.shapes
android.graphics.pdf
android.hardware
android.hardware.display
android.hardware.input
android.hardware.location
android.hardware.usb
android.inputmethodservice
android.location
android.media
android.media.audiofx
android.media.effect
android.mtp
android.net

android.net
android.net.http
android.net.nsd
android.net.rtp
android.net.sip
android.net.wifi
android.net.wifi.p2p
android.net.wifi.p2p.nsd
android.nfc
android.nfc.cardemulation
android.nfc.tech
android.opengl
android.os
android.os.storage
android.preference
android.print
android.print.pdf
android.printservice
android.provider
android.renderscript
android.sax
android.security
android.service.dreams
android.service.notification
android.service.textservice
android.service.wallpaper

android.speech
android.text
android.speech.tts
android.text.format
android.support.v13.app
android.text.method
android.support.v4.accessibilityservice android.text.style
android.support.v4.app
android.text.util
android.support.v4.content
android.transition
android.support.v4.content.pm
android.util
android.support.v4.database
android.view
android.support.v4.graphics.drawable android.view.accessibility
android.support.v4.hardware.display
android.view.animation
android.support.v4.media
android.view.inputmethod
android.support.v4.net
android.view.textservice
android.support.v4.os
android.webkit
android.support.v4.print
android.widget
android.support.v4.text
dalvik.bytecode
android.support.v4.util
dalvik.system
android.support.v4.view
android.support.v4.view.accessibility
android.support.v4.widget
android.support.v7.app
android.support.v7.appcompat
android.support.v7.gridlayout
android.support.v7.media
android.support.v7.mediarouter
android.support.v7.view
android.support.v7.widget
android.support.v8.renderscript
android.telephony
android.telephony.cdma
android.telephony.gsm
android.test
android.test.mock
15
©SIProp Project, 2006-2008
android.test.suitebuilder
Goal
Add “Calculator” API into Android System
Package Name: itri.lecture
Class Name: Cal
Method
int add(int, int)
int sub(int, int)

Android System
Nexus7
AOSP based Android 4.3.1

©SIProp Project, 2006-2008

16
Source Code of MyAPI
Java
itri.lecture.Cal.java
Main Program
1. package itri.lecture;
2. public class Cal {
3.
public Cal() {}
4.
public static int add(int a, int b) {return a+b;}
5.
public
int sub(int a, int b) {return a-b;}
6. }

package.html, package-info.java
Appoint about Build Target Dir
1. <HTML><BODY>
2. MyAPI Test Class.
3. </BODY></HTML>
4. package itri.lecture;
©SIProp Project, 2006-2008

17
Makefile of MyAPI
Android.mk
Makefile for Android
BUILD_JAVA_LIBRARY => Make .jar Package
BUILD_SHARED_LIBRARY => Make .so Package
BUILD_STATIC_LIBRARY => Make .a file
BUILD_EXECUTABLE => Make ELF file (Executable file)
BUILD_DROIDDOC => Make JavaDoc
›

LOCAL_PATH := $(call my-dir)

›

include $(CLEAR_VARS)

›
›
›
›
›

LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core framework
LOCAL_JAVACFLAGS := $(local_javac_flags)
LOCAL_MODULE := myapi

›

include $(BUILD_JAVA_LIBRARY)

©SIProp Project, 2006-2008

18
Makefile of MyAPI
Common.mk
Used by Other .mk file besides MyAPI’s .mk .
Ex. Framework Base’s Android.mk
›
›
›
›

# List of source to build into the myapi
#
core-myapi-files := 
src/itri/lecture/Cal.java

›
›
›
›
›
›

# List of junit javadoc source files for Android public API
#
# $(1): directory for search (to support use from frameworks/base)
define myapi_to_document
$(core-myapi-files)
endef

CleanSpec.mk
Newer Clean steps must be at the end of the list.
©SIProp Project, 2006-2008

19
build/envsetup.sh
Helper Command Lib for Android Build
m

jgrep
Build from Top Dir

mm
Build from Current Dir

mmm [Target Dir]
Build from Target Dir

croot
Change Top Dir

Grep for Java Source
Code

resgrep
Grep for XML Source
Code

lunch
Choose Target Build

cgrep
Grep for C/C++ Source Code

©SIProp Project, 2006-2008

20
Setup Source Code of MyAPI
Copy to “framework” Directory

“framework/base” Directory

“framework/base/core” Directory

©SIProp Project, 2006-2008

21
Application Framework Layer
Packages by Android Framework
android.accessibilityservice
android.accounts
android.animation
android.app
android.app.admin
android.app.backup
android.appwidget
android.bluetooth
android.content
android.content.pm
android.content.res
android.database
android.database.sqlite
android.drm
android.gesture
android.graphics
android.graphics.drawable
android.graphics.drawable.shapes
android.graphics.pdf
android.hardware
android.hardware.display
android.hardware.input
android.hardware.location
android.hardware.usb
android.inputmethodservice
android.location
android.media
android.media.audiofx
android.media.effect
android.mtp
android.net

android.net
android.net.http
android.net.nsd
android.net.rtp
android.net.sip
android.net.wifi
android.net.wifi.p2p
android.net.wifi.p2p.nsd
android.nfc
android.nfc.cardemulation
android.nfc.tech
android.opengl
android.os
android.os.storage
android.preference
android.print
android.print.pdf
android.printservice
android.provider
android.renderscript
android.sax
android.security
android.service.dreams
android.service.notification
android.service.textservice
android.service.wallpaper

android.speech
android.text
android.speech.tts
android.text.format
android.support.v13.app
android.text.method
android.support.v4.accessibilityservice android.text.style
android.support.v4.app
android.text.util
android.support.v4.content
android.transition
android.support.v4.content.pm
android.util
android.support.v4.database
android.view
android.support.v4.graphics.drawable android.view.accessibility
android.support.v4.hardware.display
android.view.animation
android.support.v4.media
android.view.inputmethod
android.support.v4.net
android.view.textservice
android.support.v4.os
android.webkit
android.support.v4.print
android.widget
android.support.v4.text
dalvik.bytecode
android.support.v4.util
dalvik.system
android.support.v4.view
android.support.v4.view.accessibility
android.support.v4.widget
android.support.v7.app
android.support.v7.appcompat
android.support.v7.gridlayout
android.support.v7.media
android.support.v7.mediarouter
android.support.v7.view
android.support.v7.widget
android.support.v8.renderscript
android.telephony
android.telephony.cdma
android.telephony.gsm
android.test
android.test.mock
22
©SIProp Project, 2006-2008
android.test.suitebuilder
Add MyAPI’s Source Code Path
frameworks/base/Android.mk
Base System for Framework(API)
›
›
›
›
›
›

# Common sources for doc check and api check
common_src_files := 
$(call find-other-html-files, $(html_dirs)) 
$(addprefix ../../libcore/, $(call libcore_to_document,
$(LOCAL_PATH)/../../libcore)) 
$(addprefix ../../external/junit/, $(call junit_to_document,
$(LOCAL_PATH)/../../external/junit)) 
$(addprefix ../../frameworks/myapi/, $(call myapi_to_document,
$(LOCAL_PATH)/../../frameworks/myapi))

›
›

# include definition of junit_to_document
include external/junit/Common.mk

›
›

# include definition of myapi_to_document
include frameworks/myapi/Common.mk
©SIProp Project, 2006-2008

23
Set Target Product
build/target/product/mini.mk
build/target/product/core.mk
1. # Base modules (will move elsewhere,
previously user tagged)
2. PRODUCT_PACKAGES += 
3.
20-dns.conf 
4.
95-configured 
5.
am 
6.
myapi 

©SIProp Project, 2006-2008

24
Set Class Path
system/core/rootdir/init.rc
1.

export BOOTCLASSPATH
/system/framework/core.jar:/system/framework/corejunit.jar:/system/framework/bouncycastle.jar:/system/fram
ework/ext.jar:/system/framework/framework.jar:/system/fr
amework/telephony-common.jar:/system/framework/voipcommon.jar:/system/framework/mmscommon.jar:/system/framework/android.policy.jar:/system/
framework/services.jar:/system/framework/apachexml.jar:/system/framework/myapi.jar

build/core/dex_preopt.mk
1.
2.

# TODO: replace it with device's BOOTCLASSPATH
DEXPREOPT_BOOT_JARS := core:corejunit:bouncycastle:ext:myapi:framework:
©SIProp Project, 2006-2008

25
Make OTA image
Make OTA image
This OTA image is update image for Android.

›
›
›
›

cd ~/nexus_work/android/
source build/envsetup.sh
lunch aosp_flo-user
make otapackage

This file name is
aosp_flo-ota-eng.[your Linux’s User name].zip

©SIProp Project, 2006-2008

26
What’s Android OTA-Package
Android OTA-Package has ROM images.
boot.img
Kernel, Init, Minimam Linux

recovery.img
Recovery Manager Program

system.img
Android System

userdata.img
User Data

Separated by
Address
©SIProp Project, 2006-2008

27
How to Use New APIs

©SIProp Project, 2006-2008

28
No API on SDK…

©SIProp Project, 2006-2008

29
Setup API Version for MyAPI 1/2
development/sdk/api-versions.xml
1.
2.
3.
4.
5.

<class name="itri/lecture/Cal"
since="18">
<method name="&lt;init>()V" />
<method name="add(II)I" />
<method name="sub(II)I" />
</class>

©SIProp Project, 2006-2008

30
Setup API Version for MyAPI 2/2
prebuilts/sdk/api/18.txt
1. package itri.lecture {
2. public class Cal {
3.
ctor public Cal();
4.
method public int add(int, int);
5.
method public static int sub(int, int);
6. }
7. }

©SIProp Project, 2006-2008

31
Setup JavaDoc
build/core/droiddoc.mk
1.
2.
3.
4.

5.
6.
7.
8.
9.

10.

ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# Use android_stubs_current if LOCAL_SDK_VERSION is current and no
TARGET_BUILD_APPS.
LOCAL_JAVA_LIBRARIES := android_stubs_current
$(LOCAL_JAVA_LIBRARIES)
else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION)
$(LOCAL_JAVA_LIBRARIES)
endif
else
LOCAL_JAVA_LIBRARIES := core ext framework myapi
$(LOCAL_JAVA_LIBRARIES)
endif # LOCAL_SDK_VERSION

©SIProp Project, 2006-2008

32
Make MySDK
Make MySDK
›
›
›
›

cd ~/nexus_work/android/
source build/envsetup.sh
lunch sdk-eng
make sdk

This file name is
android-sdk_eng.[your Linux’s User name]_linux-x86.zip

©SIProp Project, 2006-2008

33
How to Use New APIs

©SIProp Project, 2006-2008

34
Copy SDK to your Environment
“sdk/platforms/android-4.3.1”
to your “sdk/platforms/”

©SIProp Project, 2006-2008

35

More Related Content

PDF
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
PPTX
Android audio system(audioplicy_service)
PDF
Embedded Android Workshop with Oreo
PPT
Android booting sequece and setup and debugging
PDF
Android Things : Building Embedded Devices
ODP
Q4.11: Porting Android to new Platforms
PDF
Embedded Android : System Development - Part IV (Android System Services)
PPTX
Camera 2.0 in Android 4.2
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Android audio system(audioplicy_service)
Embedded Android Workshop with Oreo
Android booting sequece and setup and debugging
Android Things : Building Embedded Devices
Q4.11: Porting Android to new Platforms
Embedded Android : System Development - Part IV (Android System Services)
Camera 2.0 in Android 4.2

What's hot (20)

PPTX
Android audio system(audioflinger)
PDF
Android Internals at Linaro Connect Asia 2013
PDF
Embedded Android : System Development - Part I
ODP
Embedded Android : System Development - Part III
PDF
Embedded Android : System Development - Part II (HAL)
PPTX
Android Booting Sequence
PDF
Understanding the Android System Server
PPTX
Overview of Android binder IPC implementation
PPTX
Android audio system(pcm데이터출력준비-서비스서버)
PDF
Android's Multimedia Framework
PDF
Inside Android's UI
PDF
Android Storage - Vold
PPT
Spring ppt
PPT
Applets
PDF
Explore Android Internals
PDF
Android Binder IPC for Linux
PDF
Android presentation
PPT
Android Audio System
PPT
U boot porting guide for SoC
PDF
Camera2 API, SHIM, and HAL 3.2 in Android 5.1
Android audio system(audioflinger)
Android Internals at Linaro Connect Asia 2013
Embedded Android : System Development - Part I
Embedded Android : System Development - Part III
Embedded Android : System Development - Part II (HAL)
Android Booting Sequence
Understanding the Android System Server
Overview of Android binder IPC implementation
Android audio system(pcm데이터출력준비-서비스서버)
Android's Multimedia Framework
Inside Android's UI
Android Storage - Vold
Spring ppt
Applets
Explore Android Internals
Android Binder IPC for Linux
Android presentation
Android Audio System
U boot porting guide for SoC
Camera2 API, SHIM, and HAL 3.2 in Android 5.1
Ad

Similar to How to Customize Android Framework&System (20)

PDF
Wifi Direct Based Chat And File Transfer Android Application
PDF
Lecture02web 140phpapp01
PDF
20IT601PE - Mobile Application Development PPT.pdf
ODP
Enhancing and modifying_the_core_android_os
PPT
UPDATED Application fundamentals lec 1 &2.ppt
PPT
Enhancing and modifying_the_core_android_os
PDF
01 02 - introduction - adroid stack
PDF
An Introduction To Android
PPT
Introduction to android sessions new
PPTX
architecture of android.pptx
PPTX
Android development classes in chandigarh : Big Boxx Academy
PPTX
Mobile Application Development
PPT
Google android os
PPT
Portinig Application, Drivers And Os
PPT
Google android os
PPTX
Chapter1
PPT
Android software stack
PPTX
Introduction to Android (before 2015)
PPT
My androidpresentation
PDF
Android Workshop Part 1
Wifi Direct Based Chat And File Transfer Android Application
Lecture02web 140phpapp01
20IT601PE - Mobile Application Development PPT.pdf
Enhancing and modifying_the_core_android_os
UPDATED Application fundamentals lec 1 &2.ppt
Enhancing and modifying_the_core_android_os
01 02 - introduction - adroid stack
An Introduction To Android
Introduction to android sessions new
architecture of android.pptx
Android development classes in chandigarh : Big Boxx Academy
Mobile Application Development
Google android os
Portinig Application, Drivers And Os
Google android os
Chapter1
Android software stack
Introduction to Android (before 2015)
My androidpresentation
Android Workshop Part 1
Ad

More from Industrial Technology Research Institute (ITRI)(工業技術研究院, 工研院) (20)

PPTX
オープンソース界隈の利用者や技術者から見たオープンソースEDAとは? What is open source EDA from the perspecti...
PPTX
ラズパイを使って作品を作ったらラズパイコンテストでKSY賞を貰って、さらに、文化庁メディア芸術祭で審査員推薦作品に選ばれてしまった件〜自作チップでラズパイ...
PPTX
PPTX
What is the world where you can make your own semiconductors?
PPTX
PPTX
Kernel/VMレイヤーを自分色に染める!By ISHI会
PPTX
Principle Representation of The 8 Qubits Quantum Computer by RaspberryPi
PPTX
The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3
PPTX
Self‐Contained SDR Grand Station with Raspberry Pi 3
PPTX
PPTX
PPTX
5000円で誰でも作れる新世代衛星地上局
オープンソース界隈の利用者や技術者から見たオープンソースEDAとは? What is open source EDA from the perspecti...
ラズパイを使って作品を作ったらラズパイコンテストでKSY賞を貰って、さらに、文化庁メディア芸術祭で審査員推薦作品に選ばれてしまった件〜自作チップでラズパイ...
What is the world where you can make your own semiconductors?
Kernel/VMレイヤーを自分色に染める!By ISHI会
Principle Representation of The 8 Qubits Quantum Computer by RaspberryPi
The Self-Contained SDR Satellite Grand Station with Raspberry Pi 3
Self‐Contained SDR Grand Station with Raspberry Pi 3
5000円で誰でも作れる新世代衛星地上局

Recently uploaded (20)

PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
KodekX | Application Modernization Development
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Modernizing your data center with Dell and AMD
PDF
Encapsulation theory and applications.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The Rise and Fall of 3GPP – Time for a Sabbatical?
KodekX | Application Modernization Development
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Modernizing your data center with Dell and AMD
Encapsulation theory and applications.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
NewMind AI Monthly Chronicles - July 2025
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf

How to Customize Android Framework&System

  • 1. How to Customize Android Framework&System Noritsuna Imamura noritsuna@siprop.org ©SIProp Project, 2006-2008 1
  • 2. Agenda How to Customize Android Framework&System Add Own API to Android Framework&System Make Own SDK ©SIProp Project, 2006-2008 2
  • 3. About Android Android Framework has 3 Layer Stack for SmartPhone & Tablet PC. Application Framework Layer (Java) Library Layer (Linux C/C++) Kernel/Driver Layer (Linux Kernel C/ASM) ©SIProp Project, 2006-2008 3
  • 4. Structure of out dir target/common/obj/ APPS APK JAVA_LIBRARIES API PACKAGING Files Nothing... target/product/flo/ boot.img kernel ramdisk.img root ramdisk-recovery.img recovery.img recovery system.img system userdata.img data cache.img cache ©SIProp Project, 2006-2008 4
  • 5. What’s Fastboot? Fastboot is ROM Manager for eMMC. eMMC is managed by Address in Low Lovel. When you write your Kernel, you MUST point kernel address. If you mistake kernel address, your system is broken… Separated by Address ©SIProp Project, 2006-2008 5
  • 6. About Android Source Code packages App for Android frameworks Lib for Android Apps system Sys Lib for Framework docs Java Doc for Android developers Sample, Demos build Tool for Android Build prebuilts Toolchain sdk Android SDK ndk Native SDK pdk for 3rd Party SDK cts Compatibility Test tools Tools for External 2006-2008 ©SIProp Project, 6
  • 7. About Android Source Code external Linux Lib libcore Lib for Android bionic libc for Android device Diff for Devices hardware Drivers bootable BootLoader libnativehelper Helper for JNI abi Application Binary Interface dalvik Java VM art Next Generation VM ©SIProp Project, 2006-2008 7
  • 9. What’s Nexus7? Target Tablet Nexus7(2013) http://www.google.com/ nexus/7/ OS JCROM With Build Manual https://sites.google.com/ site/jcromproject/ ©SIProp Project, 2006-2008 9
  • 10. Customized UI/UX Modify Android System View Animation SystemUI Home Widget Notification Settings etc… ©SIProp Project, 2006-2008 10
  • 11. Application Framework Layer APIs App Components User Interface App Resources Animation and Graphics Computation Media and Camera Location and Sensors Connectivity Text and Input Data Storage Administration Web Apps Best Practices ©SIProp Project, 2006-2008 11
  • 12. How to Develop? ADT Standard Android Application Only Java on Application Framework Layer Advantage Use All Android Tools Many Docs from Google Developer Site & Blogs Call Stack APK File(Your Application) (Java) Call as Java API Application Framework Layer (Java) Call as JNI(C/C++) Library Layer (C/C++) Call as SysCall(C/ASM Kernel/Driver Layer (C/ASM)Project, 2006-2008 ©SIProp 12
  • 13. How to Develop? NDK w/ADT Standard Android Application for C/C++ Java on Application Framework Layer C/C++ on Limited Library Layer Call Stack APK File(Your Application) (Java & C/C++) Call as Java API Application Framework Layer (Java) Call as JNI(C/C++) Advantage Use Java&C/C++ Dis-Advantage Must Use UI Framework on Java Layer Library Layer (C/C++) Call as SysCall(C/ASM Kernel/Driver Layer (C/ASM)Project, 2006-2008 ©SIProp 13
  • 14. How to Add New APIs ©SIProp Project, 2006-2008 14
  • 15. Application Framework Layer Packages by Android Framework android.accessibilityservice android.accounts android.animation android.app android.app.admin android.app.backup android.appwidget android.bluetooth android.content android.content.pm android.content.res android.database android.database.sqlite android.drm android.gesture android.graphics android.graphics.drawable android.graphics.drawable.shapes android.graphics.pdf android.hardware android.hardware.display android.hardware.input android.hardware.location android.hardware.usb android.inputmethodservice android.location android.media android.media.audiofx android.media.effect android.mtp android.net android.net android.net.http android.net.nsd android.net.rtp android.net.sip android.net.wifi android.net.wifi.p2p android.net.wifi.p2p.nsd android.nfc android.nfc.cardemulation android.nfc.tech android.opengl android.os android.os.storage android.preference android.print android.print.pdf android.printservice android.provider android.renderscript android.sax android.security android.service.dreams android.service.notification android.service.textservice android.service.wallpaper android.speech android.text android.speech.tts android.text.format android.support.v13.app android.text.method android.support.v4.accessibilityservice android.text.style android.support.v4.app android.text.util android.support.v4.content android.transition android.support.v4.content.pm android.util android.support.v4.database android.view android.support.v4.graphics.drawable android.view.accessibility android.support.v4.hardware.display android.view.animation android.support.v4.media android.view.inputmethod android.support.v4.net android.view.textservice android.support.v4.os android.webkit android.support.v4.print android.widget android.support.v4.text dalvik.bytecode android.support.v4.util dalvik.system android.support.v4.view android.support.v4.view.accessibility android.support.v4.widget android.support.v7.app android.support.v7.appcompat android.support.v7.gridlayout android.support.v7.media android.support.v7.mediarouter android.support.v7.view android.support.v7.widget android.support.v8.renderscript android.telephony android.telephony.cdma android.telephony.gsm android.test android.test.mock 15 ©SIProp Project, 2006-2008 android.test.suitebuilder
  • 16. Goal Add “Calculator” API into Android System Package Name: itri.lecture Class Name: Cal Method int add(int, int) int sub(int, int) Android System Nexus7 AOSP based Android 4.3.1 ©SIProp Project, 2006-2008 16
  • 17. Source Code of MyAPI Java itri.lecture.Cal.java Main Program 1. package itri.lecture; 2. public class Cal { 3. public Cal() {} 4. public static int add(int a, int b) {return a+b;} 5. public int sub(int a, int b) {return a-b;} 6. } package.html, package-info.java Appoint about Build Target Dir 1. <HTML><BODY> 2. MyAPI Test Class. 3. </BODY></HTML> 4. package itri.lecture; ©SIProp Project, 2006-2008 17
  • 18. Makefile of MyAPI Android.mk Makefile for Android BUILD_JAVA_LIBRARY => Make .jar Package BUILD_SHARED_LIBRARY => Make .so Package BUILD_STATIC_LIBRARY => Make .a file BUILD_EXECUTABLE => Make ELF file (Executable file) BUILD_DROIDDOC => Make JavaDoc › LOCAL_PATH := $(call my-dir) › include $(CLEAR_VARS) › › › › › LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_NO_STANDARD_LIBRARIES := true LOCAL_JAVA_LIBRARIES := core framework LOCAL_JAVACFLAGS := $(local_javac_flags) LOCAL_MODULE := myapi › include $(BUILD_JAVA_LIBRARY) ©SIProp Project, 2006-2008 18
  • 19. Makefile of MyAPI Common.mk Used by Other .mk file besides MyAPI’s .mk . Ex. Framework Base’s Android.mk › › › › # List of source to build into the myapi # core-myapi-files := src/itri/lecture/Cal.java › › › › › › # List of junit javadoc source files for Android public API # # $(1): directory for search (to support use from frameworks/base) define myapi_to_document $(core-myapi-files) endef CleanSpec.mk Newer Clean steps must be at the end of the list. ©SIProp Project, 2006-2008 19
  • 20. build/envsetup.sh Helper Command Lib for Android Build m jgrep Build from Top Dir mm Build from Current Dir mmm [Target Dir] Build from Target Dir croot Change Top Dir Grep for Java Source Code resgrep Grep for XML Source Code lunch Choose Target Build cgrep Grep for C/C++ Source Code ©SIProp Project, 2006-2008 20
  • 21. Setup Source Code of MyAPI Copy to “framework” Directory “framework/base” Directory “framework/base/core” Directory ©SIProp Project, 2006-2008 21
  • 22. Application Framework Layer Packages by Android Framework android.accessibilityservice android.accounts android.animation android.app android.app.admin android.app.backup android.appwidget android.bluetooth android.content android.content.pm android.content.res android.database android.database.sqlite android.drm android.gesture android.graphics android.graphics.drawable android.graphics.drawable.shapes android.graphics.pdf android.hardware android.hardware.display android.hardware.input android.hardware.location android.hardware.usb android.inputmethodservice android.location android.media android.media.audiofx android.media.effect android.mtp android.net android.net android.net.http android.net.nsd android.net.rtp android.net.sip android.net.wifi android.net.wifi.p2p android.net.wifi.p2p.nsd android.nfc android.nfc.cardemulation android.nfc.tech android.opengl android.os android.os.storage android.preference android.print android.print.pdf android.printservice android.provider android.renderscript android.sax android.security android.service.dreams android.service.notification android.service.textservice android.service.wallpaper android.speech android.text android.speech.tts android.text.format android.support.v13.app android.text.method android.support.v4.accessibilityservice android.text.style android.support.v4.app android.text.util android.support.v4.content android.transition android.support.v4.content.pm android.util android.support.v4.database android.view android.support.v4.graphics.drawable android.view.accessibility android.support.v4.hardware.display android.view.animation android.support.v4.media android.view.inputmethod android.support.v4.net android.view.textservice android.support.v4.os android.webkit android.support.v4.print android.widget android.support.v4.text dalvik.bytecode android.support.v4.util dalvik.system android.support.v4.view android.support.v4.view.accessibility android.support.v4.widget android.support.v7.app android.support.v7.appcompat android.support.v7.gridlayout android.support.v7.media android.support.v7.mediarouter android.support.v7.view android.support.v7.widget android.support.v8.renderscript android.telephony android.telephony.cdma android.telephony.gsm android.test android.test.mock 22 ©SIProp Project, 2006-2008 android.test.suitebuilder
  • 23. Add MyAPI’s Source Code Path frameworks/base/Android.mk Base System for Framework(API) › › › › › › # Common sources for doc check and api check common_src_files := $(call find-other-html-files, $(html_dirs)) $(addprefix ../../libcore/, $(call libcore_to_document, $(LOCAL_PATH)/../../libcore)) $(addprefix ../../external/junit/, $(call junit_to_document, $(LOCAL_PATH)/../../external/junit)) $(addprefix ../../frameworks/myapi/, $(call myapi_to_document, $(LOCAL_PATH)/../../frameworks/myapi)) › › # include definition of junit_to_document include external/junit/Common.mk › › # include definition of myapi_to_document include frameworks/myapi/Common.mk ©SIProp Project, 2006-2008 23
  • 24. Set Target Product build/target/product/mini.mk build/target/product/core.mk 1. # Base modules (will move elsewhere, previously user tagged) 2. PRODUCT_PACKAGES += 3. 20-dns.conf 4. 95-configured 5. am 6. myapi ©SIProp Project, 2006-2008 24
  • 25. Set Class Path system/core/rootdir/init.rc 1. export BOOTCLASSPATH /system/framework/core.jar:/system/framework/corejunit.jar:/system/framework/bouncycastle.jar:/system/fram ework/ext.jar:/system/framework/framework.jar:/system/fr amework/telephony-common.jar:/system/framework/voipcommon.jar:/system/framework/mmscommon.jar:/system/framework/android.policy.jar:/system/ framework/services.jar:/system/framework/apachexml.jar:/system/framework/myapi.jar build/core/dex_preopt.mk 1. 2. # TODO: replace it with device's BOOTCLASSPATH DEXPREOPT_BOOT_JARS := core:corejunit:bouncycastle:ext:myapi:framework: ©SIProp Project, 2006-2008 25
  • 26. Make OTA image Make OTA image This OTA image is update image for Android. › › › › cd ~/nexus_work/android/ source build/envsetup.sh lunch aosp_flo-user make otapackage This file name is aosp_flo-ota-eng.[your Linux’s User name].zip ©SIProp Project, 2006-2008 26
  • 27. What’s Android OTA-Package Android OTA-Package has ROM images. boot.img Kernel, Init, Minimam Linux recovery.img Recovery Manager Program system.img Android System userdata.img User Data Separated by Address ©SIProp Project, 2006-2008 27
  • 28. How to Use New APIs ©SIProp Project, 2006-2008 28
  • 29. No API on SDK… ©SIProp Project, 2006-2008 29
  • 30. Setup API Version for MyAPI 1/2 development/sdk/api-versions.xml 1. 2. 3. 4. 5. <class name="itri/lecture/Cal" since="18"> <method name="&lt;init>()V" /> <method name="add(II)I" /> <method name="sub(II)I" /> </class> ©SIProp Project, 2006-2008 30
  • 31. Setup API Version for MyAPI 2/2 prebuilts/sdk/api/18.txt 1. package itri.lecture { 2. public class Cal { 3. ctor public Cal(); 4. method public int add(int, int); 5. method public static int sub(int, int); 6. } 7. } ©SIProp Project, 2006-2008 31
  • 32. Setup JavaDoc build/core/droiddoc.mk 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. ifneq ($(LOCAL_SDK_VERSION),) ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES) else LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES) endif else LOCAL_JAVA_LIBRARIES := core ext framework myapi $(LOCAL_JAVA_LIBRARIES) endif # LOCAL_SDK_VERSION ©SIProp Project, 2006-2008 32
  • 33. Make MySDK Make MySDK › › › › cd ~/nexus_work/android/ source build/envsetup.sh lunch sdk-eng make sdk This file name is android-sdk_eng.[your Linux’s User name]_linux-x86.zip ©SIProp Project, 2006-2008 33
  • 34. How to Use New APIs ©SIProp Project, 2006-2008 34
  • 35. Copy SDK to your Environment “sdk/platforms/android-4.3.1” to your “sdk/platforms/” ©SIProp Project, 2006-2008 35