Mudanças de comportamento: apps destinados ao Android 15 ou versões mais recentes

Assim como as versões anteriores, o Android 15 inclui mudanças de comportamento que podem afetar seu app. As mudanças de comportamento a seguir se aplicam exclusivamente a apps destinados ao Android 15 ou versões mais recentes. Caso seu app seja direcionado ao Android 15 ou versões mais recentes, modifique o app para oferecer suporte a esses comportamentos de forma adequada, quando aplicável.

Consulte também a lista de mudanças de comportamento que afetam todos os apps executados no Android 15, independente da targetSdkVersion do app.

Principal recurso

O Android 15 modifica ou expande vários recursos principais do sistema Android.

Mudanças nos serviços em primeiro plano

We are making the following changes to foreground services with Android 15.

New media processing foreground service type

O Android 15 introduz um novo tipo de serviço em primeiro plano, o mediaProcessing. Esse tipo de serviço é adequado para operações como transcodificação de arquivos de mídia. Por exemplo, um app de música pode fazer o download de um arquivo de áudio e precisar convertê-lo em um formato diferente antes de reproduzi-lo. Você pode usar um serviço em primeiro plano mediaProcessing para garantir que a conversão continue mesmo enquanto o app estiver em segundo plano.

Para mais informações sobre o tipo de serviço mediaProcessing, consulte Mudanças nos tipos de serviço em primeiro plano para o Android 15.

Restrictions on BOOT_COMPLETED broadcast receivers launching foreground services

There are new restrictions on BOOT_COMPLETED broadcast receivers launching foreground services. BOOT_COMPLETED receivers are not allowed to launch the following types of foreground services:

If a BOOT_COMPLETED receiver tries to launch any of those types of foreground services, the system throws ForegroundServiceStartNotAllowedException.

Experiência do usuário

O Android 15 inclui algumas mudanças que se destinam a criar uma experiência do usuário mais consistente e intuitiva.

Mudanças no encarte da janela

Há duas mudanças relacionadas às inserções de janela que serão lançadas no Android 15. Na versão Beta 1, a configuração de ponta a ponta será aplicada. Também haverá mudanças de configuração futuras, incluindo a configuração padrão das barras do sistema.

全面强制执行

Apps will be edge-to-edge by default on devices running Android 15 if the app is targeting Android 15.

An app that targets Android 14 and is not edge-to-edge on an Android 15 device.


An app that targets Android 15 and is edge-to-edge on an Android 15 device. This app mostly uses Material 3 Compose Components that automatically apply insets. This screen is not negatively impacted by the Android 15 edge-to-edge enforcement.

This is a breaking change that might negatively impact your app's UI. The changes are as follows:

  • Gesture handle navigation bar
    • Transparent by default.
    • Bottom offset is disabled so content draws behind the system navigation bar unless insets are applied.
    • setNavigationBarColor and R.attr#navigationBarColor is deprecated and does not affect gesture navigation.
    • setNavigationBarContrastEnforced and R.attr#navigationBarContrastEnforced continues to have no effect on gesture navigation.
  • 3 button navigation
    • Opacity set to 80% by default, with color possibly matching the window background.
    • Bottom offset disabled so content draws behind the system navigation bar unless insets are applied.
    • setNavigationBarColor and R.attr#navigationBarColor is set to match the window background by default. The window background must be a color drawable for this default to apply. This API is deprecated but continues to affect three button navigation.
    • setNavigationBarContrastEnforced and R.attr#navigationBarContrastEnforced is true by default, which adds an 80% opaque background across three button navigation.
  • Status bar
    • Transparent by default.
    • The top offset is disabled so content will draw behind the status bar unless insets are applied.
    • setStatusBarColor and R.attr#statusBarColor are deprecated and have no effect on Android 15.
    • setStatusBarContrastEnforced and R.attr#statusBarContrastEnforced are deprecated but still have an effect on Android 15.
  • Display cutout
    • layoutInDisplayCutoutMode of non-floating windows must be LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS. Otherwise apps will crash with an IllegalArgumentException. ALWAYS is the only allowed option so that users don't see a Black bar caused by the display cutout in landscape mode and therefore appear edge-to-edge.

The following example shows an app before and after targeting Android 15, and before and after applying insets.

An app that targets Android 14 and is not edge-to-edge on an Android 15 device.
An app that targets Android 15 and is edge-to-edge on an Android 15 device. However, many elements are now occluded by the status bar, 3-button navigation bar, or display cutout due to the Android 15 edge-to-edge enforcements. Occluded UI includes the Material 2 TopAppBar, FAB, and list items.
An app that targets Android 15, is edge to edge on an Android 15 device and applies insets so that UI is not occluded.

