am 679b7498: Merge "Add mac_permissions.xml dependency."

* commit '679b7498af86ee084791e86d06eaad87fe2f27f0':
  Add mac_permissions.xml dependency.
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 1fdadad..3137152 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -125,6 +125,7 @@
 LOCAL_CLANG:=
 LOCAL_ADDRESS_SANITIZER:=
 LOCAL_JAR_EXCLUDE_FILES:=
+LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
 
 # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
 # iterate over thousands of entries every time.
diff --git a/core/java.mk b/core/java.mk
index 4e33ef2..9a4f3a2 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -15,8 +15,11 @@
 
 # Make sure there's something to build.
 # It's possible to build a package that doesn't contain any classes.
-ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES)))
-$(error $(LOCAL_PATH): Target java module does not define any source or resource files)
+# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
+# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
+# You have to set up the dependency in some other way.
+ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES))$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)))
+$(warning $(LOCAL_PATH): Target java module does not define any source or resource files)
 endif
 
 LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
@@ -232,7 +235,7 @@
 # If the module includes java code (i.e., it's not framework-res), compile it.
 full_classes_jar :=
 built_dex :=
-ifneq (,$(strip $(all_java_sources)$(full_static_java_libs)))
+ifneq (,$(strip $(all_java_sources)$(full_static_java_libs))$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)))
 
 # If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller,
 # full_classes_jar will be the same module as LOCAL_BUILT_MODULE.
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 233b136..7a25f30 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -30,9 +30,6 @@
 # no hardware camera
 USE_CAMERA_STUB := true
 
-# Set /system/bin/sh to ash, not mksh, to make sure we can switch back.
-TARGET_SHELL := ash
-
 # Enable dex-preoptimization to speed up the first boot sequence
 # of an SDK AVD. Note that this operation only works on Linux for now
 ifeq ($(HOST_OS),linux)
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index c0d7a25..4a9e5fe 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -21,9 +21,6 @@
 # customize the malloced address to be 16-byte aligned
 BOARD_MALLOC_ALIGNMENT := 16
 
-# Set /system/bin/sh to ash, not mksh, to make sure we can switch back.
-TARGET_SHELL := ash
-
 # Enable dex-preoptimization to speed up the first boot sequence
 # of an SDK AVD. Note that this operation only works on Linux for now
 ifeq ($(HOST_OS),linux)
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 2513e69..4e27c49 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -530,12 +530,12 @@
 }
 .design ol {
   counter-reset: item; }
