Status Update
Comments
il...@google.com <il...@google.com> #2
I was able to reproduce this and saw the following exception in logcat:
2020-10-21 16:30:41.496 2023-2045/? E/WindowManager: Unhandled exception while laying out windows
java.lang.RuntimeException: Unknown animation name: objectAnimator
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:194)
at android.view.animation.AnimationUtils.createAnimationFromXml(AnimationUtils.java:158)
at android.view.animation.AnimationUtils.loadAnimation(AnimationUtils.java:139)
at com.android.server.wm.AppTransition.loadAnimationSafely(AppTransition.java:632)
at com.android.server.wm.AppTransition.loadAnimationRes(AppTransition.java:623)
at com.android.server.wm.AppTransition.loadAnimation(AppTransition.java:1653)
at com.android.server.wm.AppWindowToken.loadAnimation(AppWindowToken.java:2665)
at com.android.server.wm.AppWindowToken.applyAnimationLocked(AppWindowToken.java:2573)
at com.android.server.wm.AppWindowToken.commitVisibility(AppWindowToken.java:624)
at com.android.server.wm.AppTransitionController.handleClosingApps(AppTransitionController.java:381)
at com.android.server.wm.AppTransitionController.handleAppTransitionReady(AppTransitionController.java:181)
at com.android.server.wm.RootWindowContainer.checkAppTransitionReady(RootWindowContainer.java:783)
at com.android.server.wm.RootWindowContainer.performSurfacePlacementNoTrace(RootWindowContainer.java:621)
at com.android.server.wm.RootWindowContainer.performSurfacePlacement(RootWindowContainer.java:567)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop(WindowSurfacePlacer.java:159)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement(WindowSurfacePlacer.java:105)
at com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement(WindowSurfacePlacer.java:95)
at com.android.server.wm.WindowSurfacePlacer.lambda$new$0$WindowSurfacePlacer(WindowSurfacePlacer.java:62)
at com.android.server.wm.-$$Lambda$WindowSurfacePlacer$4Hbamt-LFcbu8AoZBoOZN_LveKQ.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)
Indicating that the system's WindowManager that handles launching the activity is not able to handle the Animator resources now used for the default animations by NavigationUI
in Navigation 2.3.1.
As a workaround, you can manually check for whether the destination is an <activity>
destination and navigate()
to it without any custom Animators:
override fun onOptionsItemSelected(item: MenuItem): Boolean {
val navController = findNavController(R.id.nav_host_fragment)
if (navController.currentDestination?.parent?.findNode(item.itemId) is ActivityNavigator.Destination) {
navController.navigate(item.itemId)
return true
}
return item.onNavDestinationSelected(navController) ||
super.onOptionsItemSelected(item)
}
(note that you probably want to add android:menuCategory="secondary"
to your menu item for these types of cases when you are able to switch back to onNavDestinationSelected
to avoid popping back to the start destination as per the onNavDestinationSelected()
documentation
jb...@google.com <jb...@google.com> #3
This has been fixed internally and will be available as part of the Navigation 2.3.2
release.
ap...@google.com <ap...@google.com> #4
Branch: androidx-master-dev
commit 7ec8be5ebd967ca6fd6953d5235992ddfd7a1e97
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Nov 05 13:14:05 2020
Do not add animators to ActivityDestinations in Navigation UI
When using NavigationUI onNavDestinationSelected, if the menu item
corresponds to an ActivityDestination, the navigate call fails because
the WindowManager cannot handle the ObjectAnimatorResources that are the
default in Navigation.
Relnote: "Fixed a regression in NavigationUI where using an <activity>
destination with onNavDestinationSelected would fail to navigate to the
Activity."
Test: tested in sample app
Bug: 171364502
Change-Id: I22e34487faa43e2024a407047956c18b85923b52
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.java
M navigation/navigation-ui/src/main/java/androidx/navigation/ui/NavigationUI.java
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit e730e7d7a6ea63a15085d8c17781acdd2791a6f0
Author: Jeremy Woods <jbwoods@google.com>
Date: Mon Jan 11 16:10:44 2021
Allow anim resource values of 0 when navigating to an activity
When navigating to an Activity with extra NavOptions, if you set the
animation resource values to 0, the resources can not be found.
We should allow resource values to be set to 0 to prevent any Activity
animations.
RelNote: "Fixed regression caused by
activity with an animation resource value of 0 caused a
ResourceNotFoundException."
Test: tested in sample app from
Bug: 176819931
Change-Id: I7aedb282e3bd4534758035fe17bfcdb3287be604
M navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.java
Description
Component used: Navigation Version used: 2.3.1 Devices/Android versions reproduced on: Pixel 3XL Android 11
Cannot transition to Activity with onNavDestinationSelected from navigation 2.3.1. Seems to be frozen.
I made a sample project in question, so please check it.