Modifiche del comportamento: app che hanno come target Android 17 o versioni successive

Come le release precedenti, Android 17 include modifiche al comportamento che potrebbero influire sulla tua app. Le seguenti modifiche al comportamento si applicano esclusivamente alle app che hanno come target Android 17 o versioni successive. Se la tua app ha come target Android 17 o versioni successive, devi modificarla per supportare questi comportamenti, ove applicabile.

Assicurati di esaminare anche l'elenco delle modifiche al comportamento che interessano tutte le app in esecuzione su Android 17, indipendentemente dal targetSdkVersion della tua app.

Funzionalità di base

Android 17 include le seguenti modifiche che modificano o espandono varie funzionalità di base del sistema Android.

Nuova implementazione senza blocchi di MessageQueue

Beginning with Android 17, apps targeting Android 17 (API level 37) or higher receive a new lock-free implementation of android.os.MessageQueue. The new implementation improves performance and reduces missed frames, but may break clients that reflect on MessageQueue private fields and methods.

For more information, including mitigation strategies, see MessageQueue behavior change guidance.

I campi finali statici ora non sono modificabili

Le app in esecuzione su Android 17 o versioni successive che hanno come target Android 17 (livello API 37) o versioni successive non possono modificare i campi static final. Se un'app tenta di modificare un campo static final utilizzando la reflection, verrà generato un IllegalAccessException. Il tentativo di modificare uno di questi campi tramite le API JNI (ad es. SetStaticLongField()) causerà l'arresto anomalo dell'app.

Accessibilità

Android 17 apporta le seguenti modifiche per migliorare l'accessibilità.

Supporto dell'accessibilità per la digitazione complessa della tastiera fisica IME

This feature introduces new AccessibilityEvent and TextAttribute APIs to enhance screen reader spoken feedback for CJKV language input. CJKV IME apps can now signal whether a text conversion candidate has been selected during text composition. Apps with edit fields can specify text change types when sending text changed accessibility events. For example, apps can specify that a text change occurred during text composition, or that a text change resulted from a commit. Doing this enables accessibility services such as screen readers to deliver more precise feedback based on the nature of the text modification.

App adoption

  • IME Apps: When setting composing text in edit fields, IMEs can use TextAttribute.Builder.setTextSuggestionSelected() to indicate whether a specific conversion candidate was selected.

  • Apps with Edit Fields: Apps that maintain a custom InputConnection can retrieve candidate selection data by calling TextAttribute.isTextSuggestionSelected(). These apps should then call AccessibilityEvent.setTextChangeTypes() when dispatching TYPE_VIEW_TEXT_CHANGED events. Apps targeting Android 17 (API level 37) that use the standard TextView will have this feature enabled by default. (That is, TextView will handle retrieving data from the IME and setting text change types when sending events to accessibility services).

  • Accessibility Services: Accessibility services that process TYPE_VIEW_TEXT_CHANGED events can call AccessibilityEvent.getTextChangeTypes() to identify the nature of the modification and adjust their feedback strategies accordingly.

Privacy

Android 17 include le seguenti modifiche per migliorare la privacy degli utenti.

ECH (Encrypted Client Hello) abilitato in modo opportunistico

Android 17 introduces platform support for Encrypted Client Hello (ECH), a TLS extension that enhances user privacy by encrypting the Server Name Indication (SNI) in the TLS handshake. This encryption helps prevent network observers from easily identifying the specific domain your app is connecting to.

For apps targeting Android 17 (API level 37) or higher, ECH is opportunistically used for TLS connections. ECH is active only if the networking library used by the app (for example, HttpEngine, WebView, or OkHttp) has integrated ECH support and the remote server also supports the ECH protocol. If ECH cannot be negotiated, the connection automatically falls back to a standard TLS handshake without SNI encryption.

To allow apps to customize this behavior, Android 17 adds a new <domainEncryption> element to the Network Security Configuration file. Developers can use <domainEncryption> within <base-config> or <domain-config> tags to select an ECH mode (for example, "opportunistic", "enabled", or "disabled") on a global or per-domain basis.

For more information, see the Encrypted Client Hello documentation.

Autorizzazione di accesso alla rete locale richiesta per le app che hanno come target Android 17

