aboutsummaryrefslogtreecommitdiff
path: root/en/devices/tech
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/tech')
-rw-r--r--en/devices/tech/admin/implement.html29
-rw-r--r--en/devices/tech/admin/managed-profiles.html8
-rw-r--r--en/devices/tech/admin/multi-user.html3
-rw-r--r--en/devices/tech/admin/multiuser-apps.html29
-rw-r--r--en/devices/tech/admin/provision.html13
-rw-r--r--en/devices/tech/admin/testing-provision.html68
-rw-r--r--en/devices/tech/admin/testing-setup.html4
-rw-r--r--en/devices/tech/config/carrier.html4
-rw-r--r--en/devices/tech/config/filesystem.html2
-rw-r--r--en/devices/tech/config/kernel.html13
-rw-r--r--en/devices/tech/config/kernel_network_tests.html4
-rw-r--r--en/devices/tech/config/low-ram.html78
-rw-r--r--en/devices/tech/config/runtime_perms.html15
-rw-r--r--en/devices/tech/config/uicc.html19
-rw-r--r--en/devices/tech/connect/block-numbers.html22
-rw-r--r--en/devices/tech/connect/data-saver.html24
-rw-r--r--en/devices/tech/connect/emergency-affordance.html32
-rw-r--r--en/devices/tech/dalvik/configure.html125
-rw-r--r--en/devices/tech/dalvik/dex-format.html8
-rw-r--r--en/devices/tech/dalvik/gc-debug.html49
-rw-r--r--en/devices/tech/dalvik/jit-compiler.html85
-rw-r--r--en/devices/tech/datausage/tags-explained.html5
-rw-r--r--en/devices/tech/debug/asan.html34
-rw-r--r--en/devices/tech/debug/dumpsys.html12
-rw-r--r--en/devices/tech/debug/eval_perf.html6
-rw-r--r--en/devices/tech/debug/ftrace.html109
-rw-r--r--en/devices/tech/debug/gdb.html141
-rw-r--r--en/devices/tech/debug/index.html104
-rw-r--r--en/devices/tech/debug/native-crash.html55
-rw-r--r--en/devices/tech/debug/netstats.html18
-rw-r--r--en/devices/tech/debug/procstats.html6
-rw-r--r--en/devices/tech/debug/strace.html32
-rw-r--r--en/devices/tech/debug/systrace.html38
-rw-r--r--en/devices/tech/debug/valgrind.html26
-rw-r--r--en/devices/tech/display/app-shortcuts.html20
-rw-r--r--en/devices/tech/display/circular-icons.html2
-rw-r--r--en/devices/tech/display/hdr.html26
-rw-r--r--en/devices/tech/display/multi-window.html2
-rw-r--r--en/devices/tech/display/night-light.html6
-rw-r--r--en/devices/tech/display/retail-mode.html19
-rw-r--r--en/devices/tech/ota/ab_updates.html39
-rw-r--r--en/devices/tech/ota/device_code.html151
-rw-r--r--en/devices/tech/ota/reduce_size.html4
-rw-r--r--en/devices/tech/ota/sign_builds.html68
-rw-r--r--en/devices/tech/ota/tools.html32
-rw-r--r--en/devices/tech/power/batterystats.html17
-rw-r--r--en/devices/tech/power/component.html24
-rw-r--r--en/devices/tech/power/device.html4
-rw-r--r--en/devices/tech/power/mgmt.html18
-rw-r--r--en/devices/tech/power/values.html2
-rw-r--r--en/devices/tech/test_infra/tradefed/full_example.html153
-rw-r--r--en/devices/tech/test_infra/tradefed/fundamentals/machine_setup.html6
-rw-r--r--en/devices/tech/test_infra/tradefed/fundamentals/options.html24
-rw-r--r--en/devices/tech/test_infra/tradefed/fundamentals/vts.html40
54 files changed, 1134 insertions, 743 deletions
diff --git a/en/devices/tech/admin/implement.html b/en/devices/tech/admin/implement.html
index ada8d284..f930e906 100644
--- a/en/devices/tech/admin/implement.html
+++ b/en/devices/tech/admin/implement.html
@@ -87,7 +87,7 @@ to 1 when the <code>low_ram</code> flag is defined.</p>
<h3 id=uses-feature>Uses-feature</h3>
<p>Devices must define the following <code>uses-feature</code>:</p>
-<pre>
+<pre class="devsite-click-to-copy">
android.software.managed_users
android.software.device_admin
</pre>
@@ -100,15 +100,19 @@ device, run: <code>adb shell pm list features</code>.</p>
should be enabled as part of provisioning a managed device. OEMs must ensure the
managed profile or device has all required applications by modifying:</p>
-<pre>vendor_required_apps_managed_profile.xml
+<pre class="devsite-click-to-copy">
+vendor_required_apps_managed_profile.xml
vendor_required_apps_managed_device.xml
</pre>
<p>Examples from a Nexus device:</p>
-<p><code>packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml</code></p>
+<pre class="devsite-click-to-copy">
+packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml
+</pre>
-<pre>&lt;resources&gt;
+<pre class="devsite-click-to-copy">
+&lt;resources&gt;
&lt;!-- A list of apps to be retained on the managed device --&gt;
&lt;string-array name="vendor_required_apps_managed_device"&gt;
&lt;item&gt;com.android.vending&lt;/item&gt; &lt;!--­Google Play --&gt;
@@ -121,11 +125,11 @@ vendor_required_apps_managed_device.xml
&lt;/resources&gt;
</pre>
-<p><code>
+<pre class="devsite-click-to-copy">
packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml
-</code></p>
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;resources&gt;
&lt;!-- A list of apps to be retained in the managed profile. This includes any Google experience apps required. --&gt;
&lt;string-array name="vendor_required_apps_managed_profile"&gt;
@@ -150,8 +154,12 @@ feature.</p>
<p>Devices with NFC must enable NFC during the out-of-the-box experience (i.e.,
setup wizard) and be configured to accept managed provisioning intents:</p>
-<p><code>packages/apps/Nfc/res/values/provisioning.xml</code></p>
-<pre>&lt;bool name="enable_nfc_provisioning"&gt;true&lt;/bool&gt;
+<pre class="devsite-click-to-copy">
+packages/apps/Nfc/res/values/provisioning.xml
+</pre>
+
+<pre class="devsite-click-to-copy">
+&lt;bool name="enable_nfc_provisioning"&gt;true&lt;/bool&gt;
&lt;item>application/com.android.managedprovisioning&lt;/item&gt;
</pre>
@@ -167,7 +175,8 @@ which then hands control to the newly-set device owner.</p>
<p>To meet setup requirements, add the following code to the device setup's main
activity:</p>
-<pre>&#64;Override
+<pre class="devsite-click-to-copy">
+&#64;Override
protected void onStart() {
super.onStart();
diff --git a/en/devices/tech/admin/managed-profiles.html b/en/devices/tech/admin/managed-profiles.html
index 95c7771f..eb042052 100644
--- a/en/devices/tech/admin/managed-profiles.html
+++ b/en/devices/tech/admin/managed-profiles.html
@@ -81,11 +81,15 @@ outside the managed profile.</p>
<p>Managed profiles are implemented as a new kind of secondary user, such that:</p>
-<pre>uid = 100000 * userid + appid</pre>
+<pre class="devsite-click-to-copy">
+uid = 100000 * userid + appid
+</pre>
<p>They have separate app data like regular users:</p>
-<pre>/data/user/&lt;userid&gt;</pre>
+<pre class="devsite-click-to-copy">
+/data/user/&lt;userid&gt;
+</pre>
<p>The UserId is calculated for all system requests using
<code>Binder.getCallingUid()</code>, and all system state and responses are
diff --git a/en/devices/tech/admin/multi-user.html b/en/devices/tech/admin/multi-user.html
index cc187660..e19eaea4 100644
--- a/en/devices/tech/admin/multi-user.html
+++ b/en/devices/tech/admin/multi-user.html
@@ -101,7 +101,8 @@ enable it, device manufacturers must define a resource overlay that replaces
the following values in <code>frameworks/base/core/res/res/values/config.xml</code>:
</p>
-<pre>&lt;!-- Maximum number of supported users --&gt;
+<pre class="devsite-click-to-copy">
+&lt;!-- Maximum number of supported users --&gt;
&lt;integer name="config_multiuserMaximumUsers"&gt;1&lt;/integer&gt;
&lt;!-- Whether Multiuser UI should be shown --&gt;
&lt;bool name="config_enableMultiUserUI"&gt;false&lt;/bool&gt;
diff --git a/en/devices/tech/admin/multiuser-apps.html b/en/devices/tech/admin/multiuser-apps.html
index 546659d7..c3efcd64 100644
--- a/en/devices/tech/admin/multiuser-apps.html
+++ b/en/devices/tech/admin/multiuser-apps.html
@@ -38,7 +38,7 @@ requests from any user. Only system apps can currently use this feature.</p>
<p>See the diagram below for a depiction of permissions flow with multiple users.</p>
-<p><img src="images/multi-user-perms.png" alt="Multiple users permissions flow" />
+<p><img src="/devices/tech/admin/images/multi-user-perms.png" alt="Multiple users permissions flow" />
<p class="img-caption"><strong>Figure 1.</strong> Multiple users permissions</p>
<h2 id=enabling_a_singleton_component>Enabling a singleton component</h2>
@@ -59,7 +59,7 @@ each user, with the UID being in the UID range for that user (such as 1010034).<
<p>These permissions are required</p>
-<pre>
+<pre class="devsite-click-to-copy">
INTERACT_ACROSS_USERS (signature|system)
INTERACT_ACROSS_USERS_FULL (signature)
</pre>
@@ -74,7 +74,7 @@ INTERACT_ACROSS_USERS_FULL (signature)
<li> <code>int userHandle = UserHandle.getCallingUserId()</code>
</ul>
<li> Use new, protected APIs to start services, activities, broadcasts on a specific
-user:
+user:
<ul>
<li><code>Context.startActivityAsUser(Intent, UserHandle)</code>
<li><code>Context.bindServiceAsUser(Intent, …, UserHandle)</code>
@@ -102,5 +102,28 @@ ContentObserver, PackageMonitor, BroadcastReceiver that provide additional
information about which user has caused the callback.
</ol>
+<h3 id="work-profiles">Services in multiple users or profiles</h3>
+
+<p>Not all services need to run an instance in another user or work profile. If your system service
+only needs to run as user 0, disable the service's components when running under other users to
+help preserve resources. The following example shows how you might do this at your service's entry
+points:</p>
+
+<pre class="devsite-click-to-copy">
+// Add on all entry points such as boot_completed or other manifest-listed receivers and providers
+if (!UserManager.isSystemUser()) {
+ // Disable the service
+ ComponentName targetServiceName = new ComponentName(this, TargetService.class);
+ context.getPackageManager().setComponentEnabledSetting(
+ targetServiceName, COMPONENT_ENABLED_STATE_DISABLED, 0);
+}
+</pre>
+
+<p>The example could also use <code>PackageManager.setApplicationEnabledSetting()</code> to disable
+the entire app.</p>
+
+
+
+
</body>
</html>
diff --git a/en/devices/tech/admin/provision.html b/en/devices/tech/admin/provision.html
index 9ab1937d..e1acd3e7 100644
--- a/en/devices/tech/admin/provision.html
+++ b/en/devices/tech/admin/provision.html
@@ -94,13 +94,14 @@ managed profile by sending an intent with action:
. Below is a sample intent that triggers the creation of the managed profile
and sets the DeviceAdminSample as the profile owner:</p>
-<pre>adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell am start -a android.app.action.PROVISION_MANAGED_PROFILE \
-c android.intent.category.DEFAULT \
-e wifiSsid $(printf '%q' \"WifiSSID\") \
-e deviceAdminPackage "com.google.android.deviceadminsample" \
-e android.app.extra.deviceAdminPackageName $(printf '%q'
.DeviceAdminSample\$DeviceAdminSampleReceiver) \
- -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation"
+ -e android.app.extra.DEFAULT_MANAGED_PROFILE_NAME "My Organisation"</code>
</pre>
<h2 id=device_owner_provisioning_via_nfc>Device owner provisioning</h2>
@@ -117,7 +118,7 @@ DPC as device owner.</p>
<p>A typical NFC bundle includes the following:</p>
-<pre>
+<pre class="devsite-click-to-copy">
EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME
EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_LOCATION
EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM
@@ -128,8 +129,10 @@ DPC as device owner.</p>
<p>Devices must have NFC configured to accept the managed provisioning
mimetype from the setup experience:</p>
-<pre>/packages/apps/Nfc/res/values/provisioning.xml
-
+<pre class="devsite-click-to-copy">
+/packages/apps/Nfc/res/values/provisioning.xml
+</pre>
+<pre class="devsite-click-to-copy">
&lt;bool name="enable_nfc_provisioning"&gt;true&lt;/bool&gt;
&lt;item&gt;application/com.android.managedprovisioning&lt;/item&gt;
</pre>
diff --git a/en/devices/tech/admin/testing-provision.html b/en/devices/tech/admin/testing-provision.html
index d080bad7..a8a219d2 100644
--- a/en/devices/tech/admin/testing-provision.html
+++ b/en/devices/tech/admin/testing-provision.html
@@ -50,13 +50,13 @@ Android platform has a separate version of AfW Test Harness). For Android 7.0,
the branch name is <code>afw-test-harness-nougat-dev</code>. To initialize
the repo and download source code for this branch, use:</p>
-<pre>
-$ mkdir WORKING_DIRECTORY
-$ cd WORKING_DIRECTORY
-$ git config --global user.name "Your Name"
-$ git config --global user.email "you@example.com"
-$ repo init -u https://android.googlesource.com/platform/manifest -b afw-test-harness-nougat-dev
-$ repo sync -j24
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">mkdir WORKING_DIRECTORY</code>
+<code class="devsite-terminal">cd WORKING_DIRECTORY</code>
+<code class="devsite-terminal">git config --global user.name "Your Name"</code>
+<code class="devsite-terminal">git config --global user.email "you@example.com"</code>
+<code class="devsite-terminal">repo init -u https://android.googlesource.com/platform/manifest -b afw-test-harness-nougat-dev</code>
+<code class="devsite-terminal">repo sync -j24</code>
</pre>
<p>To check out the source code for a different version, specify the branch with
@@ -92,9 +92,9 @@ with the source code.</p>
<p>To view and edit AfW source code in Android Studio:</p>
<ol>
<li>Run the following commands
-<pre>
-$ make idegen
-$ development/tools/idegen/idegen.sh
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">make idegen</code>
+<code class="devsite-terminal">development/tools/idegen/idegen.sh</code>
</pre>
</li>
<li>In Android Studio, open <code>android.ipr</code>.</li>
@@ -109,7 +109,8 @@ successfully, complete the following steps:</p>
<ol>
<li>Configure the Wi-Fi network in <code>afw-test.props</code> with the
following properties:
-<pre>wifi_ssid
+<pre class="devsite-click-to-copy">
+wifi_ssid
wifi_password (optional)
wifi_security_type (optional, available options are: NONE, WEP or WPA)
</pre>
@@ -117,7 +118,7 @@ wifi_security_type (optional, available options are: NONE, WEP or WPA)
<li>Obtain at least one account from a domain that is bound to Test DPC as
its device policy controller. Specify the details in <code>afw-test.props</code>
with the following properties:
-<pre>
+<pre class="devsite-click-to-copy">
work_account_username
work_account_password
</pre>
@@ -128,15 +129,17 @@ work_account_password
<h2 id=build_harness>Building the AfW Test Harness</h2>
<p>Initialize the build configuration using:</p>
-<pre>
-$ source build/envsetup.sh
-$ lunch
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">source build/envsetup.sh</code>
+<code class="devsite-terminal">lunch</code>
</pre>
<p>Select a device type and press <strong>Enter</strong>.</p>
<p>Build the harness using:</p>
-<pre>$ make afw-test-harness -j32</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+make afw-test-harness -j32
+</pre>
<p>This creates a directory (<code>out/host/linux-x86/afw-th/android-cts</code>)
with all necessary binaries, configuration files, and tools to run the test
harness. This directory is also zipped into a file
@@ -147,13 +150,17 @@ for distribution.</p>
<p>Use the following steps to run the AfW Test Harness:</p>
<ol>
<li>In your build environment, launch the test runner using:
-<pre>$ afw-test-tradefed</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+afw-test-tradefed
+</pre>
This starts the <code>cts-tf</code> console, loads test plans, test cases,
and <code>afw-test.props</code> from
<code>out/host/linux-x86/afw-th/android-cts</code>.</li>
<li>From the unzipped folder of <code>android-afw-test-harness.zip</code>,
launch the test runner using:
-<pre>$ cts-tf &gt; ./android‐cts/tools/afw-test‐tradefed</pre>
+<pre class="devsite-click-to-copy">
+cts-tf&gt; ./android‐cts/tools/afw-test‐tradefed
+</pre>
This loads test plans, test cases, and <code>afw-test.props</code> from
<code>android-cts</code> directory. Ensure
<code>./android‐cts/repository/testcases/afw-test.props</code> has the work
@@ -172,14 +179,17 @@ setup and enabling USB debugging.</li>
</ul>
<br>To run the test plan <code>afw-userdebug-build</code>, use:
-<pre>$ cts-tf &gt; run cts --plan afw-userdebug-build</pre>
+<pre class="devsite-click-to-copy">
+cts-tf&gt; run cts --plan afw-userdebug-build
+</pre>
To see all test plans, use the command <code>list plans</code>. To view plan
definitions, refer to
<code>out/host/linux-x86/afw-th/android-cts/repository/plans</code>.
<br>
</li>
<li>Run a test package. To run a single test package, use
-<pre>$ cts-tf &gt; run cts --package com.android.afwtest.NfcProvisioning
+<pre class="devsite-click-to-copy">
+cts-tf&gt; run cts --package com.android.afwtest.NfcProvisioning
</pre>
To view all packages, use the command <code>list packages</code>. For more
options, use the command <code>run cts --help</code>.</li>
@@ -192,16 +202,23 @@ which you can launch by running <code>afw-test-tradefed</code>.</p>
<li>Display more information with the <code>-l INFO</code> or <code>-l
DEBUG</code> flags. Example:
-<pre>$ cts-tf &gt; run cts ‐‐plan afw-userdebug-build -l DEBUG</pre></li>
+<pre class="devsite-click-to-copy">
+cts-tf&gt; run cts ‐‐plan afw-userdebug-build -l DEBUG
+</pre>
+</li>
<li>Run the test harness on a specific device with the <code>-s</code> flag.
Example:
-<pre>$ cts-tf &gt; run cts ‐‐plan afw-userdebug-build -l DEBUG -s device_sn</pre>
+<pre class="devsite-click-to-copy">
+cts-tf&gt; run cts ‐‐plan afw-userdebug-build -l DEBUG -s device_sn
+</pre>
</li>
<li>Run test harness on all connected devices with the
<code>--all-devices</code> flag. Example:
-<pre>$ cts-tf &gt; run cts ‐‐plan afw-userdebug-build -l DEBUG --all-devices</pre>
+<pre class="devsite-click-to-copy">
+cts-tf&gt; run cts ‐‐plan afw-userdebug-build -l DEBUG --all-devices
+</pre>
</li>
<li>View current running executions using <code>list invocations</code> or
@@ -246,7 +263,8 @@ Navigating:com.android.afwtest.uiautomator.pages.gms.AddAccountPage</code>
</li>
<li>If a test failed during the provisioning process, logcat contains an error
similar to:
-<pre>TestRunner: java.lang.RuntimeException: Failed to load page: com.android.afwtest.uiautomator.pages.packageinstaller.DeviceAccessPage
+<pre class="devsite-click-to-copy">
+TestRunner: java.lang.RuntimeException: Failed to load page: com.android.afwtest.uiautomator.pages.packageinstaller.DeviceAccessPage
</pre>
This is typically caused by errors in a previous UI page or the page that
failed to load, so try to find other error messages in logcat before this error,
@@ -306,7 +324,7 @@ meaningful text or content description that contains any of the following words:
Skip, Finish, Done, Accept, Agree, Next, Continue, or Proceed. Alternatively,
you can define a button in <code>afw-test.props</code> to configure the test
harness to skip your UI. Example:</em></p>
-<pre>
+<pre class="devsite-click-to-copy">
oem_widgets=your_btn
your_btn.text=your_customized_text
your_btn.package=your_package
diff --git a/en/devices/tech/admin/testing-setup.html b/en/devices/tech/admin/testing-setup.html
index 8a47fcfe..dc89c1a4 100644
--- a/en/devices/tech/admin/testing-setup.html
+++ b/en/devices/tech/admin/testing-setup.html
@@ -61,7 +61,9 @@ enterprise mobility management (EMM) providers.</p>
</ul>
</li>
<li>Set the TestDPC app as the device owner using the following command:<br>
- <pre>$ adb shell dpm set-device-owner "com.afwsamples.testdpc/.DeviceAdminReceiver"</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dpm set-device-owner "com.afwsamples.testdpc/.DeviceAdminReceiver"
+</pre>
</li>
<li>Go through device owner setup on the device (encrypt, select Wi-Fi, etc.)</li>
</ol>
diff --git a/en/devices/tech/config/carrier.html b/en/devices/tech/config/carrier.html
index 11a1fd58..81a1ecee 100644
--- a/en/devices/tech/config/carrier.html
+++ b/en/devices/tech/config/carrier.html
@@ -178,7 +178,7 @@ user adds extra services to their account)
<p>An example is below:</p>
-<pre>
+<pre class="prettyprint">
public class SampleCarrierConfigService extends CarrierService {
private static final String TAG = "SampleCarrierConfigService";
@@ -210,7 +210,7 @@ href="https://developer.android.com/reference/android/service/carrier/CarrierSer
<p>An example is below:</p>
-<pre>
+<pre class="prettyprint">
&lt;service android:name=".SampleCarrierConfigService"
android:label="&#64;string/service_name"
android:permission="android.permission.BIND_CARRIER_SERVICES"&gt;
diff --git a/en/devices/tech/config/filesystem.html b/en/devices/tech/config/filesystem.html
index c2a3fd3f..98a72baa 100644
--- a/en/devices/tech/config/filesystem.html
+++ b/en/devices/tech/config/filesystem.html
@@ -139,7 +139,7 @@ overrides. However, this is weak protection; if someone has control over
<code>/system</code>, they can typically do anything they want.</li>
</ul>
-<pre>
+<pre class="devsite-click-to-copy">
diff --git a/android_filesystem_config.h b/android_filesystem_config.h
new file mode 100644
index 0000000..874195f
diff --git a/en/devices/tech/config/kernel.html b/en/devices/tech/config/kernel.html
index 2ac4e4cc..14d2ee17 100644
--- a/en/devices/tech/config/kernel.html
+++ b/en/devices/tech/config/kernel.html
@@ -54,7 +54,9 @@ Document (CDD)</a>.</p>
<p>For devices that have a minimalist defconfig, you can use the following to
enable options:</p>
-<pre><code>ARCH=<em>arch</em> scripts/kconfig/merge_config.sh <em>path</em>/<em>device</em>_defconfig android/configs/android-base.cfg android/configs/android-recommended.cfg</code></pre>
+<pre class="devsite-click-to-copy">
+ARCH=<em>arch</em> scripts/kconfig/merge_config.sh <em>path</em>/<em>device</em>_defconfig android/configs/android-base.cfg android/configs/android-recommended.cfg
+</pre>
<p>This generates a .config file you can use to save a new defconfig or
compile a new kernel with Android features enabled.</p>
@@ -62,13 +64,16 @@ compile a new kernel with Android features enabled.</p>
<h2 id="usb">Enabling USB host mode options</h2>
<p>For USB host mode audio, enable the following options:</p>
-<pre><code>CONFIG_SND_USB=y
+<pre class="devsite-click-to-copy">
+CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
# CONFIG_USB_AUDIO is for a peripheral mode (gadget) driver
-</code></pre>
+</pre>
<p>For USB host mode MIDI, enable the following option:</p>
-<pre><code>CONFIG_SND_USB_MIDI=y</code></pre>
+<pre class="devsite-click-to-copy">
+CONFIG_SND_USB_MIDI=y
+</pre>
<h2 id="Seccomp-BPF-TSYNC">Seccomp-BPF with TSYNC</h2>
<p>Seccomp-BPF is a kernel security technology that enables the creation of
diff --git a/en/devices/tech/config/kernel_network_tests.html b/en/devices/tech/config/kernel_network_tests.html
index a1e83a24..bc437ad2 100644
--- a/en/devices/tech/config/kernel_network_tests.html
+++ b/en/devices/tech/config/kernel_network_tests.html
@@ -77,7 +77,9 @@ in the given release. For information on how to run the tests, see the <a
href="https://android.googlesource.com/kernel/tests/+/master/net/test/README">kernel
network test README file</a>. Basically, from the top of your kernel tree, run:</p>
-<pre> &lt;android tree&gt;/kernel/tests/net/test/run_net_test.sh all_tests.sh</pre>
+<pre class="devsite-click-to-copy">
+<var>ANDROID_TREE</var>/kernel/tests/net/test/run_net_test.sh all_tests.sh
+</pre>
<h3 id=passing>Passing the tests</h3> <p>The kernel network test Python
source files contain comments that specify kernel commits that are known to be
diff --git a/en/devices/tech/config/low-ram.html b/en/devices/tech/config/low-ram.html
index 10f1cbfc..100b4ab3 100644
--- a/en/devices/tech/config/low-ram.html
+++ b/en/devices/tech/config/low-ram.html
@@ -82,9 +82,11 @@ wrong thing).
<code>ActivityManager.isLowRamDevice()</code> for applications to determine if
they should turn off specific memory-intensive
features that work poorly on low-memory devices.</p>
-<p>For 512MB devices, this API is expected to return: "true" It can be enabled by
- the following system property in the device makefile.<br/>
-<code>PRODUCT_PROPERTY_OVERRIDES += ro.config.low_ram=true</code></p>
+<p>For 512MB devices, this API is expected to return <code>true</code>. It can be enabled by
+ the following system property in the device makefile.</p>
+<pre class="devsite-click-to-copy">
+PRODUCT_PROPERTY_OVERRIDES += ro.config.low_ram=true
+</pre>
<h3 id="jit">Disable JIT</h3>
@@ -99,8 +101,10 @@ they should turn off specific memory-intensive
memory usage, but if set too low will send the JIT into a thrashing mode. For
the really low-memory devices, we recommend the JIT be disabled entirely.</p>
-<p>This can be achieved by adding the following line to the product makefile:<br/>
-<code>PRODUCT_PROPERTY_OVERRIDES += dalvik.vm.jit.codecachesize=0</code></p>
+<p>This can be achieved by adding the following line to the product makefile:</p>
+<pre class="devsite-click-to-copy">
+PRODUCT_PROPERTY_OVERRIDES += dalvik.vm.jit.codecachesize=0
+</pre>
<h3 id="launcher">Launcher Configs</h3>
@@ -136,7 +140,7 @@ using live-wallpaper. Low-memory devices should not pre-install any live wallpap
<p>These thresholds can be configured via the framework config.xml</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Device configuration setting the /proc/sys/vm/extra_free_kbytes tunable
in the kernel (if it exists). A high value will increase the amount of memory
that the kernel tries to keep free, reducing allocation time and causing the
@@ -148,7 +152,7 @@ by default. -1 keeps the default. --&gt;
&lt;integer name=&quot;config_extraFreeKbytesAbsolute&quot;&gt;-1&lt;/integer&gt;
</pre>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Device configuration adjusting the /proc/sys/vm/extra_free_kbytes
tunable in the kernel (if it exists). 0 uses the default value chosen by
ActivityManager. A positive value will increase the amount of memory that the
@@ -172,7 +176,7 @@ memory or if more services have been added, the thresholds can be increased. </p
backed pages, so that background processes are being killed long before disk
thrashing would occur due to the cache getting too small.</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Device configuration setting the minfree tunable in the lowmemorykiller
in the kernel. A high value will cause the lowmemorykiller to fire earlier,
keeping more memory in the file cache and preventing I/O thrashing, but
@@ -184,7 +188,7 @@ smaller buckets. -1 keeps the default. --&gt;
&lt;integer name=&quot;config_lowMemoryKillerMinFreeKbytesAbsolute&quot;&gt;-1&lt;/integer&gt;
</pre>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Device configuration adjusting the minfree tunable in the
lowmemorykiller in the kernel. A high value will cause the lowmemorykiller to
fire earlier, keeping more memory in the file cache and preventing I/O
@@ -215,7 +219,7 @@ rendering times.</p>
<p>To enable KSM, enable <code>CONFIG_KSM</code> in the kernel and then add the
following lines to your` <code>init.&lt;device&gt;.rc</code> file:<br>
-<pre>
+<pre class="devsite-click-to-copy">
write /sys/kernel/mm/ksm/pages_to_scan 100
write /sys/kernel/mm/ksm/sleep_millisecs 500
write /sys/kernel/mm/ksm/run 1
@@ -249,29 +253,35 @@ system.</p>
<li><code>CONFIG_ZRAM</code></li>
</ul>
</li>
- <li>Then, you should add a line that looks like this to your fstab:<br />
- <code>/dev/block/zram0 none swap defaults zramsize=&lt;size in bytes&gt;,swapprio=&lt;swap partition priority&gt;</code><br />
- <code><br />
- zramsize</code> is mandatory and indicates how much uncompressed memory you want
- the zram area to hold. Compression ratios in the 30-50% range are usually
- observed.<br />
- <br />
- <code>swapprio</code> is optional and not needed if you don't have more than one swap
- area.<br />
- <br />
- You should also be sure to label the associated block device as a swap_block_device
+ <li>Then, you should add a line that looks like this to your fstab:
+<pre class="devsite-click-to-copy">
+/dev/block/zram0 none swap defaults zramsize=&lt;size in bytes&gt;,swapprio=&lt;swap partition priority&gt;
+</pre>
+ <ul>
+ <li><code>zramsize</code> is mandatory and indicates how much uncompressed memory you want the zram area to hold. Compression ratios in the 30-50% range are usually observed.</li>
+ <li><code>swapprio</code> is optional and not needed if you don't have more than one swap
+ area.</li>
+ </ul>
+ <p>You should also be sure to label the associated block device as a swap_block_device
in the device-specific <a href="/security/selinux/implement.html">
- sepolicy/file_contexts</a> so that it is treated properly by SELinux. <br />
- <code>/dev/block/zram0 u:object_r:swap_block_device:s0</code><br />
- <br />
+ sepolicy/file_contexts</a> so that it is treated properly by SELinux.</p>
+<pre class="devsite-click-to-copy">
+/dev/block/zram0 u:object_r:swap_block_device:s0
+</pre>
</li>
<li>By default, the Linux kernel swaps in 8 pages of memory at a time. When
using ZRAM, the incremental cost of reading 1 page at a time is negligible
and may help in case the device is under extreme memory pressure. To read
- only 1 page at a time, add the following to your <code>init.rc</code>:<br />
- <code>write /proc/sys/vm/page-cluster 0</code></li>
- <li>In your <code>init.rc</code> after the <code>mount_all /fstab.X</code> line, add:<br />
- <code>swapon_all /fstab.X</code></li>
+ only 1 page at a time, add the following to your <code>init.rc</code>:
+<pre class="devsite-click-to-copy">
+write /proc/sys/vm/page-cluster 0
+</pre>
+ </li>
+ <li>In your <code>init.rc</code> after the <code>mount_all /fstab.X</code> line, add:
+<pre class="devsite-click-to-copy">
+swapon_all /fstab.X
+</pre>
+ </li>
<li>The memory cgroups are automatically configured at boot time if the
feature is enabled in kernel.</li>
<li>If memory cgroups are available, the ActivityManager will mark lower
@@ -324,9 +334,11 @@ development/tools/findunused (should help make the app smaller).</li>
<li>Don't enable code that is writing Parcel data to disk and reading it later.</li>
<li>Don't subscribe to every package installed, instead use ssp filtering. Add
filtering like below:
-<br />
- <code>&lt;data android:scheme=&quot;package&quot; android:ssp=&quot;com.android.pkg1&quot; /&gt;<br />
- &lt;data android:scheme=&quot;package&quot; android:ssp=&quot;com.myapp.act1&quot; /&gt;</code></li>
+<pre class="devsite-click-to-copy">
+&lt;data android:scheme=&quot;package&quot; android:ssp=&quot;com.android.pkg1&quot; /&gt;
+&lt;data android:scheme=&quot;package&quot; android:ssp=&quot;com.myapp.act1&quot; /&gt;
+</pre>
+</li>
</ul>
<h3 id="process-states">Understand the various process states in Android</h3>
@@ -387,7 +399,7 @@ services include <code>batterystats</code>, <code>netstats</code>,
<code>procstats</code>, and <code>usagestats</code>. You can find them with
lines like this:</p>
-<pre>
+<pre class="devsite-click-to-copy">
------ CHECKIN BATTERYSTATS (dumpsys batterystats --checkin) ------
7,0,h,-2558644,97,1946288161,3,2,0,340,4183
7,0,h,-2553041,97,1946288161,3,2,0,340,4183
@@ -403,7 +415,7 @@ long running processes.</p>
<p>Run for longer durations and track the memory of the process. Does it
increase? Does it stay constant? Create Canonical use cases and run longevity
-tests on these scenarios</p>
+tests on these scenarios.</p>
</body>
</html>
diff --git a/en/devices/tech/config/runtime_perms.html b/en/devices/tech/config/runtime_perms.html
index 68e72c0e..9681b98b 100644
--- a/en/devices/tech/config/runtime_perms.html
+++ b/en/devices/tech/config/runtime_perms.html
@@ -57,7 +57,8 @@ model. Dangerous permissions are higher-risk permissions (such as
<code>READ_CALENDAR</code>) that grant requesting applications access to private
user data or control over the device that can negatively impact the user. To
view a list of dangerous permissions, run the command:</p>
-<pre>
+
+<pre class="devsite-terminal devsite-click-to-copy">
adb shell pm list permissions -g -d
</pre>
@@ -159,10 +160,14 @@ strings to AOSP.</p>
providers for core OS functionality using the
<code>DefaultPermissionGrantPolicy.java</code> in PackageManager. Examples:</p>
-<p><code>ACTION_CALL (Dialer) Default</code><br>
-<code>Phone, Contacts, SMS, Microphone</code></p>
-<p><code>SMS_DELIVER_ACTION (SMS/MMS) Default</code><br>
-<code>Phone, Contacts, SMS</code></p>
+<pre class="devsite-click-to-copy">
+ACTION_CALL (Dialer) Default
+Phone, Contacts, SMS, Microphone
+</pre>
+<pre class="devsite-click-to-copy">
+SMS_DELIVER_ACTION (SMS/MMS) Default
+Phone, Contacts, SMS
+</pre>
<h3 id="defining-custom-perms">Defining custom permissions</h3>
<p>You can define custom permissions and groups as <em>normal</em> or
diff --git a/en/devices/tech/config/uicc.html b/en/devices/tech/config/uicc.html
index 676d8167..1fa6952c 100644
--- a/en/devices/tech/config/uicc.html
+++ b/en/devices/tech/config/uicc.html
@@ -74,10 +74,12 @@ access; otherwise both certificate and package name need to match.</p>
<h3 id=rule_example>Rule example</h3>
<p>The application name is <code>com.google.android.apps.myapp</code> and the
SHA-1 certificate in hex string is:</p>
-<pre>AB:CD:92:CB:B1:56:B2:80:FA:4E:14:29:A6:EC:EE:B6:E5:C1:BF:E4</pre>
+<pre class="devsite-click-to-copy">
+AB:CD:92:CB:B1:56:B2:80:FA:4E:14:29:A6:EC:EE:B6:E5:C1:BF:E4
+</pre>
<p>The rule on UICC in hex string is:</p>
-<pre>
+<pre class="devsite-click-to-copy">
E243 &lt;= 43 is value length in hex
E135
C114 ABCD92CBB156B280FA4E1429A6ECEEB6E5C1BFE4
@@ -97,10 +99,13 @@ Access Control Rules File (ACRF) at <code>0x4300</code> and looks for entries
with AID <code>FFFFFFFFFFFF</code>. Entries with different AIDs are ignored, so
rules for other use cases can co-exist.</p>
<p>Example ACRF content in hex string:</p>
-<pre>30 10 A0 08 04 06 FF FF FF FF FF FF 30 04 04 02 43 10</pre>
+<pre class="devsite-click-to-copy">
+30 10 A0 08 04 06 FF FF FF FF FF FF 30 04 04 02 43 10
+</pre>
<p>Example Access Control Conditions File (ACCF) content:</p>
-<pre>30 16 04 14 61 ED 37 7E 85 D3 86 A8 DF EE 6B 86 4B D8 5B 0B FA A5 AF 81
+<pre class="devsite-click-to-copy">
+30 16 04 14 61 ED 37 7E 85 D3 86 A8 DF EE 6B 86 4B D8 5B 0B FA A5 AF 81
</pre>
<p>In above example, <code>0x4310</code> is the address for ACCF, which contains
@@ -204,7 +209,7 @@ developer key, with hash value
tests also print out the expected certificate hash if certificates on UICC
mismatch.</p>
<p>Example output:</p>
-<pre>
+<pre class="devsite-click-to-copy">
junit.framework.AssertionFailedError: This test requires a SIM card with carrier privilege rule on it.
Cert hash: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
</pre>
@@ -222,7 +227,9 @@ tests to run only on devices configured with same token. Carrier API CTS tests
support the device token <code>sim-card-with-certs</code>. For example, the
following device token restricts carrier API tests to run only on device
<code>abcd1234</code>:</p>
-<pre>cts-tradefed run cts --device-token abcd1234:sim-card-with-certs</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+cts-tradefed run cts --device-token abcd1234:sim-card-with-certs
+</pre>
<p>When running a test without using a device token, the test runs on all
devices.</p>
diff --git a/en/devices/tech/connect/block-numbers.html b/en/devices/tech/connect/block-numbers.html
index 69e00e6d..2b797545 100644
--- a/en/devices/tech/connect/block-numbers.html
+++ b/en/devices/tech/connect/block-numbers.html
@@ -91,7 +91,7 @@ based on the block list, that is now possible with this feature.</li></ul>
<h2 id="data-flow">Data flow</h2>
-<img src="images/block-numbers-flow.png" alt="block numbers data flow" id="block-numbers-flow" />
+<img src="/devices/tech/connect/images/block-numbers-flow.png" alt="block numbers data flow" id="block-numbers-flow" />
<p class="img-caption">
<strong>Figure 1.</strong> Block phone numbers data flow
</p>
@@ -104,13 +104,13 @@ Here are example calls using the number-blocking new feature:
<h3 id="launch-from-app">Launch blocked number manager from app</h3>
-<pre>
+<pre class="prettyprint">
Context.startActivity(telecomManager.createManageBlockedNumbersIntent(), null);
</pre>
<h3 id="query-blocked-numbers">Query blocked numbers</h3>
-<pre>
+<pre class="prettyprint">
Cursor c = getContentResolver().query(BlockedNumbers.CONTENT_URI,
new String[]{BlockedNumbers.COLUMN_ID,
BlockedNumbers.COLUMN_ORIGINAL_NUMBER,
@@ -119,7 +119,7 @@ Cursor c = getContentResolver().query(BlockedNumbers.CONTENT_URI,
<h3 id="put-blocked-number">Put blocked number</h3>
-<pre>
+<pre class="prettyprint">
ContentValues values = new ContentValues();
values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, "1234567890");
Uri uri = getContentResolver().insert(BlockedNumbers.CONTENT_URI, values);
@@ -127,7 +127,7 @@ Uri uri = getContentResolver().insert(BlockedNumbers.CONTENT_URI, values);
<h3 id="delete-blocked-number">Delete blocked number</h3>
-<pre>
+<pre class="prettyprint">
ContentValues values = new ContentValues();
values.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, "1234567890");
Uri uri = getContentResolver().insert(BlockedNumbers.CONTENT_URI, values);
@@ -233,7 +233,7 @@ Implementers can ensure their version of the feature works as intended by
running the following CTS tests:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
android.provider.cts.BlockedNumberContractTest
com.android.cts.numberblocking.hostside.NumberBlockingTest
android.telecom.cts.ExtendedInCallServiceTest#testIncomingCallFromBlockedNumber_IsRejected
@@ -244,11 +244,11 @@ android.telephony.cts.SmsManagerTest#testSmsBlocking
The <code>BlockedNumberProvider</code> can be manipulated using <code>adb</code> commands
after running <code>$ adb root</code>. For example:
</p>
-<pre>
-$ adb root
-$ adb shell content query --uri content://com.android.blockednumber/blocked
-$ adb shell content insert --uri / content://com.android.blockednumber/blocked --bind / original_number:s:'6501002000'
-$ adb shell content delete --uri / content://com.android.blockednumber/blocked/1
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell content query --uri content://com.android.blockednumber/blocked</code>
+<code class="devsite-terminal">adb shell content insert --uri / content://com.android.blockednumber/blocked --bind / original_number:s:'6501002000'</code>
+<code class="devsite-terminal">adb shell content delete --uri / content://com.android.blockednumber/blocked/1</code>
</pre>
</body>
diff --git a/en/devices/tech/connect/data-saver.html b/en/devices/tech/connect/data-saver.html
index 0d5721be..e9624295 100644
--- a/en/devices/tech/connect/data-saver.html
+++ b/en/devices/tech/connect/data-saver.html
@@ -62,22 +62,22 @@ Source Project (AOSP). See the screenshots below for examples.
These screenshots show the Data Saver mode in use.
</p>
-<img src="images/data-saver-use.png" width="397" alt="Toggling Data Saver off/on" />
+<img src="/devices/tech/connect/images/data-saver-use.png" width="397" alt="Toggling Data Saver off/on" />
<p class="img-caption">
<strong>Figure 1.</strong> Toggling Data Saver off/on
</p>
-<img src="images/data-battery-saver.png" width="641" alt="Battery saver and Data Saver are on" />
+<img src="/devices/tech/connect/images/data-battery-saver.png" width="641" alt="Battery saver and Data Saver are on" />
<p class="img-caption">
<strong>Figure 2.</strong> When both battery saver and Data Saver are on
</p>
-<img src="images/data-saver-app.png" width="376" alt="App-specific data usage screen" />
+<img src="/devices/tech/connect/images/data-saver-app.png" width="376" alt="App-specific data usage screen" />
<p class="img-caption">
<strong>Figure 3.</strong> App-specific data usage screen: Settings > Apps > Data usage
</p>
-<img src="images/data-saver-quick-settings.png" width="446" alt="Data saver in the Quick Settings" />
+<img src="/devices/tech/connect/images/data-saver-quick-settings.png" width="446" alt="Data saver in the Quick Settings" />
<p class="img-caption">
<strong>Figure 4.</strong> Data saver states on the Quick Settings menu
</p>
@@ -130,20 +130,22 @@ Implementers can ensure their version of the feature works as intended by
running the following CTS test:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
com.android.cts.net.HostsideRestrictBackgroundNetworkTests
</pre>
<p>
In addition, <code>adb</code> commands can be used to conduct tests manually by
-first running this command to see all available options:<br>
-<code>$ adb shell cmd netpolicy</code>
-</p>
+first running this command to see all available options:</p>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd netpolicy
+</pre>
<p>
-For example, this command returns the UIDs of the whitelisted apps:<br>
-<code>$ adb shell cmd netpolicy list restrict-background-whitelist</code>
-</p>
+For example, this command returns the UIDs of the whitelisted apps:</p>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd netpolicy list restrict-background-whitelist
+</pre>
</body>
</html>
diff --git a/en/devices/tech/connect/emergency-affordance.html b/en/devices/tech/connect/emergency-affordance.html
index 383449bd..bbaccacf 100644
--- a/en/devices/tech/connect/emergency-affordance.html
+++ b/en/devices/tech/connect/emergency-affordance.html
@@ -111,12 +111,12 @@ key.</li> </ul>
<table>
<tr>
- <td width="50%"><img src="images/emergency-button.png" alt="emergency
+ <td width="50%"><img src="/devices/tech/connect/images/emergency-button.png" alt="emergency
button" width="246" id="emergency-button" />
<p class="img-caption">
<strong>Figure 1.</strong> Long press the <strong>EMERGENCY</strong> button,
highlighted with a red box, on the lock screen.</p></td>
- <td width="50%"><img src="images/emergency-option.png" alt="emergency
+ <td width="50%"><img src="/devices/tech/connect/images/emergency-option.png" alt="emergency
option" width="247" id="emergency-option" />
<p class="img-caption">
<strong>Figure 2.</strong> Tap the <strong>Emergency</strong> action item on
@@ -125,11 +125,17 @@ the <em>Global Action Menu</em>.</p></td>
</table>
<p>This feature introduces the following internal components:</p> <ul>
-<li>EmergencyAffordanceManager<br>
-<code>frameworks/base/core/java/com/android/internal/policy/EmergencyAffordanceManager.java</code>
-</li> <li>EmergencyAffordanceService<br>
-<code>frameworks/base/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java</code>
-</li> </ul>
+<li>EmergencyAffordanceManager
+<pre class="devsite-click-to-copy">
+frameworks/base/core/java/com/android/internal/policy/EmergencyAffordanceManager.java
+</pre>
+</li>
+<li>EmergencyAffordanceService
+<pre class="devsite-click-to-copy">
+frameworks/base/services/core/java/com/android/server/emergency/EmergencyAffordanceService.java
+</pre>
+</li>
+</ul>
<h3 id="EmergencyAffordanceManager">EmergencyAffordanceManager</h3> <p>The
EmergencyAffordanceManager provides an internal API to use the Emergency
@@ -218,23 +224,23 @@ the RIL.</p>
<h2 id="validation">Validation</h2> <p>While testing, on a debuggable build,
the number that is called can be changed with the following command:</p>
-<pre>
-$ adb shell settings put global emergency_affordance_number <i>&lt;number_to_call&gt;</i>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell settings put global emergency_affordance_number <var>NUMBER_TO_CALL</var>
</pre>
<p>Although this setting can be set on a normal user build, it will be ignored.
To actually connect the call the number must be in the list of emergency
numbers provided by the RIL. This can be temporarily set using the following
command executed from a root shell on a userdebug device:</p>
-<pre>
-$ setprop ril.ecclist "$(getprop ril.ecclist),<i>&lt;number_to_call&gt;</i>"
+<pre class="devsite-terminal devsite-click-to-copy">
+setprop ril.ecclist "$(getprop ril.ecclist),<var>NUMBER_TO_CALL</var>"
</pre>
<p>The following command can also be used to force the Emergency Affordance
feature to be enabled even in the absence of an Indian mobile network being
detected or an Indian SIM card being inserted.</p>
-<pre>
-$ adb shell settings put global force_emergency_affordance 1
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell settings put global force_emergency_affordance 1
</pre>
<p>During testing it is recommend that at least the following cases are
diff --git a/en/devices/tech/dalvik/configure.html b/en/devices/tech/dalvik/configure.html
index 79d61fdf..2018b9c5 100644
--- a/en/devices/tech/dalvik/configure.html
+++ b/en/devices/tech/dalvik/configure.html
@@ -104,7 +104,7 @@ enabled to work.</p>
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">WITH_DEXPREOPT := true</pre>
<h3 id=dont_dexpreopt_prebuilts>DONT_DEXPREOPT_PREBUILTS</h3>
@@ -116,8 +116,10 @@ to first boot time.</p>
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<h3 id=with_dexpreopt_boot_img_only>WITH_DEXPREOPT_BOOT_IMG_ONLY</h3>
@@ -130,8 +132,10 @@ selectively disable app pre-optimization via
<p>Example usage (in product’s BoardConfig.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<h3 id=local_dex_preopt>LOCAL_DEX_PREOPT</h3>
@@ -152,7 +156,9 @@ APK signatures to remain valid.</p>
<p>Example usage (in app’s Android.mk):</p>
-<pre><code>LOCAL_DEX_PREOPT := false</code></pre>
+<pre class="devsite-click-to-copy">
+LOCAL_DEX_PREOPT := false
+</pre>
<h3 id=product_dex_preopt_*>PRODUCT_DEX_PREOPT_*</h3>
@@ -177,8 +183,10 @@ maximally used to improve first boot time.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
-$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
+$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)
+</pre>
<p>These flags can also be used to selectively disable pre-optimization of a
particular module or package by specifying <code>$(call
@@ -187,7 +195,9 @@ product's device.mk file.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>$(call add-product-dex-preopt-module-config,Calculator,disable)</code></pre>
+<pre class="devsite-click-to-copy">
+$(call add-product-dex-preopt-module-config,Calculator,disable)
+</pre>
<h2 id=other_odex>First boot installation of DEX_PREOPT files</h2>
@@ -199,14 +209,17 @@ partition. They are then copied to the data partition on first boot.</p>
<p>Example usage (in device-common.mk):</p>
-<pre><code>PRODUCT_PACKAGES += \
+<pre class="devsite-click-to-copy">
+PRODUCT_PACKAGES += \
cppreopts.sh
PRODUCT_PROPERTY_OVERRIDES += \
ro.cp_system_other_odex=1
-</code></pre>
+</pre>
<p>And in device's BoardConfig.mk:</p>
-<pre><code>BOARD_USES_SYSTEM_OTHER_ODEX := true</code></pre>
+<pre class="devsite-click-to-copy">
+BOARD_USES_SYSTEM_OTHER_ODEX := true
+</pre>
<p>See <a href="/devices/tech/ota/ab_updates.html#compilation">App
compilation in background</a> to optionally include the compilation script and
@@ -226,7 +239,9 @@ have to have its own copy, again wasting memory.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/preloaded-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/preloaded-classes
+</pre>
<p class="note"><strong>Note:</strong> This line must be placed before
inheriting any product configuration makefiles that get the default one from
@@ -246,7 +261,9 @@ post-L in AOSP, a custom image classes list can be specified using
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_DEX_PREOPT_BOOT_FLAGS += --image-classes=&lt;filename&gt;</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_BOOT_FLAGS += --image-classes=&lt;filename&gt;
+</pre>
<h2 id=compiled_classes_list>Compiled Classes List</h2>
@@ -262,7 +279,9 @@ also be specified using <code>PRODUCT_DEX_PREOPT_BOOT_FLAGS</code>.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes
+</pre>
<p class="note"><strong>Note:</strong> This line must be placed before
inheriting any product configuration makefiles that get the default one from
@@ -280,9 +299,13 @@ methods that are too large to be represented by the compiler’s internal
representation.
<li><em>speed</em> - compiles most methods and maximizes runtime performance, which is the
default option.
+ <li><em>speed-profile</em> - compiles methods passed from a profile file
+ through the <em>--profile-file</em> option or <em>--profile-file-fd</em> option.
<li><em>balanced</em> - attempts to get the best performance return on compilation investment.
<li><em>space</em> - compiles a limited number of methods, prioritizing storage space.
<li><em>interpret-only</em> - skips all compilation and relies on the interpreter to run code.
+ <li><em>verify-profile</em> - skips all compilation and only performs verification of methods passed
+ from a profile file through the <em>--profile-file</em> option or <em>--profile-file-fd</em> option.
<li><em>verify-none</em> - special option that skips verification and compilation, should be used only
for trusted system code.
</ul>
@@ -299,8 +322,10 @@ should enable PIC compilation.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_PIC := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_PIC := true
+</pre>
<p>Starting in Android 7.0, PIC compilation is enabled by default.</p>
@@ -316,14 +341,18 @@ regressions may appear in benchmarking.</p>
<p>Example usage (in product’s device.mk):</p>
-<pre><code>WITH_ART_SMALL_MODE := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_ART_SMALL_MODE := true
+</pre>
<p>In future releases, this build option will be removed since it can be done with
this (in product’s device.mk):</p>
-<pre><code>PRODUCT_PROPERTY_OVERRIDES += \
+<pre class="devsite-click-to-copy">
+PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.dex2oat-filter=interpret-only \
- dalvik.vm.image-dex2oat-filter=speed</code></pre>
+ dalvik.vm.image-dex2oat-filter=speed
+</pre>
<h2 id=dalvik_vm_properties>dalvik.vm Properties</h2>
@@ -383,23 +412,29 @@ all that is necessary.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>If this causes the system image to become too large, the next thing to try is
disabling pre-optimization of the prebuilts.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>Again, if the system image is still too large, try pre-optimizing only the boot
image.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<p>However, limiting to pre-optimizing only the boot-image means all apps will
have to be optimized on first boot. In order to avoid this, it is possible to
@@ -413,12 +448,16 @@ potentially interpreting more code and impacting runtime performance.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_DEX_PREOPT_BOOT_FLAGS := --compiler-filter=space</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_BOOT_FLAGS := --compiler-filter=space
+</pre>
<p>If a device has very limited system partition space, it’s possible to compile a
subset of classes in the boot classpath using the compiled classes list. Boot
@@ -427,12 +466,16 @@ could affect runtime performance.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-WITH_DEXPREOPT_BOOT_IMG_ONLY := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+WITH_DEXPREOPT_BOOT_IMG_ONLY := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_COPY_FILES += &lt;filename&gt;:system/etc/compiled-classes
+</pre>
<p>If a device has both limited space in the system and data partitions, compiler
filter flags can be used to disable compilation of certain apps. This will save
@@ -446,13 +489,17 @@ speed.
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true
-DONT_DEXPREOPT_PREBUILTS := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+DONT_DEXPREOPT_PREBUILTS := true
+</pre>
<p>device.mk:</p>
-<pre><code>PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
-$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)</code></pre>
+<pre class="devsite-click-to-copy">
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
+$(call add-product-dex-preopt-module-config,services,--compiler-filter=space)
+</pre>
<p>For a major version upgrade OTA, it can be useful to blacklist certain apps
from being pre-optimized since they will likely be out of date. This can be
@@ -461,11 +508,15 @@ done by specifying <code>LOCAL_DEX_PREOPT</code> (for all products) or with
<p>BoardConfig.mk:</p>
-<pre><code>WITH_DEXPREOPT := true</code></pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>Android.mk (of blacklisted apps):</p>
-<pre><code>LOCAL_DEX_PREOPT := false</code></pre>
+<pre class="devsite-click-to-copy">
+LOCAL_DEX_PREOPT := false
+</pre>
</body>
</html>
diff --git a/en/devices/tech/dalvik/dex-format.html b/en/devices/tech/dalvik/dex-format.html
index 3ff22c0d..fde14a8b 100644
--- a/en/devices/tech/dalvik/dex-format.html
+++ b/en/devices/tech/dalvik/dex-format.html
@@ -291,7 +291,7 @@ in the detection of certain forms of corruption. The value also
encodes a format version number as three decimal digits, which is
expected to increase monotonically over time as the format evolves.</p>
-<pre>
+<pre class="devsite-click-to-copy">
ubyte[8] DEX_FILE_MAGIC = { 0x64 0x65 0x78 0x0a 0x30 0x33 0x38 0x00 }
= "dex\n038\0"
</pre>
@@ -328,7 +328,7 @@ header whose <code>endian_tag</code> is <code>REVERSE_ENDIAN_CONSTANT</code>
instead of <code>ENDIAN_CONSTANT</code>, it would know that the file
has been byte-swapped from the expected form.</p>
-<pre>
+<pre class="devsite-click-to-copy">
uint ENDIAN_CONSTANT = 0x12345678;
uint REVERSE_ENDIAN_CONSTANT = 0x78563412;
</pre>
@@ -345,7 +345,7 @@ an index value is absent.</p>
<p>The chosen value for <code>NO_INDEX</code> is
representable as a single byte in the <code>uleb128p1</code> encoding.</p>
-<pre>
+<pre class="devsite-click-to-copy">
uint NO_INDEX = 0xffffffff; // == -1 if treated as a signed int
</pre>
@@ -2659,7 +2659,7 @@ each register for the <code>DBG_RESTART_LOCAL</code> code.</p>
registers by a small amount and then emit a new position table entry.
The formula for the increments are as follows:</p>
-<pre>
+<pre class="devsite-click-to-copy">
DBG_FIRST_SPECIAL = 0x0a // the smallest special opcode
DBG_LINE_BASE = -4 // the smallest line number increment
DBG_LINE_RANGE = 15 // the number of line increments represented
diff --git a/en/devices/tech/dalvik/gc-debug.html b/en/devices/tech/dalvik/gc-debug.html
index 029fde29..b1a62fe0 100644
--- a/en/devices/tech/dalvik/gc-debug.html
+++ b/en/devices/tech/dalvik/gc-debug.html
@@ -216,8 +216,11 @@ to <code>dalvikvm</code> when starting a command line program. When an app gets
the ANR request signal (SIGQUIT) it dumps information related to its locks,
thread stacks, and GC performance.</p>
-<p>The way to get GC timing dumps is to use:<br>
-<code>$ adb shell kill -S QUIT <pid></code></p>
+<p>The way to get GC timing dumps is to use:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell kill -S QUIT <var>PID</var>
+</pre>
<p>This creates a <code>traces.txt</code> file in <code>/data/anr/</code>. This
file contains some ANR dumps as well as GC timings. You can locate the
@@ -226,7 +229,7 @@ show a few things that may be of interest. It will show the histogram info for
each GC type’s phases and pauses. The pauses are usually more important to look
at. For example:</p>
-<pre>
+<pre class="devsite-click-to-copy">
sticky concurrent mark sweep paused: Sum: 5.491ms 99% C.I. 1.464ms-2.133ms Avg: 1.830ms Max: 2.133ms
</pre>
@@ -240,14 +243,14 @@ determine if long pauses are caused by the GC being slow or the thread
suspending slowly. Here is an example of what a normal time to suspend
resembles on a Nexus 5:</p>
-<pre>
+<pre class="devsite-click-to-copy">
suspend all histogram: Sum: 1.513ms 99% C.I. 3us-546.560us Avg: 47.281us Max: 601us
</pre>
<p>There are also a few other areas of interest, such as total time spent, GC
throughput, etc. Examples:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Total time spent in GC: 502.251ms
Mean GC size throughput: 92MB/s
Mean GC object throughput: 1.54702e+06 objects/s
@@ -255,15 +258,15 @@ Mean GC object throughput: 1.54702e+06 objects/s
<p>Here is an example of how to dump the GC timings of an already running app:
-<pre>
-$ adb shell kill -s QUIT &lt;pid&gt;
-$ adb pull /data/anr/traces.txt
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell kill -s QUIT <var>PID</var></code>
+<code class="devsite-terminal">adb pull /data/anr/traces.txt</code>
</pre>
<p>At this point the GC timings are inside of traces.txt. Here is example output
from Google maps:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Start Dumping histograms for 34 iterations for sticky concurrent mark sweep
ScanGrayAllocSpaceObjects: Sum: 196.174ms 99% C.I. 0.011ms-11.615ms Avg: 1.442ms Max: 14.091ms
FreeList: Sum: 140.457ms 99% C.I. 6us-1676.749us Avg: 128.505us Max: 9886us
@@ -342,8 +345,8 @@ reasons. The checks will catch a few errors that could cause heap corruption
such as using invalid/stale local and global references. Here is how to enable
CheckJNI:</p>
-<pre>
-$ adb shell setprop dalvik.vm.checkjni true
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell setprop dalvik.vm.checkjni true
</pre>
<p>Forcecopy mode is another part of CheckJNI that is very useful for detecting
@@ -355,8 +358,8 @@ the red zone don’t match what is expected, this usually means a buffer overrun
or underrun occurred. This would cause CheckJNI to abort. Here is how to enable
forcecopy mode:</p>
-<pre>
-$ adb shell setprop dalvik.vm.jniopts forcecopy
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell setprop dalvik.vm.jniopts forcecopy
</pre>
<p>One example of an error that CheckJNI should catch is writing past the end of
@@ -388,18 +391,18 @@ that valgrind is orders of magnitude slower than normal execution.</p>
<p>Here is an example use:</p>
-<pre>
+<pre class="devsite-click-to-copy">
# build and install
-$ mmm external/valgrind
-$ adb remount && adb sync
+<code class="devsite-terminal">mmm external/valgrind</code>
+<code class="devsite-terminal">adb remount && adb sync</code>
# disable selinux
-$ adb shell setenforce 0
-$ adb shell setprop wrap.com.android.calculator2
+<code class="devsite-terminal">adb shell setenforce 0</code>
+<code class="devsite-terminal">adb shell setprop wrap.com.android.calculator2</code>
"TMPDIR=/data/data/com.android.calculator2 logwrapper valgrind"
# push symbols
-$ adb shell mkdir /data/local/symbols
-$ adb push $OUT/symbols /data/local/symbols
-$ adb logcat
+<code class="devsite-terminal">adb shell mkdir /data/local/symbols</code>
+<code class="devsite-terminal">adb push $OUT/symbols /data/local/symbols</code>
+<code class="devsite-terminal">adb logcat</code>
</pre>
@@ -410,7 +413,7 @@ useful information:
<code>art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:383] Tried to mark 0x2
not contained by any spaces</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:384] Attempting see if
it's a bad root
art E 5955 5955 art/runtime/gc/collector/mark_sweep.cc:485] Found invalid
@@ -435,7 +438,7 @@ href="https://android-review.googlesource.com/#/c/133932/">https://android-revie
<p>In the case where the object isn’t a root, output similar to the following
prints:</p>
-<pre>
+<pre class="devsite-click-to-copy">
01-15 12:38:00.196 1217 1238 E art : Attempting see if it's a bad root
01-15 12:38:00.196 1217 1238 F art :
art/runtime/gc/collector/mark_sweep.cc:381] Can't mark invalid object
diff --git a/en/devices/tech/dalvik/jit-compiler.html b/en/devices/tech/dalvik/jit-compiler.html
index 6c874d84..9090349c 100644
--- a/en/devices/tech/dalvik/jit-compiler.html
+++ b/en/devices/tech/dalvik/jit-compiler.html
@@ -54,7 +54,7 @@ JIT/AOT Compilation</a> on developer.android.com for a more thorough overview.
<h2 id="architectural-overview">Architectural Overview</h2>
-<img src="images/jit-arch.png" alt="JIT architecture" width="633" id="JIT-architecture" />
+<img src="/devices/tech/dalvik/images/jit-arch.png" alt="JIT architecture" width="633" id="JIT-architecture" />
<p class="img-caption">
<strong>Figure 1.</strong> JIT architecture - how it works
</p>
@@ -83,12 +83,12 @@ application has access to the directory.
compilation.</li>
</ol>
-<img src="images/jit-profile-comp.png" alt="Profile-guided comp" width="452" id="JIT-profile-comp" />
+<img src="/devices/tech/dalvik/images/jit-profile-comp.png" alt="Profile-guided comp" width="452" id="JIT-profile-comp" />
<p class="img-caption">
<strong>Figure 2.</strong> Profile-guided compilation
</p>
-<img src="images/jit-daemon.png" alt="JIT daemon" width="718" id="JIT-daemon" />
+<img src="/devices/tech/dalvik/images/jit-daemon.png" alt="JIT daemon" width="718" id="JIT-daemon" />
<p class="img-caption">
<strong>Figure 3.</strong> How the daemon works
</p>
@@ -103,7 +103,7 @@ to behave more like shared libraries.
See the following high-level overview of how JIT works in the next diagram.
</p>
-<img src="images/jit-workflow.png" alt="JIT architecture" width="707" id="JIT-workflow" />
+<img src="/devices/tech/dalvik/images/jit-workflow.png" alt="JIT architecture" width="707" id="JIT-workflow" />
<p class="img-caption">
<strong>Figure 4.</strong> JIT data flow
</p>
@@ -183,7 +183,7 @@ compilation to a later stage). The compilation levels can be configured via
system properties with the defaults being:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install=interpret-only
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.ab-ota=speed-profile
@@ -211,20 +211,20 @@ copying and pasting. A few common use cases:
<h3 id="turn-on-jit-logging">Turn on JIT logging</h3>
-<pre>
-$ adb root
-$ adb shell stop
-$ adb shell setprop dalvik.vm.extra-opts -verbose:jit
-$ adb shell start
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell stop</code>
+<code class="devsite-terminal">adb shell setprop dalvik.vm.extra-opts -verbose:jit</code>
+<code class="devsite-terminal">adb shell start</code>
</pre>
<h3 id="disable-jit-and-run-applications-in-interpreter">Disable JIT</h3>
-<pre>
-$ adb root
-$ adb shell stop
-$ adb shell setprop dalvik.vm.usejit false
-$ adb shell start
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell stop</code>
+<code class="devsite-terminal">adb shell setprop dalvik.vm.usejit false</code>
+<code class="devsite-terminal">adb shell start</code>
</pre>
<h3 id="force-compilation-of-a-specific-package">Force compilation of a specific
@@ -232,11 +232,15 @@ package</h3>
<ul>
<li>Profile-based:
-<code>$ adb shell cmd package compile -m speed-profile -f
-my-package</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed-profile -f my-package
+</pre>
+</li>
<li>Full:
-<code>$ adb shell cmd package compile -m speed -f
-my-package</code></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed -f my-package
+</pre>
+</li>
</ul>
<h3 id="force-compilation-of-all-packages">Force compilation of all
@@ -244,20 +248,31 @@ packages</h3>
<ul>
<li>Profile-based:
-<code>$ adb shell cmd package compile -m speed-profile -f
--a</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed-profile -f -a
+</pre>
+</li>
<li>Full:
-<code>$ adb shell cmd package compile -m speed -f -a</code></li></ul>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile -m speed -f -a
+</pre>
+</li>
+</ul>
<h3 id="clear-profile-data-and-remove-compiled-code">Clear profile data and
remove compiled code</h3>
<ul>
<li>One package:
-<code>$ adb shell cmd package compile --reset my-package</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile --reset my-package
+</pre>
+</li>
<li>All packages
-<code>$ adb shell cmd package compile --reset
--a</code></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell cmd package compile --reset -a
+</pre>
+</li>
</ul>
<h2 id="recommendation">Recommendation</h2>
@@ -270,7 +285,7 @@ Note that it is strongly recommended to use the default following
support.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install=interpret-only
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.boot=verify-profile (or interpret-only)
@@ -281,7 +296,7 @@ Here’s a detailed explanation about the <code>pm.dexopt</code> options, and th
reasoning for our recommendations:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.install
</pre>
@@ -290,7 +305,7 @@ This is the compilation filter used when installing application through the
Play Store. For faster installs we recommend <code>interpret-only</code>.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.bg-dexopt
</pre>
@@ -300,7 +315,7 @@ fully charged. We recommend using <code>speed-profile</code> to take advantage
of profile guided compilation and save on storage.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.ab-ota
</pre>
@@ -311,7 +326,7 @@ update. If the device supports A/B OTA, we recommend using
save on storage.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.nsys-library
pm.dexopt.shared-apk
pm.dexopt.core-app
@@ -324,7 +339,7 @@ the <code>speed</code> filter, as the platform does not support efficient
profiling of them.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.first-boot
</pre>
@@ -336,7 +351,7 @@ use the phone for the very first time. Note that if all applications in /system
are already speed compiled, <code>pm.dexopt.first-boot</code> has no effect.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
pm.dexopt.boot
</pre>
@@ -364,11 +379,13 @@ filter. To do this, edit the following files to include these entries.
<p>Add the following entry to <code>BoardConfig.mk</code>:</p>
-<pre>WITH_DEXPREOPT := true</pre>
+<pre class="devsite-click-to-copy">
+WITH_DEXPREOPT := true
+</pre>
<p>Add the following entry to <code>device.mk</code>:</p>
-<pre>
+<pre class="devsite-click-to-copy">
PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := --compiler-filter=interpret-only
</pre>
diff --git a/en/devices/tech/datausage/tags-explained.html b/en/devices/tech/datausage/tags-explained.html
index 1d3dc6b9..73fb8e17 100644
--- a/en/devices/tech/datausage/tags-explained.html
+++ b/en/devices/tech/datausage/tags-explained.html
@@ -35,10 +35,11 @@ the tag's uid_tag portion, and stats are collected for the acct_tag
portion separately.</p>
<p>Without explicit tagging, the qtaguid module will assume the
<code>default_tag:  {acct_tag=0, uid_tag=10003}</code></p>
-<pre><code> a:  {acct_tag=1, uid_tag=10003}
+<pre class="devsite-click-to-copy">
+ a:  {acct_tag=1, uid_tag=10003}
b:  {acct_tag=2, uid_tag=10003}
c:  {acct_tag=3, uid_tag=10003}
-</code></pre>
+</pre>
<p><code>a, b, c…</code> represent explicit tags associated with specific sockets.</p>
<p><code>default_tag (acct_tag=0)</code> is the default accounting tag that contains
the total traffic for that uid, including all untagged
diff --git a/en/devices/tech/debug/asan.html b/en/devices/tech/debug/asan.html
index 0ab286dc..353aa4bd 100644
--- a/en/devices/tech/debug/asan.html
+++ b/en/devices/tech/debug/asan.html
@@ -62,7 +62,7 @@ to the build rules. Clang may find bugs in your code that GCC missed.</p>
<p>Add <code>LOCAL_SANITIZE:=address</code> to the build rule of the
executable.</p>
-<pre>
+<pre class="devsite-click-to-copy">
LOCAL_SANITIZE:=address
</pre>
@@ -83,7 +83,7 @@ which are built with ASan, you'll need two copies of the library. The
recommended way to do this is to add the following to <code>Android.mk</code>
for the module in question:</p>
-<pre>
+<pre class="devsite-click-to-copy">
LOCAL_SANITIZE:=address
LOCAL_MODULE_RELATIVE_PATH := asan
</pre>
@@ -95,7 +95,7 @@ LOCAL_MODULE_RELATIVE_PATH := asan
<p>For system daemons, add the following to the appropriate section of
<code>/init.rc</code> or <code>/init.$device$.rc</code>.</p>
-<pre>
+<pre class="devsite-click-to-copy">
setenv LD_LIBRARY_PATH /system/lib/asan
</pre>
@@ -111,9 +111,9 @@ sync</code>.</p>
when present by reading <code>/proc/$PID/maps</code>. If it's not, you may need
to disable SELinux, like so:</p>
-<pre>
-$ adb root
-$ adb shell setenforce 0
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell setenforce 0</code>
# restart the process with adb shell kill $PID
# if it is a system service, or may be adb shell stop; adb shell start.
</pre>
@@ -126,7 +126,7 @@ of Android is built without frame pointers. As a result, you will often get
only one or two meaningful frames. To fix this, either rebuild the library with
ASan (recommended!), or with:</p>
-<pre>
+<pre class="devsite-click-to-copy">
LOCAL_CFLAGS:=-fno-omit-frame-pointer
LOCAL_ARM_MODE:=arm
</pre>
@@ -167,7 +167,7 @@ this). Edit the Zygote record in
<code>system/core/rootdir/init.zygote(<em>32|64</em>).rc</code> to add the
following lines:</p>
-<pre>
+<pre class="devsite-click-to-copy">
setenv LD_LIBRARY_PATH /system/lib/asan:/system/lib
setenv ASAN_OPTIONS
allow_user_segv_handler=true
@@ -186,10 +186,10 @@ trading some memory overhead for slower application startup.</p>
that’s used to run apps under Valgrind. The following example runs the Gmail app
under ASan:</p>
-<pre>
-$ adb root
-$ adb shell setenforce 0 # disable SELinux
-$ adb shell setprop wrap.com.google.android.gm "asanwrapper"
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell setenforce 0 # disable SELinux</code>
+<code class="devsite-terminal">adb shell setprop wrap.com.google.android.gm "asanwrapper"</code>
</pre>
<p>In this context, asanwrapper rewrites <code>/system/bin/app_process</code>
@@ -209,16 +209,16 @@ AddressSanitizer at once.</p>
<p>Run the following commands in the same build tree.</p>
-<pre>
-$ make -j42
-$ SANITIZE_TARGET=address make -j42
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">make -j42</code>
+<code class="devsite-terminal">SANITIZE_TARGET=address make -j42</code>
</pre>
<p>In this mode, <code>userdata.img</code> contains extra libraries and must be
flashed to the device as well. Use the following command line:</p>
-<pre>
-$ fastboot flash userdata && fastboot flashall
+<pre class="devsite-terminal devsite-click-to-copy">
+fastboot flash userdata && fastboot flashall
</pre>
<p>At the moment of this writing, modern Nexus and Pixel devices boot to the UI in this mode.</p>
diff --git a/en/devices/tech/debug/dumpsys.html b/en/devices/tech/debug/dumpsys.html
index 80f93e54..e87722ba 100644
--- a/en/devices/tech/debug/dumpsys.html
+++ b/en/devices/tech/debug/dumpsys.html
@@ -34,8 +34,8 @@ output, specify the service you would like to examine. </p>
<p>For example, the following command:</p>
-<pre>
-$ adb shell dumpsys input
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys input
</pre>
<p>provides system data for input components such as touchscreens or built-in
@@ -47,8 +47,12 @@ keyboards.</p>
<p>For a complete list of system services that you can use with dumpsys, try the
following command:</p>
-<pre class="no-pretty-print">
-$ adb shell dumpsys -l
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys -l
+</pre>
+
+<p>Example output:</p>
+<pre class="devsite-click-to-copy">
Currently running services:
DockObserver
SurfaceFlinger
diff --git a/en/devices/tech/debug/eval_perf.html b/en/devices/tech/debug/eval_perf.html
index 44173fe0..79c77de9 100644
--- a/en/devices/tech/debug/eval_perf.html
+++ b/en/devices/tech/debug/eval_perf.html
@@ -169,8 +169,10 @@ thread enters uninterruptible sleep. It is critical for performance analysis
because uninterruptible sleep is a very common indicator of jitter.</li>
<li>Ensure you have sufficient tracing for the GPU and display pipelines. On
recent Qualcomm SOCs, tracepoints are enabled using:</li>
-<pre>$ adb shell "echo 1 &gt; /d/tracing/events/kgsl/enable"
-$ adb shell "echo 1 &gt; /d/tracing/events/mdss/enable"</pre>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell "echo 1 &gt; /d/tracing/events/kgsl/enable"</code>
+<code class="devsite-terminal">adb shell "echo 1 &gt; /d/tracing/events/mdss/enable"</code>
+</pre>
<p>These events remain enabled when you run systrace so you can see additional
information in the trace about the display pipeline (MDSS) in the
diff --git a/en/devices/tech/debug/ftrace.html b/en/devices/tech/debug/ftrace.html
index e48362df..2fbaba4b 100644
--- a/en/devices/tech/debug/ftrace.html
+++ b/en/devices/tech/debug/ftrace.html
@@ -55,10 +55,14 @@ way to determine the correct values other than looking at the appropriate header
divided into categories in <code>/d/tracing/events</code>.
<p>To enable events on a per-category basis, use:
-<pre>$ echo 1 &gt; /d/tracing/events/irq/enable</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 1 &gt; /d/tracing/events/irq/enable
+</pre>
<p>To enable events on per-event basis, use:
-<pre>$ echo 1 &gt; /d/tracing/events/sched/sched_wakeup/enable</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 1 &gt; /d/tracing/events/sched/sched_wakeup/enable
+</pre>
<p>If extra events have been enabled by writing to sysfs nodes, they will
<strong>not</strong> be reset by atrace. A common pattern
@@ -66,9 +70,11 @@ for Qualcomm device bringup is to enable <code>kgsl</code> (GPU) and
<code>mdss</code> (display pipeline) tracepoints and then use atrace or
<a href="/devices/tech/debug/systrace.html">systrace</a>:</p>
-<pre>$ adb shell "echo 1 &gt; /d/tracing/events/mdss/enable"
-$ adb shell "echo 1 &gt; /d/tracing/events/kgsl/enable"
-$ ./systrace.py sched freq idle am wm gfx view binder_driver irq workq ss sync -t 10 -b 96000 -o full_trace.html</pre>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell "echo 1 &gt; /d/tracing/events/mdss/enable"</code>
+<code class="devsite-terminal">adb shell "echo 1 &gt; /d/tracing/events/kgsl/enable"</code>
+<code class="devsite-terminal">./systrace.py sched freq idle am wm gfx view binder_driver irq workq ss sync -t 10 -b 96000 -o full_trace.html</code>
+</pre>
<p>You can also use ftrace without atrace or systrace, which is
useful when you want kernel-only traces (or if you've taken the time to write
@@ -76,13 +82,25 @@ the user-mode tracing property by hand). To run just ftrace:</p>
<ol>
<li>Set the buffer size to a value large enough for your trace:
-<pre>$ echo 96000 &gt; /d/tracing/buffer_size_kb</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 96000 &gt; /d/tracing/buffer_size_kb
+</pre>
+</li>
<li>Enable tracing:
-<pre>$ echo 1 &gt; /d/tracing/tracing_on</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 1 &gt; /d/tracing/tracing_on
+</pre>
+</li>
<li>Run your test, then disable tracing:
-<pre>$ echo 0 &gt; /d/tracing/tracing_on</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 0 &gt; /d/tracing/tracing_on
+</pre>
+</li>
<li>Dump the trace:
-<pre>$ cat /d/tracing/trace &gt; /data/local/tmp/trace_output</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /d/tracing/trace &gt; /data/local/tmp/trace_output
+</pre>
+</li>
</ol>
<p>The trace_output gives the trace in text form. To visualize it using
@@ -90,7 +108,9 @@ Catapult, get the
<a href="https://github.com/catapult-project/catapult/tree/master/">Catapult
repository</a> from Github and run trace2html:</p>
-<pre>$ catapult/tracing/bin/trace2html ~/path/to/trace_file</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+catapult/tracing/bin/trace2html ~/path/to/trace_file
+</pre>
<p>By default, this writes <code>trace_file.html</code> in the same
directory.</p>
@@ -120,7 +140,9 @@ tree</a> (<code>tracing/bin/html2trace</code>) to uncompress the trace.</li>
<li>Find a line at the beginning of the trace containing
<code>tracing_mark_sync</code>. It should look something like this:
-<pre>&lt;5134&gt;-5134 (-----) [003] ...1 68.104349: tracing_mark_write: trace_event_clock_sync: parent_ts=68.104286</pre>
+<pre class="devsite-click-to-copy">
+&lt;5134&gt;-5134 (-----) [003] ...1 68.104349: tracing_mark_write: trace_event_clock_sync: parent_ts=68.104286
+</pre>
<br>If this line does not exist (or if you used ftrace without atrace), then
timings will be relative from the first event in the ftrace log.
@@ -154,11 +176,16 @@ CONFIG_IRQSOFF_TRACER=y, CONFIG_FUNCTION_PROFILER=y, and CONFIG_PREEMPT_TRACER=y
</li>
<li>Rebuild and boot the new kernel.</li>
<li>Run the following to check for available tracers:
-<pre>$ cat /d/tracing/available_tracers</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /d/tracing/available_tracers
+</pre>
+</li>
<li>Confirm the command returns <code>function</code>, <code>irqsoff</code>,
<code>preemptoff</code>, and <code>preemptirqsoff</code>.</li>
<li>Run the following to ensure dynamic ftrace is working:
-<pre>$ cat /d/tracing/available_filter_functions | grep &lt;a function you care about&gt;</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /d/tracing/available_filter_functions | grep &lt;a function you care about&gt;
+</pre>
</li>
</ol>
@@ -195,22 +222,43 @@ so it's time to use the function profiler:</p>
<ol>
<li>As functions are sometimes renamed by the compiler, confirm
<code>ion_client_destroy</code> is there by using:
-<pre>$ cat /d/tracing/available_filter_functions | grep ion_client_destroy</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /d/tracing/available_filter_functions | grep ion_client_destroy
+</pre>
</li>
<li>After confirming it is there, use it as the ftrace filter:
-<pre>$ echo ion_client_destroy &gt; /d/tracing/set_ftrace_filter</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo ion_client_destroy &gt; /d/tracing/set_ftrace_filter
+</pre>
+</li>
<li>Turn on the function profiler:
-<pre>$ echo function &gt; /d/tracing/current_tracer</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo function &gt; /d/tracing/current_tracer
+</pre>
+</li>
<li>Turn on stack traces whenever a filter function is called:
-<pre>$ echo func_stack_trace &gt; /d/tracing/trace_options</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo func_stack_trace &gt; /d/tracing/trace_options
+</pre>
+</li>
<li>Increase the buffer size:
-<pre>$ echo 64000 &gt; /d/tracing/buffer_size_kb</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 64000 &gt; /d/tracing/buffer_size_kb
+</pre>
+</li>
<li>Turn on tracing:
-<pre>$ echo 1 &gt; /d/tracing/trace_on</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 1 &gt; /d/tracing/trace_on
+</pre>
+</li>
<li>Run the test and get the trace:
-<pre>$ cat /d/tracing/trace &gt; /data/local/tmp/trace</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /d/tracing/trace &gt; /data/local/tmp/trace
+</pre>
+</li>
<li>View the trace to see lots and lots of stack traces:
-<pre> cameraserver-643 [003] ...1 94.192991: ion_client_destroy &lt;-ion_release
+<pre class="devsite-click-to-copy">
+ cameraserver-643 [003] ...1 94.192991: ion_client_destroy &lt;-ion_release
cameraserver-643 [003] ...1 94.192997: &lt;stack trace&gt;
=&gt; ftrace_ops_no_ops
=&gt; ftrace_graph_call
@@ -220,7 +268,9 @@ so it's time to use the function profiler:</p>
=&gt; ____fput
=&gt; task_work_run
=&gt; do_notify_resume
- =&gt; work_pending</pre></li>
+ =&gt; work_pending
+ </pre>
+</li>
</ol>
<p>Based on inspection of the ion driver, we can see that
@@ -286,12 +336,21 @@ the lock trace when ftrace was not running.</p>
ftrace:</p>
<ol>
<li>Enable tracing:
-<pre>$ echo 1 &gt; /proc/sys/kernel/lock_stat</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 1 &gt; /proc/sys/kernel/lock_stat
+</pre>
+</li>
<li>Run your test.</li>
<li>Disable tracing:
-<pre>$ echo 0 &gt; /proc/sys/kernel/lock_stat</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+echo 0 &gt; /proc/sys/kernel/lock_stat
+</pre>
+</li>
<li>Dump your trace:
-<pre>$ cat /proc/lock_stat &gt; /data/local/tmp/lock_stat</pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+cat /proc/lock_stat &gt; /data/local/tmp/lock_stat
+</pre>
+</li>
</ol>
<p>For help interpreting the resulting output, refer to lockstat documentation
diff --git a/en/devices/tech/debug/gdb.html b/en/devices/tech/debug/gdb.html
new file mode 100644
index 00000000..27c99328
--- /dev/null
+++ b/en/devices/tech/debug/gdb.html
@@ -0,0 +1,141 @@
+<html devsite>
+ <head>
+ <title>Using GDB</title>
+ <meta name="project_path" value="/_project.yaml" />
+ <meta name="book_path" value="/_book.yaml" />
+ </head>
+ <body>
+ <!--
+ Copyright 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+
+<p>The GNU Project debugger (GDB) is a commonly used Unix debugger. This page
+details using <code>gdb</code> to debug Android apps and processes.</p>
+
+<h2 id=running>Debugging running apps or processes</h2>
+
+<p>To connect to an already-running app or native daemon, use
+<code>gdbclient</code> with a PID. For example, to debug the process with PID
+1234, run:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+gdbclient 1234
+</pre>
+
+<p>The script sets up port forwarding, starts the appropriate
+<code>gdbserver</code> on the device, starts the appropriate <code>gdb</code> on
+the host, configures <code>gdb</code> to find symbols, and connects
+<code>gdb</code> to the remote <code>gdbserver</code>.</p>
+
+<h2 id=starts>Debugging native process startup</h2>
+
+<p>To debug a process as it starts, use <code>gdbserver</code> or
+<code>gdbserver64</code> (for 64-bit processes). For example:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell gdbserver :5039 /system/bin/<var>MY_TEST_APP</var>
+</pre>
+
+<p>Example output:</p>
+<pre class="devsite-click-to-copy">
+Process <var>MY_TEST_APP</var> created; pid = 3460
+Listening on port 5039
+</pre>
+
+<p>Next, identify the application PID from the <code>gdbserver</code> output and
+use it in another terminal window:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+gdbclient <var>APP_PID</var>
+</pre>
+
+<p>Finally, enter <strong>continue</strong> at the <code>gdb</code> prompt.</p>
+
+<p class="note"><strong>Note:</strong> If you specify the wrong
+<code>gdbserver</code>, you'll get an unhelpful error message (such as
+"<code>Reply contains invalid hex digit 59</code>").</p>
+
+<h2 id="app-startup">Debugging app startup</h2>
+
+<p>Sometimes you want to debug an app as it starts, such as when there's a crash
+and you want to step through code to see what happens <em>before</em> the crash.
+<a href="#running">Attaching</a> works in some cases, but in other cases is
+impossible because the app crashes before you can attach. The
+<code>logwrapper</code> approach (used for <code>strace</code> and
+<code>valgrind</code>) does not always work because the app might not have
+permissions to open a port, and <code>gdbserver</code> inherits that
+restriction.</p>
+
+<p>To debug app startup, use the developer options in Settings to instruct
+the app to wait for a Java debugger to attach:</p>
+
+<ol>
+<li>Go to <em>Settings > Developer options > Select debug app</em> and choose
+your app from the list, then press <strong>Wait for debugger</strong>.</li>
+
+<li>Start the app, either from the launcher or by using the command line to run:
+<pre class="devsite-terminal devsite-click-to-copy">
+am start -a android.intent.action.MAIN -n <var>APP_NAME</var>/.<var>APP_ACTIVITY</var>
+</pre></li>
+
+<li>Wait for the app to load and a dialog to appear telling you the app is
+waiting for a debugger.</li>
+
+<li>Attach <code>gdbserver</code>/<code>gdbclient</code> normally, set
+breakpoints, then continue the process.</li></ol>
+
+<p>To let the app actually run, attach a Java Debug Wire Protocol (JDWP)
+debugger such as Java Debugger (jdb):</p>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb forward tcp:12345 jdwp:<var>XXX</var> # (Where XXX is the pid of the debugged process.)</code>
+<code class="devsite-terminal">jdb -attach localhost:12345</code>
+</pre>
+
+<h2 id=crash>Debugging apps or processes that crash</h2>
+
+<p>If you want <code>debuggerd</code> to suspend crashed processes so you can
+attach <code>gdb</code>, set the appropriate property:</p>
+
+<pre class="devsite-click-to-copy">
+# Android 7.0 Nougat and later.
+<code class="devsite-terminal">adb shell setprop debug.debuggerd.wait_for_gdb true</code>
+</pre>
+
+<pre class="devsite-click-to-copy">
+# Android 6.0 Marshmallow and earlier.
+<code class="devsite-terminal">adb shell setprop debug.db.uid 999999</code>
+</pre>
+
+<p>At the end of the usual crash output, <code>debuggerd</code> provides
+instructions on how to connect <code>gdb</code> using the command:
+<pre class="devsite-terminal devsite-click-to-copy">
+gdbclient <var>PID</var>
+</pre>
+
+
+<h2 id=symbols>Debugging without symbols</h2>
+
+<p>For 32-bit ARM, if you don’t have symbols, <code>gdb</code> can get confused
+about the instruction set it is disassembling (ARM or Thumb). To specify the
+instruction set chosen as the default when symbol information is missing, set
+the following property:</p>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+set arm fallback-mode arm # or thumb
+</pre>
+
+ </body>
+</html>
diff --git a/en/devices/tech/debug/index.html b/en/devices/tech/debug/index.html
index b2f4c140..268f24ee 100644
--- a/en/devices/tech/debug/index.html
+++ b/en/devices/tech/debug/index.html
@@ -25,11 +25,11 @@
<p>This section summarizes useful tools and related commands for debugging,
tracing, and profiling native Android platform code when developing
-platform-level features. This page covers use of <code>debuggerd</code>, a
-daemon process for collecting error information after applications crash, and
-the GNU Project debugger (GDB).</p>
+platform-level features.</p>
-<p>Other pages in this section explore system services with
+<p>This page covers use of <code>debuggerd</code>, a daemon process for
+collecting error information after applications crash. Other pages in this
+section explore system services with
<a href="/devices/tech/debug/dumpsys.html">Dumpsys</a>, viewing
<a href="/devices/tech/debug/native-memory.html">native memory</a>,
<a href="/devices/tech/debug/netstats.html">network</a>, and
@@ -37,8 +37,9 @@ the GNU Project debugger (GDB).</p>
<a href="/devices/tech/debug/asan.html">AddressSanitizer</a> to detect memory
bugs in native code, evaluating
<a href="/devices/tech/debug/eval_perf.html"> performance issues</a> (includes
-<a href="/devices/tech/debug/systrace">systrace</a>), and several other
-debugging tools.</p>
+<a href="/devices/tech/debug/systrace">systrace</a>), and using
+<a href="/devices/tech/debug/gdb.html">GNU Project debugger (GDB)</a> and
+other debugging tools.</p>
<h2 id=debuggerd>Using debuggerd</h2>
@@ -57,7 +58,7 @@ opt out of crash reporting.</p>
<p>Example <code>debuggerd</code> output (with timestamps and extraneous
information removed):</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/aosp_angler/angler:7.1.1/NYC/enh12211018:eng/test-keys'
Revision: '0'
@@ -95,8 +96,12 @@ unwind with line number information by pasting the above example into
<code>stack</code> will be on your $PATH already so you don't need to give the
full path.</p>
-<pre>
-$ development/tools/stack
+<pre class="devsite-terminal devsite-click-to-copy">
+development/tools/stack
+</pre>
+
+<p>Example output:</p>
+<pre class="devsite-click-to-copy">
Reading native crash info from stdin
03-02 23:53:49.477 17951 17951 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-02 23:53:49.477 17951 17951 F DEBUG : Build fingerprint: 'Android/aosp_angler/angler:7.1.1/NYC/enh12211018:eng/test-keys'
@@ -146,93 +151,20 @@ directly from <code>debuggerd</code> without taking up anywhere near as much
space as an unstripped version.</p>
<p>You can also <code>stack</code> an entire tombstone. Example:</p>
-<pre>
-$ stack < FS/data/tombstones/tombstone_05
+<pre class="devsite-terminal devsite-click-to-copy">
+stack < FS/data/tombstones/tombstone_05</code>
</pre>
<p>This is useful if you've just unzipped a bugreport in the current directory.
For more information about diagnosing native crashes and tombstones, see
<a href="/devices/tech/debug/native-crash.html">Diagnosing Native Crashes</a>.
</p>
-<h3>Getting a stack trace/tombstone from a running process</h3>
+<h2 id="tombstone">Getting a stack trace/tombstone from a running process</h2>
<p>You can also use <code>debuggerd</code> on a running process. From the
command line, invoke <code>debuggerd</code> using a process ID (PID) to dump the
full tombstone to <code>stdout</code>. To get just the stack for every thread in
-the process, include the <code>-b</code> or <code>--backtrace</code> flag.
-
-<h2 id=native>Using GDB</h2>
-
-<p>The GNU Project debugger (GDB) is a commonly used Unix debugger.</p>
-
-<h3 id=running>Debugging a running app</h3>
-
-<p>To connect to an already-running app or native daemon, use
-<code>gdbclient</code> with a PID. For example, to debug the process with PID
-1234, run:</p>
-
-<pre class="no-pretty-print">
-$ gdbclient 1234
-</pre>
-
-<p>The script sets up port forwarding, starts the appropriate
-<code>gdbserver</code> on the device, starts the appropriate <code>gdb</code> on
-the host, configures <code>gdb</code> to find symbols, and connects
-<code>gdb</code> to the remote <code>gdbserver</code>.</p>
-
-<h3 id=starts>Debugging a native process as it starts</h3>
-
-<p>To debug a process as it starts, use <code>gdbserver</code> or
-<code>gdbserver64</code> (for 64-bit processes). For example:</p>
-
-<pre class="no-pretty-print">
-$ adb shell gdbserver :5039 /system/bin/<em>my_test_app</em>
-Process my_test_app created; pid = 3460
-Listening on port 5039
-</pre>
-
-<p>Next, identify the application PID from the <code>gdbserver</code> output and
-use it in another terminal window:</p>
-
-<pre class="no-pretty-print">
-$ gdbclient <em>&lt;app pid&gt;</em>
-</pre>
-
-<p>Finally, enter <strong>continue</strong> at the <code>gdb</code> prompt.</p>
-
-<p class="note"><strong>Note:</strong> If you use the wrong
-<code>gdbserver</code>, you'll get an unhelpful error message (such as
-"<code>Reply contains invalid hex digit 59</code>").</p>
-
-<h3 id=crash>Debugging processes that crash</h3>
-
-<p>If you want <code>debuggerd</code> to suspend crashed processes so you can
-attach <code>gdb</code>, set the appropriate property:</p>
-
-<pre class="no-pretty-print">
-# Android 7.0 Nougat and later.
-$ adb shell setprop debug.debuggerd.wait_for_gdb true
-
-# Android 6.0 Marshmallow and earlier.
-$ adb shell setprop debug.db.uid 999999
-</pre>
-
-<p>At the end of the usual crash output, <code>debuggerd</code> provides
-instructions on how to connect <code>gdb</code> using the command:
-<pre class="no-pretty-print">
-$ gdbclient &lt;pid&gt;
-</pre>
-
-<h3 id=symbols>Debugging without symbols</h3>
-
-<p>For 32-bit ARM, if you don’t have symbols, <code>gdb</code> can get confused
-about the instruction set it is disassembling (ARM or Thumb). To specify the
-instruction set chosen as the default when symbol information is missing, set
-the following property:</p>
-
-<pre class="no-pretty-print">
-$ set arm fallback-mode arm # or thumb
-</pre>
+the process, include the <code>-b</code> or <code>--backtrace</code> flag.</p>
</body>
</html>
diff --git a/en/devices/tech/debug/native-crash.html b/en/devices/tech/debug/native-crash.html
index fec60690..c1658cc5 100644
--- a/en/devices/tech/debug/native-crash.html
+++ b/en/devices/tech/debug/native-crash.html
@@ -59,7 +59,7 @@ Older versions of Android (especially on 32-bit ARM) followed a convoluted path
between the original abort call (frame 4 here) and the actual sending of the
signal (frame 0 here):
</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
pid: 1656, tid: 1656, name: crasher >>> crasher <<<
signal 6 (<i style="color:Orange">SIGABRT</i>), code -6 (SI_TKILL), fault addr --------
<i style="color:Orange">Abort message</i>: 'some_file.c:123: some_function: assertion "false" failed'
@@ -85,7 +85,8 @@ href="http://man7.org/linux/man-pages/man2/tgkill.2.html">tgkill(2)</a></code>
directly from <code>abort</code>, so there are fewer stack frames for you to
skip over before you get to the interesting frames:
-<pre class="no-pretty-print">pid: 25301, tid: 25301, name: crasher >>> crasher <<<
+<pre class="devsite-click-to-copy">
+pid: 25301, tid: 25301, name: crasher >>> crasher <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
r0 00000000 r1 000062d5 r2 00000006 r3 00000008
r4 ffa09dd8 r5 000062d5 r6 000062d5 r7 0000010c
@@ -119,7 +120,8 @@ was called with a null pointer; and this crash should go straight to the author
of the calling code. In this case, frame #01 is the bad caller.
</p>
-<pre class="no-pretty-print">pid: 25326, tid: 25326, name: crasher >>> crasher <<<
+<pre class="devsite-click-to-copy">
+pid: 25326, tid: 25326, name: crasher >>> crasher <<<
signal 11 (<i style="color:Orange">SIGSEGV</i>), code 1 (SEGV_MAPERR), <i style="color:Orange">fault addr 0x0</i>
r0 00000000 r1 00000000 r2 00004c00 r3 00000000
r4 ab088071 r5 fff92b34 r6 00000002 r7 fff92b40
@@ -157,7 +159,9 @@ call actually succeeded first.
<p>
Here's an example of <code>readdir</code>:
</p>
-<pre class="no-pretty-print">pid: 25405, tid: 25405, name: crasher >>> crasher <<<
+
+<pre class="devsite-click-to-copy">
+pid: 25405, tid: 25405, name: crasher >>> crasher <<<
signal 11 (<i style="color:Orange">SIGSEGV</i>), code 1 (SEGV_MAPERR), <i style="color:Orange">fault addr 0xc</i>
r0 0000000c r1 00000000 r2 00000000 r3 3d5f0000
r4 00000000 r5 0000000c r6 00000002 r7 ff8618f0
@@ -190,7 +194,7 @@ you found the bug: <code>readdir</code> was passed a null pointer by the caller.
At this point you can paste the stack into the stack tool to find out
<em>where</em> in logcat this happened.
-<pre class="no-pretty-print">
+<pre class="prettyprint">
struct DIR {
int fd_;
size_t available_bytes_;
@@ -220,7 +224,8 @@ to perform actually fits. Here's an example where the code tries to
<code>read(fd, buf, 32)</code> into a buffer that's actually only 10 bytes
long...
</p>
-<pre class="no-pretty-print">pid: 25579, tid: 25579, name: crasher >>> crasher <<<
+<pre class="devsite-click-to-copy">
+pid: 25579, tid: 25579, name: crasher >>> crasher <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '<i style="color:Orange">FORTIFY: read: prevented 32-byte write into 10-byte buffer'</i>
r0 00000000 r1 000063eb r2 00000006 r3 00000008
@@ -254,7 +259,8 @@ epilogue to read it back and check that it's not changed. If that value changed,
it was overwritten by a buffer overrun, so the epilogue calls
<code>__stack_chk_fail</code> to log a message and abort.
</p>
-<pre class="no-pretty-print">pid: 26717, tid: 26717, name: crasher >>> crasher <<<
+<pre class="devsite-click-to-copy">
+pid: 26717, tid: 26717, name: crasher >>> crasher <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
<i style="color:Orange">Abort message: 'stack corruption detected'</i>
r0 00000000 r1 0000685d r2 00000006 r3 00000008
@@ -294,7 +300,7 @@ to see the currently supported selection.</p>
<p>To introduce the different pieces in a crash dump, let's work through this example crash dump:</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Android/aosp_flounder/flounder:5.1.51/AOSP/enh08201009:eng/test-keys'
Revision: '0'
@@ -318,15 +324,14 @@ backtrace:
#08 pc 00016795 /system/lib/libc.so (__libc_init+44)
#09 pc 00000abc /system/xbin/crasher
Tombstone written to: /data/tombstones/tombstone_06
+*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
</pre>
-<pre class="no-pretty-print">*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***</pre>
-
<p>The line of asterisks with spaces is helpful if you're searching a log
for native crashes. The string "*** ***" rarely shows up in logs other than
at the beginning of a native crash.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
Build fingerprint:
'Android/aosp_flounder/flounder:5.1.51/AOSP/enh08201009:eng/test-keys'
</pre>
@@ -334,7 +339,7 @@ Build fingerprint:
<p>The fingerprint lets you identify exactly which build the crash occurred
on. This is exactly the same as the <code>ro.build.fingerprint</code> system property.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
Revision: '0'
</pre>
@@ -343,7 +348,7 @@ usually unused but can be useful to help you automatically ignore bugs known
to be caused by bad hardware. This is exactly the same as the <code>ro.revision</code>
system property.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
ABI: 'arm'
</pre>
@@ -351,7 +356,7 @@ ABI: 'arm'
mostly useful for the <code>stack</code> script mentioned above, so that it knows
what toolchain to use.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
pid: 1656, tid: 1656, name: crasher &gt;&gt;&gt; crasher &lt;&lt;&lt;
</pre>
@@ -364,7 +369,7 @@ which is useful when filing bugs or trying to find the app in Google Play. The
pid and tid can also be useful in finding the relevant log lines preceding
the crash.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
</pre>
@@ -373,7 +378,7 @@ how it was received (SI_TKILL). The signals reported by <code>debuggerd</code> a
SIGBUS, SIGFPE, SIGILL, SIGSEGV, and SIGTRAP. The signal-specific codes vary
based on the specific signal.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
Abort message: 'some_file.c:123: some_function: assertion "false" failed'
</pre>
@@ -382,7 +387,7 @@ is automatically gathered from the last line of fatal logcat output for
this pid/tid, and in the case of a deliberate abort is likely to give an
explanation of why the program killed itself.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
r0 00000000 r1 00000678 r2 00000006 r3 f70b6dc8
r4 f70b6dd0 r5 f70b6d80 r6 00000002 r7 0000010c
r8 ffffffed r9 00000000 sl 00000000 fp ff96ae1c
@@ -393,7 +398,7 @@ ip 00000006 sp ff96ad18 lr f700ced5 pc f700dc98 cpsr 400b0010
signal was received. (This section varies wildly between ABIs.) How useful
these are will depend on the exact crash.<p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
backtrace:
#00 pc 00042c98 /system/lib/libc.so (tgkill+12)
#01 pc 00041ed1 /system/lib/libc.so (pthread_kill+32)
@@ -419,7 +424,7 @@ to find the corresponding assembler instruction.</p>
<h2 id=tombstones>Tombstones</h2>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
Tombstone written to: /data/tombstones/tombstone_06
</pre>
@@ -434,7 +439,7 @@ and memory dumps around the addresses in registers. Most usefully it also
includes a full memory map (similar to <code>/proc/<i>pid</i>/maps</code>). Here's an
annotated example from a 32-bit ARM process crash:</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
memory map: (fault address prefixed with ---&gt;)
---&gt;ab15f000-ab162fff r-x 0 4000 /system/xbin/crasher (BuildId:
b9527db01b5cf8f5402f899f64b9b121)
@@ -461,7 +466,7 @@ exactly which version of your code crashed. (Platform binaries include a
BuildId by default since Android M. NDK r12 and later automatically pass
<code>-Wl,--build-id</code> to the linker too.)<p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
ab163000-ab163fff r-- 3000 1000 /system/xbin/crasher
ab164000-ab164fff rw- 0 1000
f6c80000-f6d7ffff rw- 0 100000 [anon:libc_malloc]
@@ -470,7 +475,7 @@ f6c80000-f6d7ffff rw- 0 100000 [anon:libc_malloc]
<p>On Android the heap isn't necessarily a single region. Heap regions will
be labeled <code>[anon:libc_malloc]</code>.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
f6d82000-f6da1fff r-- 0 20000 /dev/__properties__/u:object_r:logd_prop:s0
f6da2000-f6dc1fff r-- 0 20000 /dev/__properties__/u:object_r:default_prop:s0
f6dc2000-f6de1fff r-- 0 20000 /dev/__properties__/u:object_r:logd_prop:s0
@@ -504,7 +509,7 @@ shows the address ranges for the mapping, the second column the permissions
(in hex), the fourth column the size of the region (in hex), and the fifth
column the file (or other region name).</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
f6f34000-f6f53fff r-x 0 20000 /system/lib/libm.so (BuildId: 76ba45dcd9247e60227200976a02c69b)
f6f54000-f6f54fff --- 0 1000
f6f55000-f6f55fff r-- 20000 1000 /system/lib/libm.so
@@ -537,7 +542,7 @@ Note that since Android 5.0 (Lollipop), the C library names most of its anonymou
regions so there are fewer mystery regions.
</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
f6fcb000-f6fccfff rw- 0 2000 [stack:5081]
</pre>
@@ -545,7 +550,7 @@ f6fcb000-f6fccfff rw- 0 2000 [stack:5081]
Regions named <code>[stack:<i>tid</i>]</code> are the stacks for the given threads.
</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
f6fcd000-f702afff r-x 0 5e000 /system/bin/linker (BuildId: 84f1316198deee0591c8ac7f158f28b7)
f702b000-f702cfff r-- 5d000 2000 /system/bin/linker
f702d000-f702dfff rw- 5f000 1000 /system/bin/linker
diff --git a/en/devices/tech/debug/netstats.html b/en/devices/tech/debug/netstats.html
index a396700d..78ddef02 100644
--- a/en/devices/tech/debug/netstats.html
+++ b/en/devices/tech/debug/netstats.html
@@ -31,8 +31,8 @@ network usage statistics collected since the device booted up.</p>
<p>To view network usage statistics, run the following command:</p>
-<pre class=prettyprint>
-$ adb shell dumpsys netstats detail
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys netstats detail
</pre>
@@ -56,7 +56,7 @@ consists of several sections: </p>
<p>Here is sample output for the active interfaces and active UID interfaces
sections:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Active interfaces:
iface=wlan0 ident=[{type=WIFI, subType=COMBINED, networkId="GoogleGuest"}]
Active UID interfaces:
@@ -72,7 +72,7 @@ information in these two section is the same.</p>
<p>Here is sample output for the Dev statistics section:</p>
-<pre>
+<pre class="devsite-click-to-copy">
Dev stats:
 Pending bytes: 170775
 Complete history:
@@ -94,7 +94,7 @@ Dev stats:
<h3 id=uid_stats>UID stats</h3>
-<pre>
+<pre class="devsite-click-to-copy">
UID stats:
 Pending bytes: 744
 Complete history:
@@ -120,9 +120,11 @@ Then look for the line labeled <code>userId</code>.</p>
<p>In our example, suppose we are trying to find network usage for our app
“com.example.myapp”. We would run the following command:</p>
-<pre>
-$ adb shell dumpsys package com.example.myapp | grep userId
-
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys package com.example.myapp | grep userId
+</pre>
+<p>This returns the following output:</p>
+<pre class="devsite-click-to-copy">
userId=10007 gids=[3003, 1028, 1015]
</pre>
diff --git a/en/devices/tech/debug/procstats.html b/en/devices/tech/debug/procstats.html
index 07250168..285ea7e0 100644
--- a/en/devices/tech/debug/procstats.html
+++ b/en/devices/tech/debug/procstats.html
@@ -33,8 +33,8 @@ proportional set size (PSS) and unique set size (USS).</p>
<p>To get application memory usage stats for the last three hours, in
human-readable form, run the following command:</p>
-<pre class=prettyprint>
-$ adb shell dumpsys procstats --hours 3
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys procstats --hours 3
</pre>
@@ -46,7 +46,7 @@ $ adb shell dumpsys procstats --hours 3
time the application was running, while the numbers following show PSS and USS
as minPSS-avgPSS-maxPSS/minUSS-avgUSS-maxUSS over samples.</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
AGGREGATED OVER LAST 3 HOURS:
* com.android.systemui / u0a20 / v22:
TOTAL: 100% (109MB-126MB-159MB/108MB-125MB-157MB over 18)
diff --git a/en/devices/tech/debug/strace.html b/en/devices/tech/debug/strace.html
index a69a64b4..5f2affb2 100644
--- a/en/devices/tech/debug/strace.html
+++ b/en/devices/tech/debug/strace.html
@@ -30,16 +30,16 @@ to learn how to collect only data you're actually interested in.</p>
<h2 id=build-strace>Building strace</h2>
<p>To build strace, run the following:
-<pre>
-$ mmma -j6 external/strace
+<pre class="devsite-terminal devsite-click-to-copy">
+mmma -j6 external/strace
</pre>
<h2 id=attach-strace>Attaching to a running process</h2>
<p>The simplest and most common use case for strace is to attach it to a running
process, which you can do with:</p>
-<pre>
-$ adb shell strace -f -p PID
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell strace -f -p PID
</pre>
<p>The <code>-f</code> flag tells strace to attach to all the threads in the
process, plus any new threads spawned later.</p>
@@ -49,16 +49,16 @@ process, plus any new threads spawned later.</p>
<ol>
<li>Set up a directory for strace logs:
-<pre>
-$ adb shell setenforce 0
-$ adb shell mkdir /data/local/tmp/strace
-$ adb shell chmod 777 /data/local/tmp/strace
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell setenforce 0</code>
+<code class="devsite-terminal">adb shell mkdir /data/local/tmp/strace</code>
+<code class="devsite-terminal">adb shell chmod 777 /data/local/tmp/strace</code>
</pre>
</li>
<li>Choose the process to trace before launching it:
-<pre>
-$ adb shell setprop wrap.com.google.android.browser "logwrapper strace -f -o /data/local/tmp/strace/strace.com.google.android.browser.txt"
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell setprop wrap.com.google.android.browser "logwrapper strace -f -o /data/local/tmp/strace/strace.com.google.android.browser.txt"
</pre>
</li>
<li>Launch the process normally.</li>
@@ -69,9 +69,9 @@ $ adb shell setprop wrap.com.google.android.browser "logwrapper strace -f -o /da
line (requires <code>adb shell setenforce 0</code>):
</p>
-<pre>
-$ cd system/core/
-$ patch -p1 &lt;&lt;EOF
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">cd system/core/</code>
+<code class="devsite-terminal">patch -p1 &lt;&lt;EOF
--- a/rootdir/init.zygote32.rc
+++ b/rootdir/init.zygote32.rc
@@ -1,4 +1,4 @@
@@ -80,7 +80,7 @@ $ patch -p1 &lt;&lt;EOF
class main
socket zygote stream 660 root system
onrestart write /sys/android_power/request_state wake
-EOF
+EOF</code>
</pre>
<h2 id=get-logs-boot>Getting strace logs during Android boot</h2>
@@ -93,7 +93,7 @@ EOF
SELinux <code>file_context</code> for <code>strace</code>. The solution is to
add a new line for strace in <code>system/sepolicy/private/file_contexts</code>
and copy the original file context over. Example:
-<pre>
+<pre class="devsite-click-to-copy">
/dev/socket/zygote u:object_r:zygote_socket:s0
+ /system/xbin/strace u:object_r:zygote_socket:s0
</pre>
@@ -108,7 +108,7 @@ do this by adding <code>androidboot.selinux=permissive</code>to
<br>
<br>Example for the Pixel (sailfish) device in
<code>/device/google/marlin/sailfish/BoardConfig.mk</code>:
-<pre>
+<pre class="devsite-click-to-copy">
- BOARD_KERNEL_CMDLINE := .... androidboot.hardware=sailfish ...
+BOARD_KERNEL_CMDLINE := .... androidboot.hardware=sailfish ... androidboot.selinux=permissive
</pre>
diff --git a/en/devices/tech/debug/systrace.html b/en/devices/tech/debug/systrace.html
index 4334f9d9..036bd6da 100644
--- a/en/devices/tech/debug/systrace.html
+++ b/en/devices/tech/debug/systrace.html
@@ -49,7 +49,9 @@ problems. (These features require root access and often a new kernel.)</p>
<p>When debugging jitter on Pixel/Pixel XL, start with the following
command:</p>
-<pre>$ ./systrace.py sched freq idle am wm gfx view sync binder_driver irq workq input -b 96000</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+./systrace.py sched freq idle am wm gfx view sync binder_driver irq workq input -b 96000
+</pre>
<p>When combined with the additional tracepoints required for GPU and display
pipeline activity, this gives you the ability to trace from user input to frame
@@ -106,7 +108,7 @@ back to sleep, waiting for EventThread wakeup.</li>
<p>Let's walk through the frame beginning at 15409ms:</p>
-<p><img src="images/perf_trace_normal_pipeline.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_normal_pipeline.png"></p>
<p class="img-caption"><strong>Figure 1.</strong> Normal UI pipeline,
EventThread running.</p>
@@ -139,14 +141,14 @@ sleep slice.</p>
<p>While EventThread is running, the UI thread for TouchLatency becomes
runnable. To see what woke it, click the blue section:</p>
-<p><img src="images/perf_trace_tl.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_tl.png"></p>
<p class="img-caption"><strong>Figure 2.</strong> UI thread for
TouchLatency.</p>
<p>Figure 2 shows the TouchLatency UI thread was woken by tid 6843, which
corresponds to EventThread. The UI thread wakes:</p>
-<p><img src="images/perf_trace_wake_render_enqueue.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_wake_render_enqueue.png"></p>
<p class="img-caption"><strong>Figure 3.</strong> UI thread wakes, renders a
frame, and enqueues it for SurfaceFlinger to consume.</p>
@@ -154,7 +156,7 @@ frame, and enqueues it for SurfaceFlinger to consume.</p>
binder transaction to view information on all of the processes involved in that
transaction:</p>
-<p><img src="images/perf_trace_binder_trans.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_binder_trans.png"></p>
<p class="img-caption"><strong>Figure 4.</strong> Binder transaction.</p>
<p>Figure 4 shows that, at 15,423.65ms, Binder:6832_1 in SurfaceFlinger becomes
@@ -164,7 +166,7 @@ see queueBuffer on both sides of the binder transaction.</p>
<p>During the queueBuffer on the SurfaceFlinger side, the number of pending
frames from TouchLatency goes from 1 to 2:</p>
-<p><img src="images/perf_trace_pending_frames.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_pending_frames.png"></p>
<p class="img-caption"><strong>Figure 5.</strong> Pending frames goes from 1 to
2.</p>
@@ -176,14 +178,14 @@ further dropped frames.</p>
<p>Soon after, SurfaceFlinger's main thread is woken by a second EventThread so
it can output the older pending frame to the display:</p>
-<p><img src="images/perf_trace_sf_woken_et.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_sf_woken_et.png"></p>
<p class="img-caption"><strong>Figure 6.</strong> SurfaceFlinger's main thread
is woken by a second EventThread.</p>
<p>SurfaceFlinger first latches the older pending buffer, which causes the
pending buffer count to decrease from 2 to 1:</p>
-<p><img src="images/perf_trace_sf_latches_pend.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_sf_latches_pend.png"></p>
<p class="img-caption"><strong>Figure 7.</strong> SurfaceFlinger first latches
the older pending buffer.</p>
@@ -191,7 +193,7 @@ the older pending buffer.</p>
final frame to the display. (Some of these sections are enabled as part of the
<code>mdss</code> tracepoint, so they may not be there on your SOC.)</p>
-<p><img src="images/perf_trace_sf_comp_submit.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_sf_comp_submit.png"></p>
<p class="img-caption"><strong>Figure 8.</strong> SurfaceFlinger sets up
composition and submits the final frame.</p>
@@ -200,7 +202,7 @@ display pipeline's kernel thread for outputting a rendered frame to the display.
We can see <code>mdss_fb0</code> as its own row in the trace (scroll down to
view).</p>
-<p><img src="images/perf_trace_wake_cpu0.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_wake_cpu0.png"></p>
<p class="img-caption"><strong>Figure 9.</strong> <code>mdss_fb0</code> wakes
on CPU 0.</p>
@@ -215,14 +217,14 @@ the Pixel XL might not be useful to you).</p>
<h2 id="example_2">Example: Non-working frame</h2>
<p>This example describes a systrace used to debug Pixel/Pixel XL jitter. To
-follow along with the example, <a href="perf_traces.zip">download the zip
+follow along with the example, <a href="/devices/tech/debug/perf_traces.zip">download the zip
file</a> of traces (which also includes other traces referred to in this
section), upzip the file, and open the systrace_tutorial.html file in your
browser.</p>
<p>When you first open the systrace, you'll see something like this:</p>
-<p><img src="images/perf_trace_tl_pxl.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_tl_pxl.png"></p>
<p class="img-caption"><strong>Figure 10</strong>. TouchLatency running on Pixel
XL (most options enabled, including mdss and kgsl tracepoints).</p>
@@ -234,7 +236,7 @@ case, FrameMissed is correlated with SurfaceFlinger missing one of its
extremely-regular runtimes and an unchanged pending-buffer count for the app
(<code>com.prefabulated.touchlatency</code>) at a vsync:</p>
-<p><img src="images/perf_trace_fm_sf.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_fm_sf.png"></p>
<p class="img-caption"><strong>Figure 11</strong>. FrameMissed correlation with
SurfaceFlinger.</p>
@@ -250,7 +252,7 @@ SurfaceFlinger wakes and immediately goes to sleep. When viewing the number of
pending frames from TouchLatency, there are two frames (a good clue to help
figure out what's going on).</p>
-<p><img src="images/perf_trace_sf_wake_sleep.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_sf_wake_sleep.png"></p>
<p class="img-caption"><strong>Figure 12.</strong> SurfaceFlinger wakes and
immediately goes to sleep.</p>
@@ -269,7 +271,7 @@ particular events in SurfaceFlinger depends on your SOC and driver stack, so
work with your SOC vendor to understand the meaning of fence categories in your
traces.</p>
-<p><img src="images/perf_traces_fences.png"></p>
+<p><img src="/devices/tech/debug/images/perf_traces_fences.png"></p>
<p class="img-caption"><strong>Figure 13.</strong> <code>mdss_fb0_retire</code>
fences.</p>
@@ -277,7 +279,7 @@ fences.</p>
Halfway through that slice, that frame should have been replaced by a new one
but wasn't. View the previous frame and look for anything interesting:</p>
-<p><img src="images/perf_trace_frame_previous.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_frame_previous.png"></p>
<p class="img-caption"><strong>Figure 14.</strong> Frame previous to busted
frame.</p>
@@ -288,7 +290,7 @@ suggests that something is very wrong with the display pipe.</p>
<p>Investigate exactly where that fence ends to determine what controls it:</p>
-<p><img src="images/perf_trace_fence_end.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_fence_end.png"></p>
<p class="img-caption"><strong>Figure 15.</strong> Investigate fence end.</p>
<p>A workqueue contains a <code>__vsync_retire_work_handler</code> that is
@@ -301,7 +303,7 @@ might not get scheduled accurately.</p>
<p>Check the previous frame to determine if that contributed; sometimes jitter
can add up over time and eventually cause us to miss a deadline.</p>
-<p><img src="images/perf_trace_previous_frame.png"></p>
+<p><img src="/devices/tech/debug/images/perf_trace_previous_frame.png"></p>
<p class="img-caption"><strong>Figure 16.</strong> Previous frame.</p>
<p>The runnable line on the kworker isn't visible because the viewer turns it
diff --git a/en/devices/tech/debug/valgrind.html b/en/devices/tech/debug/valgrind.html
index d8f1e42b..9ae0f088 100644
--- a/en/devices/tech/debug/valgrind.html
+++ b/en/devices/tech/debug/valgrind.html
@@ -31,16 +31,16 @@ debugging, most Android platform developers use
<h2 id=build-valgrind>Building Valgrind</h2>
<p>To build Valgrind:</p>
-<pre class="no-pretty-print">
-$ mmma -j6 external/valgrind
+<pre class="devsite-terminal devsite-click-to-copy">
+mmma -j6 external/valgrind
</pre>
<h2 id=app-valgrind>Using on an application</h2>
<p>To use Valgrind on an application:</p>
-<pre class="no-pretty-print">
-$ adb shell setprop wrap.<em>app_name</em> "logwrapper valgrind"
-$ adb shell am start -a android.intent.action.MAIN -n <em>app_name</em>/.MainActivity
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell setprop wrap.<em>app_name</em> "logwrapper valgrind"</code>
+<code class="devsite-terminal">adb shell am start -a android.intent.action.MAIN -n <em>app_name</em>/.MainActivity</code>
</pre>
<code><em>app_name</em></code> must be a fully-qualified name such as
@@ -49,25 +49,25 @@ $ adb shell am start -a android.intent.action.MAIN -n <em>app_name</em>/.MainAct
<h2 id=server-valgrind>Using on the system server</h2>
<p>To run the system server with Valgrind:</p>
-<pre class="no-pretty-print">
-$ adb shell setprop wrap.system_server "logwrapper valgrind"
-$ adb shell stop && adb shell start
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell setprop wrap.system_server "logwrapper valgrind"</code>
+<code class="devsite-terminal">adb shell stop && adb shell start</code>
</pre>
<h2 id=symbols-valgrind>Getting debug symbols</h2>
<p>For debug symbols, push unstripped libraries to <code>/data/local/symbols</code>:</p>
-<pre class="no-pretty-print">
-$ adb shell mkdir /data/local/symbols
-$ adb push $OUT/symbols /data/local/symbols
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell mkdir /data/local/symbols</code>
+<code class="devsite-terminal">adb push $OUT/symbols /data/local/symbols</code>
</pre>
<h2 id=boot-valgrind>Using during boot up</h2>
<p>To use Valgrind during boot up, edit
<code>out/target/product/XXXX/root/init.rc</code> by changing</p>
-<p><code>service example /system/bin/foo --arg1 --arg2</code></p>
+<pre class="devsite-click-to-copy">service example /system/bin/foo --arg1 --arg2</pre>
<p>to:</p>
-<p><code>service example /system/bin/logwrapper /system/bin/valgrind /system/bin/foo --arg1 --arg2</code></p>
+<pre class="devsite-click-to-copy">>service example /system/bin/logwrapper /system/bin/valgrind /system/bin/foo --arg1 --arg2</pre>
<p>To see the effects, create a <code>boot.img</code> and reflash the
device.</p>
diff --git a/en/devices/tech/display/app-shortcuts.html b/en/devices/tech/display/app-shortcuts.html
index 7db7bd29..fdabeb86 100644
--- a/en/devices/tech/display/app-shortcuts.html
+++ b/en/devices/tech/display/app-shortcuts.html
@@ -52,7 +52,8 @@ shortcuts include:
You can find the primary implementation of this feature in the following files:
</p>
-<pre>frameworks/base/services/core/java/com/android/server/policy/ShortcutManager.java
+<pre class="devsite-click-to-copy">
+frameworks/base/services/core/java/com/android/server/policy/ShortcutManager.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutPackage.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutUser.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutPackageInfo.java
@@ -73,7 +74,7 @@ With the following files providing supporting features (called hidden APIs in
<code>ShortcutManager.java</code>):
</p>
-<pre>
+<pre class="devsite-click-to-copy">
packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
</pre>
@@ -83,7 +84,7 @@ And, for an example, the Android Open Source Project Launcher version 3 supports
shortcuts:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
packages/apps/Launcher3/
</pre>
@@ -91,7 +92,8 @@ packages/apps/Launcher3/
Finally, see the following files for public Javadoc.
</p>
-<pre>frameworks/base/core/java/android/content/pm/ShortcutManager.java
+<pre class="devsite-click-to-copy">
+frameworks/base/core/java/android/content/pm/ShortcutManager.java
frameworks/base/core/java/android/content/pm/ShortcutInfo.java
frameworks/base/core/java/android/content/pm/LauncherApps.java
</pre>
@@ -138,7 +140,7 @@ Use the following Android Compatibility Test Suite (CTS) tests to ensure your
version of the feature (ShortcutManager and LauncherApps) works as intended:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
cts/tests/tests/shortcutmanager/
cts/hostsidetests/shortcuts/
</pre>
@@ -147,20 +149,22 @@ cts/hostsidetests/shortcuts/
And find the unit tests for the AOSP implementation here:
</p>
-<pre>frameworks/base/services/tests/servicestests/
+<pre class="devsite-click-to-copy">
+frameworks/base/services/tests/servicestests/
</pre>
<p>
Which includes:
</p>
-<pre>src/com/android/server/pm/ShortcutManagerTest*.java
+<pre class="devsite-click-to-copy">
+src/com/android/server/pm/ShortcutManagerTest*.java
</pre>
<p>
You may also employ the CTS Verifier test for shortcut manager:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
cts/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ShortcutThrottlingResetActivity.java
</pre>
diff --git a/en/devices/tech/display/circular-icons.html b/en/devices/tech/display/circular-icons.html
index 65f79769..eed152a9 100644
--- a/en/devices/tech/display/circular-icons.html
+++ b/en/devices/tech/display/circular-icons.html
@@ -38,7 +38,7 @@ href="https://android.googlesource.com/platform/frameworks/base/+/master/core/re
<p>To enable circular icons, change the <code>config_useRoundIcon</code>
setting in your overlay file from <code>false</code> to <code>true</code>:</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Flag indicating whether round icons should be parsed from the application manifest. --&gt;
&lt;bool name="config_useRoundIcon"&gt;true&lt;/bool&gt;
</pre>
diff --git a/en/devices/tech/display/hdr.html b/en/devices/tech/display/hdr.html
index 6331114e..f85ff1da 100644
--- a/en/devices/tech/display/hdr.html
+++ b/en/devices/tech/display/hdr.html
@@ -174,13 +174,13 @@ new HDR capable profiles:</p>
<h4>Dolby-Vision</h4>
-<p><code>MediaFormat</code> mime constant:
-<blockquote><pre>
+<p><code>MediaFormat</code> mime constant:</p>
+<pre class="devsite-click-to-copy">
String MIMETYPE_VIDEO_DOLBY_VISION
-</pre></blockquote></p>
+</pre>
<p><code>MediaCodecInfo.CodecProfileLevel</code> profile constants:</p>
-<blockquote><pre>
+<pre class="devsite-click-to-copy">
int DolbyVisionProfileDvavPen
int DolbyVisionProfileDvavPer
int DolbyVisionProfileDvheDen
@@ -189,7 +189,7 @@ int DolbyVisionProfileDvheDtb
int DolbyVisionProfileDvheDth
int DolbyVisionProfileDvheDtr
int DolbyVisionProfileDvheStn
-</pre></blockquote>
+</pre>
<p>Dolby Vision video layers and metadata must be concatenated into a single
buffer per frames by video applications. This is done automatically by the
@@ -197,19 +197,19 @@ Dolby-Vision capable MediaExtractor.</p>
<h4>HEVC HDR 10</h4>
-<p><code>MediaCodecInfo.CodecProfileLevel</code> profile constants:<p>
-<blockquote><pre>
+<p><code>MediaCodecInfo.CodecProfileLevel</code> profile constants:</p>
+<pre class="devsite-click-to-copy">
int HEVCProfileMain10HDR10
-</pre></blockquote>
+</pre>
<h4>VP9 HLG & PQ</h4>
<p><code>MediaCodecInfo.CodecProfileLevel</code> profile
constants:</p>
-<blockquote><pre>
+<pre class="devsite-click-to-copy">
int VP9Profile2HDR
int VP9Profile3HDR
-</pre></blockquote>
+</pre>
<p>If a platform supports an HDR-capable decoder, it shall also support an
HDR-capable extractor.</p>
@@ -553,7 +553,7 @@ MediaExtractor =&gt; MediaCodec pipeline.</p>
<h3 id="hdr10decoder">HDR10 decoder pipeline</h3>
-<p><img src="../images/hdr10_decoder_pipeline.png"></p>
+<p><img src="/devices/tech/images/hdr10_decoder_pipeline.png"></p>
<p class="img-caption"><strong>Figure 1.</strong> HDR10 pipeline</p>
@@ -588,7 +588,7 @@ the surface later.</li>
<h3 id="dvdecoder">Dolby Vision decoder pipeline</h3>
-<p><img src="../images/dolby_vision_decoder_pipleline.png"></p>
+<p><img src="/devices/tech/images/dolby_vision_decoder_pipleline.png"></p>
<p class="img-caption"><strong>Figure 2.</strong> Dolby Vision pipeline</p>
@@ -658,7 +658,7 @@ pass this to the display.</li>
<h3 id="v9decoder">VP9 decoder pipeline</h3>
-<p><img src="../images/vp9-pq_decoder_pipleline.png"></p>
+<p><img src="/devices/tech/images/vp9-pq_decoder_pipleline.png"></p>
<p class="img-caption"><strong>Figure 3.</strong> VP9-PQ pipeline</p>
diff --git a/en/devices/tech/display/multi-window.html b/en/devices/tech/display/multi-window.html
index 8d0ecbed..dbb8df30 100644
--- a/en/devices/tech/display/multi-window.html
+++ b/en/devices/tech/display/multi-window.html
@@ -81,7 +81,7 @@ and set <code>config_freeformWindowManagement</code> to true in <a
href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml">config.xml</a>.
</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;bool name="config_freeformWindowManagement"&gt;true&lt;/bool&gt;
</pre>
diff --git a/en/devices/tech/display/night-light.html b/en/devices/tech/display/night-light.html
index 22b34519..8c6609ff 100644
--- a/en/devices/tech/display/night-light.html
+++ b/en/devices/tech/display/night-light.html
@@ -43,7 +43,8 @@ using the following flags defined in:
<code><a href="https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml">
/android/frameworks/base/core/res/res/values/config.xml</a></code>
-<pre>&lt;!-- Control whether Night display is available. This should only be enabled
+<pre class="devsite-click-to-copy">
+&lt;!-- Control whether Night display is available. This should only be enabled
on devices with HWC 2 color transform support. --&gt;
&lt;bool name="config_nightDisplayAvailable">false&lt;/bool&gt;
&lt;!-- Default mode to control how Night display is automatically activated.
@@ -63,7 +64,8 @@ using the following flags defined in:
<p>
The code is divided between framework, system services, SystemUI, and Settings:
</p>
-<pre>platform/frameworks/base/core
+<pre class="devsite-click-to-copy">
+platform/frameworks/base/core
├ java/android/provider/Settings.java
├ java/com/android/internal/app/NightDisplayController.java
└ res/res/values/config.xml
diff --git a/en/devices/tech/display/retail-mode.html b/en/devices/tech/display/retail-mode.html
index 0e8c9acc..b694e616 100644
--- a/en/devices/tech/display/retail-mode.html
+++ b/en/devices/tech/display/retail-mode.html
@@ -43,7 +43,7 @@ employees.</li></ul>
<h2 id="lifecycle">Lifecycle</h2>
-<img src="images/retail-demo-flow.png" alt="retail demo mode flow" width="XXX" id="retail-demo-flow" />
+<img src="/devices/tech/display/images/retail-demo-flow.png" alt="retail demo mode flow" width="XXX" id="retail-demo-flow" />
<p class="img-caption">
<strong>Figure 1.</strong> Retail demonstration mode option in Language selection
</p>
@@ -58,7 +58,7 @@ factory. Once a consumer setup has completed, retail mode may no longer be
available. Once selected, the device finishes SUW with an abbreviated flow.
</p>
-<img src="images/retail-demo-wizard.png" alt="retail demo wizard use" width="XXX" id="retail-demo-wizard" />
+<img src="/devices/tech/display/images/retail-demo-wizard.png" alt="retail demo wizard use" width="XXX" id="retail-demo-wizard" />
<p class="img-caption">
<strong>Figure 2.</strong> Retail demonstration mode option in Language
selection
@@ -135,9 +135,10 @@ from the boot loader.
<h2 id="examples-and-source">Examples and source</h2>
<p>
-Find the custom launcher that plays a video in a loop within:<br>
-<code>/packages/apps/RetailDemo</code>
-</p>
+Find the custom launcher that plays a video in a loop within:</p>
+<pre class="devsite-click-to-copy">
+/packages/apps/RetailDemo
+</pre>
<h2 id="implementation">Implementation</h2>
@@ -165,7 +166,7 @@ An OEM specifies a custom launcher by overriding the framework resource
For example, with:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- Component that is the default launcher when Retail Mode is enabled. --&gt;
&lt;string name="config_demoModeLauncherComponent"&gt;com.android.retaildemo/.DemoPlayer&lt;/string&gt;
</pre>
@@ -288,7 +289,7 @@ video from can be configured by overriding the following string value in the
RetailDemo app:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;!-- URL where the retail demo video can be downloaded from. --&gt;
&lt;string name="retail_demo_video_download_url"&gt;&lt;/string&gt;
</pre>
@@ -306,7 +307,7 @@ in <code>res/values-en-rUS/strings.xml</code> and
In <code>res/values-en-rUS/strings.xml</code>:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;string name="retail_demo_video_download_url"&gt;download URL for US video goes here&lt;/string&gt;
</pre>
@@ -314,7 +315,7 @@ In <code>res/values-en-rUS/strings.xml</code>:
And similarly in <code>res/values-en-rGB/strings.xml</code>:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;string name="retail_demo_video_download_url"&gt;download URL for UK video goes here&lt;/string&gt;
</pre>
diff --git a/en/devices/tech/ota/ab_updates.html b/en/devices/tech/ota/ab_updates.html
index 0c538085..282ea5a0 100644
--- a/en/devices/tech/ota/ab_updates.html
+++ b/en/devices/tech/ota/ab_updates.html
@@ -375,7 +375,7 @@
<li>Implement the state machine as shown in Figure 1:</li>
</ul>
-<img src="images/ab-updates-state-machine.png">
+<img src="/devices/tech/ota/images/ab-updates-state-machine.png">
<p class="img-caption"><strong>Figure 1.</strong> Bootloader state machine</p>
@@ -423,8 +423,9 @@
extra arguments:
</p>
-<pre>skip_initramfs rootwait ro init=/init root="/dev/dm-0 dm=system none ro,0 1 \
- android-verity &lt;public-key-id&gt; &lt;path-to-system-partition&gt;"
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">skip_initramfs rootwait ro init=/init root="/dev/dm-0 dm=system none ro,0 1 \
+ android-verity &lt;public-key-id&gt; &lt;path-to-system-partition&gt;"</code>
</pre>
<p>
@@ -444,19 +445,23 @@
<code>openssl</code> command to convert from <code>.pem</code> to
<code>.der</code> format (if the .X509 certificate is formatted in
<code>.pem</code> format):
- <pre>openssl x509 -in &lt;x509-pem-certificate&gt; -outform der -out &lt;x509-der-certificate&gt;</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+openssl x509 -in &lt;x509-pem-certificate&gt; -outform der -out &lt;x509-der-certificate&gt;
+</pre>
</li>
<li>
Once copied to the kernel build root, build the <code>zImage</code> to
include the certificate as part of the system keyring. This can be verified
from the following <code>procfs</code> entry (requires
<code>KEYS_CONFIG_DEBUG_PROC_KEYS</code> to be enabled):
- <pre>angler:/# cat /proc/keys
+<pre class="devsite-click-to-copy">
+angler:/# cat /proc/keys
1c8a217e I------ 1 perm 1f010000 0 0 asymmetri
Android: 7e4333f9bba00adfe0ede979e28ed1920492b40f: X509.RSA 0492b40f []
2d454e3e I------ 1 perm 1f030000 0 0 keyring
-.system_keyring: 1/4</pre>
+.system_keyring: 1/4
+</pre>
</li>
</ol>
@@ -550,8 +555,10 @@ Android: 7e4333f9bba00adfe0ede979e28ed1920492b40f: X509.RSA 0492b40f []
the A/B-ed partitions. For example:
</p>
-<pre>&lt;path-to-block-device&gt;/vendor /vendor ext4 ro
-wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect</pre>
+<pre class="devsite-click-to-copy">
+&lt;path-to-block-device&gt;/vendor /vendor ext4 ro
+wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect
+</pre>
<p>
Please note that there should be no partition named <code>vendor</code> but
@@ -628,7 +635,8 @@ wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect</pre>
For example, use the following to generate a full OTA:
</p>
-<pre>./build/tools/releasetools/ota_from_target_files \
+<pre class="devsite-terminal devsite-click-to-copy">
+./build/tools/releasetools/ota_from_target_files \
dist_output/tardis-target_files.zip ota_update.zip
</pre>
@@ -636,7 +644,8 @@ wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect</pre>
Or, generate an incremental OTA:
</p>
-<pre>./build/tools/releasetools/ota_from_target_files \
+<pre class="devsite-terminal devsite-click-to-copy">
+./build/tools/releasetools/ota_from_target_files \
-i PREVIOUS-tardis-target_files.zip \
dist_output/tardis-target_files.zip incremental_ota_update.zip
</pre>
@@ -661,7 +670,8 @@ wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect</pre>
configuration:
</p>
-<pre>AB_OTA_PARTITIONS := \
+<pre class="devsite-click-to-copy">
+AB_OTA_PARTITIONS := \
boot \
system \
bootloader
@@ -692,7 +702,8 @@ wait,verify=&lt;path-to-block-device&gt;/metadata,slotselect</pre>
applicable):
</p>
-<pre>AB_OTA_POSTINSTALL_CONFIG += \
+<pre class="devsite-click-to-copy">
+AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_system=true \
POSTINSTALL_PATH_system=usr/bin/postinst \
FILESYSTEM_TYPE_system=ext4
@@ -706,14 +717,14 @@ additions to the product's device configuration (in the product's device.mk):</p
<ol>
<li>Include the native components in the build. This ensures the compilation
script and binaries are compiled and included in the system image.
- <pre>
+<pre class="devsite-click-to-copy">
# A/B OTA dexopt package
PRODUCT_PACKAGES += otapreopt_script
</pre>
</li>
<li>Connect the compilation script to <code>update_engine</code> such that it
is run as a post-install step.
- <pre>
+<pre class="devsite-click-to-copy">
# A/B OTA dexopt update_engine hookup
AB_OTA_POSTINSTALL_CONFIG += \
RUN_POSTINSTALL_system=true \
diff --git a/en/devices/tech/ota/device_code.html b/en/devices/tech/ota/device_code.html
index 144f43fc..98f37f0f 100644
--- a/en/devices/tech/ota/device_code.html
+++ b/en/devices/tech/ota/device_code.html
@@ -38,9 +38,11 @@ used by both the recovery binary and the package-building tools. You can
specify the name of the map file in TARGET_RECOVERY_FSTAB in BoardConfig.mk.</p>
<p>A sample partition map file might look like this:</p>
-<p><code>device/yoyodyne/tardis/recovery.fstab</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/recovery.fstab
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
# mount point fstype device [device2] [options (3.0+ only)]
/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0
@@ -131,9 +133,11 @@ to provide the device-specific functionality. The file <code>
makes a good starting point to copy when writing a version of this file for
your device.</p>
-<p><code>device/yoyodyne/tardis/recovery/recovery_ui.cpp</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/recovery/recovery_ui.cpp
+</pre>
-<pre>
+<pre class="prettyprint">
#include &lt;linux/input.h&gt;
#include "common.h"
@@ -147,7 +151,7 @@ your device.</p>
appear in the hidden recovery menu. Headers describe how to operate the menu
(i.e. controls to change/select the highlighted item).</p>
-<pre>
+<pre class="prettyprint">
static const char* HEADERS[] = { "Volume up/down to move highlight;",
"power button to select.",
"",
@@ -171,7 +175,7 @@ ScreenRecoveryUIimplementation (see instructions for
function to customize from ScreenRecoveryUI is <code>CheckKey()</code>, which
does the initial asynchronous key handling:</p>
-<pre>
+<pre class="prettyprint">
class TardisUI : public ScreenRecoveryUI {
public:
virtual KeyAction CheckKey(int key) {
@@ -212,7 +216,7 @@ setup: the display is toggled by holding down power and pressing volume-up,
and the device can be rebooted immediately by pressing the power button five
times in a row (with no other intervening keys):</p>
-<pre>
+<pre class="prettyprint">
class TardisUI : public ScreenRecoveryUI {
private:
int consecutive_power_keys;
@@ -263,7 +267,7 @@ Images</a>.</p>
instance of your UI class and return that from the <code>GetUI()</code>
function:</p>
-<pre>
+<pre class="prettyprint">
class TardisDevice : public Device {
private:
TardisUI* ui;
@@ -283,7 +287,7 @@ but before any action has been taken. The default implementation does nothing,
so you do not need to provide this in your subclass if you have nothing to do:
</p>
-<pre>
+<pre class="prettyprint">
void StartRecovery() {
// ... do something tardis-specific here, if needed ....
}
@@ -294,7 +298,7 @@ so you do not need to provide this in your subclass if you have nothing to do:
of items. In this implementation, it returns the static arrays defined at the
top of the file:</p>
-<pre>
+<pre class="prettyprint">
const char* const* GetMenuHeaders() { return HEADERS; }
const char* const* GetMenuItems() { return ITEMS; }
</pre>
@@ -303,7 +307,7 @@ const char* const* GetMenuItems() { return ITEMS; }
<p>Next, provide a <code>HandleMenuKey()</code> function, which takes a
keypress and the current menu visibility, and decides what action to take:</p>
-<pre>
+<pre class="prettyprint">
int HandleMenuKey(int key, int visible) {
if (visible) {
switch (key) {
@@ -350,7 +354,7 @@ use trackball motions as triggers for rebooting or toggling the display.</p>
devices pressing Alt-W in recovery would start a data wipe whether the menu
was visible or not. YOu could implement like this:</p>
-<pre>
+<pre class="prettyprint">
int HandleMenuKey(int key, int visible) {
if (ui->IsKeyPressed(KEY_LEFTALT) &amp;&amp; key == KEY_W) {
return 2; // position of the "wipe data" item in the menu
@@ -369,7 +373,7 @@ However, you can return the values if desired.</p>
positions in the array of items returned by <code>GetMenuItems()</code> to
actions. For the array of items in the tardis example, use:</p>
-<pre>
+<pre class="prettyprint">
BuiltinAction InvokeMenuItem(int menu_position) {
switch (menu_position) {
case 0: return REBOOT;
@@ -409,7 +413,7 @@ should erase it here. You should return 0 to indicate success and another
value for failure, though currently the return value is ignored. The user data
and cache partitions are wiped whether you return success or failure.</p>
-<pre>
+<pre class="prettyprint">
int WipeData() {
// ... do something tardis-specific here, if needed ....
return 0;
@@ -421,7 +425,7 @@ and cache partitions are wiped whether you return success or failure.</p>
for the <code>make_device()</code> function that creates and returns an
instance of your Device class:</p>
-<pre>
+<pre class="prettyprint">
class TardisDevice : public Device {
// ... all the above methods ...
};
@@ -436,9 +440,11 @@ Device* make_device() {
on your device. In Android.mk, create a static library that contains only this
C++ file:</p>
-<p><code>device/yoyodyne/tardis/recovery/Android.mk</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/recovery/Android.mk
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -455,7 +461,7 @@ include $(BUILD_STATIC_LIBRARY)
<p>Then, in the board configuration for this device, specify your static
library as the value of TARGET_RECOVERY_UI_LIB.</p>
-<pre>
+<pre class="devsite-click-to-copy">
device/yoyodyne/tardis/BoardConfig.mk
[...]
@@ -483,11 +489,11 @@ and the <strong>installing</strong> animation.</p>
<tbody>
<tr>
<td>
-<img src="../images/icon_error.png" alt="image shown during ota error">
+<img src="/devices/tech/images/icon_error.png" alt="image shown during ota error">
<p class="img-caption"><strong>Figure 1.</strong> icon_error.png</p>
</td>
<td>
-<img src="../images/icon_installing_5x.png" alt="image shown during ota install"
+<img src="/devices/tech/images/icon_installing_5x.png" alt="image shown during ota install"
height="275">
<p class="img-caption"><strong>Figure 2.</strong> icon_installing.png</p>
</td>
@@ -521,11 +527,11 @@ above) and the <b>installing</b> animation plus several overlay images:</p>
<tbody>
<tr>
<td rowspan="2">
-<img src="../images/icon_installing.png" alt="image shown during ota install">
+<img src="/devices/tech/images/icon_installing.png" alt="image shown during ota install">
<p class="img-caption"><strong>Figure 3.</strong> icon_installing.png</p>
</td>
<td>
-<img src="../images/icon_installing_overlay01.png" alt="image shown as first
+<img src="/devices/tech/images/icon_installing_overlay01.png" alt="image shown as first
overlay">
<p class="img-caption"><strong>Figure 4.</strong> icon-installing_overlay01.png
</p>
@@ -533,7 +539,7 @@ overlay">
</tr>
<tr>
<td>
-<img src="../images/icon_installing_overlay07.png" alt="image shown as seventh
+<img src="/devices/tech/images/icon_installing_overlay07.png" alt="image shown as seventh
overlay">
<p class="img-caption"><strong>Figure 5.</strong> icon_installing_overlay07.png
</p>
@@ -551,12 +557,12 @@ overlay is placed on top of the base image:</p>
<table style="border-collapse:collapse;">
<tbody>
<tr>
-<td><img align="center" src="../images/composite01.png" alt="composite image of
+<td><img align="center" src="/devices/tech/images/composite01.png" alt="composite image of
install plus first overlay">
<p class="img-caption"><strong>Figure 6.</strong> Installing animation frame 1
(icon_installing.png + icon_installing_overlay01.png)
</td>
-<td><img align="center" src="../images/composite07.png" alt="composite image of
+<td><img align="center" src="/devices/tech/images/composite07.png" alt="composite image of
install plus seventh overlay">
<p class="img-caption"><strong>Figure 7.</strong> Installing animation frame 7
(icon_installing.png + icon_installing_overlay07.png)
@@ -593,7 +599,7 @@ strings for that message in each locale.</p>
<p>Sample image of recovery text strings:</p>
-<img src="../images/installing_text.png" alt="image of recovery text">
+<img src="/devices/tech/images/installing_text.png" alt="image of recovery text">
<p class="img-caption"><strong>Figure 8.</strong> Localized text for recovery
messages</p>
@@ -623,9 +629,9 @@ in English.</p>
<p>Progress bars can appear below the main image (or animation). The progress
bar is made by combining two input images, which must be of the same size:</p>
-<img src="../images/progress_empty.png" alt="empty progress bar">
+<img src="/devices/tech/images/progress_empty.png" alt="empty progress bar">
<p class="img-caption"><strong>Figure 9.</strong> progress_empty.png</p>
-<img src="../images/progress_fill.png" alt="full progress bar">
+<img src="/devices/tech/images/progress_fill.png" alt="full progress bar">
<p class="img-caption"><strong>Figure 10.</strong> progress_fill.png</p>
<p>The left end of the <i>fill</i> image is displayed next to the right end of
@@ -633,11 +639,11 @@ the <i>empty</i> image to make the progress bar. The position of the boundary
between the two images is changed to indicate the progress. For example, with
the above pairs of input images, display:</p>
-<img src="../images/progress_1.png" alt="progress bar at 1%">
+<img src="/devices/tech/images/progress_1.png" alt="progress bar at 1%">
<p class="img-caption"><strong>Figure 11.</strong> Progress bar at 1%></p>
-<img src="../images/progress_10.png" alt="progress bar at 10%">
+<img src="/devices/tech/images/progress_10.png" alt="progress bar at 10%">
<p class="img-caption"><strong>Figure 12.</strong> Progress bar at 10%</p>
-<img src="../images/progress_50.png" alt="progress bar at 50%">
+<img src="/devices/tech/images/progress_50.png" alt="progress bar at 50%">
<p class="img-caption"><strong>Figure 13.</strong> Progress bar at 50%</p>
<p>You can provide device-specific versions of these images by placing them
@@ -678,8 +684,10 @@ doesn't have keys or you want to process them differently.</p>
by providing your own extension functions that can be called from within your
updater script. Here's a sample function for the tardis device:</p>
-<p><code>device/yoyodyne/tardis/recovery/recovery_updater.c</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/recovery/recovery_updater.c
+</pre>
+<pre class="prettyprint">
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
@@ -691,7 +699,7 @@ by which the function was called, a <code>State*</code> cookie, the number of
incoming arguments, and an array of <code>Expr*</code> pointers representing
the arguments. The return value is a newly-allocated <code>Value*</code>.</p>
-<pre>
+<pre class="prettyprint">
Value* ReprogramTardisFn(const char* name, State* state, int argc, Expr* argv[]) {
if (argc != 2) {
return ErrorAbort(state, "%s() expects 2 args, got %d", name, argc);
@@ -711,7 +719,7 @@ ownership of the Value returned and are responsible for eventually calling
<p>Suppose the function needs two arguments: a string-valued <b>key</b> and a
blob-valued <b>image</b>. You could read arguments like this:</p>
-<pre>
+<pre class="prettyprint">
Value* key = EvaluateValue(state, argv[0]);
if (key == NULL) {
return NULL;
@@ -738,7 +746,7 @@ blob-valued <b>image</b>. You could read arguments like this:</p>
for multiple arguments. The <code>ReadValueArgs()</code> function can make this
easier. Instead of the code above, you could have written this:</p>
-<pre>
+<pre class="prettyprint">
Value* key;
Value* image;
if (ReadValueArgs(state, argv, 2, &amp;key, &amp;image) != 0) {
@@ -763,7 +771,7 @@ number of arguments (it returns an array of <code>Value*</code>).</p>
<p>After evaluating the arguments, do the work of the function:</p>
-<pre>
+<pre class="devsite-click-to-copy">
// key-&gt;data is a NUL-terminated string
// image-&gt;data and image-&gt;size define a block of binary data
//
@@ -781,7 +789,7 @@ copy of the constant string to return, since the caller will <code>free()
</code> both. Don't forget to call <code>FreeValue()</code> on the objects you
got by evaluating your arguments!</p>
-<pre>
+<pre class="prettyprint">
FreeValue(key);
FreeValue(image);
@@ -796,7 +804,7 @@ got by evaluating your arguments!</p>
<p>The convenience function <code>StringValue()</code> wraps a string into a
new Value object. Use to write the above code more succinctly:</p>
-<pre>
+<pre class="prettyprint">
FreeValue(key);
FreeValue(image);
@@ -811,7 +819,7 @@ register each extension function. By convention, name device-specific
functions <code><i>device</i>.<i>whatever</i></code> to avoid conflicts with
future built-in functions added.</p>
-<pre>
+<pre class="prettyprint">
void Register_librecovery_updater_tardis() {
RegisterFunction("tardis.reprogram", ReprogramTardisFn);
}
@@ -821,9 +829,11 @@ void Register_librecovery_updater_tardis() {
code. (This is the same makefile used to customize the recovery UI in the
previous section; your device may have both static libraries defined here.)</p>
-<p><code>device/yoyodyne/tardis/recovery/Android.mk</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/recovery/Android.mk
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
include $(CLEAR_VARS)
LOCAL_SRC_FILES := recovery_updater.c
LOCAL_C_INCLUDES += bootable/recovery
@@ -832,7 +842,7 @@ LOCAL_C_INCLUDES += bootable/recovery
<p>The name of the static library must match the name of the
<code>Register_<i>libname</i></code> function contained within it.</p>
-<pre>
+<pre class="devsite-click-to-copy">
LOCAL_MODULE := librecovery_updater_tardis
include $(BUILD_STATIC_LIBRARY)
</pre>
@@ -847,9 +857,11 @@ their (non-existent) registration function. For example, if your
device-specific code wanted to use zlib to decompress data, you would include
libz here.</p>
-<p><code>device/yoyodyne/tardis/BoardConfig.mk</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/BoardConfig.mk
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
[...]
# add device-specific extensions to the updater binary
@@ -873,8 +885,10 @@ your extension functions.</p>
Assuming your data file is in <code>device/yoyodyne/tardis/tardis.dat</code>,
declare the following in your device's AndroidBoard.mk:</p>
-<p><code>device/yoyodyne/tardis/AndroidBoard.mk</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/AndroidBoard.mk
+</pre>
+<pre class="devsite-click-to-copy">
[...]
$(call add-radio-file,tardis.dat)
@@ -886,8 +900,10 @@ loaded no matter what device is being built. (If your tree includes multiple
devices, you only want the tardis.dat file added when building the tardis
device.)</p>
-<p><code>device/yoyodyne/tardis/Android.mk</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/Android.mk
+</pre>
+<pre class="devsite-click-to-copy">
[...]
# an alternative to specifying it in AndroidBoard.mk
@@ -907,8 +923,10 @@ multiple times to add as many files as you want.</p>
<p>To extend the release tools, write a Python module (must be named
releasetools.py) the tools can call into if present. Example:</p>
-<p><code>device/yoyodyne/tardis/releasetools.py</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/releasetools.py
+</pre>
+<pre class="prettyprint">
import common
def FullOTA_InstallEnd(info):
@@ -924,7 +942,7 @@ def FullOTA_InstallEnd(info):
<p>A separate function handles the case of generating an incremental OTA
package. For this example, suppose you need to reprogram the tardis only when
the tardis.dat file has changed between two builds.</p>
-<pre>
+<pre class="prettyprint">
def IncrementalOTA_InstallEnd(info):
# copy the data into the package.
source_tardis_dat = info.source_zip.read("RADIO/tardis.dat")
@@ -1016,9 +1034,11 @@ documentation for ZIP archives</a>.</p>
<p>Specify the location of your device's releasetools.py script in your
BoardConfig.mk file:</p>
-<p><code>device/yoyodyne/tardis/BoardConfig.mk</code></p>
+<pre class="devsite-click-to-copy">
+device/yoyodyne/tardis/BoardConfig.mk
+</pre>
-<pre>
+<pre class="devsite-click-to-copy">
[...]
TARGET_RELEASETOOLS_EXTENSIONS := device/yoyodyne/tardis
@@ -1042,30 +1062,15 @@ target-files.</p>
picks up the device-specific module from the target_files .zip file and uses
it when generating OTA packages:</p>
-<pre>
-% <b>./build/tools/releasetools/ota_from_target_files \
- -i PREVIOUS-tardis-target_files.zip \
- dist_output/tardis-target_files.zip incremental_ota_update.zip</b>
-unzipping target target-files...
-<b>using device-specific extensions from target_files</b>
-unzipping source target-files...
- [...]
-done.
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/ota_from_target_files -i PREVIOUS-tardis-target_files.zip dist_output/tardis-target_files.zip incremental_ota_update.zip</code>
</pre>
<p>Alternatively, you can specify device-specific extensions when you run
<code>ota_from_target_files</code>.</p>
-<pre>
-% <b>./build/tools/releasetools/ota_from_target_files \
- -s device/yoyodyne/tardis \ # specify the path to device-specific extensions
- -i PREVIOUS-tardis-target_files.zip \
- dist_output/tardis-target_files.zip incremental_ota_update.zip</b>
-unzipping target target-files...
-<b>loaded device-specific extensions from device/yoyodyne/tardis</b>
-unzipping source target-files...
- [...]
-done.
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/ota_from_target_files -s device/yoyodyne/tardis -i PREVIOUS-tardis-target_files.zip dist_output/tardis-target_files.zip incremental_ota_update.zip</code>
</pre>
<p class="note"><strong>Note:</strong> For a complete list of options, refer
diff --git a/en/devices/tech/ota/reduce_size.html b/en/devices/tech/ota/reduce_size.html
index 6a4e6182..227c40df 100644
--- a/en/devices/tech/ota/reduce_size.html
+++ b/en/devices/tech/ota/reduce_size.html
@@ -175,8 +175,8 @@
<p>To use the build diff tool, run the following command:</p>
-<pre class=prettyprint>
-$ target_files_diff.py dir1 dir2
+<pre class="devsite-terminal devsite-click-to-copy">
+target_files_diff.py dir1 dir2
</pre>
<p><code>dir1</code> and <code>dir2</code> are base directories that contain the extracted target
diff --git a/en/devices/tech/ota/sign_builds.html b/en/devices/tech/ota/sign_builds.html
index 4829547a..fbc0d718 100644
--- a/en/devices/tech/ota/sign_builds.html
+++ b/en/devices/tech/ota/sign_builds.html
@@ -52,12 +52,12 @@ publicly released or deployed Android OS image with a special set of
<p>To generate your own unique set of release-keys, run these commands from
the root of your Android tree:</p>
-<pre class="no-pretty-print">
-subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'
-mkdir ~/.android-certs
-for x in releasekey platform shared media; do \
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">subject='/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com'</code>
+<code class="devsite-terminal">mkdir ~/.android-certs</code>
+<code class="devsite-terminal">for x in releasekey platform shared media; do \
./development/tools/make_key ~/.android-certs/$x "$subject"; \
-done
+done</code>
</pre>
<p><code>$subject</code> should be changed to reflect your organization's
@@ -69,12 +69,12 @@ such as on an air-gapped computer.</p>
<p>To generate a release image, use:</p>
-<pre class="no-pretty-print">
-make dist
-./build/tools/releasetools/sign_target_files_apks \
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">make dist</code>
+<code class="devsite-terminal">./build/tools/releasetools/sign_target_files_apks \
-o \ # explained in the next section
-d ~/.android-certs out/dist/*-target_files-*.zip \
- signed-target_files.zip
+ signed-target_files.zip</code>
</pre>
<p>The <code>sign_target_files_apks</code> script takes a target-files .zip
@@ -87,11 +87,11 @@ been signed with new keys. The newly signed images can be found under
A signed target-files zip can be converted into a signed OTA update zip
using the following procedure:
-<pre class="no-pretty-print">
-./build/tools/releasetools/ota_from_target_files \
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/ota_from_target_files \
-k ~/.android-certs/releasekey \
signed-target_files.zip \
- signed-ota_update.zip
+ signed-ota_update.zip</code>
</pre>
<h3 id="signatures-sideloading">Signatures and sideloading</h3>
@@ -126,8 +126,10 @@ verification against otacerts.zip). You can specify extra keys to be
included only in recovery by setting the PRODUCT_EXTRA_RECOVERY_KEYS
variable in your product definition:</p>
-<p><code>vendor/yoyodyne/tardis/products/tardis.mk</code></p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
+vendor/yoyodyne/tardis/products/tardis.mk
+</pre>
+<pre class="devsite-click-to-copy">
[...]
PRODUCT_EXTRA_RECOVERY_KEYS := vendor/yoyodyne/security/tardis/sideload
@@ -165,8 +167,10 @@ build/target/product/security</code>:</p>
in their Android.mk file. (testkey is used if this variable is not set.) You
can also specify an entirely different key by pathname, e.g.:</p>
-<p><code>device/yoyodyne/apps/SpecialApp/Android.mk</code></p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
+device/yoyodyne/apps/SpecialApp/Android.mk
+</pre>
+<pre class="devsite-click-to-copy">
[...]
LOCAL_CERTIFICATE := device/yoyodyne/security/special
@@ -185,7 +189,7 @@ dest_key</i></code> flag specifies key replacements one at a time. The flag
replace all those in <code>build/target/product/security</code>; it is
equivalent to using <code>-k</code> four times to specify the mappings:</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
build/target/product/security/testkey = dir/releasekey
build/target/product/security/platform = dir/platform
build/target/product/security/shared = dir/shared
@@ -198,7 +202,7 @@ one to replace the additional <code>keydevice/yoyodyne/security/special</code>
required by SpecialApp in the example above. If the keys were in the following
files:</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
vendor/yoyodyne/security/tardis/releasekey.x509.pem
vendor/yoyodyne/security/tardis/releasekey.pk8
vendor/yoyodyne/security/tardis/platform.x509.pem
@@ -215,12 +219,12 @@ vendor/yoyodyne/security/special-release.pk8 # password protected
<p>Then you would sign all the apps like this:</p>
-<pre class="no-pretty-print">
-% <b>./build/tools/releasetools/sign_target_files_apks \
- -d vendor/yoyodyne/security/tardis \
- -k vendor/yoyodyne/special=vendor/yoyodyne/special-release \
- -o \
- tardis-target_files.zip signed-tardis-target_files.zip</b>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/sign_target_files_apks -d vendor/yoyodyne/security/tardis -k vendor/yoyodyne/special=vendor/yoyodyne/special-release -o tardis-target_files.zip signed-tardis-target_files.zip</code>
+</pre>
+
+<p>This brings up the following:</p>
+<pre class="devsite-click-to-copy">
Enter password for vendor/yoyodyne/security/special-release key&gt;
Enter password for vendor/yoyodyne/security/tardis/media key&gt;
Enter password for vendor/yoyodyne/security/tardis/platform key&gt;
@@ -267,24 +271,22 @@ flags.</p>
certificate/private key pairs using the openssl tool from
<a href="https://www.openssl.org/">openssl.org</a>:</p>
-<pre class="no-pretty-print">
+<pre class="devsite-click-to-copy">
# generate RSA key
-% <b>openssl genrsa -3 -out temp.pem 2048</b>
+<code class="devsite-terminal">openssl genrsa -3 -out temp.pem 2048</code>
Generating RSA private key, 2048 bit long modulus
....+++
.....................+++
e is 3 (0x3)
# create a certificate with the public part of the key
-% <b>openssl req -new -x509 -key temp.pem -out releasekey.x509.pem \
- -days 10000 \
- -subj '/C=US/ST=California/L=San Narciso/O=Yoyodyne, Inc./OU=Yoyodyne Mobility/CN=Yoyodyne/emailAddress=yoyodyne@example.com'</b>
+<code class="devsite-terminal">openssl req -new -x509 -key temp.pem -out releasekey.x509.pem -days 10000 -subj '/C=US/ST=California/L=San Narciso/O=Yoyodyne, Inc./OU=Yoyodyne Mobility/CN=Yoyodyne/emailAddress=yoyodyne@example.com'</code>
# create a PKCS#8-formatted version of the private key
-% <b>openssl pkcs8 -in temp.pem -topk8 -outform DER -out releasekey.pk8 -nocrypt</b>
+<code class="devsite-terminal">openssl pkcs8 -in temp.pem -topk8 -outform DER -out releasekey.pk8 -nocrypt</code>
# securely delete the temp.pem file
-% <b>shred --remove temp.pem</b>
+<code class="devsite-terminal">shred --remove temp.pem</code>
</pre>
<p>The openssl pkcs8 command given above creates a .pk8 file with <i>no</i>
@@ -315,7 +317,7 @@ the following command from the root of the Android
tree:
</p>
-<pre>
+<pre class="devsite-terminal devsite-click-to-copy">
./build/tools/releasetools/img_from_target_files signed-target-files.zip signed-img.zip
</pre>
@@ -324,7 +326,7 @@ The resulting file, <code>signed-img.zip</code>, contains all the .img files.
To load an image onto a device, use fastboot as
follows:
-<pre>
+<pre class="devsite-terminal devsite-click-to-copy">
fastboot update signed-img.zip
</pre>
diff --git a/en/devices/tech/ota/tools.html b/en/devices/tech/ota/tools.html
index 1b26f918..4ad58d90 100644
--- a/en/devices/tech/ota/tools.html
+++ b/en/devices/tech/ota/tools.html
@@ -39,26 +39,18 @@ state of the device.</p>
<p>Example: Using the release tools to build a full update for the
hypothetical <b>tardis</b> device:</p>
-<pre>
+<pre class="devsite-click-to-copy">
# first, build the target-files .zip
-% <b>. build/envsetup.sh &amp;&amp; lunch tardis-eng</b>
-% <b>mkdir dist_output</b>
-% <b>make dist DIST_DIR=dist_output</b>
- [...]
-% <b>ls -l dist_output/*target_files*</b>
--rw-r----- 1 user eng 69965275 Sep 29 15:51 tardis-target_files.zip
+<code class="devsite-terminal">. build/envsetup.sh &amp;&amp; lunch tardis-eng</code>
+<code class="devsite-terminal">mkdir dist_output</code>
+<code class="devsite-terminal">make dist DIST_DIR=dist_output</code>
</pre>
<p>The target-files .zip contains everything needed to construct OTA packages.
</p>
-<pre>
-% <b>./build/tools/releasetools/ota_from_target_files \
- dist_output/tardis-target_files.zip ota_update.zip</b>
-unzipping target target-files...
-done.
-% <b>ls -l ota_update.zip</b>
--rw-r----- 1 user eng 62236561 Sep 29 15:58 ota_update.zip
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/ota_from_target_files dist_output/tardis-target_files.zip ota_update.zip</code>
</pre>
<p>The ota_update.zip is now ready to be sent to test devices (everything is
@@ -81,16 +73,8 @@ incremental update, you need the target_files .zip from the previous build
(the one you want to update <i>from</i>) as well as the target_files .zip from
the new build.</p>
-<pre>
-% <b>./build/tools/releasetools/ota_from_target_files \
- -i PREVIOUS-tardis-target_files.zip \ </b># make incremental from this older version<b>
- dist_output/tardis-target_files.zip incremental_ota_update.zip</b>
-unzipping target target-files...
-unzipping source target-files...
- [...]
-done.
-% <b>ls -l incremental_ota_update.zip</b>
--rw-r----- 1 user eng 1175314 Sep 29 16:10 incremental_ota_update.zip
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">./build/tools/releasetools/ota_from_target_files -i PREVIOUS-tardis-target_files.zip dist_output/tardis-target_files.zip incremental_ota_update.zip # make incremental from the older version</code>
</pre>
<p>This build is very similar to the previous build, and the incremental
diff --git a/en/devices/tech/power/batterystats.html b/en/devices/tech/power/batterystats.html
index 75c1e9e5..10cf934f 100644
--- a/en/devices/tech/power/batterystats.html
+++ b/en/devices/tech/power/batterystats.html
@@ -48,8 +48,9 @@
<h2 id="command-line_options">Command input</h2>
<p>The basic <code>batterystats</code> command is:</p>
- <pre class="prettyprint">
-$ adb shell dumpsys batterystats</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys batterystats
+</pre>
<p>Supported options:</p>
<ul>
<li><code>--help</code> displays additional options for tailoring the output.
@@ -59,13 +60,15 @@ $ adb shell dumpsys batterystats</pre>
</ul>
<p>For example, to print battery usage statistics in csv format for all apps
since the device was last charged, run the command:</p>
- <pre class="prettyprint">
-$ adb shell dumpsys batterystats --charged --checkin</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys batterystats --charged --checkin
+</pre>
<p>You can also specify a package name to get statistics for a single app. For
example, to print battery usage statistics for a given app package
since the device was last charged, run the command:</p>
- <pre class="prettyprint">
-$ adb shell dumpsys batterystats --charged &lt;package-name&gt;</pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys batterystats --charged &lt;package-name&gt;
+</pre>
<h2 id="output">Command output</h2>
@@ -101,7 +104,7 @@ $ adb shell dumpsys batterystats --charged &lt;package-name&gt;</pre>
<p>Sample output:</p>
- <pre class="no-pretty-print">
+ <pre class="devsite-click-to-copy">
9,0,i,vers,11,116,K,L 9,0,i,uid,1000,android
9,0,i,uid,1000,com.android.providers.settings
9,0,i,uid,1000,com.android.inputdevices
diff --git a/en/devices/tech/power/component.html b/en/devices/tech/power/component.html
index 90edf65a..0b69358c 100644
--- a/en/devices/tech/power/component.html
+++ b/en/devices/tech/power/component.html
@@ -105,8 +105,8 @@ in low-power states inappropriate for measuring active power use. To prevent the
suspending while the screen is off, use a temporary partial wakelock. Using a USB cable, connect
the device to a development host, then issue the following command:</p>
-<pre>
-$ adb shell "echo temporary &gt; /sys/power/wake_lock"
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell "echo temporary &gt; /sys/power/wake_lock"
</pre>
<p>While in <code>wake_lock</code>, the screen off state does not trigger a system suspend.
@@ -114,8 +114,8 @@ $ adb shell "echo temporary &gt; /sys/power/wake_lock"
<p>To remove the wakelock:</p>
-<pre>
-$ adb shell "echo temporary &gt; /sys/power/wake_unlock"
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell "echo temporary &gt; /sys/power/wake_unlock"
</pre>
<h3 id="measure-suspend">Measuring system suspend</h3>
@@ -155,7 +155,7 @@ scheduling activity.</p>
<p>You must specify the available CPU speeds for your device in the power profile <code>cpu.speeds</code> entry. To get a list of available CPU speeds, run:</p>
-<pre>
+<pre class="devsite-terminal devsite-click-to-copy">
adb shell cat /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state
</pre>
@@ -167,12 +167,12 @@ controlling CPU speed using the userspace cpufreq governor and using sysfs inter
speed. For example, to set speed for 200MHz on a system with only 1 CPU or all CPUs sharing a
common cpufreq policy, use the system console or adb shell to run the following commands:</p>
-<pre>
-echo userspace &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
-echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
-echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
-echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
-cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">echo userspace &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor</code>
+<code class="devsite-terminal">echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq</code>
+<code class="devsite-terminal">echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq</code>
+<code class="devsite-terminal">echo 200000 &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed</code>
+<code class="devsite-terminal">cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq</code>
</pre>
<p class="note">
@@ -187,7 +187,7 @@ setting the maximum speed.</p>
<p>To measure current consumed by a CPU running at various speeds, use the system console to place
the CPU in a CPU-bound loop using the command:</p>
-<pre>
+<pre class="devsite-click-to-copy">
# while true; do true; done
</pre>
diff --git a/en/devices/tech/power/device.html b/en/devices/tech/power/device.html
index 160cbb18..88443663 100644
--- a/en/devices/tech/power/device.html
+++ b/en/devices/tech/power/device.html
@@ -45,7 +45,7 @@ consumption between configurations.</p>
<p>To read power consumption data, insert calls to the API in your testing code.</p>
-<pre>
+<pre class="prettyprint">
import android.os.BatteryManager;
import android.content.Context;
BatteryManager mBatteryManager =
@@ -59,7 +59,7 @@ Slog.i(TAG, "Remaining energy = " + energy + "nWh");
<p>Android supports the following battery fuel gauge properties:</p>
-<pre>
+<pre class="devsite-click-to-copy">
BATTERY_PROPERTY_CHARGE_COUNTER Remaining battery capacity in microampere-hours
BATTERY_PROPERTY_CURRENT_NOW Instantaneous battery current in microamperes
BATTERY_PROPERTY_CURRENT_AVERAGE Average battery current in microamperes
diff --git a/en/devices/tech/power/mgmt.html b/en/devices/tech/power/mgmt.html
index 21086893..7dd0862b 100644
--- a/en/devices/tech/power/mgmt.html
+++ b/en/devices/tech/power/mgmt.html
@@ -97,11 +97,11 @@ a period of time.
<h3 id=testing_app_standby>Testing App Standby</h3>
<p>You can manually test App Standby using the following <code>adb</code> commands:</p>
-<pre>
-$ adb shell dumpsys battery unplug
-$ adb shell am set-idle packageName true
-$ adb shell am set-idle packageName false
-$ adb shell am get-idle packageName
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb shell dumpsys battery unplug</code>
+<code class="devsite-terminal">adb shell am set-idle packageName true</code>
+<code class="devsite-terminal">adb shell am set-idle packageName false</code>
+<code class="devsite-terminal">adb shell am get-idle packageName</code>
</pre>
<h2 id="doze">Doze</h2>
@@ -195,7 +195,7 @@ they can complete their processing.</li>
<p>Android 7.0 and later extends Doze by enabling a lightweight sleep mode during screen
off, before the device is idle.</p>
-<p><img src="../images/doze_lightweight.png"></p>
+<p><img src="/devices/tech/images/doze_lightweight.png"></p>
<p class="img-caption">Figure 1. Doze modes for non-stationary and stationary
devices.</p>
@@ -258,10 +258,10 @@ configuration is necessary.</p>
<li>In the device overlay config file
<code>overlay/frameworks/base/core/res/res/values/config.xml</code>, set
<code>config_enableAutoPowerModes</code> to <strong>true</strong>:
-<pre>
-bool name="config_enableAutoPowerModes"&gt;true&lt;/bool&gt;
+<pre class="devsite-click-to-copy">
+&lt;bool name="config_enableAutoPowerModes"&gt;true&lt;/bool&gt;
</pre>
-<br>In AOSP, this parameter is set to false (Doze disabled) by default.<br>
+In AOSP, this parameter is set to false (Doze disabled) by default.<br>
</li>
<li>Confirm that preloaded apps and services:
<ul>
diff --git a/en/devices/tech/power/values.html b/en/devices/tech/power/values.html
index 472b8207..e4c68426 100644
--- a/en/devices/tech/power/values.html
+++ b/en/devices/tech/power/values.html
@@ -68,7 +68,7 @@ from the <code>sysfs</code> files in:
<p>Example of cluster CPUs and speeds:</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;array name="cpu.active.cluster0"&gt;
&lt;value&gt;200&lt;/value&gt;
&lt;value&gt;300&lt;/value&gt;
diff --git a/en/devices/tech/test_infra/tradefed/full_example.html b/en/devices/tech/test_infra/tradefed/full_example.html
index c8f44f93..f2bbb704 100644
--- a/en/devices/tech/test_infra/tradefed/full_example.html
+++ b/en/devices/tech/test_infra/tradefed/full_example.html
@@ -58,7 +58,8 @@ your modules against that JAR.</p>
tradefed test generally implements the
<a href="/reference/com/android/tradefed/testtype/IRemoteTest.html">IRemoteTest</a>
interface. Here's an implementation for the HelloWorldTest:</p>
-<pre><code>package com.android.tradefed.example;
+<pre class="prettyprint">
+package com.android.tradefed.example;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.result.ITestInvocationListener;
@@ -70,12 +71,14 @@ public class HelloWorldTest implements IRemoteTest {
System.out.println("Hello, TF World!");
}
}
-</code></pre>
+</pre>
<p>Save this sample code to
<code>&lt;tree&gt;/tools/tradefederation/core/prod-tests/src/com/android/tradefed/example/HelloWorldTest.java</code>
and rebuild tradefed from your shell:</p>
-<pre><code>m -jN</code></pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+m -jN
+</pre>
<p>Note that <code>System.out</code> in the example above may not actually
direct output to the console. While this is acceptable for this test example,
@@ -94,9 +97,10 @@ order.</p>
<p>Lets create a new Configuration for our HelloWorldTest (note the full class
name of the HelloWorldTest):</p>
-<pre><code>&lt;configuration description="Runs the hello world test"&gt;
+<pre class="prettyprint">
+&lt;configuration description="Runs the hello world test"&gt;
&lt;test class="com.android.tradefed.example.HelloWorldTest" /&gt;
-&lt;/configuration&gt;</code></pre>
+&lt;/configuration&gt;</pre>
<p>Save this data to a <code>helloworld.xml</code> file anywhere on your local
filesystem (e.g. <code>/tmp/helloworld.xml</code>). TF will parse the
@@ -106,21 +110,24 @@ reflection, instantiate it, cast it to a <code>IRemoteTest</code>, and call its
<h2 id="runconfig">Running the config (R)</h2>
<p>From your shell, launch the tradefed console:</p>
-<pre><code>$ tradefed.sh
-</code></pre>
+<pre class="devsite-terminal devsite-click-to-copy">
+tradefed.sh
+</pre>
<p>Ensure a device is connected to the host machine and is visible to tradefed:</p>
-<pre><code>tf &gt;list devices
+<pre class="devsite-click-to-copy">
+tf&gt; list devices
Serial State Product Variant Build Battery
004ad9880810a548 Available mako mako JDQ39 100
-</code></pre>
+</pre>
<p>Configurations can be executed using the <code>run &lt;config&gt;</code>
console command. Try:</p>
-<pre><code>tf&gt; run /tmp/helloworld.xml
+<pre class="devsite-click-to-copy">
+tf&gt; run /tmp/helloworld.xml
05-12 13:19:36 I/TestInvocation: Starting invocation for target stub on build 0 on device 004ad9880810a548
Hello, TF World!
-</code></pre>
+</pre>
<p>You should see "Hello, TF World!" output on the terminal.</p>
<h2 id="addconfig">Adding the config to the Classpath (D, I, R)</h2>
@@ -133,13 +140,15 @@ core library
(<code>&lt;tree&gt;/tools/tradefederation/core/prod-tests/res/config/example/helloworld.xml</code>).
Rebuild tradefed, restart the tradefed console, then ask tradefed to display the
list of configurations from the classpath:</p>
-<pre><code>tf&gt; list configs
+<pre class="devsite-click-to-copy">
+tf&gt; list configs
[…]
example/helloworld: Runs the hello world test
-</code></pre>
+</pre>
<p>You can now run the helloworld config using:</p>
-<pre><code>tf &gt;run example/helloworld
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-12 13:21:21 I/TestInvocation: Starting invocation for target stub on build 0 on device 004ad9880810a548
Hello, TF World!
</code></pre>
@@ -152,7 +161,8 @@ to the test.</p>
<p>Tests can get a reference to an Android device by implementing the
<a href="/reference/com/android/tradefed/testtype/IDeviceTest.html">IDeviceTest</a>
interface. Here's a sample implementation of what this looks like:</p>
-<pre><code>public class HelloWorldTest implements IRemoteTest, IDeviceTest {
+<pre class="prettyprint">
+public class HelloWorldTest implements IRemoteTest, IDeviceTest {
private ITestDevice mDevice;
&#64;Override
public void setDevice(ITestDevice device) {
@@ -165,7 +175,7 @@ interface. Here's a sample implementation of what this looks like:</p>
}
}
-</code></pre>
+</pre>
<p>The Trade Federation framework will inject the <code>ITestDevice</code>
reference into your test via the <code>IDeviceTest#setDevice</code> method,
@@ -173,25 +183,30 @@ before the <code>IRemoteTest#run</code> method is called.</p>
<p>Let's modify the HelloWorldTest print message to display the serial number of
the device:</p>
-<pre><code>&#64;Override
+<pre class="prettyprint">
+&#64;Override
public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
System.out.println("Hello, TF World! I have device " + getDevice().getSerialNumber());
}
-</code></pre>
+</pre>
<p>Now rebuild tradefed and check the list of devices:</p>
-<pre><code>$ tradefed.sh
-tf &gt;list devices
+<pre class="devsite-terminal devsite-click-to-copy">
+tradefed.sh
+</pre>
+<pre class="devsite-click-to-copy">
+tf&gt; list devices
Serial State Product Variant Build Battery
004ad9880810a548 Available mako mako JDQ39 100
-</code></pre>
+</pre>
<p>Take note of the serial number listed as <strong>Available</strong>; that is
the device that should be allocated to HelloWorld:</p>
-<pre><code>tf &gt;run example/helloworld
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-12 13:26:18 I/TestInvocation: Starting invocation for target stub on build 0 on device 004ad9880810a548
Hello, TF World! I have device 004ad9880810a548
-</code></pre>
+</pre>
<p>You should see the new print message displaying the serial number of the
device.</p>
@@ -213,7 +228,8 @@ the start and end of each test, and the end of the test run.</p>
<p>Here's what the HelloWorldTest implementation might look like with a single
failed test result.</p>
-<pre><code>&#64;Override
+<pre class="prettyprint">
+&#64;Override
public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
System.out.println("Hello, TF World! I have device " + getDevice().getSerialNumber());
@@ -223,7 +239,8 @@ public void run(ITestInvocationListener listener) throws DeviceNotAvailableExcep
listener.testFailed(testId, "oh noes, test failed");
listener.testEnded(testId, Collections.emptyMap());
listener.testRunEnded(0, Collections.emptyMap());
-}</code></pre>
+}
+</pre>
<p>TF includes several <code>IRemoteTest</code> implementations you can reuse
instead of writing your own from scratch. For example,
@@ -239,15 +256,18 @@ Types</a>.</p>
<a href="/reference/com/android/tradefed/result/TextResultReporter.html">TextResultReporter</a>,
which dumps the results of an invocation to stdout. To illustrate, run the
HelloWorldTest config from the previous section:</p>
-<pre><code>$ ./tradefed.sh
-tf &gt;run example/helloworld
+<pre class="devsite-terminal devsite-click-to-copy">
+./tradefed.sh
+</pre>
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-16 20:03:15 I/TestInvocation: Starting invocation for target stub on build 0 on device 004ad9880810a548
Hello, TF World! I have device 004ad9880810a548
05-16 20:03:15 I/InvocationToJUnitResultForwarder: run helloworldrun started: 1 tests
Test FAILURE: com.example.TestClassName#sampleTest
stack: oh noes, test failed
05-16 20:03:15 I/InvocationToJUnitResultForwarder: run ended 0 ms
-</code></pre>
+</pre>
<p>To store the results of an invocation elsewhere, such as in a file, specify a
custom <code>ITestInvocationListener</code> implementation using the
@@ -259,14 +279,16 @@ listener, which writes test results to an XML file in a format similar to that
used by the <em>ant</em> JUnit XML writer. To specify the result_reporter in the
configuration, edit the <code>…/res/config/example/helloworld.xml</code>
config:</p>
-<pre><code>&lt;configuration description="Runs the hello world test"&gt;
+<pre class="prettyprint">
+&lt;configuration description="Runs the hello world test"&gt;
&lt;test class="com.android.tradefed.example.HelloWorldTest" /&gt;
&lt;result_reporter class="com.android.tradefed.result.XmlResultReporter" /&gt;
&lt;/configuration&gt;
-</code></pre>
+</pre>
<p>Now rebuild tradefed and re-run the hello world sample:</p>
-<pre><code>tf &gt;run example/helloworld
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-16 21:07:07 I/TestInvocation: Starting invocation for target stub on build 0 on device 004ad9880810a548
Hello, TF World! I have device 004ad9880810a548
05-16 21:07:07 I/XmlResultReporter: Saved device_logcat log to /tmp/0/inv_2991649128735283633/device_logcat_6999997036887173857.txt
@@ -276,7 +298,8 @@ Hello, TF World! I have device 004ad9880810a548
<p>Notice the log message stating that an XML file has been generated; the
generated file should look like this:</p>
-<pre><code>&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
+<pre class="prettyprint">
+&lt;?xml version='1.0' encoding='UTF-8' ?&gt;
&lt;testsuite name="stub" tests="1" failures="1" errors="0" time="9" timestamp="2011-05-17T04:07:07" hostname="localhost"&gt;
&lt;properties /&gt;
&lt;testcase name="sampleTest" classname="com.example.TestClassName" time="0"&gt;
@@ -284,7 +307,7 @@ generated file should look like this:</p>
&lt;/failure&gt;
&lt;/testcase&gt;
&lt;/testsuite&gt;
-</code></pre>
+</pre>
<p>You can also write your own custom invocation listeners&mdash;they simply
need to implement the
@@ -313,19 +336,21 @@ and sends it to the invocation listener for processing.
for the ddmlib Log class. Let's convert the
previous <code>System.out.println</code> call in HelloWorldTest to a
<code>CLog</code> call:</p>
-<pre><code>&#64;Override
+<pre class="prettyprint">
+&#64;Override
public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
CLog.i("Hello, TF World! I have device %s", getDevice().getSerialNumber());
-</code></pre>
+</pre>
<p><code>CLog</code> handles string interpolation directly, similar to
<code>String.format</code>. When you rebuild and rerun TF, you should see the
log message on stdout:</p>
-<pre><code>tf&gt; run example/helloworld
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-16 21:30:46 I/HelloWorldTest: Hello, TF World! I have device 004ad9880810a548
-</code></pre>
+</pre>
<p>By default, tradefed
<a href"/reference/com/android/tradefed/log/StdoutLogger.html">outputs host log
@@ -334,7 +359,8 @@ messages to a file:
<a href="/reference/com/android/tradefed/log/FileLogger.html">FileLogger</a>.
To add file logging, add a <code>logger</code> tag to the config, specifying the
full class name of <code>FileLogger</code>:</p>
-<pre><code>&lt;configuration description="Runs the hello world test"&gt;
+<pre class="prettyprint">
+&lt;configuration description="Runs the hello world test"&gt;
&lt;test class="com.android.tradefed.example.HelloWorldTest" /&gt;
&lt;result_reporter class="com.android.tradefed.result.XmlResultReporter" /&gt;
&lt;logger class="com.android.tradefed.log.FileLogger" /&gt;
@@ -342,7 +368,8 @@ full class name of <code>FileLogger</code>:</p>
</code></pre>
<p>Now, rebuild and run the helloworld example again:</p>
-<pre><code>tf &gt;run example/helloworld
+<pre class="devsite-click-to-copy">
+tf &gt;run example/helloworld
05-16 21:38:21 I/XmlResultReporter: Saved device_logcat log to /tmp/0/inv_6390011618174565918/device_logcat_1302097394309452308.txt
05-16 21:38:21 I/XmlResultReporter: Saved host_log log to /tmp/0/inv_6390011618174565918/host_log_4255420317120216614.txt
@@ -350,10 +377,13 @@ full class name of <code>FileLogger</code>:</p>
</code></pre>
<p>The log message indicates the path of the host log, which, when viewed,
should contain your HelloWorldTest log message:</p>
-<pre><code>$ more /tmp/0/inv_6390011618174565918/host_log_4255420317120216614.txt
+<pre class="devsite-terminal devsite-click-to-copy">
+more /tmp/0/inv_6390011618174565918/host_log_4255420317120216614.txt</pre>
+<p>Example output:</p>
+<pre class="devsite-click-to-copy">
05-16 21:38:21 I/HelloWorldTest: Hello, TF World! I have device 004ad9880810a548
-</code></pre>
+</pre>
<h2 id="optionhandling">Handling options (D, I, R)</h2>
<p>Objects loaded from a TF Configuration (aka <b>Configuration objects</b>)
@@ -371,41 +401,46 @@ description of supported types, see
</p>
<p>Let's add an <code>@Option</code> to HelloWorldTest:</p>
-<pre><code>@Option(name="my_option",
+<pre class="prettyprint">
+@Option(name="my_option",
shortName='m',
description="this is the option's help text",
// always display this option in the default help text
importance=Importance.ALWAYS)
private String mMyOption = "thisisthedefault";
-</code></pre>
+</pre>
<p>Next, let's add a log message to display the value of the option in
HelloWorldTest so we can demonstrate it was received correctly:</p>
-<pre><code>&#64;Override
+<pre class="prettyprint">
+&#64;Override
public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
CLog.logAndDisplay(LogLevel.INFO, "I received option '%s'", mMyOption);
-</code></pre>
+</pre>
<p>Finally, rebuild TF and run helloworld; you should see a log message with the
<code>my_option</code> default value:</p>
-<pre><code>tf&gt; run example/helloworld
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld
05-24 18:30:05 I/HelloWorldTest: I received option 'thisisthedefault'
-</code></pre>
+</pre>
<h3 id="passclivalues">Passing values from the command line</h3>
<p>Pass in a value for <code>my_option</code>; you should see
<code>my_option</code> populated with that value:</p>
-<pre><code>tf&gt; run example/helloworld --my_option foo
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld --my_option foo
05-24 18:33:44 I/HelloWorldTest: I received option 'foo'
-</code></pre>
+</pre>
<p>TF configurations also include a help system, which automatically displays
help text for <code>@Option</code> fields. Try it now, and you should see the
help text for <code>my_option</code>:</p>
-<pre><code>tf&gt; run example/helloworld --help
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld --help
Printing help for only the important options. To see help for all options, use the --help-all flag
cmd_options options:
@@ -432,21 +467,24 @@ all <code>@Option</code> fields, regardless of importance. For details, see
<p>You can also specify an Option value within the config by adding a
<code>&lt;option name="" value=""&gt;</code> element. Test it using
<code>helloworld.xml</code>:</p>
-<pre><code>&lt;test class="com.android.tradefed.example.HelloWorldTest" &gt;
+<pre class="prettyprint">
+&lt;test class="com.android.tradefed.example.HelloWorldTest" &gt;
&lt;option name="my_option" value="fromxml" /&gt;
&lt;/test&gt;
-</code></pre>
+</pre>
<p>Re-building and running helloworld should now produce this output:</p>
-<pre><code>05-24 20:38:25 I/HelloWorldTest: I received option 'fromxml'
-</code></pre>
+<pre class="devsite-click-to-copy">
+05-24 20:38:25 I/HelloWorldTest: I received option 'fromxml'
+</pre>
<p>The configuration help should also update to indicate the default value of
<code>my_option</code>:</p>
-<pre><code>tf&gt; run example/helloworld --help
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld --help
test options:
-m, --my_option this is the option's help text Default: fromxml.
-</code></pre>
+</pre>
<p>Other configuration objects included in the helloworld config, such as
<code>FileLogger</code>, also accept options. The option
@@ -458,7 +496,8 @@ logging to stdout by passing in the <code>--log-level-display</code> arg.</p>
<p>Try this now, and you should see the 'I have device' log message reappear on
stdout, in addition to being logged to a file:</p>
-<pre><code>tf &gt;run example/helloworld --log-level-display info
+<pre class="devsite-click-to-copy">
+tf&gt; run example/helloworld --log-level-display info
05-24 18:53:50 I/HelloWorldTest: Hello, TF World! I have device 004ad9880810a548
</code></pre>
diff --git a/en/devices/tech/test_infra/tradefed/fundamentals/machine_setup.html b/en/devices/tech/test_infra/tradefed/fundamentals/machine_setup.html
index 71dcf5c9..47b99bde 100644
--- a/en/devices/tech/test_infra/tradefed/fundamentals/machine_setup.html
+++ b/en/devices/tech/test_infra/tradefed/fundamentals/machine_setup.html
@@ -33,7 +33,7 @@
<p>
From the root directory of the Android source tree:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
<code class="devsite-terminal">source ./build/make/envsetup.sh</code>
<code class="devsite-terminal">lunch &lt;device-target&gt;</code>
<code class="devsite-terminal">make tradefed-all -j8</code>
@@ -44,7 +44,7 @@
<p>
TradeFed requires the <code>adb</code> utility in your <code>$PATH</code>:
</p>
-<pre class="devsite-terminal">
+<pre class="devsite-terminal devsite-click-to-copy">
export PATH=$PATH:&lt;path/to/adb&gt;
</pre>
@@ -52,7 +52,7 @@ export PATH=$PATH:&lt;path/to/adb&gt;
Once TradeFed is built, the <code>tradefed.sh</code> launcher script is
accessible from your path. To launch the Trade Federation console:
</p>
-<pre class="devsite-terminal">
+<pre class="devsite-terminal devsite-click-to-copy">
tradefed.sh
</pre>
<p>
diff --git a/en/devices/tech/test_infra/tradefed/fundamentals/options.html b/en/devices/tech/test_infra/tradefed/fundamentals/options.html
index fc494f34..bb891b79 100644
--- a/en/devices/tech/test_infra/tradefed/fundamentals/options.html
+++ b/en/devices/tech/test_infra/tradefed/fundamentals/options.html
@@ -46,7 +46,8 @@ the TF console when the command is run with <code>--help</code> or <code>--help-
<p>As an example, let's say we want to build a functional phone test which will dial a variety of
phone numbers, and will expect to receive a sequence of DTMF tones from each number after it
connects.</p>
-<code><pre>public class PhoneCallFuncTest extends IRemoteTest {
+<pre class="prettyprint">
+public class PhoneCallFuncTest extends IRemoteTest {
&#64;Option(name = "timeout", description = "How long to wait for connection, in millis")
private long mWaitTime = 30 * 1000; // 30 seconds
@@ -56,7 +57,8 @@ connects.</p>
public PhoneCallFuncTest() {
mCalls.add("123-456-7890", "01134"); // default
- }</pre></code>
+ }
+</pre>
<p>That's all that's required for the Developer to set up two points of configuration for that
test. They could then go off and use <code>mWaitTime</code> and <code>mCalls</code> as normal,
@@ -73,21 +75,24 @@ suppose the Integrator wanted to define a lower-latency test that calls the defa
as a long-running test that calls a variety of numbers. They could create a pair of configurations
that might look like the following:</p>
-<code><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
+<pre class="prettyprint">
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration description="low-latency default test; low-latency.xml"&gt;
&lt;test class="com.example.PhoneCallFuncTest"&gt;
&lt;option name="timeout" value="5000" /&gt;
&lt;/test&gt;
-&lt;/configuration&gt;</pre></code>
+&lt;/configuration&gt;</pre>
-<code><pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
+<pre class="prettyprint">
+&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;configuration description="call a bunch of numbers; many-numbers.xml"&gt;
&lt;test class="com.example.PhoneCallFuncTest"&gt;
&lt;option name="call" key="111-111-1111" value="#*#*TEST1*#*#" /&gt;
&lt;option name="call" key="222-222-2222" value="#*#*TEST2*#*#" /&gt;
&lt;!-- ... --&gt;
&lt;/test&gt;
-&lt;/configuration&gt;</pre></code>
+&lt;/configuration&gt;
+</pre>
<h2 id="testrunner">Test Runner</h2>
<p>The Test Runner also has access to these configuration points via the Trade Federation console.
@@ -98,11 +103,14 @@ append to fields specified by Lifecycle Objects within each config.</p>
<p>To run the low-latency test with the <code>many-numbers</code> phone numbers, the Test Runner
could execute:</p>
-<code><pre>tf >run low-latency.xml --call 111-111-1111 #*#*TEST1*#*# --call 222-222-2222 #*#*TEST2*#*#</pre></code>
+<pre class="devsite-click-to-copy">
+tf&gt; run low-latency.xml --call 111-111-1111 #*#*TEST1*#*# --call 222-222-2222 #*#*TEST2*#*#
+</pre>
<p>Or, to get a similar effect from the opposite direction, the Test Runner could reduce the wait time
for the <code>many-numbers</code> test:</p>
-<code><pre>tf >run many-numbers.xml --timeout 5000</code></pre>
+<pre class="devsite-click-to-copy">
+tf&gt; run many-numbers.xml --timeout 5000</pre>
</body>
</html>
diff --git a/en/devices/tech/test_infra/tradefed/fundamentals/vts.html b/en/devices/tech/test_infra/tradefed/fundamentals/vts.html
index 473db22f..8ba912d8 100644
--- a/en/devices/tech/test_infra/tradefed/fundamentals/vts.html
+++ b/en/devices/tech/test_infra/tradefed/fundamentals/vts.html
@@ -31,27 +31,41 @@ then test a patch using a VTS plan.</p>
<p>To set up a testing environment:</p>
<ol>
<li>Install Python development kit:
-<pre><code>$ sudo apt-get install python-dev</code></pre></li>
+<pre class="devsite-terminal devsite-click-to-copy">
+sudo apt-get install python-dev
+</pre>
+</li>
<li>Install Protocol Buffer tools (for Python):
-<pre><code>$ sudo apt-get install python-protobuf<br>
-$ sudo apt-get install protobuf-compiler
-</code></pre></li>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">sudo apt-get install python-protobuf</code>
+<code class="devsite-terminal">sudo apt-get install protobuf-compiler</code>
+</pre>
+</li>
<li>Install Python virtual environment-related tools:
-<pre><code>$ sudo apt-get install python-virtualenv<br>
-$ sudo apt-get install python-pip
-</code></pre></li></ol>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">sudo apt-get install python-virtualenv</code>
+<code class="devsite-terminal">sudo apt-get install python-pip</code>
+</pre>
+</li>
+</ol>
<h2 id="test">Testing a patch</h2>
<p>To test a patch:</p>
<ol>
<li>Build a VTS host-side package:
-<pre><code>$ . build/envsetup.sh
-$ lunch aosp_arm64-userdebug
-$ make vts -j</code></pre></li>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">. build/envsetup.sh</code>
+<code class="devsite-terminal">lunch aosp_arm64-userdebug</code>
+<code class="devsite-terminal">make vts -j</code>
+</pre>
+</li>
<li>Run the default VTS tests:
-<pre><code>$ vts-tradefed<br>
-&gt; run vts // where vts is the test plan name
-</pre></code></li></ol>
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">vts-tradefed</code>
+tf&gt; run vts // where vts is the test plan name
+</pre>
+</li>
+</ol>
<h2 id="plans">VTS plans</h2>
<p>Available VTS test plans include:</p>