Merge "Set API version for KKWT. DO NOT MERGE" into klp-modular-dev
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 7fabe88..8a30a38 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -59,6 +59,9 @@
     uiautomator \
     webview
 
+PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.software.webview.xml:system/etc/permissions/android.software.webview.xml
+
 # The order of PRODUCT_BOOT_JARS matters.
 PRODUCT_BOOT_JARS := \
     core \
diff --git a/target/product/core_tiny.mk b/target/product/core_tiny.mk
index cd0cd69..8c1135f 100644
--- a/target/product/core_tiny.mk
+++ b/target/product/core_tiny.mk
@@ -18,6 +18,7 @@
 
 PRODUCT_PACKAGES := \
     Bluetooth \
+    CalendarProvider \
     ContactsProvider \
     CertInstaller \
     FusedLocation \
@@ -70,6 +71,7 @@
     libsqlite_jni \
     libwilhelm \
     make_ext4fs \
+    nullwebview \
     screencap \
     sensorservice \
     uiautomator
@@ -86,7 +88,8 @@
     framework2 \
     android.policy \
     services \
-    apache-xml
+    apache-xml \
+    nullwebview
 
 PRODUCT_RUNTIMES := runtime_libdvm_default
 
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 4b99ca1..688d048 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -713,6 +713,7 @@
     color: #33b5e5;
     border-bottom-color: #33b5e5; } }
 
+h1:target,
 h2:target,
 h3:target {
     -webkit-animation-name: glowheader;
@@ -1131,7 +1132,7 @@
 h3, h4 {
     color:#333;
     line-height: 20px;
-    margin: 10px 0;
+    margin: 10px 0 14px 0;
 }
 h4 {
   font-size: 16px;
@@ -4093,6 +4094,7 @@
   width: 26px;
   height: 25px;
   background: url(../images/dac_logo.png);
+  background-image: -webkit-image-set(url(../images/dac_logo.png) 1x, url(../images/dac_logo@2x.png) 2x);
   z-index: 52;
   position: relative;
 }
@@ -5137,10 +5139,12 @@
   margin-bottom: 0px;
   font-size: 20px;
   color: #363636;
+  padding-top: 70px;
+  margin-top:-60px;
 }
 .headerLine hr {
   overflow: hidden;
-  margin: 42px 0 0 0;
+  margin: 30px 0 0 0;
 }
 
 .article-detail #body-content {
@@ -5365,11 +5369,11 @@
 .resource-flow-layout:after {
   content: ".";
   display: block;
-  height: 0;
+  height: 10;
+  position:relative;
   clear: both;
   visibility: hidden;
 }
-
 .resource-card:hover {
   cursor: pointer;
 }
@@ -6383,4 +6387,12 @@
 div.jd-descr > .resource-widget[data-section=distribute\/tools]
 .section-card-menu .card-info ul li {
   border-top-color: #7e3794 !important;
+}
+
+div.jd-descr > h2:before, h3:before {
+display:block;
+content: "   ";
+margin-top:-60px;
+height: 70px;
+visibility:hidden;
 }
\ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index e6befe3..d8d5732 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -884,103 +884,99 @@
 /* #########     END COOKIES!     ########## */
 
 
-
-
+var sticky = false;
 var stickyTop;
+var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
 /* Sets the vertical scoll position at which the sticky bar should appear.
    This method is called to reset the position when search results appear or hide */
 function setStickyTop() {
   stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
 }
 
-
-/* 
+/*
  * Displays sticky nav bar on pages when dac header scrolls out of view 
  */
