diff options
22 files changed, 297 insertions, 179 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java index c29d75e516ef..94ea2c5b4d90 100644 --- a/core/java/android/app/ActivityView.java +++ b/core/java/android/app/ActivityView.java @@ -354,9 +354,11 @@ public class ActivityView extends ViewGroup { private static class ActivityContainerWrapper { private final IActivityContainer mIActivityContainer; private final CloseGuard mGuard = CloseGuard.get(); + boolean mOpened; // Protected by mGuard. ActivityContainerWrapper(IActivityContainer container) { mIActivityContainer = container; + mOpened = true; mGuard.open("release"); } @@ -424,11 +426,16 @@ public class ActivityView extends ViewGroup { } void release() { - if (DEBUG) Log.v(TAG, "ActivityContainerWrapper: release called"); - try { - mIActivityContainer.release(); - mGuard.close(); - } catch (RemoteException e) { + synchronized (mGuard) { + if (mOpened) { + if (DEBUG) Log.v(TAG, "ActivityContainerWrapper: release called"); + try { + mIActivityContainer.release(); + mGuard.close(); + } catch (RemoteException e) { + } + mOpened = false; + } } } diff --git a/docs/html/guide/components/activities.jd b/docs/html/guide/components/activities.jd index 1cbaa79194e5..3de7eea09d32 100644 --- a/docs/html/guide/components/activities.jd +++ b/docs/html/guide/components/activities.jd @@ -4,12 +4,6 @@ page.tags="activity","intent" <div id="qv-wrapper"> <div id="qv"> -<h2>Quickview</h2> -<ul> - <li>An activity provides a user interface for a single screen in your application</li> - <li>Activities can move into the background and then be resumed with their state restored</li> -</ul> - <h2>In this document</h2> <ol> <li><a href="#Creating">Creating an Activity</a> diff --git a/docs/html/guide/components/bound-services.jd b/docs/html/guide/components/bound-services.jd index 653c7a0b785e..4215f0f29dce 100644 --- a/docs/html/guide/components/bound-services.jd +++ b/docs/html/guide/components/bound-services.jd @@ -6,12 +6,6 @@ parent.link=services.html <div id="qv-wrapper"> <ol id="qv"> -<h2>Quickview</h2> -<ul> - <li>A bound service allows other components to bind to it, in order to interact with it and -perform interprocess communication</li> - <li>A bound service is destroyed once all clients unbind, unless the service was also started</li> -</ul> <h2>In this document</h2> <ol> <li><a href="#Basics">The Basics</a></li> diff --git a/docs/html/guide/components/fragments.jd b/docs/html/guide/components/fragments.jd index 32c9f9962858..0cc5f7268f8a 100644 --- a/docs/html/guide/components/fragments.jd +++ b/docs/html/guide/components/fragments.jd @@ -5,15 +5,6 @@ parent.link=activities.html <div id="qv-wrapper"> <div id="qv"> - - <h2>Quickview</h2> - <ul> - <li>Fragments decompose application functionality and UI into reusable modules</li> - <li>Add multiple fragments to a screen to avoid switching activities</li> - <li>Fragments have their own lifecycle, state, and back stack</li> - <li>Fragments require API Level 11 or greater</li> - </ul> - <h2>In this document</h2> <ol> <li><a href="#Design">Design Philosophy</a></li> diff --git a/docs/html/guide/components/processes-and-threads.jd b/docs/html/guide/components/processes-and-threads.jd index 1fed712c38f5..e297205ca462 100644 --- a/docs/html/guide/components/processes-and-threads.jd +++ b/docs/html/guide/components/processes-and-threads.jd @@ -5,13 +5,6 @@ page.tags="lifecycle","background" <div id="qv-wrapper"> <div id="qv"> -<h2>Quickview</h2> -<ul> - <li>Every application runs in its own process and all components of the application run in that -process, by default</li> - <li>Any slow, blocking operations in an activity should be done in a new thread, to avoid slowing -down the user interface</li> -</ul> <h2>In this document</h2> <ol> diff --git a/docs/html/guide/components/services.jd b/docs/html/guide/components/services.jd index da01d2c5ecb5..6e22be8e2f56 100644 --- a/docs/html/guide/components/services.jd +++ b/docs/html/guide/components/services.jd @@ -3,14 +3,6 @@ page.title=Services <div id="qv-wrapper"> <ol id="qv"> -<h2>Quickview</h2> -<ul> - <li>A service can run in the background to perform work even while the user is in a different -application</li> - <li>A service can allow other components to bind to it, in order to interact with it and -perform interprocess communication</li> - <li>A service runs in the main thread of the application that hosts it, by default</li> -</ul> <h2>In this document</h2> <ol> <li><a href="#Basics">The Basics</a></li> diff --git a/docs/html/guide/components/tasks-and-back-stack.jd b/docs/html/guide/components/tasks-and-back-stack.jd index f818873ab256..e054313e8f3e 100644 --- a/docs/html/guide/components/tasks-and-back-stack.jd +++ b/docs/html/guide/components/tasks-and-back-stack.jd @@ -5,14 +5,6 @@ parent.link=activities.html <div id="qv-wrapper"> <div id="qv"> -<h2>Quickview</h2> -<ul> - <li>All activities belong to a task</li> - <li>A task contains a collection of activities in the order in which the user interacts with -them</li> - <li>Tasks can move to the background and retain the state of each activity in order for users -to perform other tasks without losing their work</li> -</ul> <h2>In this document</h2> <ol> diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index 0a234aa17279..ff083120e824 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -564,7 +564,11 @@ <li><a href="<?cs var:toroot ?>guide/practices/tablets-and-handsets.html"> <span class="en">Supporting Tablets and Handsets</span> </a></li> - + <li> + <a href="<?cs var:toroot ?>guide/practices/verifying-apps-art.html"> + <span class="en">Verifying App Behavior on ART</span> + </a> + </li> </ul> </li> diff --git a/docs/html/images/tools-home.png b/docs/html/images/tools-home.png Binary files differindex 291a36138a4e..86a7414bc91b 100644 --- a/docs/html/images/tools-home.png +++ b/docs/html/images/tools-home.png diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd index 26e8f30e128b..aa4fd6886eb7 100644 --- a/docs/html/sdk/index.jd +++ b/docs/html/sdk/index.jd @@ -230,7 +230,6 @@ This is the Android Software Development Kit License Agreement </div> - </div><!-- end TOS --> @@ -253,16 +252,30 @@ Android SDK components and a version of the Eclipse IDE with built-in <b>ADT (Android Developer Tools)</b> to streamline your Android app development.</p> -<p>With a single download, the ADT Bundle + +<!-- this appears when viewing the online docs --> +<div class="online" style="margin-bottom:85px"> + +<a class="big button subtitle" id="download-bundle-button" +href="" style="width:295px;display:block;margin:25px 0" ></a> + +<p id="not-supported">Choose the SDK package for your OS from the table below.</p> + + + <p>With a single download, the Eclipse ADT bundle includes everything you need to begin developing apps:</p> <ul> <li>Eclipse + ADT plugin</li> <li>Android SDK Tools</li> <li>Android Platform-tools</li> -<li>The latest Android platform</li> -<li>The latest Android system image for the emulator</li> +<li>A version of the Android platform</li> +<li>A version of the Android system image for the emulator</li> </ul> +</div> +<!-- end online --> + + <!-- this appears when viewing the offline docs --> <p class="offline"> @@ -275,52 +288,44 @@ href="http://developer.android.com/sdk/index.html">developer.android.com/sdk/</a <div class="col-7" style="margin-right:0;"> - <img src="{@docRoot}images/sdk-cube.png" alt="" height=264 /> - -<!-- this appears when viewing the online docs --> -<div class="online"> - -<a class="big button subtitle" id="download-bundle-button" -href="" style="display:none;width:265px;margin:0 auto;display:block" ></a> + <img src="{@docRoot}images/tools-home.png" alt="" height="347" width="400" /> +</div><!-- end col-7 --> -<p id="not-supported">Choose the SDK package for your OS from the table below.</p> -</div> -<!-- end online --> -</div><!-- end col-7 --> +<div class="col-7" style="background: #ddd; + padding: 30px 20px; width:350px; margin:20px 0 0 20px;"> + <h3 style="margin-top:0"> + <a href="/sdk/installing/studio.html">Get Android Studio Beta</a> + </h3> + <p> + Android Studio is a new IDE powered by IntelliJ that provides new features and improvements + over ADT. It's currently in beta but will be the official Android IDE once it's ready.</p> + <p style="margin: 0;"> + <a href="/sdk/installing/studio.html">Learn more about Android Studio</a></p> + </div> <!-- alternative SDK options --> -<div class="col-13" style="margin:0;"> - +<div class="col-13" style="margin:-70px 0 0;"> -<!-- this appears only when viewing the online docs --> -<div class="online caution"> -<h3 style="margin:0 0 10px 0;font-size:14px">Android Studio Early Access Preview</h3> -<p>A new Android development environment called Android Studio, -based on IntelliJ IDEA, is now available as an <strong>early access preview</strong>. -For more information, see -<a href="{@docRoot}sdk/installing/studio.html">Getting Started with Android Studio</a>.</p> +<p style="width:340px">If you prefer to use an existing version of Eclipse or another IDE, +you can instead download the stand-alone Android SDK Tools:</p> -</div> -<p>If you prefer to use an existing version of Eclipse or another IDE, -you can instead take a more customized approach to installing -the Android SDK. See the following instructions:</p> <h4 id="ExistingIDE"><a href='' class="expandable" onclick="toggleExpandable(this,'.myide');hideExpandable('.pax,.reqs');return false;" - >USE AN EXISTING IDE</a></h4> + >GET THE SDK FOR AN EXISTING IDE</a></h4> <div class="col-13 myide" style="margin:0 0 15px;display:none;"> @@ -333,13 +338,11 @@ the ADT plugin to it.</p> <a class="button subtitle" id="download-tools-button" href="" style="display:none" ></a> </p> - </div> - <h4 id="Requirements"><a href='' class="expandable" onclick="toggleExpandable(this,'.reqs');hideExpandable('.pax,.myide');return false;" >SYSTEM REQUIREMENTS</a></h4> @@ -359,23 +362,9 @@ the ADT plugin to it.</p> </ul> </div> -<div class="col-6 reqs" style="margin:0 0 15px 20px;display:none;"> -<h5>Eclipse IDE</h5> - <ul> - <li><a href="http://eclipse.org/mobile/">Eclipse</a> 3.7.2 (Indigo) or greater -<p class="note"><strong>Note:</strong> Eclipse 3.6 (Helios) is no longer -supported with the latest version of ADT.</p></li> - <li>Eclipse <a href="http://www.eclipse.org/jdt">JDT</a> plugin (included -in most Eclipse IDE packages) </li> - <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 6</a> - (JRE alone is not sufficient)</li> - <li><a href="{@docRoot}tools/sdk/eclipse-adt.html">Android Development Tools plugin</a> -(recommended)</li> - <li><strong>Not</strong> compatible with GNU Compiler for Java (gcj)</li> - </ul> - +<div class="col-7 reqs" style="margin:0 0 80px 20px;display:none;"> -<h5>Other development environments</h5> +<h5>Development tools</h5> <ul> <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 6</a> (JRE alone is not sufficient)</li> @@ -385,6 +374,4 @@ in most Eclipse IDE packages) </li> <p class="note"><strong>Note:</strong> Some Linux distributions may include JDK 1.4 or Gnu Compiler for Java, both of which are <em>not</em> supported for Android development. </p> -</div><!-- end col-7 reqs --> - - +</div><!-- end reqs -->
\ No newline at end of file diff --git a/docs/html/sdk/installing/installing-adt.jd b/docs/html/sdk/installing/installing-adt.jd index b23212d33a28..1e87cd8fb632 100644 --- a/docs/html/sdk/installing/installing-adt.jd +++ b/docs/html/sdk/installing/installing-adt.jd @@ -20,6 +20,18 @@ only if you already have an Eclipse installation that you want to continue using have Eclipse installed, you should instead <b><a href="{@docRoot}sdk/index.html">install the complete Android SDK</a></b>, which includes the latest IDE for Android developers.</p> +<p>Your existing Eclipse installation must meet these requirements:</p> + <ul> + <li><a href="http://eclipse.org/mobile/">Eclipse</a> 3.7.2 (Indigo) or greater +<p class="note"><strong>Note:</strong> Eclipse 3.6 (Helios) is no longer +supported with the latest version of ADT.</p></li> + <li>Eclipse <a href="http://www.eclipse.org/jdt">JDT</a> plugin (included +in most Eclipse IDE packages) </li> + <li><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 6</a> + (JRE alone is not sufficient)</li>oid Development Tools plugin</a> +(recommended)</li> + <li><strong>Not</strong> compatible with GNU Compiler for Java (gcj)</li> + </ul> <h2 id="Download">Download the ADT Plugin</h2> diff --git a/docs/html/sdk/installing/studio.jd b/docs/html/sdk/installing/studio.jd index 8f2596ba275e..af6bd756a5ac 100644 --- a/docs/html/sdk/installing/studio.jd +++ b/docs/html/sdk/installing/studio.jd @@ -1,4 +1,4 @@ -page.title=Getting Started with Android Studio +page.title=Android Studio page.tags="studio" @jd:body @@ -7,7 +7,7 @@ page.tags="studio" <div style="position:relative;min-height:660px;"> -<h3 style="color:#f80">BETA RELEASE</h3> +<h3 style="color:#FF4444;margin:-30px 0 20px">BETA</h3> <div id="tos" style="position:absolute;display:none;width:inherit;"> <div class="col-13" style="margin:0;"> </div><!-- provides top margin for content --> @@ -185,19 +185,19 @@ This is the Android Software Development Kit License Agreement <div id="main"> -<div class="figure" style="width:400px;margin-top:-20px"> +<div class="figure" style="width:400px;margin-top:-75px"> <img src="{@docRoot}images/tools/android-studio.png" height="330" width="400" style="margin-bottom:20px" /> <a class="big button subtitle" id="download-ide-button" -href="" style="display:none;width:265px;margin:0 auto;display:block;font-size:18px" ></a> -<div style="width:290px;padding:10px 40px 0 60px;font-size:12px;line-height:16px"> +href="" style="display:none;width:368px;margin:0 auto;display:block;font-size:18px" ></a> +<div style="margin:20px 0 0 0"> <p style="margin-bottom:8px">This download includes:</p> -<ul> -<li>Android Studio <b>early access preview</b></li> -<li>All the Android SDK Tools to design, test, debug, and profile your app</li> -<li>The latest Android platform to compile your app</li> -<li>The latest Android system image to run your app in the emulator</li> +<ul style="margin-bottom:20px"> +<li>Android Studio Beta</li> +<li>All the Android SDK Tools to design, test, and debug your app</li> +<li>A version of the Android platform to compile your app</li> +<li>A version of the Android system image to run your app in the emulator</li> </ul> </div> @@ -206,36 +206,34 @@ href="" style="display:none;width:265px;margin:0 auto;display:block;font-size:18 <p>Android Studio is a new Android development environment based on IntelliJ -IDEA. Similar to Eclipse with the -ADT Plugin, Android Studio provides integrated Android developer tools -for development and debugging. On top of the +IDEA. It provides new features and improvements over Eclipse ADT +and will be the official Android IDE once it's ready. On top of the capabilities you expect from IntelliJ, Android Studio offers:</p> <ul> - <li>Gradle-based build support.</li> - <li>Android-specific refactoring and quick fixes.</li> - <li>Lint tools to catch performance, usability, version compatibility and other problems.</li> - <li>ProGuard and app-signing capabilities. </li> - <li>Template-based wizards to create common Android designs and components.</li> - <li>A rich layout editor that allows you to drag-and-drop UI components, preview layouts on - multiple screen configurations, and much more.</li> + <li>Flexible Gradle-based build system.</li> + <li>Build variants and multiple APK generation.</li> + <li>Expanded template support for Google Services and various device types.</li> + <li>Rich layout editor with support for theme editing.</li> + <li>Lint tools to catch performance, usability, version compatibility, and other problems.</li> + <li>ProGuard and app-signing capabilities.</li> <li>Built-in support for <a href="http://android-developers.blogspot.com/2013/06/adding-backend-to-your-app-in-android.html" class="external-link">Google Cloud Platform</a>, making it easy to integrate Google Cloud - Messaging and App Engine as server-side components. + Messaging and App Engine. </ul> -<p class="caution"><strong>Caution:</strong> Android Studio is currently available as -an <strong>early access preview</strong>. Several features -are either incomplete or not yet implemented and you may encounter bugs. If you are not +<p class="caution"><strong>Caution:</strong> Android Studio is currently in +<strong>beta</strong>. Some features +are not yet implemented and you may encounter bugs. If you are not comfortable using an unfinished product, you may want to instead -download (or continue to use) the -<a href="{@docRoot}sdk/index.html">ADT Bundle</a> (Eclipse with the ADT Plugin).</p> +download (or continue to use) +<a href="{@docRoot}sdk/index.html">Eclipse with ADT</a>.</p> -<h4 style="clear:right;text-align:right;margin-right:50px"><a href='' class="expandable" +<h4 style="margin-top: 20px;"><a href='' class="expandable" onclick="toggleExpandable(this,'.pax');return false;" - >DOWNLOAD FOR OTHER PLATFORMS</a></h4> + >VIEW ALL DOWNLOADS AND SIZES</a></h4> <div class="pax col-13 online" style="display:none;margin:0;"> @@ -288,6 +286,79 @@ download (or continue to use) the +<h2 style="margin-bottom: 0px;">Android Studio vs. Eclipse ADT Comparison</h2> + +<p> +The following table lists some key differences between Android Studio Beta and +<a href="{@docRoot}sdk/index.html">Eclipse with ADT</a>. +</p> + +<style> +td.yes { + color: #669900; +} +td.no { + color: #CC0000; +} +</style> + +<table> + <tbody><tr> + <th>Feature</th> + <th>Android Studio</th> + <th>ADT</th> + </tr> + <tr> + <td>Build system</td> + <td><a href="http://www.gradle.org/" class="external-link">Gradle</a></td> + <td><a href="http://ant.apache.org/" class="external-link">Ant</a></td> + </tr> + <tr> + + <td>Maven-based build dependencies</td> + <td class="yes">Yes</td> + <td class="no">No</td> + </tr> + + <td>Build variants and multiple-APK generation (great for Android Wear)</td> + <td class="yes">Yes</td> + <td class="no">No</td> + </tr> + + <tr> + <td>Advanced Android code completion and refactoring</td> + <td class="yes">Yes</td> + <td class="no">No</td> + </tr> + <tr> + <td>Graphical layout editor</td> + <td class="yes">Yes</td> + <td class="yes">Yes</td> + </tr> + <tr> + </tr> + + <tr> + <td>APK signing</td> + <td class="yes">Yes</td> + <td class="yes">Yes</td> + </tr> + + <tr> + <td>Keystore management</td> + <td class="no">Coming soon</td> + <td class="yes">Yes</td> + </tr> + + <tr> + <td>NDK support</td> + <td class="no">Coming soon</td> + <td class="yes">Yes</td> + </tr> + </tbody></table> + + + <h2 id="Updating">Updating from older versions</h2> <p>If you already have Android Studio installed, in most cases, you can upgrade to the latest @@ -505,8 +576,8 @@ for possible resolutions to known issues: <a href="http://tools.android.com/know if (os) { /* set up primary ACE download button */ $('#download-ide-button').show(); - $('#download-ide-button').append("Download Android Studio <span class='small'>v0.5.2</span>" - + "<br/> <span class='small'>for " + os + "</span>"); + $('#download-ide-button').append("Download Android Studio Beta <span class='small'>v0.5.2</span>" + + "<br/> <span class='small'>with the Android SDK for " + os + "</span>"); $('#download-ide-button').click(function() {return onDownload(this,true);}).attr('href', bundlename); } else { diff --git a/docs/html/tools/device.jd b/docs/html/tools/device.jd index e748b12d06cb..89b3857ab6e6 100644 --- a/docs/html/tools/device.jd +++ b/docs/html/tools/device.jd @@ -5,6 +5,7 @@ page.title=Using Hardware Devices <div id="qv"> <h2>In this document</h2> <ol> + <li><a href="#device-developer-options">Enabling On-device Developer Options</a></li> <li><a href="#setting-up">Setting up a Device for Development</a> <ol> <li><a href="#VendorIds">USB Vendor IDs</a></li> @@ -43,6 +44,29 @@ allow you to verify that your application functions properly on different versio platform, in different screen sizes and orientations, and more.</p> +<h2 id="developer-device-options" style="margin-bottom: 0px;">Enabling On-device Developer Options</h2> + +<img src="/images/tools/dev-options-inmilk.png" alt="" style="float:right;margin-left:30px"> + +<p>Android-powered devices have a host of developer options that you can +access on the phone, which let you:</p> +<ul> + <li>Enable debugging over USB.</li> + <li>Quickly capture bug reports onto the device.</li> + <li>Show CPU usage on screen.</li> + <li>Draw debugging information on screen such as layout bounds, + updates on GPU views and hardware layers, and other information.</li> + <li>Plus many more options to simulate app stresses or enable debugging options.</li> +</ul> +<p>To access these settings, open the <em>Developer options</em> in the +system Settings. On Android 4.2 and higher, the Developer options screen is +hidden by default. To make it visible, go to +<b>Settings > About phone</b> and tap <b>Build number</b> seven times. Return to the previous +screen to find Developer options at the bottom.</p> + + + + <h2 id="setting-up">Setting up a Device for Development</h2> <p>With an Android-powered device, you can develop and debug your Android applications just as you diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs index 450a5c454b61..fb4659f01fe8 100644 --- a/docs/html/tools/tools_toc.cs +++ b/docs/html/tools/tools_toc.cs @@ -1,12 +1,6 @@ <ul id="nav"> <li class="nav-section"> - <div class="nav-section-header empty"> - <a href="<?cs var:toroot ?>tools/index.html"><span class="en">Developer Tools</span></a> - </div> - </li> - - <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot ?>sdk/index.html"><span class="en">Download</span></a></div> <ul> diff --git a/docs/html/training/cloudsync/backupapi.jd b/docs/html/training/cloudsync/backupapi.jd index a5436c6d2eec..fd35ada63bda 100644 --- a/docs/html/training/cloudsync/backupapi.jd +++ b/docs/html/training/cloudsync/backupapi.jd @@ -41,7 +41,7 @@ new devices using the Backup API.</p> <h2 id="register">Register for the Android Backup Service</h2> <p>This lesson requires the use of the <a - href="http://code.google.com/android/backup/index.html">Android Backup + href="{@docRoot}google/backup/index.html">Android Backup Service</a>, which requires registration. Go ahead and <a href="http://code.google.com/android/backup/signup.html">register here</a>. Once that's done, the service pre-populates an XML tag for insertion in your Android diff --git a/docs/html/training/cloudsync/index.jd b/docs/html/training/cloudsync/index.jd index 55b275b89983..8679009b005b 100644 --- a/docs/html/training/cloudsync/index.jd +++ b/docs/html/training/cloudsync/index.jd @@ -6,6 +6,16 @@ startpage=true @jd:body +<div id="tb-wrapper"> +<div id="tb"> + +<h2>Dependencies and prerequisites</h2> +<ul> + <li>Android 2.2 (API level 8) and higher</li> +</ul> +</div> +</div> + <p>By providing powerful APIs for internet connectivity, the Android framework helps you build rich cloud-enabled apps that sync their data to a remote web service, making sure all your devices always stay in sync, and your valuable diff --git a/docs/html/wear/css/wear.css b/docs/html/wear/css/wear.css index fe9eef290f1a..7c8d1a9cbf30 100644 --- a/docs/html/wear/css/wear.css +++ b/docs/html/wear/css/wear.css @@ -143,7 +143,7 @@ } .wear-hero { - height: calc(100% - 70px); + height: calc(100% - 122px); min-height: 504px; margin-top: 0; padding-top: 0; diff --git a/docs/html/wear/index.jd b/docs/html/wear/index.jd index 659e9f20b12c..e0a8d128e8bd 100644 --- a/docs/html/wear/index.jd +++ b/docs/html/wear/index.jd @@ -15,7 +15,6 @@ page.customHeadTag=<link rel="stylesheet" type="text/css" href="/wear/css/wear.c - <div id="video-container"> <div id="video-frame"> <div class="video-close"> @@ -397,7 +396,7 @@ $("#icon-video-close").on("click", function() { <script> $("a.wear-down-arrow").on("click", function(e) { $("body").animate({ - scrollTop: $(".wear-hero").height() + 76 + scrollTop: $(".wear-hero").height() + 128 }, 1000, "easeOutQuint"); e.preventDefault(); }); diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 685da13b8ada..d894e4eb2f10 100755 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -32,12 +32,11 @@ import static com.android.server.am.ActivityManagerService.VALIDATE_TOKENS; import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE; import static com.android.server.am.ActivityStackSupervisor.DEBUG_APP; +import static com.android.server.am.ActivityStackSupervisor.DEBUG_CONTAINERS; import static com.android.server.am.ActivityStackSupervisor.DEBUG_SAVED_STATE; import static com.android.server.am.ActivityStackSupervisor.DEBUG_STATES; import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID; -import static com.android.server.am.ActivityStackSupervisor.ActivityContainer.CONTAINER_STATE_HAS_SURFACE; - import com.android.internal.os.BatteryStatsImpl; import com.android.server.Watchdog; import com.android.server.am.ActivityManagerService.ItemMatcher; @@ -1275,7 +1274,7 @@ final class ActivityStack { ActivityRecord parent = mActivityContainer.mParentActivity; if ((parent != null && parent.state != ActivityState.RESUMED) || - !mActivityContainer.isAttached()) { + !mActivityContainer.isAttachedLocked()) { // Do not resume this stack if its parent is not resumed. // TODO: If in a loop, make sure that parent stack resumeTopActivity is called 1st. return false; @@ -2539,11 +2538,14 @@ final class ActivityStack { || prevState == ActivityState.INITIALIZING) { // If this activity is already stopped, we can just finish // it right now. - boolean activityRemoved = destroyActivityLocked(r, true, - oomAdj, "finish-imm"); + r.makeFinishing(); + boolean activityRemoved = destroyActivityLocked(r, true, oomAdj, "finish-imm"); if (activityRemoved) { mStackSupervisor.resumeTopActivitiesLocked(); } + if (DEBUG_CONTAINERS) Slog.d(TAG, + "destroyActivityLocked: finishCurrentActivityLocked r=" + r + + " destroy returned removed=" + activityRemoved); return activityRemoved ? null : r; } @@ -2912,6 +2914,7 @@ final class ActivityStack { if (r != null) { mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r); } + if (DEBUG_CONTAINERS) Slog.d(TAG, "activityDestroyedLocked: r=" + r); if (isInStackLocked(token) != null) { if (r.state == ActivityState.DESTROYING) { @@ -3669,7 +3672,7 @@ final class ActivityStack { mStacks.remove(this); mStacks.add(0, this); } - mActivityContainer.onTaskListEmpty(); + mActivityContainer.onTaskListEmptyLocked(); } } diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index ed6a8bbb9a7f..bca215dde51a 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -105,6 +105,7 @@ public final class ActivityStackSupervisor implements DisplayListener { static final boolean DEBUG_SAVED_STATE = DEBUG || false; static final boolean DEBUG_STATES = DEBUG || false; static final boolean DEBUG_IDLE = DEBUG || false; + static final boolean DEBUG_CONTAINERS = DEBUG || false; public static final int HOME_STACK_ID = 0; @@ -127,6 +128,7 @@ public final class ActivityStackSupervisor implements DisplayListener { static final int HANDLE_DISPLAY_REMOVED = FIRST_SUPERVISOR_STACK_MSG + 7; static final int CONTAINER_CALLBACK_VISIBILITY = FIRST_SUPERVISOR_STACK_MSG + 8; static final int CONTAINER_CALLBACK_TASK_LIST_EMPTY = FIRST_SUPERVISOR_STACK_MSG + 9; + static final int CONTAINER_TASK_LIST_EMPTY_TIMEOUT = FIRST_SUPERVISOR_STACK_MSG + 10; private final static String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay"; @@ -224,7 +226,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // TODO: Add listener for removal of references. /** Mapping from (ActivityStack/TaskStack).mStackId to their current state */ - SparseArray<ActivityContainer> mActivityContainers = new SparseArray<ActivityContainer>(); + private SparseArray<ActivityContainer> mActivityContainers = new SparseArray<ActivityContainer>(); /** Mapping from displayId to display current state */ private final SparseArray<ActivityDisplay> mActivityDisplays = @@ -2161,8 +2163,10 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityContainer createActivityContainer(ActivityRecord parentActivity, IActivityContainerCallback callback) { - ActivityContainer activityContainer = new VirtualActivityContainer(parentActivity, callback); + ActivityContainer activityContainer = + new VirtualActivityContainer(parentActivity, callback); mActivityContainers.put(activityContainer.mStackId, activityContainer); + if (DEBUG_CONTAINERS) Slog.d(TAG, "createActivityContainer: " + activityContainer); parentActivity.mChildContainers.add(activityContainer); return activityContainer; } @@ -2171,6 +2175,8 @@ public final class ActivityStackSupervisor implements DisplayListener { final ArrayList<ActivityContainer> childStacks = parentActivity.mChildContainers; for (int containerNdx = childStacks.size() - 1; containerNdx >= 0; --containerNdx) { ActivityContainer container = childStacks.remove(containerNdx); + if (DEBUG_CONTAINERS) Slog.d(TAG, "removeChildActivityContainers: removing " + + container); container.release(); } } @@ -2178,11 +2184,8 @@ public final class ActivityStackSupervisor implements DisplayListener { void deleteActivityContainer(IActivityContainer container) { ActivityContainer activityContainer = (ActivityContainer)container; if (activityContainer != null) { - activityContainer.mStack.finishAllActivitiesLocked(); - final ActivityRecord parent = activityContainer.mParentActivity; - if (parent != null) { - parent.mChildContainers.remove(activityContainer); - } + if (DEBUG_CONTAINERS) Slog.d(TAG, "deleteActivityContainer: ", + new RuntimeException("here").fillInStackTrace()); final int stackId = activityContainer.mStackId; mActivityContainers.remove(stackId); mWindowManager.removeStack(stackId); @@ -2765,16 +2768,19 @@ public final class ActivityStackSupervisor implements DisplayListener { @Override public void onDisplayAdded(int displayId) { + Slog.v(TAG, "Display added displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_ADDED, displayId, 0)); } @Override public void onDisplayRemoved(int displayId) { + Slog.v(TAG, "Display removed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_REMOVED, displayId, 0)); } @Override public void onDisplayChanged(int displayId) { + Slog.v(TAG, "Display changed displayId=" + displayId); mHandler.sendMessage(mHandler.obtainMessage(HANDLE_DISPLAY_CHANGED, displayId, 0)); } @@ -2950,6 +2956,13 @@ public final class ActivityStackSupervisor implements DisplayListener { } } } break; + case CONTAINER_TASK_LIST_EMPTY_TIMEOUT: { + synchronized (mService) { + Slog.w(TAG, "Timeout waiting for all activities in task to finish. " + + msg.obj); + ((ActivityContainer) msg.obj).onTaskListEmptyLocked(); + } + } break; } } } @@ -3006,8 +3019,10 @@ public final class ActivityStackSupervisor implements DisplayListener { @Override public int getDisplayId() { - if (mActivityDisplay != null) { - return mActivityDisplay.mDisplayId; + synchronized (mService) { + if (mActivityDisplay != null) { + return mActivityDisplay.mDisplayId; + } } return -1; } @@ -3016,10 +3031,12 @@ public final class ActivityStackSupervisor implements DisplayListener { public boolean injectEvent(InputEvent event) { final long origId = Binder.clearCallingIdentity(); try { - if (mActivityDisplay != null) { - return mInputManagerInternal.injectInputEvent(event, - mActivityDisplay.mDisplayId, - InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); + synchronized (mService) { + if (mActivityDisplay != null) { + return mInputManagerInternal.injectInputEvent(event, + mActivityDisplay.mDisplayId, + InputManager.INJECT_INPUT_EVENT_MODE_ASYNC); + } } return false; } finally { @@ -3029,10 +3046,23 @@ public final class ActivityStackSupervisor implements DisplayListener { @Override public void release() { - mContainerState = CONTAINER_STATE_FINISHING; - mStack.finishAllActivitiesLocked(); - detachLocked(); - mWindowManager.removeStack(mStackId); + synchronized (mService) { + if (mContainerState == CONTAINER_STATE_FINISHING) { + return; + } + mContainerState = CONTAINER_STATE_FINISHING; + + final Message msg = + mHandler.obtainMessage(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this); + mHandler.sendMessageDelayed(msg, 1000); + + long origId = Binder.clearCallingIdentity(); + try { + mStack.finishAllActivitiesLocked(); + } finally { + Binder.restoreCallingIdentity(origId); + } + } } private void detachLocked() { @@ -3123,15 +3153,17 @@ public final class ActivityStackSupervisor implements DisplayListener { return ActivityStackSupervisor.this; } - boolean isAttached() { + boolean isAttachedLocked() { return mActivityDisplay != null; } void getBounds(Point outBounds) { - if (mActivityDisplay != null) { - mActivityDisplay.getBounds(outBounds); - } else { - outBounds.set(0, 0); + synchronized (mService) { + if (mActivityDisplay != null) { + mActivityDisplay.getBounds(outBounds); + } else { + outBounds.set(0, 0); + } } } @@ -3154,7 +3186,12 @@ public final class ActivityStackSupervisor implements DisplayListener { return true; } - void onTaskListEmpty() { + void onTaskListEmptyLocked() { + mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this); + if (!mStack.isHomeStack()) { + detachLocked(); + deleteActivityContainer(this); + } mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget(); } @@ -3173,7 +3210,7 @@ public final class ActivityStackSupervisor implements DisplayListener { mParentActivity = parent; mCallback = callback; mContainerState = CONTAINER_STATE_NO_SURFACE; - mIdString = "VirtualActivtyContainer{" + mStackId + ", parent=" + mParentActivity + "}"; + mIdString = "VirtualActivityContainer{" + mStackId + ", parent=" + mParentActivity + "}"; } @Override @@ -3219,22 +3256,22 @@ public final class ActivityStackSupervisor implements DisplayListener { } } - setSurfaceIfReady(); + setSurfaceIfReadyLocked(); if (DEBUG_STACK) Slog.d(TAG, "setSurface: " + this + " to display=" + virtualActivityDisplay); } @Override - boolean isAttached() { - return mSurface != null && super.isAttached(); + boolean isAttachedLocked() { + return mSurface != null && super.isAttachedLocked(); } @Override void setDrawn() { synchronized (mService) { mDrawn = true; - setSurfaceIfReady(); + setSurfaceIfReadyLocked(); } } @@ -3244,8 +3281,8 @@ public final class ActivityStackSupervisor implements DisplayListener { return false; } - private void setSurfaceIfReady() { - if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReady: mDrawn=" + mDrawn + + private void setSurfaceIfReadyLocked() { + if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn + " mContainerState=" + mContainerState + " mSurface=" + mSurface); if (mDrawn && mSurface != null && mContainerState == CONTAINER_STATE_NO_SURFACE) { ((VirtualActivityDisplay) mActivityDisplay).setSurface(mSurface); diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java index 81db8b306aa0..72b403405bb8 100644 --- a/services/core/java/com/android/server/wm/TaskStack.java +++ b/services/core/java/com/android/server/wm/TaskStack.java @@ -154,7 +154,8 @@ public class TaskStack { for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { final ArrayList<WindowState> windows = activities.get(activityNdx).allAppWindows; for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { - if (windows.get(winNdx).mWinAnimator.isAnimating()) { + final WindowStateAnimator winAnimator = windows.get(winNdx).mWinAnimator; + if (winAnimator.isAnimating() && !winAnimator.isDummyAnimation()) { return true; } } @@ -236,9 +237,22 @@ public class TaskStack { void detachDisplay() { EventLog.writeEvent(EventLogTags.WM_STACK_REMOVED, mStackId); + + boolean doAnotherLayoutPass = false; for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) { - mService.tmpRemoveTaskWindowsLocked(mTasks.get(taskNdx)); + final AppTokenList appWindowTokens = mTasks.get(taskNdx).mAppTokens; + for (int appNdx = appWindowTokens.size() - 1; appNdx >= 0; --appNdx) { + final WindowList appWindows = appWindowTokens.get(appNdx).allAppWindows; + for (int winNdx = appWindows.size() - 1; winNdx >= 0; --winNdx) { + mService.removeWindowInnerLocked(null, appWindows.get(winNdx)); + doAnotherLayoutPass = true; + } + } } + if (doAnotherLayoutPass) { + mService.requestTraversalLocked(); + } + mAnimationBackgroundSurface.destroySurface(); mAnimationBackgroundSurface = null; mDimLayer.destroySurface(); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 28d9fcddbc9a..5626c7a2aad0 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2488,7 +2488,7 @@ public class WindowManagerService extends IWindowManager.Stub Binder.restoreCallingIdentity(origId); } - private void removeWindowInnerLocked(Session session, WindowState win) { + void removeWindowInnerLocked(Session session, WindowState win) { if (win.mRemoved) { // Nothing to do. return; |