11. Apps targeting M can:
can ask for any permission at any time
Legacy apps will:
get all permissions at install time, as before
Users can:
deny any permissions upon request
deny any permissions at any later time – even legacy apps
18. Two APIs for fingerprints
FingerprintManager.authenticate()
Verify that authorized user is present
Your app controls all UI
KeyguardManager.createConfirmDeviceCredentialIntent()
Present lock screen to user
startActivityForResult(), check for RESULT_OK
Sample code
github.com/googlesamples/android-FingerprintDialog
github.com/googlesamples/android-ConfirmCredential
26. Power improvements
Better screen-off battery life
Doze
Untouched devices become “inactive”
Wait longer to wake up for background tasks
Resume normal operation when moved, used, or plugged in
App standby
Unused apps lose network access
Resume when launched/used or when plugged in
28. Assistant Support
New APIs to provide the assistant with relevant data
See SDK docs:
Activity.onProvideAssistData(Bundle)
Application.OnProvideAssistDataListener
42. Icons in Notifications
Icon ic = Icon.createWithResource(context,
R.drawable.ic_notification);
Notification no = Notification.Builder(context)
.setSmallIcon(ic)
...
.build();
43. Icons in Notifications
Icon ic = Icon.createWithBitmap(iconBitmap);
Notification no = Notification.Builder(context)
.setSmallIcon(ic)
...
.build();
49. Establishing app links
At install time
Package Manager fetches statements.json
Matches hash to APK’s signing certificate
These links will now launch your app
On failure, a link is not created
Usual intent chooser will be shown
Users can review & modify app links
Settings -> Apps -> (Your App) -> Open by default
50. <activity ...>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host=“example.com" />
<data android:scheme="http" android:host="www.example.com" />
</intent-filter>
</activity>
AndroidManifest.xml
This is where we will look for /.well-known/statements.json
51. Establishing app links
At install time
Package Manager fetches statements.json
Matches hash to APK’s signing certificate
These links will now launch your app
On failure, a link is not created
Usual intent chooser will be shown
Users can review & modify app links
Settings -> Apps -> (Your App) -> Open by default
56. Bluetooth stylus support
Want to make a Bluetooth stylus?
Report pressure and buttons using Bluetooth HID
Android M will fuse this with touch events
Result touch stream will be TOOL_TYPE_STYLUS
(or TOOL_TYPE_ERASER)
Bluetooth stylus support for every app and every M device
57. New stylus API in M
Button support
ACTION_BUTTON_PRESS, ACTION_BUTTON_RELEASE,
BUTTON_STYLUS_PRIMARY, BUTTON_STYLUS_SECONDARY
Gesture support
ScaleGestureDetector.setStylusScaleEnabled(bool)
Quick scale with button-click+drag
OnGestureListener.onStylusButtonPress
Use this for selection & drag-and-drop
59. RenderScript Compute
BLAS intrinsics
(Really big matrices)
Allocation-less launches
Size of kernel separate from data
ScriptGroup
More dependency types
Better compiler optimizations
60. Camera
New Torch mode
Independent of camera device
CameraManager.setTorchMode(String cameraId, boolean enabled);
public abstract class CameraManager.TorchCallback {
public void onTorchModeUnavailable(String cameraId) {}
public void onTorchModeChanged(String cameraId, boolean enabled) {}
}
61. MIDI
Your could already do this…
… but it was a lot of work
Introducing … android.media.midi
MidiDeviceManager
MidiInputPort
MidiOutputPort
MidiDeviceService
62. High Resolution Audio
Audio samples: single-precision float
Sample rate: 96 kHz
USB digital audio: multichannel
66. Systrace
ListView item recycling involved inflating views. Ensure
Your Adapter#getView() recycles the incoming View,
Instead of constructing a new one.