Show of Hands How many people know what Android is? How many are Windows developers? Do you have the Android SDK Installed?
Android overview A software platform and OS for mobile devices Based on the Linux kernel, but most things around the kernel are developed anew Developed by initially by Android Inc, acquired by Google in 2005 Supports writing managed code in Java Source available via AOSP project (Android Open Source Project) What is Android?
Android overview Android Java (Google SDK + Motorola EMDK) Most Android apps (and some system services) are written this way Easy to manage Not Sun/Oracle Java (discussed in detail later) Google SDK and other dev tools downloadable on http://developer.android.com for free http://developer.android.com Motorola EMDK available on support website for free Android Native SDK (Google NDK) Write some code in C/C++ (high-performance routines). Cannot write the whole app in C++, still must build a Java app. Different APIs, high complexity, less portable RhoMobile (Motorola) Use web technologies to build cross-platform applications Packaged as standard Android app when deployed to the device Development options
Android and The Enterprise Well architected OS Easy to use development tools Access to open source for fixes and mods Consumer by design –End user has too much control –Lacks MDM, Security, Lockdown, mass mgmt Many enterprise-grade features have been added, but still not enough to call an Enterprise OS Evolution over the years Android is the next best alternative OS for the enterprise. However it lacks many enterprise class features today. Motorola is researching the gaps in order to deliver enterprise Android
Android OS Architecture Requirements Design constraints for Android Platform Constrained processing power, memory, storage and battery life Variety of device form factors and capabilities (screen size, keyboard, wireless interfaces) Variety of target CPUs (variations of ARM, x86, etc) Non tech-savvy users Apple / MS are already ahead in the game Results Minimalistic OS kernel Minimizing memory use through sharing, etc Sleep whenever possible Application runtime must be abstracted from the OS and hardware platform Application runtime must be sandboxed to minimize malware impact Reuse standard components as much as possible Provide ‘bare’ OS core and have app developers create lots of portable apps
Android OS Architecture Modified Linux 3.x Kernel Lightweight build, variety of CPU architectures and hardware supported, proven tech, lots of security options Tweaks and modifications to support advanced memory/power/etc management for resource-constrained devices Java for applications Proven technology popular among developers - Enterprise (JSP, etc), mobile (J2ME, etc) and many others Runs in JavaVM = OS/hw independent = supports diverse set of devices - Missing HW features can be virtualized or replaced with stubs But – greater CPU/RAM requirements - Custom Java libraries using open source and in-house developed components to address this Dalvik Java VM A custom Java VM optimized for mobile devices - Memory sharing, extra security and sandboxing, quick startup, etc Provide tools to build Dalvik Java apps from ‘standard’ Java source code Resulting choices
Android OS Architecture Resulting System Architecture Diagram APPLICATIONS APPLICATIONS FRAMEWORK LIBRARIESANDROID RUNTIME LINUX KERNEL Home Contacts Phone Browser … … Activity Manager Window Manager Content Providers View System View System Package Manager Telephony Manager Resource Manager Location Manager Notification Manager Surface Manager Media Framework SQLite Core Libraries Dalvik Virtual Machine OpenGL | ES FreeType WebKit SGL SSL libc Display Driver Display Driver Camera Driver Flash Memory Driver Binder (IPC) Driver Binder (IPC) Driver Keypad Driver Keypad Driver WiFi Driver Audio Drivers Audio Drivers Power Management
Android OS Architecture Resulting System Architecture Diagram
Android OS Architecture Every OS Version has an API Level. Even minor versions may have a different API Level App developer targets application for a minimum API level Because apps are targeted for a minimum API level, most older Android apps will work just fine on new Android releases. Does not apply to low-level system apps and hacks Libraries and Versioning
Accessing Android Devices Contains useful tools and drivers –Enable device troubleshooting and low- level management (ADB, DDMS, etc) –USB drivers Non-developer SDK install –http://developer.android.com/sdk/http://developer.android.com/sdk/ –Select “Download for other platforms” - > “SDK Tools Only” Choose bundle for your platform. EXE for simple install, ZIP for custom Install to a path with NO SPACES –Run SDK Manager and install only Android SDK Tools and Platform- Tools Add the \tools and \platform-tools to system PATH –Install Motorola Android USB Driver Support Central –Validate with ‘adb devices’ More on ADB later Android SDK for non-developers
Agenda Get Connected Pass around jump drive – copy to desktop folder Do the ADB Super-Fast Installation Talk about USB connection modes ADB Usage Modes (command line, gui) What you can do with ADB and scripts (and what you CAN’T do, and why – actually SEE how file permissions control your access) Summary of Online Resources
ADB Super-Fast Installation When you install the Android SDK, ADB is installed as part of that process –Gives both visual and command line access –But it takes how long ?!? If you search “15 second ADB install” you will find a windows install for ADB and Fastboot –Yes it’s about that fist –Quick and easy You can also do a “super-fast install” by dropping just a few files into your PC –Gives command line access –Really quick and easy
Setup Directions From the memory stick being handed around.. Copy the folder “ADB” to your desktop Look in the folder, find and install the MSI Android USB drivers Connect your device with a USB cable Go to Settings…Developer Options.. –enable Developer Options (slide ON) –check USB Debugging and Stay Awake Run “adb devices” to check connection
USB Connection Modes USB Mass Storage – direct connection to PC –Raw, not sharable, access only to sdcards –Complete control - can format, FATonly –Seems to be downplayed as of JellyBean PTP, MTP – managed connection to PC –Picture Transfer Protocol – for camera (pics) Media Transfer Protocol – all kinds of files –File managed, sharable, access only to sdcards –Limited control – read, write files and folder
How ADB Connection Differs ADB allows much greater access to files –File access not limited to sdcards –Access from “/” limited only by file permissions /data/tmp, sdcards, /enterprise/usr, … ADB allows interactive running of commands on device ADB also has higher-level functions for support of development/debugging/screen sharing
Android / |-/etc |-/data |-/enterprise |-/sdcard |-/system |-/storage | |-/sdcard | … USB Connection Modes mass storage switch SD card USBUSB USBStor USBScan storage volumes Raw device access File system access ATAPI File Transfer OFF ON PC
Android / |-/etc |-/data |-/enterprise |-/sdcard |-/system |-/storage | |-/sdcard | … USB Connection Modes mass storage switch SD card USBUSB USBStor USBScan storage volumes Raw device access File system access ATAPI File Transfer OFF ON PC ADB cmd or shell Debug Agent
ADB Connection Test ADB Installation needs to be finished by this time –Folder with ADB –Installation of latest Drivers Run “adb devices” –Be sure you have a connection –Check USB mode All good – ready to proceed?
Why Study ADB? Easiest way to get familiar with basics of how device is set up and some basics about file security. Can be used as tool to deploy apps and settings. Great tool for TESTing what you are about to deploy, even if you will be using an MDM This is as close as we are going to get to the feeling we had on MW/CE that we could use ActiveSync connection to run RAPI installs or to “drop in” files to achieve unit configuration.
ADB capabilities to cover.. Shell or remote execution File/folder transfer.. push/pull/sync Package install/update/uninstall Package run/run with parms/stop Use with multiple devices, use over WiFi Use to find out things.. –Explore filesystem and permissions problems –adb shell getprop | find “MX” –adb pm list.. packsges, permissions, features
ADB Capabilities - Backup Rumored to be able to “clone” setup.. –It cannot (at least in JB) –It’s a darn GOOD thing that it cannot.. Why? –Expect future versions of the OS to further restrict what can be exported from a device. Way too slow for use in actual deployments
How Easy it Used to Be In Windows CE, you could could.. –set up a folder on our desktop, with all the files arranged just as we wanted them on the mobile, –Connect USB via ActiveSync, open the AS file browser window –then drag and drop the \application folder as a single item.. –It copied all the files.. Then cold boot to test your setup. -you could deploy devices the same way -Or build a custom image from the folder
How easy it can be now.. Now with ADB, you can –make a folder on your desktop, with all the files arranged just as we want them on the mobile –and arrange all the files as I want them to be –Connect USB via and configure ADB Debug –then run a script that Uses “adb push” the folder as a single item.. Installs and runs some APKs Script can end with a command to run ER – tests persistence –disables USB Debug –When setup tests OK, SAME procedure deploys units
File Management & ADB Using ADB shell: –df, mount –cd, pwd, ls, ls -la, mkdir, cp, etc… –Piping ‘|’ and redirecting to a file ‘>’ Including external launches adb shell “cd /system/bin; ls” > commandList.txt adb shell “cd /system/bin; ls –l | find “toolbox” > toolbox.txt grep, more, busybox –Understanding permissions (rwxd, user/group/all) –Understanding storage modes When USB Storage mode is available –Check Linux kernel version (cat /proc/version) ADB push/pull file to/from SD Card
ADB Scripting Even COMPLEX tasks can be made simple, reliable and fast.. –Though you still have to enable USB Debug –And remember to disable it when you’re done –And prevent users from re-enabling it Combine that with the “quick install” and.. –You can send quick install and some scripts to a partner, and he can be staging units without an MDM this afternoon.
Remember - ADB is Dangerous Imagine that you deploy devices, containing.. –Corporate owned applications –Corporate data –Corporate WLAN settings Now imagine someone takes a device home and connects ADB… –Hey, it’s just a portable device, what could possibly go wrong? (and if it does -- who will get blamed?) Rule: Never deploy with ADB enabled. Ideal: Never allow users to enable ADB.