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

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

Lesen Sie sich auch die Liste der Verhaltensänderungen durch, die sich auf alle Apps auswirken, die unter Android 16 ausgeführt werden, unabhängig von der targetSdkVersion Ihrer App.

Nutzerfreundlichkeit und System-UI

Android 16 (API-Level 36) enthält die folgenden Änderungen, die eine einheitlichere und intuitivere Nutzererfahrung ermöglichen sollen.

Deaktivierung von „Edge to Edge“ wird eingestellt

In Android 15 wurde der Vollbildmodus für Apps erzwungen, die auf Android 15 (API-Level 35) ausgerichtet sind. Sie können diese Funktion für Ihre App deaktivieren, indem Sie R.attr#windowOptOutEdgeToEdgeEnforcement auf true festlegen. Für Apps, die auf Android 16 (API-Level 36) ausgerichtet sind, ist R.attr#windowOptOutEdgeToEdgeEnforcement nicht mehr unterstützt und deaktiviert. Die randlose Anzeige kann in Ihrer App nicht deaktiviert werden.

  • Wenn Ihre App auf Android 16 (API-Level 36) ausgerichtet ist und auf einem Android 15-Gerät ausgeführt wird, funktioniert R.attr#windowOptOutEdgeToEdgeEnforcement weiterhin.
  • Wenn Ihre App auf Android 16 (API-Level 36) ausgerichtet ist und auf einem Android 16-Gerät ausgeführt wird, ist R.attr#windowOptOutEdgeToEdgeEnforcement deaktiviert.

Für den Test in Android 16 Beta 3 muss Ihre App randlose Displays unterstützen. Entfernen Sie alle Verwendungen von R.attr#windowOptOutEdgeToEdgeEnforcement, damit Ihre App auch auf einem Android 15-Gerät randlos angezeigt wird. Informationen zur Unterstützung von Vollbildinhalten finden Sie in den Anleitungen Kompositionen erstellen und Ansichten.

Migration oder Deaktivierung für die Prognosefunktion erforderlich

For apps targeting Android 16 (API level 36) or higher and running on an Android 16 or higher device, the predictive back system animations (back-to-home, cross-task, and cross-activity) are enabled by default. Additionally, onBackPressed is not called and KeyEvent.KEYCODE_BACK is not dispatched anymore.

If your app intercepts the back event and you haven't migrated to predictive back yet, update your app to use supported back navigation APIs. or temporarily opt out by setting the android:enableOnBackInvokedCallback attribute to false in the <application> or <activity> tag of your app's AndroidManifest.xml file.

The predictive back-to-home animation.
The predictive cross-activity animation.
The predictive cross-task animation.

Elegant-Schrift-APIs werden eingestellt und deaktiviert

Bei Apps, die auf Android 15 (API-Level 35) ausgerichtet sind, ist das Attribut elegantTextHeight TextView standardmäßig auf true festgelegt. Dadurch wird die kompakte Schrift durch eine deutlich lesbarere Schrift ersetzt. Sie können dies überschreiben, indem Sie das elegantTextHeight-Attribut auf false festlegen.

Unter Android 16 wird das Attribut elegantTextHeight eingestellt. Es wird ignoriert, sobald Ihre App auf Android 16 ausgerichtet ist. Die von diesen APIs gesteuerten „UI-Schriftarten“ werden eingestellt. Sie sollten daher alle Layouts anpassen, um eine einheitliche und zukunftssichere Textdarstellung in Arabisch, Lao, Myanmar, Tamil, Gujarati, Kannada, Malayalam, Odia, Telugu oder Thai zu gewährleisten.

elegantTextHeight-Verhalten für Apps, die auf Android 14 (API-Level 34) und niedriger oder auf Android 15 (API-Level 35) ausgerichtet sind und bei denen die Standardeinstellung durch Festlegen des Attributs elegantTextHeight auf false überschrieben wurde.
elegantTextHeight-Verhalten für Apps, die auf Android 16 ausgerichtet sind, oder für Apps, die auf Android 15 (API-Level 35) ausgerichtet sind und bei denen die Standardeinstellung nicht durch Festlegen des elegantTextHeight-Attributs auf false überschrieben wurde.

