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
diff --git a/api/current.txt b/api/current.txt
index b574160..d631ee2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4338,6 +4338,7 @@
     method public abstract android.support.v4.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
     method public abstract int getBackStackEntryCount();
     method public abstract android.support.v4.app.Fragment getFragment(android.os.Bundle, java.lang.String);
+    method public abstract android.support.v4.app.Fragment getPrimaryNavigationFragment();
     method public abstract boolean isDestroyed();
     method public abstract void popBackStack();
     method public abstract void popBackStack(java.lang.String, int);
@@ -4435,6 +4436,7 @@
     method public abstract android.support.v4.app.FragmentTransaction setBreadCrumbTitle(java.lang.CharSequence);
     method public abstract android.support.v4.app.FragmentTransaction setCustomAnimations(int, int);
     method public abstract android.support.v4.app.FragmentTransaction setCustomAnimations(int, int, int, int);
+    method public abstract android.support.v4.app.FragmentTransaction setPrimaryNavigationFragment(android.support.v4.app.Fragment);
     method public abstract android.support.v4.app.FragmentTransaction setTransition(int);
     method public abstract android.support.v4.app.FragmentTransaction setTransitionStyle(int);
     method public abstract android.support.v4.app.FragmentTransaction show(android.support.v4.app.Fragment);