Descripción general de las funciones y APIs

Android 15 incluye excelentes funciones y APIs para desarrolladores. En las siguientes secciones, se resumen estas funciones para ayudarte a comenzar a usar las APIs relacionadas.

Para obtener una lista detallada de las APIs nuevas, modificadas y quitadas, lee el informe de diferencias de APIs. Para obtener detalles sobre las nuevas APIs, consulta la referencia de la API de Android. Las nuevas APIs están destacadas para mayor visibilidad. Además, para conocer las áreas en las que los cambios de la plataforma podrían afectar a tus apps, asegúrate de revisar los cambios de comportamiento que afectan a las apps cuando se orientan a Android 15 y los cambios de comportamiento que afectan a todas las apps, independientemente de targetSdkVersion.

Cámara y contenido multimedia

Android 15 incluye una variedad de funciones que mejoran la experiencia de la cámara y el contenido multimedia, y que te brindan acceso a herramientas y hardware para ayudar a los creadores a dar vida a su visión en Android.

Mejora con poca luz

Android 15 introduces Low Light Boost, a new auto-exposure mode available to both Camera 2 and the night mode camera extension. Low Light Boost adjusts the exposure of the Preview stream in low-light conditions. This is different from how the night mode camera extension creates still images, because night mode combines a burst of photos to create a single, enhanced image. While night mode works very well for creating a still image, it can't create a continuous stream of frames, but Low Light Boost can. Thus, Low Light Boost enables new camera capabilities, such as:

  • Providing an enhanced image preview, so users are better able to frame their low-light pictures
  • Scanning QR codes in low light

If you enable Low Light Boost, it automatically turns on when there's a low light level, and turns off when there's more light.

Apps can record off the Preview stream in low-light conditions to save a brightened video.

For more information, see Low Light Boost.

Controles de cámara integrados en la app

Android 15 添加了一个新扩展,用于在支持的设备上更好地控制相机硬件及其算法:

  • 高级闪光灯强度调整,可让您在拍摄照片时精确控制 SINGLETORCH 模式下的闪光强度。

Control del margen de HDR

Android 15 chooses HDR headroom that is appropriate for the underlying device capabilities and bit-depth of the panel. For pages that have lots of SDR content, such as a messaging app displaying a single HDR thumbnail, this behavior can end up adversely influencing the perceived brightness of the SDR content. Android 15 lets you control the HDR headroom with setDesiredHdrHeadroom to strike a balance between SDR and HDR content.

The brightness of SDR UI elements on the left screen appears to be more uniform than the brightness on the right screen, which simulates possible headroom issues when HDR and SDR content are mixed. By adjusting the HDR headroom, you can achieve a better balance between the SDR and HDR content.

Control de volumen

Android 15 introduces support for the CTA-2075 loudness standard to help you avoid audio loudness inconsistencies and ensure users don't have to constantly adjust volume when switching between content. The system leverages known characteristics of the output devices (headphones and speaker) along with loudness metadata available in AAC audio content to intelligently adjust the audio loudness and dynamic range compression levels.

To enable this feature, you need to ensure loudness metadata is available in your AAC content and enable the platform feature in your app. For this, you instantiate a LoudnessCodecController object by calling its create factory method with the audio session ID from the associated AudioTrack; this automatically starts applying audio updates. You can pass an OnLoudnessCodecUpdateListener to modify or filter loudness parameters before they are applied on the MediaCodec.

// Media contains metadata of type MPEG_4 OR MPEG_D
val mediaCodec = …
val audioTrack = AudioTrack.Builder()
                                .setSessionId(sessionId)
                                .build()
...
// Create new loudness controller that applies the parameters to the MediaCodec
try {
   val lcController = LoudnessCodecController.create(mSessionId)
   // Starts applying audio updates for each added MediaCodec

AndroidX media3 ExoPlayer will soon be updated to leverage LoudnessCodecController APIs for a seamless app integration.

Dispositivos MIDI 2.0 virtuales

Android 13 agregó compatibilidad para conectarse a dispositivos MIDI 2.0 mediante USB, que se comunican mediante paquetes MIDI universales (UMP). Android 15 extiende la compatibilidad con UMP a apps MIDI virtuales, lo que permite que las apps de composición controlen las apps de sintetizador como un dispositivo MIDI 2.0 virtual, al igual que lo harían con un dispositivo MIDI USB 2.0.

Conectividad

Android 15 actualiza la plataforma para brindarle a tu app acceso a los avances más recientes en comunicación.

Compatibilidad por satélite

Android 15 continues to extend platform support for satellite connectivity and includes some UI elements to ensure a consistent user experience across the satellite connectivity landscape.

Apps can use ServiceState.isUsingNonTerrestrialNetwork() to detect when a device is connected to a satellite, giving them more awareness of why full network services might be unavailable. Additionally, Android 15 provides support for SMS and MMS apps as well as preloaded RCS apps to use satellite connectivity for sending and receiving messages.

A notification appears when the device connects to a satellite.

Experiencias NFC más fluidas

Android 15 is working to make the tap to pay experience more seamless and reliable while continuing to support Android's robust NFC app ecosystem. On supported devices, apps can request the NfcAdapter to enter observe mode, where the device listens but doesn't respond to NFC readers, sending the app's NFC service PollingFrame objects to process. The PollingFrame objects can be used to auth ahead of the first communication to the NFC reader, allowing for a one tap transaction in many cases.

In addition, apps can now register a fingerprint on supported devices so they can be notified of polling loop activity, which allows for smooth operation with multiple NFC-aware applications.

Rol de billetera

Android 15 引入了一个新的钱包角色,可让您与用户首选的钱包应用更紧密地集成。此角色取代了 NFC 默认的感应式付款设置。用户可以通过导航到设置 > 应用 > 默认应用来管理 Google 钱包角色持有者。

在为付款类别中注册的 AID 路由 NFC 触碰时,可使用“钱包”角色。除非已在前台运行为同一 AID 注册的另一个应用,否则点按操作会始终转到钱包角色持有者。

此角色还可用于确定钱包“快速访问”功能块在启用后应转到的位置。当角色设置为“无”时,“快速访问”功能块不可用,并且付款类别 NFC 触碰仅会传送到前台应用。

Productividad y herramientas para desarrolladores

Si bien la mayor parte de nuestro trabajo para mejorar tus centros de productividad se centra en herramientas como Android Studio, Jetpack Compose y las bibliotecas de Android Jetpack, siempre buscamos formas en la plataforma que te ayuden a concretar tu visión con mayor facilidad.

Mejoras de PDF

Android 15 Developer Preview 2 includes an early preview of substantial improvements to the PdfRenderer APIs. Apps can incorporate advanced features such as rendering password-protected files, annotations, form editing, searching, and selection with copy. Linearized PDF optimizations are supported to speed local PDF viewing and reduce resource use.

The latest updates to PDF rendering include features such as searching an embedded PDF file.

The PdfRenderer has been moved to a module that can be updated using Google Play system updates independent of the platform release, and we're supporting these changes back to Android 11 (API level 30) by creating a compatible pre-Android 15 version of the API surface, called PdfRendererPreV.

We value your feedback on the enhancements we've made to the PdfRenderer API surface, and we plan to make it even easier to incorporate these APIs into your app with an upcoming Android Jetpack library.

Mejoras en el cambio automático de idioma

Android 14 增加了设备端音频中的多语言识别功能,可在语言之间自动切换,但这可能会导致单词丢失,尤其是在语言切换时,两种话语之间的停顿较少时。Android 15 添加了额外的控件,可帮助应用根据其用例调整此切换。EXTRA_LANGUAGE_SWITCH_INITIAL_ACTIVE_DURATION_TIME_MILLIS 会将自动切换限制为仅在音频会话开始时进行,而 EXTRA_LANGUAGE_SWITCH_MATCH_SWITCHES 则会在指定次数的切换后停用语言切换。如果您希望自动检测到会话期间只讲一种语言,这些选项特别有用。

Controles detallados de salto de línea

从 Android 15 开始,TextView 和底层换行符可以将文本的给定部分保留在同一行中,以提高可读性。您可以通过在字符串资源或 createNoBreakSpan 中使用 <nobreak> 标记来利用此换行符自定义功能。同样,您可以使用 <nohyphen> 标记或 createNoHyphenationSpan 避免断字的情况。

例如,以下字符串资源不包含换行符,而是在不希望的位置显示文本“Pixel 8 Pro”进行渲染:

<resources>
    <string name="pixel8pro">The power and brains behind Pixel 8 Pro.</string>
</resources>

相比之下,此字符串资源包含 <nobreak> 标记,该标记会封装短语“Pixel 8 Pro.”并防止换行符:

<resources>
    <string name="pixel8pro">The power and brains behind <nobreak>Pixel 8 Pro.</nobreak></string>
</resources>

这些字符串的呈现方式差异如下图所示:

用于设置一行文本的布局,其中词组“Pixel 8 Pro”未使用 <nobreak> 标记进行换行。
同一行文本的布局,其中词组“Pixel 8 Pro”用 <nobreak> 标记封装。

Actualizaciones de OpenJDK 17

Android 15 会继续更新 Android 的核心库,以与最新 OpenJDK LTS 版本中的功能保持一致。

其中包含以下主要功能和改进:

这些 API 通过 Google Play 系统更新在超过 10 亿台搭载 Android 12(API 级别 31)及更高版本的设备上进行了更新,让您能够以最新的编程功能为目标平台。

Java 和 OpenJDK 是 Oracle 及/或其关联公司的商标或注册商标。

Archivado de apps

Android and Google Play announced support for app archiving last year, allowing users to free up space by partially removing infrequently used apps from the device that were published using Android App Bundle on Google Play. Android 15 now includes OS level support for app archiving and unarchiving, making it easier for all app stores to implement it.

Apps with the REQUEST_DELETE_PACKAGES permission can call the PackageInstaller requestArchive method to request archiving an installed app package, which removes the APK and any cached files, but persists user data. Archived apps are returned as displayable apps through the LauncherApps APIs; users will see a UI treatment to highlight that those apps are archived. If a user taps on an archived app, the responsible installer will get a request to unarchive it, and the restoration process can be monitored by the ACTION_PACKAGE_ADDED broadcast.

Accesibilidad

En Android 15, se agregan funciones que mejoran la accesibilidad para los usuarios.

Mejor braille

En Android 15, permitimos que TalkBack admita pantallas braille que usen el estándar HID a través de USB y Bluetooth seguro.

Este estándar, al igual que el que se usa en mouse y teclados, ayudará a Android a admitir una mayor variedad de pantallas braille con el tiempo.

Pantallas y factores de forma grandes

Android 15 brinda a tus apps la compatibilidad para aprovechar al máximo los factores de forma de Android, incluidas las pantallas grandes, los dispositivos plegables y los dispositivos plegables.

Compatibilidad con la pantalla de portada

Tu app puede declarar una propiedad que Android 15 usa para permitir que tu Application o Activity se presente en las pequeñas pantallas de portada de los dispositivos que admiten la pantalla abatible. Estas pantallas son demasiado pequeñas para considerarlas como objetivos compatibles de modo que las apps para Android se ejecuten en ellas, pero tu app puede aceptar admitirlas, lo que hará que esté disponible en más lugares.

Rendimiento y batería

Android continúa su enfoque en ayudarte a mejorar el rendimiento y la calidad de tus apps. Android 15 introduce APIs nuevas que ayudan a que las tareas de tu app sean más eficientes de ejecutar, optimizar el rendimiento de las apps y recopilar estadísticas sobre tus apps.

API de ApplicationStartInfo

In previous versions of Android, app startup has been a bit of a mystery. It was challenging to determine within your app whether it started from a cold, warm, or hot state. It was also difficult to know how long your app spent during the various launch phases: forking the process, calling onCreate, drawing the first frame, and more. When your Application class was instantiated, you had no way of knowing whether the app started from a broadcast, a content provider, a job, a backup, boot complete, an alarm, or an Activity.

The ApplicationStartInfo API on Android 15 provides all of this and more. You can even choose to add your own timestamps into the flow to help collect timing data in one place. In addition to collecting metrics, you can use ApplicationStartInfo to help directly optimize app startup; for example, you can eliminate the costly instantiation of UI-related libraries within your Application class when your app is starting up due to a broadcast.

Información detallada sobre el tamaño de la app

自 Android 8.0(API 级别 26)起,Android 就一直包含 StorageStats.getAppBytes API,该 API 将应用的安装大小汇总为一个字节,这些字节是 APK 大小、从 APK 中提取的文件的大小以及设备上生成的文件(例如预先 (AOT) 编译代码)的总和。就应用的存储空间使用情况而言,此数字并不富有见解。

Android 15 增加了 StorageStats.getAppBytesByDataType([type]) API,可让您深入了解应用如何使用所有空间,包括 APK 文件拆分、AOT 和加速相关代码、dex 元数据、库和引导式配置文件。

Generación de perfiles administrada por la app

Android 15 包含全新的 ProfilingManager 类,可让您从应用内收集性能分析信息。我们计划使用 Android Jetpack API 封装该类,这将简化性能分析请求的构建过程,但核心 API 将允许收集堆转储、堆配置文件、堆栈采样等信息。它使用提供的标记为您的应用提供回调,用于标识输出文件,该文件将传递到应用的文件目录。该 API 会限制速率限制,以最大限度地降低对性能的影响。

Mejoras en la base de datos SQLite

Android 15 introduce nuevas APIs de SQLite que exponen funciones avanzadas del motor SQLite subyacente que tienen como objetivo problemas de rendimiento específicos que pueden manifestarse en las apps.

Los desarrolladores deben consultar las prácticas recomendadas sobre el rendimiento de SQLite para aprovechar al máximo su base de datos SQLite, en especial cuando trabajan con bases de datos grandes o cuando se ejecutan consultas sensibles a la latencia.

  • Transacciones diferidas de solo lectura: Cuando emitas transacciones de solo lectura (no incluyen instrucciones de escritura), usa beginTransactionReadOnly() y beginTransactionWithListenerReadOnly(SQLiteTransactionListener) para emitir transacciones DEFERRED de solo lectura. Estas transacciones pueden ejecutarse de forma simultánea y, si la base de datos está en modo WAL, pueden ejecutarse en simultáneo con las transacciones de IMMEDIATE o EXCLUSIVE.
  • ID y recuentos de filas: Se agregaron nuevas APIs para recuperar el recuento de las filas modificadas o el ID de la última fila insertada sin emitir una consulta adicional. getLastChangedRowCount() muestra la cantidad de filas que insertó, actualizó o borró la instrucción de SQL más reciente dentro de la transacción actual, mientras que getTotalChangedRowCount() muestra el recuento de la conexión actual. getLastInsertRowId() muestra el rowid de la última fila que se insertará en la conexión actual.
  • Declaraciones sin procesar: Emite una declaración de SQlite sin procesar, evitando las wrappers de conveniencia y cualquier sobrecarga de procesamiento adicional que puedan generar.

Actualizaciones del framework de rendimiento dinámico de Android

Android 15 continues our investment in the Android Dynamic Performance Framework (ADPF), a set of APIs that allow games and performance intensive apps to interact more directly with power and thermal systems of Android devices. On supported devices, Android 15 will add new ADPF capabilities:

  • A power-efficiency mode for hint sessions to indicate that their associated threads should prefer power saving over performance, great for long-running background workloads.
  • GPU and CPU work durations can both be reported in hint sessions, allowing the system to adjust CPU and GPU frequencies together to best meet workload demands.
  • Thermal headroom thresholds to interpret possible thermal throttling status based on headroom prediction.

To learn more about how to use ADPF in your apps and games, head over to the documentation.

Privacidad

Android 15 incluye una variedad de funciones que ayudan a los desarrolladores de apps a proteger la privacidad del usuario.

Detección de grabación de pantalla

Android 15 adds support for apps to detect that they are being recorded. A callback is invoked whenever the app transitions between being visible or invisible within a screen recording. An app is considered visible if activities owned by the registering process's UID are being recorded. This way, if your app is performing a sensitive operation, you can inform the user that they're being recorded.

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

override fun onStart() {
   super.onStart()
   val initialState =
      windowManager.addScreenRecordingCallback(mainExecutor, mCallback)
   mCallback.accept(initialState)
}

override fun onStop() {
    super.onStop()
    windowManager.removeScreenRecordingCallback(mCallback)
}

Capacidades expandidas de IntentFilter

Android 15 builds in support for more precise Intent resolution through UriRelativeFilterGroup, which contains a set of UriRelativeFilter objects that form a set of Intent matching rules that must each be satisfied, including URL query parameters, URL fragments, and blocking or exclusion rules.

These rules can be defined in the AndroidManifest XML file with the new <uri-relative-filter-group> tag, which can optionally include an android:allow tag. These tags can contain <data> tags that use existing data tag attributes as well as the new android:query and android:fragment attributes.

Here's an example of the AndroidManifest syntax:

<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="http" />
  <data android:scheme="https" />
  <data android:domain="astore.com" />
  <uri-relative-filter-group>
    <data android:pathPrefix="/auth" />
    <data android:query="region=na" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:allow="false">
    <data android:pathPrefix="/auth" />
    <data android:query="mobileoptout=true" />
  </uri-relative-filter-group>
  <uri-relative-filter-group android:allow="false">
    <data android:pathPrefix="/auth" />
    <data android:fragmentPrefix="faq" />
  </uri-relative-filter-group>
</intent-filter>

Privacy Sandbox en Android

Android 15 将 Android 广告服务提升到扩展级别 10,在其中融入了最新版本的 Privacy Sandbox on Android。我们致力于开发新技术来加强用户隐私保护,并为移动应用提供有效的个性化广告体验。我们的隐私沙盒页面详细介绍了 Privacy Sandbox on Android 开发者预览版和 Beta 版计划,以帮助您开始使用。

Health Connect

Android 15 integra las extensiones 10 de Android 14 en torno a Health Connect de Android, una plataforma segura y centralizada para administrar y compartir los datos de salud y fitness recopilados por la app. Esta actualización agrega compatibilidad con nuevos tipos de datos de actividad física, nutrición y mucho más.

Compartir pantalla parcialmente

Android 15 支持局部屏幕共享,因此用户可以仅分享或录制应用窗口,而不是整个设备屏幕。此功能在 Android 14 QPR2 中首次启用,包含 MediaProjection 回调,可让您的应用自定义局部屏幕共享体验。请注意,对于以 Android 14(API 级别 34)或更高版本为目标平台的应用,现在需要针对每个 MediaProjection 捕获会话征得用户同意

Seguridad

Android 15 te ayuda a mejorar la seguridad de tu app y a proteger sus datos.

Administración de claves para la encriptación de extremo a extremo

Presentamos E2eeContactKeysManager en Android 15, que facilita la encriptación de extremo a extremo (E2EE) en tus apps para Android mediante una API a nivel del SO destinada al almacenamiento de claves públicas criptográficas.

El E2eeContactKeysManager está diseñado para integrarse con la app de contactos de la plataforma a fin de brindarles a los usuarios una forma centralizada de administrar y verificar las claves públicas de sus contactos.

Protege archivos con fs-verity

Android 15 的 FileIntegrityManager 包含一些可让您利用 Linux 内核中 fs-verity 功能的强大功能的新 API。借助 fs-verity,您可以通过自定义加密签名保护文件,从而确保文件未被篡改或损坏。这有助于增强安全性,防止潜在的恶意软件或未经授权的文件修改,从而损害应用的功能或数据。

Experiencia del usuario

Android 15 les brinda a los desarrolladores de apps y a los usuarios más control y flexibilidad para configurar sus dispositivos de modo que se ajusten a sus necesidades.

Reglas para la función No interrumpir mejoradas

AutomaticZenRule lets apps customize Attention Management (Do Not Disturb) rules and decide when to activate or deactivate them. Android 15 greatly enhances these rules with the goal of improving the user experience. The following enhancements are included:

  • Adding types to AutomaticZenRule, allowing the system to apply special treatment to some rules.
  • Adding an icon to AutomaticZenRule, helping to make the modes be more recognizable.
  • Adding a triggerDescription string to AutomaticZenRule that describes the conditions on which the rule should become active for the user.
  • Added ZenDeviceEffects to AutomaticZenRule, allowing rules to trigger things like grayscale display, night mode, or dimming the wallpaper.

Internacionalización

Android 15 agrega funciones y capacidades que complementan la experiencia del usuario cuando un dispositivo se usa en diferentes idiomas.

Justificación entre caracteres

Starting with Android 15, text can be justified utilizing letter spacing by using JUSTIFICATION_MODE_INTER_CHARACTER. Inter-word justification was first introduced in Android 8.0 (API level 26), and inter-character justification provides similar capabilities for languages that use the whitespace character for segmentation, such as Chinese, Japanese, and others.

Layout for Japanese text using JUSTIFICATION_MODE_NONE.
Layout for English text using JUSTIFICATION_MODE_NONE.


Layout for Japanese text using JUSTIFICATION_MODE_INTER_WORD.
Layout for English text using JUSTIFICATION_MODE_INTER_WORD.


Layout for Japanese text using the new JUSTIFICATION_MODE_INTER_CHARACTER.
Layout for English text using the new JUSTIFICATION_MODE_INTER_CHARACTER.