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.
Esperienza utente e UI di sistema
Android 17 include le seguenti modifiche, pensate per creare un'esperienza utente più coerente e intuitiva.
Widget Limite di memoria
Beginning with Android 17, for apps targeting
Android 17 (API level 37) or higher, the system enforces a strict memory
limit (1.5 * screen width * screen height * 4) against the combined memory usage
of both Bitmaps and Icons present in the RemoteViews parcel. Exceeding these
limits throws a fatal IllegalArgumentException and crashes the app's process.
For more information, see UpdateAppWidget.
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
A partire da Android 17, le app che hanno come target Android 17 (livello API 37)
o versioni successive ricevono una nuova implementazione senza blocchi di
android.os.MessageQueue. La nuova implementazione migliora il rendimento e
riduce i frame mancanti, ma potrebbe interrompere i client che riflettono su campi e metodi privati di MessageQueue.
Per ulteriori informazioni, incluse le strategie di mitigazione, consulta la guida al cambiamento di comportamento di MessageQueue.
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 esempio 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
InputConnectioncan retrieve candidate selection data by callingTextAttribute.isTextSuggestionSelected(). These apps should then callAccessibilityEvent.setTextChangeTypes()when dispatchingTYPE_VIEW_TEXT_CHANGEDevents. Apps targeting Android 17 (API level 37) that use the standardTextViewwill have this feature enabled by default. (That is,TextViewwill 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_CHANGEDevents can callAccessibilityEvent.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
Android 17 introduce il supporto della piattaforma per Encrypted Client Hello (ECH), un'estensione TLS che migliora la privacy degli utenti criptando l'indicazione del nome del server (SNI) nell'handshake TLS. Questa crittografia impedisce agli osservatori della rete di identificare facilmente il dominio specifico a cui si connette la tua app.
Per le app che hanno come target Android 17 (livello API 37) o versioni successive, ECH viene utilizzato per le connessioni TLS. ECH è attivo solo se la libreria di rete utilizzata dall'app (ad esempio HttpEngine, WebView o OkHttp) ha integrato il supporto ECH e il server remoto supporta anche il protocollo ECH. Se non è possibile negoziare ECH, il client invia un'estensione ECH con contenuti randomizzati (un meccanismo chiamato ECH GREASE). Per maggiori dettagli su come funziona ECH GREASE, consulta RFC 9849.
Per consentire alle app di personalizzare questo comportamento, Android 17 aggiunge un nuovo elemento
<domainEncryption> al file di configurazione della sicurezza di rete.
Gli sviluppatori possono utilizzare <domainEncryption> all'interno dei tag <base-config> o
<domain-config> per selezionare una modalità ECH (ad esempio,
"enabled" o "disabled") a livello globale o per dominio.
Per saperne di più, consulta la documentazione relativa a Encrypted Client Hello.
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.
Protezione OTP per i messaggi SMS standard
Beginning with Android 17, Android is extending its SMS OTP protection
to apply to standard SMS messages (SMS messages containing an OTP that do not
use the WebOTP or SMS Retriever formats). For most apps targeting
Android 17 (API level 37) or higher, these SMS messages do not become
available until three hours after receipt. This delay is intended to help
prevent OTP hijacking. During this three hour delay, the
SMS_RECEIVED_ACTION broadcast is withheld and
SMS provider database queries are filtered. The SMS message is
available to these apps after the delay.
Certain apps such as the default SMS assistant app, connected device companion apps, etc., are exempted from this delay. All apps that rely on reading SMS messages for OTP extraction should transition to using SMS Retriever or SMS User Consent APIs to ensure continued functionality.
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 exploit di gravità elevata come phishing, hijacking dell'interazione e attacchi 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 Background Activity
Launch (BAL) estendendo le protezioni a
IntentSender. Gli sviluppatori devono eseguire la migrazione dalla costante legacyMODE_BACKGROUND_ACTIVITY_START_ALLOWED. Devi invece adottare controlli granulari comeMODE_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à StrictMode e i controlli lint aggiornati per identificare i pattern legacy e garantire la preparazione ai futuri requisiti dell'SDK di destinazione.
Attiva CT per impostazione predefinita
If an app targets Android 17 (API level 37) or higher, certificate transparency (CT) is enabled by default. (On Android 16, CT is available but apps had to opt in.)
Safer Native DCL—C
If your app targets Android 17 (API level 37) or higher, the Safer Dynamic Code Loading (DCL) protection introduced in Android 14 for DEX and JAR files now extends to native libraries.
All native files loaded using System.load() must be marked as read-only.
Otherwise, the system throws UnsatisfiedLinkError.
We recommend that apps avoid dynamically loading code whenever possible, as doing so greatly increases the risk that an app can be compromised by code injection or code tampering.
Limitare i campi PII nella visualizzazione dei dati CP2
For apps targeting Android 17 (API level Android 17 (API level 37)) and higher, Contacts Provider 2 (CP2) restricts certain columns containing Personally Identifiable Information (PII) from the data view. When this change is enabled, these columns are removed from the data view to enhance user privacy. The restricted columns include:
Apps that are using these columns from ContactsContract.Data
can extract them from ContactsContract.RawContacts
instead, by joining with RAW_CONTACT_ID.
Applica controlli SQL rigorosi in CP2
For apps targeting Android 17 (API level Android 17 (API level 37)) and
higher, Contacts Provider 2 (CP2) enforces strict SQL query validation when
the ContactsContract.Data table is accessed without
READ_CONTACTS permission.
With this change, if an app doesn't have READ_CONTACTS
permission, StrictColumns and
StrictGrammar options are set when querying
the ContactsContract.Data table. If a query
uses a pattern that isn't compatible with these, it will be
rejected and cause an exception to be thrown.
Intelligence
Android 17 include le seguenti modifiche all'intelligence di sistema.
Ritiro di setContentCaptureEnabled
Content Capture is enabled by default on certain devices to allow on-device AI features to analyze screen contents for intelligent experiences.
Starting in Android 17, the
ContentCaptureManager.setContentCaptureEnabled(boolean)
API method is deprecated. For apps that target Android 17 (API level 37) or
higher, calling setContentCaptureEnabled(false) no longer disables Content
Capture.
If your app needs to continue disabling Content Capture or restrict screen
contents from being captured by the system, you must transition to using the
FLAG_SECURE window layout parameter.
To disable Content Capture, set the FLAG_SECURE flag on your window as shown
in the following example:
Kotlin
window.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
Java
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
);
For more details, see the
WindowManager.LayoutParams.FLAG_SECURE reference
documentation.
Media
Android 17 include le seguenti modifiche al comportamento dei contenuti multimediali.
Protezione dell'audio in background
A partire da Android 17, il framework audio applica restrizioni alle interazioni audio in background, tra cui riproduzione audio, richieste di focus audio e API di modifica del volume, per garantire che queste modifiche vengano avviate intenzionalmente dall'utente.
Alcune limitazioni audio si applicano a tutte le app. Tuttavia, le limitazioni sono più rigide se un'app ha come target Android 17 (livello API 37). Se una di queste app interagisce con l'audio mentre è in background, deve avere un servizio in primo piano in esecuzione. Inoltre, l'app deve soddisfare uno o entrambi i seguenti requisiti:
- Il servizio in primo piano deve disporre delle funzionalità "durante l'uso".
- L'app deve disporre dell'autorizzazione sveglia esatta e interagire con
flussi audio
USAGE_ALARM.
Per ulteriori informazioni, incluse le strategie di mitigazione, consulta Protezione dell'audio in background.
Fattori di forma dei dispositivi
Android 17 include le seguenti modifiche per migliorare l'esperienza utente in 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 sugli schermi grandi (sw>=600dp)
We introduced Platform API changes in Android 16 to ignore orientation, aspect ratio, and resizability restrictions on large screens (sw >= 600dp) for apps targeting API level 36 or higher. Developers have the option to opt out of these changes with SDK 36, but this opt-out will no longer be available for apps that target Android 17 (API level 37) or higher.
For more information, see Restrictions on orientation and resizability are ignored.
Connettività
Android 17 introduce la seguente modifica per migliorare la coerenza e
allinearsi al comportamento standard di Java InputStream per i socket RFCOMM Bluetooth.
Comportamento coerente di BluetoothSocket read() per RFCOMM
Per le app destinate ad Android 17 (livello API 37), il
metodo read() di InputStream ottenuto da un
BluetoothSocket basato su RFCOMM ora restituisce -1 quando il
socket viene chiuso o la connessione viene interrotta.
Questa modifica rende il comportamento dei socket RFCOMM coerente con i socket LE CoC e
si allinea alla documentazione standard InputStream.read(), che indica che -1 viene restituito quando viene raggiunta la fine dello stream.
Le app che si basano esclusivamente sull'intercettazione di un'eccezione IOException per uscire da un ciclo di lettura potrebbero
essere interessate da questa modifica e devono aggiornare i cicli di lettura di BluetoothSocket per
controllare esplicitamente un valore restituito di -1. Ciò garantisce che il ciclo termini
correttamente quando il dispositivo remoto si disconnette o il socket viene chiuso. Per un esempio dell'implementazione consigliata, consulta lo snippet di codice nella guida Trasferire dati Bluetooth.