From 54aaa42d865d6ace29d500f4d6d107dfdbd2f3f5 Mon Sep 17 00:00:00 2001 From: Julian Winkler Date: Sat, 11 Jan 2025 17:50:21 +0100 Subject: [PATCH] ViewGroup: prevent NotFoundException caused by log message --- src/api-impl/android/content/res/AssetManager.java | 2 +- src/api-impl/android/view/ViewGroup.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api-impl/android/content/res/AssetManager.java b/src/api-impl/android/content/res/AssetManager.java index bde3f320..18dea18b 100644 --- a/src/api-impl/android/content/res/AssetManager.java +++ b/src/api-impl/android/content/res/AssetManager.java @@ -685,7 +685,7 @@ public final class AssetManager { */ /*package*/ native final int getResourceIdentifier(String name, String type, String defPackage); - /*package*/ /*native*/ final String getResourceName(int resid) { + public /*native*/ final String getResourceName(int resid) { String name = getResourcePackageName(resid); String type = getResourceTypeName(resid); if (type != null) diff --git a/src/api-impl/android/view/ViewGroup.java b/src/api-impl/android/view/ViewGroup.java index 74b0fa46..ac7eff68 100644 --- a/src/api-impl/android/view/ViewGroup.java +++ b/src/api-impl/android/view/ViewGroup.java @@ -359,7 +359,7 @@ public class ViewGroup extends View implements ViewParent, ViewManager { public void setClipToPadding(boolean clipToPadding) {} public View findViewById(int id) { - Slog.v(TAG, "findViewById: looking for id: " + String.format("%x", id) + "(" + getResources().getResourceName(id) + ")" + " | checking: " + this + ",id: " + String.format("%x", this.getId()) + ", id_str: " + this.getIdName()); + Slog.v(TAG, "findViewById: looking for id: " + String.format("%x", id) + "(" + getResources().getAssets().getResourceName(id) + ")" + " | checking: " + this + ",id: " + String.format("%x", this.getId()) + ", id_str: " + this.getIdName()); if (this.id == id) { Slog.v(TAG, "findViewById: found: "+this+" | id: " + String.format("%x", this.getId()) + ", id_str: " + this.getIdName()); return this;