Random Musings on the Android 14 Developer Preview 2

Random Musings on the Android 14 Developer Preview 2

When Google releases a new developer preview, I rummage by
the API distinctions report
the substantial-level overviews,
and even the launch blog site publish,
to see if there are issues that warrant additional attention from
builders. I try to emphasize mainstream characteristics that any developer
may possibly fairly use, along with points that could not
get fairly as considerably attention, mainly because they are buried in the JavaDocs.

So… what does DP2 have in store for us?

What Received Prime-Line Protection

You can no longer get rid of application processes other than your very own.
I am stunned it took them this long to tackle this. Mishaal Rahmann
has additional on this.

You will not be equipped to install applications with a targetSdkVersion down below 23.
My hope is that Google, or any individual, works by using hypervisor tactics (or anything comparable)
to enable functioning more mature apps in a sandbox.

MediaStore tracks who owns what, but
you may not be in a position to obtain that details.

What Altered with Display Captures

There is a new DETECT_Display screen_Seize permission.
This ties into registerScreenCaptureCallback() on Exercise.
As you could guess, this lets you locate out when this activity is subject to a screen
capture. It is unclear what types of display captures are lined:

  • Screenshots only, or also screencasts?
  • Only from MediaProjection, or also from built-in OS mechanisms?
  • Does it incorporate screen captures from growth instruments, like Android Studio?

Also be aware that the callback does not make it possible for you to block the monitor seize, just
uncover out that it happened. You can block screen captures making use of FLAG_Secure, at
minimum to some extent.

There is also Motion_Launch_Capture_Material_Action_FOR_Note.
This captures a screenshot, lets the person to edit it, and presents you the
screenshot back again through the Uri shipped to onActivityResult(). Nonetheless, you will need to have to
keep the Launch_Seize_Content_Activity_FOR_Be aware permission,
which is only readily available for applications in the Position_NOTES position.

What Is Choosy

For the “share sheet” (Action_CHOOSER), there are two new extras:

What Got Highlighted

TextView bought highlighted. Specifically, there is a new setSearchResultHighlights()
system to enable you to specify ranges for highlighting text. And, as
Thomas Künneth noted
there are new Highlights and Highlights.Builder classes for extra advanced
highlighting, with setHighlights() on TextView to utilize them.

What Permissions Improved

There is a full suite of new Manage_System_Policy_* permissions, this sort of
as
Control_Unit_Coverage_Digital camera and
Handle_Machine_Coverage_Unit_IDENTIFIERS.
Presumably, this ties into DevicePolicyManager.

There is a new EXECUTE_Application_Motion permission,
minimal to assistants.

What Is Not Long For This Earth

The “long jobs” stuff in JobScheduler is now “user-initiated jobs”. So,
for illustration, the Run_Lengthy_Work opportunities permission is now Operate_User_INITIATED_Work.

What Transformed with Broadcasts

A BroadcastReceiver can simply call getSentFromUid()
and getSentFromPackage()
to locate out where the broadcast came from.

In associated information, sendBroadcast() and sendOrderedBroadcast() now have variants
that consider a Bundle that you can create using BroadcastOptions.
Suitable now, the only these kinds of option is whether or not the id-sharing talked about
in the prior paragraph is enabled.

What Else Caught My Eye

There is a new overrideActivityTransition() approach on Action.
The JavaDocs
may perhaps make your head spin, as it ties into the more mature overridePendingTransition()
strategy and “predictive back” navigation.

Overall health Link obtained its very own spouse and children of packages.

WindowManager has an addProposedRotationListener() process.
Your callback gets a rotation value (e.g., Surface.ROTATION_180).
“This listener presents software an prospect to selectively react to product orientation changes”.

The USE_Complete_Display_INTENT authorization was extra a couple of years in the past, to regulate
whether or not you can increase a total-monitor notification.
Now, there is Motion_Manage_App_USE_Total_Screen_INTENT,
which you can use to start an exercise to make it possible for the person to grant your application
permission to use “full screen intents”. And there is
canSendFullScreenIntent() on NotificationManager
to find out the standing of that permission.

PowerManager now delivers isAllowedInLowPowerStandby(),
which will explain to you if small energy standby is disabled for a single cause or a further.
You can also respond to these adjustments, it seems, by registering a receiver
for Action_Lower_Ability_STANDBY_Coverage_Improved.

JobScheduler now has the idea of namespaces.

When by default you can no for a longer period generate mutable PendingIntent objects wrapping
an implicit Intent, FLAG_Permit_UNSAFE_IMPLICIT_INTENT.
could enable you bypass that restriction.