Tuesday, July 2, 2024

The Second Developer Preview of Android 15


Posted by Dave Burke, VP of Engineering


Android 14 logo

At this time marks the second chapter of the Android 15 story with the discharge of Android 15 Developer Preview 2!

Android 15 continues our work to construct a platform that helps enhance your productiveness whereas supplying you with new capabilities to supply superior media and AI experiences, benefit from gadget kind elements, reduce battery affect, maximize easy app efficiency, and defend consumer privateness and safety, all on probably the most various lineup of gadgets on the market.

Android continues so as to add options enabling your apps to benefit from premium gadget {hardware}, together with the newest telecommunications options, high-end media capabilities, dazzling shows, foldable/filppable kind elements, and AI processing.

Your suggestions on the Android 15 Developer Preview and Beta program performs a key position in serving to Android constantly enhance. The Android 15 developer website has extra details about the preview, together with downloads for Pixel and detailed documentation about adjustments. This preview is only the start, and we’ll have tons extra to share as we transfer by means of the discharge cycle. Thanks prematurely on your assist in making Android a platform that works for everybody.

Updating Android communications

Android 15 updates the platform to present your app entry to the newest advances in communication.

Satellite tv for pc assist

Android 15 continues to increase platform assist for satellite tv for pc connectivity and consists of some UI components to make sure a constant consumer expertise throughout the satellite tv for pc connectivity panorama.

screen schot of a mobile Android device showing notification when device connects to satellite

Notification when gadget connects to satellite tv for pc

Apps can use ServiceState.isUsingNonTerrestrialNetwork() to detect when a tool is linked to a satellite tv for pc, giving them extra consciousness of why full community companies could also be unavailable. Moreover, Android 15 supplies assist for SMS/ MMS purposes in addition to preloaded RCS purposes to make use of satellite tv for pc connectivity for sending and receiving messages.

Smoother NFC experiences

Android 15 is working to make the faucet to pay expertise extra seamless and dependable whereas persevering with to assist Android’s strong NFC app ecosystem. On supported gadgets, apps can request the NfcAdapter enter observe mode, the place the gadget will pay attention however not reply to NFC readers, sending the app’s NFC service PollingFrame objects to course of. The PollingFrame objects

can be utilized to auth forward of the primary communication to the NFC reader, permitting for a one faucet transaction in lots of circumstances.

Developer productiveness

Whereas most of our work to enhance your productiveness facilities round instruments like Android Studio, Jetpack Compose, and the Android Jetpack libraries, we at all times search for methods within the platform that will help you extra simply understand your imaginative and prescient.

PDF Enhancements

screen schot of a mobile Android device showing search enabled for PDF files

Allow looking embedded PDF information with updates to PdfRenderer

Android 15 Developer Preview 2 consists of an early preview of considerable enhancements to the PdfRenderer APIs, giving apps capabilities to include superior options akin to rendering password-protected information, annotations, kind enhancing, looking, and choice with copy. Linearized PDF optimizations are supported to hurry native PDF viewing and scale back useful resource use.

The PdfRenderer has been moved to a module that may be up to date utilizing Google Play system updates unbiased of the platform launch, and we’re supporting these adjustments again to Android R by making a appropriate pre-Android 15 model of the API floor, referred to as PdfRendererPreV.

We worth your suggestions on the enhancements we have made to the PdfRenderer API floor, and we plan to make it a lot simpler to include these APIs into your app with an upcoming Android Jetpack library. Keep tuned.

Automated language switching refinements

Android 14 added on-device multi-language audio recognition with computerized switching between languages, however this will trigger phrases to get dropped, particularly when languages swap with much less of a pause between the 2 utterances. Android 15 has added extra controls to permit apps to assist tune this switching for his or her use case. EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS confines the automated switching to the start of the audio session, whereas EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES deactivates the language switching after an outlined variety of switches. This generally is a helpful refinement, notably if the expectation is that there will likely be a single language spoken through the session that needs to be autodetected.

Granular line break controls

Beginning in Android 15, the TextView and the underlying line breaker can protect the given portion of textual content in the identical line to enhance readability. You possibly can benefit from this line break customization by utilizing the <nobreak> tag in string sources or createNoBreakSpan. Equally, you may protect phrases from hyphenation by utilizing the <nohyphen> tag or createNoHyphenationSpan.

Examples and screenshots:

<sources>
    <string title="pixel8pro">The ability and brains behind Pixel 8 Professional.</string>
</sources>

text reads: The power and brains behind Pixel 8 Pro.

