Primary navigation fragments

Add API to track the "primary navigation fragment" for a
FragmentManager. This allows designating one active fragment in a
FragmentManager as the intended nested recipient of navigation actions
such as popping the back stack.

The FragmentManager popBackStack methods will now delegate to the
child FragmentManager of the current primary navigation fragment first
before trying to pop its own back stack. This can only happen if a
back stack transaction id or back stack entry name is not provided to
the pop operation, as these names and ids are namespaced to each
individual FragmentManager.

Primary navigation fragments are set as part of a FragmentTransaction
and follow the associated expectations. Transactions added to the back
stack will be fully reversed when popped, restoring the previous
primary navigation fragment for the FragmentManager. If a primary
navigation fragment is removed from the FragmentManager, the primary
navigation fragment will be set to null.

Bug: 30596279
Test: ../gradlew connectedCheck in fragment/

Change-Id: I82cd22cda6e9ee22fe293c36859e99f49d36a129
7 files changed