Modifiche al comportamento: tutte le app

La piattaforma Android 15 include modifiche al comportamento che potrebbero influire sulla tua app. Le seguenti modifiche al comportamento si applicano a tutte le app quando vengono eseguite su Android 15, indipendentemente dal targetSdkVersion. Devi testare la tua app e poi modificarla in base alle esigenze per supportare correttamente questi comportamenti, ove applicabile.

Assicurati di esaminare anche l'elenco delle modifiche al comportamento che interessano solo le app che hanno come target Android 15.

Funzionalità di base

Android 15 modifica o espande varie funzionalità di base del sistema Android.

Modifiche allo stato interrotto del pacchetto

The intention of the package FLAG_STOPPED state (which users can engage in AOSP builds by long-pressing an app icon and selecting "Force Stop") has always been to keep apps in this state until the user explicitly removes the app from this state by directly launching the app or indirectly interacting with the app (through the sharesheet or a widget, selecting the app as live wallpaper, etc.). In Android 15, we've updated the behavior of the system to be aligned with this intended behavior. Apps should only be removed from the stopped state through direct or indirect user action.

To support the intended behavior, in addition to the existing restrictions, the system also cancels all pending intents when the app enters the stopped state on a device running Android 15. When the user's actions remove the app from the stopped state, the ACTION_BOOT_COMPLETED broadcast is delivered to the app providing an opportunity to re-register any pending intents.

You can call the new ApplicationStartInfo.wasForceStopped() method to confirm whether the app was put into the stopped state.

Supporto delle dimensioni delle pagine di 16 kB

Historically, Android has only supported 4 KB memory page sizes, which has optimized system memory performance for the average amount of total memory that Android devices have typically had. Beginning with Android 15, AOSP supports devices that are configured to use a page size of 16 KB (16 KB devices). If your app uses any NDK libraries, either directly or indirectly through an SDK, then you will need to rebuild your app for it to work on these 16 KB devices.

As device manufacturers continue to build devices with larger amounts of physical memory (RAM), many of these devices will adopt 16 KB (and eventually greater) page sizes to optimize the device's performance. Adding support for 16 KB page size devices enables your app to run on these devices and helps your app benefit from the associated performance improvements. Without recompiling, apps won't work on 16 KB devices in future Android releases.

To help you add support for your app, we've provided guidance on how to check if your app is impacted, how to rebuild your app (if applicable), and how to test your app in a 16 KB environment using emulators (including Android 15 system images for the Android Emulator).

Vantaggi e miglioramenti delle prestazioni

Devices configured with 16 KB page sizes use slightly more memory on average, but also gain various performance improvements for both the system and apps:

  • Lower app launch times while the system is under memory pressure: 3.16% lower on average, with more significant improvements (up to 30%) for some apps that we tested
  • Reduced power draw during app launch: 4.56% reduction on average
  • Faster camera launch: 4.48% faster hot starts on average, and 6.60% faster cold starts on average
  • Improved system boot time: improved by 8% (approximately 950 milliseconds) on average

These improvements are based on our initial testing, and results on actual devices will likely differ. We'll provide additional analysis of potential gains for apps as we continue our testing.

Controllare se la tua app è interessata

If your app uses any native code, then you should rebuild your app with support for 16 KB devices. If you are unsure if your app uses native code, you can use the APK Analyzer to identify whether any native code is present and then check the alignment of ELF segments for any shared libraries that you find. Android Studio also provides features that help you to automatically detect alignment issues.

If your app only uses code written in the Java programming language or in Kotlin, including all libraries or SDKs, then your app already supports 16 KB devices. Nevertheless, we recommend that you test your app in a 16 KB environment to verify that there are no unexpected regressions in app behavior.

Modifiche necessarie per alcune app per supportare lo spazio privato

Private space is a new feature in Android 15 that lets users create a separate space on their device where they can keep sensitive apps away from prying eyes, under an additional layer of authentication. Because apps in the private space have restricted visibility, some types of apps need to take additional steps to be able to see and interact with apps in a user's private space.