<sources>
    <string title="pixel8pro">The ability and brains behind <nobreak>Pixel 8 Professional.</nobreak></string>
</sources>

text reads: The power and brains behind Pixel 8 Pro.

Expanded IntentFilter Performance

Android 15 builds-in assist for extra exact Intent decision by means of UriRelativeFilterGroup, which comprise a set of UriRelativeFilter objects that kind a set of Intent matching guidelines that should every be glad, together with URL question parameters, URL fragments, and blocking/exclusion guidelines. This helps purposes higher sustain with the dynamic calls for of web-hosted deep hyperlinks.

These guidelines might be outlined within the AndroidManifest with the brand new <uri-relative-filter-group> tag which may optionally embrace an android:enable tag. These tags can comprise tags that use present knowledge tag attributes in addition to the new android:question and android:fragment attributes.

An instance of the AndroidManifest syntax that will likely be supported:

<intent-filter>
  <motion android:title="android.intent.motion.VIEW" />
  <class android:title="android.intent.class.BROWSABLE" />
  <knowledge android:scheme="http" />
  <knowledge android:scheme="https" />
  <knowledge android:area="astore.com" />
  <uri-relative-filter-group>
    <knowledge android:pathPrefix="/auth" />
    <knowledge android:question="area=na" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:enable="false">
    <knowledge android:pathPrefix="/auth" />
    <knowledge android:question="mobileoptout=true" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:enable="false">
    <knowledge android:pathPrefix="/auth" />
    <knowledge android:fragmentPrefix="faq" />
  </uri-relative-filter-group>
</intent-filter>

Extra OpenJDK API assist

Android 15 continues so as to add OpenJDK APIs. Developer Preview 2 consists of assist for added math/strictmath strategies, a number of util updates together with sequenced assortment/map/set, ByteBuffer assist in Deflater, and safety key updates. These APIs are up to date on over a billion gadgets working Android 12+ by means of Android 15 by means of Google Play System updates so you may goal the newest programming options.

Giving your app extra flexibility on extra screens

Android 15 offers your apps the assist to get probably the most out of Android’s kind elements, together with giant screens, flippables, and foldables.

Cowl display assist

Your app can declare a property that Android 15 makes use of to permit your Software or Exercise to be offered on the small cowl screens of supported flippable gadgets. These screens are too small to be thought-about as appropriate targets for Android apps to run on, however your app can opt-in to supporting them, making your app obtainable in additional locations.

A extra non-public, safe Android

We’re at all times trying to give customers extra transparency and management over their knowledge whereas enhancing the core security measures of the platform.

Display document detection

Android 15 provides assist for apps to detect that they’re being recorded. A callback is invoked each time the app transitions between being seen or invisible inside a display recording. (An app is taken into account seen if actions owned by the registering course of’s UID are being recorded.) This manner, in case your app is performing a delicate operation, you may inform the consumer that they are being recorded.

val mCallback = Client<Int> { state ->
  if (state == SCREEN_RECORDING_STATE_VISIBLE) {
    // we're being recorded
  } else {
    // we’re not being recorded
  }
}

override enjoyable onStart() {
   tremendous.onStart()
   val initialState =
      windowManager.addScreenRecordingCallback(mainExecutor, mCallback)
   mCallback.settle for(initialState)
}

override enjoyable onStop() {
    tremendous.onStop()
    windowManager.removeScreenRecordingCallback(mCallback)
}

Making Android extra environment friendly

We’re introducing new APIs that may assist you collect insights about your apps, persevering with to optimize the best way background purposes work, and offering APIs to assist make duties in your app extra environment friendly to execute.

ApplicationStartInfo API

App startup on Android has at all times been a little bit of a thriller. There was no straightforward strategy to know inside your app whether or not it began from a chilly, heat, or sizzling state. It was troublesome to know the way lengthy your app spent through the numerous launch phases: forking the method, calling onCreate, drawing the primary body, and extra. When your utility class was instantiated, you had no manner of realizing whether or not the app began from a broadcast, a content material supplier, a job, a backup, boot full, an alarm, or an Exercise.

The ApplicationStartInfo API on Android 15 offers you all of this and extra. You possibly can even select so as to add your individual timestamps into the circulation to make it straightforward to gather timing knowledge in a single place. Along with accumulating metrics, you need to use ApplicationStartInfo to assist straight optimize app startup; for instance, you may remove the expensive instantiation of UI-related libraries inside your Software class when your app is beginning up on account of a broadcast.

Adjustments to bundle stopped state