Hauptfunktion

Android 16 (API-Level 36) enthält die folgenden Änderungen, die verschiedene Kernfunktionen des Android-Systems ändern oder erweitern.

Optimierung der Planung von Aufträgen mit fester Rate

Prior to targeting Android 16, when scheduleAtFixedRate missed a task execution due to being outside a valid process lifecycle, all missed executions immediately execute when the app returns to a valid lifecycle.

When targeting Android 16, at most one missed execution of scheduleAtFixedRate is immediately executed when the app returns to a valid lifecycle. This behavior change is expected to improve app performance. Test this behavior in your app to check if your app is impacted. You can also test by using the app compatibility framework and enabling the STPE_SKIP_MULTIPLE_MISSED_PERIODIC_TASKS compat flag.

Formfaktoren von Geräten

Android 16 (API-Level 36) enthält die folgenden Änderungen für Apps, die auf Geräten mit großen Bildschirmen angezeigt werden.

Adaptive Layouts

With Android apps now running on a variety of devices (such as phones, tablets, foldables, desktops, cars, and TVs) and windowing modes on large screens (such as split screen and desktop windowing), developers should build Android apps that adapt to any screen and window size, regardless of device orientation. Paradigms like restricting orientation and resizability are too restrictive in today's multidevice world.

Ignore orientation, resizability, and aspect ratio restrictions

For apps targeting Android 16 (API level 36), Android 16 includes changes to how the system manages orientation, resizability, and aspect ratio restrictions. On displays with smallest width >= 600dp, the restrictions no longer apply. Apps also fill the entire display window, regardless of aspect ratio or a user's preferred orientation, and pillarboxing isn't used.

This change introduces a new standard platform behavior. Android is moving toward a model where apps are expected to adapt to various orientations, display sizes, and aspect ratios. Restrictions like fixed orientation or limited resizability hinder app adaptability, so we recommend making your app adaptive to deliver the best possible user experience.

You can also test this behavior by using the app compatibility framework and enabling the UNIVERSAL_RESIZABLE_BY_DEFAULT compat flag.

Common breaking changes

Ignoring orientation, resizability, and aspect ratio restrictions might impact your app's UI on some devices, especially elements that were designed for small layouts locked in portrait orientation: for example, issues like stretched layouts and off-screen animations and components. Any assumptions about aspect ratio or orientation can cause visual issues with your app. Learn more about how to avoid them and improve your app's adaptive behaviour.

Allowing device rotation results in more activity re-creation, which can result in losing user state if not properly preserved. Learn how to correctly save UI state in Save UI states.

Implementation details

The following manifest attributes and runtime APIs are ignored across large screen devices in full-screen and multi-window modes:

The following values for screenOrientation, setRequestedOrientation(), and getRequestedOrientation() are ignored:

  • portrait
  • reversePortrait
  • sensorPortrait
  • userPortrait
  • landscape
  • reverseLandscape
  • sensorLandscape
  • userLandscape

Regarding display resizability, android:resizeableActivity="false", android:minAspectRatio, and android:maxAspectRatio have no effect.

For apps targeting Android 16 (API level 36), app orientation, resizability, and aspect ratio constraints are ignored on large screens by default, but every app that isn't fully ready can temporarily override this behavior by opting out (which results in the previous behavior of being placed in compatibility mode).

Exceptions

The Android 16 orientation, resizability, and aspect ratio restrictions don't apply in the following situations:

  • Games (based on the android:appCategory flag)
  • Users explicitly opting in to the app's default behavior in aspect ratio settings of the device
  • Screens that are smaller than sw600dp

Opt out temporarily

To opt out a specific activity, declare the PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY manifest property:

<activity ...>
  <property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
  ...
</activity>

If too many parts of your app aren't ready for Android 16, you can opt out completely by applying the same property at the application level:

<application ...>
  <property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
</application>

Gesundheit und Fitness

Android 16 (API-Level 36) enthält die folgenden Änderungen im Zusammenhang mit Gesundheits- und Fitnessdaten.

