Hacking Android OS http://gplus.to/JimmyLIVE August 13, 2011 Room TTN1, ITSC-CMU
Topics (1)Why Android?Introduction to AOSP(Android Open-Source Project)Compiling AOSP and Creating ROMArchitecture of Android OSAndroid SDK, NDK, ADKIntroduction to CyanogenModInput Method CustomizationCreating your own LauncherTheme and Live Wall Paper
Topics (2)Rooting Android DevicesHBoot, FastBoot, Recovery, S-OFF, UnlockBootloaderHow to cook the Android ROMSuper User, ODEX, Deodex, Zip-align, SigningHow to trap SMSSensors in Android PhoneIntroduction to Arduino and Android ADK(Android Accessory Developer Kit)
What will you get from this class? You will get NOTHING from this class but many links to where to read more You will break your phone’s warrantee You may BRICK your phone You may create the best phone on earth from the bad SH*T phone in your hands You may go to jail...
AndroidAndroid is an open-source software stack(OS, Middle ware, Applications) created formobile phones and other devices. The AndroidOpen Source Project (AOSP), led by Google,is tasked with the maintenance and furtherdevelopment of Android.
Why Android?“We created Android in response to our ownexperiences launching mobile apps. We wantedto make sure that there was no central pointof failure, so that no industry player canrestrict or control the innovations of anyother. Thats why we created Android, andmade its source code open.” - Google -
AOSPThe goal of the Android Open Source Projectis to create a successful real-world productthat improves the mobile experience for endusers.To get and compile Android source code:http:/ /source.android.com/source/initializing.html
Android Release History1.0 (branch name unknown, backnaming it Apple Pie)1.1 (branch name unknown, backnaming Banana bread)1.5 (Cupcake branch)1.6 (Donut branch)2.0 (Eclair branch)2.1 (Eclair branch)2.2 (Froyo branch)2.3 (Gingerbread branch)3.0 (Honeycomb branch)3.1 (Honeycomb branch)3.2 (Honeycomb branch)(Ice Cream Sandwich)
To startGet Android SourceCompile itUnlock your phone(lost your phone’s warantee)Install the result ROM to your phone(lost all of Google and Bundled apps)
Compile AOSP$ . build/envsetup.sh$ lunch(Select target device)$ make -j4
What is Crespo?Developer Devices Dream (HTC G1) Sapphire Passion (Google Nexus One) Crespo (Google Nexus S) Crespo4G (Google Nexus S 4G)
Reboot to Bootloader$ adb reboot bootloaderUse hardware button
Unlock Bootloader$ fastboot oem unlock On Nexus One, the operation voids the warranty and is irreversible. On Nexus S and Nexus S 4G, the bootloader can be locked back with $ fastboot oem lock
Flash your built ROM$ fastboot ﬂashall -w Congratulations! You lost all Google and bundled apps!
Try FlashGoogle AppsRestore your phone by ﬂash OTA ROMHow to solve problem when you BRICK yourphone
HBoot, FastBoot, SPLHboot is the init script of the device. In others words, itmakes possible to the device power on and load all the"programs"Fastboot is protocol used to update the ﬂash ﬁle system inAndroid devices from a host over USBThe SPL, or Second Program Loader, in conjunction with theIPL comprise a devices bootloader. Aside from bootstrappingAndroid, the bootloader also fulﬁlls various diagnosticfunctions. One of these functions is the manipulation of datain the devices internal ﬂash ram. Depending on the SPLinstalled, the user can apply a signed NBH ﬁle, ﬂash nandimages, and more. Note that the SPL is installed and operatesindependently of the Android build that runs atop it.
Create your own Android BeagleBoard http://beagleboard.org/ Panda Board http://www.pandaboard.org/ http://www.digikey.com/us/en/ph/texas- instruments/pandaboard.html
CyanogenModCyanogenMod is an aftermarketﬁrmware for a number of cellphones based on the open-sourceAndroid operating system. Itoffers features not found in theofﬁcial Android based ﬁrmwaresof vendors of these cell phones.http://www.cyanogenmod.com/
MIUIMIUI, Redeﬁning Android.MIUI is one of the most popular Android ROMs inthe world.It is based on Android 2.3 and has a unique UIthat looks and feels great to use. MIUI isupdated every Friday based on the feedback fromits users, it is then translated to English by ourtranslation team for you all to use and love. Sowhat are you waiting for, head over to the ROMSsection and download MIUI for your phone.http://miuiandroid.com/
Google TV & AndroidThe software that Google TV runs is aversion of Android that has been enhancedto support video search, HDTV signaling, anda full Google Chrome browser. It currentydoesnt support certain Android features likeinstalling third party apps.
Writing Android AppsAndroid Developer sitehttp://developer.android.com/index.htmlAndroid SDKhttp://developer.android.com/sdk/index.htmlADT plugin for Eclipsehttp://developer.android.com/sdk/eclipse-adt.htmlAndroid NDKhttp://developer.android.com/sdk/eclipse-adt.htmlAndroid Open Accesory Development Kit (ADK)http://developer.android.com/guide/topics/usb/adk.html
Customize AOSPOur Goal: Thai Android OS Thai IME Thai Launcher Thai Theme & Live Wallpaper Thai Web Browser Thai Date & Time Thai Character Display Thai Sorting Thai Essential Apps
Customize IME (Brief Examples)packages/inputmethods/LatinIMEAdd xml-thCustomize Keyboard layout for THAI(and many detail to ﬁx and add such as wordsuggestion vocabulary and behavior)
Launcher Customization ADW Launcher is a good place to start http://forum.xda-developers.com/ showthread.php?t=645550 http://code.google.com/p/adw-launcher- android/ Source code: https://github.com/AnderWeb/ android_packages_apps_Launcher
LIVE WallpaperStart at “Cube LIVE Wallpaper” sample codefrom Android SDKTutorialhttp://blog.androgames.net/58/android-live-wallpaper-tutorial/
How to RootRevolutionaryhttp://forum.xda-developers.com/showthread.php?t=1191732SuperBoothttp://android-dls.com/wiki/index.php?title=Use_Superboot_to_get_rootGalaxy S IIhttp://forum.xda-developers.com/showthread.php?t=1103399
HTC Bootloader Unlock(Coming soon)http://htcdev.com/While waiting, use Revolutionary :Phttp://www.momobiles.com/s-off-htc-ﬂyer-with-revolutionary-tool/
dsixda’s KitchenA good start for Android ROM Cooker“This is NOT a tool to automatically turn you into a full-ﬂedged ROM developer. ROM development normally involveswork from the ground up and involves time, research andpatience. I am just giving the tools to help the averageperson get things done quickly from an existing base.” dsixda
Reading about CookingHow to cook ROM (Hero)http://forum.xda-developers.com/showthread.php?t=551711How to cook ROM (Magic)http://forum.xda-developers.com/showthread.php?t=566235Extract ROM ﬁle from HTC’s RUUhttp://lukasz.szmit.eu/2010/04/extracting-rom-ﬁles-from-htc-android.html
Signed Update.zipThe "signed update" type ROM image always contains thefollowing components:boot.img - This ﬁle is a binary representation of the root ﬁlesystem of the device. It contains the system kernel and allﬁles required to start the core part of Androidsystem - This is a directory containing all ﬁles foundunder /system on a running Android device. It has exactlythe same layout.META-INF - This is directory containing the update manifestand script. The manifest is a ﬁle which lists all ﬁle includedin the update, with their SHA1 checksums. The update scriptis used to apply the update on a device
ODEX File"Normal" apps have an APK with a manifest, resources, and a"classes.dex" inside. The classes.dex is optimized by the packagemanager on ﬁrst use, and ends up in /data/dalvik-cache/."System" apps have the DEX optimization performed ahead of time. Theresulting ".odex" ﬁle is stored next to the APK, the classes.dex isremoved from the APK, and the whole thing works without having to putmore stuff in your /data partition.The optimized DEX ﬁles cannot easily be converted back to unoptimizedDEX, and Im not sure theres any beneﬁt in doing so. Both kinds ofDEX ﬁles can be examined with "dexdump".More detail can be found in dalvik/docs/dexopt.html in the sourcetree, or on the web at:http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/dexopt.html;hb=HEAD
Boot Logo & AnimationHow to createhttp://forum.samdroid.net/f55/tutorial-how-create-custom-bootlogo-bootanimation-863/
Trapping SMSBroadcast ReceiverSMS Received --> Your app --> FUN!
ADK & ArduinoArduino Mega ADKhttp://labs.arduino.cc/ADK/IndexProcessing for Androidhttp://wiki.processing.org/w/Android
What’s next?All source code available athttp://clicknect.comNext Training Image Processing using OpenCV Introduction to OpenGL ES Introduction to WebGL Introduction to HTML5 Canvas (You can suggest topics)