update doclava for s.a.c redesign

Change-Id: I4788472ea2ba923070362624f75fe72bf5b43df7

Conflicts:
	src/com/google/doclava/ClearPage.java
diff --git a/src/com/google/doclava/ClearPage.java b/src/com/google/doclava/ClearPage.java
index 9c512c9..4a6d39a 100644
--- a/src/com/google/doclava/ClearPage.java
+++ b/src/com/google/doclava/ClearPage.java
@@ -28,6 +28,7 @@
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Arrays;
 
 public class ClearPage {
   /*
@@ -156,7 +157,7 @@
     }
   }
 
-  public static void copyFile(File from, String toPath) {
+  public static void copyFile(boolean allowExcepted, File from, String toPath) {
     File to = new File(outputDir + "/" + toPath);
     FileInputStream in;
     FileOutputStream out;
@@ -176,7 +177,7 @@
       System.err.println(from.getAbsolutePath() + ": Error opening file");
       return;
     }
-    if (!isValidContentType(toPath, DROIDDOC_VALID_CONTENT_TYPES)) {
+    if (!isValidContentType(allowExcepted, toPath, DROIDDOC_VALID_CONTENT_TYPES)) {
         Errors.error(Errors.INVALID_CONTENT_TYPE, null, "Failed to process " + from
                 + ": Invalid file type. Please move the file to frameworks/base/docs/image_sources/... or docs/downloads/...");
         return;
@@ -220,9 +221,15 @@
     }
   }
 
-  public static String[] DROIDDOC_VALID_CONTENT_TYPES = {".txt", ".css", ".js", ".html", ".ico", ".png", ".jpg", ".gif", ".svg", ".webm", ".ogv","mp4", ".java", ".xml", ".aidl", ".rs",".zip", ".yaml", ".pdf"};
+  public static ArrayList<String> DROIDDOC_VALID_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(".txt", ".css",
+    ".js", ".html", ".ico", ".png", ".jpg", ".gif", ".svg", ".webm", ".ogv","mp4", ".java", ".xml", ".aidl", ".rs",".zip", ".yaml"));
 
-  public static boolean isValidContentType(String s, String[] list) {
+  public static ArrayList<String> DROIDDOC_EXCEPTED_CONTENT_TYPES = new ArrayList<String>(Arrays.asList(".pdf"));
+
+  public static boolean isValidContentType(boolean allowExcepted, String s, ArrayList<String> list) {
+    if(allowExcepted){
+      list.addAll(DROIDDOC_EXCEPTED_CONTENT_TYPES);
+    }
     for (String t : list) {
       if (s.endsWith(t)) {
         return true;
diff --git a/src/com/google/doclava/DocFile.java b/src/com/google/doclava/DocFile.java
index da829a4..dd0a6bc 100644
--- a/src/com/google/doclava/DocFile.java
+++ b/src/com/google/doclava/DocFile.java
@@ -164,6 +164,14 @@
       } else if ((filename.indexOf("tools") == 0) || (filename.indexOf("sdk") == 0)) {
         hdf.setValue("tools", "true");
         fromTemplate = hdf.getValue("page.template", "");
+      } else if (filename.indexOf("devices") == 0) {
+        hdf.setValue("devices", "true");
+      } else if (filename.indexOf("source") == 0) {
+        hdf.setValue("source", "true");
+      } else if (filename.indexOf("accessories") == 0) {
+        hdf.setValue("accessories", "true");
+      } else if (filename.indexOf("compatibility") == 0) {
+        hdf.setValue("compatibility", "true");
       }
       if (fromTemplate.equals("sdk")) {
         ClearPage.write(hdf, "sdkpage.cs", outfile);
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java
index 4435018..a239210 100644
--- a/src/com/google/doclava/Doclava.java
+++ b/src/com/google/doclava/Doclava.java
@@ -90,6 +90,7 @@
 
   private static boolean gmsRef = false;
   private static boolean gcmRef = false;
+  private static boolean sac = false;
 
   public static boolean checkLevel(int level) {
     return (showLevel & level) == level;
@@ -735,8 +736,11 @@
         } else if (len > 3 && ".jd".equals(templ.substring(len - 3))) {
           String filename = templ.substring(0, len - 3) + htmlExtension;
           DocFile.writePage(f.getAbsolutePath(), relative, filename);
-        } else {
-          ClearPage.copyFile(f, templ);
+        } else if(!f.getName().equals(".DS_Store")){
+              Data data = makeHDF();
+              String hdfValue = data.getValue("sac") == null ? "" : data.getValue("sac");
+              boolean allowExcepted = hdfValue.equals("true") ? true : false;
+              ClearPage.copyFile(allowExcepted, f, templ);
         }
       } else if (f.isDirectory()) {
         writeDirectory(f, relative + f.getName() + "/", js);
diff --git a/src/com/google/doclava/SampleCode.java b/src/com/google/doclava/SampleCode.java
index 0776af1..65d44b5 100644
--- a/src/com/google/doclava/SampleCode.java
+++ b/src/com/google/doclava/SampleCode.java
@@ -84,13 +84,13 @@
 
         if (inList(out, IMAGES)) {
           // copied directly
-          ClearPage.copyFile(f, out);
+          ClearPage.copyFile(false, f, out);
           writeImagePage(f, convertExtension(out, Doclava.htmlExtension), subdir);
           files.add(name);
         }
         if (inList(out, TEMPLATED)) {
           // copied and goes through the template
-          ClearPage.copyFile(f, out);
+          ClearPage.copyFile(false, f, out);
           writePage(f, convertExtension(out, Doclava.htmlExtension), subdir);
           files.add(name);
         }