Back in October 2021, Google made the Android 12L Developer Preview public. This feature drop is expected to become final for AOSP in Q1 2022. Starting in December, three beta versions are scheduled until then. Like in the past, this new version will get a new API level (probably 32). With Beta 2, system behaviours and APIs are finalized. Currently, you need to use
minSdkVersion. To get an idea of what will be new, and what will change, you should look at the Android API Differences Report. In this short port, I'll show you a few interesting changes and features.
Let's start with
android.media. This packages sees one new class (
Spatializer) and one accompanying interface (
Spatializer.OnSpatializerStateChangedListener). According to the documentation,
provides access to querying capabilities and behaviour of
sound spatialization on the device. Sound spatialization
simulates sounds originating around the listener as if they
were coming from virtual speakers placed around the listener.
As Android 12L is designed for large screens, it makes perfect sense to update the multimedia experience on these devices, as they are often used to enjoy audio and video content. Support for spatialization is optional, so you need to check if the feature is supported using isAvailable().
OnSpatializerStateChangedListener allows your app to get notified of changes to the state of the spatializer effect.
AudioManager has a new method getSpatializer(). It returns a handle to the optional platform's
Spatializer. The returned value is never
android.service.voice.VoiceInteractionSession was added with API level 21. According to the documentation, provides
a facility for the implementation to interact with the user in
the voice interaction layer. The user interface is initially
shown by default, and can be created be overriding
onCreateContentView()in which the UI can be built.
A voice interaction session can be self-contained, ultimately
finish()when done. It can also initiate voice
interactions with applications by calling
The new method registerVisibleActivityCallback registers a callback that will be notified when visible activities have been changed.
VoiceInteractionSession.VisibleActivityCallback defines two methods:
onInvisible(VoiceInteractionSession.ActivityId activityId)is called to inform that a visible activity has gone
onVisible(VisibleActivityInfo activityInfo)is called to inform that an activity has become visible
unregisterVisibleActivityCallback() unregisters the callback.
As you have just seen, another new class related to this is
android.service.voice.VisibleActivityInfo. According to the documentation, it is
used to represent a visible activity information. The system
provides this to services that need to know
To obtain the isnatce, just invoke
getActivityId(), which returns a
You will also get an instance of
VoiceInteractionSession.ActivityId, for example, from
onInvisible() of the
ActivityId inside a
onInvisible() receive it directly is, at the time of writing, not obvious.
You can pass
ActivityId to, at least,
requestDirectActions() of a
There are some other changes and additions in various places. For example, class
android.os.Environment seems to undeprecate
getExternalStoragePublicDirectory(String). Both methods were deprecated with API level 29. At the time of writing, the implications of this are not obvious (at least to the author 🤣).
There also seems to be a new
Manifest.permission on the way, as the
LAUNCH_TWO_PANE_SETTINGS_DEEP_LINK constant suggests. The documentation says:
An application needs this permission for
Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINKto show its
Activity in 2-pane of Settings app.
ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK currently reads:
Activity Action: For system or preinstalled apps to show their
Activityin 2-pane mode in Settings app on large screen
Google will likely be detailing the workflow in later beta versions.
As for most early preview versions, some API changes or additions are not immediately clear. Usually, Google explains them sooner or later. What do you think about the new feature drop? There surely are quite a few interesting things waiting for us in later betas, right? Please share your thoughts in the comments.