Hello, Developers Android 11 introduces great new features and APIs for developers.
Device controls
createPublisherFor(List controlIds)
Return a valid Publisher for the given controlIds.
createPublisherForAllAvailable()
Publisher for all available controls Retrieve all available controls.
createPublisherForSuggested()
(Optional) Publisher for suggested controls The service may be asked to provide a small number of recommended controls, in order to suggest some controls to the user for favoriting.
onBind(Intent intent)
Return the communication channel to the service.
onUnbind(Intent intent)
Called when all clients have disconnected from a particular interface published by the service.
performControlAction(String controlId, ControlAction action, Consumer consumer)
The user has interacted with a Control.
requestAddControl(Context context, ComponentName componentName, Control control)
Request SystemUI to prompt the user to add a control to favorites.
waterfall displays
Call DisplayCutout.getWaterfallInsets() to get exact dimensions of the waterfall inset.
Chat Bubbles
- The BubbleMetadata.Builder() constructor with no parameters is deprecated. Instead, use either of the two new constructors BubbleMetadata.Builder(PendingIntent, Icon) or BubbleMetadata.Builder(String).
- Create BubbleMetadata from a shortcut ID by calling BubbleMetadata.Builder(String). The string passed should match the shortcut ID provided to Notification.Builder.
- Create bubble icons with Icon.createWithContentUri(), or with the new method createWithAdaptiveBitmapContentUri().
Biometric Authentication types
BiometricManager.Authenticators interface, which you can use to declare the types of authentication that your app supports.
authentication type
you can check whether the user authenticated using a device credential or a biometric credential by calling getAuthenticationType().
QoS API
The new Quality of Service API includes support for prioritization and task deadlines in NNAPI.
- ANeuralNetworksDevice_wait()
- ANeuralNetworksCompilation_setPriority()
- ANeuralNetworksCompilation_setTimeout()
- ANeuralNetworksExecution_setTimeout()
Memory domain input/output
NNAPI 1.3 includes support for memory domains as input and output to execution. This removes unnecessary copies of the same data among different system components, improving the runtime performance of Android neural networks. This feature adds a set of new NDK APIs for use with ANeuralNetworksMemoryDesc and ANeuralNetworkMemory objects.
- ANeuralNetworksMemoryDesc_create()
- ANeuralNetworksMemoryDesc_free()
- ANeuralNetworksMemoryDesc_addInputRole()
- ANeuralNetworksMemoryDesc_addOutputRole()
- ANeuralNetworksMemoryDesc_setDimensions()
- ANeuralNetworksMemoryDesc_finish()
- ANeuralNetworksMemory_createFromDesc()
- ANeuralNetworksMemory_copy()
Dependency API and sync fence support
NNAPI 1.3 includes support for asynchronous compute with dependencies, allowing greatly reduced overhead when invoking small chained models.
- ANeuralNetworksEvent_createFromSyncFenceFd()
- ANeuralNetworksEvent_getSyncFenceFd()
- ANeuralNetworksExecution_startComputeWithDependencies()
Control flow
NNAPI 1.3 includes support for general control flow with the new graph operations ANEURALNETWORKS_IF and ANEURALNETWORKS_WHILE, which accept other models as arguments using the new ANEURALNETWORKS_MODEL operand type.
- ANeuralNetworksModel_setOperandValueFromModel()
- ANeuralNetworks_getDefaultLoopTimeout()
- ANeuralNetworks_getMaximumLoopTimeout()
- ANeuralNetworksExecution_setLoopTimeout()
Improved IME transitions
- To show an IME while any EditText has the focus, call view.getInsetsController().show(Type.ime()).
- To hide the IME, call view.getInsetsController().hide(Type.ime())
- You can check whether an IME is currently visible by calling view.getRootWindowInsets().isVisible(Type.ime())
- To synchronize your app’s views with the appearance and disappearance of the IME, set a listener on a view by providing a WindowInsetsAnimation.Callback to View.setWindowInsetsAnimationCallback()
Controlling the IME animation
You can also take control of the IME animation, or the animation of another system bar like the navigation bar
call setOnApplyWindowInsetsListener()
To move the IME or other system bar, call the controller’s controlWindowInsetsAnimation() method.
Allocating MediaCodec buffers
- MediaCodec.LinearBlock
- MediaCodec.OutputFrame
- MediaCodec.QueueRequest
- MediaCodec.getQueueRequest()
- MediaCodec.getOutputFrame()
- MediaCodec.LinearBlock.isCodecCopyFreeCompatible()
- Instead of calling MediaCodec.getOutputBuffer() with the index, apps may use MediaCodec.getOutputFrame()
- Instead of calling MediaCodec.getInputBuffer() and MediaCodec.queueInputBuffer() with the index, apps should use MediaCodec.getQueueRequest
Low-latency decoding in MediaCodec
You can check whether a codec supports low-latency decoding by passing FEATURE_LowLatency to MediaCodecInfo.CodecCapabilities.isFeatureSupported().
Set the new key KEY_LOW_LATENCY to 0 or 1 using MediaCodec.configure().
Set the new parameter key PARAMETER_KEY_LOW_LATENCY to 0 or 1 using MediaCodec.setParameters().
concurrent use of more than one camera
- getConcurrentCameraIds() returns a Set of combinations of camera IDs that can stream concurrently with guaranteed stream combinations when configured by the same application process.
- isConcurrentSessionConfigurationSupported() queries whether camera devices can concurrently support the corresponding session configurations.
Accessibility
- To work with a description of a UI element’s state that’s more semantically meaningful than contentDescription, call the getStateDescription() method.
- To request that touch events bypass the system’s touch explorer, call setTouchExplorationPassthroughRegion(). Similarly, to request that gestures bypass the system’s gesture detector, call setGestureDetectionPassthroughRegion().
- You can request IME actions, such as “enter” and “next”, as well as screenshots of windows that don’t enable the FLAG_SECURE flag.
App process exit reasons
ActivityManager.getHistoricalProcessExitReasons() method, which reports the reasons for any recent process terminations.
setProcessStateSummary() method to store custom state information for later analysis
Yes Correct: Hello Developers, Android 11 has some interesting features for you.
Happy Coding 🙂
Discover more from CODE t!ps
Subscribe to get the latest posts sent to your email.