I have created a small sample app to test out the android navigation library. The general idea is that I want two tabs with their own navigation graph.
My main activity layout contains a BottomNavigationView with two NavHosts.
The ButtonNavigationView click listener takes care of showing one NavHost or the other and also calling  NavigationUI.setupActionBarWithNavController with the selected controller to update the toolbar accordingly. Up navigation is working fine.
The problem I am facing right now is the back button.
There is a property app:defaultNavHost="true" which ensures that your NavHostFragment intercepts the system back button, but I want that to be on/off depending on the active graph. I couldn't find a way to change it :(
I know I can override onBackPressed() but I am trying to find a way for the library to do that work for me letting it know which graph is active.