Product News

Android 17 QPR2 is live in AOSP

12 min read
View Daniel Galpin's profile
Daniel Galpin Developer Advocate

We pushed Android 17 QPR2 (SDK 37.2) to the Android Open Source Project (AOSP) as part of our ongoing commitment to open source. Transparent access to platform code empowers developers, device makers, and the broader Android community to inspect how the OS works, debug edge cases with confidence, and build innovative experiences across an open ecosystem.

Building on Android 17 and QPR1 (SDK 37.1), QPR2 delivers targeted platform APIs and runtime improvements for Android phones, foldables, and tablets. While QPR2 introduces no target-SDK behavior changes, it does ship a few runtime updates that apply to all apps (self-broadcast delivery, call-forwarding USSD requests, and Quick Settings brightness overrides) that are worth verifying. This guide walks through the updates across QPR1 and QPR2 that impact the widest set of Android apps: proactive memory budgeting and process-exit diagnostics, display jank and media pipeline improvements, a redesigned Picture-in-Picture experience, and privacy and security hardening to help you prepare for future Android releases.

Performance, Memory & System Health

App Memory Budgets (MemoryBudgetManager)

In Android 17 QPR2 (SDK 37.2), App Memory Budgets let your app declare soft working-set targets for its package or individual processes. Exceeding a memory budget does not terminate your process; instead, the OS targets cold-page reclaim specifically toward your app—evicting clean file-backed pages, writing dirty pages back to disk, and swapping inactive anonymous heap pages to zRAM—so your app’s working set can stay in memory, while helping protect system stability.

<!-- AndroidManifest.xml (release builds only) -->
<application>
    <!-- Foreground baseline + density scaling (pick one scaling attribute per clause) -->
    <memory-budget
        android:maxMb="180"
        android:state="foreground"
        android:additionalMbPerDensity="16" />
    <memory-budget
        android:maxMb="120"
        android:state="perceptible" />
    <memory-budget
        android:maxMb="48"
        android:state="background" />
</application>

Use MemoryBudgetManager at runtime to register a background pressure listener and inspect or tighten budgets:

import android.app.MemoryBudgetManager
import android.os.Build
import android.os.HandlerThread

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA &&
    Build.VERSION.SDK_INT_FULL >= Build.VERSION_CODES_FULL.CINNAMON_BUN_2
) {
    val memoryBudgetManager = context.getSystemService(MemoryBudgetManager::class.java)

    // Register on a background HandlerThread Looper before tightening a dynamic budget
    val cleanupThread = HandlerThread("MemoryBudgetCleanup").apply { start() }
    val listener = MemoryBudgetManager.OnOverBudgetListener { budgetCeilingBytes ->
        // Callback receives the exceeded budget ceiling in bytes—keep cleanup lock-free and fast
        trimInMemoryCaches(budgetCeilingBytes)
    }
    memoryBudgetManager.registerProcessOverBudgetListener(cleanupThread.looper, listener)

    // Query live usage and effective ceiling, then optionally tighten the current process budget
    val usageBytes = memoryBudgetManager.processCurrentUsageBytes
    val ceilingBytes = memoryBudgetManager.processBudgetBytes
    
    try {
        memoryBudgetManager.setProcessBudgetBytes(96L * 1024L * 1024L)
    } catch (e: IllegalArgumentException) {
        // will throw if a tighter manifest or system limit applies
    }

    // Unregister the listener and call cleanupThread.quitSafely() during teardown
}

Process Termination & Memory Limiter Diagnostics

While <memory-budget> manages soft working-set reclaim, Android 17 also enforces higher device-wide app memory limits (Memory Limiter) to terminate processes with runaway leaks. QPR2 (SDK 37.2) expands ApplicationExitInfo with dedicated exit reasons alongside Android 17's structured ANR metadata:

import android.app.ActivityManager
import android.app.ApplicationExitInfo
import android.content.Context
import android.os.Build


val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val exitReasons = activityManager.getHistoricalProcessExitReasons(null, 0, 10)


