Accueil / Apps & Logiciels / The first beta of Android 18

The first beta of Android 18

Today we're releasing the first Beta of Android 18, continuing our work to build a platform that prioritizes privacy, security, and refined performance. This build kicks off our biweekly Android 18 Beta release cycle, running in parallel with the conclusion of the Android 17 QPR3 Beta program.

Android 18 extends the memory management foundation we built across Android 17, with Beta 1 introducing per-process soft memory limits for background services. Other Beta 1 highlights include:

Building on our transition to an always-on Android Canary channel, the Android 18 Beta program plans to release approximately every two weeks in a continuous improvement cycle:

Over the past year, Android has delivered new capabilities and minor SDK releases continuously across quarterly platform updates. Android 18 (API level 38) is our annual major SDK release, which includes planned app-breaking behavior changes. This allows us to continue evolving the platform across performance, memory efficiency, security, privacy, and device form factors. It's also the only release that includes updates to Android's NDK.

We're going to be moving quickly from this Beta to our Platform Stability milestone, targeted for February. At this milestone, we plan to deliver final SDK/NDK APIs and largely final app-facing behaviors. From that time you’ll have several months before the final release to complete your testing.

We plan for Android 18 to continue to get updates in a series of quarterly releases, with the upcoming release in Q2 being the only one where we introduce planned app breaking behavior changes. Continue to watch this space as we reveal more of the story of Android 18, and join the Beta program to get regular drops of new features and APIs.

When a user switches away from your app to quickly snap a photo or reply to a message and returns to a cold splash screen, the culprit is usually wasted background RAM. Even as apps, games, and on-device AI workloads do more, most mainstream phones still have between 4 GB and 8 GB of RAM. Much of what evicts cached apps from memory isn't active user work. It's leftover full-resolution bitmaps from closed screens, one-time startup data, unreleased game assets held in the background, or hidden UI hierarchies pinned alongside a small background service.

In Android 18, we're extending our multi-release memory roadmap from catching extreme runaway leaks to helping keep background processes closer to their active working set. This helps more apps stay warm in RAM and resume quickly. Watch for more memory efficiency features planned in future Android 18 Beta releases.

Many apps and games run foreground services, such as data syncs, asset downloads, media playback, or location updates, inside their main UI process. Once the user leaves the screen, that active service keeps the entire process pinned at an elevated priority, holding onto stopped Activity hierarchies, decoded images, and graphics buffers.

Android will be rolling out per-process soft memory limits across the Android 18 Beta that apply when an app process runs a service with no visible UI. These limits are scaled by service role and device RAM.

For most apps whose background service simply shares a process with leftover UI state, Android pages out untouched allocations automatically, typically with no code changes needed. Background tasks generally slow down only if the service's own active working set exceeds its soft limit, triggering page faults as evicted files reload or swapped pages decompress.

If your background service experiences memory pressure under its soft limit:

You can inspect your app's active service roles, thresholds, and live budget sources today on an Android 18 Beta 1 device via ADB:

For details on interpreting these outputs and managing memory budgets, see the Memory Limiter, App Memory Budgets, Android Memory Optimization Guide, and MemoryBudgetManager docs.

Because per-process soft memory limits and the new dumpsys meminfo Memory Budget section are rolling out gradually during the Beta, your Beta 1 device may not have them active on day one. If dumpsys meminfo does not yet show a Memory Budget section (or Limit Source: Process role while your service runs without visible UI), the rollout has not reached your device yet. You can still test a limit deterministically on any Beta 1 build by running:

Note: Manual overrides set both the soft and hard limits to that size, so going below your app's active working set can terminate the process rather than just reclaiming memory.

Android 18's soft memory limits build directly on a full year of continuous platform memory and diagnostic upgrades introduced across Android 17, 17 QPR1 (SDK 37.1), and 17 QPR2 (SDK 37.2), all of which you can use today to measure, budget, and optimize your app's footprint:

Adopting these budgeting and profiling tools also helps prepare your apps and games for Google Play's February 2027 Android Vitals quality thresholds covering memory usage (anonymous RSS + swap), background and cached bitmap memory usage, and DEX code optimization.

First rolled out on Pixel devices in Android 17, time-based garbage collection triggering is now enabled by default in ART on Android 18. Previously, ART scheduled concurrent garbage collection primarily from static byte-allocation watermarks controlled by seven interdependent heap-sizing properties. As a result, an app that allocated a burst of temporary objects during startup or screen transitions and then went idle could hold unreachable garbage in RAM indefinitely. ART's time-based controller instead adapts GC cadence continuously to both allocation rate and elapsed time since the previous collection, including reclaiming unused heap memory concurrently once an app goes idle. In Pixel Beta testing, time-based GC triggering helped deliver:

No code changes are required, though two runtime behaviors are worth keeping in mind when profiling your app:

Alongside memory management, Android 18 Beta 1 continues expanding Android 17's concurrency and garbage collection upgrades across all apps, modernizing the Android Runtime (ART), and cleaning up legacy SDK surfaces.

In Android 17, we introduced a lock-free MessageQueue for apps targeting API level 37 or higher to help eliminate main-thread lock contention and priority inversion when background threads post work to UI handlers. Starting in Android 18 Beta 1, the legacy monitor-locked implementation is removed and android.os.MessageQueue runs lock-free for every app regardless of targetSdkVersion, alongside new fast-path consumer and wakeup optimizations. As we shared when introducing Android 17's lock-free MessageQueue, internal beta traces showed a 15% reduction in app main-thread time spent in lock contention, 4% fewer missed frames in apps, 7.7% fewer missed frames in System UI and Launcher interactions, and a 9.1% reduction in 95th-percentile time from app startup to first frame drawn. Extending this architecture to apps targeting API level 36 and lower helps bring those lock-free benefits to more apps.

Most apps benefit automatically with zero code changes. However, if you maintain an app targeting API level 36 or lower, or ship an SDK, that still uses unsupported reflection to inspect private MessageQueue fields (such as mMessages), those fields now return null on Android 18. Migrate custom main-thread watchdogs and frame monitors to public Looper logging or ProfilingManager, and update UI testing libraries such as Espresso and Robolectric to current releases.

The Android Runtime now enforces OpenJDK 17 sealed class and interface restrictions when loading classes and interfaces. This also means that the SDK jars are built for Java language version 17. Previously, compilers such as javac and D8/R8 validated sealed class hierarchies at compile time and recorded permitted subclass metadata in DEX files (minSdk 34 and higher), but ART did not enforce those constraints at runtime.

When loading a class or interface, ART now verifies that:

A class that fails these checks is rejected with a VerifyError.

If you compile your app and its dependencies together using standard build tools, your app should be unaffected in production. However, if your app:

Recompile dependent modules together when sealed hierarchies change and verify that your tooling preserves valid permitted-subclass metadata. You are also affected if code generates subclasses of sealed types at runtime (for example, mocking a sealed class or interface with Mockito in instrumented tests).

Origine de l’article : lire l’article original

Traduction