Berechtigungen für Gesundheit und Fitness

For apps targeting Android 16 (API level 36) or higher, BODY_SENSORS permissions are transitioning to the granular permissions under android.permissions.health also used by Health Connect. Any API previously requiring BODY_SENSORS or BODY_SENSORS_BACKGROUND now requires the corresponding android.permissions.health permission. This affects the following data types, APIs, and foreground service types:

If your app uses these APIs, it should now request the respective granular permissions:

These permissions are the same as those that guard access to reading data from Health Connect, the Android datastore for health, fitness, and wellness data.

Mobile apps

Mobile apps migrating to use the READ_HEART_RATE and other granular permissions must also declare an activity to display the app's privacy policy. This is the same requirement as Health Connect.

Konnektivität

Android 16 (API-Level 36) enthält die folgenden Änderungen am Bluetooth-Stack, um die Verbindung mit Peripheriegeräten zu verbessern.

Neue Intents zum Umgang mit verlorenen Geräten und Verschlüsselungsänderungen

Im Rahmen der verbesserten Verarbeitung von Verbindungsunterbrechungen werden in Android 16 außerdem zwei neue Intents eingeführt, um Apps besser über Verbindungsunterbrechungen und Verschlüsselungsänderungen zu informieren.

Für Apps, die auf Android 16 ausgerichtet sind, ist jetzt Folgendes möglich:

  • Sie erhalten eine ACTION_KEY_MISSING-Intent, wenn ein Verlust der Remote-Verbindung erkannt wird. So können Sie Nutzern informativeres Feedback geben und entsprechende Maßnahmen ergreifen.
  • Sie erhalten eine ACTION_ENCRYPTION_CHANGE-Intent, wenn sich der Verschlüsselungsstatus des Links ändert. Dazu gehören Änderungen des Verschlüsselungsstatus, des Verschlüsselungsalgorithmus und der Größe des Verschlüsselungsschlüssels. Apps müssen davon ausgehen, dass die Verknüpfung wiederhergestellt wurde, wenn die Verknüpfung nach dem Empfang der ACTION_ENCRYPTION_CHANGE-Intent erfolgreich verschlüsselt wurde.

Wenn in Ihrer App derzeit benutzerdefinierte Mechanismen für die Verarbeitung von Verbindungsverlusten verwendet werden, migrieren Sie zur neuen Intent-Aktion ACTION_KEY_MISSING, um Verbindungsverluste zu erkennen und zu verwalten. Wir empfehlen, dass Ihre App den Nutzer auffordert, zu bestätigen, dass sich das Remote-Gerät in Reichweite befindet, bevor das Gerät vergessen und neu gekoppelt wird.

Wenn die Verbindung zu einem Gerät nach Erhalt der ACTION_KEY_MISSING-Intent getrennt wird, sollte Ihre App vorsichtig sein, bevor sie eine neue Verbindung zum Gerät herstellt, da dieses Gerät möglicherweise nicht mehr mit dem System verbunden ist.

Sicherheit

Android 16 (API-Level 36) enthält die folgenden Sicherheitsänderungen.

MediaStore-Version gesperrt

Bei Apps, die auf Android 16 oder höher ausgerichtet sind, ist MediaStore#getVersion() jetzt für jede App eindeutig. Dadurch werden identifizierende Eigenschaften aus dem Versionsstring entfernt, um Missbrauch und Verwendung für Fingerprinting-Techniken zu verhindern. Apps dürfen keine Annahmen über das Format dieser Version treffen. Apps sollten Versionsänderungen bereits bei der Verwendung dieser API verarbeiten und in den meisten Fällen sollte ihr aktuelles Verhalten nicht geändert werden müssen, es sei denn, der Entwickler hat versucht, zusätzliche Informationen abzuleiten, die über den beabsichtigten Umfang dieser API hinausgehen.

Datenschutz

Android 16 (API-Level 36) enthält die folgenden Änderungen im Hinblick auf den Datenschutz.

Berechtigung für das lokale Netzwerk

