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 da targetSdkVersion
. Devi testare la tua app e poi modificarla
in base alle necessità per supportarli correttamente, 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 di interruzione del pacchetto
软件包 FLAG_STOPPED
状态(用户可以通过在 AOSP build 中长按应用图标并选择“强制停止”来启用此状态)的用途一直是让应用保持在此状态,直到用户通过直接启动应用或间接与应用互动(通过 Sharesheet 或 widget、将应用选择为动态壁纸等)来明确将应用从此状态移除。在 Android 15 中,我们更新了系统行为,使其与此预期行为保持一致。应用应仅通过直接或间接的用户操作从停止状态移除。
为了支持预期行为,除了现有限制之外,当应用在搭载 Android 15 的设备上进入停止状态时,系统还会取消所有待处理 intent。当用户的操作将应用从停止状态移除时,系统会将 ACTION_BOOT_COMPLETED
广播传送到应用,以便应用有机会重新注册所有待处理 intent。
您可以调用新的 ApplicationStartInfo.wasForceStopped()
方法来确认应用是否已进入停止状态。
Supporto delle dimensioni delle pagine di 16 kB
Storicamente, Android ha supportato solo dimensioni delle pagine di memoria di 4 KB, il che ha ottimizzato le prestazioni della memoria di sistema per la quantità media di memoria totale che i dispositivi Android hanno in genere avuto. A partire da Android 15, AOSP supporta i dispositivi configurati per utilizzare una dimensione pagina di 16 KB (dispositivi da 16 KB). Se la tua app utilizza librerie NDK, direttamente o indirettamente tramite un SDK, dovrai ricompilare l'app per farla funzionare su questi dispositivi da 16 KB.
Man mano che i produttori di dispositivi continuano a creare dispositivi con quantità maggiori di memoria fisica (RAM), molti di questi dispositivi adotteranno dimensioni delle pagine di 16 KB (e alla fine maggiori) per ottimizzare le prestazioni del dispositivo. L'aggiunta del supporto per i dispositivi con dimensioni di pagina di 16 kB consente alla tua app di essere eseguita su questi dispositivi e di sfruttare i miglioramenti delle prestazioni associati. Senza ricompilazione, le app non funzioneranno sui dispositivi da 16 KB nelle versioni future di Android.
Per aiutarti ad aggiungere il supporto per la tua app, abbiamo fornito indicazioni su come verificare se la tua app è interessata, su come ricompilare l'app (se applicabile) e su come testarla in un ambiente da 16 kB utilizzando emulatori (incluse le immagini di sistema Android 15 per Android Emulator).
Vantaggi e miglioramenti delle prestazioni
配置为使用 16 KB 页面大小的设备平均会使用略多一些的内存,但系统和应用的性能也会得到各种提升:
- 缩短了系统内存压力时的应用启动时间:平均降低了 3.16%;对于我们测试的某些应用而言,改进幅度更大(最高可达 30%)
- 应用启动期间的功耗降低:平均降低了 4.56%
- 相机启动更快:热启动速度平均提高了 4.48%,冷启动速度平均提高了 6.60%
- 缩短了系统启动时间:平均缩短了 8%(约 950 毫秒)
这些改进基于我们的初始测试,实际设备上的结果可能会有所不同。随着测试的继续进行,我们将进一步分析应用的潜在收益。
Controllare se la tua app è interessata
如果您的应用使用了任何原生代码,则应重新构建应用,使其支持 16 KB 设备。如果您不确定自己的应用是否使用了原生代码,可以使用 APK 分析器来确定是否存在任何原生代码,然后检查您找到的任何共享库的 ELF 段对齐情况。Android Studio 还提供了一些功能,可帮助您自动检测对齐问题。
如果您的应用仅使用以 Java 或 Kotlin 编程语言编写的代码(包括所有库或 SDK),则该应用已支持 16 KB 设备。不过,我们建议您在 16 KB 环境中测试应用,以验证应用行为是否出现意外的回归。
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:
- Your app must be assigned as the default launcher app for the device—that
is, possessing the
ROLE_HOME
role. - 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:
- 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. - The user must be able to hide and show the private space container.
- The user must be able to lock and unlock the private space container. Use
the
requestQuietModeEnabled()
method to lock (by passingtrue
) or unlock (by passingfalse
) the private space. 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
andACTION_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 includeEXTRA_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 基于
在 Android 14 中进行的更改,并扩展了
安全性。在 Android 15 中,
无法安装低于 24 的 targetSdkVersion
。
要求应用符合现代 API 级别有助于确保更好的安全性和
保护隐私。
恶意软件通常会以较低的 API 级别为目标平台,以绕过安全和隐私
更高的 Android 版本中引入的保护机制。例如,有些恶意软件应用使用 targetSdkVersion
22,以避免受到 Android 6.0 Marshmallow(API 级别 23)在 2015 年引入的运行时权限模型的约束。这项 Android 15 变更使恶意软件更难以规避安全和隐私权方面的改进限制。尝试安装以较低 API 级别为目标平台的应用将导致安装失败,并且 Logcat 中会显示如下所示的消息:
INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 24, but found 7
在升级到 Android 15 的设备上,targetSdkVersion
级别较低的任何应用
安装在 Google Play 上
如果您需要测试以旧版 API 级别为目标平台的应用,请使用以下 ADB 命令:
adb install --bypass-low-target-sdk-block FILENAME.apk
Sicurezza e privacy
Android 15 引入了强大的措施来防范动态密码 (OTP) 欺诈并保护用户的敏感内容,重点是增强通知监听器服务和屏幕共享保护措施。主要增强功能包括从可供不可信应用访问的通知中隐去 OTP、在屏幕共享期间隐藏通知,以及在发布 OTP 时保护应用 activity。这些变更旨在保护用户的敏感内容,使其免受未经授权的操作者的侵害。
开发者需要注意以下事项,以确保其应用与 Android 15 中的变更兼容:
动态密码隐去
Android 会阻止实现 NotificationListenerService
的不受信任应用读取已检测到 OTP 的通知中的未隐去的内容。配套设备管理器关联等受信任应用不受这些限制。
屏幕共享保护
- 在屏幕共享会话期间,系统会隐藏通知内容,以保护用户的隐私。如果应用实现了
setPublicVersion()
,Android 会显示通知的公开版本,该版本在不安全情境中用作替换通知。否则,系统会隐去通知内容,不提供任何其他背景信息。 - 系统会向远程观看者隐藏密码输入等敏感内容,以防止泄露用户的敏感信息。
- 如果在屏幕共享期间检测到动态密码,系统会隐藏在该时间段内发布通知的应用的活动。应用内容在启动时会向远程查看器隐藏。
- 除了 Android 自动识别敏感字段之外,开发者还可以使用
setContentSensitivity
手动将应用的部分标记为敏感,在屏幕共享期间,这些敏感字段会对远程观看者隐藏。 - 开发者可以选择切换开发者选项下的停用屏幕共享防护选项,以便出于演示或测试目的豁免屏幕共享防护。默认的系统屏幕录制工具不受这些更改的影响,因为录制内容会保留在设备上。
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
Before Android 15, if an app requested direct or offload audio playback while
another app was playing audio and the resource limits were reached, the app
would fail to open a new AudioTrack
.
Beginning with Android 15, when an app requests direct or offload
playback and the resource
limits are reached, the system invalidates any currently open
AudioTrack
objects which prevent fulfilling the new track request.
(Direct and offload audio tracks are typically opened for playback of compressed audio formats. Common use-cases for playing direct audio include streaming encoded audio over HDMI to a TV. Offload tracks are typically used to play compressed audio on a mobile device with hardware DSP acceleration.)
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
从 Android 15 开始,预测性返回动画的开发者选项已被移除。现在,如果应用已完全或在 activity 级别选择启用预测性返回手势,则系统会为其显示“返回主屏幕”“跨任务”和“跨 activity”等系统动画。如果您的应用受到了影响,请执行以下操作:
- 确保您的应用已正确迁移,以使用预测性返回手势。
- 确保 fragment 转场效果可与预测性返回导航搭配使用。
- 请弃用动画和框架过渡,改用动画和 androidx 过渡。
- 从
FragmentManager
不认识的返回堆栈迁移。请改用由FragmentManager
或 Navigation 组件管理的返回堆栈。
Widget disattivati quando l'utente arresta forzatamente un'app
If a user force-stops an app on a device running Android 15, the system temporarily disables all the app's widgets. The widgets are grayed out, and the user cannot interact with them. This is because beginning with Android 15, the system cancels all an app's pending intents when the app is force-stopped.
The system re-enables those widgets the next time the user launches the app.
For more information, see Changes to package stopped state.
Il chip della barra di stato della proiezione dei contenuti multimediali avvisa gli utenti della condivisione dello schermo, della trasmissione e della 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.

检查您的应用是否受到影响
默认情况下,您的应用会包含状态栏条状标签,并会在锁定屏幕激活时自动暂停屏幕投影。
如需详细了解如何针对这些用例测试应用,请参阅状态栏条状标签和自动停止。
Limitazioni di accesso alla rete in background
在 Android 15 中,如果应用在有效的进程生命周期之外启动网络请求,则会收到异常。通常是 UnknownHostException
或其他与套接字相关的 IOException
。在有效生命周期之外发生的网络请求通常是因为应用在不再活跃后,不知不觉地继续发出网络请求。
为缓解此异常,请使用生命周期感知型组件,确保您的网络请求具有生命周期感知功能,并在离开有效的进程生命周期时取消。如果您非常重视即使用户离开应用也要发出网络请求,请考虑使用 WorkManager 调度网络请求,或使用前台服务继续执行对用户可见的任务。
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.