+$(window).scroll(function(event) {
+
+  setStickyTop();
+  var hiding = false;
+  var $stickyEl = $('#sticky-header');
+  var $menuEl = $('.menu-container');
+  // Exit if there's no sidenav
+  if ($('#side-nav').length == 0) return;
+  // Exit if the mouse target is a DIV, because that means the event is coming
+  // from a scrollable div and so there's no need to make adjustments to our layout
+  if ($(event.target).nodeName == "DIV") {
+    return;
+  }
+
+  var top = $(window).scrollTop();
+  // we set the navbar fixed when the scroll position is beyond the height of the site header...
+  var shouldBeSticky = top >= stickyTop;
+  // ... except if the document content is shorter than the sidenav height.
+  // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
+  if ($("#doc-col").height() < $("#side-nav").height()) {
+    shouldBeSticky = false;
+  }
+
+  // Don't continue if the header is sufficently far away
+  // (to avoid intensive resizing that slows scrolling)
+  if (sticky == shouldBeSticky) {
+    return;
+  }
+  // Account for horizontal scroll
+  var scrollLeft = $(window).scrollLeft();
+  // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
+  if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
+    updateSideNavPosition();
+    prevScrollLeft = scrollLeft;
+  }
+
+  // If sticky header visible and position is now near top, hide sticky
+  if (sticky && !shouldBeSticky) {
+    sticky = false;
+    hiding = true;
+    // make the sidenav static again
+    $('#devdoc-nav')
+        .removeClass('fixed')
+        .css({'width':'auto','margin':''})
+        .prependTo('#side-nav');
+    // delay hide the sticky
+    $menuEl.removeClass('sticky-menu');
+    $stickyEl.fadeOut(250);
+    hiding = false;
+
+    // update the sidenaav position for side scrolling
+    updateSideNavPosition();
+  } else if (!sticky && shouldBeSticky) {
+    sticky = true;
+    $stickyEl.fadeIn(10);
+    $menuEl.addClass('sticky-menu');
+
+    // make the sidenav fixed
+    var width = $('#devdoc-nav').width();
+    $('#devdoc-nav')
+        .addClass('fixed')
+        .css({'width':width+'px'})
+        .prependTo('#body-content');
+
+    // update the sidenaav position for side scrolling
+    updateSideNavPosition();
+
+  } else if (hiding && top < 15) {
+    $menuEl.removeClass('sticky-menu');
+    $stickyEl.hide();
+    hiding = false;
+  }
+  resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
+});
+
+/*
+ * Manages secion card states and nav resize to conclude loading
+ */
 (function() {
   $(document).ready(function() {
 
-    setStickyTop();
-    var sticky = false;
-    var hiding = false;
-    var $stickyEl = $('#sticky-header');
-    var $menuEl = $('.menu-container');
-
-    var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
-
-    $(window).scroll(function() {
-      // Exit if there's no sidenav
-      if ($('#side-nav').length == 0) return;
-      // Exit if the mouse target is a DIV, because that means the event is coming
-      // from a scrollable div and so there's no need to make adjustments to our layout
-      if (event.target.nodeName == "DIV") {
-        return;
-      }
-
-
-      var top = $(window).scrollTop();
-      // we set the navbar fixed when the scroll position is beyond the height of the site header...
-      var shouldBeSticky = top >= stickyTop;
-      // ... except if the document content is shorter than the sidenav height.
-      // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
-      if ($("#doc-col").height() < $("#side-nav").height()) {
-        shouldBeSticky = false;
-      }
-
-      // Don't continue if the header is sufficently far away
-      // (to avoid intensive resizing that slows scrolling)
-      if (sticky && shouldBeSticky) {
-        return;
-      }
-
-      // Account for horizontal scroll
-      var scrollLeft = $(window).scrollLeft();
-      // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
-      if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
-        updateSideNavPosition();
-        prevScrollLeft = scrollLeft;
-      }
-
-      // If sticky header visible and position is now near top, hide sticky
-      if (sticky && !shouldBeSticky) {
-        sticky = false;
-        hiding = true;
-        // make the sidenav static again
-        $('#devdoc-nav')
-            .removeClass('fixed')
-            .css({'width':'auto','margin':''})
-            .prependTo('#side-nav');
-        // delay hide the sticky
-        $menuEl.removeClass('sticky-menu');
-        $stickyEl.fadeOut(250);
-        hiding = false;
-
-        // update the sidenaav position for side scrolling
-        updateSideNavPosition();
-      } else if (!sticky && shouldBeSticky) {
-        sticky = true;
-        $stickyEl.fadeIn(10);
-        $menuEl.addClass('sticky-menu');
-
-        // make the sidenav fixed
-        var width = $('#devdoc-nav').width();
-        $('#devdoc-nav')
-            .addClass('fixed')
-            .css({'width':width+'px'})
-            .prependTo('#body-content');
-
-        // update the sidenaav position for side scrolling
-        updateSideNavPosition();
-
-      } else if (hiding && top < 15) {
-        $menuEl.removeClass('sticky-menu');
-        $stickyEl.hide();
-        hiding = false;
-      }
-
-      resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
-    });
-
     // Stack hover states
     $('.section-card-menu').each(function(index, el) {
       var height = $(el).height();
@@ -1827,6 +1823,11 @@
     }
     // Stop here if Google results are showing
     else if ($("#searchResults").is(":visible")) {
+        //If search_results is scrolled out of view, scroll to top on input
+        if ((sticky ) && (search.value != "")) {
+          $('body,html').animate({scrollTop:0}, '500', 'swing');
+        }
+        // if results aren't showing (and text not empty), return true to allow search to execute
         return true;
     }
     // 38 UP ARROW
@@ -2505,8 +2506,6 @@
     if (!$("#searchResults").is(":hidden")) {
       hideResults();
     }
-    // Adjust the scroll position to account for sticky header
-    $(window).scrollTop($(window).scrollTop() - 60);
     return;
   }
 
@@ -3517,7 +3516,6 @@
     while (i < resources.length) {
       var cardSize = cardSizes[j++ % cardSizes.length];
       cardSize = cardSize.replace(/^\s+|\s+$/,'');
-      console.log("cardsize is " + cardSize);
       // Some card sizes do not get a plusone button, such as where space is constrained
       // or for cards commonly embedded in docs (to improve overall page speed).
       plusone = !((cardSize == "6x2") || (cardSize == "6x3") ||