All apps

Because apps in the private space are kept in a separate user profile, similar to work profiles, apps shouldn't assume that any installed copies of their app that aren't in the main profile are in the work profile. If your app has logic related to work profile apps that make this assumption, you'll need to adjust this logic.

Medical apps

When a user locks the private space, all apps in the private space are stopped, and those apps can't perform foreground or background activities, including showing notifications. This behavior might critically impact the use and function of medical apps installed in the private space.

The private space setup experience warns users that the private space is not suitable for apps that need to perform critical foreground or background activities, such as showing notifications from medical apps. However, apps can't determine whether or not they're being used in the private space, so they can't show a warning to the user for this case.

For these reasons, if you develop a medical app, review how this feature might impact your app and take appropriate actions—such as informing your users not to install your app in the private space—to avoid disrupting critical app capabilities.

Launcher apps

If you develop a launcher app, you must do the following before apps in the private space will be visible:

  1. Your app must be assigned as the default launcher app for the device—that is, possessing the ROLE_HOME role.
  2. Your app must declare the ACCESS_HIDDEN_PROFILES normal permission in your app's manifest file.

Launcher apps that declare the ACCESS_HIDDEN_PROFILES permission must handle the following private space use cases:

  1. Your app must have a separate launcher container for apps installed in the private space. Use the getLauncherUserInfo() method to determine which type of user profile is being handled.
  2. The user must be able to hide and show the private space container.
  3. The user must be able to lock and unlock the private space container. Use the requestQuietModeEnabled() method to lock (by passing true) or unlock (by passing false) the private space.
  4. While locked, no apps in the private space container should be visible or discoverable through mechanisms such as search. Your app should register a receiver for the ACTION_PROFILE_AVAILABLE and ACTION_PROFILE_UNAVAILABLE broadcasts and update the UI in your app when the locked or unlocked state of the private space container changes. Both of these broadcasts include EXTRA_USER, which your app can use to refer to the private profile user.

    You can also use the isQuietModeEnabled() method to check whether the private space profile is locked or not.

App store apps

The private space includes an "Install Apps" button that launches an implicit intent to install apps into the user's private space. In order for your app to receive this implicit intent, declare an <intent-filter> in your app's manifest file with a <category> of CATEGORY_APP_MARKET.

Carattere emoji basato su PNG rimosso

Il file del carattere emoji precedente (NotoColorEmojiLegacy.ttf) basato su PNG è stato rimosso, lasciando solo il file basato su vettori. A partire da Android 13 (livello API 33), il file del carattere emoji utilizzato dal renderer emoji di sistema è passato da un file basato su PNG a un file basato su vettori. Il sistema ha mantenuto il file dei caratteri legacy in Android 13 e 14 per motivi di compatibilità, in modo che le app con i propri visualizzatori dei caratteri potessero continuare a utilizzarlo fino a quando non fosse stato possibile eseguire l'upgrade.

Per verificare se la tua app è interessata, cerca nel codice riferimenti al NotoColorEmojiLegacy.ttf file.

Puoi scegliere di adattare la tua app in diversi modi:

  • Utilizza le API di piattaforma per il rendering del testo. Puoi eseguire il rendering del testo in un Canvas basato su bitmap e utilizzarlo per ottenere un'immagine non elaborata, se necessario.
  • Aggiungi il supporto dei caratteri COLRv1 alla tua app. La libreria open source FreeType supporta COLRv1 nella versione 2.13.0 e superiori.
  • Come ultima risorsa, puoi includere il file del carattere emoji precedente (NotoColorEmoji.ttf) nel tuo APK, anche se in questo caso la tua app non avrà gli aggiornamenti emoji più recenti. Per maggiori informazioni, consulta la pagina del progetto GitHub di Noto Emoji.

Aumento della versione minima dell'SDK target da 23 a 24

Android 15 builds on the the changes that were made in Android 14 and extends this security further. In Android 15, apps with a targetSdkVersion lower than 24 can't be installed. Requiring apps to meet modern API levels helps to ensure better security and privacy.

