Marko Gargenta_Remixing android
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Marko Gargenta_Remixing android

on

  • 1,255 views

 

Statistics

Views

Total Views
1,255
Views on SlideShare
1,133
Embed Views
122

Actions

Likes
0
Downloads
41
Comments
0

2 Embeds 122

http://de.droidcon.com 121
http://wiki.onakasuita.org 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Marko Gargenta_Remixing android Document Transcript

  • 1. Remixing AndroidMarko Gargenta @Marakana
  • 2. About Marko Gargenta1.1. Entrepreneur, Author, Speaker Developer of Android Bootcamp for Marakana. Instructor for 1,000s of developers on Android at Qualcomm, Cisco, Motorola, Intel, DoD and other great orgs. Author of Learning Android published by O’Reilly. Speaker at OSCON (3x), ACM, IEEE, SDC, AnDevCon. Co-Founder of SFAndroid.org Co-Chair of Android Open conference: Android Open
  • 3. Why Remix Android??2.1. Vanilla is just not for everyone. r·i/ēmk/ emxrˈis: Vr: eb Mx(oehn)aan i smtig gi. Nu: on Adfeetvrino a oe oeaigsse poue i sc awy ifrn eso f n pn prtn ytm rdcd n uh a. Because Android is open Because custom is better Because we can
  • 4. Remix What?!?3.1. Cosmetics aside, we’re focusing on major surgery to Android OS. Registering New Device: Marakana Alpha Makefile Plumbing Building Alpha Device Adding Custom Kernel Adding Native Libs Adding Native Daemon Exposing Libs via JNI Registering New System Service Extending Android Framework Adding New App Creating SDK Add-on
  • 5. Android Stack: The High Level Overview
  • 6. Android Stack: From Source to Device
  • 7. Android Stack: Layer Interaction
  • 8. Interaction Between Apps
  • 9. Marakana Alpha
  • 10. Getting the AOSP Source Initialize the build environment Download the source Build the source Run on device
  • 11. Setting up the Directory StructureSelf-contained directory structure: d v c / a a a a : Main eiemrkn/ placeholder for Marakana Alpha codebase. d v c / a a a a a p a Code eiemrkn/lh: that goes onto the device. d v c / a a a a a p a s k a d n Code eiemrkn/lh-d_do: that goes into the SDK add-on. d v c / a a a a a p a c m o : Shared eiemrkn/lh-omn codebase for device and SDK add-on.
  • 12. Registering Marakana Alpha11.1. To future-proof your changes, don’t sprinkle other people’s code - keep itseparate. Create v n o s t p s file: edreu.h device/marakana/alpha/vendorsetup.sh adlnhcmofl_aaaaapaeg d_uc_ob ulmrkn_lh-n Rebuild the lunch menu: $suc bideveu.h ore ul/nstps icuigdvc/aaaaapavnostps nldn eiemrkn/lh/edreu.h icuigdvc/oosiga/edreu.h nldn eiemt/tnryvnostps icuigdvc/oownryvnostps nldn eiemt/iga/edreu.h icuigdvc/asn/rsogvnostps nldn eiesmugcep4/edreu.h icuigdvc/asn/rsovnostps nldn eiesmugcep/edreu.h icuigdvc/asn/auovnostps nldn eiesmugmgr/edreu.h icuigdvc/asn/oovnostps nldn eiesmugtr/edreu.h icuigdvc/asn/uavnostps nldn eiesmugtn/edreu.h icuigdvc/ipnavnostps nldn eiet/ad/edreu.h icuigskbs_opeinabbs nldn d/ahcmlto/d.ah
  • 13. Makefile Plumbing12.1. The make system is complex - copy from samples to get started. Create main product make file: dvc/aaaaapaAdodrdcsm eiemrkn/lh/nriPout.k POUTMKFLS: $LCLDR/ulapam RDC_AEIE = (OA_I)fl_lh.k Create the main build file: dvc/aaaaapafl_lh.k eiemrkn/lh/ulapam $cl ihrtpout $SCTRE_I)poutlnugssalm) (al nei-rdc, (R_AGTDR/rdc/agae_ml.k $cl ihrtpout $SCTRE_I)poutgnrcm) (al nei-rdc, (R_AGTDR/rdc/eei.k #Dsadihrtdvle adueoronised icr neie aus n s u w nta. POUTNM : fl_aaaaapa RDC_AE = ulmrkn_lh POUTDVC : apa RDC_EIE = lh POUTMDL: Fl Mrkn ApaIaefrEuao RDC_OE = ul aaaa lh mg o mltr icue$cl almkflsudr$LCLPT) nld (al l-aeie-ne,(OA_AH) Copy boiler-plate files from generic: $c bidtre/or/eei/orCni.k p ul/agtbadgnrcBadofgm dvc/aaaaapa. eiemrkn/lh/ $c bidtre/or/eei/nriBadm p ul/agtbadgnrcAdodor.k dvc/aaaaapa. eiemrkn/lh/ $c bidtre/or/eei/eiem p ul/agtbadgnrcdvc.k dvc/aaaaapa. eiemrkn/lh/ $c bidtre/or/eei/ytmpo p ul/agtbadgnrcsse.rp dvc/aaaaapa. eiemrkn/lh/
  • 14. Generating Platform Signing Keys13.1. To pass CTS, we must generate our own platform signing keys Define our subject/issuer info: $SGE=/=SS=aionaLSnFacsoOMrkn INR"CU/TClfri/=a rnic/=aaaa Ic/UAdodC=nri Pafr Sge/miAdesadodmrkn.o" n.O=nri/NAdod ltom inrealdrs=nri@aaaacm Remove the existing keys (it does not hurt to back them up first!): $r bidtre/rdc/euiy*p m ul/agtpoutscrt/.* Generate the platform key: $eh |dvlpettosmk_e bidtre/rdc/euiypafr co eeomn/ol/aeky ul/agtpoutscrt/ltom "SGE" $INR cetn bidtre/rdc/euiypafr.k wt n pswr raig ul/agtpoutscrt/ltomp8 ih o asod Gnrtn RApiaeky 24 btln mdls eeaig S rvt e, 08 i og ouu ..........++ ..........+ .............................++ .............................+ ei 3(x) s 03 Generate the shared key: $eh |dvlpettosmk_e bidtre/rdc/euiysae co eeomn/ol/aeky ul/agtpoutscrt/hrd "SGE" $INR cetn bidtre/rdc/euiysae.k wt n pswr raig ul/agtpoutscrt/hrdp8 ih o asod Gnrtn RApiaeky 24 btln mdls eeaig S rvt e, 08 i og ouu ........................................ ........................................ .........++ .........+ ......++ ......+ ei 3(x) s 03 Generate the media key: $eh |dvlpettosmk_e bidtre/rdc/euiymda co eeomn/ol/aeky ul/agtpoutscrt/ei "SGE" $INR cetn bidtre/rdc/euiymdap8wt n pswr raig ul/agtpoutscrt/ei.k ih o asod Gnrtn RApiaeky 24 btln mdls eeaig S rvt e, 08 i og ouu
  • 15. ..........+ .........++ ..........++ ..........+ ei 3(x) s 03Generate the testkey key: $eh |dvlpettosmk_e bidtre/rdc/euiytsky co eeomn/ol/aeky ul/agtpoutscrt/ete "SGE" $INR cetn bidtre/rdc/euiytskyp8wt n pswr raig ul/agtpoutscrt/ete.k ih o asod Gnrtn RApiaeky 24 btln mdls eeaig S rvt e, 08 i og ouu ..........++ ..........+ ........................++ ........................+ ei 3(x) s 03Verify that our keys have been created: $l - bidtre/rdc/euiy*p s 1 ul/agtpoutscrt/.* bidtre/rdc/euiymdap8 ul/agtpoutscrt/ei.k bidtre/rdc/euiymdax0.e ul/agtpoutscrt/ei.59pm bidtre/rdc/euiypafr.k ul/agtpoutscrt/ltomp8 bidtre/rdc/euiypafr.59pm ul/agtpoutscrt/ltomx0.e bidtre/rdc/euiysae.k ul/agtpoutscrt/hrdp8 bidtre/rdc/euiysae.59pm ul/agtpoutscrt/hrdx0.e bidtre/rdc/euiytskyp8 ul/agtpoutscrt/ete.k bidtre/rdc/euiytskyx0.e ul/agtpoutscrt/ete.59pmCheck that our specific subject/issuer has been used: $oeslx0 -ou -ujc -sur-n pns 59 not sbet ise i bidtre/rdc/euiypafr.59pm ul/agtpoutscrt/ltomx0.e sbet /=SS=aionaLSnFacsoOMrkn ujc= CU/TClfri/=a rnic/=aaaa Ic/UAdodC=nri Pafr Sge/miAdesadodmrkn.o n.O=nri/NAdod ltom inrealdrs=nri@aaaacm ise=/=SS=aionaLSnFacsoOMrkn sur CU/TClfri/=a rnic/=aaaa Ic/UAdodC=nri Pafr Sge/miAdesadodmrkn.o n.O=nri/NAdod ltom inrealdrs=nri@aaaacmThe b i d t r e / r d c / e u i y . k files are the private keys (. 5 9 p mare the ul/agtpoutscrt/p8 x0.ecertificates) - keep them safe and secure - especially since we did not encrypt them!
  • 16. Building Alpha Device14.1. Let’s build Alpha - so far a vanilla Android. Register the device with build system $suc bideveu.h ore ul/nstps icuigdvc/aaaaapavnostps nldn eiemrkn/lh/edreu.h … Choose lunch menu $lnhfl_aaaaapaeg uc ulmrkn_lh-n ====================== ====================== PAFR_ESO_OEAERL LTOMVRINCDNM=E PAFR_ESO=.. LTOMVRIN403 TRE_RDC=ulmrkn_lh AGTPOUTfl_aaaaapa TRE_UL_AIN=n AGTBIDVRATeg TRE_UL_YErlae AGTBIDTP=ees TRE_UL_PS AGTBIDAP= TRE_RHam AGTAC=r TRE_RHVRATam7a AGTAC_AIN=rv- HS_RHx6 OTAC=8 HS_Slnx OTO=iu HS_UL_YErlae OTBIDTP=ees BIDI=M7K UL_DIL4 ====================== ====================== Compile the device $epr UECAH= xot S_CCE1 $mk -1 ae j0 … Isaldfl ls:ottre/rdc/lh/ntle-ie.x ntle ie it u/agtpoutapaisaldflstt Tre sse f iae agt ytm s mg: ottre/rdc/lh/b/AKGN/ytmmg_nemdae/ytmig u/agtpoutapaojPCAIGsseiaeitreitssse.m Isalsse f iae ottre/rdc/lh/ytmig ntl ytm s mg: u/agtpoutapasse.m Run new device
  • 17. $euao -v Apa mltr ad lh -ytmottre/rdc/lh/ytmig sse u/agtpoutapasse.m -ads ottre/rdc/lh/ads.m rmik u/agtpoutaparmikigVerify build numberLook for the Build number property in System Settings→About phone screen.
  • 18. Marakana Alpha Custom Kernel
  • 19. Android Stack - Kernel
  • 20. Marakana Alpha Custom Kernel Steps17.1. Not everyone is going to need a custom kernel - but we can have it. Download and build kernel source $mdr~kre/ ki /enl $c ~kre/ d /enl $gtcoehts/adodgolsuc.o/enlglfs.i i ln tp:/nri.ogeorecmkre/odihgt $c glfs/ d odih $gtbac - i rnh a $gtceku - rmtsoii/nri-odih262 i hcot t eoe/rgnadodglfs-..9 $mk glfs_rv_ecni AC=r ae odiham7dfofg RHam $mk mncni ae euofg $mk -1 AC=r ae j0 RHam COSCMIE/OPpeul/iu-8/olhi/r-ai443bnameb- RS_OPL=AS/rbitlnxx6tocanameb-../i/r-ai Copy kernel into our device folder c /aht/enlac/r/otzmg dvc/aaaaapacmo/enl p pt/okre/rhambo/Iae eiemrkn/lh-omnkre Enable our custom kernel in BoardConfig.mk device/marakana/alpha/BoardConfig.mk … TRE_OKRE : fle AGTN_ENL = as … Create a alpha.mk makefile for our common components device/marakana/alpha-common/alpha.mk M_AH: $LCLPT)./lh-omn YPT = (OA_AH/.apacmo icue$cl alsbi-aeie) nld (al l-udrmkfls #Eal orcso kre nbe u utm enl LCLKRE : $M_AH/enl OA_ENL = (YPT)kre POUTCP_IE + $LCLKRE)kre RDC_OYFLS = (OA_ENL:enl
  • 21. Include a p a m in main makefile f l _ l h . k lh.k ulapamdevice/marakana/alpha/full_alpha.mk … icuedvc/aaaaapacmo/lh.k nld eiemrkn/lh-omnapamRebuild the device and restart the device with: $euao -v Apa mltr ad lh -enlottre/rdc/lh/enl kre u/agtpoutapakre -ytmottre/rdc/lh/ytmig sse u/agtpoutapasse.m -ads ottre/rdc/lh/ads.m rmik u/agtpoutaparmikigVerify it worked $abselct/rcvrin d hl a po/eso Lnxvrin262-aaaaeapeg09f (tdn@bnu (c vrin iu eso ..9mrkn-xml-bd3b suetuut) gc eso 440(C))# TeJl1 2:40 PT21 .. GC 5 u u 9 22:3 D 01
  • 22. Marakana Alpha Custom Lib
  • 23. Android Stack - Native Libraries
  • 24. Marakana Alpha Custom Lib Steps20.1. From drivers to open source libraries, you likely need custom libraries. Create home for shared libraries $mdrdvc/aaaaapacmo/i/ ki eiemrkn/lh-omnlb Create shared libs makefile device/marakana/alpha-common/lib/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkfls Create folder for l b r n o library imklg mdrdvc/aaaaapacmo/i/imklg ki eiemrkn/lh-omnlblbrno Create l b r n o . header file imklgh device/marakana/alpha-common/lib/libmrknlog/libmrknlog.h .. . etr itmk_ls_o(; xen n rnfuhlg) etr itmk_e_oa_o_ie) xen n rngtttllgsz(; etr itmk_e_sdlgsz(; xen n rngtue_o_ie) .. . Implement the library l b r n o . using i c l )to talk to kernel imklgc ot( device/marakana/alpha-common/lib/libmrknlog/libmrknlog.c Create the A d o d m makefile nri.k device/marakana/alpha-common/lib/libmrknlog/Android.mk LCLPT: $cl m-i) OA_AH= (al ydr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLSCFLS: lbrno. OA_R_IE = imklgc LCLSAE_IRRE : lbuislbtl lb OA_HRDLBAIS = ictl iuis ic LCLMDL : lbrno OA_OUE = imklg LCLPEIKMDL : fle OA_RLN_OUE = as
  • 25. icue$BIDSAE_IRR) nld (UL_HRDLBAYRegister the library with a p a m lh.kdevice/marakana/alpha-common/alpha.mk … POUTPCAE + lbrno RDC_AKGS = imklgTest l b r n o . obuilds imklgs $mk -1 lbrno ae j0 imklg … tre SaeLb lbrno agt hrdi: imklg (u/agtpoutgnrcojSAE_IRRE/imklgitreitsLNE ottre/rdc/eei/b/HRDLBAISlbrno_nemdae/IKD /imklgs) lbrno.o tre Nnpeikd lbrno agt o-rlne: imklg (u/agtpoutgnrcsmossse/i/imklgs) ottre/rdc/eei/ybl/ytmlblbrno.o tre Srp lbrno (u/agtpoutgnrcojlblbrno.o agt ti: imklg ottre/rdc/eei/b/i/imklgs) Isal ottre/rdc/eei/ytmlblbrno.o ntl: u/agtpoutgnrcsse/i/imklgs
  • 26. Marakana Alpha Native Daemon
  • 27. Android Stack - Native Daemons
  • 28. Marakana Alpha Native Daemon Steps23.1. It’s nice to have a native daemon look over your shoulder. Create folder for binaries $mdrdvc/aaaaapacmo/i ki eiemrkn/lh-omnbn $mdrdvc/aaaaapacmo/i/rnod ki eiemrkn/lh-omnbnmklg Create A d o d m for binaries nri.k device/marakana/alpha-common/bin/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkfls Create daemon source file m k l g . rnodc device/marakana/alpha-common/bin/mrknlogd/mrknlogd.c Create A d o d m file nri.k device/marakana/alpha-common/bin/mrknlogd/Android.mk LCLPT: $cl m-i) OA_AH= (al ydr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLSCFLS: mklg. OA_R_IE = rnodc LCLCICUE : $LCLPT)./.lblbrno/ OA__NLDS = (OA_AH/../i/imklg LCLSAE_IRRE : lbrno lb lbuislbtl OA_HRDLBAIS = imklg ic ictl iuis LCLMDL : mklg OA_OUE = rnod icue$BIDEEUAL) nld (UL_XCTBE Register m k l g with a p a m file rnod lh.k device/marakana/alpha-common/alpha.mk … POUTPCAE + mklg RDC_AKGS = rnod Create custom i i . cby using the default one ntr $c sse/oerodrii.cdvc/aaaaapacmo/ p ytmcr/oti/ntr eiemrkn/lh-omn.
  • 29. Register m k l g with i i . c rnod ntrdevice/marakana/alpha-common/init.rc … #Mrkn cso lgfuhn deo aaaas utm o-lsig amn sriemklg /ytmbnmklg 6 evc rnod sse/i/rnod 0 ue sse sr ytm goplg ru o oeht nsoInclude i i . cin our a p a m device build ntr lh.kdevice/marakana/alpha-common/alpha.mk … #Cp orii.cfl oe teeitn oe(ic or cnan eta oy u ntr ie vr h xsig n sne us otis xr cags hne) POUTCP_IE + $M_AH/ntr:otii.c RDC_OYFLS = (YPT)ii.cro/ntrBuild the device $mk -1 ae j0 … Isalsse f iae ottre/rdc/lh/ytmig ntl ytm s mg: u/agtpoutapasse.m Isaldfl ls:ottre/rdc/lh/ntle-ie.x ntle ie it u/agtpoutapaisaldflsttVerify it all works by restarting the device #(esatteeuao r)tr h mltr $euao -enlottre/rdc/lh/enl& mltr kre u/agtpoutapakre #wi frteeuao t fns at o h mltr o iih #cekotordeo hc u u amn $absell - /ytmbnmklg d hl s l sse/i/rnod -wrx- ro rx-rx ot sel hl 50 21-71 0:5mklg 58 010-3 22 rnod #cekta i rn hc ht t us $abselp |ge mklg d hl s rp rnod sse ytm 37 1 14 04 22 9 c02f adba S/ytmbnmklg 0508 f0dc sse/i/rnod $ablga |ge MK d oct rp RN IMK LgDeo( /RN o amn 3) Fuhdlg(,6 o 656bts.Wiig6 scns 7: lse o 1 0 f 53 ye) atn 0 eod bfr tenx fuh eoe h et ls. IMK LgDeo( /RN o amn 3) Fuhdlg(,346o 656bts.Wiig6 7: lse o 2 40 f 53 ye) atn 0 scnsbfr tenx fuh eod eoe h et ls. IMK LgDeo( /RN o amn 3) Fuhdlg(,22o 656bts.Wiig6 7: lse o 3 3 f 53 ye) atn 0
  • 30. scnsbfr tenx fuheod eoe h et ls.^C$ablga - d oct g/e/o/an rn bfe i 6K (K cnue) mxetyi 49b mxdvlgmi: ig ufr s 4b 0b osmd, a nr s 06, apyodi 47bala s 06#go :) od -
  • 31. Wrapping Native Lib with JNI
  • 32. Wrapping Native Lib with JNI Steps25.1. The glue for Java to talk to C and back. Create directory structure for our JNI wrapper $mdrdvc/aaaaapacmo/rmwr ki eiemrkn/lh-omnfaeok $mdrdvc/aaaaapacmo/rmwr/rno_n ki eiemrkn/lh-omnfaeokmklgji $mdrdvc/aaaaapacmo/rmwr/rno_n/aa ki eiemrkn/lh-omnfaeokmklgjijv $mdrdvc/aaaaapacmo/rmwr/rno_n/n ki eiemrkn/lh-omnfaeokmklgjiji Create top level A d o d m files nri.k device/marakana/alpha-common/framework/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkfls device/marakana/alpha-common/framework/mrknlog_jni/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkfls Create Java Library L b o . a a iLgjv dvc/aaaaapacmo/ eiemrkn/lh-omn faeokmklgjijv/o/aaaaadodlblgLbo.aa rmwr/rno_n/aacmmrkn/nri/i/o/iLgjv Create test M i . a a anjv dvc/aaaaapacmo/ eiemrkn/lh-omn faeokmklgjijv/o/aaaaadodlblgMi.aa rmwr/rno_n/aacmmrkn/nri/i/o/anjv Create custom permission device/marakana/alpha- common/framework/mrknlog_jni/java/com.marakana.android.lib.log.xml <xlvrin"."ecdn=uf8? ?m eso=10 noig"t-"> <emsin> prisos <irr nm=cmmrkn.nri.i.o" lbay ae"o.aaaaadodlblg fl=/ytmfaeokcmmrkn.nri.i.o.a"> ie"sse/rmwr/o.aaaaadodlblgjr/ <prisos /emsin> Create A d o d m file for our JNI wrapper nri.k
  • 33. device/marakana/alpha-common/framework/mrknlog_jni/java/Android.mk LCLPT : $cl m-i) OA_AH = (al ydr #Bidtelbay ul h irr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLMDL : cmmrkn.nri.i.o OA_OUE = o.aaaaadodlblg LCLSCFLS: $cl aljv-ie-ne,) OA_R_IE = (al l-aaflsudr. LCLJV_IRRE : cr OA_AALBAIS = oe LCLN_TNADLBAIS: tu OA_OSADR_IRRE = re icue$BIDJV_IRR) nld (UL_AALBAY #Bidtedcmnain ul h ouetto icue$CERVR) nld (LA_AS LCLSCFLS: $cl alsbi-aafls $cl alsbi-tlfls OA_R_IE = (al l-udrjv-ie) (al l-udrhm-ie) LCLMDL: cmmrkn.nri.i.o_o OA_OUE= o.aaaaadodlblgdc LCLDODO_PIN : cmmrkn.nri.i.o OA_RIDCOTOS = o.aaaaadodlblg LCLMDL_LS : JV_IRRE OA_OUECAS = AALBAIS LCLDODO_S_TNADDCE : tu OA_RIDCUESADR_OLT = re icue$BIDDODO) nld (UL_RIDC #Cp cmmrkn.nri.i.o.m t /ytmecprisos oy o.aaaaadodlblgxl o sse/t/emsin/ icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLMDL : cmmrkn.nri.i.o.m OA_OUE = o.aaaaadodlblgxl LCLMDL_LS : EC OA_OUECAS = T LCLMDL_AH: $TRE_U_T)prisos OA_OUEPT = (AGTOTEC/emsin LCLSCFLS: $LCLMDL) OA_R_IE = (OA_OUE icue$BIDPEUL) nld (UL_RBITCreate the JNI header file $jvh-n aa ji - dvc/aaaaapacmo/rmwr/rno_n/n/ d eiemrkn/lh-omnfaeokmklgjiji -lspt casah ottre/omnojJV_IRRE/o.aaaaadodlblgitreits u/agtcmo/b/AALBAIScmmrkn.nri.i.o_nemdae/ cassjr lse.a cmmrkn.nri.i.o.iLg o.aaaaadodlblgLboCheck that you got the right JNI headerdevice/marakana/alpha-common/framework/mrknlog_jni/jni/com_marakana_android_lib_log_LibLog.h …
  • 34. JIXOTvi JIALJv_o_aaaaadodlblgLbo_lsLg NEPR od NCL aacmmrkn_nri_i_o_iLgfuho (NEv,jls) JIn* cas; … JIXOTjn JIALJv_o_aaaaadodlblgLbo_eTtloSz NEPR it NCL aacmmrkn_nri_i_o_iLggtoaLgie (NEv,jls) JIn* cas; … JIXOTjn JIALJv_o_aaaaadodlblgLbo_eUeLgie NEPR it NCL aacmmrkn_nri_i_o_iLggtsdoSz (NEv,jls) JIn* cas; …Implement the header file, wrapping calls to our l b r n o shared library imklgdvc/aaaaapacmo/ eiemrkn/lh-omnfaeokmklgjijicmmrkn_nri_i_o_iLgc rmwr/rno_n/n/o_aaaaadodlblgLbo.Create A d o d m file nri.kdevice/marakana/alpha-common/framework/mrknlog_jni/jni/Android.mk LCLPT: $cl m-i) OA_AH= (al ydr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLSCFLS: cmmrkn_nri_i_o_iLgc OA_R_IE = o_aaaaadodlblgLbo. LCLCICUE + $JIHICUE $LCLPT)./../i/imklg OA__NLDS = (N__NLD) (OA_AH/../.lblbrno LCLSAE_IRRE : lbrno OA_HRDLBAIS = imklg LCLMDL : lbrno_n OA_OUE = imklgji LCLPEIKMDL : fle OA_RLN_OUE = as icue$BIDSAE_IRR) nld (UL_HRDLBAYRegister this module with a p a m file lh.kdevice/marakana/alpha-common/alpha.mk … POUTPCAE + RDC_AKGS = cmmrkn.nri.i.o o.aaaaadodlblg cmmrkn.nri.i.o.m o.aaaaadodlblgxl lbrno_n imklgjiBuild the device $mk -1 ae j0 … tre Peul:cmmrkn.nri.i.o.m agt rbit o.aaaaadodlblgxl (u/agtpoutapaojECcmmrkn.nri.i.o.m_nemdae ottre/rdc/lh/b/T/o.aaaaadodlblgxlitreits /o.aaaaadodlblgxl cmmrkn.nri.i.o.m)
  • 35. … Isal ottre/rdc/lh/ytmlblbrno_n.o ntl: u/agtpoutapasse/i/imklgjis … Isalsse f iae ottre/rdc/lh/ytmig ntl ytm s mg: u/agtpoutapasse.m Isaldfl ls:ottre/rdc/lh/ntle-ie.x ntle ie it u/agtpoutapaisaldflsttVerify it works via our M i . a n )test code anmi( #(esatteeuao r)tr h mltr $euao -enlottre/rdc/lh/enl& mltr kre u/agtpoutapakre #wi frteeuao t fns at o h mltr o iih #cekotorJv lbay hc u u aa irr $absell - /ytmfaeokcmmrkn.nri.i.o.a d hl s l sse/rmwr/o.aaaaadodlblgjr -wr-- ro r--r- ot ro ot 17 21-71 0:1 41 010-1 00 cmmrkn.nri.i.o.a o.aaaaadodlblgjr #cekotorJv lbayrgsr fl hc u u aa irr eity ie $absell - /ytmecprisoscmmrkn.nri.i.o.m d hl s l sse/t/emsin/o.aaaaadodlblgxl -wr-- ro r--r- ot ro ot 1921-71 2:7 7 010-0 35 cmmrkn.nri.i.o.m o.aaaaadodlblgxl #cekotorJIsae lbay hc u u N hrd irr $absell - /ytmlblbrno_n.o d hl s l sse/i/imklgjis -wr-- ro r--r- ot ro ot 59 21-71 0:1lbrno_n.o 26 010-1 14 imklgjis #ceki oruiiyi digwa i i spoe t hc f u tlt s on ht t s upsd o $ablga - d oct g /e/o/an rn bfe i 6K (3bcnue) mxetyi 49b mx dvlgmi: ig ufr s 4b 3K osmd, a nr s 06, a pyodi 47b ala s 06 #nwrnorJv lbaysMi.an)b drcl ivkn teDli V o u u aa irr anmi( y iety noig h avk M $abseldliv -p/ytmfaeokcmmrkn.nri.i.o.a d hl avkm c sse/rmwr/o.aaaaadodlblgjr cmmrkn.nri.i.o.an o.aaaaadodlblgMi Fuhdlg Peiul i wscnuig336o 656bts lse o. rvosy t a osmn 44 f 53 ye #cekaan hc gi $ablga - d oct g /e/o/an rn bfe i 6K (K cnue) mxetyi 49b mx dvlgmi: ig ufr s 4b 0b osmd, a nr s 06, a pyodi 47b ala s 06 $abseldliv -p/ytmfaeokcmmrkn.nri.i.o.a d hl avkm c sse/rmwr/o.aaaaadodlblgjr cmmrkn.nri.i.o.an o.aaaaadodlblgMi Fuhdlg Peiul i wscnuig27o 656bts lse o. rvosy t a osmn 1 f 53 ye #go :) od -
  • 36. Marakana Alpha Service Interface
  • 37. Android Stack - Framework
  • 38. Marakana Alpha Service Interface Steps28.1. Because other apps are going to want to use our service as well. Create directory structure for our m k l g e v c rnosrie $mdr- dvc/aaaaapa ki p eiemrkn/lh- cmo/rmwr/rnosriecmmrkn/nri/evc/o omnfaeokmklgevc/o/aaaaadodsrielg Create the interface L g e v c . i lfile oSriead dvc/aaaaapacmo/ eiemrkn/lh-omn faeokmklgevc/o/aaaaadodsrielgIoSriead rmwr/rnosriecmmrkn/nri/evc/o/Lgevc.il Create L g a a e . a aproxy to our bound service oMngrjv dvc/aaaaapacmo/ eiemrkn/lh-omn faeokmklgevc/o/aaaaadodsrielgLgaae.aa rmwr/rnosriecmmrkn/nri/evc/o/oMngrjv Expose L g a a e . a aas a Java library oMngrjv device/marakana/alpha- common/framework/mrknlogservice/com.marakana.android.service.log.xml <xlvrin"."ecdn=uf8? ?m eso=10 noig"t-"> <emsin> prisos <irr nm=cmmrkn.nri.evc.o" lbay ae"o.aaaaadodsrielg fl=/ytmfaeokcmmrkn.nri.evc.o.a"> ie"sse/rmwr/o.aaaaadodsrielgjr/ <prisos /emsin> Create A d o d m file for m k l g e v c nri.k rnosrie device/marakana/alpha-common/framework/mrknlogservice/Android.mk LCLPT : $cl m-i) OA_AH = (al ydr #Bidtelbay ul h irr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLMDL : cmmrkn.nri.evc.o OA_OUE = o.aaaaadodsrielg LCLSCFLS: $cl aljv-ie-ne,) OA_R_IE = (al l-aaflsudr. LCLSCFLS+ cmmrkn/nri/evc/o/Lgevc.il OA_R_IE = o/aaaaadodsrielgIoSriead LCLJV_TTCLBAIS: adodcmo OA_AASAI_IRRE = nri-omn LCLJV_IRRE : cr OA_AALBAIS = oe icue$BIDJV_IRR) nld (UL_AALBAY
  • 39. #Bidtedcmnain ul h ouetto icue$CERVR) nld (LA_AS LCLSCFLS: $cl alsbi-aafls $cl alsbi-tlfls OA_R_IE = (al l-udrjv-ie) (al l-udrhm-ie) LCLMDL: cmmrkn.nri.evc.o_o OA_OUE= o.aaaaadodsrielgdc LCLDODO_PIN : cmmrkn.nri.evc.o OA_RIDCOTOS = o.aaaaadodsrielg LCLMDL_LS : JV_IRRE OA_OUECAS = AALBAIS LCLDODO_S_TNADDCE : tu OA_RIDCUESADR_OLT = re icue$BIDDODO) nld (UL_RIDC #Cp cmmrkn.nri.evc.o.m t /ytmecprisos oy o.aaaaadodsrielgxl o sse/t/emsin/ icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLMDL : cmmrkn.nri.evc.o.m OA_OUE = o.aaaaadodsrielgxl LCLMDL_LS : EC OA_OUECAS = T LCLMDL_AH: $TRE_U_T)prisos OA_OUEPT = (AGTOTEC/emsin LCLSCFLS: $LCLMDL) OA_R_IE = (OA_OUE icue$BIDPEUL) nld (UL_RBITAdd it to a p a m file lh.kdevice/marakana/alpha-common/alpha.mk … POUTPCAE + RDC_AKGS = cmmrkn.nri.evc.o o.aaaaadodsrielg cmmrkn.nri.evc.o.m o.aaaaadodsrielgxlVerify that the device builds okay $mk -1 cmmrkn.nri.evc.o ae j0 o.aaaaadodsrielg cmmrkn.nri.evc.o.m o.aaaaadodsrielgxl … tre Peul:cmmrkn.nri.evc.o.m agt rbit o.aaaaadodsrielgxl … Isal ntl: ottre/rdc/lh/ytmecprisoscmmrkn.nri.evc.o u/agtpoutapasse/t/emsin/o.aaaaadodsrielg .m xl … Ad:cmmrkn.nri.evc.o < dvc/aaaaapa il o.aaaaadodsrielg = eiemrkn/lh- cmo/rmwr/rnosriecmmrkn/nri/evc/o/Lgevc.i omnfaeokmklgevc/o/aaaaadodsrielgIoSriead l … tre Jr cmmrkn.nri.evc.o agt a: o.aaaaadodsrielg … Isal ntl:
  • 40. ottre/rdc/lh/ytmfaeokcmmrkn.nri.evc.o.au/agtpoutapasse/rmwr/o.aaaaadodsrielgjr…
  • 41. Marakana Alpha Service App
  • 42. Android Stack - Services
  • 43. Marakana Alpha Service App Steps31.1. Register the service with the Service Manager so others can use it. Create the directory structure for our code $mdrdvc/aaaaapacmo/p ki eiemrkn/lh-omnap Create main A d o d m file nri.k device/marakana/alpha-common/app/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkfls Create A d o d a i e t x lfile for our server app nriMnfs.m dvc/aaaaapacmo/p/rnoSrieAdodaietxl eiemrkn/lh-omnapMkLgevc/nriMnfs.m Provide I o S r i e m l j v implementation for our service LgevcIp.aa dvc/aaaaapacmo/ eiemrkn/lh-omn apMkLgevc/r/o/aaaaadodlgevc/LgevcIp.aa p/rnoSriesccmmrkn/nri/osrieIoSriemljv Register L g e v c A pwith S r i e a a e oSriep evcMngr dvc/aaaaapa eiemrkn/ lh- cmo/p/rnoSriesccmmrkn/nri/osrieLgevcApjv omnapMkLgevc/r/o/aaaaadodlgevc/oSriep.aa Create the A d o d m file nri.k device/marakana/alpha-common/app/MrknLogService/Android.mk LCLPT: $cl m-i) OA_AH= (al ydr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLSCFLS: $cl aljv-ie-ne,r) OA_R_IE = (al l-aaflsudrsc LCLRQIE_OUE : OA_EURDMDLS = cmmrkn.nri.evc.o o.aaaaadodsrielg cmmrkn.nri.i.o o.aaaaadodlblg LCLJV_IRRE : OA_AALBAIS = cmmrkn.nri.evc.o o.aaaaadodsrielg cmmrkn.nri.i.o o.aaaaadodlblg cr oe faeok rmwr LCLPCAENM : MkLgevc OA_AKG_AE = rnoSrie LCLSKVRIN: cret OA_D_ESO = urn
  • 44. LCLPOUR_NBE : dsbe OA_RGADEALD = iald LCLCRIIAE: pafr OA_ETFCT = ltom icue$BIDPCAE nld (UL_AKG)Register our service app with a p a m file lh.kdevice/marakana/alpha-common/alpha.mk … POUTPCAE + MkLgevc RDC_AKGS = rnoSrieBuild the device $mk -1 ae j0 … Isal ottre/rdc/lh/ytmapMkLgevc.p ntl: u/agtpoutapasse/p/rnoSrieak … Isalsse f iae ottre/rdc/lh/ytmig ntl ytm s mg: u/agtpoutapasse.m Isaldfl ls:ottre/rdc/lh/ntle-ie.x ntle ie it u/agtpoutapaisaldflstt
  • 45. Marakana Alpha Client App
  • 46. Android Stack - Apps
  • 47. Marakana Alpha Client App Steps34.1. A demo client app - to make sure it all works. Create directory structure for our M k L g e v c C i n app rnoSrielet $mdrdvc/aaaaapaapMkLgevcCin ki eiemrkn/lh/p/rnoSrielet $mdrdvc/aaaaapaapMkLgevcCin/e ki eiemrkn/lh/p/rnoSrieletrs $mdrdvc/aaaaapaapMkLgevcCin/e/aus ki eiemrkn/lh/p/rnoSrieletrsvle $mdrdvc/aaaaapaapMkLgevcCin/e/aot ki eiemrkn/lh/p/rnoSrieletrslyu $mdrdvc/aaaaapaapMkLgevcCin/r ki eiemrkn/lh/p/rnoSrieletsc $mdr- ki p dvc/aaaaapaapMkLgevcCin/r/o/aaaaadodlgev eiemrkn/lh/p/rnoSrieletsccmmrkn/nri/osri ccin elet Create L g c i i y j v oAtvt.aa dvc/aaaaapa eiemrkn/lh/ apMkLgevcCin/r/o/aaaaadodlgevccin/oAtvt.a p/rnoSrieletsccmmrkn/nri/osrieletLgciiyj Create A d o d a i e t x lfile nriMnfs.m dvc/aaaaapaapMkLgevcCin/nriMnfs.m eiemrkn/lh/p/rnoSrieletAdodaietxl Create A d o d m file nri.k device/marakana/alpha/app/MrknLogServiceClient/Android.mk LCLPT: $cl m-i) OA_AH= (al ydr icue$CERVR) nld (LA_AS LCLMDL_AS: otoa OA_OUETG = pinl LCLSCFLS: $cl aljv-ie-ne,r) OA_R_IE = (al l-aaflsudrsc LCLJV_IRRE : cmmrkn.nri.evc.o OA_AALBAIS = o.aaaaadodsrielg LCLPCAENM : MkLgevcCin OA_AKG_AE = rnoSrielet LCLSKVRIN: cret OA_D_ESO = urn LCLPOUR_NBE : dsbe OA_RGADEALD = iald icue$BIDPCAE nld (UL_AKG) Register M k L g e v c C i n with main makefile f l _ l h . m rnoSrielet ulapaxl device/marakana/alpha/full_alpha.mk … POUTPCAE + MkLgevcCin RDC_AKGS = rnoSrielet
  • 48. Build entire device $mk -1 ae j0 … Isalsse f iae ottre/rdc/lh/ytmig ntl ytm s mg: u/agtpoutapasse.m Isaldfl ls:ottre/rdc/lh/ntle-ie.x ntle ie it u/agtpoutapaisaldflsttVerify it all worksRun the MrknLogServiceClient app and try to flush the log.
  • 49. Marakana Alpha SDK Add-On35.1. Other developers may want to develop for our cool Alpha device as well. Create directory structure $mdrdvc/aaaaapaskadnsis ki eiemrkn/lh-d_do/kn $c - skeuao/kn/VAdvc/aaaaapa p r d/mltrsisHG eiemrkn/lh- skadnsisMkHgMp d_do/kn/rnvadi Create portrait layout background We took a standard one and just added our logo. Create landscape layout background Same as with the previous image, just add a logo.
  • 50. Define h r w r . n file adaeiidevice/marakana/alpha-sdk_addon/hardware.ini #Cso hrwr otosfrteado. utm adae pin o h d-n #Poete dfndhr ipc alADtreigti ado. rpris eie ee mat l V agtn hs d-n #Ec si cnas oerd toevle wt isonhrwr.n fl. ah kn a lo vrie hs aus ih t w adaeii ie v.epie=2 mhaSz 4Create SDK Add-on m n f s . n file aietiidevice/marakana/alpha-sdk_addon/manifest.ini nm=lh AdO aeApa d-n vno=aaaa edrMrkn dsrpinMrkn ApaAdo ecito=aaaa lh d-n ai1 p=0 rvso= eiin1 lbaiscmmrkn.nri.i.o;o.aaaaadodsrielg irre=o.aaaaadodlblgcmmrkn.nri.evc.o cmmrkn.nri.i.o=o.aaaaadodlblgjrMrkn Lg o.aaaaadodlblgcmmrkn.nri.i.o.a;aaaa o Lbay irr cmmrkn.nri.evc.o=o.aaaaadodsrielgjrMrkn o.aaaaadodsrielgcmmrkn.nri.evc.o.a;aaaa LgSrie o evc si=rnvadi knMkHgMp
  • 51. Define classes to be includeddevice/marakana/alpha-sdk_addon/alpha_sdk_addon_stub_defs.txt +o.aaaaadodlblg* cmmrkn.nri.i.o. -o.aaaaadodlblgMi cmmrkn.nri.i.o.an +o.aaaaadodsrielg* cmmrkn.nri.evc.o.Create main a p a s k a d n m makefile for Alpha SDK Add-on lh_d_do.kdevice/marakana/alpha-sdk_addon/alpha_sdk_addon.mk #Icuetecmo suf nld h omn tf icuedvc/aaaaapacmo/lh.k nld eiemrkn/lh-omnapam #Ls o mdlst icuei teteado sse iae it f oue o nld n h h d-n ytm mg POUTPCAE + RDC_AKGS = cmmrkn.nri.i.o_o o.aaaaadodlblgdc cmmrkn.nri.evc.o_o o.aaaaadodsrielgdc #Tenm o ti ado (o teSK h ae f hs d-n fr h D) POUTSKADNNM : mrkn_lh_do RDC_D_DO_AE = aaaaapaadn #Cp tefloigflsfrti ado SK oy h olwn ie o hs d-ns D POUTSKADNCP_IE : RDC_D_DO_OYFLS = $LCLPT)mnfs.n:aietii (OA_AH/aietiimnfs.n $LCLPT)hrwr.n:adaeii (OA_AH/adaeiihrwr.n $cl fn-oysbi-ie, (al idcp-udrfls* ,(OA_AH/kn/rnvadisisMkHgMp) $LCLPT)sisMkHgMp,kn/rnvadi #Cp tejrflsfrtelbais(Ps epsdi ti ado SK oy h a ie o h irre AI) xoe n hs d-ns D POUTSKADNCP_OUE : RDC_D_DO_OYMDLS = cmmrkn.nri.i.o:iscmmrkn.nri.i.o.a o.aaaaadodlblglb/o.aaaaadodlblgjr cmmrkn.nri.evc.o:iscmmrkn.nri.evc.o.a o.aaaaadodsrielglb/o.aaaaadodsrielgjr POUTSKADNSU_ES: $LCLPT)apaskadnsu_estt RDC_D_DO_TBDF = (OA_AH/lh_d_do_tbdf.x #Dfn tenm o tedcmnaint gnrt frti ado SK eie h ae f h ouetto o eeae o hs d-ns D POUTSKADNDCMDL : RDC_D_DO_O_OUE = cmmrkn.nri.evc.o_o o.aaaaadodsrielgdc #Sneteado i a euao,w as ne t epiil cp tekre t ic h d-n s n mltr e lo ed o xlcty oy h enl o iae mgs POUTSKADNCP_IE + $LCLKRE)iae/enlqm RDC_D_DO_OYFLS = (OA_ENL:mgskre-eu
  • 52. #Ti ado etnstedfutskpout hs d-n xed h eal d rdc. $cl ihrtpout $SCTRE_I)poutskm) (al nei-rdc, (R_AGTDR/rdc/d.k #Tenm o ti ado (o tebidsse) h ae f hs d-n fr h ul ytm #UeaePOUT<RDC_AE-d_dot bidtea ado, s mk RDC-POUTNM>skadn o ul h n d-n #s i ti cs,w wudrnaePOUTmrkn_lh_do-d_do o n hs ae e ol u mk RDC-aaaaapaadnskadn POUTNM : mrkn_lh_do RDC_AE = aaaaapaadn POUTDVC : apa RDC_EIE = lh POUTMDL: Mrkn ApaSKAdnIaefrEuao RDC_OE = aaaa lh D do mg o mltrCreate main A d o d r d c s m listing other makefiles nriPout.kdevice/marakana/alpha-sdk_addon/AndroidProducts.mk POUTMKFLS: $LCLDR/lh_d_do.k RDC_AEIE = (OA_I)apaskadnmCreate top-level makefiledevice/marakana/alpha-sdk_addon/Android.mk icue$cl alsbi-aeie) nld (al l-udrmkflsBuild the SDK Add-on $mk -1 POUTmrkn_lh_do-d_do ae j0 RDC-aaaaapaadnskadn … PcaigSKAdn oths/iu-8/d_do/aaaaapaadn akgn D do: u/otlnxx6skadnmrkn_lh_do- egsuetlnxx6zp n.tdn-iu-8.iCheck that Marakana Alpha shows in Android SDK ManagerStart the Android SDK Manager to see all available Add-ons.
  • 53. Create new AVD based on Marakana AlphaFrom the Android AVD Manager, create new AVD using Alpha as the target.
  • 54. Verify the new AVD boots up with right ROM imageStart the new AVD. You should see all of the modifications we’ve done.
  • 55. Remixing Android SummaryThank you!Marko Gargenta & Marakana Team@MarkoGargentaSpecial thanks to Aleksandar (Sasa) Gargenta for providing most of the research on how toput together Marakana Alpha, properly.Slides & video of this presentation is available at Marakana.com(c) Marakana.com