Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
Navigation doesn't actually log any error messages - this seems to be an internal error message posted by the Android framework whenever you call getDisplayName().
We can add a workaround to try to filter out obviously invalid IDs before calling getDisplayName().
We can add a workaround to try to filter out obviously invalid IDs before calling getDisplayName().
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 76051ec2f5cd70d5279bbac708e5696e0be647d4
Author: Ian Lake <ilake@google.com>
Date: Mon Aug 12 15:49:48 2019
Avoid calling getResourceName() on invalid IDs
aapt generated resource IDs have a specific
namespace (the high byte is nonzero as per
ViewCompat.generateViewId()), so we can avoid
passing in invalid IDs to getResourceName().
This helps fix spurious logging done by the
framework which prints out "Invalid ID 0x00000000".
Test: ran existing tests, ensured that new code is called
Fixes: 139213740
Change-Id: Idfdb6179c035d9ec6f162fbd131eb740303ab2f5
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.java
https://android-review.googlesource.com/1100561
https://goto.google.com/android-sha1/76051ec2f5cd70d5279bbac708e5696e0be647d4
Branch: androidx-master-dev
commit 76051ec2f5cd70d5279bbac708e5696e0be647d4
Author: Ian Lake <ilake@google.com>
Date: Mon Aug 12 15:49:48 2019
Avoid calling getResourceName() on invalid IDs
aapt generated resource IDs have a specific
namespace (the high byte is nonzero as per
ViewCompat.generateViewId()), so we can avoid
passing in invalid IDs to getResourceName().
This helps fix spurious logging done by the
framework which prints out "Invalid ID 0x00000000".
Test: ran existing tests, ensured that new code is called
Fixes: 139213740
Change-Id: Idfdb6179c035d9ec6f162fbd131eb740303ab2f5
M navigation/navigation-common/src/main/java/androidx/navigation/NavDestination.java
cc...@google.com <cc...@google.com> #4
il...@google.com <il...@google.com> #5
We benchmark the typical case, which would indeed use a 0 ID for the root navigation graph. Since we're avoiding the getResourceName() call in that specific case, a speed up would be expected (although that magnitude of speed up is higher than I would have thought).
cc...@google.com <cc...@google.com> #6
Thanks, triaged as expected optimization.
Description
Version used: I can reproduce it in a different versions.
Devices/Android versions reproduced on: Pixel XL
This error is logged in NavDestination.onInflate() when NavHostFragment inflates nav graph. The call stack is:
NavHostFragment.onCreate()
NavController.setGraph()
NavInflater.inflate(int graphResId)
NavInflater.inflate(Resources res, XmlResourceParser parser, AttributeSet attrs, int graphResId)
NavDestination.onInflate()
In NavDestination.onInflate(), if <navigation> doesn’t have an id, we will set mId to 0. Then we pass mId to getDisplayName(). Because mId is 0 now, it will throw a Resources.NotFoundException and log error “Invalid ID 0x00000000”.