If your app:

  • is already edge-to-edge and applies insets, you are mostly unimpacted, except in the following scenarios. However, even if you feel you aren't impacted, we recommend you test your app.
    • Your app crashes because you have a non-floating window, such as an Activity that uses SHORT_EDGES, NEVER or DEFAULT instead of LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS. If your app crashes on launch, this may be due to your splashscreen. Until a fix is available, set window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutInDisplayCutoutMode.always.
    • There may be lower traffic screens with occluded UI. Verify these less visited screens don't have occluded UI. Lower traffic screens include:
      • Onboarding or sign-in screens
      • Settings pages
  • is not edge-to-edge, you are most likely impacted. In addition to the scenarios for apps that are already edge-to-edge, you will need to consider the following:
    • If your app uses Material 3 Components (androidx.compose.material3 in compose, such as TopAppBar, BottomAppBar, and NavigationBar, these components are likely not impacted because they automatically handle insets.
    • If your app is using Material 2 Components (androidx.compose.material in Compose, these components don't automatically handle insets. However, you can get access to the insets and apply them manually. In androidx.compose.material 1.6.0 and later use the windowInsets parameter to apply the insets manually for BottomAppBar, TopAppBar, BottomNavigation, and NavigationRail. Likewise, use the contentWindowInsets parameter for Scaffold.
    • If your app uses Views and Material Components (com.google.android.material, most Views based Material Components such as BottomNavigationView, BottomAppBar, NavigationRailView, or NavigationView, handle insets and require no additional work. However, you will need to add android:fitsSystemWindows="true" if using AppBarLayout.
    • For custom Composables, apply the insets manually as padding. If your content is within a Scaffold, you may consume insets using Scaffold's padding values. Otherwise, apply padding using one of the WindowInsets.
    • If your app is using Views and BottomSheet, SideSheet or custom containers, apply padding using ViewCompat.setOnApplyWindowInsetsListener. For RecyclerView, apply padding using this listener and also add clipToPadding="false".
  • must offer custom background protection to three button navigation or the status bar, you app should place a composable or view behind the system bar using WindowInsets.Type#tappableElement() to get the three button navigation bar height or WindowInsets.Type#statusBars.

See the Edge to Edge Views and Edge to Edge Compose guides for additional considerations on applying insets.

The list of deprecated and disabled APIs are:

  • R.attr#statusBarColor
  • R.attr#navigationBarColor
  • R.attr#navigationBarDividerColor
  • Window#setDecorFitsSystemWindows
  • Window#setStatusBarColor
  • Window#setStatusBarContrastEnforced
  • Window#setNavigationBarColor
  • Window#setNavigationBarDividerColor
  • Window#getStatusBarColor
  • Window#getStatusBarContrastEnforced
  • Window#getNavigationBarColor
  • Window#getNavigationBarDividerColor

稳定配置

Essa mudança não está disponível para teste na versão Beta 1, mas vai estar em breve.

Caso seu app seja destinado ao Android 15 ou versões mais recentes, o Configuration não vai excluir mais as barras do sistema. Se você usa o tamanho da tela na classe Configuration para o cálculo do layout, substitua-o por alternativas melhores, como ViewGroup, WindowInsets ou WindowMetricsCalculator, dependendo da sua necessidade.

Configuration está disponível desde a API 1. Normalmente, ele é recebido de Activity.onConfigurationChanged. Ela fornece informações como densidade, orientação e tamanhos da janela. Uma característica importante sobre os tamanhos de janela retornados de Configuration é que ele excluiu anteriormente as barras do sistema.

O tamanho da configuração é normalmente usado para seleção de recursos, como /res/layout-h500dp, e esse ainda é um caso de uso válido. No entanto, usá-lo para cálculo do layout sempre foi desencorajado. Se fizer isso, você deve se afastar dela agora. Substitua o uso de Configuration por algo mais adequado, dependendo do seu caso de uso.

Se você o usar para calcular o layout, use um ViewGroup adequado, como CoordinatorLayout ou ConstraintLayout. Se você o usar para determinar a altura da barra de navegação do sistema, use WindowInsets. Se você quiser saber o tamanho atual da janela do app, use computeCurrentWindowMetrics.

A lista a seguir descreve os campos afetados por essa alteração:

O atributo eleganteTextHeight adota o padrão de "true"

For apps targeting Android 15, the elegantTextHeight TextView attribute becomes true by default, replacing the compact font used by default with some scripts that have large vertical metrics with one that is much more readable. The compact font was introduced to prevent breaking layouts; Android 13 (API level 33) prevents many of these breakages by allowing the text layout to stretch the vertical height utilizing the fallbackLineSpacing attribute.

In Android 15, the compact font still remains in the system, so your app can set elegantTextHeight to false to get the same behavior as before, but it is unlikely to be supported in upcoming releases. So, if your app supports the following scripts: Arabic, Lao, Myanmar, Tamil, Gujarati, Kannada, Malayalam, Odia, Telugu or Thai, test your app by setting elegantTextHeight to true.

elegantTextHeight behavior for apps targeting Android 14 (API level 34) and lower.
elegantTextHeight behavior for apps targeting Android 15.

Câmera e mídia

O Android 15 faz as seguintes mudanças no comportamento da câmera e da mídia para apps destinados ao Android 15 ou versões mais recentes.

Restrições à solicitação da seleção de áudio

Os apps direcionados ao Android 15 precisam ser o principal app ou executando um serviço em primeiro plano relacionado a áudio para solicitar a seleção de áudio. Se um app tentar solicitar a seleção quando não atender a um desses requisitos, a chamada vai retornar AUDIOFOCUS_REQUEST_FAILED.

Um serviço em primeiro plano é considerado relacionado ao áudio se o tipo dele é mediaPlayback, camera, microphone ou phoneCall.

Saiba mais sobre a seleção de áudio em Gerenciar a seleção de áudio.

Atualização das restrições não SDK

Android 15 includes updated lists of restricted non-SDK interfaces based on collaboration with Android developers and the latest internal testing. Whenever possible, we make sure that public alternatives are available before we restrict non-SDK interfaces.

If your app does not target Android 15, some of these changes might not immediately affect you. However, while it's possible for your app to access some non-SDK interfaces depending on your app's target API level, using any non-SDK method or field always carries a high risk of breaking your app.

If you are unsure if your app uses non-SDK interfaces, you can test your app to find out. If your app relies on non-SDK interfaces, you should begin planning a migration to SDK alternatives. Nevertheless, we understand that some apps have valid use cases for using non-SDK interfaces. If you can't find an alternative to using a non-SDK interface for a feature in your app, you should request a new public API.

e

Para saber mais sobre as mudanças dessa versão do Android, consulte Atualizações para restrições de interfaces não SDK no Android 15. Para saber mais sobre interfaces não SDK em geral, consulte Restrições para interfaces não SDK.