Skip to content

fix: check trim memory level in onTrimMemory() implementations - #1051

Merged
dkhawk merged 2 commits into
mainfrom
fix/check-trim-memory-level
Oct 23, 2026
Merged

dkhawk merged 2 commits into
mainfrom
fix/check-trim-memory-level

Conversation

@dkhawk

@dkhawk dkhawk commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

This change adds a level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN check to onTrimMemory() implementations in GoogleMap and StreetView to avoid unexpectedly trimming needed resources when TRIM_MEMORY_RUNNING_* is sent.

Currently only TRIM_MEMORY_UI_HIDDEN (20) and TRIM_MEMORY_BACKGROUND (40) are sent, but TRIM_MEMORY_RUNNING_CRITICAL (15) and TRIM_MEMORY_RUNNING_LOW (10) are being undeprecated.

Verification

  • ./gradlew :maps-compose:testDebugUnitTest
  • ./gradlew spotlessCheck
  • ./gradlew :maps-compose:lintDebug

Add a level >= TRIM_MEMORY_UI_HIDDEN check in GoogleMap and StreetView onTrimMemory() implementations to avoid unexpectedly trimming needed resources when TRIM_MEMORY_RUNNING_* levels are sent.
@dkhawk
dkhawk marked this pull request as ready for review October 22, 2026 23:14
@dkhawk
dkhawk requested a review from kikoso October 22, 2026 23:14
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 366fe16 on main (#1052).

Module Line % Change Branch % Change
maps-compose 15.28% 🔺 +0.37 3.76% 🔺 +0.21
maps-compose-utils 6.09% no change 4.47% no change
maps-compose-widgets 0.00% no change 0.00% no change
TOTAL 12.41% 🔺 +0.27 3.79% 🔺 +0.16

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 44.85% -0.04% 🍏
Files changed 52.63% ❌

Module Coverage
maps-app 63.91% -0.11% ❌
Files
Module File Coverage
maps-app StreetView.kt 88.39% -0.84% ❌
GoogleMap.kt 79.99% -0.65% ❌

@kikoso kikoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants