The second Android 11 Developer Preview is now available, test it out and share your feedback.

ExtensionProvider

open class ExtensionProvider
kotlin.Any
   ↳ androidx.window.extensions.ExtensionProvider

A stub implementation for the class that will instantiate the Extension.

This class should be implemented by OEM and deployed to the target devices.

Summary

Public methods

open static String?

Get the version of the vendor library on this device.

open static ExtensionInterface?
getExtensionImpl(@NonNull context: Context)

Instantiate the Extension for the use by the WindowManager library.

Public methods

getApiVersion

@Nullable open static fun getApiVersion(): String?

Get the version of the vendor library on this device. If the returned version is not supported by the WindowManager library, then some functions may not be available or replaced with stub implementations.

WindowManager library provides the Semantic Versioning string in a form of MAJOR.MINOR.PATCH-description We will increment the MAJOR version when make incompatible API changes, MINOR version when add functionality in a backwards-compatible manner, and PATCH version when make backwards-compatible bug fixes. And the description can be ignored.

Vendor extension library should provide MAJOR.MINOR.PATCH to the WindowManager library. The MAJOR and MINOR version are used to identify the interface version that the library will use. The PATCH version does not indicate compatibility. The patch version should be incremented whenever the vendor library makes bug fixes or updates to the algorithm.

Return
String? the version that vendor supported in this device. The MAJOR.MINOR.PATCH format should be used.

getExtensionImpl

@Nullable open static fun getExtensionImpl(@NonNull context: Context): ExtensionInterface?

Instantiate the Extension for the use by the WindowManager library.

The library will instantiate the vendor implementation using this interface.

Return
ExtensionInterface? A compatible version of the ExtensionInterface for the provided library version string, or null if not available.