Verhaltensänderungen: Apps, die auf Android 17 oder höher ausgerichtet sind

Wie bei früheren Versionen enthält Android 17 Verhaltensänderungen, die sich auf deine App auswirken können. Die folgenden Verhaltensänderungen gelten ausschließlich für Apps, die auf Android 17 oder höher ausgerichtet sind. Wenn deine App auf Android 17 oder höher ausgerichtet ist, solltest du sie gegebenenfalls so ändern, dass sie diese Verhaltensweisen unterstützt.

Sieh dir auch die Liste der Verhaltensänderungen an, die sich auf alle Apps auswirken, die unter Android 17 ausgeführt werden, unabhängig von der targetSdkVersion deiner App.

Hauptfunktion

Android 17 enthält die folgenden Änderungen, die verschiedene Kernfunktionen des Android-Systems ändern oder erweitern.

Neue sperrfreie Implementierung von MessageQueue

Ab Android 17 erhalten Apps, die auf Android 17 (API-Level 37) oder höher ausgerichtet sind, eine neue sperrenfreie Implementierung von android.os.MessageQueue. Die neue Implementierung verbessert die Leistung und reduziert fehlende Frames, kann aber Clients beeinträchtigen, die private Felder und Methoden von MessageQueue verwenden.

Weitere Informationen, einschließlich Strategien zur Risikominderung, finden Sie unter Leitfaden zur Verhaltensänderung von MessageQueue.

Statische finale Felder sind jetzt nicht mehr änderbar

Apps running on Android 17 or higher that target Android 17 (API level 37) or higher cannot change static final fields. If an app attempts to change a static final field by using reflection, it will cause an IllegalAccessException. Attempting to modify one of these fields through JNI APIs (such as SetStaticLongField()) will cause the app to crash.

Bedienungshilfen

In Android 17 wurden die folgenden Änderungen vorgenommen, um die Bedienungshilfen zu verbessern.

Unterstützung von Bedienungshilfen für die Eingabe über komplexe IME-Tastaturen

Mit dieser Funktion werden die neuen AccessibilityEvent und TextAttribute APIs eingeführt, um die Sprachausgabe von Screenreadern für die Eingabe in CJKV-Sprachen zu verbessern. CJKV-IME-Apps können jetzt signalisieren, ob während der Texterstellung ein Kandidat für die Textkonvertierung ausgewählt wurde. Apps mit Bearbeitungsfeldern können beim Senden von Ereignissen zur Barrierefreiheit für geänderten Text Textänderungstypen angeben. Apps können beispielsweise angeben, dass eine Textänderung während der Texterstellung erfolgt ist oder dass eine Textänderung durch einen Commit verursacht wurde. Dadurch können Bedienungshilfen wie Screenreader genaueres Feedback geben, das auf der Art der Textänderung basiert.

App-Akzeptanz

  • IME-Apps:Beim Erstellen von Text in Bearbeitungsfeldern können IMEs mit TextAttribute.Builder.setTextSuggestionSelected() angeben, ob ein bestimmter Konvertierungskandidat ausgewählt wurde.

  • Apps mit Bearbeitungsfeldern:Apps, die eine benutzerdefinierte InputConnection verwalten, können Kandidatenauswahldaten mit TextAttribute.isTextSuggestionSelected() abrufen. Diese Apps sollten dann AccessibilityEvent.setTextChangeTypes() aufrufen, wenn sie TYPE_VIEW_TEXT_CHANGED-Ereignisse senden. Bei Apps, die auf Android 17 (API-Level 37) ausgerichtet sind und die Standardklasse TextView verwenden, ist diese Funktion standardmäßig aktiviert. Das bedeutet, dass TextView das Abrufen von Daten aus der IME und das Festlegen von Textänderungstypen beim Senden von Ereignissen an Bedienungshilfen übernimmt.

  • Bedienungshilfen:Bedienungshilfen, die TYPE_VIEW_TEXT_CHANGED-Ereignisse verarbeiten, können AccessibilityEvent.getTextChangeTypes() aufrufen, um die Art der Änderung zu ermitteln und ihre Feedbackstrategien entsprechend anzupassen.

Datenschutz

Android 17 enthält die folgenden Änderungen, um den Datenschutz für Nutzer zu verbessern.

ECH (Encrypted Client Hello) aktiviert

Mit Android 17 wird die Plattformunterstützung für Encrypted Client Hello (ECH) eingeführt. Das ist eine TLS-Erweiterung, die den Datenschutz für Nutzer verbessert, indem sie die Server Name Indication (SNI) im TLS-Handshake verschlüsselt. Diese Verschlüsselung verhindert, dass Netzwerkbeobachter die spezifische Domain, mit der sich Ihre App verbindet, leicht identifizieren können.

