Your SlideShare is downloading. ×
0
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Anatomy of an android
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Anatomy of an android

1,711

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,711
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
60
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Anatomy of an Android 김용욱 (@dalinaum)
  • 2. Android Version● 1.5 Cupcake● 1.6 Donut● 2.0 2.1 Eclair● 2.2 Froyo (Frozen Yogurt)● 2.3.x Gingerbread (2.3.7)● 3.x Honeycomb (3.2) ....● 4.x Ice Cream Sandwich
  • 3.  
  • 4. 시작점● Anatomy & Physiology of an Android (2008 Google IO) ○ Patrick Brady (Google)● Inside the Android Application Framework (2008 GIO) ○ Dan Morill (Google)
  • 5. Linux Kernel 
  • 6. 리눅스 커널● 리눅스 커널 위에 동작하지만 리눅스는 아니다.● 리눅스의 표준 유틸리티를 사용하지 않는다.● 리눅스의 커널 버전은 크게 중요하지 않음.
  • 7. 리눅스 커널● 메모리, 프로세스 관리가 뛰어나다.● 퍼미션 기반의 보안 모델을 가지고 있다.● 오픈소스
  • 8. 리눅스 커널● Timed GPIO (Generic-purpose I/O)● Power Management● Ashmem (Anonymous shared memory)● Binder● Low Memory Killer● Kernel Debugger● Logger● Alarm
  • 9. Timed GPIO(generic purpose I/O)● Mike Lockwood (Google)● 일정 시간동안 사용자영역에서 GPIO에 접근하기 위해 열어 둔 인터페이스● 바이브레이터 등에 사용됨.●  drivers/staging/android/ ○ timed_output.[h|c] ○ timed_gpio.[h|c]
  • 10. Power Management● 작성자: Google (iSad...)● Suspend 전에 애플리케이션의 종료 기회 제공.● kernel/power/ 디렉토리에 위치 ○ suspend.c ○ userwakelock.c ○ earlysuspend.c ○ consoleearlysuspend.c ○ fbearlysuspend.c
  • 11. Ashmem (Anonymous shared memory)● Robert Love (Google, Ex-Noveller) ○  Linux Kernel Developmen의 저자 ○ Android의 Logger도 작성.● 여러 프로세스 간의 데이터 공유를 위함.● pmem과의 차이점은 "익명"이라는 점.● mm/ashmem.c
  • 12. Binder (Android IPC, like RPC)● Dianne Hackborn (Google, Ex-BeOSer)● Binder (BeOS) -> OpenBinder (Palm) -> Binder (Android)● RPC같은 IPC를 구현● driver/staging/android ○ binder.[h|c]
  • 13. Low memory killer● Arve Hjønnevåg (Google, Ex-BeOSer)● 리눅스 메모리관리 ○ 사용량이 많은 프로세스 희생. ○ 다수 프로세스를 살리는 데 있음.● 안드로이드 - 포그라운드 앱 우선 ○ 프로세스마다 현재 상태 기록.● driver/staging/android ○ lowmemorykiller.c
  • 14. Low memory killer example (init.rc)# Define the oom_adj values for the classes of processes that can be# killed by the kernel.  These are used in ActivityManagerService.   setprop ro.FOREGROUND_APP_ADJ 0   setprop ro.VISIBLE_APP_ADJ 1   setprop ro.SECONDARY_SERVER_ADJ 2   setprop ro.HIDDEN_APP_MIN_ADJ 7   setprop ro.CONTENT_PROVIDER_ADJ 14   setprop ro.EMPTY_APP_ADJ 15# Define the memory thresholds at which the above process classes will# be killed.  These numbers are in pages (4k).   setprop ro.FOREGROUND_APP_MEM 1536   setprop ro.VISIBLE_APP_MEM 2048   setprop ro.SECONDARY_SERVER_MEM 4096   setprop ro.HIDDEN_APP_MEM 5120   setprop ro.CONTENT_PROVIDER_MEM 5632   setprop ro.EMPTY_APP_MEM 6144
  • 15. HAL (Hardware Abstraction Layer) 
  • 16. HAL (Hardware Abstraction Layer)● 리눅스 커널 디바이스를 안드로이드로 부터 분리하기 위함● 라이선스 문제 ○ 리눅스 커널은 GPL - 공개해야 함. ○ 커널만 공개하고 하드웨어 드라이버 로직을 HAL로 분리 ○ Google과 Apple은 자신들이 원하는 내용만 공개.● 호환성 문제 ○ 안드로이드는 리눅스 커널 드라이버 구조를 몰라도 됨.
  • 17. Android Runtime 
  • 18. Dalvik● Dan Bornstein (Obvious Corp, Ex-Googler)● Dalvik - Dan이 살던 지명.● 레지스터 방식의 Java Virtual Machine. ○ Oracle(Sun) VM은 스택방식 ○ Oracle의 특허 회피 ○ ARM에 최적화.● DEX 포맷 사용 ○ JAR보다 용량 효율적.
  • 19. Libraries 
  • 20. Libraries● Bionic C (Shinichiro Kwasaki-Hitachi) ○ Non-GPL Lib C, Very small● WebKit (Don Melton-Apple, Martin Jones, Torben Weis) ○ KDE (KHTML) -> Apple (Webkit)● Media Framework (StageFright) ○ OpenCore (PV)  -> StageFright (Google, 보다 단순함)● SQLite (D. Richard Hipp-Hipp, Wyrick & Company, Inc.) ○ 경량 DB (앱에 내장 되는 형태) ○ 최근에는 LevelDB로 대체 움직임● Native Servers ○ SurfaceFlinger, AudioFlinger
  • 21. Native Servers 
  • 22. Application Framework 
  • 23. Application Framework● Core Platform Services● Hardware Services● Application Framework
  • 24. Core platform Services● Activity Manager● Package Manager● Window Manager● Resource Manager● Content Providers● View System
  • 25. What is Activity? 
  • 26.  
  • 27. Intent 
  • 28. Intent (URL을 액티비티으로 연결)<activity android:name=".MyActivity"><intent-filter><category android:name="android.intent.category.DEFAULT"/><category android:name="android.intent.category.BROWSABLE"/><data android:scheme="http" android:host="mysite.com android:pathPrefix="/news/articles/"/></intent-filter></activity> ● http://mysite.com/news/articles가 보이면 저기로 연결. ● 웹브라우저 (링크클릭) -> (링크에 대한 인텐트) -> 우리 앱 ● 안드로이드 앱은 액티비티로 서로 연결되어 있음. ● 전화가 왔을 때 인텐트를 확인하여 스팸이면 끊어버리는 앱.
  • 29. Looper & Message Queue 
  • 30. Fragment (Android 3.0 Honeycomb) 
  • 31.   
  • 32.  2 Fragments in 1 Activity
  • 33.  Action Bar - 현재 상태, 아이콘, 메뉴 
  • 34.  System Bar - 뒤로가기, 홈, 창 변환 버튼, 노티파이케이션.
  • 35.   
  • 36. Hardware Services● Telephony Service● Location Service● Bluetooth Service● WiFi Service● USB Service● Sensor Service● NFC Service (Android 2.3.3)
  • 37. Application Framework● RTFM ○ Read the fine manual, please :)
  • 38. Layer InteractionThere are 3 main flavors of Android layer cake: ● App -> Runtime Service -> Lib ● App -> Runtime Service -> Native Service -> Lib ● App -> Runtime Service -> Native Daemon -> Lib
  • 39. Layer InteractionThere are 3 main flavors of Android layer cake: ● App -> Runtime Service -> Lib ● App -> Runtime Service -> Native Service -> Lib ● App -> Runtime Service -> Native Daemon -> Lib
  • 40. Layer InteractionThere are 3 main flavors of Android layer cake: ● App -> Runtime Service -> Lib ● App -> Runtime Service -> Native Service -> Lib ● App -> Runtime Service -> Native Daemon -> Lib
  • 41. Make world● Official ○ AOSP (Android Open Source Project) ■ http://source.android.com/●  Custom ○  CyanogenMod (CM) ■ http://www.cyanogenmod.com/ ○  CodeAuroraForum (CAF) ■ https://www.codeaurora.org/● Groups ○  http://groups.google.com/group/android-contrib ○  http://groups.google.com/group/android-platform ○  http://groups.google.com/group/android-building
  • 42. RecommendCyanogenMod - de facto standard custom ROM
  • 43. Special Thanks to JBQ Jean-Baptiste Queru (Google)Thanks JBQ, who moves truck-loads of source code in andout of the Googleplex 
  • 44. Q&A

×