Merge "docs: Quick fix to Google Play TOC" into mnc-mr-docs
diff --git a/docs/html/distribute/googleplay/work/about.jd b/docs/html/distribute/googleplay/work/about.jd
index 20fec7a..a31bca2 100644
--- a/docs/html/distribute/googleplay/work/about.jd
+++ b/docs/html/distribute/googleplay/work/about.jd
@@ -66,7 +66,9 @@
<li>Request the minimum permissions that your app needs.</li>
<li>Make sure communication to your backend and data in your backend is secure.</li>
<li>Implement authorization policies that will minimize the number of your employees that can access user data.</li>
- <li><a href={@docRoot}training/enterprise/app-compatibility.html">Offer compatibility with work profile</a> and test that with the <a href="{@docRoot}samples/BasicManagedProfile/index.html">BasicManagedProfile sample app</a>.</li>
+ <li><a href={@docRoot}training/enterprise/app-compatibility.html>Offer compatibility with work
+ profile</a> and test that with the <a href="{@docRoot}samples/BasicManagedProfile/index.html"
+ >BasicManagedProfile sample app</a>.</li>
<li>Support <a href="{@docRoot}training/enterprise/app-restrictions.html">app restrictions</a> so that IT admins can remotely configure your app through leading EMM solutions.</li>
</ul>
diff --git a/docs/html/ndk/downloads/index.jd b/docs/html/ndk/downloads/index.jd
index 9ac3b46..116bbbb 100644
--- a/docs/html/ndk/downloads/index.jd
+++ b/docs/html/ndk/downloads/index.jd
@@ -317,295 +317,52 @@
$('#Downloads').after($('#download-table'));
</script>
- <h2 id="extract">Extraction</h2>
- <p>The NDK package is a self-extracting binary. To unpack it, follow the procedure for your
- development platform:</p>
- <ul>
- <li>On Linux and Mac OS X (Darwin):
- <ul>
- <ol>
- <li>Download the appropriate package from this page.</li>
- <li>Open a terminal window.</li>
- <li>Go to the directory to which you downloaded the package.</li>
- <li>Run <code>chmod a+x</code> on the downloaded package.</li>
- <li>Execute the package. For example:
- <pre class="no-pretty-print">
-ndk$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
-ndk$ ./android-ndk-r10c-darwin-x86_64.bin
- </pre></li>
- <p>The folder containing the NDK extracts itself.</p>
- <p>You can also use a program like 7z to extract the package.</p>
- </ol>
- </ul>
- </li>
- <li>On Windows:</li>
- <ul>
- <ol>
- <li>Download the appropriate package from this page.</li>
- <li>Navigate to the folder to which you downloaded the package.</li>
- <li>Double-click the downloaded file. The folder containing the NDK extracts itself.</li>
- </ol>
- </ul>
- </ul>When uncompressed, the NDK files are contained in a directory called
- <code>android-ndk-<version></code>. You can rename the NDK directory if necessary and you
- can move it to any location on your computer. This documentation refers to the NDK directory as
- <code><ndk></code>.
-
-
- <p>You are now ready to start working with the NDK.</p>
-
<h2 id="rel">Release Notes</h2>
- <p>Android NDK, Revision 11</a> <em>(March 2016)</em></p>
- <dl>
- <dt>Clang</dt>
- <dd>
- <ul>
- <li>Important announcements
- <ul>
- <li>We strongly recommend switching to Clang.
- <ul>
- <li>If you experience problems with Clang, file bugs
- <a href="https://github.com/android-ndk/ndk/issues">here</a> for issues
- specific to Clang in the NDK. For more general Clang issues,
- file bugs by following the instructions on
- <a href="http://llvm.org/docs/HowToSubmitABug.html">this page</a>.</li>
- </ul>
- </li>
- <li>Clang has been updated to 3.8svn (r243773, build 2481030).
- <ul>
- <li>This version is a nearly pure upstream Clang.</li>
- <li>The Windows 64-bit downloadable NDK package contains a 32-bit
- version of Clang.</li>
- </ul>
- </li>
- </ul>
- </li>
-
- <li>Additions
- <ul>
- <li>Clang now provides support for emulated TLS.
- <ul>
- <li>The compiler now supports {@code __thread} by emulating
- ELF TLS with pthread thread-specific data.</li>
- <li>C++11 {@code thread_local} works in some cases, but not
- for data with non-trivial destructors, because those cases
- require support from libc. This limitation does not
- apply when running on Android 6.0 (API level 23) or newer.</li>
- <li>Emulated TLS does not yet work with Aarch64 when
- TLS variables are accessed from a shared library.</li>
- </ul>
- </li>
- </ul>
- </dd>
- <dl>
-
- <dl>
- <dt>GCC</dt>
- <dd>
- <ul>
- <li>Important announcements</li>
- <ul>
- <li>GCC in the NDK is now deprecated in favor of Clang.
- <ul>
- <li>The NDK will neither be upgrading to 5.x, nor accept
- non-critical backports.</li>
- <li>Maintenance for miscompiles and internal compiler errors
- in 4.9 will be handled on a case by case basis.</li>
- </ul>
- </li>
- </ul>
- <li>Removals
- <ul>
- <li>Removed GCC 4.8. All targets now use GCC 4.9.</li>
- </ul>
- </li>
- <li>Other changes
- <ul>
- <li>Synchronized google/gcc-4_9 to r224707. Previously, it had been
- synchronized with r214835.</li>
- </ul>
- </li>
- </ul>
- </dd>
- <dl>
+ <p>Android NDK, Revision 11b</a> <em>(March 2016)</em></p>
<dl>
<dt>NDK</dt>
<dd>
<ul>
<li>Important announcements
- <ul>
- <li>The samples are no longer included in the NDK package.
- They are instead available on
- <a href="https://github.com/googlesamples/android-ndk">GitHub.</a>
- </li>
- <li>The documentation is no longer included in the NDK package.
- Instead, it is on the <a href="{@docRoot}ndk/index.html">Android
- developer website.</a></li>
- </ul>
- </li>
+ <ul>
+ <li>We’ve moved our bug tracker to <a href="https://github.com/android-ndk/ndk/issues">
+ GitHub.</a></li>
+ </ul>
+ </li>
- <li>Additions
- <ul>
- <li>Added a native tracing API to {@code android-23}.</li>
- <li>Added a native multinetwork API to {@code android-23}.</li>
- <li>Enabled libc, m, and dl to provide versioned symbols, starting
- from API level 21.</li>
- <li>Added Vulkan headers and library to API level N.</li>
- </ul>
- </li>
-
- <li>Removals
- <ul>
- <li>Removed support for {@code _WCHAR_IS_8BIT}.</li>
- <li>Removed sed.</li>
- <li>Removed mclinker.</li>
- <li>Removed Perl.</li>
- <li>Removed from all versions of NDK libc, m, and dl all symbols which
- the platform versions of those libs do not support.</li>
- <li>Partially removed support for mips64r2. The rest will be removed
- in the future.</li>
- </ul>
- </li>
-
- <li>Other changes
- <ul>
- <li>Changed ARM standalone toolchains to default to arm7.
- <ul>
- <li>You can restore the old behavior by passing specifying the
- {@code -target} option as {@code armv5te-linux-androideabi}.
- </li>
- </ul>
- </li>
- <li>Changed the build system to use {@code -isystem} for platform
- includes.
- <ul>
- <li>Warnings that bionic causes no longer break app builds.</li>
- </ul>
+ <li>Changes
+ <ul>
+ <li>{@code ndk-gdb.py} is fixed. It had
+ <a href="https://github.com/android-ndk/ndk/issues/3">regressed entirely</a>
+ in r11.</li>
+ <li>{@code ndk-gdb} for Mac <a href="https://github.com/android-ndk/ndk/issues/2">
+ is fixed</a>.</li>
+ <li>Added more top-level shortcuts for command line tools:
+ <ul>
+ <li>{@code ndk-depends}.</li>
+ <li>{@code ndk-gdb}.</li>
+ <li>{@code ndk-stack}.</li>
+ <li>{@code ndk-which}. This command had been entirely absent from previous
+ releases.</li>
+ </ul>
+ </li>
+ <li>Fixed standalone toolchains for libc++, which had been missing
+ {@code __cxxabi_config.h}.</li>
+ <li>Fixed help documentation for {@code --toolchain} in
+ {@code make-standalone-toolchain.sh}.</li>
</li>
- <li>Fixed a segfault that occurred when a binary threw exceptions
- via gabi++. (Issue <a href="http://b.android.com/179410">179410</a>)
- </li>
- <li>Changed libc++’s inline namespace to {@code std::__ndk1}
- to prevent ODR issues with platform libc++.</li>
-
- <li>All libc++ libraries are now built with libc++abi.
- <li>Bumped default {@code APP_PLATFORM} to Gingerbread.
- <ul>
- <li>Expect support for Froyo and older to be dropped in a
- future release.</ul>
- </ul>
- <li>Updated gabi++ {@code _Unwind_Exception} struct for 64 bits.
- <li>Added the following capabilities to cpufeatures:
- <ul>
- <li>Detect SSE4.1 and SSE4.2.</li>
- <li>Detect cpu features on x86_64.</li>
- </ul>
- </li>
- <li>Updated libc++abi to upstream
- <a href="http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150302/124603.html">
- r231075</a>.
- <li>Updated {@code byteswap.h}, {@code endian.h}, {@code sys/procfs.h},
- {@code sys/ucontext.h}, {@code sys/user.h}, and {@code uchar.h} from
- ToT Bionic.
- <li>Synchronized {@code sys/cdefs.h} across all API levels.
-
- <li>Fixed {@code fegetenv and fesetenv} for arm.
- <li>Fix end pointer size/alignment of {@code crtend_*} for mips64
- and x86_64.
- </ul>
- </li>
- </ul>
- </ul>
+ </ul>
</dd>
<dl>
- <dl>
- <dt>Binutils</dt>
+ <dt>Clang</dt>
<dd>
<ul>
- <li>Additions
- <ul>
- <li>Added a new option: {@code --pic-veneer}.</li>
- </ul>
- </li>
-
- <li>Removals
- <ul>
- <li>The 32-bit Windows package no longer contains ld.gold.
- You can instead get ld.gold from the 64-bit Windows package.</li>
- </ul>
- </li>
-
- <li>Changes
+ <li>Errata</li>
<ul>
- <li>Unified binutils source between Android and ChromiumOS.
- For more information on this change, see the comments
- <a href="https://android-review.googlesource.com/#/c/182865/">
- here.</a></li>
- <li>Improved reliability of Gold for aarch64. Use
- {@code -fuse-ld=gold} at link time to use gold instead of bfd.
- The default will likely switch in the next release.</li>
- <li>Improved linking time for huge binaries for Gold ARM back end
- (up to 50% linking time reduction for debuggable Chrome Browser).
- </li>
+ <li>Contrary to what we reported in the r11 Release Notes, {@code __thread}
+ does not work. This is because the version of Clang we ship is missing a bug fix for
+ emulated TLS support.</li>
</ul>
- </li>
- </ul>
- </dd>
- <dl>
- <dl>
- <dt>GDB</dt>
- <dd>
- <ul>
-
- <li>Removals
- <ul>
- <li>Removed ndk-gdb in favor of ndk-gdb.py.</li>
- </ul>
- </li>
-
- <li>Changes
- <ul>
- <li>Updated gdb to version 7.10.</li>
- <li>Improved performance.</li>
- <li>Improved error messages.</li>
- <li>Fixed relative project paths.</li>
- <li>Stopped Ctrl-C from killing the backgrounded gdbserver.</li>
- <li>Improved Windows support.</li>
- </ul>
- </li>
- </ul>
- </dd>
-
- <dl>
- <dl>
- <dt>YASM</dt>
- <dd>
- <ul>
-
- <li>Changes
- <ul>
- <li>Updated YASM to version 1.3.0.</li>
- </ul>
- </li>
- </ul>
- </dd>
-
- <dl>
- <dl>
- <dt>Known issues</dt>
- <dd>
- <ul>
- <li>x86 ASAN does not currently work. For more information, see the
- discussion <a href="https://android-review.googlesource.com/#/c/186276/">
- here.</a></li>
- <li>The combination of Clang, x86, stlport_static, and optimization
- levels higher than {@code -O0} causes test failures with
- {@code dynamic_cast}. For more information, see the comments
- <a href="https://android-review.googlesource.com/#/c/185920">here</a>.
- </li>
- <li>Exception handling often fails with c++_shared on ARM32. The root
- cause is incompatibility between the LLVM unwinder that libc++abi uses
- for ARM32 and libgcc. This behavior is not a regression from r10e.</li>
</ul>
</dd>
diff --git a/docs/html/ndk/downloads/revision_history.jd b/docs/html/ndk/downloads/revision_history.jd
index b3ea858..b150045 100644
--- a/docs/html/ndk/downloads/revision_history.jd
+++ b/docs/html/ndk/downloads/revision_history.jd
@@ -5,6 +5,270 @@
took place in each new version.</p>
<div class="toggle-content closed">
+<a name="11"></a>
+ <p>
+ <a href="#" onclick="return toggleContent(this)"> <img
+ src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
+ >Android NDK, Revision 11</a> <em>(March 2016)</em>
+ </p>
+ <div class="toggle-content-toggleme">
+ <dl>
+ <dt>Clang</dt>
+ <dd>
+ <ul>
+ <li>Important announcements
+ <ul>
+ <li>We strongly recommend switching to Clang.
+ <ul>
+ <li>If you experience problems with Clang, file bugs
+ <a href="https://github.com/android-ndk/ndk/issues">here</a> for issues
+ specific to Clang in the NDK. For more general Clang issues,
+ file bugs by following the instructions on
+ <a href="http://llvm.org/docs/HowToSubmitABug.html">this page</a>.</li>
+ </ul>
+ </li>
+ <li>Clang has been updated to 3.8svn (r243773, build 2481030).
+ <ul>
+ <li>This version is a nearly pure upstream Clang.</li>
+ <li>The Windows 64-bit downloadable NDK package contains a 32-bit
+ version of Clang.</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+
+ <li>Additions
+ <ul>
+ <li>Clang now provides support for emulated TLS.
+ <ul>
+ <li>The compiler now supports {@code __thread} by emulating
+ ELF TLS with pthread thread-specific data.</li>
+ <li>C++11 {@code thread_local} works in some cases, but not
+ for data with non-trivial destructors, because those cases
+ require support from libc. This limitation does not
+ apply when running on Android 6.0 (API level 23) or newer.</li>
+ <li>Emulated TLS does not yet work with Aarch64 when
+ TLS variables are accessed from a shared library.</li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ <dl>
+
+ <dl>
+ <dt>GCC</dt>
+ <dd>
+ <ul>
+ <li>Important announcements</li>
+ <ul>
+ <li>GCC in the NDK is now deprecated in favor of Clang.
+ <ul>
+ <li>The NDK will neither be upgrading to 5.x, nor accept
+ non-critical backports.</li>
+ <li>Maintenance for miscompiles and internal compiler errors
+ in 4.9 will be handled on a case by case basis.</li>
+ </ul>
+ </li>
+ </ul>
+ <li>Removals
+ <ul>
+ <li>Removed GCC 4.8. All targets now use GCC 4.9.</li>
+ </ul>
+ </li>
+ <li>Other changes
+ <ul>
+ <li>Synchronized google/gcc-4_9 to r224707. Previously, it had been
+ synchronized with r214835.</li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ <dl>
+ <dl>
+ <dt>NDK</dt>
+ <dd>
+ <ul>
+ <li>Important announcements
+ <ul>
+ <li>The samples are no longer included in the NDK package.
+ They are instead available on
+ <a href="https://github.com/googlesamples/android-ndk">GitHub.</a>
+ </li>
+ <li>The documentation is no longer included in the NDK package.
+ Instead, it is on the <a href="{@docRoot}ndk/index.html">Android
+ developer website.</a></li>
+ </ul>
+ </li>
+
+ <li>Additions
+ <ul>
+ <li>Added a native tracing API to {@code android-23}.</li>
+ <li>Added a native multinetwork API to {@code android-23}.</li>
+ <li>Enabled libc, m, and dl to provide versioned symbols, starting
+ from API level 21.</li>
+ <li>Added Vulkan headers and library to API level N.</li>
+ </ul>
+ </li>
+
+ <li>Removals
+ <ul>
+ <li>Removed support for {@code _WCHAR_IS_8BIT}.</li>
+ <li>Removed sed.</li>
+ <li>Removed mclinker.</li>
+ <li>Removed Perl.</li>
+ <li>Removed from all versions of NDK libc, m, and dl all symbols which
+ the platform versions of those libs do not support.</li>
+ <li>Partially removed support for mips64r2. The rest will be removed
+ in the future.</li>
+ </ul>
+ </li>
+
+ <li>Other changes
+ <ul>
+ <li>Changed ARM standalone toolchains to default to arm7.
+ <ul>
+ <li>You can restore the old behavior by passing specifying the
+ {@code -target} option as {@code armv5te-linux-androideabi}.
+ </li>
+ </ul>
+ </li>
+ <li>Changed the build system to use {@code -isystem} for platform
+ includes.
+ <ul>
+ <li>Warnings that bionic causes no longer break app builds.</li>
+ </ul>
+ </li>
+ <li>Fixed a segfault that occurred when a binary threw exceptions
+ via gabi++. (Issue <a href="http://b.android.com/179410">179410</a>)
+ </li>
+ <li>Changed libc++’s inline namespace to {@code std::__ndk1}
+ to prevent ODR issues with platform libc++.</li>
+
+ <li>All libc++ libraries are now built with libc++abi.
+ <li>Bumped default {@code APP_PLATFORM} to Gingerbread.
+ <ul>
+ <li>Expect support for Froyo and older to be dropped in a
+ future release.</ul>
+ </ul>
+ <li>Updated gabi++ {@code _Unwind_Exception} struct for 64 bits.
+ <li>Added the following capabilities to cpufeatures:
+ <ul>
+ <li>Detect SSE4.1 and SSE4.2.</li>
+ <li>Detect cpu features on x86_64.</li>
+ </ul>
+ </li>
+ <li>Updated libc++abi to upstream
+ <a href="http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20150302/124603.html">
+ r231075</a>.
+ <li>Updated {@code byteswap.h}, {@code endian.h}, {@code sys/procfs.h},
+ {@code sys/ucontext.h}, {@code sys/user.h}, and {@code uchar.h} from
+ ToT Bionic.
+ <li>Synchronized {@code sys/cdefs.h} across all API levels.
+
+ <li>Fixed {@code fegetenv and fesetenv} for arm.
+ <li>Fix end pointer size/alignment of {@code crtend_*} for mips64
+ and x86_64.
+ </ul>
+ </li>
+ </ul>
+ </ul>
+ </dd>
+ <dl>
+ <dl>
+ <dt>Binutils</dt>
+ <dd>
+ <ul>
+ <li>Additions
+ <ul>
+ <li>Added a new option: {@code --pic-veneer}.</li>
+ </ul>
+ </li>
+
+ <li>Removals
+ <ul>
+ <li>The 32-bit Windows package no longer contains ld.gold.
+ You can instead get ld.gold from the 64-bit Windows package.</li>
+ </ul>
+ </li>
+
+ <li>Changes
+ <ul>
+ <li>Unified binutils source between Android and ChromiumOS.
+ For more information on this change, see the comments
+ <a href="https://android-review.googlesource.com/#/c/182865/">
+ here.</a></li>
+ <li>Improved reliability of Gold for aarch64. Use
+ {@code -fuse-ld=gold} at link time to use gold instead of bfd.
+ The default will likely switch in the next release.</li>
+ <li>Improved linking time for huge binaries for Gold ARM back end
+ (up to 50% linking time reduction for debuggable Chrome Browser).
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ <dl>
+ <dl>
+ <dt>GDB</dt>
+ <dd>
+ <ul>
+
+ <li>Removals
+ <ul>
+ <li>Removed ndk-gdb in favor of ndk-gdb.py.</li>
+ </ul>
+ </li>
+
+ <li>Changes
+ <ul>
+ <li>Updated gdb to version 7.10.</li>
+ <li>Improved performance.</li>
+ <li>Improved error messages.</li>
+ <li>Fixed relative project paths.</li>
+ <li>Stopped Ctrl-C from killing the backgrounded gdbserver.</li>
+ <li>Improved Windows support.</li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+
+ <dl>
+ <dl>
+ <dt>YASM</dt>
+ <dd>
+ <ul>
+
+ <li>Changes
+ <ul>
+ <li>Updated YASM to version 1.3.0.</li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+
+ <dl>
+ <dl>
+ <dt>Known issues</dt>
+ <dd>
+ <ul>
+ <li>x86 ASAN does not currently work. For more information, see the
+ discussion <a href="https://android-review.googlesource.com/#/c/186276/">
+ here.</a></li>
+ <li>The combination of Clang, x86, stlport_static, and optimization
+ levels higher than {@code -O0} causes test failures with
+ {@code dynamic_cast}. For more information, see the comments
+ <a href="https://android-review.googlesource.com/#/c/185920">here</a>.
+ </li>
+ <li>Exception handling often fails with c++_shared on ARM32. The root
+ cause is incompatibility between the LLVM unwinder that libc++abi uses
+ for ARM32 and libgcc. This behavior is not a regression from r10e.</li>
+ </ul>
+ </dd>
+ </dl>
+
+ </div>
+</div>
+<div class="toggle-content closed">
<a name="10e"></a>
<p>
<a href="#" onclick="return toggleContent(this)"> <img
diff --git a/docs/html/sdk/sdk_vars.cs b/docs/html/sdk/sdk_vars.cs
index 7e17801..972980d 100644
--- a/docs/html/sdk/sdk_vars.cs
+++ b/docs/html/sdk/sdk_vars.cs
@@ -39,18 +39,18 @@
set:sdk.win_installer_checksum='f9b59d72413649d31e633207e31f456443e7ea0b' ?><?cs
-set:ndk.mac64_download='android-ndk-r11-darwin-x86_64.zip' ?><?cs
-set:ndk.mac64_bytes='772314112' ?><?cs
-set:ndk.mac64_checksum='a3764714eff7d187c80d989a9bf1ff8ebf5a0dfa' ?><?cs
+set:ndk.mac64_download='android-ndk-r11b-darwin-x86_64.zip' ?><?cs
+set:ndk.mac64_bytes='772411311' ?><?cs
+set:ndk.mac64_checksum='c64fb355fec4da57d329ab45bf0aa29a1aec58dc' ?><?cs
-set:ndk.linux64_download='android-ndk-r11-linux-x86_64.zip' ?><?cs
-set:ndk.linux64_bytes='794012672' ?><?cs
-set:ndk.linux64_checksum='7b4e0d13f6bbf48dd87475be9d052273dc766fb6' ?><?cs
+set:ndk.linux64_download='android-ndk-r11b-linux-x86_64.zip' ?><?cs
+set:ndk.linux64_bytes='794138413' ?><?cs
+set:ndk.linux64_checksum='cf0658956945c81d3d3fad5f9a24fa062d4c9d41' ?><?cs
-set:ndk.win64_download='android-ndk-r11-windows-x86_64.zip' ?><?cs
-set:ndk.win64_bytes='771291648' ?><?cs
-set:ndk.win64_checksum='49fcdae88724c74bb52b332b648edba9700b9529' ?><?cs
-set:ndk.win32_download='android-ndk-r11-windows-x86.zip' ?><?cs
-set:ndk.win32_bytes='728773632' ?><?cs
-set:ndk.win32_checksum='0c9e895e400ab539c2005759410ef3e33d048291'
+set:ndk.win64_download='android-ndk-r11b-windows-x86_64.zip' ?><?cs
+set:ndk.win64_bytes='771396549' ?><?cs
+set:ndk.win64_checksum='480eca1b29cfe73a5b35374730e6a82ca65c2aa6' ?><?cs
+set:ndk.win32_download='android-ndk-r11b-windows-x86.zip' ?><?cs
+set:ndk.win32_bytes='728894948' ?><?cs
+set:ndk.win32_checksum='b42da395440cc1c5dc4eeeb383679331addeb3ea'
?>
diff --git a/docs/html/training/wearables/data-layer/events.jd b/docs/html/training/wearables/data-layer/events.jd
index c797f68..9bed9d5 100644
--- a/docs/html/training/wearables/data-layer/events.jd
+++ b/docs/html/training/wearables/data-layer/events.jd
@@ -68,72 +68,100 @@
</pre>
-<h2 id="Listen">Listen for Data Layer Events </h2>
-<p>Because the data layer synchronizes and sends data across the handheld and
-wearable, you normally want to listen for important events, such as when data items
-are created, messages are received, or when the wearable and handset are connected.
+<h2 id="Listen">Listen for Data Layer Events</h2>
+<p>
+Because the data layer synchronizes and sends data across the handheld and
+wearable, it is usually necessary to listen for important events. Examples of
+such events include creation of data items and receipt of messages.
</p>
-<p>To listen for data layer events, you have two options:</p>
-
+<p>
+To listen for data layer events, you have two options:
+</p>
<ul>
- <li>Create a service that extends
- <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
- </li>
- <li>Create an activity that implements
- <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataApi.DataListener</code></a>.
- </li>
+ <li>Create a service that extends <a href
+="https://developer.android.com/reference/com/google/android/gms/wearable/WearableListenerService.html">
+{@code WearableListenerService}</a>.</li>
+ <li>Create an activity that implements <a
+href="https://developer.android.com/reference/com/google/android/gms/wearable/DataApi.DataListener.html">
+{@code DataApi.DataListener}</a>.</li>
</ul>
-
-<p>With both these options, you override the data event callback methods for the events you
-are interested in handling.</p>
-
-<h3 id="listener-service">With a WearableListenerService</h3>
+<p>
+With both these options, you override the data event callback methods for the
+events you are interested in handling.
+</p>
+<h3>With a WearableListenerService</h3>
+<p>
+You typically create instances of this service in both your wearable and
+handheld apps. If you are not interested in data events in one of these apps,
+then you don't need to implement this service in that particular app.
+</p>
+<p>
+For example, you can have a handheld app that sets and gets data item objects
+and a wearable app that listens for these updates to update its UI. The
+wearable never updates any of the data items, so the handheld app doesn't
+listen for any data events from the wearable app.
+</p>
+<p>
+Some of the events you can listen for using <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html">
+{@code WearableListenerService}</a> are as follows:
+</p>
+<ul>
+ <li><a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)">
+{@code onDataChanged()}</a>:
+Whenever a data item object is created, deleted, or changed, the system triggers
+this callback on all connected nodes.
+</li>
+<li><a
+href="http://developer.android.com/reference/com/google/android/gms/wearable/WearableListenerService.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)">
+{@code onMessageReceived()}</a>: A message sent from a node triggers
+this callback on the target node.</li>
+<li><a
+href="https://developers.google.com/android/reference/com/google/android/gms/wearable/WearableListenerService.html#onCapabilityChanged(com.google.android.gms.wearable.CapabilityInfo)">
+{@code onCapabilityChanged()}</a>:
+When a capability that an instance of your app advertises becomes available
+on the network, that event triggers this callback. If you're looking for a
+nearby node you can query the
+<a
+href="https://developers.google.com/android/reference/com/google/android/gms/wearable/Node.html#isNearby()">
+{@code isNearby()}</a> method of the nodes provided in the callback.</li>
<p>
-You typically create instances of this service in both your wearable and handheld apps. If you
-are not interested in data events in one of these apps, then you don't need to implement this
-service in that particular app.</p>
-
-<p>For example, you can have a handheld app that sets and gets data item objects and a wearable app
-that listens for these updates to update it's UI. The wearable never updates any of the data items,
-so the handheld app doesn't listen for any data events from the wearable app.</p>
-
-<p>You can listen for the following events with
-<a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:</p>
-
-<ul>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code></a>
-- Called when data item objects are created, changed, or deleted. An event on one side of a connection
-triggers this callback on both sides.</li>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)"><code>onMessageReceived()</code></a>
-- A message sent from one side of a connection triggers this callback on the other side of the connection.</li>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)"><code>onPeerConnected()</code></a>
- and <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onPeerDisconnected(com.google.android.gms.wearable.Node)"><code>onPeerDisconnected()</code></a> -
- Called when the connection with the handheld or wearable is connected or disconnected.
- Changes in connection state on one side of the connection trigger these callbacks on both sides
- of the connection.
- </li>
+In addition to those on this list, you can listen for events from
+<a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener">
+{@code ChannelApi.ChannelListener}</a>, such as
+<a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener.html#onChannelOpened(com.google.android.gms.wearable.Channel)">
+{@code onChannelOpened()}</a>.
+</p>
</ul>
-
-<p>To create a <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:</p>
+<p>To create a <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>, follow these steps:</p>
<ol>
<li>Create a class that extends
- <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
+ <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
</li>
<li>Listen for the events that you're interested in, such as
- <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code></a>.
+ <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)">
+<code>onDataChanged()</code></a>.
</li>
- <li>Declare an intent filter in your Android manifest to notify the system about your
- <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
- This allows the system to bind your service as needed.
+ <li>Declare an intent filter in your Android manifest to notify the system
+about your
+ <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>
+WearableListenerService</code></a>.
+ This declaration allows the system to bind your service as needed.
</li>
</ol>
<p>The following example shows how to implement a simple
- <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:
+ <a
+href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>
+WearableListenerService</code></a>:
</p>
-
<pre>
public class DataLayerListenerService extends WearableListenerService {
@@ -146,7 +174,7 @@
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onDataChanged: " + dataEvents);
}
- final List<DataEvent> events = FreezableUtils
+ final List events = FreezableUtils
.freezeIterable(dataEvents);
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
@@ -179,85 +207,139 @@
}
</pre>
-<p>Here's the corresponding intent filter in the Android manifest file:</p>
+<p>
+The next section explains how to use an intent filter with this listener.
+</p>
+
+<h3>Using filters with WearableListenerService</h3>
+
+<p>
+An intent filter for the
+<a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html">
+{@code WearableListenerService}</a> example shown in the previous section might look like this:
<pre>
<service android:name=".DataLayerListenerService">
- <intent-filter>
- <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
+ <data android:scheme="wear" android:host="*"
+ android:path="/start-activity" />
</intent-filter>
</service>
</pre>
-
-<h4>Permissions within Data Layer Callbacks</h4>
-
<p>
-To deliver callbacks to your application for data layer events, Google Play services
-binds to your <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>,
-and calls your callbacks via IPC. This has the consequence
-that your callbacks inherit the permissions of the calling process.</p>
-
-<p>If you try to perform a privileged operation within a callback, the security check fails because your callback is
-running with the identity of the calling process, instead of the identity of your app's
-process.</p>
-
-<p>To fix this, call {@link android.os.Binder#clearCallingIdentity} </a>,
-to reset identity after crossing the IPC boundary, and then restore identity with
-{@link android.os.Binder#restoreCallingIdentity restoreCallingIdentity()} when
-you've completed the privileged operation:
+In this filter, the {@code DATA_CHANGED} action replaces the
+previously recommended {@code BIND_LISTENER} action so that only specific
+events wake or launch your application. This change improves system efficiency
+and reduces battery consumption and other overhead associated with your
+application. In this example, the watch listens for the
+{@code /start-activity} data item, and the
+phone listens for the {@code /data-item-received} message response.
+</p>
+<p>
+Standard Android filter matching rules apply. You can specify multiple services
+per manifest, multiple intent filters per service, multiple actions per filter,
+and multiple data stanzas per filter. Filters can match on a wildcard host or on
+a specific one. To match on a wildcard host, use {@code host="*"}. To match
+on a specific host, specify {@code host=<node_id>}.
</p>
-<pre>
-long token = Binder.clearCallingIdentity();
-try {
- performOperationRequiringPermissions();
-} finally {
- Binder.restoreCallingIdentity(token);
-}
-</pre>
-
-<h3 id="Listen">With a Listener Activity</h3>
-
<p>
-If your app only cares about data layer events when the user is interacting
-with the app and does not need a long-running service to handle every data
-change, you can listen for events in an activity by implementing one or more
-of the following interfaces:
+You can also match a literal path or path prefix. If you are matching by path
+or path prefix, you must specify a wildcard or specific host.
+If you do not do so, the system ignores the path you specified.
+</p>
+<p>
+For more information on the filter types that Wear supports, see the
+API reference documentation for <a
+href="https://developers.google.com/android/reference/com/google/android/gms/wearable/WearableListenerService">
+{@code WearableListenerService}</a>.
+
+</p>
+<p>
+For more information on data filters and matching rules, see the API reference
+documentation for the <a
+href="{@docRoot}guide/topics/manifest/data-element.html">{@code data}</a>
+manifest element.
+</p>
+
+
+<p>When matching intent filters, there are two important rules to remember:</p>
<ul>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataApi.DataListener</code></a></li>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.MessageListener.html"><code>MessageApi.MessageListener</code></a></li>
- <li><a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html"><code>NodeApi.NodeListener</code></a></li>
+ <li>If a scheme is not specified for the intent filter, the system ignores
+ all the other URI attributes.</li>
+ <li>If no host is specified for the filter, the system ignores the
+ port attribute and all the path attributes.</li>
</ul>
+
+<h3>With a listener activity</h3>
+<p>
+If your app only cares about data-layer events when the user is interacting
+with the app, it may not need a long-running service to handle every data
+change. In such a case, you can listen for events in an activity by
+implementing one or more of the following interfaces:
</p>
+<ul>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>
+ DataApi.DataListener</code></a></li>
+
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.MessageListener.html">
+ <code>MessageApi.MessageListener</code></a></li>
+
+ <li><a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityApi.CapabilityListener.html">{@code CapabilityApi.CapabilityListener}</a></li>
+</ul>
<p>To create an activity that listens for data events:</p>
<ol>
<li>Implement the desired interfaces.</li>
-<li>In {@link android.app.Activity#onCreate}, create an instance of
-<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a>
-to work with the Data Layer API.
+<li>In {@link android.app.Activity#onCreate onCreate()}, create an instance of
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code>
+</a>to work with the Data Layer API.</li>
+
<li>
-In {@link android.app.Activity#onStart onStart()}, call <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()"><code>connect()</code></a> to connect the client to Google Play services.
+In {@link android.app.Activity#onStart onStart()}, call <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()">
+<code>connect()</code></a> to connect the client to Google Play services.
</li>
+
<li>When the connection to Google Play services is established, the system calls
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)"><code>onConnected()</code></a>. This is where you call
-<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.DataApi.DataListener)"><code>DataApi.addListener()</code></a>,
- <a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.MessageApi.MessageListener)"><code>MessageApi.addListener()</code></a>,
- or <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.NodeApi.NodeListener)"><code>NodeApi.addListener()</code></a>
- to notify Google Play services that your activity is interested in listening for data layer events.
-</li>
+
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.DataApi.DataListener)">
+<code>DataApi.addListener()</code></a>,
+
+<a href="{@docRoot}android/reference/com/google/android/gms/wearable/CapabilityApi.CapabilityListener">
+<code>MessageApi.addListener()</code></a>, or
+
+<a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.wearable.CapabilityApi.CapabilityListener,%20android.net.Uri,%20int)">
+{@code CapabilityApi.addListener()}</a> to notify Google Play services that your activity is
+interested in listening for data layer events.</li>
+
<li>In {@link android.app.Activity#onStop onStop()}, unregister any listeners with
<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.DataApi.DataListener)"><code>DataApi.removeListener()</code></a>,
-<a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.MessageApi.MessageListener)"><code>MessageApi.removeListener()</code></a>,
-or <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.NodeApi.NodeListener)"><code>NodeApi.removeListener()</code></a>.
-</li>
-<li>Implement <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code>,
- <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerConnected(com.google.android.gms.wearable.Node)"><code>onMessageReceived()</code></a>,
- <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerConnected(com.google.android.gms.wearable.Node)"><code>onPeerConnected()</code></a>, and
- <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerDisconnected(com.google.android.gms.wearable.Node)"><code>onPeerDisconnected()</code></a>, depending on the interfaces that you implemented.
-</li>
+<a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.MessageApi.MessageListener)"><code>MessageApi.removeListener()</code></a>, or
+<a href="http://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient,%20com.google.android.gms.wearable.MessageApi.MessageListener)">
+{@code CapabilityApi.removeListener()}</a>.</li>
+
+
+<p>An alternative to adding listeners in
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)"><code>onConnected()</code></a>
+and removing them in
+{@link android.app.Activity#onStop onStop()} is to add a filtered listener in an activity’s {@link android.app.Activity#onResume onResume()} and
+remove it in {@link android.app.Activity#onPause onPause()}, so as to only receive data that is relevant to the
+current application state.</p>
+
+
+<li>Implement
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)">
+<code>onDataChanged()</code></a>,
+ <a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/MessageApi.MessageListener.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)">
+ <code>onMessageReceived()</code></a>,
+ <a href="https://developers.google.com/android/reference/com/google/android/gms/wearable/WearableListenerService.html#onCapabilityChanged(com.google.android.gms.wearable.CapabilityInfo)">
+{@code onCapabilityChanged()}</a>,
+or methods from <a href="http://developer.android.com/reference/com/google/android/gms/wearable/ChannelApi.ChannelListener.html">
+Channel API listener methods</a>, depending on the interfaces that you implemented.</li>
</ol>
<p>Here's an example that implements
@@ -318,3 +400,19 @@
}
}
</pre>
+<h3>Using Filters with Listener Activities</h3>
+<p>
+Just as you can specify intent filters for manifest-based
+<a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html">
+<code>WearableListenerService</code></a> objects, you can also use intent filters when registering a
+listener through the Wearable API. The same rules are applicable to both
+API-based listeners manifest-based listeners.
+</p>
+
+<p>
+A common pattern is to register a listener with a specific path or path prefix
+in an activity’s{@link android.app.Activity#onResume onResume()} method, and to
+remove the listener in the activity’s {@link android.app.Activity#onPause onPause()} method.
+Implementing listeners in this fashion allows your application to more selectively receive events,
+improving its design and efficiency.
+</p>