for (exitInfo in exitReasons) {
    when (exitInfo.reason) {
        ApplicationExitInfo.REASON_MEMORY_LIMITER -> {
            // QPR2 (SDK 37.2)+: terminated by system Memory Limiter
            reportMemoryLimiterKill(exitInfo.rss, exitInfo.timestamp)
        }
        ApplicationExitInfo.REASON_OTHER -> {
            // Fallback for Android 17.0 (37.0) and QPR1 (37.1): check getDescription()
            if (exitInfo.description?.contains("MemoryLimiter:AnonSwap") == true) {
                reportMemoryLimiterKill(exitInfo.rss, exitInfo.timestamp)
            }
        }
        ApplicationExitInfo.REASON_ANOMALY -> {
            // QPR2 (SDK 37.2)+: terminated due to a system resource anomaly (e.g., FD leak)
            reportResourceAnomalyKill(exitInfo.description, exitInfo.timestamp)
        }
        ApplicationExitInfo.REASON_ANR -> {
            // Android 17.0 (API 37)+: inspect structured ANR metadata
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CINNAMON_BUN) {
                exitInfo.anrInfo?.let { anr ->
                    reportStructuredAnr(
                        anrId = anr.anrId,
                        anrType = anr.anrType,
                        timeoutMillis = anr.timeoutMillis,
                        userPerceptible = anr.isUserPerceptible
                    )
                }
            }
        }
    }
}

Display Jank & Startup Telemetry

In QPR2 (SDK 37.2), SurfaceView and SurfaceControl now expose registerOnJankDataListener() so games, camera viewfinders, and custom renderers can see exactly when their frames appeared on-screen. Jank data is emitted when a desired presentation time is set, or when a specific VsyncId is set (such as by SurfaceControl.Transaction.setFrameTimeline). For example:

import android.os.Build
import android.view.SurfaceControl
import android.view.SurfaceView


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA &&
    Build.VERSION.SDK_INT_FULL >= Build.VERSION_CODES_FULL.CINNAMON_BUN_2
) {
    val surfaceView = findViewById<SurfaceView>(R.id.surface_view)
    val jankRegistration = surfaceView.registerOnJankDataListener(context.mainExecutor) { jankDataList ->
        for (jankData in jankDataList) {
            val desiredTime = jankData.desiredPresentTimeNanos
            val actualTime = jankData.presentTimeNanos


            if (actualTime > SurfaceControl.JankData.PRESENTATION_TIME_UNSET &&
                desiredTime > SurfaceControl.JankData.PRESENTATION_TIME_UNSET &&
                jankData.jankType != SurfaceControl.JankData.JANK_NONE
            ) {
                logRenderJank(jankData.jankType, actualTime - desiredTime)
            }
        }
    }
}

