Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

What’s new in aNdroid [Google I/O Extended Bangkok 2016]

6.313 visualizaciones

Publicado el

Slides used in Google I/O Extended Bangkok 2016 session

Publicado en: Tecnología
  • Sé el primero en comentar

What’s new in aNdroid [Google I/O Extended Bangkok 2016]

  1. 1. What’s new in aNdroid
  2. 2. The Droid has no name
  3. 3. #GeekAlert
  4. 4. #teamAndroid
  5. 5. ConstraintLayout
  6. 6. Multi-Window: Split Screen
  7. 7. Freeform Mode
  8. 8. Multi-Window Lifecycle Only focused Activity is active. The rest are in “Paused” state. [Live Demo]
  9. 9. Multi-Window Lifecycle Default behavior: Recreate the Activity upon resizing Or handle it yourself: <activity android:configChanges= “screenSize|smallestScreenSize|screenLayout|orientation" ...
  10. 10. Multi-Window: Split Screen android:resizeableActivity=["true" | "false"] <activity android:name=".MyActivity"> <layout android:defaultHeight="500dp" android:defaultWidth="600dp“ android:minHeight="200dp" android:minWidth="200dp" android:gravity="top|end"/> </activity> Activity.isInMultiWindowMode() Activity.onMultiWindowModeChanged()
  11. 11. Multi-Window: Split Screen Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT
  12. 12. Multi-Window: Picture-in-Picture
  13. 13. Multi-Window: Picture-in-Picture <activity android:name=".MyActivity“ android:resizeableActivity="true“ android:supportsPictureInPicture="true" android:configChanges= “screenSize|smallestScreenSize|screenLayout|orientation" ... Activity.enterPictureInPictureMode() Activity.isInPictureInPictureMode() Activity.onPictureInPictureModeChanged()
  14. 14. Drag n’ Drop View.startDragAndDrop() View.DRAG_FLAG_GLOBAL View.DRAG_FLAG_GLOBAL_URI_READ View.DRAG_FLAG_GLOBAL_URI_WRITE View.cancelDragAndDrop() View.updateDragShadow() android.view.DragAndDropPermissions Activity.requestDragAndDropPermissions()
  15. 15. Notifications • New templates
  16. 16. Notifications • New templates • Bundled notifications
  17. 17. Notifications • New templates • Bundled notifications • Direct Reply [Live Demo]
  18. 18. Notifications • New templates • Bundled notifications • Direct Reply [Live Demo] • Custom View [Live Demo]
  19. 19. Notifications • New templates • Bundled notifications • Direct Reply [Live Demo] • Custom View [Live Demo] • Message Style
  20. 20. Quick Settings • Users: Choose your favorite tiles! • Reorder them, too • Top 5 become your even-quicker-quick-settings • [Live Demo]
  21. 21. Quick Settings • Developers: Create your own tiles! • Key classes: android.service.quicksettings.TileService onTileAdded(), onTileRemoved() onStartListening(), onStopListening() onClick() getQsTile() -> android.service.quicksettings.Tile setState(), setLabel(), setIcon() then, updateTile()
  22. 22. Quick Settings <service android:name=".MyTileService" android:label="@string/starting_label" android:icon="@drawable/starting_icon" android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> <intent-filter> <action android:name="android.service.quicksettings.action.QS_TILE" /> </intent-filter> </service>
  23. 23. Display Size • User-determined display size • All UI, not just text • .85x – 1.45x • Avoid px • Ensure your app works well on sw320dp
  24. 24. Multi-Locale • User can select multiple languages • And order them • Also added new languages, variants • [Live Demo]
  25. 25. Doze Marshmallow
  26. 26. The ~Extended~ Doze mode N
  27. 27. Doze in N
  28. 28. Doze • Marshmallow • Screen off, on battery, stationary • Restricts network, services, defers jobs, syncs, alarms • N • All of the above, plus • Screen off, on battery, not stationary • Restricts network, defers jobs, syncs
  29. 29. Project Svelte ConnectivityManager.CONNECTIVITY_ACTION Camera.ACTION_NEW_PICTURE Camera.ACTION_NEW_VIDEO JobScheduler JobScheduler.Builder.addTriggerContentUri(); Goodbye Hello!
  30. 30. Data Saver
  31. 31. Data Saver Flowchart
  32. 32. Data Saver getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager.isActiveNetworkMetered(); ConnectivityManager.getRestrictBackgroundStatus();
  33. 33. Data Saver
  34. 34. Direct Boot
  35. 35. Direct Boot: App Storage Areas
  36. 36. Direct Boot: App Storage Areas
  37. 37. Direct Boot: App Storage Areas
  38. 38. Direct Boot <receiver android:directBootAware="true" > ... <intent-filter> <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver>
  39. 39. Scoped Directory Access StorageManager sm = (StorageManager)getSystemService(Context.STORAGE_SERVICE); StorageVolume volume = sm.getPrimaryVolume(); Intent intent = volume.createAccessIntent(Environment.DIRECTORY_PICTURES); startActivityForResult(intent, request_code);
  40. 40. Android for Work
  41. 41. Runtime • Faster interpreter • JIT • Faster install times • Less space consumed on device • Faster reboots • Apps use partial AOT • Only for hotspots
  42. 42. New Runtime Libraries • ICU4J • Unicode and globalization support • Subset exposed in android.icu • Avoids conflicts with com.ibm.icu • Deprecated and unstable APIs omitted • Functional Interface • java.util.function • java.util.stream
  43. 43. Java 8 Language Features • Require the Jack toolchain android { ... defaultConfig { ... jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } }
  44. 44. Lambdas • Implemented using anonymous class • Backward compatible with Gingerbread Vertex[] v = new Vertex[100]; // ... Arrays.sort(v, (Vertex v1, Vertex v2) -> { return v1.length() - v2.length(); }); Arrays.sort(v, (v1, v2) -> v1.length() - v2.length()); Arrays.sort(v, VertexFactory::compareVertices);
  45. 45. Default & Static Interface Methods • Not backward compatible public interface Renderable { void draw(Canvas c); default bool isHardwardAccelerated() { return false; } static int getMaxTextureSize() { return 2048; } } public interface FrameListener { default void onFrameStarted() { } default void onFrameEnded() { } }
  46. 46. Stream APIs • Not backward compatible List<String> dictionary = ... dictionary.stream() .filter(s -> s.contains("droid")) .sorted() .limit(10) .forEach(s -> Log.d(TAG, "I love the word " + s));
  47. 47. Repeating Annotations • Not backward compatible @Schedule(metered=false, frequencyInHours=24) @Schedule(metered=true, frequencyInHours=1) public void fullSync() { ... }
  48. 48. Java Audio Latency • Previous releases reduced native latency • Lower latency AudioTrack (40-70ms reduction) AudioAttributes attributes = new AudioAttributes.Builder() .setFlags(AudioAttributes.FLAG_LOW_LATENCY) .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) .build(); • Dynamic resize of AudioTrack buffers • Underruns query
  49. 49. Renderscript • Single source • Many kernels in a single file • Launch kernels from kernels • Reduction kernels • Access multiple image buffers from video streams • Allocation.getByteBuffer() to reduce copies • Enhanced fp16 support
  50. 50. OpenGL ES 3.2 • GLES 3.1 + Android extension pack • Except EXT_texture_sRGB_decode • Advanced blending equations • Tesselation shaders • Geometry shaders • ASTC (LDR) • Image atomics • Floating point framebuffers
  51. 51. Vulkan • Low-level, low-overhead, cross-platform 3D API • Asynchronous/multithreaded command generation • Intermediate shader binary format (SPIR-V) • Offline shaders compilation • Object-based API, no global state • Explicit memory management and synchronization • No error checking
  52. 52. adb shell • Returns remote process exit status • Pass-through stdin $ cat README | adb shell wc -l • Handles window size and terminal type • Improved command line tools (ls, etc.) • Improved performance (push, pull)
  53. 53. NDK • Clang 3.8 • GCC 4.9 • Switch to clang, GCC is deprecated! • ARM toolchains default to arm7 arch
  54. 54. VR Activity.setVRModeEnabled(boolean); https://developers.google.com/vr/android/
  55. 55. Support Library Future is here
  56. 56. Support Library • Night Mode • Bottom Sheets • VectorDrawable / AnimatedVectorDrawable • RecyclerView • Design Support Library • Chrome Custom Tabs • etc.
  57. 57. Other UI Goodies • VectorDrawable performance improvements • Loading, rendering improved 20-90% in N • FloatProperty / IntProperty
  58. 58. Android Instant Apps
  59. 59. Android Instant Apps • Sneak preview now • Rolling out to developers over the next year • Build inside Android Studio • Just a different build artifact • Demos in the Play Sandbox
  60. 60. Android N Release Date
  61. 61. Go Get It!
  62. 62. Go Get It! Learn: d.android.com/preview Get: d.android.com/preview/setup-sdk.html Report: d.android.com/preview/bug
  63. 63. Thank you

×