Android 17 introduces the ACCESS_LOCAL_NETWORK runtime permission to protect users from unauthorized local network access. Because this falls under the existing NEARBY_DEVICES permission group, users who have already granted other NEARBY_DEVICES permissions aren't prompted again. This new requirement prevents malicious apps from exploiting unrestricted local network access for covert user tracking and fingerprinting. By declaring and requesting this permission, your app can discover and connect to devices on the local area network (LAN), such as smart home devices or casting receivers.

Apps targeting Android 17 (API level 37) or higher now have two paths to maintain communication with LAN devices: Adopt system-mediated, privacy-preserving device pickers to skip the permission prompt, or explicitly request this new permission at runtime to maintain local network communication.

For more information, see the Local network permission documentation.

Nascondi le password dai dispositivi fisici

If an app targets Android 17 (API level 37) or higher and the user is using a physical input device (for example, an external keyboard), the Android operating system applies the new show_passwords_physical setting to all characters in the password field. By default, that setting hides all password characters.

The Android system shows the last-typed password character to help the user see if they mistyped the password. However, this is much less necessary with larger external keyboards. In addition, devices with external keyboards often have larger displays, which increases the danger of someone seeing the typed password.

If the user is using the device's touchscreen, the system applies the new show_passwords_touch setting.

Sicurezza

Android 17 apporta i seguenti miglioramenti alla sicurezza di dispositivi e app.

Sicurezza attività

In Android 17, la piattaforma continua il suo passaggio a un'architettura "sicura per impostazione predefinita", introducendo una serie di miglioramenti progettati per mitigare gli exploit di gravità elevata come phishing, hijacking dell'interazione e attacchi di tipo confused deputy. Questo aggiornamento richiede agli sviluppatori di attivare esplicitamente i nuovi standard di sicurezza per mantenere la compatibilità dell'app e la protezione degli utenti.

I principali impatti per gli sviluppatori includono:

  • Rafforzamento di BAL e miglioramento dell'attivazione: stiamo perfezionando le limitazioni di Avvio attività in background (BAL) estendendo le protezioni a IntentSender. Gli sviluppatori devono eseguire la migrazione dalla costante legacy MODE_BACKGROUND_ACTIVITY_START_ALLOWED. Devi invece adottare controlli granulari come MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, che limita l'avvio dell'attività agli scenari in cui l'app chiamante è visibile, riducendo in modo significativo la superficie di attacco.
  • Strumenti di adozione:gli sviluppatori devono utilizzare la modalità Strict e i controlli lint aggiornati per identificare i pattern legacy e garantire la conformità ai futuri requisiti dell'SDK di destinazione.

Attiva CT per impostazione predefinita

Se un'app ha come target Android 17 (livello API 37) o versioni successive, la trasparenza dei certificati (CT) è attivata per impostazione predefinita. (Su Android 16, la CT è disponibile, ma le app dovevano attivare la funzionalità.)

Safer Native DCL—C

Se la tua app ha come target Android 17 (livello API 37) o versioni successive, la protezione Safer Dynamic Code Loading (DCL) introdotta in Android 14 per i file DEX e JAR ora si estende alle librerie native.

Tutti i file nativi caricati utilizzando System.load() devono essere contrassegnati come di sola lettura. In caso contrario, il sistema genera UnsatisfiedLinkError.

Ti consigliamo di evitare il caricamento dinamico del codice ogni volta che è possibile, in quanto ciò aumenta notevolmente il rischio che un'app possa essere compromessa da un'iniezione o una manomissione del codice.

Fattori di forma dei dispositivi

Android 17 include le seguenti modifiche per migliorare l'esperienza utente su una vasta gamma di dimensioni e fattori di forma dei dispositivi.

Modifiche all'API della piattaforma per ignorare i vincoli di orientamento, ridimensionamento e proporzioni su schermi di grandi dimensioni (sw>=600 dp)

Abbiamo introdotto modifiche all'API della piattaforma in Android 16 per ignorare le limitazioni di orientamento, proporzioni e ridimensionamento su schermi di grandi dimensioni (sw >= 600 dp) per le app che hanno come target il livello API 36 o superiore. Gli sviluppatori hanno la possibilità di disattivare queste modifiche con l'SDK 36, ma questa disattivazione non sarà più disponibile per le app che hanno come target Android 17 (livello API 37) o versioni successive.

Per saperne di più, consulta Le limitazioni relative all'orientamento e al ridimensionamento vengono ignorate.