Android Meetup, Илья Лёвин


Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Add getSystemService line ?

    Display Manager: class that holds all displays connected. Requires either developer or end user to choose a Display.

    Media Router: The MediaRouter class holds all possible routes for audio and video to go (e.g. speakers and displays) but differs from Display Manager as it will automatically select the best Route (or Display in our case)

  • Your route can change, your presentation display can be disconnected, your activity can be paused, etc. Once you created your presentation, you need to care about all this.

    A presentation is automatically canceled when its display is removed.
    But the activity must take care of pausing its content when the activity itself is paused, and test if the display still exists (so the presentation) while resuming, to resume or restart it.
  • If you don’t have a WiDi adapter, Android 4.2 includes an Developer options that allows you to simulate the second display, you can choose res and dpi and it will then create an overlay of that display.

    If developer options don’t show up, tap on Build number within About phone around 5 times to bring it up.
  • Android Meetup, Илья Лёвин

    1. 1. Android* on Intel platforms Ilya Levin, Software Developer
    2. 2. 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
    3. 3. 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*
    4. 4. Tablets with Intel Inside - 2013 ASUS* 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
    5. 5. 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 Merrifield Next Generation Smartphones
    6. 6. Intel devices are already fully compatible with established Android* ecosystem Android* Dalvik* apps  These will directly work, Dalvik has been optimized 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 !
    7. 7. 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
    8. 8. How to target multiple platforms (incl. x86) from NDK apps?
    9. 9. 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/”: APP_ABI=all The NDK will generate optimized code for all target ABIs You 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 built ARM v5 libs are built x86 libs are built mips libs are built Put APP_ABI=all inside Run ndk-build…
    10. 10. 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)
    11. 11. Fat Binaries By 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)
    12. 12. Multiple APKs Google 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
    13. 13. Intel® Tools for Android* apps developers HAXM, GPA, and others Most of Intel tools are relevant even if you’re not targeting x86 platforms!
    14. 14. 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
    15. 15. ARM and x86 Emulators running AnTuTu* Benchmark
    16. 16. Android* on Intel platforms And what it means for you, developers. Ilya Levin, Software Developer HAXM (Hardware Accelerated Execution Manager)
    17. 17. 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
    18. 18. Using the Second-Screen API and Intel® Wireless Display From Android* Applications
    19. 19. 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
    20. 20. What is Intel® Wireless Display (WiDi) Supports two additional Display modes Extended 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
    21. 21. 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
    22. 22. 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
    23. 23. 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
    24. 24. Connecting a Wireless Display on Android* Sony* Xperia Z Stock/Intel® Samsung* Galaxy S4
    25. 25. 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
    26. 26.  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
    27. 27.  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)
    28. 28. 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)
    29. 29. Ideas for Dual Screen Applications Enter search term Touchpad Mode Web Browser
    30. 30. 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 &123 / space · search And Web Browser
    31. 31. Ideas for Dual Screen Applications Games Dual Joysticks Mode
    32. 32. Ideas for Dual Screen Applications Productivity App
    33. 33. 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
    34. 34. 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 displays Display[] presentationDisplays = mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
    35. 35. 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:
    36. 36. Testing your Second-Screen Apps Options: • 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.
    37. 37. Q&A
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.