android meetup, Илья Лёвин
TRANSCRIPT
![Page 1: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/1.jpg)
Android* on Intel platforms
Ilya Levin, Software Developer
![Page 2: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/2.jpg)
Smartphones with Intel Inside - 2012
Motorola* RAZR i ZTE* Grand X IN
Lava* Xolo X900 Megafon* Mint
Lenovo* K800
Orange* San Diego (UK)
Orange* avec Intel Inside (FR)
Z2460
![Page 3: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/3.jpg)
Smartphones with Intel Inside - 2013
Intel® Yolo
Acer* Liquid C1
Z2420 Z2580Z2560
Lenovo* K900 – 5.5”
ASUS Fonepad™ Note FHD - 6”
ZTE* Grand X2 In – 4.5”
ZTE* Geek – 5”
…
Etisalat E-20*
![Page 4: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/4.jpg)
Tablets with Intel Inside - 2013ASUS* MeMO Pad FHD 10”
(Z2560)
ASUS* Fonepad™ 7”
(Z2420/Z2560)
Dell* Venue 7/8
(Z2560)
Samsung* Galaxy™ Tab 3 10.1”
(Z2560)
LTE version now available
![Page 5: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/5.jpg)
Future Android* platforms based on Intel* Silvermont microarchitecture
New 22nm tri-gate microarchitecture~3X more peak performance or ~5X lower power than previous Atom microarchitecture
Intel® Atom™ Processor Z3000 Series (Bay Trail)
Next Generation Tablets
MerrifieldNext Generation Smartphones
![Page 6: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/6.jpg)
Intel devices are already fully compatible with established Android* ecosystemAndroid* Dalvik* apps
These will directly work, Dalvik has beenoptimized for Intel® platforms.
Android NDK apps Most will run without any recompilation on consumer
platforms. Android NDK provides an x86 toolchain since 2011 A simple recompile using the Android NDK yields the
best performance If there is specific processor dependent code, porting
may be necessary
Most of the time, it just works !
![Page 7: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/7.jpg)
When optimization is needed
Performance critical apps are popular Games Real time multimedia Augmented reality
Users are sensitive Don’t accept lags Fluid animations Minimal load time
![Page 8: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/8.jpg)
How to target multiple platforms (incl. x86) from NDK apps?
![Page 9: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/9.jpg)
If you have the source code of your native libraries, you can compile it for several CPU architectures by setting APP_ABI to all in the Makefile “jni/Application.mk”:
APP_ABI=all
The NDK will generate optimized code for all target ABIsYou can also pass APP_ABI variable directly to ndk-build, and specify each ABI:
ndk-build APP_ABI=x86
Configuring NDK Target ABIs
ARM v7a libs are builtARM v5 libs are builtx86 libs are built
mips libs are built
Put APP_ABI=all inside Application.mkRun ndk-build…
![Page 10: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/10.jpg)
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 (i.e., your fat binary APK would be larger than 50MB)
![Page 11: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/11.jpg)
Fat BinariesBy default, an APK contains libraries for every supported ABIs.
Use lib/armeabi libraries
Use lib/armeabi-v7a libraries
Use lib/x86 libraries
libs/armeabi-v7a
libs/x86
libs/armeabi
APK file
…
The application will be filtered during installation (after download)
![Page 12: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/12.jpg)
Multiple APKsGoogle Play* supports multiple APKs for the same application.
What compatible APK will be chosen for a device entirely depends on the android:VersionCode
If you have multiple APKs for multiple ABIs, best is to simply prefix your current version code with a digit representing the ABI:
2310 6310
You can have more options for multiple APKs, here is a convention that will work if you’re using all of these:
x86ARMv7
![Page 13: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/13.jpg)
Intel® Tools for Android* apps developersHAXM, GPA, and others
Most of Intel tools are relevant even if you’re not targeting x86 platforms!
![Page 14: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/14.jpg)
Intel x86 Emulator Accelerator
Intel x86 Atom System Image
Faster Android* Emulation on Intel® Architecture Based Host PC
Pre-built Intel® Atom™ Processor Images
• Android* SDK manager has x86 emulation images built-in
• To emulate an Intel Atom processor based Android phone, install the “Intel Atom x86 System Image” available in the Android SDK Manager
Much Faster Emulation
• Intel® Hardware Accelerated Execution Manager (Intel® HAXM) for Mac and Windows uses Intel® Virtualization Technology (Intel® VT) to accelerate Android emulator
• Intel VT is already supported in Linux* by qemu -kvm
![Page 15: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/15.jpg)
ARM and x86 Emulators running AnTuTu* Benchmark
![Page 16: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/16.jpg)
Android* on Intel platformsAnd what it means for you, developers.
Ilya Levin, Software Developer
HAXM(Hardware Accelerated Execution Manager)
![Page 17: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/17.jpg)
Intel® Graphics Performance Analyzers
• Profiles performance and Power
• Real-time charts of CPU, GPU and power metrics
• Conduct real-time experiments with OpenGL-ES* (with state overrides) to help narrow down problems
• Triage system-level performance with CPU, GPU and Power metrics
Available freely on intel.com/software/gpa
![Page 18: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/18.jpg)
Using the Second-Screen API and Intel® Wireless Display From Android* Applications
![Page 19: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/19.jpg)
What is Miracast*?• Miracast* is standard for wireless peer-to-peer
screen-casting, created and certified by the WiFi Alliance*
• Wireless replacement for HDMI*/MHL*
• Built upon existing standards
- H.264 (MPEG-4 AVC) video compression & WiFi Direct
• Based on Intel® Wi-Fi Display specifications
• Open for the industry
• Support added in Android* 4.2
![Page 20: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/20.jpg)
What is Intel® Wireless Display (WiDi)
Supports two additional Display modesExtended Video mode (with Android* media framework)Multi-task usage support (content on second screen, while local screen used for other task)
Available on most Intel® Atom™ SOCs
Intel® WiDi is a superset of WFA Miracast*
• WFA Miracast* certified– compatible with Miracast* certified receivers.
• Supports HD video up to 1080p/60 with 5.1 audio• Content protection with HDCP2.1
![Page 21: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/21.jpg)
Miracast* Concept
Video Render Audio Render
Video Decode Audio Decode
De-Packetize De-Packetize
Link Content Protection Decrypt (Optional)
AV DeMux
Transport
LLC
WI-Fi MAC (Direct Link)
Wi-Fi PHY
SINK
Video Encode Audio Encode
Packetize Packetize
Link Content Protection Encrypt (Optional)
AV Mux
Transport
LLC
WI-Fi MAC (Direct Link)
Wi-Fi PHY
Video Frames Audio Samples
SOURCE
![Page 22: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/22.jpg)
Adapters• Actiontec* ScreenBeam Pro• Netgear* (ex: PTV3000)• Viewsonic (WPG-370)• Acer*
• Best Buy* Rocketfish*
• Lenovo*
• …
Projectors• Dell*
• Seiko Epson *• Ricoh*• LG*• …
TVs• Samsung*• Toshiba*• LG*• TCL*• Sharp*• Philips*• …
Miracast* Certified Sink Devices
Intel® WiDi Certified
![Page 23: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/23.jpg)
Second-Screen Enabled Devices running Android* 4.2.x
Device Miracast* Certified
HDMI*, MHL* or SlimPort*
Samsung* Galaxy S4 Yes Yes
Samsung Galaxy Tab3 10.1 No Yes
Sony* Xperia Z Yes Yes
LG* Optimus G Yes Yes
Nexus* 4 Yes Yes
HTC* One Yes Yes
Lenovo* K900 Yes No
Asus* MeMO Pad FHD10 Yes Yes
![Page 24: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/24.jpg)
Connecting a Wireless Display on Android*
Sony* Xperia Z Stock/Intel® Samsung* Galaxy S4
![Page 25: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/25.jpg)
Clone Mode (Default)
After establishing the connection, user sees local screen on the remote display
Resolution sent to remote is the same as local display’s
No need to do anything to support this mode
![Page 26: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/26.jpg)
Remote screen used for content viewing
Local screen used for control & context info
Application can target this mode using the Android* Presentation API
Dual Screen Display With Single App
![Page 27: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/27.jpg)
Video mode is activated automatically when user plays a video using Android* Media Player framework (ex: VideoView)
User sees video content on the remote at the 1080p resolution (or whatever the native resolution of the content is)
Local video rendering is turned off to save power, but UI stays untouched
Extended Video Mode(Intel® Platform Specific)
![Page 28: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/28.jpg)
Use-Cases for Second Screen Applications Multi-Media Sharing
‒ Share videos and photos to a large screen and use handset to navigate
Gaming‒ Use handset as game controller
Productivity Apps‒ Sharing presentations to large screen or projector
IVI‒ Transfer phones screen to car head unit (Navigation)
![Page 29: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/29.jpg)
Ideas for Dual Screen Applications
Enter search term
Touchpad Mode
Web Browser
![Page 30: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/30.jpg)
Ideas for Dual Screen Applications
And
Keyboard Input Mode
wq e r t y u i o p
sa d f g h j k l
z x c v b n m&12
3/ space · searc
h
And
Web Browser
![Page 31: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/31.jpg)
Ideas for Dual Screen Applications
Games
Dual Joysticks Mode
![Page 32: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/32.jpg)
Ideas for Dual Screen Applications
Productivity App
![Page 33: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/33.jpg)
The Presentation Object
Dialog
Presentation
You need to have a fragment based navigation if you want to keep it running while navigating in the app.
The activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed.
• Presentation is the based class and should be extended:
• Presentation inherits from Dialog, and as for a Dialog its lifecycle is bound to an Activity
public class DemoPresentation extends Presentation {
• Needs to be associated with a Display at creation time
![Page 34: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/34.jpg)
Before showing a Presentation you need to select a Display, this can be done in 2 ways:
1. MediaRouter API (in API 16): system will decide the best display for you!
2. Display Manager API (in API 17): Enumeration of displays
Using the Presentation API
// Get the MediaRouter service MediaRouter mMediaRouter = (MediaRouter)getSystemService(Context.MEDIA_ROUTER_SERVICE); // Care only about routes that have full video support.MediaRouter.RouteInfo mRouteInfo = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);Display presentationDisplay = mRouteInfo.getPresentationDisplay();
// Get the DisplayManager service. DisplayManager mDisplayManager = (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); // enumerate the displaysDisplay[] presentationDisplays = mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
![Page 35: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/35.jpg)
Presentation API
MediaRouter.getSelectedRoute
(ROUTE_TYPE_LIVE_VIDEO)
MediaRouter.routeInfo
getPresentationDisplay()new Presentation
(activityContext, display)
.show()
Then, using MediaRouter.addCallback, you have to monitor:• onRouteUnselected• onRouteSelected• onRoutePresentationDisplayChanged
And inside the activity owning the Presentation:• onResume• onPause
How to get a Presentation displayed:
![Page 36: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/36.jpg)
Testing your Second-Screen AppsOptions:• Real Hardware - supporting second screen functionality• Simulate secondary screen - new feature in Android* 4.2 (in Developer options). You
can select by resolution and DPI and once activated you get an overlay emulating the secondary screen.
![Page 37: Android Meetup, Илья Лёвин](https://reader036.vdocuments.site/reader036/viewer/2022062312/554997f6b4c9050c708b4751/html5/thumbnails/37.jpg)
Q&A