Bei Apps, die auf Android 17 (API-Level 37) oder höher ausgerichtet sind, wird ECH für TLS-Verbindungen verwendet. ECH ist nur aktiv, wenn die von der App verwendete Netzwerkbibliothek (z. B. HttpEngine, WebView oder OkHttp) die ECH-Unterstützung integriert hat und der Remote-Server das ECH-Protokoll ebenfalls unterstützt. Wenn ECH nicht ausgehandelt werden kann, sendet der Client eine ECH-Erweiterung mit zufälligen Inhalten (ein Mechanismus namens ECH GREASE). Weitere Informationen zur Funktionsweise von ECH GREASE finden Sie in RFC 9849.

Damit Apps dieses Verhalten anpassen können, wird in Android 17 der Konfigurationsdatei für die Netzwerksicherheit das neue <domainEncryption> Element hinzugefügt. Entwickler können <domainEncryption> innerhalb von <base-config> oder <domain-config>-Tags verwenden, um einen ECH-Modus (z. B. "enabled" oder "disabled") global oder pro Domain auszuwählen.

Weitere Informationen finden Sie in der Dokumentation zu Encrypted Client Hello.

Berechtigung für lokales Netzwerk für Apps, die auf Android 17 ausgerichtet sind, erforderlich

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.

Passwörter auf physischen Geräten ausblenden

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.

OTP-Schutz für Standard-SMS-Nachrichten

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.

Sicherheit

In Android 17 wurden die folgenden Verbesserungen an der Geräte- und App-Sicherheit vorgenommen.

Aktivitätssicherheit

In Android 17, the platform continues its shift toward a "secure-by-default" architecture, introducing a suite of enhancements designed to mitigate high-severity exploits such as phishing, interaction hijacking, and confused deputy attacks. This update requires developers to explicitly opt in to new security standards to maintain app compatibility and user protection.

Key impacts for developers include:

  • BAL hardening & improved opt-in: We are refining Background Activity Launch (BAL) restrictions by extending protections to IntentSender. Developers must migrate away from the legacy MODE_BACKGROUND_ACTIVITY_START_ALLOWED constant. Instead, you should adopt granular controls like MODE_BACKGROUND_ACTIVITY_START_ALLOW_IF_VISIBLE, which restricts activity starts to scenarios where the calling app is visible, significantly reducing the attack surface.
  • Adoption tools: Developers should utilize strict mode and updated lint checks to identify legacy patterns and ensure readiness for future target SDK requirements.

CT standardmäßig aktivieren

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.)

Sicherere 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.

Felder mit personenbezogenen Daten in der CP2-Datenansicht einschränken

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.

Strikte SQL-Prüfungen in CP2 erzwingen

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.

Medien

Android 17 enthält die folgenden Änderungen am Medienverhalten.

Härtung von Audio im Hintergrund

Beginning with Android 17, the audio framework enforces restrictions on background audio interactions including audio playback, audio focus requests, and volume change APIs to ensure that these changes are started intentionally by the user.

Some audio restrictions apply to all apps. However, the restrictions are more stringent if an app targets Android 17 (API level 37). If one of these apps interacts with audio while it is in the background, it must have a foreground service running. In addition, the app must meet one or both of these requirements:

  • The foreground service must have while-in-use (WIU) capabilities.
  • The app must have the exact alarm permission and be interacting with USAGE_ALARM audio streams.

For more information, including mitigation strategies, see Background audio hardening.

Formfaktoren von Geräten

Android 17 enthält die folgenden Änderungen, um die Nutzerfreundlichkeit auf einer Reihe von Geräten mit unterschiedlichen Größen und Formfaktoren zu verbessern.

Änderungen an der Plattform-API, um Einschränkungen für Ausrichtung, Größenänderung und Seitenverhältnis auf großen Displays (sw>=600dp) zu ignorieren

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.

Konnektivität

In Android 17 wurde die folgende Änderung eingeführt, um die Konsistenz zu verbessern und das Verhalten an das Standardverhalten von InputStream in Java für Bluetooth-RFCOMM-Sockets anzupassen.

Konsistentes BluetoothSocket-read()-Verhalten für RFCOMM

For apps targeting Android 17 (API level 37), the read() method of the InputStream obtained from an RFCOMM-based BluetoothSocket now returns -1 when the socket is closed or the connection is dropped.

This change makes RFCOMM socket behavior consistent with LE CoC sockets and aligns with the standard InputStream.read() documentation, which states that -1 is returned when the end of the stream is reached.

Apps that rely solely on catching an IOException to break out of a read loop may be impacted by this change and should update the BluetoothSocket read loops to explicitly check for a return value of -1. This ensures the loop terminates correctly when the remote device disconnects or the socket is closed. For an example of the recommended implementation, see the code snippet in the Transfer Bluetooth data guide.