SIGN IN SIGN UP

perf(android): Avoid exception-driven control flow in getResourceId (#5631)

* perf(android): Avoid exception-driven control flow in getResourceId

ViewUtils.getResourceId threw Resources.NotFoundException for views with
no id or a generated id, and callers caught and discarded it. During a
view-hierarchy snapshot and on every gesture this ran per view, so in
Compose-heavy apps where most views have generated ids the SDK
constructed an exception (and a native stack trace fill) per view on the
main thread.

Add a non-throwing resolveResourceId that returns null for unresolved
ids and route the hot callers through it. The public getResourceId
remains as a throwing wrapper for backward compatibility. Behavior
(emitted identifiers and fallbacks) is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* changelog

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
N
Nelson Osacky committed
e279b061f72b2bbcf3b1b3c178024933e0031f60
Parent: 8fe8bad
Committed by GitHub <noreply@github.com> on 6/30/2026, 9:45:14 AM