Malware often targets lower API levels in order to bypass security and privacy protections that have been introduced in higher Android versions. For example, some malware apps use a targetSdkVersion of 22 to avoid being subjected to the runtime permission model introduced in 2015 by Android 6.0 Marshmallow (API level 23). This Android 15 change makes it harder for malware to avoid security and privacy improvements. Attempting to install an app targeting a lower API level results in an installation failure, with a message like the following one appearing in Logcat:

INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 7

On devices upgrading to Android 15, any apps with a targetSdkVersion lower than 24 remain installed.

If you need to test an app targeting an older API level, use the following ADB command:

adb install --bypass-low-target-sdk-block FILENAME.apk

Sicurezza e privacy

Android 15 introduce misure efficaci per combattere le frodi con passcode una tantum (OTP) e per proteggere i contenuti sensibili dell'utente, concentrandosi sull'aumento della sicurezza del servizio di ascolto delle notifiche e delle protezioni per la condivisione schermo. I miglioramenti principali includono l'oscuramento delle OTP dalle notifiche accessibili ad app non attendibili, la disattivazione delle notifiche durante la condivisione schermo e la protezione delle attività delle app quando vengono pubblicate le OTP. Queste modifiche hanno lo scopo di proteggere i contenuti sensibili dell'utente da soggetti non autorizzati.

Gli sviluppatori devono tenere presente quanto segue per assicurarsi che le loro app siano compatibili con le modifiche di Android 15:

Oscuramento OTP

Android impedirà alle app non attendibili che implementano un NotificationListenerService di leggere i contenuti non oscurati delle notifiche in cui è stata rilevata una OTP. Le app attendibili, come le associazioni di gestori dei dispositivi complementari, sono esenti da queste limitazioni.

Protezione Condivisione schermo

  • I contenuti delle notifiche vengono nascosti durante le sessioni di condivisione dello schermo per preservare la privacy dell'utente. Se l'app implementa setPublicVersion(), Android mostra la versione pubblica della notifica che funge da notifica sostitutiva in contesti non sicuri. In caso contrario, i contenuti della notifica vengono oscurati senza alcun ulteriore contesto.
  • I contenuti sensibili, come l'inserimento della password, vengono nascosti agli spettatori remoti per impedire la divulgazione delle informazioni sensibili dell'utente.
  • Le attività delle app che pubblicano notifiche durante la condivisione schermo in cui è stato rilevato un codice OTP verranno nascoste. I contenuti dell'app vengono nascosti all'utente remoto quando l'app viene lanciata.
  • Oltre all'identificazione automatica dei campi sensibili da parte di Android, gli sviluppatori possono contrassegnare manualmente parti della propria app come sensibili utilizzando setContentSensitivity, che viene nascosta agli spettatori remoti durante la condivisione schermo.
  • Gli sviluppatori possono scegliere di attivare/disattivare l'opzione Disattiva protezioni condivisione schermo nelle Opzioni sviluppatore per essere esentati dalle protezioni della condivisione schermo a scopo di dimostrazione o test. Lo screen recorder di sistema predefinito è esente da queste modifiche, poiché le registrazioni rimangono sul dispositivo.

Fotocamera e contenuti multimediali

Android 15 apporta le seguenti modifiche al comportamento della fotocamera e dei contenuti multimediali per tutte le app.

La riproduzione audio diretta e l'offload invalidano le tracce audio dirette o con offload aperte in precedenza quando vengono raggiunti i limiti delle risorse

Prima di Android 15, se un'app richiedeva la riproduzione audio diretta o di offload mentre un'altra app stava riproducendo audio e i limiti di risorse erano stati raggiunti, l'app non riusciva ad aprire un nuovo AudioTrack.

A partire da Android 15, quando un'app richiede la riproduzione diretta o con offload e vengono raggiunti i limiti di risorse, il sistema invalida tutti gli oggetti AudioTrack attualmente aperti che impediscono di soddisfare la nuova richiesta di traccia.

Le tracce audio dirette e di offload vengono in genere aperte per la riproduzione di formati audio compressi. Casi d'uso comuni per la riproduzione di audio diretto includono lo streaming di audio codificato tramite HDMI su una TV. Le tracce di offload vengono in genere utilizzate per riprodurre audio compresso su un dispositivo mobile con accelerazione DSP hardware.

Esperienza utente e UI di sistema

Android 15 include alcune modifiche volte a creare un'esperienza utente più coerente e intuitiva.

Animazioni predittive per Indietro attivate per le app che hanno eseguito l'opt-in

Beginning in Android 15, the developer option for predictive back animations has been removed. System animations such as back-to-home, cross-task, and cross-activity now appear for apps that have opted in to the predictive back gesture either entirely or at an activity level. If your app is affected, take the following actions:

  • Ensure that your app has been properly migrated to use the predictive back gesture.
  • Ensure that your fragment transitions work with predictive back navigation.
  • Migrate away from animation and framework transitions and use animator and androidx transitions instead.
  • Migrate away from back stacks that FragmentManager doesn't know about. Use back stacks managed by FragmentManager or by the Navigation component instead.

Widget disattivati quando l'utente arresta forzatamente un'app

Se un utente forza l'interruzione di un'app su un dispositivo con Android 15, il sistema disattiva temporaneamente tutti i widget dell'app. I widget non sono selezionabili e l'utente non può interagire con loro. Questo perché, a partire da Android 15, il sistema annulla tutti gli intent in attesa di un'app quando questa viene interrotta forzatamente.

Il sistema riattiva questi widget alla successiva apertura dell'app da parte dell'utente.

Per ulteriori informazioni, consulta Modifiche allo stato di arresto del pacchetto.

Il chip della barra di stato della proiezione dei contenuti multimediali avvisa gli utenti di condivisione dello schermo, trasmissione e registrazione

Gli exploit di proiezione dello schermo espongono i dati utente privati, come le informazioni finanziarie, perché gli utenti non si rendono conto che lo schermo del loro dispositivo viene condiviso.

Per le app in esecuzione su dispositivi con Android 15 QPR1 o versioni successive, un chip della barra di stato grande e in evidenza avvisa gli utenti di eventuali proiezioni dello schermo in corso. Gli utenti possono toccare il chip per impedire la condivisione, la trasmissione o la registrazione della schermata. Inoltre, la proiezione dello schermo si interrompe automaticamente quando lo schermo del dispositivo è bloccato.

Chip barra delle app per condivisione schermo, trasmissione e registrazione.

Check if your app is impacted

By default, your app includes the status bar chip and automatically suspends screen projection when the lock screen activates.

To learn more about how to test your app for these use cases, see Status bar chip and auto stop.

Limitazioni di accesso alla rete in background

In Android 15, apps that start a network request outside of a valid process lifecycle receive an exception. Typically, an UnknownHostException or other socket-related IOException. Network requests that happen outside of a valid lifecycle are usually due to apps unknowingly continuing a network request even after the app is no longer active.

To mitigate this exception, ensure your network requests are lifecycle aware and cancelled upon leaving a valid process lifecycle by using lifecycle aware components. If it is important that the network request should happen even when the user leaves the application, consider scheduling the network request using WorkManager or continue a user visible task using Foreground Service.

Ritiri

Con ogni release, API Android specifiche potrebbero diventare obsolete o dover essere refattorizzate per offrire una migliore esperienza per gli sviluppatori o supportare nuove funzionalità della piattaforma. In questi casi, ritiriamo ufficialmente le API obsolete e indirizziamo gli sviluppatori verso API alternative da utilizzare.

Il ritiro significa che abbiamo interrotto il supporto ufficiale per le API, ma queste continueranno a rimanere disponibili per gli sviluppatori. Per scoprire di più sui ritiri importanti in questa release di Android, consulta la pagina dei ritiri.