> Documentation index: https://developer.android.com/about/versions/llms.txt

This page describes important **developer-facing** features for the
Android 18 release, as well as changes to existing API behaviors in
Android 18 that **might affect your apps.**

## Behavior changes for all apps

The behavior changes covered in this section apply to all apps when they run on
Android 18, regardless of `targetSdkVersion`. You should test your app
and then modify it as needed to support these properly, where applicable.

Make sure to also review the list of [behavior changes that only affect apps
after they target Android 18](https://developer.android.com/about/versions/18/features-and-changes#changes-18).

### Elevated process memory limits

<br />

<br />

Starting in Android 18, the platform applies RAM-tiered soft memory limits using
Linux cgroup v2 `memory.high` controls to processes that have no visible UI and
run specific elevated background roles. This behavior change applies to all apps
running on Android 18 regardless of `targetSdkVersion`, doesn't use an App
Compatibility framework toggle, and activates in stages during Android 18 Beta
on 4 GB, 6 GB to 8 GB, and 12 GB and higher devices. Exact
role limits vary by device RAM and configuration and might change across Android
18 Beta builds as thresholds are calibrated.

Crossing an elevated process limit doesn't immediately terminate your app. After
a brief grace period above the limit, the operating system reclaims cold
file-backed pages and swaps idle anonymous pages to zRAM while keeping your
active working set resident. For more information, see [How memory budgets
work](https://developer.android.com/topic/performance/memory/app-memory-budgets#over-budget-behavior). Setting `android:largeHeap="true"` doesn't raise these
platform-enforced process limits. If a single process runs multiple roles at the
same time, such as `mediaProjection` alongside `microphone`, the highest
applicable limit or unconstrained status applies.

- **How to identify affected apps** : Your app is in scope only while its process has no visible UI and runs one of the enforced background roles. Processes with visible activities, split-screen windows, Picture-in-Picture windows, expanded Bubbles, or top screen-off activities are exempt, whereas `SYSTEM_ALERT_WINDOW` overlays without a foreground activity aren't exempt:
  - **Enforced [foreground service types](https://developer.android.com/develop/background-work/services/fgs/service-types.md.txt) and bound services** : `connectedDevice`, `dataSync`, `health`, `location`, `mediaPlayback`, `mediaProjection`, `remoteMessaging`, `specialUse`, and `systemExempted` foreground services, plus bound [`NotificationListenerService`](https://developer.android.com/reference/android/service/notification/NotificationListenerService.md.txt) and system `PrivateComputeCore` services.
  - **Unconstrained roles in initial Beta builds** : `camera`, `fileManagement`, `mediaProcessing`, `microphone`, `phoneCall`, and `shortService` foreground services, plus [`CompanionDeviceService`](https://developer.android.com/reference/android/companion/CompanionDeviceService.md.txt) and [`VoiceInteractionService`](https://developer.android.com/reference/android/service/voice/VoiceInteractionService.md.txt).
- **How to test** : Because default role limits activate in stages during Android 18 Beta, don't assume an unthrottled run means your app is unaffected; apply candidate limits manually on an R8-optimized release build (debug builds inflate memory residency, and active instrumentation tests are exempt from role limits):
  1. Verify that the memory limiter is enabled on your test device by running `adb shell am memory-limiter status` (see [Test your app's behavior under
     the memory constraints](https://developer.android.com/about/versions/17/behavior-changes-all#mem-limit-test)), and check process state with `adb
     shell dumpsys activity processes PACKAGE_NAME`. When default role limits are active on your build and your app runs an enforced background role with no visible UI, inspect the active limit in the `Limit` row where `Limit Source` is `Process role` in the [Memory budget
     section](https://developer.android.com/topic/performance/memory/guide/tools-overview#memory-budget) of `adb shell dumpsys meminfo PACKAGE_NAME`, or query it in-process through `getProcessBudgetBytes` on [`MemoryBudgetManager`](https://developer.android.com/reference/android/app/MemoryBudgetManager.md.txt) and Jetpack [`MemorySnapshot`](https://developer.android.com/reference/kotlin/androidx/core/os/MemorySnapshot.md.txt).
  2. If `dumpsys meminfo` reports `Limit: none` because default role limits aren't active on your build yet, or to test tighter 4 GB profiles on higher-RAM devices, sweep candidate ceilings down from your app's current background residency by running `adb shell am memory-limiter manual PID
     <size>MB`, such as `120MB` (see [Sweep candidate budgets](https://developer.android.com/topic/performance/memory/app-memory-budgets#sweep-candidate-budgets)). Include the `MB` suffix, because bare integers 20 and higher are parsed as bytes, and clear the override with `adb shell am memory-limiter manual
     PID none` before returning to your UI. Because `manual` sets both `memory.high` and the hard limit `memory.max`, a value below your active working set can terminate the process. To test soft-only limits in-app, call `MemoryBudgetManager.setProcessBudgetBytes` and `clearProcessBudget`, or temporarily exclude your app's UID from active default limits with `adb shell am memory-limiter ignore UID` and reset with `adb shell am memory-limiter ignore none`.
  3. Verify trim handlers with `adb shell am send-trim-memory PROCESS
     RUNNING_LOW`, and don't copy [Android vitals memory usage](https://developer.android.com/google/play/vitals/memory-usage.md.txt) numbers directly as your target ceiling. Android vitals reports anonymous RSS plus swap, whereas platform limits measure resident anonymous memory plus resident file cache and exclude swap.
- **What developers need to do** : Most apps that exceed the limit only because of inactive UI screens left behind after going to the Home screen need no code changes, because the system reclaims those idle pages cleanly. If an R8 release build shows active memory pressure such as audio glitches, delayed Bluetooth or location updates, sluggish warm resume, or [`ApplicationExitInfo.REASON_MEMORY_LIMITER`](https://developer.android.com/reference/android/app/ApplicationExitInfo.md.txt#REASON_MEMORY_LIMITER) exits, take the following steps in order:
  - **Replace persistent services where an OS alternative fits** : Migrate `dataSync` transfers to [WorkManager](https://developer.android.com/develop/background-work/background-tasks/persistent/getting-started/define-work.md.txt) or user-initiated data transfer jobs, continuous `health` step counting to batched sensors or Health Connect, passive `connectedDevice` presence scanning to `CompanionDeviceManager` where supported, and caller ID to `CallScreeningService`.
  - **Stay single-process and release hidden UI memory** : Keep services that share UI state, media players, maps, or a local database in one process. Enable [R8 optimization](https://developer.android.com/topic/performance/memory/manage-app-memory.md.txt#enable-r8), stream large payloads instead of buffering them in RAM (see [Manage your app's memory](https://developer.android.com/topic/performance/memory/manage-app-memory.md.txt)), and release image caches, off-screen views, and backgrounded video tracks or surfaces in `Activity.onStop` or `ProcessLifecycleOwner` `ON_STOP` because Android suppresses `TRIM_MEMORY_UI_HIDDEN` while a foreground service is active. Avoid `level >= TRIM_MEMORY_UI_HIDDEN` guards in `onTrimMemory`, which skip `TRIM_MEMORY_RUNNING_LOW` because its numeric constant is lower. At process scope, `MemoryBudgetManager.getProcessBudgetBytes` and `registerProcessOverBudgetListener` reflect platform-enforced elevated process limits even without a `<memory-budget>` manifest declaration (`clearProcessBudget` clears only dynamic app-set ceilings, and `registerPackageOverBudgetListener` requires a package budget). Register listeners on a background `HandlerThread` `Looper` rather than `Looper.getMainLooper` or `null`, and avoid blocking I/O in the callback; see [Listen for over-budget pressure callbacks](https://developer.android.com/topic/performance/memory/app-memory-budgets.md.txt#over-budget-listeners).
  - **Isolate headless work in a secondary process only when needed** : Move UI-independent services with minimal IPC, such as VPN tunnels, passive loggers, or `NotificationListenerService`, into a dedicated `android:process` gated by `Application.getProcessName`. For more information, see [Keep background work alive with a lean
    process](https://developer.android.com/topic/performance/memory/guide/process-splitting). If your app uses Flutter, React Native, .NET MAUI, or Unity, avoid moving non-Kotlin or non-Java runtimes into a second process because doing so duplicates the runtime; keep secondary workers in Kotlin or Java, or stay single-process.
- **Risks of inaction**: Processes whose active background working set stays well above their role limit, or that leak memory over time, experience sustained direct-reclaim throttling, zRAM swap refaults, higher CPU and battery usage, degraded background quality, sluggish app resume, or Application Not Responding (ANR) errors.

### Zero-tap sign-in restoration

<br />

<br />

To eliminate manual login friction during device setup and restore (Out-Of-Box
Experience), the Zero-Tap Sign-In Restoration requirement mandates that apps
supporting user sign-in automatically restore the user's active session on a new
device on Android 9 (API level 28) and higher. Standard apps must integrate the
Jetpack Credential Manager `RestoreCredentials` API (`androidx.credentials`),
which backs up a cloud-encrypted restore key during sign-in and silently
restores the user's session in the background during device setup. Existing apps
that integrated Block Store prior to September 30, 2026 to retrieve sign-in
tokens remain compliant, and apps that authenticate directly via the device's
primary OS account must ensure no redundant welcome or confirmation screens
block automatic sign-in after restore.

- **What to do to adopt:** Integrate `CredentialManager` with
  `CreateRestoreCredentialRequest` upon user sign-in and query
  `GetRestoreCredentialOption` on first launch after device restore to silently
  sign the user into the same account without displaying redundant onboarding
  screens (or prompt for a lightweight biometric challenge for high-security
  financial and health apps):

  ```kotlin
  val credentialManager = CredentialManager.create(context)
  // Fetch the options required to get the restore key
  val authenticationJson = fetchAuthenticationJson()

  // Create the GetRestoreCredentialRequest object
  val options = GetRestoreCredentialOption(authenticationJson)
  val getRequest = GetCredentialRequest(listOf(options))

  val response = credentialManager.getCredential(context, getRequest)

  // Type-check and extract the restore credential
  val credential = response.credential as RestoreCredential
  ```
- **Estimated effort:** *Small to Moderate effort (XS--M)* : small effort (\< 1
  day) for apps that already support Passkeys or `CredentialManager`; moderate
  effort (M) for apps that need to deploy FIDO2-compliant server verification.

- **How to get started:** Follow the [Implement Restore Credentials](https://developer.android.com/identity/sign-in/restore-credentials-implementation.md.txt)
  and [Test Restore Credentials in Android Studio](https://developer.android.com/identity/sign-in/test-restore-credentials.md.txt) guides on
  devices running Android 9+ with Google Play services (24220000 or higher and
  version 1.5.0 or higher of the `androidx.credentials` library), and declare
  your sign-in testing configuration via TestLoginAccount in the Play Console
  before Play policy enforcement begins on April 1, 2027.

- **Key benefits:** Delivers a friction-free, zero-tap sign-in experience across
  device upgrades and restores, reducing user churn from forgotten passwords
  while protecting against phishing and account takeovers (ATO) via
  cloud-encrypted restore keys.

## Behavior changes for apps targeting Android 18 or higher

The behavior changes covered in this section apply exclusively to apps that are
targeting Android 18 or higher. If your app is targeting
Android 18 or higher, you should modify your app to support these
behaviors properly, where applicable.

Be sure to also review the list of [behavior changes that affect all apps
running on Android 18](https://developer.android.com/about/versions/18/features-and-changes#changes-all).

### Android haptics fallback support (Phase 2 - legacy APIs)

<br />

<br />

Android 18 expands framework-level **Haptics Fallback Support** beyond modern
`VibrationEffect.Builder` API to universally cover existing legacy APIs,
including `VibrationEffect.Composition,` `VibrationEffect.createWaveform()`,
`createOneShot(), createPredefined()`, and Piecewise Linear Envelopes (PWLEs)
created by `BasicEnvelopeBuilder` and `WaveformEnvelopeBuilder`.

When an application triggers one of these legacy haptic effects on a device
whose HAL lacks native capabilities (such as lacking native PWLE support or
amplitude control), the framework now automatically translates the request into
a safe, deterministic fallback alternative (such as a supported basic waveform
or a binary ON/OFF pattern). To safely isolate apps from unintended behavior
shifts, this fallback expansion is gated by target SDK version 38 (Android 18).

- **What to do to adopt:** The fallback mechanism applies automatically when you
  update your app to target SDK 38. However, developers are highly encouraged to
  transition legacy long-duration primitives (such as `PRIMITIVE_SPIN` and
  `PRIMITIVE_THUD`) and basic amplitude-only waveforms to modern PWLEs utilizing
  the new Composition API:

  ```kotlin
  // Example: Migrating to the new modern Builder API
  val basicPwle = VibrationEffect.Envelope.create(
      VibrationEffect.BasicEnvelopeBuilder()
          .setInitialSharpness(0f)
          .addControlPoint(1f /* intensity */, 0f /* sharpness */, 200L /* durationMillis */)
          .addControlPoint(0f /* intensity */, 0f /* sharpness */, 200L /* durationMillis */)
  )

  val effect = VibrationEffect.Builder()
      .addPreset(0L /* startTimeMillis */, VibrationEffect.Preset.create(VibrationEffect.Preset.PRESET_CLICK)) 
      .addEnvelope(50L /* startTimeMillis */, basicPwle) 
      .build()

  vibrator.vibrate(effect)
  ```
- **Estimated effort:** Small effort (\< 1 day) to update the target SDK version,
  verify the new fallback behaviors on legacy APIs, and replace manual
  device-capability checks (e.g., `if (vibrator.hasAmplitudeControl())`) with
  reliance on the platform's automatic fallbacks.

- **How to get started:** Use the App Compatibility framework
  (`adb shell am compat enable haptics_fallback_legacy_apis <package-name>`) to
  quickly compare fallback behaviors against legacy "haptic silence". Test your
  implementation on the Android Emulator (which lacks advanced haptic drivers
  and will naturally trigger fallback routes) or on unsupported hardware like
  the Pixel 8a.

- **Key benefits**: Ensures a reliable baseline tactile experience across the
  Android ecosystem, allowing developers to "design once, play everywhere."
  Furthermore, applications automatically benefit from continuous hardware
  improvements; as users upgrade to devices with native PWLE support, your app
  will automatically deliver the highest-fidelity haptics without requiring any
  code changes.

### Disable content: URIs in WebView by default

<br />

<br />

To protect apps using `WebView` from malicious content attempting to access data
using the app's privileges, Android 18 changes the default value of
`WebSettings.getAllowContentAccess()` from `true` to **`false`** for
applications targeting Android 18 (`targetSdkVersion 38`) or higher. When
`allowContentAccess` is disabled, `WebView` blocks all attempts to access
`content://` URIs via `loadUrl()`, `<iframe>`, `<img>`, `fetch()`, or other web
APIs.

- **How to identify impact:** Your app is impacted if it targets Android 18 (`targetSdkVersion 38`) and loads `content://` URIs directly into a `WebView` (e.g., `webView.loadUrl("content://...")`), or renders HTML pages that embed `content://` resources (including images, iframes, and any other mechanism) without explicitly calling `webView.getSettings().setAllowContentAccess(true)`.
- **What developers need to do:** If `content://` URIs should be accessible, developers must explicitly call `webView.getSettings().setAllowContentAccess(true)` before attempting to load content. Developers should ensure that their app only loads the specific `content://` URIs that they intend, and should not load `content://` URIs that come from untrusted sources.
- **Risks of inaction:** When targeting Android 18+, any attempt by a `WebView` to load or fetch a `content://` URI with default `WebSettings` will fail with `ERR_ACCESS_DENIED`, which may cause entire pages or specific parts of pages to fail to render.

### Disabling of deprecated android.hardware.Camera API

<br />

<br />

Android 18 is expected to enforce the platform turndown of the legacy
`android.hardware.Camera` (`Camera1`) API for applications targeting Android 18
(`targetSdkVersion 38`) or higher.

Camera1 was deprecated in Android 5.0 (Lollipop, API level 21) in favor of
`android.hardware.camera2`. Camera1 API lacks support for modern multi-camera
arrays, HDR video capture, concurrent camera streaming, and manual per-frame
sensor controls. Jetpack CameraX, which is built on Camera2, is now the
recommended camera API.

When an application targeting Android 18+ attempts to invoke
`android.hardware.Camera.open()`, the camera service blocks initialization and
throws a `RuntimeException`. Moreover, calling
`android.hardware.Camera.getNumberOfCameras()` returns `0` in the same
conditions.

- **How to identify impact:** Search your codebase and third-party SDK dependencies for uses of `android.hardware.Camera`. Dependencies to check include legacy QR or barcode scanners, document capture SDKs, and WebRTC wrappers. Look for imports or calls to `android.hardware.Camera`, `Camera.open()`, `Camera.getNumberOfCameras()`, or `Camera.Parameters`.
- **What developers need to do:** Migrate all remaining camera capture, preview,
  and frame-processing workflows from `android.hardware.Camera` to **Jetpack
  CameraX** (`ProcessCameraProvider`) or `android.hardware.camera2`:

  ```kotlin
  val cameraProviderFuture = ProcessCameraProvider.getInstance(context)
  cameraProviderFuture.addListener({
      val cameraProvider = cameraProviderFuture.get()
      cameraProvider.bindToLifecycle(
  lifecycleOwner,CameraSelector.DEFAULT_BACK_CAMERA, preview)
  }, ContextCompat.getMainExecutor(context))
  ```
- **Risks of inaction:** Once your application updates its `targetSdkVersion` to
  Android 18 (`38`), any call to `android.hardware.Camera.open()` will
  immediately fail with a `RuntimeException`, causing camera previews, QR
  scanners, or video call features to crash.

### Fix legacy handling of system apps by PM APIs

<br />

<br />

To align `PackageManager` query results with documented per-user isolation
guarantees in multi-user environments, Android 18 (`targetSdkVersion 38`)
updates `PackageManager` APIs like `PackageManager.getInstalledPackages()`,
`PackageManager.getInstalledApplications()`, `PackageManager.getPackageInfo()`,
and `PackageManager.getApplicationInfo()` when called with
`MATCH_UNINSTALLED_PACKAGES`, `MATCH_ARCHIVED_PACKAGES`, or
`MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS`. Starting in Android 18, these queries
only return system apps that were actually installed (or subsequently
uninstalled with `DELETE_KEEP_DATA`) in the queried user profile. Queries using
`MATCH_KNOWN_PACKAGES` (`MATCH_UNINSTALLED_PACKAGES | MATCH_ANY_USER`) or
explicitly combining `MATCH_ANY_USER` continue to return system apps across all
device users for callers holding `INTERACT_ACROSS_USERS`.

- **How to identify impact:** Audit your codebase for calls to `PackageManager` APIs passing `MATCH_UNINSTALLED_PACKAGES`, `MATCH_ARCHIVED_PACKAGES`, or `MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS` in multi-user, work profile, or Device Policy Controller (DPC) environments where your logic assumes system packages installed on other users will be included in the result.
- **What developers need to do:** Ensure your app doesn't assume system
  packages never installed on the current user are returned when querying with
  `MATCH_UNINSTALLED_PACKAGES`, `MATCH_ARCHIVED_PACKAGES`, or
  `MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS`. If your privileged system or
  enterprise management app intentionally requires visibility into system
  packages installed across all users on the device, explicitly include the
  `MATCH_ANY_USER` flag (or `MATCH_KNOWN_PACKAGES`) alongside the required
  `INTERACT_ACROSS_USERS` permission:

  ```kotlin
  val flags = PackageManager.PackageInfoFlags.of(
      (PackageManager.MATCH_UNINSTALLED_PACKAGES or PackageManager.MATCH_ANY_USER).toLong()
  )
  val allDevicePackages = context.packageManager.getInstalledPackages(flags)
  ```
- **Risks of inaction:** When targeting Android 18 (`targetSdkVersion 38`) or
  higher in a multi-user environment, `PackageManager` queries using
  `MATCH_UNINSTALLED_PACKAGES`, `MATCH_ARCHIVED_PACKAGES`, or
  `MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS` without `MATCH_ANY_USER` will omit
  system apps that were never installed on the target user, which may alter
  package inventory lists or provisioning behavior for callers relying on the
  legacy cross-user behavior.

### Global keyboard navigation

<br />

<br />

Android 18 introduces global system-wide keyboard navigation shortcuts
(`Meta+Back` / `Meta+F1` and `Meta+Shift+Back` / `Meta+Shift+F1`) that enable
users to cycle keyboard focus across all visible windows on screen---including
application windows, system bars, status bars, and floating or
picture-in-picture windows---solely using a physical keyboard.
Because these system-level shortcuts are intercepted
globally by `WindowManagerService` before key events are dispatched to the
active window, they take precedence over any custom application-defined keyboard
shortcuts bound to the same key combinations.

- **How to identify impact:** Audit your application's key event handlers (`KeyEvent.Callback`, `onKeyDown()`, `onKeyShortcut()`, or `KeyboardShortcutsGroup` definitions) to determine whether your app intercepts or registers `Meta+Back` (`KEYCODE_BACK` with `META_META_ON`), `Meta+F1` (`KEYCODE_F1` with `META_META_ON`), `Meta+Shift+Back`, or `Meta+Shift+F1` for in-app actions.
- **What developers need to do:** Remap any conflicting in-app keyboard
  shortcuts away from `Meta+Back` / `Meta+F1` and `Meta+Shift+Back` /
  `Meta+Shift+F1` to alternative key combinations so users can access both
  global window focus cycling and your app's custom shortcuts:

  ```kotlin
  override fun onProvideKeyboardShortcuts(
      data: MutableList<KeyboardShortcutGroup>, menu: Menu?, deviceId: Int
  ) {
      val group = KeyboardShortcutGroup("Navigation")
      group.addItem(KeyboardShortcutInfo("Switch pane", KeyEvent.KEYCODE_TAB, KeyEvent.META_CTRL_ON))
      data.add(group)
  }
  ```
- **Risks of inaction:** Any custom in-app functionality bound to `Meta+Back`
  (`Meta+F1`) or `Meta+Shift+Back` (`Meta+Shift+F1`) will become unreachable
  when global keyboard navigation is active, as the system consumes these key
  events to cycle focus across windows.

### NPU manager

<br />

<br />

Android 18 introduces centralized Machine Learning (ML) model memory management
inside the system **NpuManager** service. Today, large on-device generative AI
and ML models consume gigabytes of system RAM, and their accelerator buffers are
frequently pinned in physical memory even when the inference session is idle or
backgrounded, causing system-wide memory pressure and low-memory killer (LMK)
thrashing. `NpuManager` enables the OS to track NPU buffer allocations,
dynamically reclaim idle ML model weights when an app moves to the background,
and restore them when inference resumes.

- **How to identify impact:** Your app is impacted if it executes on-device ML/AI models on the NPU using LiteRT (TensorFlow Lite), NNAPI, or custom vendor NPU runtimes and retains large model weight buffers in memory while backgrounded.
- **What developers need to do:** Use the latest LiteRT runtime with hardware
  accelerator delegation and release or unpin NPU interpreter sessions when the
  app enters `onStop()`:

  ```kotlin
  override fun onStop() {
      super.onStop()
      npuInterpreter.resetVariableTensors() // Allow NpuManager to reclaim idle buffers
  }
  ```
- **Risks of inaction:** Apps that allocate large pinned NPU buffers without
  supporting `NpuManager` memory reclamation risk having their NPU contexts
  forcibly evicted or their process terminated by the system Low Memory Killer
  (LMK) when backgrounded under memory pressure.

### OpenJDK 25 APIs for 27Q2

<br />

<br />

Android 18 updates the Android Runtime (`ART`) and core library (`libcore`) to
integrate language features, standard library APIs, and behavioral
specifications from **OpenJDK 25** . This update brings modern Java API additions
across `java.util`, `java.lang`, `java.time`, `java.util.concurrent`, and
`java.security`, along with stricter OpenJDK 25 specification compliance for
collection mutability, string formatting, math edge cases, and concurrency
primitives.

#### Reflective access to private fields/methods

- **How to identify impact:** Your app is impacted if it targets Android 18+ and relies on reflection into private fields/methods of `java.lang.*` or `java.util.*` classes, depends on legacy pre-Java 25 edge-case behaviors in `BigDecimal`, `DateTimeFormatter`, or `Collections`, or bundles third-party bytecode manipulation libraries that inspect core library class files.
- **What developers need to do:** Compile and test against the Android 18 SDK
  and replace reflective access to internal `java.*` fields with public standard
  APIs:

  ```kotlin
  android {
      compileSdk = 38
      compileOptions {
          sourceCompatibility = JavaVersion.VERSION_21
          targetCompatibility = JavaVersion.VERSION_21
      }
  }
  ```
- **Risks of inaction:** Apps using reflection against modified internal
  `libcore` fields or relying on deprecated pre-OpenJDK 25 behavioral quirks may
  encounter `NoSuchFieldException`, `InaccessibleObjectException`, or subtle
  data formatting mismatches when targeting Android 18+.

#### Synchronization on value-based classes

Synchronization on [value-based](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/doc-files/ValueBased.html) class instances won't be allowed:
an attempt to synchronize on them in apps running on Android 18 (or higher) and
targeting Android 18 (or higher) will throw an exception.

- **How to identify impact:** If you are targeting Android 18 and see a runtime
  exception that has a message similar to
  `"java.lang.Integer is not an identity class"` then you are trying to
  synchronize on a value-based class (**please note:** *the message is just for
  debugging purposes and it may change in the future* ). To find out explicit
  synchronization attempts in your app, you can `adb push` the apk to e.g.
  `/data/local/tmp` and run

  ```bash
  dex2oat --dex-file=/data/local/tmp/app.apk --oat-file=/data/local/tmp/output.oat
  ```

  in the `adb shell` session. Then in `adb logcat` you'll see entries such as:

      10-02 13:33:40.062  3608  3629 W dex2oat : void edt.b(): monitor-enter on value-class (Ljava/lang/Boolean;).

  Make sure you're testing the same APK you'd upload into PlayStore, with all
  obfuscation libraries and frameworks applied.
- **What developers need to do:** You should use an object that is an instance
  of a non-value class. For example, you can replace code such as this:

  ```java
      private Integer lock = new Integer(1);
      ...
      synchronized (lock) { ... }
  ```

  with code that uses non-value classes for synchronization:

  ```java
      private final Object lock = new Object();
      ...
      synchronized (lock) { ... }
  ```
- **Risks of inaction:** Apps synchronizing on instances of value-classes will
  see the synchronization attempt fail once the targeted SDK is updated to
  Android 18.

> [!NOTE]
> **Note:** If you use **React Native** , issues in the library have been fixed as of **v0.87.0** (and backported to **v0.86.2**). Please make sure you upgrade to a suitable version of the library.

> [!NOTE]
> **Note:** Behavior of the `==` operator is not affected in this release (Android 18).

### PCC framework enforcement and restrictions

<br />

<br />

Android 18 (API level 38) enforces Private Compute Core (PCC) sandbox boundaries
for system-bound intelligence services, global AppSearch callers, and privacy
indicator exemptions. These requirements apply only to packages targeting
Android 18 or higher (`targetSdkVersion` 38 or higher); packages targeting
Android 17 (API level 37) or lower remain exempt at run time.

Specifically, Android 18 enforces three PCC framework requirements:

1. **System-bound intelligence services** : `system_server` verifies at service binding time that configured system services targeting Android 18 or higher declare either `android:privateComputeCore="true"` or `android:isolatedProcess="true"` on their `<service>` manifest element, and rejects binding otherwise. Default implementations hosted by the Android ExtServices module, such as the default `NotificationAssistantService` and `TextClassifierService`, are exempt. This requirement applies to services configured through the following device overlays:
   - `ContentCaptureService` (`config_defaultContentCaptureService`)
   - `ContentProtectionService` (`config_defaultContentProtectionService`)
   - `TranslationService` (`config_defaultTranslationService`)
   - `TextClassifierService` (`config_defaultTextClassifierPackage`)
   - `AugmentedAutofillService` (`config_defaultAugmentedAutofillService`)
   - `FieldClassificationService` (`config_defaultFieldClassificationService`)
   - `SmartspaceService` (`config_defaultSmartspaceService`)
   - `RotationResolverService` (`config_defaultRotationResolverService`)
   - `AttentionService` (`config_defaultAttentionService`)
   - `AmbientContextDetectionService` (`config_defaultAmbientContextDetectionService`)
   - `WearableSensingService` (`config_defaultWearableSensingService`)
   - `NotificationAssistantService` (`config_defaultAssistantAccessComponent`)
2. **Global AppSearch access** : Packages targeting Android 18 or higher that hold `READ_GLOBAL_APP_SEARCH_DATA` through the `SYSTEM_UI_INTELLIGENCE` role must invoke global `AppSearchManager` query APIs from a PCC sandbox process (`android:privateComputeCore="true"`, verified through `Process.isPrivateComputeCoreUid`). Calls from non-PCC processes are rejected.
3. **Privacy indicator scoping for ambient audio and media capture** : Previously, system intelligence packages configured through device intelligence overlays (`config_systemAmbientAudioIntelligence`, `config_systemAudioIntelligence`, `config_systemVisualIntelligence`, `config_systemUiIntelligence`, `config_systemNotificationIntelligence`, and `config_systemTextIntelligence`) received a package-wide exemption from the status bar microphone and camera privacy indicators when capturing audio or video through `AudioRecord` or `MediaRecorder`. For packages targeting Android 18 or higher, privacy indicator suppression applies only to accesses originating from a PCC sandbox process (`android:privateComputeCore="true"`, verified through `Process.isPrivateComputeCoreUid`). Any `AudioRecord` or `MediaRecorder` session initiated from a non-PCC process displays the standard user-facing microphone or camera privacy indicator.

**How to identify impact**:

- Third-party apps aren't affected because all affected services and APIs are `@SystemApi` and gated by `signature|privileged` permissions, device config overlays, or system roles.
- Preloaded or system packages that implement any of the listed system-bound services, query global AppSearch data through `READ_GLOBAL_APP_SEARCH_DATA`, or rely on system intelligence privacy indicator exemptions must run those components in the required sandboxed process before targeting Android 18.

**What developers need to do**:

1. For any affected system-bound `<service>` in a package targeting Android 18
   or higher, add `android:privateComputeCore="true"` or
   `android:isolatedProcess="true"` to the service declaration in
   `AndroidManifest.xml`:

   ```xml
   <service
       android:name=".MySystemIntelligenceService"
       android:permission="android.permission.BIND_TEXT_CLASSIFIER_SERVICE"
       android:privateComputeCore="true"
       android:exported="true" />
   ```
2. Ensure any code querying global `AppSearchManager` data through
   `READ_GLOBAL_APP_SEARCH_DATA` executes from a PCC sandbox process
   (`<service android:privateComputeCore="true" />`).

3. Audit packages configured in `config_system*Intelligence` overlays that
   target Android 18 or higher, and ensure background ambient `AudioRecord` or
   `MediaRecorder` capture runs inside a PCC sandbox process
   (`<service android:privateComputeCore="true" />`) to retain the privacy
   indicator exemption.

**Risks of inaction** : When an affected system package updates its
`targetSdkVersion` to 38 or higher, `system_server` rejects binding to non-PCC
and non-isolated implementations of the listed system-bound services, rejects
global `AppSearchManager` queries from non-PCC callers, and displays the
standard microphone or camera privacy indicator for non-PCC `AudioRecord` or
`MediaRecorder` capture.

### PhotoPicker location metadata (GET_CONTENT) adoption

<br />

<br />

When `Intent.ACTION_GET_CONTENT` is launched with a media MIME type, the system
opens the PhotoPicker. Android 18 expands the PhotoPicker location metadata
feature to these `ACTION_GET_CONTENT` launches, making its behavior consistent
with `MediaStore.ACTION_PICK_IMAGES` and completely decoupling location sharing
from broad storage runtime permissions (`ACCESS_MEDIA_LOCATION`). Previously,
when opening the PhotoPicker via an `ACTION_GET_CONTENT` intent with a media
MIME type, location metadata was shared only if the calling app held the
`ACCESS_MEDIA_LOCATION` runtime permission.

Starting in Android 18 (targetSdkVersion 38), `ACCESS_MEDIA_LOCATION` will no
longer matter for location sharing in Photopicker, and location access is now
granted on a per-session basis. Calling apps can request location metadata by
setting the intent extra `MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS` to
`true`, which displays a user-facing location toggle in the PhotoPicker UI for
that session to make the user aware of the session's location sharing status.
The user can choose whether or not to share location and the user's decision
will be final. If the extra is not requested, location is redacted by default.

**Note on `ACCESS_MEDIA_LOCATION` retention:** Retaining `ACCESS_MEDIA_LOCATION`
in your manifest might be useful for backward compatibility to ensure consistent
location access across the following scenarios:

1. **Devices running Android 17 and lower:** These devices still require this permission for location sharing in `GET_CONTENT`.
2. **Previously persisted URIs:** Location access for URIs acquired while targeting SDK 37 or lower continues to depend on holding this permission.
3. **Pre-Mainline update devices:** Devices running Android 18 and higher fall back to checking this permission until they receive the corresponding Mainline module update.

- **How to identify impact:** Your app is impacted if it targets Android 18 (targetSdkVersion 38) or higher and:
  - Launches `Intent.ACTION_GET_CONTENT` and expects location metadata relying solely on holding `ACCESS_MEDIA_LOCATION` permission without passing `MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS`.
  - Calls `MediaStore.setRequireOriginal(uri)` or appends `requireOriginal=1` on `content://` URIs returned from `ACTION_GET_CONTENT` solely based on holding the `ACCESS_MEDIA_LOCATION`.
- **What developers need to do:**

  - **Pass the intent extra:** Explicitly set
    `MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS` to `true` when
    launching `ACTION_GET_CONTENT` if location metadata is needed:

    ```kotlin
    val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
        type = "image/*"
        putExtra(MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS, true)
    }
    ```
  - **Handle `UnsupportedOperationException` downstream:** Because
    `MediaStore.setRequireOriginal(photoUri)` only appends query parameters,
    `UnsupportedOperationException` is thrown downstream when attempting to
    open the stream if the unredacted original file cannot be provided. Catch
    this exception and fall back to the default URI:

    ```kotlin
    val originalUri = MediaStore.setRequireOriginal(photoUri)
    val inputStream = try {
        contentResolver.openInputStream(originalUri)
    } catch (e: UnsupportedOperationException) {
        contentResolver.openInputStream(photoUri)
    }
    ```
- **Risks of inaction:**

  - **Runtime crashes (`UnsupportedOperationException`):** Opening streams from `MediaStore.setRequireOriginal()` URIs or using third-party media libraries that append `requireOriginal=1` on `ACTION_GET_CONTENT` URIs will throw an unhandled `UnsupportedOperationException` if location access was not requested or was declined by the user.
  - **Silent loss of location metadata:** Apps targeting Android 18 (targetSdkVersion 38) or higher that rely solely on holding `ACCESS_MEDIA_LOCATION` without passing `MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS` will silently receive media with EXIF GPS coordinates redacted by default.

### Protection against NFC phishing attacks

<br />

<br />

To combat widespread NFC relay phishing attacks that abuse Android devices to
intercept and replay contactless payment card transactions at Point-of-Sale
(PoS) terminals or NFC-enabled ATMs, Android 18 introduces granular permission
gating for financial Application Identifiers (AIDs). Rather than treating all
NFC communications uniformly under the general `android.permission.NFC`
permission, the platform separates financial transaction access into two
dedicated normal-level permissions: `android.permission.NFC_PAYMENT_AID_CE` for
Host Card Emulation (HCE) payment services and
`android.permission.NFC_PAYMENT_AID_READER` for reader-mode applications
interacting with external payment cards. Additionally,
`NfcAdapter.getAidsForPaymentPermission()` allows applications to query the
exact list of protected payment AID prefixes enforced by the platform.

- **How to identify impact:** Your app is impacted if it registers a `HostApduService` or `OffHostApduService` for card emulation with an AID group containing financial/payment AIDs (such as `A000000003` for Visa, `A000000004` for Mastercard, or `2PAY.SYS.DDF01`), OR if your app uses `NfcAdapter.enableReaderMode()` / `IsoDep.transceive()` to send APDU `SELECT` commands targeting payment AIDs on external NFC cards.
- **What developers need to do:** Declare `NFC_PAYMENT_AID_CE` (for mobile
  wallet/card emulation apps) or `NFC_PAYMENT_AID_READER` (for merchant PoS
  terminal/reader apps) in your `AndroidManifest.xml`:

  ```xml
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
      <uses-permission android:name="android.permission.NFC_PAYMENT_AID_CE" />
      <uses-permission android:name="android.permission.NFC_PAYMENT_AID_READER" />
  </manifest>
  ```
- **Risks of inaction:** If an app attempts to register a card emulation service
  containing any protected payment AID without holding `NFC_PAYMENT_AID_CE`, the
  entire AID group registration is rejected by the NFC stack. If an app in
  reader mode sends an APDU `SELECT` command matching a protected payment AID
  without holding `NFC_PAYMENT_AID_READER`, the call throws a runtime
  `SecurityException`.

### Restrict implicit URI grants

<br />

<br />

Previously, if an app launched an intent with the [`ACTION_SEND`](https://developer.android.com/reference/android/content/Intent.md.txt#ACTION_SEND) or
[`ACTION_SEND_MULTIPLE`](https://developer.android.com/reference/android/content/Intent.md.txt#ACTION_SEND_MULTIPLE) action, the system automatically gave the
target app read access to the content URIs in [`EXTRA_STREAM`](https://developer.android.com/reference/android/content/Intent.md.txt#EXTRA_STREAM). For
[`ACTION_IMAGE_CAPTURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_IMAGE_CAPTURE) and related capture actions such as
[`ACTION_IMAGE_CAPTURE_SECURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_IMAGE_CAPTURE_SECURE),
[`ACTION_VIDEO_CAPTURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_VIDEO_CAPTURE),
[`ACTION_MOTION_PHOTO_CAPTURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_MOTION_PHOTO_CAPTURE), and
[`ACTION_MOTION_PHOTO_CAPTURE_SECURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_MOTION_PHOTO_CAPTURE_SECURE), it gave read and write
access to the URI in [`EXTRA_OUTPUT`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#EXTRA_OUTPUT).
Starting in
Android 18, for apps targeting Android 18 (API level 38) or higher, the system
no longer automatically grants these permissions. Apps must explicitly grant the
relevant URI permissions instead of relying on the system to grant them.

#### Detection

1. **StrictMode:** To detect the usage of these intents in your app, use
   [`StrictMode`](https://developer.android.com/reference/android/os/StrictMode.md.txt) with
   [`detectImplicitUriPermissionGrant()`](https://developer.android.com/reference/android/os/StrictMode.VmPolicy.Builder.md.txt#detectImplicitUriPermissionGrant()) to trigger a violation:

   ```kotlin
   val policy = StrictMode.VmPolicy.Builder()
       .detectImplicitUriPermissionGrant()
       .penaltyLog()
       .build()
   StrictMode.setVmPolicy(policy)
   ```
2. **Logcat:** Alternatively, you can monitor for logged exceptions containing
   the message `Please set the grant explicitly in the app` that appears when
   the system detects a missing explicit grant. You can monitor for these logs
   using the following `adb` command:

   ```bash
   adb logcat | grep "Please set the grant explicitly in the app"
   ```
3. **Android Lint (optional):** You can also use the `MissingExplicitUriGrant`
   lint check (available starting in Android Gradle Plugin `9.5.0`) to help spot
   intents missing explicit grant flags in your source code and apply quick
   fixes in Android Studio. Because static analysis cannot catch every dynamic
   intent flow, use it alongside [`StrictMode`](https://developer.android.com/reference/android/os/StrictMode.md.txt) or Logcat testing.

#### Mitigation

**Intent senders**

To explicitly grant the necessary permissions, add the
[`FLAG_GRANT_READ_URI_PERMISSION`](https://developer.android.com/reference/android/content/Intent.md.txt#FLAG_GRANT_READ_URI_PERMISSION) flag to
[`ACTION_SEND`](https://developer.android.com/reference/android/content/Intent.md.txt#ACTION_SEND) and [`ACTION_SEND_MULTIPLE`](https://developer.android.com/reference/android/content/Intent.md.txt#ACTION_SEND_MULTIPLE) intents:

```kotlin
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
```

Include both [`FLAG_GRANT_READ_URI_PERMISSION`](https://developer.android.com/reference/android/content/Intent.md.txt#FLAG_GRANT_READ_URI_PERMISSION) and
[`FLAG_GRANT_WRITE_URI_PERMISSION`](https://developer.android.com/reference/android/content/Intent.md.txt#FLAG_GRANT_WRITE_URI_PERMISSION) flags for
[`ACTION_IMAGE_CAPTURE`](https://developer.android.com/reference/android/provider/MediaStore.md.txt#ACTION_IMAGE_CAPTURE) and related capture intents:

```kotlin
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
```

**Intent receivers**

If your app receives these intents, check whether the required grant flag is set
on the incoming intent to gracefully degrade functionality if the sending app
did not grant permission (checking for
[`FLAG_GRANT_WRITE_URI_PERMISSION`](https://developer.android.com/reference/android/content/Intent.md.txt#FLAG_GRANT_WRITE_URI_PERMISSION) follows a similar structure):

```kotlin
val granted = (intent.flags and Intent.FLAG_GRANT_READ_URI_PERMISSION) ==
    Intent.FLAG_GRANT_READ_URI_PERMISSION
```

### Vertical metrics and Nastaliq support

<br />

<br />

Android 18 updates the platform text layout engine (`Minikin` / `StaticLayout`)
to standardize vertical font metrics calculation and introduces native
**Nastaliq** calligraphic script shaping and fallback font support for Urdu
(`ur`). Previously, tall ascenders, descenders, and stacked diacritics in
complex scripts---especially Nastaliq---were frequently clipped at the top or bottom
of `TextView` and Compose `Text` bounds due to legacy Roboto-centric line height
clamping. The updated vertical metrics engine dynamically respects the font's
true vertical bounds.

- **How to identify impact:** Your app is impacted if the Urdu text rendered
  with the new Nastaliq font is clipped vertically or breaks the layout. See
  example screenshots:

  ![Screenshot showing Urdu text clipped vertically](https://developer.android.com/static/about/versions/18/images/changes/bad-urdu-1.png)

  ![Screenshot showing Urdu text clipped vertically](https://developer.android.com/static/about/versions/18/images/changes/bad-urdu-2.png)
- **What developers need to do:** Test the app in Urdu with the new Nastaliq
  font and fix any UI issues detected. The exact fix depends on how the affected
  UI component is implemented. Below are mitigations for the most common
  patterns of font height issues:

  - **Remove fixed height constraints (recommended):** Where possible, remove hardcoded line heights or fixed container heights (for example, use `wrap_content` on `View` layouts or let Compose components size dynamically to their text content).
  - **If height constraints are needed (for example, carousel cards):** Developers may mitigate the issue in one of the following ways:
    - **Measure height using the rendered text:** Calculate the component height using the text height returned by [`TextMeasurer`](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/TextMeasurer.md.txt) or [`Paint.getFontMetricsInt(CharArray, ...)`](https://developer.android.com/reference/kotlin/android/graphics/Paint.md.txt#getFontMetricsInt(kotlin.CharArray,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Int,%20kotlin.Boolean,%20android.graphics.Paint.FontMetricsInt)). (Warning: Always pass the actual rendered or localized text. Do not call `Paint.getFontMetrics()` without text, or pass an English dummy string to `TextMeasurer`, as doing so returns the default Latin script height instead of the actual font's height.)
    - **Use locale-specific line height:** If the app is already using static numbers for text line-height, consider adding a higher number for specific locales (e.g. `ur`). Please note that this is not a scalable solution, but could be used to mitigate the issues.
- **Risks of inaction:** UI components with rigid fixed-height text containers
  or clipped parent bounds may exhibit truncated text or layout overlap when
  rendering Urdu/Kashmiri Nastaliq script or tall multi-script glyphs.

## New features and APIs

Android 18 introduces new features and APIs for developers. The
following sections summarize these features to help you get started with the
related APIs.

### App memory budgets

<br />

<br />

Android 17 QPR2 introduced [declarative and runtime app memory
budgets](https://developer.android.com/topic/performance/memory/app-memory-budgets) to isolate memory pressure within individual application
packages and processes using Linux cgroup v2 (`memory.high`) controls. Rather
than allowing unbounded memory growth to trigger system-wide reclamation, UI
jank, or Low Memory Killer (LMK) terminations of background apps, when an app
exceeds its declared budget the kernel targets memory reclamation specifically
at that app's cgroup (dropping clean file pages, flushing dirty pages, and
swapping anonymous pages to zRAM).

Declare static package-level or per-process memory ceilings for your app in
`AndroidManifest.xml` by using `<memory-budget>`, including state-specific
budgets for `foreground`, `perceptible`, and `background` states, display
density and pixel scaling through `android:additionalMbPerDensity` and
`android:additionalBytesPerDisplayPixel`, and hardware feature overrides
through `android:feature`. At run time, set tighter dynamic ceilings within
manifest and system limits through `MemoryBudgetManager`, or through NDK
`<android/memory_budget_manager.h>` starting in Android 18 (API level 38). You
can also register `MemoryBudgetManager.OnOverBudgetListener` callbacks to trim
caches when an over-budget event occurs.

- **What to do to adopt**:

  Follow the guidance at [Set app memory budgets](https://developer.android.com/topic/performance/memory/app-memory-budgets.md.txt) to validate
  candidate budgets behind remote configuration using `MemoryBudgetManager`,
  and optionally register `MemoryBudgetManager.OnOverBudgetListener`
  callbacks to discard non-essential caches when `onOverBudget` triggers.
  Don't apply release-tuned limits to unoptimized debug builds. After field
  validation, graduate proven `<memory-budget>` ceilings into your release
  `AndroidManifest.xml`:

  ```xml
  <application ...>
      <memory-budget android:maxMb="256" />
      <memory-budget android:state="background" android:maxMb="64" />
  </application>
  ```
- **Estimated effort** : *Moderate effort (M, 1 to 3 days)* to measure
  `memory.current` and working-set refaults across `foreground`, `perceptible`,
  and `background` process states, deploy candidate budgets in stages, and wire
  cache-trimming handlers in `MemoryBudgetManager.OnOverBudgetListener`.

- **How to get started** : Follow the guidance at [Set app memory
  budgets](https://developer.android.com/topic/performance/memory/app-memory-budgets) to sweep candidate budgets locally using `am
  memory-limiter manual` or `MemoryBudgetManager` and find the working-set knee
  (the lowest budget where reclaim removes only cold slack, so refaults, CPU
  time, and frame times stay where they were without a budget)
  across `foreground`, `perceptible`, and `background` flows. Deploy candidate
  budgets in stages behind remote configuration using `MemoryBudgetManager`. If
  you need to roll back, call `clearProcessBudget` or `clearPackageBudget`.
  Register a `MemoryBudgetManager.OnOverBudgetListener` through
  `registerProcessOverBudgetListener` to verify reclamation handling, and then
  declare proven steady-state `<memory-budget>` clauses in your release
  `AndroidManifest.xml`.

- **Key benefits**: Protects system-wide multitasking stability on
  memory-constrained 4 GB and premium devices, prevents runaway
  allocations in one process from evicting background processes such as the
  launcher or keyboard, and gives you deterministic, reproducible memory
  reclamation behavior across test and production environments.

### FCM ACv2 changes

<br />

<br />

Firebase Cloud Messaging (FCM) is updating its APIs for sending \& receiving
messages to version 2 (ACv2) with an update to improve Android push notification
delivery reliability.

Some key benefits for migrating and adopting are the following:

- **Minimize Notification Delivery Delay**: Ensure notifications are delivered to devices in a reliable \& predictable timeframe.
- **Simplify API Usage**: Provide a well-lit path that makes it easier for developers to do the right thing \& difficult to do the wrong thing.

Detailed developer documentation and migration guides for adapting application
server integrations and client SDK configurations to FCM ACv2 can be found at
<https://firebase.google.com/docs/cloud-messaging/send/v2-api>

### In-process xHE-AAC software encoder

<br />

<br />

Android 17 QPR1 introduced an [xHE-AAC audio encoder](https://developer.android.com/media/platform/xhe-aac-encoding.md.txt). Designed for
high-efficiency Rich Communication Services (RCS) voice messaging and
low-bitrate audio streaming, the xHE-AAC encoder delivers studio-grade speech
and audio compression at bitrates as low as 12--24 kbps.

Android 18 introduces an in-process sandboxed software xHE-AAC audio encoder
(`c2.android.inproc.xheaac.encoder`) within the MediaCodec Codec2 framework.
Running the software encoder in-process within an isolated sandbox eliminates
Binder IPC and hardware buffer copy overhead between the application process and
the `mediaswcodec` service, significantly reducing CPU consumption, memory
footprint, and encoding latency. See [Optimize audio performance using
in-process decoders](https://developer.android.com/media/platform/in-process-codecs) for more information about in process codecs.

- **What to do to adopt xHE-AAC encoding:** Configure your `MediaCodec` audio
  encoding pipeline to request the `audio/mp4a-latm` MIME type with
  `MediaFormat.KEY_AAC_PROFILE` set to
  `MediaCodecInfo.CodecProfileLevel.AACObjectXHE` (`42`):

  ```kotlin
  val format = MediaFormat.createAudioFormat(MediaFormat.MIMETYPE_AUDIO_AAC, 48000, 1).apply {
      setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectXHE)
      setInteger(MediaFormat.KEY_BIT_RATE, 16000)
  }
  ```
- **What to do to adopt xHE-AAC LFI encoding**: Explicitly requesting the inproc
  xhe-aac encoder

  ```kotlin
  MediaCodec.createByCodecName("c2.android.inproc.xheaac.encoder")
  ```
- **Estimated effort:** *Small effort (\< 1 day)* to update `MediaFormat` audio
  profile configuration and validate encoded stream bitrates.

- **How to get started:** Initialize the xhe-aac in process codec on an Android
  18 preview build and verify codec instantiation via
  `adb logcat -s CCodec:D MediaCodec:I`.

- **Key benefits:** Provides superior voice and audio quality at ultra-low
  bitrates (ideal for RCS voice messaging and constrained cellular networks)
  while reducing IPC overhead, battery drain, and encoding latency.