Devices on the LAN can be accessed by any app that has the INTERNET permission. This makes it easy for apps to connect to local devices but it also has privacy implications such as forming a fingerprint of the user, and being a proxy for location.

The Local Network Protections project aims to protect the user's privacy by gating access to the local network behind a new runtime permission.

Release plan

This change will be deployed between two releases, 25Q2 and TBD respectively. It is imperative that developers follow this guidance for 25Q2 and share feedback because these protections will be enforced at a later Android release. Moreover, they will need to update scenarios which depend on implicit local network access by using the following guidance and prepare for user rejection and revocation of the new permission.

Impact

At the current stage, LNP is an opt-in feature which means only the apps that opt in will be affected. The goal of the opt-in phase is for app developers to understand which parts of their app depend on implicit local network access such that they can prepare to permission guard them for the next release.

Apps will be affected if they access the user's local network using:

  • Direct or library use of raw sockets on local network addresses (e.g. mDNS or SSDP service discovery protocol)
  • Use of framework level classes that access the local network (e.g. NsdManager)

Traffic to and from a local network address requires local network access permission. The following table lists some common cases:

App Low Level Network Operation Local Network Permission Required
Making an outgoing TCP connection yes
Accepting incoming TCP connections yes
Sending a UDP unicast, multicast, broadcast yes
Receiving an incoming UDP unicast, multicast, broadcast yes

These restrictions are implemented deep in the networking stack, and thus they apply to all networking APIs. This includes sockets created in native or managed code, networking libraries like Cronet and OkHttp, and any APIs implemented on top of those. Trying to resolve services on the local network (i.e. those with a .local suffix) will require local network permission.

Exceptions to the rules above:

  • If a device's DNS server is on a local network, traffic to or from it (at port 53) doesn't require local network access permission.
  • Applications using Output Switcher as their in-app picker won't need local network permissions (more guidance to come in 2025Q4).

Developer Guidance (Opt-in)

To opt into local network restrictions, do the following:

  1. Flash the device to a build with 25Q2 Beta 3 or later.
  2. Install the app to be tested.
  3. Toggle the Appcompat flag in adb:

    adb shell am compat enable RESTRICT_LOCAL_NETWORK <package_name>
    
  4. Reboot The device

Now your app's access to the local network is restricted and any attempt to access the local network will lead to socket errors. If you are using APIs that perform local network operations outside of your app process (ex: NsdManager), they won't be impacted during the opt-in phase.

To restore access, you must grant your app permission to NEARBY_WIFI_DEVICES.

  1. Ensure the app declares the NEARBY_WIFI_DEVICES permission in its manifest.
  2. Go to Settings > Apps > [Application Name] > Permissions > Nearby devices > Allow.

Now your app's access to the local network should be restored and all your scenarios should work as they did prior to opting the app in.

Once enforcement for local network protection begins, here is how the app network traffic will be impacted.

Permission Outbound LAN Request Outbound/Inbound Internet Request Inbound LAN Request
Granted Works Works Works
Not Granted Fails Works Fails

Use the following command to toggle-off the App-Compat flag

adb shell am compat disable RESTRICT_LOCAL_NETWORK <package_name>

Errors

Errors arising from these restrictions will be returned to the calling socket whenever it invokes send or a send variant to a local network address.

Example errors:

sendto failed: EPERM (Operation not permitted)

sendto failed: ECONNABORTED (Operation not permitted)

Local Network Definition

A local network in this project refers to an IP network that utilizes a broadcast-capable network interface, such as Wi-Fi or Ethernet, but excludes cellular (WWAN) or VPN connections.

The following are considered local networks:

IPv4:

  • 169.254.0.0/16 // Link Local
  • 100.64.0.0/10 // CGNAT
  • 10.0.0.0/8 // RFC1918
  • 172.16.0.0/12 // RFC1918
  • 192.168.0.0/16 // RFC1918

IPv6:

  • Link-local
  • Directly-connected routes
  • Stub networks like Thread
  • Multiple-subnets (TBD)

Additionally, both multicast addresses (224.0.0.0/4, ff00::/8) and the IPv4 broadcast address (255.255.255.255) are classified as local network addresses.