Wednesday, December 18, 2024

Android 15 is supposed to force apps to go edge-to-edge, but Google quietly added a way to opt out

Must read

Mishaal Rahman / Android Authority

TL;DR

  • Starting in Android 15, apps that target the new release are forced to go edge-to-edge by default, which makes the status and navigation bars transparent.
  • However, Google quietly added an API that apps can use to opt out of edge-to-edge enforcement.
  • This API isn’t mentioned in any of Google’s developer documents, blog posts, or codelabs, though.

Although Android has long offered apps the ability to use your phone’s entire screen by letting them draw content underneath the status and navigation bars, many apps don’t take advantage of this. There are many reasons why developers have shied away from making their apps go edge-to-edge, but in the upcoming Android 15 update, they’ll have no choice but to do so — or at least, that’s what we thought.

For a bit of context, apps have long been able to go edge-to-edge by implementing a few APIs that tells the OS to draw the app underneath the two “system bars” (ie. the status and navigation bars). The reason that Google didn’t immediately enforce this behavior is that many apps might have UI issues if they were forced to go edge-to-edge. For example, an app might have an interactive element like a floating action button that would overlap with the navigation bar if it went edge-to-edge.

To resolve this, Google gave developers a way to handle overlaps by using insets, which specify which parts of the app’s screen intersect with the system UI. However, because edge-to-edge was never enforced on apps, many developers didn’t need to bother with handling these UI conflicts. That’s supposed to change with Android 15, though.

When Google announced Android 15 Beta 1 earlier this year, they revealed that apps targeting Android 15 will be displayed edge-to-edge by default. To assist developers with this transition, Google published new developer docs, tutorials, and codelabs that demonstrate how to handle edge-to-edge enforcements in Android 15.

What none of these guides mention, though, is that there’s actually an API that apps can use to opt out of edge-to-edge mode.

On the left: App targets SDK 34 (Android 14) and is not edge-to-edge on an Android 15 device.
On the right: App targets SDK 35 (Android 15) and is edge-to-edge on an Android 15 device. Source: Google

The API in question is an attribute called windowOptOutEdgeToEdgeEnforcement that apps can set to true in their theme files. The attribute is false by default, which means that edge-to-edge enforcement will be applied to the window if it’s part of an app that targets Android 15. If the attribute is set to true, though, then edge-to-edge enforcement won’t be applied to the window in question.

However, the description for the API warns that “this attribute will be deprecated and disabled in a future SDK level,” which means this workaround won’t exist forever. At the very least, it gives developers at least two additional years to optimize their apps for edge-to-edge mode since the Google Play Store won’t force apps to target Android 15 until August 31, 2026. Even then, we don’t know exactly which version of Android will actually deprecate and disable this attribute as Google warns, meaning it could be used to avoid supporting edge-to-edge mode for longer than two years.

Regardless, we hope most developers will update their apps to support edge-to-edge mode rather than opt out. If not, we hope that this attribute is only used to temporarily and selectively opt certain windows out of edge-to-edge enforcement. Several of Google’s own apps may be doing just this, as the folks over on the GN Issues group on Telegram have pointed out that apps like Phone by Google and Google Play Services aren’t drawing edge-to-edge despite targeting Android 15.

Then there’s Google Chrome for Android, which may also use this API to opt out of edge-to-edge mode. Some developers are also pushing Google to provide an opt-out mechanism in future versions of Android, and if they oblige, then Android’s edge-to-edge enforcement could go back to being just a suggestion.

Got a tip? Talk to us! Email our staff at news@androidauthority.com. You can stay anonymous or get credit for the info, it’s your choice.

Latest article