For activity triggered startups (ApplicationStartInfo.getStartComponent() equals to ApplicationStartInfo#START_COMPONENT_ACTIVITY), QPR2 also adds ApplicationStartInfo.START_TIMESTAMP_SOURCE_EVENT: the time (in SystemClock.uptimeNanos()) of the initial source event which triggered the start, such as the users click on the app icon in launcher.

Optimized Delivery of Self-Broadcasts

Starting in Android 17 QPR2, Android optimizes self-broadcasts—broadcasts (such as sendBroadcast()) where every matching receiver runs in the same process that sent the broadcast—for all apps, regardless of targetSdkVersion. The system hands self-broadcasts back to the sending process for delivery without raising process importance or preventing a cached process from being frozen, and undelivered self-broadcasts are lost if the process is killed.

  • Avoid using self-broadcasts as background timers or keep-alive mechanisms. Use WorkManager for persistent background work, AlarmManager for exact timing, and direct callbacks or Kotlin flows for in-process communication.

See the documentation for more detail on this.

Preventing circular lock inversion deadlocks

QPR2 also helps prevent circular lock-inversion deadlocks in RemoteCallbackList by dispatching broadcast() and unfreeze-queued callbacks outside its per-interface monitor lock.

Strict Occlusion Mode (QPR2)

Determine whether your app is completely occluded so that you can avoid costly screen updates using TrustedPresentationThresholds.SIGNAL_MODE_STRICT_OCCLUSION with WindowManager.registerTrustedPresentationListener().

Picture-in-Picture, UI & Media Pipelines

Picture-in-Picture: Primary Action & Always-On Overlay Actions

Android 17 QPR2 (SDK 37.2) modernizes Picture-in-Picture (PiP) on phones, foldables, and tablets with two high-impact additions to PictureInPictureParams.Builder:

import android.app.PictureInPictureParams
import android.app.RemoteAction
import android.graphics.drawable.Icon
import android.os.Build


val primaryAction = RemoteAction(
    Icon.createWithResource(context, R.drawable.ic_pause),
    "Pause",
    "Pause playback",
    pausePendingIntent
)


val pipBuilder = PictureInPictureParams.Builder()


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA &&
    Build.VERSION.SDK_INT_FULL >= Build.VERSION_CODES_FULL.CINNAMON_BUN_2
) {
    // 1. Designate a prominent primary action in the redesigned PiP menu
    pipBuilder.setActions(listOf(prevAction, primaryAction, nextAction), primaryAction)


    // 2. Optionally display persistent overlay controls (e.g., CTA and Skip) without a tap
    if (maxNumPictureInPictureOverlayActions > 0) {
        pipBuilder.setOverlayActions(listOf(ctaAction, skipAction), ctaAction)
    }
} else {
    pipBuilder.setActions(listOf(prevAction, primaryAction, nextAction))
}


setPictureInPictureParams(pipBuilder.build())

Support for new drawing effects

Android 17 QPR2 (API level 37.2) introduces new APIs to implement backdrop blurring and other effects, such as frosted glass. With setBackdropRenderEffect(), a RenderNode can now automatically sample and blur whatever content sits underneath it, making it straightforward to add these effects to your app UI.

At the Android Dev Summit, we showed how you can chain blur, saturation, and shaders in Jetpack Compose to turn a "Jump to bottom" chat button into a magnifying glass, a kaleidoscope, or a morphing Android mascot.

New Compose Graphics Features Video Thumbnail.png

Since media apps usually render video using a SurfaceView, Android 17 QPR2 introduces SurfaceView.setBlurRegions(). This allows you to do things like blur areas behind video player controls when they show and hide.

Blur regions demo in compose.png

Several graphics, media, and UI improvements take effect automatically or require only a single API call:

  • Remote SurfaceView for Camera Previews (QPR1): Standard Camera2 sessions targeting a SurfaceView transparently route preview buffers directly from the camera producer to the display compositor on realtime threads—reducing preview latency with zero code changes.
  • In-Process Memory-Safe Audio Decoders (QPR2): New in-process Rust decoders for FLAC and MP3 can improve decode latency. Discover them via MediaCodecInfo.SECURITY_MODEL_MEMORY_SAFE or MediaFormat.KEY_SECURITY_MODEL.
  • Asynchronous Floating ActionMode Text Selection (QPR2): Custom text editors and browsers can offload TextClassifier work to System UI via ActionMode.setTextSelection(). Text selection and right-click menus across Views, Compose, and browsers also surface a new "Look Up" action when an app handling Intent.ACTION_LOOK_UP_TEXT is installed.
  • Custom Window Dim Colors: Tint dialog and bottom-sheet scrims via android:backgroundDimColor or Window.setDimColor(Color.pack(colorInt)) (QPR2)
  • Region subtags in font fallbacks: In QPR1+, font fallback now takes region subtags into account, so users with non-CJK locales in East Asian regions (such as English (Japan) / en-JP or English (Taiwan) / en-TW) see accurate regional Han glyphs.

Privacy, Security & Connected Peripherals

Prepare for Restricted Implicit URI Grants

