Support for custom root element in navtree. Check status_text for DAC.

An included book.yaml file must start with a 'toc:' root element. Passing
'-hdf book.root toc' to LOCAL_DROIDDOC_OPTIONS is now recognized by the
yaml_navtree template. Otherwise, default to the current 'reference:' element.

Test for 'dac' hdf var before displaying the toc_element's status_text. This
is used for DAC's CSS styling and will eventually migrate to the Devsite
templates. Requires '-hdf dac true' passed to DAC's LOCAL_DROIDDOC_OPTIONS.

Fix bug for yaml file name. If -yaml was declared before the -devsite option,
then the filename would get overwritten. This now checks if a filename has
already been declared before supplying a default.

Test: LOCAL_DROIDDOC_OPTIONS := \
Test:   -hdf book.root toc \
Test:   -yaml _toc.yaml \
Test:   -werror \
Test:   -package \
Test:   -devsite \
Change-Id: I4429ee0848842e9aa4ab5b2bad992b84c4ccd106
diff --git a/res/assets/templates-sdk/yaml_navtree.cs b/res/assets/templates-sdk/yaml_navtree.cs
index 25b3fa6..e2a7b4e 100644
--- a/res/assets/templates-sdk/yaml_navtree.cs
+++ b/res/assets/templates-sdk/yaml_navtree.cs
@@ -3,20 +3,28 @@
 # print out the yaml nav for the reference docs, only printing the title,
 path, and status_text (API level) for each package.
 
-?>
-reference:<?cs
+?><?cs
+if:book.root ?><?cs var:book.root ?>:<?cs
+else ?>reference:<?cs
+/if?><?cs
 if:docs.packages.link ?>
 - title: Class Index
-  path: /<?cs var:docs.classes.link ?>
-  status_text: no-toggle
-- title: Package Index
-  path: /<?cs var:docs.packages.link ?>
+  path: /<?cs var:docs.classes.link ?><?cs
+    if:dac ?>
   status_text: no-toggle<?cs
+    /if?>
+- title: Package Index
+  path: /<?cs var:docs.packages.link ?><?cs
+    if:dac ?>
+  status_text: no-toggle<?cs
+    /if?><?cs
 /if ?><?cs
 each:page = docs.pages?><?cs
   if:page.type == "package"?>
 - title: <?cs var:page.label ?>
-  path: /<?cs var:page.link ?>
+  path: /<?cs var:page.link ?><?cs
+    if:dac ?>
   status_text: apilevel-<?cs var:page.apilevel ?><?cs
+    /if?><?cs
   /if?><?cs
 /each ?>
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 39daf07..d5bbfb1 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -337,7 +337,9 @@
           DEVSITE_STATIC_ONLY = true;
           System.out.println("  ... Generating static html only for devsite");
         }
-        yamlNavFile = "_book.yaml";
+        if (yamlNavFile == null) {
+          yamlNavFile = "_book.yaml";
+        }
       }
     }
 
@@ -822,8 +824,6 @@
     return data;
   }
 
-
-
   public static Data makePackageHDF() {
     Data data = makeHDF();
     ClassInfo[] classes = Converter.rootClasses();