Cambios de comportamiento: todas las apps

La plataforma de Android 17 incluye cambios de comportamiento que podrían afectar tu app. Los siguientes cambios de comportamiento se aplican a todas las apps cuando se ejecutan en Android 17, independientemente de targetSdkVersion. Debes probar tu app y, luego, modificarla según corresponda para admitir estos cambios.

Asegúrate también de consultar la lista de cambios de comportamiento que solo afectan a las apps orientadas a Android 17.

Seguridad

Android 17 incluye las siguientes mejoras en la seguridad de dispositivos y apps.

Plan de baja de usesClearTraffic

In a future release, we plan to deprecate the usesCleartextTraffic element. Apps that need to make unencrypted (HTTP) connections should migrate to using a network security configuration file, which lets you specify which domains your app needs to make cleartext connections to.

Be aware that network security configuration files are only supported on API levels 24 and higher. If your app has a minimum API level lower than 24, you should do both of the following:

  • Set the usesCleartextTraffic attribute to true
  • Use a network configuration file

If your app's minimum API level is 24 or higher, you can use a network configuration file and you don't need to set usesCleartextTraffic.

Restringe las concesiones de URI implícitas

Currently, if an app launches an intent with a URI that has the action Send, SendMultiple, or ImageCapture, the system automatically grants the read and write URI permissions to the target app. We plan to change this behavior in Android 18. For this reason, we recommend that apps explicitly grant the relevant URI permissions instead of relying on the system to grant them.

Límites de keystore por app

Las apps deben evitar crear una cantidad excesiva de claves en Android Keystore, ya que es un recurso compartido para todas las apps del dispositivo. A partir de Android 17, el sistema aplica un límite en la cantidad de claves que puede tener una app. El límite es de 50,000 claves para las apps que no son del sistema y que se segmentan para Android 17 (nivel de API 37) o versiones posteriores, y de 200,000 claves para todas las demás apps. Las apps del sistema tienen un límite de 200,000 claves, independientemente del nivel de API al que se orienten.

Si una app intenta crear claves más allá del límite, la creación falla con un KeyStoreException. La cadena de mensaje de la excepción contiene información sobre el límite de claves. Si la app llama a getNumericErrorCode() en la excepción, el valor de devolución depende del nivel de API al que se orienta la app:

  • Apps segmentadas para Android 17 (nivel de API 37) o versiones posteriores: getNumericErrorCode() devuelve el nuevo valor de ERROR_TOO_MANY_KEYS.
  • Todas las demás apps: getNumericErrorCode() devuelve ERROR_INCORRECT_USAGE.

Experiencia del usuario y IU del sistema

Android 17 incluye los siguientes cambios destinados a crear una experiencia del usuario más coherente e intuitiva.

Restablece la visibilidad predeterminada del IME después de la rotación

Beginning with Android 17, when the device's configuration changes (for example, through rotation), and this is not handled by the app itself, the previous IME visibility is not restored.

If your app undergoes a configuration change that it does not handle, and the app needs the keyboard to be visible after the change, you must explicitly request this. You can make this request in one of the following ways:

  • Set the android:windowSoftInputMode attribute to stateAlwaysVisible.
  • Programmatically request the soft keyboard in your activity's onCreate() method, or add the onConfigurationChanged() method.

Intervención humana

Android 17 incluye los siguientes cambios que afectan la forma en que las apps interactúan con dispositivos de entrada humana, como teclados y paneles táctiles.

Los paneles táctiles entregan eventos relativos de forma predeterminada durante la captura del puntero

从 Android 17 开始,如果应用使用 View.requestPointerCapture() 请求捕获指针,并且用户使用触控板,系统会识别用户触摸操作产生的指针移动和滚动手势,并以与捕获的鼠标产生的指针和滚轮移动相同的方式将这些信息报告给应用。在大多数情况下,这使得支持捕获鼠标的应用无需为触控板添加特殊的处理逻辑。如需了解详情,请参阅 View.POINTER_CAPTURE_MODE_RELATIVE 的文档。

以前,系统不会尝试识别触控板的手势,而是以类似于触摸屏触摸的格式将原始的绝对手指位置传递给应用。如果应用仍需要此绝对数据,则应改为使用 View.POINTER_CAPTURE_MODE_ABSOLUTE 调用新的 View.requestPointerCapture(int) 方法。

Contenido multimedia

Android 17 incluye los siguientes cambios en el comportamiento de contenido multimedia.

Protección de audio en segundo plano

A partir de Android 17, el framework de audio aplica restricciones en las interacciones de audio en segundo plano, como la reproducción de audio, las solicitudes de enfoque de audio y las APIs de cambio de volumen, para garantizar que el usuario inicie estos cambios de forma intencional.

Si la app intenta llamar a las APIs de audio mientras no se encuentra en un ciclo de vida válido, las APIs de reproducción de audio y de cambio de volumen fallarán de forma silenciosa sin arrojar una excepción ni proporcionar un mensaje de error. La API de enfoque de audio falla con el código de resultado AUDIOFOCUS_REQUEST_FAILED.

Para obtener más información, incluidas las estrategias de mitigación, consulta Protección de audio en segundo plano.

Conectividad

Android 17 incluye los siguientes cambios para mejorar la conectividad de los dispositivos.

Revinculación autónoma para pérdidas de vinculación de Bluetooth

Android 17 introduces autonomous re-pairing, a system-level enhancement designed to automatically resolve Bluetooth bond loss.

Previously, if a bond was lost, users had to manually navigate to Settings to unpair and then re-pair the peripheral. This feature builds upon the security improvement of Android 16 by allowing the system to re-establish bonds in the background without requiring users to manually navigate to Settings to unpair and re-pair peripherals.

While most apps will not require code changes, developers should be aware of the following behavior changes in Bluetooth stack:

  • New pairing context: The ACTION_PAIRING_REQUEST now includes the EXTRA_PAIRING_CONTEXT extra which allows apps to distinguish between a standard pairing request and an autonomous system-initiated re-pairing attempt.
  • Conditional key updates: Existing security keys will only be replaced if the re-pairing is successful and new connection meets or exceeds the security level of the previous bond.
  • Modified intent timing: The ACTION_KEY_MISSING intent is now broadcast only if the autonomous re-pairing attempt fails. This reduces unnecessary error handling in the app if the system successfully recovers the bond in the background.
  • User notification: The system manages re-pairing via new UI notifications and dialogs. Users will be prompted to confirm the re-pairing attempt to ensure they are aware of the reconnection.

Peripheral device manufacturers and companion app developers should verify that hardware and app gracefully handle bond transitions. To test this behavior, simulate a remote bond loss using either of the following methods:

  • Manually remove the bond information from the peripheral device
  • Manually unpair the device in: Settings > Connected devices