Today, when an app launches Intent.ACTION_SEND or ACTION_SEND_MULTIPLE with content URIs in EXTRA_STREAM, the system implicitly grants the target app read access to them. For MediaStore.ACTION_IMAGE_CAPTURE and related capture actions, it grants read and write access to the URI in MediaStore.EXTRA_OUTPUT. In future Android releases the plan is to stop granting these permissions automatically.

Use Android 17's StrictMode.VmPolicy.Builder.detectImplicitUriPermissionGrant() in debug builds now, or the MissingExplicitUriGrant lint check, to find intents that rely on the implicit grant. Then add Intent.FLAG_GRANT_READ_URI_PERMISSION explicitly (plus FLAG_GRANT_WRITE_URI_PERMISSION for capture intents). If your app receives these intents, check whether the sender granted access, and degrade gracefully if it didn't.

import android.content.Intent
import android.os.Build
import android.os.StrictMode
// Detect implicit URI permission grants in debug builds ahead of future Android releases
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CINNAMON_BUN) {
    val policy = StrictMode.VmPolicy.Builder()
        .detectImplicitUriPermissionGrant()
        .penaltyLog()
        .build()
    StrictMode.setVmPolicy(policy)
}
// Grant URI permissions explicitly on outgoing share intents
// (capture intents also need FLAG_GRANT_WRITE_URI_PERMISSION)
val shareIntent = Intent(Intent.ACTION_SEND).apply {
    type = "image/png"
    putExtra(Intent.EXTRA_STREAM, documentUri)
    addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
// On the receiving side, check that the sender granted read access
val granted = (intent.flags and Intent.FLAG_GRANT_READ_URI_PERMISSION) ==
    Intent.FLAG_GRANT_READ_URI_PERMISSION

Photo Picker Location Metadata Toggle

Starting in QPR1, when an app requests location access with MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS, users selecting photos through MediaStore.ACTION_PICK_IMAGES see a system toggle to strip or include geographic EXIF location metadata (with broader ACTION_GET_CONTENT coverage planned for future releases). Previously, location metadata was never included with photo picker URIs. Ensure your EXIF parsing handles both included and missing GPS coordinates gracefully, without interrupting uploads or app workflows:

import android.content.Intent
import android.media.ExifInterface
import android.net.Uri
import android.provider.MediaStore

// 1. Request location metadata when launching the Photo Picker
val pickIntent = Intent(MediaStore.ACTION_PICK_IMAGES).apply {
    putExtra(MediaStore.EXTRA_REQUEST_LOCATION_METADATA_ACCESS, true)
}

// 2. Read optional GPS coordinates from the returned URI
fun extractOptionalLocation(selectedUri: Uri): Pair<Float, Float>? {
    context.contentResolver.openInputStream(selectedUri)?.use { stream ->
        val exif = ExifInterface(stream)
        val latLong = FloatArray(2)
        if (exif.getLatLong(latLong)) {
            return latLong[0] to latLong[1]
        }
    }
    return null // Proceed gracefully when the user strips location metadata
}

Additional Security, Storage & Peripheral Updates

Consumer Features at a Glance

Alongside the developer APIs above, Android 17 QPR1 and QPR2 bring user-visible platform updates across phones, foldables, and tablets that shape how people interact with your apps:

User-Facing FeatureReleaseWhat Users SeeDeveloper Action
Always-On PiP OverlaysQPR2Redesigned PiP menu and persistent action buttons over video.Adopt setActions(list, primaryAction) and setOverlayActions().
Foldable App Handle & Bubble-to-FullscreenQPR2Top-of-window handle on foldables to enter split screen or reposition bubbles, plus a "Move to fullscreen" shortcut on phone bubbles.Test multi-window resizability and Bubbles-to-fullscreen transitions.
Quick Settings Brightness OverrideQPR2Unlocked Quick Settings brightness slider even when the top app sets a custom window brightness (such as for QR codes or boarding passes).Avoid assuming LayoutParams.screenBrightness locks display brightness while visible; normal brightness resumes on exit.
"Look Up" Text Context ActionQPR2New "Look Up" action in text selection and right-click menus across Views, Compose, and browsers.Handle or launch Intent.ACTION_LOOK_UP_TEXT where relevant.
Persistent USB GrantsQPR1Redesigned USB dialog with "Always allow" and "Only this time" options. Manage or revoke access in Settings → Connected devices → USB. Unused grants auto-expire (30 days with a serial number, 7 days without).No changes required—UsbManager.requestPermission() succeeds without prompting when already granted. Check hasPermission() on connect to open immediately instead of caching permission state.
Custom Window Dim ColorsQPR2Brand-tinted scrims behind dialogs and bottom sheets.Set android:backgroundDimColor or call Window.setDimColor(Color.pack(colorInt)).
Regional CJK Font FallbackQPR1Localized Han glyph variants for regional scripts (such as en-JP and en-TW).Supply regional language tags via LocaleList.forLanguageTags(...) on text views.

Beyond app-facing APIs, Android 17 QPR2 also rolls out several system-wide quality-of-life, connectivity, and accessibility upgrades:

  • Expanded Color Theming & Adaptive Wallpapers: A custom rainbow hue slider and four color intensity styles (Neutral, Soft, Bright, and Bold) under Wallpaper & style → Colors, plus platform support for wallpapers that switch automatically between light and dark themes.
  • Status Bar Controls & Print Live Updates: A new Settings → Notifications → Status bar page to filter notification icons (All, Priority only, or None) and toggle battery percentage, mute, and vibrate indicators—alongside real-time Live Updates and status bar chips for active print jobs, improved monochrome AOD Live Update icon detection, and a more discoverable All apps peek in the system Share sheet.
  • Auracast Voice Broadcast & Smooth Bluetooth Volume: Preview Voice broadcast from the phone or wired headset mic over Bluetooth LE Audio Auracast (with optional password-protected private channels), QR/NFC tap-to-join for public streams with on-device Live Caption and Translation, and smooth Absolute Volume ramping that helps prevent sudden Bluetooth volume spikes when switching audio streams.
  • Linux Terminal Guest-to-Host File Sharing: The running Linux VM's home directory now mounts directly inside Android's system file viewer (DocumentsUI) under Linux VM for browsing, editing, and searching files from Android, paired with configurable host-or-VM web link handling.
  • Accessibility & Input Controls: Quick lock-screen and notification-shade controls for paired hearing devices, an updated color-correction preview and filter in Accessibility settings, and a keyboard vibration intensity slider..

Android 17 QPR2 Availability

Android 17 QPR2 (SDK 37.2) is available today on supported Google Pixel devices—including the Pixel 6a through Pixel 11 series, Pixel Fold, and Pixel Tablet or by using 64-bit Android Emulator system images (including phone, foldable, tablet, resizable, and 16 KB page-size images) in Android Studio.

Configure Minor SDK 37.2 and Guard Runtime Calls

Update compileSdk in your module's build.gradle.kts to minor API level 2 while keeping targetSdk = 37. When checking Build.VERSION.SDK_INT_FULL at runtime, always check Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA first so apps with minSdk < 36 do not throw NoSuchFieldError on Android 15 (API 35) or lower:

// build.gradle.kts
android {
    compileSdk {
        version = release(37) {
            minorApiLevel = 2
        }
    }


    defaultConfig {
        targetSdk = 37
    }
}

Guard QPR1 and QPR2 API calls at runtime with SDK_INT and SDK_INT_FULL:

import android.os.Build


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
    if (Build.VERSION.SDK_INT_FULL >= Build.VERSION_CODES_FULL.CINNAMON_BUN_2) {
        // Safe to call Android 17 QPR2 (SDK 37.2) APIs
    } else if (Build.VERSION.SDK_INT_FULL >= Build.VERSION_CODES_FULL.CINNAMON_BUN_1) {
        // Safe to call Android 17 QPR1 (SDK 37.1) APIs
    }
}

For full build details, API changes, and issue tracking, see the Android 17 QPR2 release notes, the API 37.2 diff report, the App Memory Budgets guide, and report feedback through the Android Issue Tracker.

Written by:
Continue reading