Snap for 9512875 from b3269255adcd5e68b4de96e0f1f202107afc7796 to androidx-arch-core-release

Change-Id: I9eb04178730301feab73e5e6a826fd7630a1d0f6
diff --git a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
index 2711a2d..3892160 100644
--- a/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
+++ b/core/src/main/kotlin/Formats/JavaLayoutHtml/JavaLayoutHtmlFormatOutputBuilder.kt
@@ -857,19 +857,31 @@
 
     protected open fun FlowContent.apiAndDeprecatedVersions(node: DocumentationNode) {
         val apiLevelExists = node.apiLevel.name.isNotEmpty()
+        val sdkExtSinceExists = node.sdkExtSince.name.isNotEmpty()
         val deprecatedLevelExists = node.deprecatedLevel.name.isNotEmpty()
-        if (apiLevelExists || deprecatedLevelExists) {
+        if (apiLevelExists || sdkExtSinceExists || deprecatedLevelExists) {
             div(classes = "api-level") {
                 if (apiLevelExists) {
                     +"Added in "
                     a(href = "https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels") {
                         +"API level ${node.apiLevel.name}"
                     }
-                    if (deprecatedLevelExists) {
+                }
+                if (sdkExtSinceExists) {
+                    if (apiLevelExists) {
                         br
+                        +"Also in "
+                    } else {
+                        +"Added in "
+                    }
+                    a(href = "https://developer.android.com/sdkExtensions") {
+                        +"${node.sdkExtSince.name}"
                     }
                 }
                 if (deprecatedLevelExists) {
+                    if (apiLevelExists || sdkExtSinceExists) {
+                        br
+                    }
                     +"Deprecated in "
                     a(href = "https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels") {
                         +"API level ${node.deprecatedLevel.name}"
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
index a7df4e4..94bb045 100644
--- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
+++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt
@@ -112,7 +112,7 @@
     fun nodeForElement(element: PsiNamedElement,
                        kind: NodeKind,
                        name: String = element.name ?: "<anonymous>"): DocumentationNode {
-        val (docComment, deprecatedContent, attrs, apiLevel, deprecatedLevel, artifactId, attribute) = docParser.parseDocumentation(element)
+        val (docComment, deprecatedContent, attrs, apiLevel, sdkExtSince, deprecatedLevel, artifactId, attribute) = docParser.parseDocumentation(element)
         val node = DocumentationNode(name, docComment, kind)
         if (element is PsiModifierListOwner) {
             node.appendModifiers(element)
@@ -140,6 +140,9 @@
         apiLevel?.let {
             node.append(it, RefKind.Detail)
         }
+        sdkExtSince?.let {
+            node.append(it, RefKind.Detail)
+        }
         deprecatedLevel?.let {
             node.append(it, RefKind.Detail)
         }
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index 21cc2bb..0c73e76 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -25,6 +25,7 @@
     val deprecatedContent: Content?,
     val attributeRefs: List<String>,
     val apiLevel: DocumentationNode? = null,
+    val sdkExtSince: DocumentationNode? = null,
     val deprecatedLevel: DocumentationNode? = null,
     val artifactId: DocumentationNode? = null,
     val attribute: DocumentationNode? = null
@@ -35,6 +36,7 @@
             emptyList(),
             null,
             null,
+            null,
             null
         )
     }
@@ -109,6 +111,7 @@
 
         val attrRefSignatures = mutableListOf<String>()
         var since: DocumentationNode? = null
+        var sdkextsince: DocumentationNode? = null
         var deprecated: DocumentationNode? = null
         var artifactId: DocumentationNode? = null
         var attrName: String? = null
@@ -135,6 +138,9 @@
                 "since", "apisince" -> {
                     since = DocumentationNode(tag.getApiLevel() ?: "", Content.Empty, NodeKind.ApiLevel)
                 }
+                "sdkextsince" -> {
+                    sdkextsince = DocumentationNode(tag.getSdkExtSince() ?: "", Content.Empty, NodeKind.SdkExtSince)
+                }
                 "deprecatedsince" -> {
                     deprecated = DocumentationNode(tag.getApiLevel() ?: "", Content.Empty, NodeKind.DeprecatedLevel)
                 }
@@ -153,7 +159,7 @@
         attrName?.let { name ->
             attr = DocumentationNode(name, attrDesc ?: Content.Empty, NodeKind.AttributeRef)
         }
-        return JavadocParseResult(result, deprecatedContent, attrRefSignatures, since, deprecated, artifactId, attr)
+        return JavadocParseResult(result, deprecatedContent, attrRefSignatures, since, sdkextsince, deprecated, artifactId, attr)
     }
 
     private val tagsToInherit = setOf("param", "return", "throws")
@@ -182,6 +188,13 @@
         return null
     }
 
+    fun PsiDocTag.getSdkExtSince(): String? {
+        if (dataElements.isNotEmpty()) {
+            return join(dataElements.map { it.text }, " ")
+        }
+        return null
+    }
+
     private fun PsiDocTag.getAttrRef(element: PsiNamedElement): String? {
         if (dataElements.size > 1) {
             val elementText = dataElements[1].text
diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
index 6841503..098a17f 100644
--- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
+++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt
@@ -142,6 +142,9 @@
             } else if (name?.toLowerCase() == "since" || name?.toLowerCase() == "apisince") {
                 val apiLevel = DocumentationNode(it.getContent(), Content.Empty, NodeKind.ApiLevel)
                 append(apiLevel, RefKind.Detail)
+            } else if (name?.toLowerCase() == "sdkextsince") {
+                val sdkExtSince = DocumentationNode(it.getContent(), Content.Empty, NodeKind.SdkExtSince)
+                append(sdkExtSince, RefKind.Detail)
             } else if (name?.toLowerCase() == "deprecatedsince") {
                 val deprecatedLevel = DocumentationNode(it.getContent(), Content.Empty, NodeKind.DeprecatedLevel)
                 append(deprecatedLevel, RefKind.Detail)
@@ -223,6 +226,9 @@
                 parseResult.apiLevel?.let {
                     node.append(it, RefKind.Detail)
                 }
+                parseResult.sdkExtSince?.let {
+                    node.append(it, RefKind.Detail)
+                }
                 parseResult.deprecatedLevel?.let {
                     node.append(it, RefKind.Detail)
                 }
diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt
index c84d416..7ac6d8f 100644
--- a/core/src/main/kotlin/Model/DocumentationNode.kt
+++ b/core/src/main/kotlin/Model/DocumentationNode.kt
@@ -64,6 +64,7 @@
     AttributeRef,
 
     ApiLevel,
+    SdkExtSince,
 
     DeprecatedLevel,
 
@@ -120,6 +121,8 @@
         get() = references(RefKind.ExternalType).map { it.to }.firstOrNull()
     val apiLevel: DocumentationNode
         get() = detailOrNull(NodeKind.ApiLevel) ?: DocumentationNode("", Content.Empty, NodeKind.ApiLevel)
+    val sdkExtSince: DocumentationNode
+        get() = detailOrNull(NodeKind.SdkExtSince) ?: DocumentationNode("", Content.Empty, NodeKind.SdkExtSince)
     val deprecatedLevel: DocumentationNode
         get() = detailOrNull(NodeKind.DeprecatedLevel) ?: DocumentationNode("", Content.Empty, NodeKind.DeprecatedLevel)
     val artifactId: DocumentationNode