-  .design ol li {
+  .design ol>li {
     font-size: 14px;
     line-height: 20px;
     list-style-type: none;
     position: relative; }
-    .design ol li:before {
+    .design ol>li:before {
       content: counter(item) ". ";
       counter-increment: item;
       position: absolute;
@@ -561,16 +561,18 @@
       content: "9. "; }
     .design ol li.value-10:before {
       content: "10. "; }
-.design .with-callouts ol li {
+.design .with-callouts ol>li {
   list-style-position: inside;
   margin-left: 0; }
-  .design .with-callouts ol li:before {
+  .design .with-callouts ol>li:before {
     display: inline;
     left: -20px;
     float: left;
     width: 17px;
     color: #33b5e5;
     font-weight: 500; }
+.design .with-callouts ul>li {
+  list-style-position: outside; }
 
 /* special list items */
 li.no-bullet {
@@ -1079,22 +1081,71 @@
    Print Only
    ========================================================================== */
 @media print {
-a {
-    color: inherit;
-}
-.nav-x, .nav-y {
-    display: none;
-}
-.str { color: #060; }
-.kwd { color: #006; font-weight: bold; }
-.com { color: #600; font-style: italic; }
-.typ { color: #404; font-weight: bold; }
-.lit { color: #044; }
-.pun { color: #440; }
-.pln { color: #000; }
-.tag { color: #006; font-weight: bold; }
-.atn { color: #404; }
-.atv { color: #060; }
+  /* configure printed page */
+  @page {
+      margin: 0.75in 1in;
+      widows: 4;
+      orphans: 4;
+  }
+
+  /* reset spacing metrics */
+  html, body, .wrap {
+      margin: 0 !important;
+      padding: 0 !important;
+      width: auto !important;
+  }
+
+  /* leave enough space on the left for bullets */
+  body {
+      padding-left: 20px !important;
+  }
+  #doc-col {
+      margin-left: 0;
+  }
+
+  /* hide a bunch of non-content elements */
+  #header, #footer, #nav-x, #side-nav,
+  .training-nav-top, .training-nav-bottom,
+  #doc-col .content-footer,
+  .nav-x, .nav-y,
+  .paging-links,
+  a.totop {
+      display: none !important;
+  }
+
+  /* remove extra space above page titles */
+  #doc-col .content-header {
+      margin-top: 0;
+  }
+
+  /* bump up spacing above subheadings */
+  h2 {
+      margin-top: 40px !important;
+  }
+
+  /* print link URLs where possible and give links default text color */
+  p a:after {
+      content: " (" attr(href) ")";
+      font-size: 80%;
+  }
+  p a {
+      word-wrap: break-word;
+  }
+  a {
+      color: inherit;
+  }
+
+  /* syntax highlighting rules */
+  .str { color: #060; }
+  .kwd { color: #006; font-weight: bold; }
+  .com { color: #600; font-style: italic; }
+  .typ { color: #404; font-weight: bold; }
+  .lit { color: #044; }
+  .pun { color: #440; }
+  .pln { color: #000; }
+  .tag { color: #006; font-weight: bold; }
+  .atn { color: #404; }
+  .atv { color: #060; }
 }
 
 /* =============================================================================
@@ -2033,8 +2084,11 @@
 #jd-content img.toggle-content-img {
   margin:0 5px 5px 0;
 }
-div.toggle-content > p {
-  padding:0 0 5px;
+div.toggle-content p {
+  margin:10px 0 0;
+}
+div.toggle-content-toggleme {
+  padding:0 0 0 15px;
 }
 
 
@@ -2145,14 +2199,9 @@
 
 .nolist {
   list-style:none;
-  padding:0;
-  margin:0 0 1em 1em;
+  margin-left:0;
 }
 
-.nolist li {
-  padding:0 0 2px;
-  margin:0;
-}
 
 pre.classic {
   background-color:transparent;
@@ -2180,6 +2229,12 @@
   color:#666;
 }
 
+div.note, 
+div.caution, 
+div.warning {
+  margin: 0 0 15px;
+}
+
 p.note, div.note, 
 p.caution, div.caution, 
 p.warning, div.warning {
@@ -2898,10 +2953,6 @@
 
 /* SEARCH RESULTS */
 
-/* disable twiddle and size selectors for left column */
-#leftSearchControl div {
-  padding:0;
-}
 
 #leftSearchControl .gsc-twiddle {
   background-image : none;
@@ -3475,7 +3526,7 @@
 
 .morehover:hover {
   opacity:1;
-  height:345px;
+  height:385px;
   width:268px;
   -webkit-transition-property:height,  -webkit-opacity;
 }
@@ -3489,7 +3540,7 @@
 .morehover .mid {
   width:228px;
   background:url(../images/more_mid.png) repeat-y;
-  padding:10px 20px 10px 20px;
+  padding:10px 20px 0 20px;
 }
 
 .morehover .mid .header {
@@ -3598,15 +3649,19 @@
   padding-top: 14px;
 }
 
+#nav-x .wrap {
+  min-height:34px;
+}
+
 #nav-x .wrap,
 #searchResults.wrap {
     max-width:940px;
     border-bottom:1px solid #CCC;
-    min-height:34px;
-    
 }
 
-
+#searchResults.wrap #leftSearchControl {
+  min-height:700px
+}
 .nav-x {
     margin-left:0;
     margin-bottom:0;
@@ -3762,7 +3817,8 @@
   height: 300px;
 }
 .slideshow-develop img.play {
-  width:350px;
+  max-width:350px;
+  max-height:240px;
   margin:20px 0 0 90px;
   -webkit-transform: perspective(800px ) rotateY( 35deg );
   box-shadow: -16px 20px 40px rgba(0, 0, 0, 0.3);
@@ -3817,6 +3873,7 @@
 .feed .feed-nav li {
   list-style: none;
   float: left;
+  height: 21px; /* +4px bottom border = 25px; same as .feed-nav */
   margin-right: 25px;
   cursor: pointer;
 }
@@ -3969,21 +4026,24 @@
 .landing-docs {
   margin:20px 0 0;
 }
-.landing-banner {
-  height:280px;
-}
 .landing-banner .col-6:first-child,
-.landing-docs .col-6:first-child {
+.landing-docs .col-6:first-child,
+.landing-docs .col-12 {
   margin-left:0;
+  min-height:280px;
 }
 .landing-banner .col-6:last-child,
-.landing-docs .col-6:last-child {
+.landing-docs .col-6:last-child,
+.landing-docs .col-12 {
   margin-right:0;
 }
 
 .landing-banner h1 {
   margin-top:0;
 }
+.landing-docs {
+  clear:left;
+}
 .landing-docs h3 {
   font-size:14px;
   line-height:21px;
@@ -4002,4 +4062,4 @@
 
 .plusone {
   float:right;
-}
\ No newline at end of file
+}
diff --git a/tools/droiddoc/templates-sdk/assets/css/fullscreen.css b/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
index 7503924..71cf65b 100644
--- a/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
+++ b/tools/droiddoc/templates-sdk/assets/css/fullscreen.css
@@ -2,6 +2,7 @@
 /* =============================================================================
    Columns
    ========================================================================== */
+/* Applied to body to debug layout alignments
 .grid {
   width:100%;
   height:100%;
@@ -10,6 +11,7 @@
   margin:auto;
   position:absolute;
 }   
+*/
 
 @media screen, projection, print {
 .full {
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index 6fec693..ba32d25 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -195,11 +195,15 @@
     
     if ($selListItem.hasClass('nav-section')) {
       // we're on an index page, jump to the first topic
-      $nextLink = $selListItem.find('ul').find('a:eq(0)');
+      $nextLink = $selListItem.find('ul:eq(0)').find('a:eq(0)');
 
       // if there aren't any children, go to the next section (required for About pages)
       if($nextLink.length == 0) {
         $nextLink = $selListItem.next('li').find('a');
+      } else if ($('.topic-start-link').length) {
+        // as long as there's a child link and there is a "topic start link" (we're on a landing)
+        // then set the landing page "start link" text to be the first doc title
+        $('.topic-start-link').text($nextLink.text().toUpperCase());
       }
       
       // Handle some Training specialties
diff --git a/tools/droiddoc/templates-sdk/assets/js/search_autocomplete.js b/tools/droiddoc/templates-sdk/assets/js/search_autocomplete.js
index 6b1e525..04f0e93 100644
--- a/tools/droiddoc/templates-sdk/assets/js/search_autocomplete.js
+++ b/tools/droiddoc/templates-sdk/assets/js/search_autocomplete.js
@@ -1,82 +1,12 @@
-/**
- * jQuery history event v0.1
- * Copyright (c) 2008 Tom Rodenberg <tarodenberg gmail com>
- * Licensed under the GPL (http://www.gnu.org/licenses/gpl.html) license.
+/*
+ * jQuery hashchange event - v1.3 - 7/21/2010
+ * http://benalman.com/projects/jquery-hashchange-plugin/
+ * 
+ * Copyright (c) 2010 "Cowboy" Ben Alman
+ * Dual licensed under the MIT and GPL licenses.
+ * http://benalman.com/about/license/
  */
-(function($) {
-    var currentHash, previousNav, timer, hashTrim = /^.*#/;
-
-    var msie = {
-        iframe: null,
-        getDoc: function() {
-            return msie.iframe.contentWindow.document;
-        },
-        getHash: function() {
-            return msie.getDoc().location.hash;
-        },
-        setHash: function(hash) {
-            var d = msie.getDoc();
-            d.open();
-            d.close();
-            d.location.hash = hash;
-        }
-    };
-
-    var historycheck = function() {
-        var hash = msie.iframe ? msie.getHash() : location.hash;
-        if (hash != currentHash) {
-            currentHash = hash;
-            if (msie.iframe) {
-                location.hash = currentHash;
-            }
-            var current = $.history.getCurrent();
-            $.event.trigger('history', [current, previousNav]);
-            previousNav = current;
-        }
-    };
-
-    $.history = {
-        add: function(hash) {
-            hash = '#' + hash.replace(hashTrim, '');
-            if (currentHash != hash) {
-                var previous = $.history.getCurrent();
-                location.hash = currentHash = hash;
-                if (msie.iframe) {
-                    msie.setHash(currentHash);
-                }
-                $.event.trigger('historyadd', [$.history.getCurrent(), previous]);
-            }
-            if (!timer) {
-                timer = setInterval(historycheck, 100);
-            }
-        },
-        getCurrent: function() {
-            if (currentHash) {
-              return currentHash.replace(hashTrim, '');
-            } else { 
-              return ""; 
-            }
-        }
-    };
-
-    $.fn.history = function(fn) {
-        $(this).bind('history', fn);
-    };
-
-    $.fn.historyadd = function(fn) {
-        $(this).bind('historyadd', fn);
-    };
-
-    $(function() {
-        currentHash = location.hash;
-        if ($.browser.msie) {
-            msie.iframe = $('<iframe style="display:none"src="javascript:false;"></iframe>')
-                            .prependTo('body')[0];
-            msie.setHash(currentHash);
-            currentHash = msie.getHash();
-        }
-    });
-})(jQuery);
+(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('<iframe tabindex="-1" title="empty"/>').hide().one("load",function(){r||l(a());n()}).attr("src",r||"javascript:0").insertAfter("body")[0].contentWindow;h.onpropertychange=function(){try{if(event.propertyName==="title"){q.document.title=h.title}}catch(s){}}}};j.stop=k;o=function(){return a(q.location.href)};l=function(v,s){var u=q.document,t=$.fn[c].domain;if(v!==s){u.title=h.title;u.open();t&&u.write('<script>document.domain="'+t+'"<\/script>');u.close();q.location.hash=v}}})();return j})()})(jQuery,this);
 
 
 
@@ -187,7 +117,14 @@
     if (e.keyCode == 13) {
         $('#search_filtered_div').addClass('no-display');
         if (!$('#search_filtered_div').hasClass('no-display') || (gSelectedIndex < 0)) {
-            return true;
+            if ($("#searchResults").is(":hidden")) {
+              // if results aren't showing, return true to allow search to execute
+              return true;
+            } else {
+              // otherwise, results are already showing, so allow ajax to auto refresh the results
+              // and ignore this Enter press to avoid the reload.
+              return false;
+            }
         } else if (kd && gSelectedIndex >= 0) {
             window.location = toroot + gMatches[gSelectedIndex].link;
             return false;
@@ -335,9 +272,8 @@
 function submit_search() {
   var query = document.getElementById('search_autocomplete').value;
   location.hash = 'q=' + query;
-  $.history.add('q=' + query);
   loadSearchResults();
-  $("#searchResults").slideDown();
+  $("#searchResults").slideDown('slow');
   return false;
 }
 
@@ -346,9 +282,11 @@
   $("#searchResults").slideUp();
   $(".search .close").addClass("hide");
   location.hash = '';
-  drawOptions.setInput(document.getElementById("searchResults"));
   
-  $("#search_autocomplete").blur();
+  $("#search_autocomplete").val("").blur();
+  
+  // reset the ajax search callback to nothing, so results don't appear unless ENTER
+  searchControl.setSearchStartingCallback(this, function(control, searcher, query) {});
   return false;
 }
 
@@ -367,19 +305,9 @@
 
             
       google.load('search', '1');
+      var searchControl;
 
       function loadSearchResults() {
-        if (location.hash.indexOf("q=") == -1) {
-          // if there's no query in the url, don't search and make sure results are hidden
-          $('#searchResults').hide();
-          return;
-        }
-        
-        var $results = $("#searchResults");
-        if ($results.is(":hidden")) {
-          $results.slideDown();
-        }
-        
         document.getElementById("search_autocomplete").style.color = "#000";
 
         // create search control
@@ -430,7 +358,7 @@
         // configure result options
         searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
         searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
-        searchControl.setTimeoutInterval(google.search.SearchControl.TIMEOUT_LONG);
+        searchControl.setTimeoutInterval(google.search.SearchControl.TIMEOUT_SHORT);
         searchControl.setNoResultsString(google.search.SearchControl.NO_RESULTS_DEFAULT_STRING);
 
         // upon ajax search, refresh the url and search title
@@ -438,7 +366,6 @@
           updateResultTitle(query);
           var query = document.getElementById('search_autocomplete').value;
           location.hash = 'q=' + query;
-          $.history.add('q=' + query);
         });
 
         // draw the search results box
@@ -453,16 +380,36 @@
       // End of loadSearchResults
 
 
-      google.setOnLoadCallback(loadSearchResults, true);
-
-      // when an event on the browser history occurs (back, forward, load) perform a search
-      $(window).history(function(e, hash) {
-        var query = decodeURI(getQuery(hash));
-        if (query == "undefined") {
-          hideResults(); 
-          return; 
+      google.setOnLoadCallback(function(){
+        if (location.hash.indexOf("q=") == -1) {
+          // if there's no query in the url, don't search and make sure results are hidden
+          $('#searchResults').hide();
+          return;
+        } else {
+          // first time loading search results for this page
+          $('#searchResults').slideDown('slow');
+          $(".search .close").removeClass("hide");
+          loadSearchResults();
         }
+      }, true);
+
+      // when an event on the browser history occurs (back, forward, load) requery hash and do search
+      $(window).hashchange( function(){
+        // Exit if the hash isn't a search query or there's an error in the query
+        if ((location.hash.indexOf("q=") == -1) || (query == "undefined")) {
+          // If the results pane is open, close it.
+          if (!$("#searchResults").is(":hidden")) {
+            hideResults();
+          }
+          return;
+        }
+
+        // Otherwise, we have a search to do
+        var query = decodeURI(getQuery(location.hash));
         searchControl.execute(query);
+        $('#searchResults').slideDown('slow');
+        $("#search_autocomplete").focus();
+        $(".search .close").removeClass("hide");
 
         updateResultTitle(query);
       });
diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs
index 39293fb..51759bc 100644
--- a/tools/droiddoc/templates-sdk/components/masthead.cs
+++ b/tools/droiddoc/templates-sdk/components/masthead.cs
@@ -28,16 +28,22 @@
   <div class="morehover" id="moremenu">
     <div class="top"></div>
     <div class="mid">
+      <div class="header">Links</div>
+      <ul>
+        <li><a href="https://play.google.com/apps/publish/">Google Play Developer Console</a></li>
+        <li><a href="http://android-developers.blogspot.com/">Android Developers Blog</a></li>
+        <li><a href="<?cs var:toroot ?>about/index.html">About Android</a></li>
+      </ul>
       <div class="header">Android Sites</div>
       <ul>
         <li><a href="http://www.android.com">Android.com</a></li>
         <li class="active"><a>Android Developers</a></li>
         <li><a href="http://source.android.com">Android Open Source Project</a></li>
       </ul>
-      <div class="header">Support</div>
+      <!-- <div class="header">Support</div>
       <ul>
         <li><a href="<?cs var:toroot ?>support.html">Developer Support</a></li>
-      </ul>
+      </ul> -->
       <div class="header">Languages</div>
         <div id="language" class="locales">
           <select name="language" onChange="changeLangPref(this.value, true)">
diff --git a/tools/droiddoc/templates-sdk/docpage.cs b/tools/droiddoc/templates-sdk/docpage.cs
index 181f777..3f9c01a 100644
--- a/tools/droiddoc/templates-sdk/docpage.cs
+++ b/tools/droiddoc/templates-sdk/docpage.cs
@@ -44,17 +44,19 @@
   <?cs if:(!fullpage && !header.hide) ?>
     <?cs if:page.landing ?><?cs # header logic for docs that are landing pages ?>
       <div class="landing-banner">
+        <?cs if:page.landing.image ?><?cs # use two-column layout only if there's an image ?>
         <div class="col-6">
-          <?cs if:page.landing.image ?>
           <img src="<?cs var:toroot ?><?cs var:page.landing.image ?>" alt="" />
-          <?cs /if ?>
         </div>
         <div class="col-6">
+        <?cs /if ?>
           <h1 itemprop="name" style="margin-bottom:0;"><?cs var:page.title ?></h1>
           <p itemprop="description"><?cs var:page.landing.intro ?></p>
           
-          <p><a href="<?cs var:page.landing.next ?>" class="next-page-link">LEARN MORE</a></p>
+          <p><a class="next-page-link topic-start-link"></a></p>
+        <?cs if:page.landing.image ?>
         </div>
+        <?cs /if ?>
       </div>
     <?cs else ?>
       <h1 itemprop="name"><?cs var:page.title ?></h1>