Android 15 consists of a number of enhancements to the PackageManager’s Stopped State. Apps which might be in a Stopped State ought to solely be leaving this state by means of direct consumer motion. Moreover, apps coming into the Stopped State could have their PendingIntents eliminated. To assist builders re-register their pending intents, apps will now obtain the BOOT_COMPLETED broadcast as soon as they’re faraway from the Stopped State. Lastly, the brand new ApplicationStartInfo may also embrace the ApplicationStartInfo.wasForceStopped() to let builders know that their app was put into the Stopped State.

Detailed app dimension info

Android has provided an API, StorageStats.getAppBytes(), that summarizes the put in dimension of an app as a single variety of bytes, which is a sum of the APK dimension, the scale of information extracted from the APK, and information that have been generated on the gadget akin to ahead-of-time (AOT) compiled code. This quantity just isn’t very insightful by way of how your app is utilizing storage.

Android 15 provides the StorageStats.getAppBytesByDataType([type]) API, which lets you get perception into how your app is utilizing up all that area, together with apk file splits, AOT and speedup associated code, dex metadata, libraries, and guided profiles.

Adjustments to foreground companies

Android 14 started requiring Foreground Service Varieties. The documentation mentions that the dataSync Foreground Service kind will likely be deprecated in a future model of Android.

To assist migrating away from the dataSync Foreground Service kind, Android 15 consists of the mediaProcessing Foreground Service kind, which is used to carry out time-consuming operations on media property, like changing media to totally different codecs. In a future Beta launch, this service could have a runtime restrict of 6 hours.

SQLite database

Android 15 introduces new SQLite APIs that expose superior options from the underlying SQLite engine that concentrate on particular efficiency points that may manifest in apps.

Builders ought to seek the advice of greatest practices for SQLite efficiency to get probably the most out of their SQLite database, particularly when working with giant databases or when working latency-sensitive queries.

    • Row counts and IDs: new APIs have been added to retrieve the depend of modified rows or the final inserted row ID with out issuing an extra question. getLastChangedRowCount() will return the variety of rows that have been inserted, up to date, or deleted by the latest SQL assertion inside the present transaction, whereas getTotalChangedRowCount() will return the depend on the present connection. getLastInsertRowId() will return the “rowid” of the final row to be inserted on the present connection.
    • Uncooked statements: difficulty a uncooked SQlite assertion, bypassing comfort wrappers and any extra processing overhead that they could incur.

Media refinements

Every launch of Android focuses on bettering the media expertise.

HDR Headroom Management

side by side images of SDR content

The picture on the left exhibits a view with SDR content material. The picture on the appropriate simulates perceived headroom points with SDR and HDR combined content material, which we will keep away from by setting the specified HDR headroom.

Android 15 chooses HDR headroom that’s applicable for the underlying gadget capabilities and bit-depth of the panel; for pages which have a number of SDR content material akin to a messaging app displaying a single HDR thumbnail, this will find yourself adversely influencing the perceived brightness of the SDR content material. Android 15 means that you can management the HDR headroom with setDesiredHdrHeadroom to strike a stability between SDR and HDR content material.

Loudness Management

moving image of Droid wearing headphones and bopping his head rhythmically

Android 15 introduces assist for the CTA-2075 loudness customary that will help you keep away from audio loudness inconsistencies and guarantee customers do not must continuously alter quantity when switching between content material. The system leverages recognized traits of the output gadgets (headphones, speaker) together with loudness metadata obtainable in AAC audio content material to intelligently alter the audio loudness and dynamic vary compression ranges.

To allow this characteristic, you could guarantee loudness metadata is accessible in your AAC content material and allow the platform characteristic in your app. For this, you instantiate a LoudnessCodecController object by calling its create manufacturing unit methodology with the audio session ID from the related AudioTrack; this mechanically begins making use of audio updates. You possibly can go an OnLoudnessCodecUpdateListener to change/filter loudness parameters earlier than they’re utilized on the MediaCodec.

// media comprises metadata of kind MPEG_4 OR MPEG_D
val mediaCodec = ...
val audioTrack = AudioTrack.Builder()
                                .setSessionId(sessionId)
                                .construct()
