Software and Services Group
Android* on Intel platforms
Daniel Holmlund
Gayathri Murali
Software and Services Group
Agenda
Introduction
Porting and Packaging for IA
Android Testing
Intel tools
Software and Services Group
Introduction
Software and Services Group
Committed to providing the best experience on IA
Intel is the number one contributor to Linux kernel.
Intel is working on Android 64 bit operating system.
Intel recognized as the #1 external contributor2 to Jelly Bean. In line to be #1 again for next Android release
Chrome browser ported to Android and optimized to run best on IA
Intel has contributed 750+ patches to Webkit (Drives the browser for Android and iOS) in the last two months and is the 2nd largest Contributor to Chromium behind Google
Creating cross-platform tools and development environments based on new programming models
3X Faster1
Android ICS Browser
GPU accelerated
FPS: 20 60
6X Faster1
Jscript Performance
X86 codegen
Industry Leader
Best-in-class1
Optimized Android 2.3
Web Runtime
CES 2012 Review
>20% Faster1
Optimized SKIA
Rendering Library
Android 2.3
Software and Services Group
Optimizing Android for Intel
Atom Processor-Based Devices
A
pp
s A
pp
lica
tio
n
Fram
ew
ork
Home Contacts Phone Browser
Activity Manager Windows* Manager
Telephony Manager
Resource Manager
Content Providers View System
Location Manager Notification Manager Package Manager
Surface Manager
OpenGL* ES
SGL
Media Framework
FreeType
SSL
SQLite
WebKit
libc
Core Libraries
Dalvik Virtual Machine
Display Driver Camera Driver Flash Memory Driver Binder (IPC) Driver
Keypad Driver WiFi Driver Audio Drivers Power Management
Libraries
Linux* Kernel
Android* Runtime
Ap
ps
Use
r Ex
per
ien
ce
Mid
dle
war
e
Op
erat
ing
Syst
em
Apply our extensive experience optimizing Java* to the Dalvik* VM
Drivers validated & optimized for power & memory footprint
SKIA and openGL optimizations
Enhanced debugging and logging
IA assembly optimizations
We optimize web technologies such as HTML 5, WebKit and JavaScript
GPU & Video support for canvas operations
Extensive middleware development in imaging, media and DRM deliver compelling media experiences
Memory Optimizations, AVI, DivX*, and ASF container types,
WMV /VC-1 decoder. Live Streaming optimizations, HDMI
and WiDI Extended Video Modes, Video Playback DRM
Based on third party validation and sampling of Android apps using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance and/or results.
Software and Services Group
Smartphones with Intel Inside - 2013
Intel Yolo
Acer Liquid C1
ASUS* Fonepad - 7
Z2420 Z2580 Z2560
Lenovo* K900 5.5
ASUS Fonepad Note FHD - 6
ZTE Grand X2 4.5 ZTE* Geek 5
Software and Services Group
Tablets with Intel Inside - 2013
Samsung* Galaxy Tab 3 10.1
(Z2560)
ASUS* MeMO Pad FHD 10
(Z2560)
ASUS* Fonepad 7
(Z2420)
ASUS* Transformer Book Trio
Atom Z2580 + Core i7 4th Generation
Dell* Venue 7
Software and Services Group
Porting and Packaging for IA
Software and Services Group
NDK application
Good news! Most NDK applications run as it as on x86 platforms
Port your applications to improve performance and reliability
NDK applications categorized to 3 types
Consists of C/C++ code only that is not related to hardware Recompile the native code to run the application on the Intel Atom platform successfully.
Open the NDK project and search for Android.mk file and add APP_ABI := armeabi armeabi-v7a x86 in Android.mk and re-build the native code with ndk-build.
Uses a third-party dynamic linked library the shared library must be recompiled into x86 version for the Intel Atom platform.
Includes assembly code that is highly related to non-IA platforms code must be rewritten with IA assembly or C/C++.
Use the header file here to convert all NEON instructions into SSE instructions.
Software and Services Group
NDK Application Demo
Software and Services Group
Porting Dalvik applications
Dalvik applications run without any changes on all Intel powered devices
For a high resolution device, change the default memory allocation to meet application
requirements
Software and Services Group
PSI
TS
PIDs
Packaging APKs for multiple CPU
architectures
Two options:
One package for all (fat binary)
Embed native libraries for each architecture in one APK
Easiest and preferred way to go.
Multiple APKs
One APK per architecture
If you have good reasons to do so (ie your fat binary APK would be larger than 50MB).
Software and Services Group
The application will be filtered on ABI support during installation (after download).
Use lib/armeabi libraries
Use lib/armeabi-v7a libraries
Use lib/x86 libraries
Fat Binaries
Software and Services Group
Version code convention (proposal)
APKs that targets different platforms must have different version codes.
The store will choose the compatible APK with the higher version code number.
Using this convention, the chosen APK will be the one that run best on the device.
Software and Services Group
Android Testing
Software and Services Group
Options available to test
Emulators
Part of the SDK or stand alone emulators that aids in testing application in your development environment.
An Emulator mimics the hardware and software features of a typical mobile device
Cloud based testing
Actual devices are available on cloud for testing
Developers can create test scripts and run the tests on cloud on actual devices
Real device testing
Developers have access to the actual device to test the application functionality
Software and Services Group
Emulators - Create and starting
AVD Launch the Android Virtual
Device Manager: In Eclipse,
click Android Virtual Device
Manager from the toolbar.
In the Android Virtual Device Manager panel,
click New.
Fill in the details
Make sure you select an API that is supported by an
x86 system image,
CPU/ABI is set to x86, and
you have enabled GPU
(OpenGL ES*) emulation.
You can launch the x86 AVD by clicking on Start,
then Launch.
Software and Services Group
Cloud based testing
A device laboratory of multiple real devices are available for the developers to test
A test is carried out on the cloud based on test scripts either created by the developers or built in test scripts provided the service
provider
There may be a cost associated in using the devices
Developers may not be able to see the actual test in progress, but gets a detailed report out with screenshots
Ability to adopt to changing condition
Scale up and down
Software and Services Group
Real device testing on Cloud - AppTHwack
AppTHwack provides real device testing services on Android, iOS and other mobile web apps.
AppTHwack maintains a device lab with almost all devices available in market which are available for a period of testing. Users can
either use the built in test created by AppTHwack to test their apps
or create a custom test script.
Check out the pricing details here
Intel Software sponsors free testing of devices running on Intel platforms.
Check out the device lab here
Software and Services Group
Intel Hardware Accelerated
Execution Manager (HAXM)
Software and Services Group
Pre-built Atom Images Android SDK manager has x86 emulation
images built-in
To emulate an Atom-based Android phone, install the Intel Atom x86 System Image available in the Android SDK Manager
Much Faster Emulation Intel Hardware Accelerated Execution Manager
(HAXM) for Mac and Windows uses Intel
Virtualization Technology (VT) to accelerate
Android emulator by 2-4x
Intel VT is already supported in Linux* (KVM) for x86.
See www.intel.com/software/android for demo videos & installation tips
Intel x86 Emulator
Accelerator
Faster Android Emulation using an IA-based host
PC
Intel x86 Atom System Image
Software and Services Group
Intel HAXM - DEMO
Software and Services Group
Intel Graphics Performance
Analyzers
Software and Services Group
25
Intel Graphics Performance Analyzers System Analyzer for Android
Real-time system-level performance analysis for Intel-based Android devices
Immediate experiments and overwrites enable developers to isolate CPU and GPU performance problems
Metrics for CPU, GPU, API, memory, network, power, etc.
Copyright 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
For on-device app testing: Intel GPA System Analyzer Real-time Remote Performance and Power Profiling
Intel GPA System
Analyzer running on
a PC Android
Smart
Phone USB adb Connection
Wi-Fi Connection
Data
Real-time charts: CPU metrics Graphics API level metrics Processor graphics hardware metrics Power metrics
Download Intel GPA for FREE at intel.com/software/GPA
Software and Services Group
Intel GPA - DEMO
Software and Services Group
Intel HTML5 Development Environment
(XDK)
more on:
html5dev-software.intel.com
Create, Debug and Build HTML5 apps for multiple platforms from a single code base.
Software and Services Group
Intel Threading Building Blocks
(TBB)
Software and Services Group
Key Features of TBB
You can specify tasks instead of manipulating threads
TBB maps your logical tasks onto threads with full support for nested parallelism
Targets threading for scalable performance
Uses proven efficient parallel patterns
Uses work-stealing to support the load balance of unknown execution time for tasks.
Open source and licensed versions available on :
Linux, Windows, Mac OS X* and Android*
30
Software and Services Group
Intel TBB Integration
#for including tbb in your project:
include $(CLEAR_VARS)
LOCAL_MODULE := tbb
LOCAL_SRC_FILES := $(TBB_PATH)/lib/android/libtbb.so
LOCAL_EXPORT_C_INCLUDES := $(TBB_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
#for calling tbb from your lib:
LOCAL_CPP_FEATURES := rtti exceptions
LOCAL_SHARED_LIBRARIES += tbb
LOCAL_CFLAGS += -DTBB_USE_GCC_BUILTINS -std=c++11
Android.mk
APP_ABI := x86
APP_STL := gnustl_shared Application.mk
System.loadLibrary("gnustl_shared");
System.loadLibrary("tbb");
System.loadLibrary("YourLib"); Java
Software and Services Group
Intel TBB - Download
GPLv2 with runtime exception available from threadingbuildingblocks.org/download :
The commercial version with support is here: software.intel.com/en-us/intel-tbb
Copyright 2012, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners.
Where to Get More Info
Intel Developer Zone (IDZ) Real developers sharing knowledge and
offering help Dedicated communities and forums
focused on your interests Worldwide reach News and insights on cutting edge
technology
Intel Android* Developer Website Great content you wont find anywhere else Technical articles, tools, and How-To
guides Native app porting tips & case studies Info on x86 emulator and Intel Hardware
Accelerated Execution Manager Active forums and blogs written by Intel and
community experts
software.intel.com/android
Software and Services Group
Backup
Software and Services Group
Intel C++ Compiler for Android
Software and Services Group
Intel C++ Compiler Optimized System and Application Performance
36
High Performance
Boosts performance with a single recompile
Binary and source compatible with GNU* GCC compiler
Intel Cilk Plus - task and data parallelism
Standards support
Optimization
Intel Atom - optimized common libc/libm functions
Streaming SIMD Extensions 3 (SSE3) instruction support
Vectorization support
Interprocedural optimization
Profile guided optimization
High performance. GNU compatibility. Standard support.
Software and Services Group
Most Android* Apps Will Just Work on Atom
Android Dalvik and HTML5 apps These should just work we do extensive testing of pre-production systems
Android native (NDK) apps Most will run w/o any recompilation but A simple recompile using the Android NDK yields the best performance If the developer uses ARM-specific features, add equivalent Intel SSE
features
Top Android Market apps Intel validates and tests on Intel Atom processor platforms (Mix of Dalvik and native (NDK) apps)
Android Runtime
Core Libraries
Dalvik Virtual
Machine
Software and Services Group
Optimization
Use Inline instead of Frequently Used Short
Use Float instead of Double
The Intel Atom platform has FPU enabled. In most cases, using Float instead of Double speeds up the data computing process and saves memory bandwidth in
Intel Atom processor-based devices.
Multi-thread coding
Multi-thread coding allows you to use the hyper-threading function of the Intel Atom processor to increase throughput and improve overall performance
High Performance compiler flags
Adding specific flags according to your target platform is highly recommended. You can add the following recommended flags during
compilation on the Intel Atom platform:
-march=atom
-msse4
-mavx
-maes
Software and Services Group
Intel VTune Amplifier for Android
Software and Services Group
Intel VTune Amplifier XE 2013 Performance & Power Profiler
Where is my application
Spending Time? Wasting Time? Consuming Power?
Focus tuning on functions taking time
See call stacks Drill to source and asm code
See cache misses on your source
See functions sorted by # of cache misses
See Frequency and Sleep states
See Wakeup reasons
Advanced profiling for Android Mobile Devices
Software and Services Group
Intel VTune Amplifier XE 2013 CPU Performance Analysis
Identify Hotspots and inefficient code
Cache Misses, Branch Mispredictions
Drill down from Java & C/C++ to assembler code
Software and Services Group
CPU Power Analysis
Use case: Collecting data from sensor
Continuously collecting accelerometer data
Use power analysis to find out impact of sampling frequency
2/11/2014
SENSOR_DELAY_FASTEST SENSOR_DELAY_NORMAL
Lowest Power consumption
High Power consumption