Add disabled and loggingonly support to compat changes docs am: cb64f29fb4 am: 4287294690

Change-Id: I6fd1464944eaa8c01d44be45e8d25b3e7bffea25
diff --git a/res/assets/templates-sdk/compatchanges.cs b/res/assets/templates-sdk/compatchanges.cs
index bcb0def..001b937 100644
--- a/res/assets/templates-sdk/compatchanges.cs
+++ b/res/assets/templates-sdk/compatchanges.cs
@@ -16,13 +16,22 @@
 <?cs each:change=change ?>
   <h3 class="api-name" id="<?cs var:change.name ?>"><?cs var:change.name ?></h3>
   <div>Value: <?cs var:change.id ?></div>
-  <!-- TODO: This will do the wrong thing for disabled changes; need to plumb through the
-       disabled flag -->
-  <div>Enabled for <?cs if:change.enableAfterTargetSdk ?>
-      apps with a <code>targetSdkVersion</code> of greater than <?cs var:change.enableAfterTargetSdk ?>.
-    <?cs else ?>
-      all apps.
-    <?cs /if ?>
+  <div>
+  <?cs if:change.loggingOnly ?>
+        Used for logging only.
+  <?cs else ?>
+        <?cs if:change.disabled ?>
+            Disabled for all apps.
+        <?cs else ?>
+            Enabled for
+            <?cs if:change.enableAfterTargetSdk ?>
+                apps with a <code>targetSdkVersion</code> of greater than
+                <?cs var:change.enableAfterTargetSdk ?>.
+            <?cs else ?>
+                all apps.
+            <?cs /if ?>
+        <?cs /if ?>
+  <?cs /if ?>
   </div>
 
   <?cs call:description(change) ?>
diff --git a/src/com/google/doclava/CompatInfo.java b/src/com/google/doclava/CompatInfo.java
index 5747d93..167f6ab 100644
--- a/src/com/google/doclava/CompatInfo.java
+++ b/src/com/google/doclava/CompatInfo.java
@@ -42,16 +42,22 @@
     public final String definedInClass;
     public final String sourceFile;
     public final int sourceLine;
+    public final boolean disabled;
+    public final boolean loggingOnly;
     public final int enableAfterTargetSdk;
 
+
     CompatChange(String name, long id, String description, String definedInClass,
-        String sourceFile, int sourceLine, int enableAfterTargetSdk) {
+            String sourceFile, int sourceLine, boolean disabled, boolean loggingOnly,
+            int enableAfterTargetSdk) {
       this.name = name;
       this.id = id;
       this.description = description;
       this.definedInClass = definedInClass;
       this.sourceFile = sourceFile;
       this.sourceLine = sourceLine;
+      this.disabled = disabled;
+      this.loggingOnly = loggingOnly;
       this.enableAfterTargetSdk = enableAfterTargetSdk;
     }
 
@@ -62,12 +68,14 @@
       private String mDefinedInClass;
       private String mSourceFile;
       private int mSourceLine;
+      private boolean mDisabled;
+      private boolean mLoggingOnly;
       private int mEnableAfterTargetSdk;
 
       CompatChange build() {
         return new CompatChange(
             mName, mId, mDescription, mDefinedInClass, mSourceFile, mSourceLine,
-            mEnableAfterTargetSdk);
+                mDisabled, mLoggingOnly, mEnableAfterTargetSdk);
       }
 
       Builder name(String name) {
@@ -106,6 +114,24 @@
         return this;
       }
 
+      boolean parseBool(String value) {
+        if (value == null) {
+          return false;
+        }
+        boolean result = Boolean.parseBoolean(value);
+        return result;
+      }
+
+      Builder disabled(String disabled) {
+        mDisabled = parseBool(disabled);
+        return this;
+      }
+
+      Builder loggingOnly(String loggingOnly) {
+        mLoggingOnly = parseBool(loggingOnly);
+        return this;
+      }
+
       Builder enableAfterTargetSdk(String enableAfter) throws SAXException {
         if (enableAfter == null) {
           mEnableAfterTargetSdk = 0;
@@ -138,8 +164,10 @@
           throw new SAXException("<compat-change> id is not a valid long", nfe);
         }
         mCurrentChange.name(attributes.getValue("name"))
-            .description(attributes.getValue("description"))
-            .enableAfterTargetSdk(attributes.getValue("enableAfterTargetSdk"));
+                .description(attributes.getValue("description"))
+                .enableAfterTargetSdk(attributes.getValue("enableAfterTargetSdk"))
+                .disabled(attributes.getValue("disabled"))
+                .loggingOnly(attributes.getValue("loggingOnly"));
 
       } else if (qName.equals("meta-data")) {
         if (mCurrentChange == null) {
@@ -215,6 +243,12 @@
         hdf.setValue(path + ".enableAfterTargetSdk",
             Integer.toString(change.enableAfterTargetSdk));
       }
+      if (change.loggingOnly) {
+        hdf.setValue(path + ".loggingOnly", Boolean.toString(true));
+      }
+      if (change.disabled) {
+        hdf.setValue(path + ".disabled", Boolean.toString(true));
+      }
       TagInfo.makeHDF(hdf, path + ".descr", comment.tags());
     }
   }