what’s new in android [google i/o extended bangkok 2016]

67
What’s new in aNdroid

Upload: sittiphol-phanvilai

Post on 16-Apr-2017

5.373 views

Category:

Technology


1 download

TRANSCRIPT

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

What’s new in aNdroid

Page 2: What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Page 3: What’s new in aNdroid [Google I/O Extended Bangkok 2016]

The Droid has no name

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

#GeekAlert

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

#teamAndroid

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

ConstraintLayout

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

Multi-Window: Split Screen

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

Freeform Mode

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

Multi-Window LifecycleOnly focused Activity is active.

The rest are in “Paused” state.

[Live Demo]

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

Multi-Window LifecycleDefault behavior:

Recreate the Activity upon resizing

Or handle it yourself:

<activity android:configChanges= “screenSize|smallestScreenSize|screenLayout|orientation" ...

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

Multi-Window: Split Screenandroid: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()

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

Multi-Window: Split ScreenIntent.FLAG_ACTIVITY_LAUNCH_ADJACENT

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

Multi-Window: Picture-in-Picture

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

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()

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

Drag n’ DropView.startDragAndDrop() View.DRAG_FLAG_GLOBAL View.DRAG_FLAG_GLOBAL_URI_READ View.DRAG_FLAG_GLOBAL_URI_WRITE

View.cancelDragAndDrop()View.updateDragShadow()

android.view.DragAndDropPermissionsActivity.requestDragAndDropPermissions()

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

Notifications• New templates

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

Notifications• New templates• Bundled notifications

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

Notifications• New templates• Bundled notifications• Direct Reply [Live Demo]

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

Notifications• New templates• Bundled notifications• Direct Reply [Live Demo]• Custom View [Live Demo]

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

Notifications• New templates• Bundled notifications• Direct Reply [Live Demo]• Custom View [Live Demo]• Message Style

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

Quick Settings• Users: Choose your favorite tiles!• Reorder them, too• Top 5 become your

even-quicker-quick-settings

• [Live Demo]

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

Quick Settings• Developers: Create your own tiles!• Key classes:

android.service.quicksettings.TileServiceonTileAdded(), onTileRemoved()onStartListening(), onStopListening()onClick()

getQsTile() -> android.service.quicksettings.TilesetState(), setLabel(), setIcon()then, updateTile()

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

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>

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

Display Size• User-determined display size

• All UI, not just text

• .85x – 1.45x• Avoid px• Ensure your app works well on sw320dp

Page 25: What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Page 26: What’s new in aNdroid [Google I/O Extended Bangkok 2016]

Multi-Locale• User can select multiple languages

• And order them

• Also added new languages, variants

• [Live Demo]

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

DozeMarshmallow

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

The ~Extended~ Doze modeN

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

Doze in N

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

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

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

Project SvelteConnectivityManager.CONNECTIVITY_ACTIONCamera.ACTION_NEW_PICTURECamera.ACTION_NEW_VIDEO

JobSchedulerJobScheduler.Builder.addTriggerContentUri();

Goodbye

Hello!

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

Data Saver

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

Data Saver Flowchart

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

Data Saver

getSystemService(Context.CONNECTIVITY_SERVICE);

ConnectivityManager.isActiveNetworkMetered();

ConnectivityManager.getRestrictBackgroundStatus();

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

Data Saver

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

Direct Boot

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

Direct Boot: App Storage Areas

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

Direct Boot: App Storage Areas

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

Direct Boot: App Storage Areas

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

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>

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

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);

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

Android for Work

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

Runtime• Faster interpreter• JIT

• Faster install times• Less space consumed on device• Faster reboots

• Apps use partial AOT• Only for hotspots

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

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

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

Java 8 Language Features• Require the Jack toolchain

android { ... defaultConfig { ... jackOptions { enabled true } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }}

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

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);

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

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() { }}

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

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));

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

Repeating Annotations• Not backward compatible

@Schedule(metered=false, frequencyInHours=24)@Schedule(metered=true, frequencyInHours=1)public void fullSync() { ...}

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

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

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

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

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

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

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

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

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

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)

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

NDK• Clang 3.8• GCC 4.9• Switch to clang, GCC is deprecated!• ARM toolchains default to arm7 arch

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

VR

Activity.setVRModeEnabled(boolean);

https://developers.google.com/vr/android/

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

Support Library

Future is here

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

Support Library• Night Mode• Bottom Sheets• VectorDrawable / AnimatedVectorDrawable• RecyclerView• Design Support Library• Chrome Custom Tabs• etc.

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

Other UI Goodies• VectorDrawable performance improvements• Loading, rendering improved 20-90% in N

• FloatProperty / IntProperty

Page 60: What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Page 61: What’s new in aNdroid [Google I/O Extended Bangkok 2016]

Android Instant Apps

Page 62: What’s new in aNdroid [Google I/O Extended Bangkok 2016]
Page 63: What’s new in aNdroid [Google I/O Extended Bangkok 2016]

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

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

Android N Release Date

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

Go Get It!

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

Go Get It!

Learn: d.android.com/preview

Get: d.android.com/preview/setup-sdk.html

Report: d.android.com/preview/bug

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

Thank you