...
// create new loudness controller that applies the parameters to the MediaCodec
strive {
   val lcController = LoudnessCodecController.create(mSessionId)
   // begins making use of audio updates for every added MediaCodec

AndroidX media3 ExoPlayer will quickly be up to date to leverage LoudnessCodecController APIs for a seamless app integration.

Use Spatializer as a substitute of Virtualizer

Android 12 included the Spatializer class, which permits querying the capabilities and conduct of sound spatialization on the gadget. In Android 15, we’re deprecating the Virtualizer class; as a substitute use AudioAttributes.Builder.setSpatializationBehavior to characterize the way you need your content material to be performed when spatialization is supported.

AndroidX media3 ExoPlayer 1.0 permits spatial audio by default for multichannel audio when the gadget helps it. See the weblog submit and documentation for extra info, together with APIs to regulate the characteristic.

Consumer Expertise

AutomaticZenRules enable apps to customise Consideration Administration (Do Not Disturb) guidelines and determine when to activate/deactivate them. Android 15 tremendously enhances these guidelines with the aim of bettering the consumer expertise. It does this by:

    • Including sorts to AutomaticZenRule, permitting the system to use particular therapy to some guidelines
    • Including an icon to AutomaticZenRule, serving to to make the modes be extra recognizable
    • Including a triggerDescription string to AutomaticZenRule that describes the situations on which the rule ought to grow to be lively for the consumer
    • Added ZenDeviceEffects to AutomaticZenRule, permitting guidelines to set off issues like grayscale show, night time mode, or dimming the wallpaper

Conduct adjustments

As a result of backward compatibility is so necessary to us, we attempt to restrict impactful conduct adjustments, however some are inevitable.

Elegant fonts all over the place

As soon as your app targets Android 15, the elegantTextHeight TextView attribute turns into true by default, changing the compact font utilized by default with some scripts which have giant vertical metrics with one that’s way more readable. The compact font was launched to forestall breaking layouts; Android 13 prevents many of those breakages by permitting the textual content format to stretch the vertical top using the fallbackLineSpacing attribute. In Android 15, the compact font nonetheless stays within the system, so your app can set elegantTextHeight to false to get the identical conduct as earlier than, however it’s unlikely to be supported in upcoming releases. So, in case your utility helps the next scripts: Arabic, Lao, Myanmar, Tamil, Gujarati, Kannada, Malayalam, Odia, Telugu or Thai, please take a look at your purposes by setting elegantTextHeight to true.

Examples and screenshots

Default conduct as of Android 14

Default behavior as of Android 14

Default conduct for purposes that concentrate on Android 15

Default behavior as of Android 14

App compatibility

Android 15 release timeline

To provide you extra time to plan for app compatibility work, we’re letting you understand our Platform Stability milestone effectively prematurely.

At this milestone, we’ll ship ultimate SDK/NDK APIs and likewise ultimate inside APIs and app-facing system behaviors. We’re anticipating to succeed in Platform Stability in June 2024, and from that point you’ll have a number of months earlier than the official launch to do your ultimate testing. The discharge timeline particulars are right here.

The Developer Preview has all the things you could strive the Android 15 options, take a look at your apps, and provides us suggestions. You may get began right now by flashing a system picture onto a Pixel 6, 7, or 8 collection gadget, together with the Pixel Fold and Pixel Pill. We’re not providing sideload photos for Developer Preview 2. When you don’t have a Pixel gadget, you may use the 64-bit system photos with the Android Emulator in Android Studio. When you’ve already put in Android 15 Developer Preview 1, it’s best to get an over-the-air replace to Android 15 Developer Preview 2.

For the most effective improvement expertise with Android 15, we suggest that you just use the newest preview of Android Studio Jellyfish (or newer Jellyfish+ variations). When you’re arrange, listed here are a few of the issues it’s best to do:

    • Strive the brand new options and APIs – your suggestions is crucial through the early a part of the developer preview. Report points in our tracker on the suggestions web page.
    • Check your present app for compatibility – study whether or not your app is affected by adjustments in Android 15; set up your app onto a tool or emulator working Android 15 and extensively take a look at it.

We’ll replace the preview system photos and SDK commonly all through the Android 15 launch cycle. This preview launch is for builders solely and never meant for day by day or client use, so we’re making it obtainable by handbook obtain solely. When you’ve manually put in a preview construct, you’ll mechanically get future updates over-the-air for all later previews and Betas. Learn extra right here.

When you intend to maneuver from the Android 14 QPR Beta program to the Android 15 Developer Preview program and do not wish to must wipe your gadget, we suggest that you just transfer to Developer Preview 2 now. In any other case you might run into time durations the place the Android 14 Beta could have a newer construct date which is able to stop you from going on to the Android 15 Developer Preview with out doing an information wipe.

As we attain our Beta releases, we’ll be inviting customers to strive Android 15 as effectively, and we’ll open up enrollment for the Android Beta program at the moment. For now, please notice that the Android Beta program just isn’t but obtainable for Android 15.

For full info, go to the Android 15 developer website.

Java and OpenJDK are emblems or registered emblems of Oracle and/or its associates.



Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles