Merge "Gracefully handle races with package uninstall" into mnc-dev
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 8ff56f8..4bbaaa1 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -939,4 +939,6 @@
public static final String OWNER_INFO_KEY = "OwnerInfo";
/** @hide */
public static final String PATTERN_VISIBLE_KEY = "PatternVisible";
+ /** @hide */
+ public static final String PASSWORD_VISIBLE_KEY = "PasswordVisible";
}
diff --git a/core/java/com/android/internal/view/FloatingActionMode.java b/core/java/com/android/internal/view/FloatingActionMode.java
index 0195208..93d2a1d 100644
--- a/core/java/com/android/internal/view/FloatingActionMode.java
+++ b/core/java/com/android/internal/view/FloatingActionMode.java
@@ -121,11 +121,7 @@
public void updateViewLocationInWindow() {
checkToolbarInitialized();
mOriginatingView.getLocationInWindow(mViewPosition);
- mViewRect.set(
- mViewPosition[0],
- mViewPosition[1],
- mViewPosition[0] + mOriginatingView.getWidth(),
- mViewPosition[1] + mOriginatingView.getHeight());
+ mOriginatingView.getGlobalVisibleRect(mViewRect);
repositionToolbar();
}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index e5ef60c..55b058c 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -957,6 +957,29 @@
}
/**
+ * Set whether the visible password is enabled for cryptkeeper screen.
+ */
+ public void setVisiblePasswordEnabled(boolean enabled, int userId) {
+ // Update for crypto if owner
+ if (userId != UserHandle.USER_OWNER) {
+ return;
+ }
+
+ IBinder service = ServiceManager.getService("mount");
+ if (service == null) {
+ Log.e(TAG, "Could not find the mount service to update the user info");
+ return;
+ }
+
+ IMountService mountService = IMountService.Stub.asInterface(service);
+ try {
+ mountService.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error changing password visible state", e);
+ }
+ }
+
+ /**
* @return Whether tactile feedback for the pattern is enabled.
*/
public boolean isTactileFeedbackEnabled() {
diff --git a/core/res/res/layout/notification_template_material_base.xml b/core/res/res/layout/notification_template_material_base.xml
index ea22b15..94bbec8 100644
--- a/core/res/res/layout/notification_template_material_base.xml
+++ b/core/res/res/layout/notification_template_material_base.xml
@@ -19,6 +19,7 @@
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="64dp"
+ android:tag="base"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml
index 2a3ee90..a13dc85 100644
--- a/core/res/res/layout/notification_template_material_big_base.xml
+++ b/core/res/res/layout/notification_template_material_big_base.xml
@@ -19,6 +19,7 @@
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:tag="big"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml
index 93acdbf..7fd93de 100644
--- a/core/res/res/layout/notification_template_material_big_media.xml
+++ b/core/res/res/layout/notification_template_material_big_media.xml
@@ -20,6 +20,7 @@
android:layout_width="match_parent"
android:layout_height="128dp"
android:background="#00000000"
+ android:tag="bigMedia"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/core/res/res/layout/notification_template_material_big_media_narrow.xml b/core/res/res/layout/notification_template_material_big_media_narrow.xml
index 21e5ff8..807cfaf 100644
--- a/core/res/res/layout/notification_template_material_big_media_narrow.xml
+++ b/core/res/res/layout/notification_template_material_big_media_narrow.xml
@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="128dp"
android:background="#00000000"
+ android:tag="bigMediaNarrow"
>
<ImageView android:id="@+id/icon"
android:layout_width="128dp"
diff --git a/core/res/res/layout/notification_template_material_big_picture.xml b/core/res/res/layout/notification_template_material_big_picture.xml
index f1a9549..f3768b5 100644
--- a/core/res/res/layout/notification_template_material_big_picture.xml
+++ b/core/res/res/layout/notification_template_material_big_picture.xml
@@ -19,6 +19,7 @@
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:tag="bigPicture"
>
<ImageView
android:id="@+id/big_picture"
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
index f657f04..b677a98 100644
--- a/core/res/res/layout/notification_template_material_big_text.xml
+++ b/core/res/res/layout/notification_template_material_big_text.xml
@@ -19,6 +19,7 @@
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:tag="bigText"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/core/res/res/layout/notification_template_material_inbox.xml b/core/res/res/layout/notification_template_material_inbox.xml
index a8d2ee3..c109225 100644
--- a/core/res/res/layout/notification_template_material_inbox.xml
+++ b/core/res/res/layout/notification_template_material_inbox.xml
@@ -19,6 +19,7 @@
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:tag="inbox"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/core/res/res/layout/notification_template_material_media.xml b/core/res/res/layout/notification_template_material_media.xml
index 0292d28..f6c22c8 100644
--- a/core/res/res/layout/notification_template_material_media.xml
+++ b/core/res/res/layout/notification_template_material_media.xml
@@ -21,6 +21,7 @@
android:layout_height="64dp"
android:orientation="horizontal"
android:background="#00000000"
+ android:tag="media"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
diff --git a/docs/html/auto/images/logos/apps/umano.png b/docs/html/auto/images/logos/apps/umano.png
deleted file mode 100644
index 478e268..0000000
--- a/docs/html/auto/images/logos/apps/umano.png
+++ /dev/null
Binary files differ
diff --git a/docs/html/auto/images/logos/apps/whatsapp.png b/docs/html/auto/images/logos/apps/whatsapp.png
new file mode 100644
index 0000000..a180d7a
--- /dev/null
+++ b/docs/html/auto/images/logos/apps/whatsapp.png
Binary files differ
diff --git a/docs/html/auto/index.jd b/docs/html/auto/index.jd
index 66ea15a..bf36995 100644
--- a/docs/html/auto/index.jd
+++ b/docs/html/auto/index.jd
@@ -272,8 +272,9 @@
/>
</div>
<div class="col-4">
- <img src="{@docRoot}auto/images/logos/apps/umano.png"
- width="160" height="160" class="img-logo" />
+ <img src="{@docRoot}auto/images/logos/apps/skype.png"
+ width="160" height="70" class="img-logo" style="margin-top:40px"
+ />
</div>
<div class="col-4">
<img src="/auto/images/logos/apps/spotify.png"
@@ -293,15 +294,14 @@
/>
</div>
<div class="col-4">
- <img src="{@docRoot}auto/images/logos/apps/skype.png"
- width="160" height="70" class="img-logo" style="margin-top:40px; margin-left:160px"
- />
- </div>
- <div class="col-4">
<img src="{@docRoot}auto/images/logos/apps/textme.png"
width="80" height="80" class="img-logo" style="margin-top:30px;margin-left:200px"
/>
</div>
+ <div class="col-4">
+ <img src="{@docRoot}auto/images/logos/apps/whatsapp.png"
+ width="120" height="120" class="img-logo" style="margin-top:10px;margin-left:180px" />
+ </div>
</div>
<div class="cols" style="margin-top:60px">
diff --git a/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image01.png b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image01.png
new file mode 100644
index 0000000..d4a1ea5
--- /dev/null
+++ b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image01.png
Binary files differ
diff --git a/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image02.png b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image02.png
new file mode 100644
index 0000000..f8f0d8c
--- /dev/null
+++ b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image02.png
Binary files differ
diff --git a/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image03.png b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image03.png
new file mode 100644
index 0000000..fc59b54
--- /dev/null
+++ b/docs/html/images/tools/performance/allocation-tracker/gettingstarted_image03.png
Binary files differ
diff --git a/docs/html/images/tools/performance/allocation_tracker.png b/docs/html/images/tools/performance/allocation_tracker.png
new file mode 100755
index 0000000..cbae4cd
--- /dev/null
+++ b/docs/html/images/tools/performance/allocation_tracker.png
Binary files differ
diff --git a/docs/html/images/tools/performance/battery_historian.png b/docs/html/images/tools/performance/battery_historian.png
new file mode 100755
index 0000000..d1d58ac
--- /dev/null
+++ b/docs/html/images/tools/performance/battery_historian.png
Binary files differ
diff --git a/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image01.png b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image01.png
new file mode 100644
index 0000000..8f12698
--- /dev/null
+++ b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image01.png
Binary files differ
diff --git a/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png
new file mode 100644
index 0000000..e8a0a87
--- /dev/null
+++ b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png
Binary files differ
diff --git a/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image03.png b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image03.png
new file mode 100644
index 0000000..8914d3b
--- /dev/null
+++ b/docs/html/images/tools/performance/batterystats-battery-historian/gettingstarted_image03.png
Binary files differ
diff --git a/docs/html/images/tools/performance/compare_AllocationTracker.png b/docs/html/images/tools/performance/compare_AllocationTracker.png
new file mode 100755
index 0000000..bec9931
--- /dev/null
+++ b/docs/html/images/tools/performance/compare_AllocationTracker.png
Binary files differ
diff --git a/docs/html/images/tools/performance/compare_HeapViewer.png b/docs/html/images/tools/performance/compare_HeapViewer.png
new file mode 100755
index 0000000..2cc4bce
--- /dev/null
+++ b/docs/html/images/tools/performance/compare_HeapViewer.png
Binary files differ
diff --git a/docs/html/images/tools/performance/compare_MemoryMonitor.png b/docs/html/images/tools/performance/compare_MemoryMonitor.png
new file mode 100755
index 0000000..5a728fd
--- /dev/null
+++ b/docs/html/images/tools/performance/compare_MemoryMonitor.png
Binary files differ
diff --git a/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image01.png b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image01.png
new file mode 100644
index 0000000..a398f35
--- /dev/null
+++ b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image01.png
Binary files differ
diff --git a/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image02.png b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image02.png
new file mode 100644
index 0000000..9a7ccb3
--- /dev/null
+++ b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image02.png
Binary files differ
diff --git a/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image03.png b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image03.png
new file mode 100644
index 0000000..acdff2c
--- /dev/null
+++ b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image03.png
Binary files differ
diff --git a/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image04.png b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image04.png
new file mode 100644
index 0000000..8219ec8
--- /dev/null
+++ b/docs/html/images/tools/performance/debug-gpu-overdraw/gettingstarted_image04.png
Binary files differ
diff --git a/docs/html/images/tools/performance/gpu_profiling.png b/docs/html/images/tools/performance/gpu_profiling.png
new file mode 100755
index 0000000..c86fb14
--- /dev/null
+++ b/docs/html/images/tools/performance/gpu_profiling.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap-viewer/gettingstarted_image01.png b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image01.png
new file mode 100644
index 0000000..eef493c
--- /dev/null
+++ b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image01.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap-viewer/gettingstarted_image02.png b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image02.png
new file mode 100644
index 0000000..7540640
--- /dev/null
+++ b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image02.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap-viewer/gettingstarted_image03.png b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image03.png
new file mode 100644
index 0000000..42e8ba3
--- /dev/null
+++ b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image03.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap-viewer/gettingstarted_image04.png b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image04.png
new file mode 100644
index 0000000..36d1164
--- /dev/null
+++ b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image04.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap-viewer/gettingstarted_image05.png b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image05.png
new file mode 100644
index 0000000..b74d37b
--- /dev/null
+++ b/docs/html/images/tools/performance/heap-viewer/gettingstarted_image05.png
Binary files differ
diff --git a/docs/html/images/tools/performance/heap_viewer.png b/docs/html/images/tools/performance/heap_viewer.png
new file mode 100755
index 0000000..d9028d0
--- /dev/null
+++ b/docs/html/images/tools/performance/heap_viewer.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image001.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image001.png
new file mode 100644
index 0000000..eef493c
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image002.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image002.png
new file mode 100644
index 0000000..00e8edf
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image003.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image003.png
new file mode 100644
index 0000000..c0f9c78
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image004.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image004.png
new file mode 100644
index 0000000..bc555b8
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image005.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image005.png
new file mode 100644
index 0000000..209f71b
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image006.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image006.png
new file mode 100644
index 0000000..57d3256
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image006.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image007.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image007.png
new file mode 100644
index 0000000..dd12e07
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image007.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image008.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image008.png
new file mode 100644
index 0000000..74302b2
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image008.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image009.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image009.png
new file mode 100644
index 0000000..1b93961
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image009.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image010.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image010.png
new file mode 100644
index 0000000..1fe198b
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image010.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image011.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image011.png
new file mode 100644
index 0000000..a9a0a3e
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image011.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image012.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image012.png
new file mode 100644
index 0000000..9308cd1
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image012.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image013.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image013.png
new file mode 100644
index 0000000..80e1ba1
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image013.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image014.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image014.png
new file mode 100644
index 0000000..326c5a0
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image014.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image015.png b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image015.png
new file mode 100644
index 0000000..e9824a4
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy-viewer/gettingstarted_image015.png
Binary files differ
diff --git a/docs/html/images/tools/performance/hierarchy_viewer.png b/docs/html/images/tools/performance/hierarchy_viewer.png
new file mode 100755
index 0000000..064efea
--- /dev/null
+++ b/docs/html/images/tools/performance/hierarchy_viewer.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image001.png b/docs/html/images/tools/performance/import_image001.png
new file mode 100755
index 0000000..872c55b
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image002.png b/docs/html/images/tools/performance/import_image002.png
new file mode 100755
index 0000000..114f90b
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image003.png b/docs/html/images/tools/performance/import_image003.png
new file mode 100755
index 0000000..1e47d7b
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image004.png b/docs/html/images/tools/performance/import_image004.png
new file mode 100755
index 0000000..6c5b801
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image005.png b/docs/html/images/tools/performance/import_image005.png
new file mode 100755
index 0000000..35080c5
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image006.png b/docs/html/images/tools/performance/import_image006.png
new file mode 100755
index 0000000..08b9e61
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image006.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image007.png b/docs/html/images/tools/performance/import_image007.png
new file mode 100755
index 0000000..d2ec83b
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image007.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image008.png b/docs/html/images/tools/performance/import_image008.png
new file mode 100755
index 0000000..efde7df
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image008.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image009.png b/docs/html/images/tools/performance/import_image009.png
new file mode 100755
index 0000000..f9e6109
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image009.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image010.png b/docs/html/images/tools/performance/import_image010.png
new file mode 100755
index 0000000..165edea
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image010.png
Binary files differ
diff --git a/docs/html/images/tools/performance/import_image011.png b/docs/html/images/tools/performance/import_image011.png
new file mode 100755
index 0000000..f475ebc
--- /dev/null
+++ b/docs/html/images/tools/performance/import_image011.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory-monitor/gettingstarted_image001.png b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image001.png
new file mode 100644
index 0000000..c6fe045
--- /dev/null
+++ b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory-monitor/gettingstarted_image002.png b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image002.png
new file mode 100644
index 0000000..f46b6f1
--- /dev/null
+++ b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory-monitor/gettingstarted_image003.png b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image003.png
new file mode 100644
index 0000000..72291cd
--- /dev/null
+++ b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory-monitor/gettingstarted_image004.png b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image004.png
new file mode 100644
index 0000000..d343879
--- /dev/null
+++ b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory-monitor/gettingstarted_image005.png b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image005.png
new file mode 100644
index 0000000..f7d9784
--- /dev/null
+++ b/docs/html/images/tools/performance/memory-monitor/gettingstarted_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/memory_monitor.png b/docs/html/images/tools/performance/memory_monitor.png
new file mode 100755
index 0000000..c761141
--- /dev/null
+++ b/docs/html/images/tools/performance/memory_monitor.png
Binary files differ
diff --git a/docs/html/images/tools/performance/overdraw.png b/docs/html/images/tools/performance/overdraw.png
new file mode 100755
index 0000000..ff402d0
--- /dev/null
+++ b/docs/html/images/tools/performance/overdraw.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image001.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image001.png
new file mode 100644
index 0000000..d59cf12
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image002.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image002.png
new file mode 100644
index 0000000..5f974ef
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image003.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image003.png
new file mode 100644
index 0000000..788c18d
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image004.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image004.png
new file mode 100644
index 0000000..ab0616e
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image005.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image005.png
new file mode 100644
index 0000000..6411bf6
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image006.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image006.png
new file mode 100644
index 0000000..6376a1a
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image006.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image007.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image007.png
new file mode 100644
index 0000000..586a8d8
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image007.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image008.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image008.png
new file mode 100644
index 0000000..47ff045
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image008.png
Binary files differ
diff --git a/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image009.png b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image009.png
new file mode 100644
index 0000000..c448162
--- /dev/null
+++ b/docs/html/images/tools/performance/profile-gpu-rendering/gettingstarted_image009.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace.png b/docs/html/images/tools/performance/systrace.png
new file mode 100755
index 0000000..567a8a7
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace/gettingstarted_image001.png b/docs/html/images/tools/performance/systrace/gettingstarted_image001.png
new file mode 100644
index 0000000..e31f531
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace/gettingstarted_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace/gettingstarted_image002.png b/docs/html/images/tools/performance/systrace/gettingstarted_image002.png
new file mode 100644
index 0000000..01c69f5
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace/gettingstarted_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace/gettingstarted_image003.png b/docs/html/images/tools/performance/systrace/gettingstarted_image003.png
new file mode 100644
index 0000000..bf34f3f
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace/gettingstarted_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace/gettingstarted_image004.png b/docs/html/images/tools/performance/systrace/gettingstarted_image004.png
new file mode 100644
index 0000000..2a5286f
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace/gettingstarted_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/systrace/gettingstarted_image005.png b/docs/html/images/tools/performance/systrace/gettingstarted_image005.png
new file mode 100644
index 0000000..7f41398
--- /dev/null
+++ b/docs/html/images/tools/performance/systrace/gettingstarted_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview.png b/docs/html/images/tools/performance/traceview.png
new file mode 100755
index 0000000..16e6bdd
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image001.png b/docs/html/images/tools/performance/traceview/gettingstarted_image001.png
new file mode 100644
index 0000000..eef493c
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image001.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image002.png b/docs/html/images/tools/performance/traceview/gettingstarted_image002.png
new file mode 100644
index 0000000..a334319
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image002.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image003.png b/docs/html/images/tools/performance/traceview/gettingstarted_image003.png
new file mode 100644
index 0000000..57f3ab4
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image003.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image004.png b/docs/html/images/tools/performance/traceview/gettingstarted_image004.png
new file mode 100644
index 0000000..b32b9ad
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image004.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image005.png b/docs/html/images/tools/performance/traceview/gettingstarted_image005.png
new file mode 100644
index 0000000..a893dde
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image005.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image006.png b/docs/html/images/tools/performance/traceview/gettingstarted_image006.png
new file mode 100644
index 0000000..9ffee43
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image006.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image007.png b/docs/html/images/tools/performance/traceview/gettingstarted_image007.png
new file mode 100644
index 0000000..3b04ba3
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image007.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image008.png b/docs/html/images/tools/performance/traceview/gettingstarted_image008.png
new file mode 100644
index 0000000..054cd90
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image008.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image009.png b/docs/html/images/tools/performance/traceview/gettingstarted_image009.png
new file mode 100644
index 0000000..7b95cf3e
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image009.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image010.png b/docs/html/images/tools/performance/traceview/gettingstarted_image010.png
new file mode 100644
index 0000000..871d4bc
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image010.png
Binary files differ
diff --git a/docs/html/images/tools/performance/traceview/gettingstarted_image011.png b/docs/html/images/tools/performance/traceview/gettingstarted_image011.png
new file mode 100644
index 0000000..6e39a19
--- /dev/null
+++ b/docs/html/images/tools/performance/traceview/gettingstarted_image011.png
Binary files differ
diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js
index 05f89ff..a61a17d 100644
--- a/docs/html/jd_collections.js
+++ b/docs/html/jd_collections.js
@@ -1580,5 +1580,38 @@
"training/enterprise/work-policy-ctrl.html",
"samples/BasicManagedProfile/index.html"
]
+ },
+ "tools/performance/rendering": {
+ "title": "",
+ "resources": [
+ "tools/performance/debug-gpu-overdraw/index.html",
+ "tools/performance/profile-gpu-rendering/index.html",
+ "tools/performance/hierarchy-viewer/setup.html",
+ "tools/performance/hierarchy-viewer/index.html",
+ "tools/performance/hierarchy-viewer/profiling.html"
+ ]
+ },
+ "tools/performance/memory": {
+ "title": "",
+ "resources": [
+ "tools/performance/memory-monitor/index.html",
+ "tools/performance/heap-viewer/index.html",
+ "tools/performance/allocation-tracker/index.html",
+ "tools/performance/comparison.html"
+ ]
+ },
+ "tools/performance/cpu": {
+ "title": "",
+ "resources": [
+ "tools/performance/traceview/index.html",
+ "tools/performance/systrace/index.html"
+ ]
+ },
+ "tools/performance/battery": {
+ "title": "",
+ "resources": [
+ "tools/performance/batterystats-battery-historian/index.html",
+ "tools/performance/batterystats-battery-historian/charts.html"
+ ]
}
}
\ No newline at end of file
diff --git a/docs/html/preview/features/app-linking.jd b/docs/html/preview/features/app-linking.jd
new file mode 100644
index 0000000..c516f35
--- /dev/null
+++ b/docs/html/preview/features/app-linking.jd
@@ -0,0 +1,112 @@
+page.title=App Linking
+
+@jd:body
+
+
+<div id="qv-wrapper">
+ <div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#web-assoc">Declare a Website Association</a></li>
+ <li><a href="#verfy-links">Request App Link Verification</a></li>
+ <li><a href="#user-manage">Managing App Link Settings</a></li>
+ </ol>
+ </div>
+</div>
+
+<p>
+ The Android Intent system is a flexible mechanism to enable apps to handle content and requests.
+ Multiple apps may declare matching URI patterns in their intent filters. When a user clicks on a
+ web link that does not have default launch handler, the platform may show a dialog for the user
+ to select from a list of apps that have declared matching intent filters.
+</p>
+
+<p>
+ The Android M Developer Preview introduces support for app linking, which improves upon existing
+ link handling by allowing app developers to associate an app with a web domain they own. When
+ developers create this association, the platform can automatically determine the default app used
+ to handle a particular web link and skip asking users.
+</p>
+
+
+<h2 id="web-assoc">Declare a Website Association</h2>
+
+<p>
+ Website owners must declare associations with apps to establish an app link. The site owner
+ declares the relationship to an app by hosting a JSON file, named {@code statements.json}, at the
+ well-known location on the domain:
+</p>
+
+<pre>http://<domain>:<optional port>/.well-known/statements.json</pre>
+
+<p class="note">
+ <strong>Note:</strong>
+ During the M Developer Preview period, the JSON file is verified via http protocol. For
+ the official release of the platform, the file is verified over encrypted, https protocol.
+</p>
+
+<p>
+ This JSON file indicates the Android app that should be used as the default handler for the URLs
+ under this domain. It identifies the app based on these fields:
+</p>
+
+<ul>
+ <li>{@code package_name}: The package name declared in the app's manifest.</li>
+
+ <li>{@code sha256_cert_fingerprints}: The SHA256 fingerprint of your app’s signing certificate.
+ You can use the Java keytool to generate the fingerprint using the following command:
+ <pre>keytool -list -v -keystore my-release-key.keystore</pre>
+ </li>
+</ul>
+
+<p>
+ The following file listing shows an example of the contents and format of a
+ {@code statements.json} file:
+</p>
+
+<pre>
+[{
+ "relation": ["delegate_permission/common.handle_all_urls"],
+ "target": {
+ "namespace": "android_app",
+ "package_name": "<strong><package name></strong>",
+ "sha256_cert_fingerprints": ["<strong>6C:EC:C5:0E:34:AE....EB:0C:9B</strong>"]
+ }
+}]
+</pre>
+
+
+<h2 id="verfy-links">Request App Link Verification</h2>
+
+<p>
+ An app can indicate to the platform to verify app links against the {@code statements.json} files
+ hosted on the sites defined by the host names in the <data> elements of the intent filters.
+ To do this, add an {@code android:autoVerify} attribute to the appropriate intent filters in the
+ manifest, as shown in the following manifest code snippet:
+</p>
+
+<pre>
+<activity ...>
+ <intent-filter <strong>android:autoVerify="true"</strong>>
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="http" android:host="www.android.com" />
+ <data android:scheme="https" android:host="www.android.com" />
+ </intent-filter>
+</activity>
+</pre>
+
+<p>
+ When an app is installed, the platform attempts to verify the app links. If the platform cannot
+ successfully verify app links, it falls back to prompting the user the next time they open a link
+ that the app handles, or they will need to explicitly enable the app in the App Info settings UI.
+</p>
+
+<h2 id="user-manage">Managing App Link Settings</h2>
+
+<p>
+ Users can change app link settings so URLs are handled the way they prefer. You can review and
+ manage app links in the system Settings app, under <strong>Settings > Apps > App Info >
+ Open by default</strong>.
+</p>
diff --git a/docs/html/tools/performance/allocation-tracker/index.jd b/docs/html/tools/performance/allocation-tracker/index.jd
new file mode 100644
index 0000000..e71b584
--- /dev/null
+++ b/docs/html/tools/performance/allocation-tracker/index.jd
@@ -0,0 +1,148 @@
+page.title=Allocation Tracker Walkthrough
+meta.tags="android, performance, profiling, tools, memoryleaks, memoryheap"
+page.tags="android", "performance", "profiling", "tools", "memoryleaks", "memoryheap"
+page.metaDescription=Record you app's memory allocations with their call stack to identify code that allocates and frees objects unnecessarily.
+page.image=tools/performance/thumbnails/tools_allocation_tracker.png
+page.article=true
+
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithAllocationTracker">Working with Allocation Tracker</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/heap-viewer/index.html">
+ Heap Viewer Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/memory-monitor/index.html">
+ Memory Monitor Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/comparison.html">
+ Comparison: Memory Monitor, Heap Viewer, Allocation Tracker</a>
+ <li><a href="{@docRoot}tools/performance/traceview/index.html">
+ Traceview Walkthrough</a></li>
+</ul>
+
+</div>
+
+
+ <p>This walkthrough shows the basic usage and workflow for the Allocation Tracker tool in Android
+ Studio. Allocation Tracker records an app's memory allocations and lists all
+ allocated objects for the profiling cycle with their call stack, size, and allocating code.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Identifying where many similar object types, from roughly the same call stack, are
+ allocated and deallocated over a very short period of time.</li>
+
+ <li>Finding the places in your code that may contribute to inefficient memory use.</li>
+ </ul>
+
+ <p>Before using Allocation Tracker, profile your code with the
+ <a href="{@docRoot}tools/performance/memory-monitor/index.html">Memory
+ Monitor Tool</a>. If you see many garbage collection events in a short amount of time, use
+ <a href="{@docRoot}tools/performance/heap-viewer/index.html">Heap
+ Viewer</a> to identify candidate object types, and Allocation Tracker to determine where this is
+ happening in your code.</p>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+
+ <li>Application code. Use your own code, or the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+ <h2 id="WorkingWithAllocationTracker">Working with Allocation Tracker</h2>
+
+ <p>Allocation Tracker records each memory allocation that your app performs during the profiling
+ cycle. You tell Allocation Tracker to start recording and it logs allocations
+ until you tell it to stop.</p>
+
+<hr>
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/allocation-tracker/gettingstarted_image01.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Steps for starting Allocation Tracker.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source, and run it on your device.</li>
+
+ <li>Click the <b>Android</b> button at the bottom of your Android Studio window.</li>
+
+ <li>Click the RECORD button
+ <img src="{@docRoot}images/tools/performance/allocation-tracker/gettingstarted_image02.png">
+ (Start Allocation Tracking tooltip).</li>
+
+ <li>Interact with your application.</li>
+
+ <li>Click the (same) STOP button (Stop Allocation Tracking tooltip).</li>
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/allocation-tracker/gettingstarted_image03.png"
+ alt=""
+ width="440px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Example of Allocation Tracker output.
+ </p>
+ </div>
+
+ <li>After a few seconds, a pane with your recorded data opens.
+
+ <p>Note that allocations are logged on
+ the device, and the data file is transferred to the host computer, parsed for information, and
+ displayed.</p></li>
+
+ <li>The pane populates with a table.
+
+ <ul>
+ <li>Each row represents a memory allocation event.</li>
+
+ <li>Each column represents information about the allocation, such as the object type,
+ the thread, and its size. </li>
+
+ <li>The columns are movable, resizable, and sortable.</li>
+ </ul>
+
+ <p>Use the Filter to show only allocations from your app.</li>
+
+ <li>Click on an object to see its full stack trace.</li>
+ </ol>
+</div></li>
+</ul>
diff --git a/docs/html/tools/performance/batterystats-battery-historian/charts.jd b/docs/html/tools/performance/batterystats-battery-historian/charts.jd
new file mode 100644
index 0000000..cbe9d85
--- /dev/null
+++ b/docs/html/tools/performance/batterystats-battery-historian/charts.jd
@@ -0,0 +1,124 @@
+page.title=Battery Historian Charts
+meta.tags="android, performance, profiling, tools, battery, historian, batterydrain
+page.tags="android", performance", "profiling", "tools", "battery", "historian" "batterydrain"
+page.metaDescription=Examine and interpret the collected battery usage data in your browser.
+page.image=tools/performance/thumbnails/tools_battery_historian.png
+page.article=true
+
+@jd:body
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#BatteryHistorianCharts">Battery Historian Charts</a></li>
+ <li><a href="#FilteringBatterystats">Filtering batterystats output</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/batterystats-battery-historian/index.html">
+ Batterystats & Battery Historian Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/systrace/index.html">
+ Systrace Walkthrough</a></li>
+</ul>
+
+</div>
+
+
+ <p id="BatteryHistorianCharts">
+ The Battery Historian chart graphs power-relevant events over time.</p>
+
+ <p>Each row shows a colored bar segment when a system component is active
+ and thus drawing current from the battery. The chart does <i>not</i> show <i>how much</i> battery was used by the
+ component, only that the app was active. Charts are organized by category.</p>
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png"
+ alt=""
+ height="" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Example of Battery Historian output.
+ </p>
+ </div>
+
+ <h3>Battery usage categories</h3>
+
+ <ul>
+ <li><b>battery_level</b>: When the battery level was recorded and logged.
+ Reported in percent, where 093 is 93%. Provides an overall measure of how fast the battery
+ is draining.</li>
+
+ <li><b>top</b>: The application running at the top; usually, the application that is visible to
+ the user. If you want to measure battery drain while your app is active, make sure
+ it's the top app. If you want to measure battery drain while your app is in
+ the background, make sure it's <i>not</i> the top app.</li>
+
+ <li><b>wifi_running</b>: Shows that the Wi-Fi network connection was active.</li>
+
+ <li><b>screen</b>: Screen is turned on.</li>
+
+ <li><b>phone_in_call</b>: Recorded when the phone is in a call.</li>
+
+ <li><b>wake_lock</b>: App wakes up, grabs a lock, does small work, then goes back to sleep.
+ This is one of the most important pieces of information. Waking up the phone is expensive, so
+ if you see lots of short bars here, that might be a problem.</li>
+
+ <li><b>running</b>: Shows when the CPU is awake. Check whether it is awake and asleep
+ when you expect it to be.</li>
+
+ <li><b>wake_reason</b>: The last thing that caused the kernel to wake up. If
+ it's your app, determine whether it was necessary.</li>
+
+ <li><b>mobile_radio</b>: Shows when the radio was on. Starting the radio is battery expensive.
+ Many narrow bars close to each other can indicate opportunities for
+ batching and other optimizations.</li>
+
+ <li><b>gps</b>: Indicates when the GPS was on. Make sure this is what you expect.</li>
+
+ <li><b>sync:</b> Shows when an app was syncing with a backend. The sync bar also shows which
+ app did the syncing. For users, this can show apps where they might turn syncing off to save
+ battery. Developers should sync as little as possible and only as often as necessary.</li>
+ </ul>
+
+
+ <p class="note"><strong>Note:</strong>
+ Not every chart will show every category.</p>
+
+ <h2 id="FilteringBatterystats">Filtering batterystats output</h2>
+
+ <p>You can gather additional information from the <code>batterystats.txt</code> file
+ where you saved the output from the batterystats command.</p>
+
+ <div class="figure" style="">
+<img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image03.png"
+ alt=""
+ width="340px" />
+ <p class="img-caption">
+ <strong>Figure 2.</strong>Example of filtered batterystats output.
+ </p>
+ </div>
+
+ <p>Open the file in a text editor and search for:</p>
+
+ <ol>
+ <li><b><code>Battery History</code></b>: A time series of power-relevant events, such as
+ screen, Wi-Fi, and app launch. These are also visible through Battery Historian.</li>
+
+ <li><b><code>Per-PID Stats</code></b>: How long each process ran.</li>
+
+ <li><b><code>Statistics since last charge</code></b>: System-wide statistics, such as
+ cell signal levels and screen brightness. Provides an overall picture of what's happening
+ with the device. This information is especially useful
+ to make sure no external events are affecting your experiment.</li>
+
+ <li><b><code>Estimated power use (mAh)</code></b> by UID and peripheral: This is currently an
+ extremely rough estimate and should not be considered experiment data.</li>
+
+ <li><b><code>Per-app mobile ms per packet</code></b>: Radio-awake-time divided by packets sent.
+ An efficient app will transfer all its traffic in batches, so the lower this number the
+ better.</li>
+
+ <li><b><code>All partial wake locks</code></b>: All app-held wakelocks, by aggregate
+ duration and count.</li>
+ </ol>
diff --git a/docs/html/tools/performance/batterystats-battery-historian/index.jd b/docs/html/tools/performance/batterystats-battery-historian/index.jd
new file mode 100644
index 0000000..2072df9
--- /dev/null
+++ b/docs/html/tools/performance/batterystats-battery-historian/index.jd
@@ -0,0 +1,129 @@
+page.title=Batterystats & Battery Historian Walkthrough
+meta.tags="android, performance, profiling, tools, battery, batterystats, historian, batterydrain
+page.tags="android", "performance", "profiling", "tools", "battery", "batterystats", "historian", "batterydrain"
+page.metaDescription=Collect battery usage data from your device and display it graphically in your browser.
+page.image=tools/performance/thumbnails/tools_battery_historian.png
+page.article=true
+
+
+@jd:body
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/batterystats-battery-historian/charts.html">
+ Battery Historian Charts</a></li>
+ <li><a href="{@docRoot}tools/performance/systrace/index.html">
+ Systrace Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows the basic usage and workflow for the Batterystats tool and the Battery
+ Historian script.</p>
+
+ <p>Batterystats collects battery data from your device, and Battery Historian converts that data
+ into an HTML visualization that you can view in your Browser. Batterystats is part of the Android
+ framework, and Battery Historian is open-sourced and available on GitHub at <a href=
+ "https://github.com/google/battery-historian">https://github.com/google/battery-historian</a>.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Showing you where and how processes are drawing current from the battery.</li>
+
+ <li>Identifying tasks in your app that could be deferred or even removed to improve battery
+ life.</li>
+ </ul>
+
+ <h2>Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled running Android 5.0 or higher.</li>
+ </ul>
+
+ <h2>Working with Batterystats & Battery Historian</h2>
+
+ <div class="sidebox-wrapper" style="width:400px;">
+ <div class="sidebox" style="width:350px;">
+ <h2>Summary</h2>
+ <code>
+ <p><b>https://github.com/google/battery-historian</b></p>
+ <p>> adb kill-server</p>
+ <p>> adb devices</p>
+ <p>> adb shell dumpsys batterystats --reset</p>
+ <p><disconnect and play with app>...<reconnect></p>
+ <p>> adb devices</p>
+ <p>>adb shell dumpsys batterystats > batterystats.txt</p>
+ <p>> python historian.py batterystats.txt > batterystats.html</p>
+ </code>
+ </div>
+ </div>
+
+ <ol>
+
+ <li>Download the open-source Battery Historion Python script from GitHub (<a href=
+ "https://github.com/google/battery-historian">https://github.com/google/battery-historian</a>).
+ </li>
+
+ <li>Unzip the file to extract the Battery Historian folder. Inside the folder,
+ find the <code>historian.py</code> file
+ and move it to the Desktop or another <em>writable</em> directory.</li>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>On your computer, open a Terminal window.</li>
+
+ <li>Change to the directory where you've saved <code>historian.py</code>,
+ <br>for example:
+ <code>cd ~/Desktop</code></li>
+
+ <li>Shut down your running adb server.
+ <br><code>> adb kill-server</code></li>
+
+ <li>Restart adb and check for connected devices.
+ <br><code>> adb devices</code>
+ <br><img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image01.png">
+ <br>If you don't see any devices, make sure your phone is connected, and USB Debugging
+ is turned on, and then kill and restart adb.</li>
+
+ <li>Reset battery data gathering.
+ <br><code>> adb shell dumpsys batterystats --reset</code>
+ <p>Resetting erases old battery collection data; otherewise, the output will be huge.</p>
+ </li>
+
+ <li>Disconnect your device from your computer so that you are only drawing current from the
+ device's battery.</li>
+
+ <li>Play with your app for a short time.</li>
+
+ <li>Reconnect your phone.</li>
+
+ <li>Make sure your phone is recognized: <code>> adb devices</code></li>
+
+ <li>Dump all battery data. This can take a while:
+ <br><code>> adb shell dumpsys batterystats > batterystats.txt</code></li>
+
+ <li>Create a HTML version of the data dump for Battery Historian:
+ <br><code>> python historian.py batterystats.txt > batterystats.html</code></li>
+
+ <li>Open the <code>batterystats.htm</code> file in your browser.</li>
+
+ <li>Continue with <a href="{@docRoot}tools/performance/batterystats-battery-historian/charts.html">
+ Battery Historian Charts</a>.
+ </li>
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/batterystats-battery-historian/gettingstarted_image02.png"
+ alt=""
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Battery Historian output.
+ </p>
+ </div>
+ </ol>
+
+
+
diff --git a/docs/html/tools/performance/comparison.jd b/docs/html/tools/performance/comparison.jd
new file mode 100644
index 0000000..cf4b7120
--- /dev/null
+++ b/docs/html/tools/performance/comparison.jd
@@ -0,0 +1,133 @@
+page.title=Memory Profilers
+meta.tags="android, performance, profiling, tools, memory, memoryleaks, garbagecollection"
+page.tags="android", "performance", "profiling", "tools", "memory", "memoryleaks", "garbagecollection"
+page.metaDescription=Heap Viewer, Memory Monitor, and Allocation Tracker are complementary tools that visualize the memory your app uses.
+page.image=tools/performance/thumbnails/tools_memory_monitor.png
+page.article=true
+
+@jd:body
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#MemoryMonitor">Memory Monitor</a></li>
+ <li><a href="#HeapViewer">Heap Viewer</a></li>
+ <li><a href="#AllocationTracker">Allocation Tracker</a></li>
+
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/memory-monitor/index.html">
+ Memory Monitor Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/heap-viewer/index.html">
+ Heap Viewer Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/allocation-tracker/index.html">
+ Allocation Tracker Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>Heap Viewer, Memory Monitor, and Allocation Tracker are complementary tools that visualize the
+ memory your app uses.</p>
+
+ <ol>
+ <li>Use the
+ <a href="{@docRoot}tools/performance/memory-monitor/index.html">
+ Memory Monitor Tool</a> to find out whether undesirable garbage collection (GC) event patterns might
+ be causing your performance problems.</li>
+
+ <li>Run
+ <a href="{@docRoot}tools/performance/heap-viewer/index.html">
+ Heap Viewer</a> to identify object types that get or stay allocated
+ unexpectedely or unecessarily.</li>
+
+ <li>Use
+ <a href="{@docRoot}tools/performance/allocation-tracker/index.html">
+ Allocation Tracker</a> to identify where in your code the problem might be.</li>
+ </ol>
+
+ <h2 id="MemoryMonitor">Memory Monitor</h2>
+
+<div>
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/compare_MemoryMonitor.png"
+ alt=""
+ height="" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Memory Monitor.
+ </p>
+ </div>
+
+ <ul>
+ <li>Shows available and used memory as they both change over time <i>for your app</i> in a
+ graph, with dips indicating Garbage Collection (GC) events.</li>
+
+ <li>Provides a quick way to test whether app slowness might be related
+ to excessive GC events.</li>
+
+ <li>Provides a quick way to see whether app crashes might be related
+ to running out of memory.</li>
+
+ <li>Runs live on your application and updates about once a second.</li>
+
+ <li>Helps quickly identify the potential of memory leaks.</li>
+
+ <li>Helps identify GC patterns for your application and determine whether
+ they are healthy and what you expect.</li>
+
+ <li>Is easy to use, and it is easy to interpret what you see.</li>
+
+ <li>However, Memory Monitor does not tell you which objects are the cause
+ of your problems, or where in your code it might be.</li>
+ </ul>
+
+ <h2 id="HeapViewer">Heap Viewer</h2>
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/compare_HeapViewer.png"
+ alt=""
+ height="" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Heap Viewer.
+ </p>
+ </div>
+
+ <ul>
+ <li>Shows snapshots of a number of objects allocated by type.</li>
+
+ <li>Samples data every time a garbage collection event occurs
+ naturally or triggered by you.</li>
+
+ <li>Helps identify which object types might be involved in memory leaks.</li>
+
+ <li>However, you have to look for changes over time yourself by tracking what's
+ happening in the graph.</li>
+ <br><br><br><br>
+ </ul>
+
+ <h2 id="AllocationTracker">Allocation Tracker</h2>
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/compare_AllocationTracker.png"
+ alt=""ge
+ height="" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Allocation Tracker.
+ </p>
+ </div>
+
+ <ul>
+ <li>Shows when and where your code allocates object types, their size, allocating thread, and
+ stack traces.</li>
+
+ <li>Helps recognize memory churn through recurring allocation/deallocation patterns.</li>
+
+ <li>Can be used in combination with Heap Viewer to track down memory leaks. For example, if you
+ see a bitmap object resident on the heap, you can find its allocation location with Allocation
+ Tracker.</li>
+
+ <li>However, it takes time and experience to learn to interpret the output from this tool.</li>
+
+ </ul>
diff --git a/docs/html/tools/performance/debug-gpu-overdraw/index.jd b/docs/html/tools/performance/debug-gpu-overdraw/index.jd
new file mode 100644
index 0000000..e6b85fd
--- /dev/null
+++ b/docs/html/tools/performance/debug-gpu-overdraw/index.jd
@@ -0,0 +1,156 @@
+page.title=Debug GPU Overdraw Walkthrough
+meta.tags="android, performance, profiling, tools, rendering, overdraw"
+page.tags="android", "performance", "profiling", "tools", "rendering", "overdraw"
+page.metaDescription=Use color-coding to show how many times each pixel is redrawn on the screen to reduce rendering overhead.
+page.image=tools/performance/thumbnails/tools_debug_gpu_overdraw.png
+page.article=true
+
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#VisualizingOverdraw">Visualizing Overdraw</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/profile-gpu-rendering/index.html">
+ Profile GPU Rendering Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/index.html">
+ Hierarchy Viewer Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows how to visualize overdraw on your mobile device by color-coding
+ interface elements based on how often they are drawn underneath.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Showing where an app might be doing more rendering work than necessary.</li>
+
+ <li>Helping you see where you might be able to reduce rendering overhead.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+ </ul>
+
+
+ <h2 id="VisualizingOverdraw">Visualizing Overdraw on your Mobile Device</h2>
+
+ <ul class="no-bullet">
+ <!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img
+ src="{@docRoot}images/tools/performance/debug-gpu-overdraw/gettingstarted_image01.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Steps for turning on Debug GPU Overdraw.
+ </p>
+ </div>
+
+ <li>On your mobile device, go to <b>Settings</b> and tap <b>Developer Options</b>.</li>
+
+ <li>In the <em>Hardware accelerated rendering</em> section,
+ select <b>Debug GPU Overdraw</b>.</li>
+
+ <li>In the <b>Debug GPU overdraw</b> popup, select <b>Show overdraw areas</b>.</li>
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="5">
+
+ <div class="figure" style="padding-right:100px">
+ <img
+ src="{@docRoot}images/tools/performance/debug-gpu-overdraw/gettingstarted_image02.png"
+ alt=""
+ width="180px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Example of<br>Debug GPU Overdraw output.
+ </p>
+ </div>
+
+ <li>Don't panic as your screen turns into a delirium of colors.
+ The coloring is provided to help you diagnose your app's display behavior.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="6">
+
+ <div class="figure" style="">
+ <img
+ src="{@docRoot}images/tools/performance/debug-gpu-overdraw/gettingstarted_image03.png"
+ alt=""
+ width="300px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Color key for Debug GPU Overdraw output.
+ </p>
+ </div>
+
+ <br><br>
+ <li>The colors are hinting at the amount of overdraw on your screen for each pixel, as
+ follows:
+
+ <ul>
+ <li><b>True color:</b> No overdraw</li>
+ <li><b>Blue:</b> Overdrawn once</li>
+ <li><b>Green:</b> Overdrawn twice</li>
+ <li><b>Pink:</b> Overdrawn three times</li>
+ <li><b>Red:</b> Overdrawn four or more times</li>
+ </ul>
+ </li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img
+ src="{@docRoot}images/tools/performance/debug-gpu-overdraw/gettingstarted_image04.png"
+ alt=""
+ width="300px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Examples of undesirable and desirable
+ <br>Debug GPU Overdraw output.
+ </p>
+ </div>
+
+ <br><br><br>
+ <li>Some overdraw is unavoidable. As you are tuning your app's
+ user interface, the goal is to arrive at a visualization that shows mostly true
+ colors and 1X overdraw in blue.</li>
+
+ </ol>
+</div></li>
+</ul>
diff --git a/docs/html/tools/performance/heap-viewer/index.jd b/docs/html/tools/performance/heap-viewer/index.jd
new file mode 100644
index 0000000..9ca0c47c
--- /dev/null
+++ b/docs/html/tools/performance/heap-viewer/index.jd
@@ -0,0 +1,177 @@
+page.title=Heap Viewer Walkthrough
+meta.tags="android, performance, profiling, tools, memory, memoryleaks, memoryheap"
+page.tags="android", "performance", "profiling", "tools", "memory", "memoryleaks", "memoryheap"
+page.metaDescription=Report in real-time how many objects of what types and sizes your application is allocating and find memory leaks.
+page.image=tools/performance/thumbnails/tools_heap_viewer.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithHeapViewer">Working with Heap Viewer</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/memory-monitor/index.html">
+ Memory Monitor Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/allocation-tracker/index.html">
+ Allocation Tracker Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/comparison.html">
+ Comparison: Memory Monitor, Heap Viewer, Allocation Tracker</a>
+ <li><a href="{@docRoot}tools/performance/traceview/index.html">
+ Traceview Walkthrough</a></li>
+</ul>
+
+</div>
+
+
+ <p>This walkthrough shows the basic usage and workflow for the Heap Viewer tool. Heap Viewer
+ reports in real-time what <i>types</i> of objects your application has allocated, how many, and
+ their sizes on the heap.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Getting a sense of how your app allocates and frees memory.</li>
+
+ <li>Identifying memory leaks.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device running Android 5.0 or higher with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+
+ <li>Application code. Use your own code, or the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+ <h2 id="WorkingWithHeapViewer">Working with Heap Viewer</h2>
+
+ <ul class="no-bullet">
+ <!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/heap-viewer/gettingstarted_image01.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Starting Android Device Monitor.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source, and run it on your device.</li>
+
+ <li>Start the Android Device Monitor from Android Studio: <b>Tools -> Android -> Android
+ Device</b> <b>Monitor</b>.
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="4">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/heap-viewer/gettingstarted_image02.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Steps for Using Heap Viewer.
+ </p>
+ </div>
+
+ <li>Make sure your device and application are showing in the <b>Devices</b> tab.</li>
+
+ <li>Click the <b>DDMS</b> button, because the Heap Viewer is one of the DDMS tools.</li>
+
+ <li>Click the <b>Heap</b> tab, which is where your data will appear.</li>
+
+ <li>In the <b>Devices</b> tab, select the app you want to monitor.</li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="8">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/heap-viewer/gettingstarted_image03.png"
+ alt=""
+ width="300px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Update Heap button.
+ </p>
+ </div>
+
+ <li>To start monitoring, click the Update Heap button, which looks like a green can.</li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="9">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/heap-viewer/gettingstarted_image04.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Triggering GC (Garbage Collection).
+ </p>
+ </div>
+
+ <li>Note the <em>Heap updates will happen
+ after every GC for this client.</em> message.</li>
+
+ <li>Press the <strong>Cause CG</strong> button to
+ trigger a garbage collection event.
+ </li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="11">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/heap-viewer/gettingstarted_image05.png"
+ alt=""
+ width="480px" />
+ <p class="img-caption">
+ <strong>Figure 5. </strong>Example Heap Viewer output.
+ </p>
+ </div>
+
+ <li>Click a data type to see detailed information on its current allocations on the
+ heap.</li>
+
+ </ol>
+</div></li>
+
+ <p class="note"><b>Note:</b> To visualize allocation changes over time, combine
+ several snapshots of the bar graph into an animated gif or video.</p>
+ </ul>
diff --git a/docs/html/tools/performance/hierarchy-viewer/index.jd b/docs/html/tools/performance/hierarchy-viewer/index.jd
new file mode 100644
index 0000000..ebf23e5
--- /dev/null
+++ b/docs/html/tools/performance/hierarchy-viewer/index.jd
@@ -0,0 +1,330 @@
+page.title=Hierarchy Viewer Walkthrough
+meta.tags="android, performance, profiling, tools, rendering, hierarchyviewer"
+page.tags="android", "performance", "profiling", "tools", "rendering", "hierarchyviewer"
+page.metaDescription=Visualize your app's view hierarchy to help you simplify your layouts.
+page.image=tools/performance/thumbnails/tools_hierarchy_viewer.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithHierarchyViewer">Working with Hierarchy Viewer</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/setup.html">
+ Device Setup for Hierarchy Viewer</a></li>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/profiling.html">
+ Profiling with Hierarchy Viewer</a></li>
+ <li><a href=
+ "http://developer.android.com/tools/debugging/debugging-ui.html#viewhierarchy">Hierarchy Viewer
+ </a></li>
+ <li><a href="/guide/topics/ui/overview.html#Layout">View Hierarchies</a></li>
+ <li><a href="{@docRoot}tools/performance/importing-legacy-apps.html">
+ Importing Legacy Apps into Android Studio<a></li>
+ <li><a href="{@docRoot}tools/device.html">Using Hardware Devices</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows the basic usage and workflow for the Hierarchy Viewer tool.</p>
+
+ <p>The Hierarchy Viewer tool visualizes your app's <a href=
+ "http://developer.android.com/guide/topics/ui/overview.html#Layout">view hierarchy</a> and
+ profiles the relative rendering speed for each view.
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Simplifying your view hierarchy to reduce overdraw, and make it easier to manage.</li>
+
+ <li>Finding potential rendering performance bottlenecks related to the structure and shape of your
+ view hierarchy.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device set up to work with Hierarchy Viewer:</li>
+
+ <li style="list-style: none; display: inline">
+ <ol>
+ <li>You must have <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer
+ Options</a> enabled on your mobile device. You must use a physical device to get
+ accurate measurements.</li>
+
+ <li>Set an {@code ANDROID_HVPROTO} environment variable on the desktop machine
+ that is connected to your device. For more information, see
+ <a href="{@docRoot}tools/performance/hierarchy-viewer/setup.html">Device Setup for Hierarchy Viewer</a>.</li>
+ </ol>
+ </li>
+
+ <li>Debuggable app code with a view hierarchy. Use your own code, or the code for the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+ <h2 id="WorkingWithHierarchyViewer">Working with Hierarchy Viewer</h2>
+
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image001.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Starting Android Device Monitor.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source, and run it on your device.</li>
+
+ <li>From Android Studio, start the Android Device Monitor: <b>Tools > Android >
+ Android Device Monitor</b>.</li>
+
+ <li>Allow <b>USB Debugging</b> on your phone (if asked).</li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="6">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image005.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Android Device Monitor.
+ </p>
+ </div>
+
+ <li>Figure 2 illustrates what is initially shown in the Device Monitor tool. This varies
+ depending on your setup.
+ <p>Make sure your device
+ and the package for your application are showing in the Devices (DDMS mode) or Windows
+ (Hierarchy Viewer mode) tab. You can choose <b>Window > Reset Perspective</b> to get
+ back to the default arrangement.</p>
+ <p>If the app does not appear, make sure you
+ followed the <a href="{@docRoot}tools/performance/hierarchy-viewer/setup.html"> device
+ setup instructions</a>, then start over at step 1.</p></li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image002.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Changing Perspective to Hierarchy Viewer.
+ </p>
+ </div>
+
+ <li>In Android Device Monitor (ADM), in the menu bar, choose <b>Window > Open
+ Perspective</b>, and in the popup click <b>Hierarchy View</b>.<br>
+
+ <p>OR</p>
+ <p> Click the <b>Hierarchy View</b> button if it's already visible.<br>
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image003.png">
+ </p></li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="9">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image006.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Hierarchy Viewer layout.
+ </p>
+ </div>
+
+ <li>If not already open, the Hierarchy View panes open.<br>
+ The example screen in Figure 4 shows an example of these panes.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="10">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image004.png"
+ alt=""
+ width="240px" />
+ <p class="img-caption">
+ <strong>Figure 5. </strong>Resetting the Perspective.
+ </p>
+ </div>
+
+ <li>If you see a different window arrangement, in Android Device Manager, use
+ <b>Window > Reset Perspective</b> to return to the default layout for this tutorial.
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="11">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image007.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 6. </strong>Populated Hierarchy Viewer.
+ </p>
+ </div>
+
+ <li>Double-click your application in the Windows tab. This populates the panes with the
+ view hierarchy of your application.
+ This display is a static representation of the complete view hierarchy defined for the
+ app.</li>
+
+ <li>You can adjust the sizes of the panes and ADM will preserve your
+ arrangement in future sessions.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="13">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image008.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 7. </strong>Hierarchy Viewer panes.
+ </p>
+ </div>
+
+ <li>If necessary, click the <b>Layout View</b> tab to hide the Console and show a wireframe of
+ your layout. The outline of the currently selected view is red. Click an outline to select
+ it.</li>
+
+ <li>The rest of the panes:
+
+ <ul>
+ <li>The <b>Tree Overview</b> in the upper right gives you a bird's-eye view of your
+ app's complete <a href=
+ "http://developer.android.com/guide/topics/ui/overview.html#Layout">View</a> <a href=
+ "http://developer.android.com/guide/topics/ui/overview.html#Layout">Hierarchy</a>.</li>
+
+ <li>In the <b>Tree Overview</b>, move the gray viewport rectangle to change what section of
+ your hierarchy shows in the <b>Tree View</b> pane (in the center).</li>
+
+ <li>In the <b>Tree View</b>, you can drag and zoom the tree using your mouse.</li>
+ </ul>
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="15">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image009.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 7. </strong>Parts of the View node display.
+ </p>
+ </div>
+
+ <li>Click on a View node to display details. Here is an annotated close-up of a node
+ and its details.</li>
+
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="16">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image010.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 8. </strong>Location of View Properties tab.
+ </p>
+ </div>
+
+ <li>Click the <b>View Properties</b> tab at the top right (next to the Windows tab) to see
+ properties of the selected View node.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="17">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image011.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 9. </strong>Rendering a view in a popup.
+ </p>
+ </div>
+
+ <li>Double-click a View node in the Tree View to render it in a popup window.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="18">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image012.png"
+ alt=""
+ width="240px" />
+ <p class="img-caption">
+ <strong>Figure 10. </strong>Node with its type and id.
+ </p>
+ </div>
+
+ <li>Nodes in the Tree View show a Type, which indicates the View class,
+ and an id, which is the view identifier in your code.</li>
+
+ </ol>
+</div></li>
+</ul>
diff --git a/docs/html/tools/performance/hierarchy-viewer/profiling.jd b/docs/html/tools/performance/hierarchy-viewer/profiling.jd
new file mode 100644
index 0000000..b505228
--- /dev/null
+++ b/docs/html/tools/performance/hierarchy-viewer/profiling.jd
@@ -0,0 +1,169 @@
+page.title=Profiling with Hierarchy Viewer
+meta.tags="android, performance, profiling, tools, rendering, hierarchyviewer
+page.tags="android", "performance", "profiling", "tools", "rendering", "hierarchyviewer"
+page.metaDescription=Profile the relative rendering speed for each view.
+page.image=tools/performance/thumbnails/tools_hierarchy_viewer_profiling.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#ProfilingWithHierarchyViewer">Profiling with Hierarchy Viewer</a></li>
+ <li><a href="#InterpretingResults">Interpreting Profiling Results</a></li>
+
+</ul>
+</div>
+
+<p>This walkthrough shows you how to profile your app's view hiearchy with
+ Hierarchy Viewer, and how to interpret the results.</p>
+
+<h2 id="WhatYouNeed">Prerequisites</h2>
+
+<ul>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/setup.html">
+ Device Setup for Hierarchy Viewer</a></li>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/index.html">
+ Hierarchy Viewer Walkthrough</a></li>
+</ul>
+
+<h2 id="ProfilingWithHierarchyViewer">Profiling Steps</h2>
+
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+
+ <ol class="padded">
+
+ <div class="figure" style="">
+<img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image014.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>View hierarchy after profiling.
+ </p>
+ </div>
+
+ <li>Start Hierarchy Viewer for your app.</li>
+
+ <li>In the <b>Tree View</b> or the <b>Layout View</b>, click on the View node whose
+ children you want to profile.</li>
+
+ <li>To start profiling, click the small button with three circles
+<img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image013.png">
+ at the top of the Tree View.
+
+ </li>
+
+ <li>For large view hierarchies, profiling may take a few seconds.</li>
+
+ <li>Each view in your subtree gets three dots, which can be green, yellow, or red.
+
+ <ul>
+ <li>The left dot represents the Draw Process of the rendering pipeline.</li>
+ <li>The middle dot represents the Layout Phase.</li>
+ <li>The right dot represents the Execute Phase.</li>
+ </ul>
+ </li>
+
+</ol></div>
+
+</li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="5">
+
+ <div class="figure" style="">
+<img src="{@docRoot}images/tools/performance/hierarchy-viewer/gettingstarted_image015.png"
+ alt=""
+ width="240px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>How the colored dots relate<br>to the rendering pipeline.
+ </p>
+ </div>
+
+ <li>These dots roughly correspond to the Measure,
+ Layout, and Draw
+ phases of the processing pipeline.</li>
+
+ <li>The color of the dots indicates the relative performance
+ of this node in respect to all other profiled nodes.
+
+ <ul>
+ <li><strong>Green</strong> means the view renders faster than at least
+ half of the other views.</li>
+
+ <li><strong>Yellow</strong> means the view renders faster than the bottom
+ half of the other views.</li>
+
+ <li><strong>Red</strong> means the view is among the slowest
+ half of views.</li>
+ </ul>
+ </li>
+
+ </ol>
+</div></li>
+</ul>
+
+ <h2 id="InterpretingResults">Interpreting Hierarchy Viewer Profiling Results</h2>
+
+ <p>Hierarchy Viewer measures the <em>relative performance</em> of a
+ node</b>, so there are always red nodes in a profile, and it
+ doesn't necessarily mean that view is too slow for the users of
+ your app.</p>
+
+ <p>Hierarchy Viewer software rasterizes your Activity to acquire the timing
+ information. Rasterization is the process of taking a high-level primitive, such as a
+ circle or a vector font, and turning it into pixels on the screen. Typically,
+ rasterization is done by the GPU on your device, but in the case of
+ software rasterization, rendering is done on the CPU with
+ ordinary software. This means that the absolute
+ reported timings are correct relative to each other, but are bloated and vary
+ depending on the overall and changing CPU workload on your device and PC. Profile
+ several times to get a feel for the average measurements.</p>
+
+ <p>The following are guidelines for interpreting Hierarchy Viewer profiling output.</p>
+
+ <p>A red node is a potential problem in any situation where your app has
+ unexpectedly slow performance. In a relative setting, there is always a
+ slowest node; make sure it is the node you expect.
+ The following examples illustrate how to interpret red dots.</p>
+
+ <ul>
+ <li>Look for red dots in leaf nodes or view groups with only a few children. This
+ might point to a problem. Your app may not be slow, or it may not be slow on your
+ device, but you need to be aware of why that dot is red.
+ <a href="{@docRoot}tools/performance/systrace/index.html"> Systrace</a> or
+ <a href="{@docRoot}tools/performance/traceview/index.html"> Traceview</a>
+ can give you additional information. </li>
+
+ <li>If you have a view group with many children and a red measure phase, take a
+ look at the children to see how they are performing.</li>
+
+ <li>A view with yellow or even red dots might not be performing slowly on the
+ device. That's where the actual numbers are helpful.
+ <a href="{@docRoot}tools/performance/systrace/index.html"> Systrace</a> or
+ <a href="{@docRoot}tools/performance/traceview/index.html"> Traceview</a>
+ can give you additional information.</li>
+
+ <li>If the root view of a hierarchy has a red measure phase, red layout phase, and
+ yellow draw phase, this is somewhat typical, because it's the
+ parent of all the other views.</li>
+
+ <li>If a leaf node in a tree with 20+ views has a red draw phase, this <i>is</i> a
+ problem. Check your OnDraw method for code that shouldn't be
+ there.</li>
+ </ul>
diff --git a/docs/html/tools/performance/hierarchy-viewer/setup.jd b/docs/html/tools/performance/hierarchy-viewer/setup.jd
new file mode 100644
index 0000000..aaac1ca
--- /dev/null
+++ b/docs/html/tools/performance/hierarchy-viewer/setup.jd
@@ -0,0 +1,89 @@
+page.title=Device Setup for Hierarchy Viewer
+meta.tags="android, performance, profiling, tools, rendering, hierarchyviewer"
+page.tags="android", "performance", "profiling", "tools", "rendering", "hierarchyviewer"
+page.metaDescription=Set up your mobile device to work with Hierarchy Viewer.
+page.image=tools/performance/thumbnails/tools_hierarchy_viewer.png
+page.article=true
+
+@jd:body
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/index.html">
+ Hierarchy Viewer Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/profiling.html">
+ Profiling with Hierarchy Viewer</a></li>
+</ul>
+
+</div>
+
+ <p>To run Hierarchy Viewer, you must enable Developer Options on your mobile device and perform
+ some setup on your computer.</p>
+
+ <h2>Configuring Devices</h2>
+
+ <ol>
+ <li><p>Enable <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ on your mobile device.</p></li>
+
+ <li>Depending on the type of device you have, do one of the following:
+ <ul>
+ <li>If you have a locked device running Android 4.0 or lower, follow the instructions
+ for <a href=
+ "https://github.com/romainguy/ViewServer">installing and configuring ViewServer</a>.
+ </li>
+ <li>If you have an unlocked device running Android 4.0 or lower,
+ no further configuration is needed.</li>
+ <li>If you have a device running Android 4.1 or higher, you must set an environment
+ variable on your development machine. For more information,
+ see <a href="#hvproto-variable">Setting the ANDROID_HVPROTO variable</a>
+ </ul>
+ </li>
+ </ol>
+
+
+ <h2 id="hvproto-variable">Setting the ANDROID_HVPROTO variable</h2>
+
+ <h3>Windows</h3>
+
+ <ol>
+ <li>Click <b>My Computer > Property > Advanced > Environment Variables.</b></li>
+
+ <li>Click <b>New.</b></li>
+
+ <li>In variables name put: <code>ANDROID_HVPROTO</code></li>
+
+ <li>In variable value put: <code>ddm</code></li>
+
+ <li>Click <b>OK</b><./li>
+ </ol>
+
+ <h3>Mac</h3>
+
+ <ol>
+ <li>Edit <code>~/.bash_profile</code></li>
+
+ <li>Add:
+ <br><code>#Hierarchy Viewer Variable
+ <br>export ANDROID_HVPROTO=ddm</code>
+ </li>
+
+ <li><code>source ~/.bash_profile</code></li>
+ </ol>
+
+ <h3>Linux</h3>
+
+ <ol>
+ <li>Edit <code>~/.bash_profile</code></li>
+
+ <li>Add:
+
+ <br><code>#Hierarchy Viewer Variable
+ <br>export ANDROID_HVPROTO=ddm</code>
+ </li>
+
+ <li><code>source ~/.bash_profile</code></li>
+ </ol>
diff --git a/docs/html/tools/performance/importing-legacy-apps.jd b/docs/html/tools/performance/importing-legacy-apps.jd
new file mode 100644
index 0000000..cee3519
--- /dev/null
+++ b/docs/html/tools/performance/importing-legacy-apps.jd
@@ -0,0 +1,149 @@
+page.title=Importing Legacy Apps into Android Studio
+meta.tags="android, performance, profiling, tools"
+page.tags="android", "performance", "profiling", "tools"
+page.metaDescription=Required changes when importing legacy apps into Android Studio.
+page.article=true
+
+@jd:body
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#StepsForImporting">Steps for Importing</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="/tools/device.html">Using Hardware Devices</a></li>
+ <li><a href="/tools/help/index.html">Tools</a></li>
+</ul>
+
+</div>
+
+
+ <p>Importing some pre-Android-1.0 projects into Android 1.0 or newer can trigger a series of
+ errors. This document shows you how to resolve them, using a version of the Sunshine app used in
+ the <a href="https://www.udacity.com/course/ud853">Android Fundamentals Udacity Course</a> as an
+ example.</p>
+
+ <p><b>CAVEAT:</b> As with all documentation of this kind, the details are likely to vary for each
+ application and each update of Android Studio.</p>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>The latest version of <a href="http://developer.android.com/sdk/index.html">Android
+ Studio</a> (this document uses version 1.1).</li>
+
+ <li>It helps to know how to <a href="https://developer.android.com/training/index.html">build
+ and run apps from Android Studio</a> on your device.</li>
+
+ <li>To use Sunshine, you need to download code from <a href=
+ "https://github.com/">github.com</a>. More info at <a href=
+ "https://help.github.com/">help.github.com</a>.</li>
+ </ul>
+
+ <h2 id="StepsForImporting">Steps for Importing Sunshine into Android Studio 1.1.0</h2>
+
+ <ol>
+ <li>Download Sunshine ZIP from GitHub: <a href=
+ "https://github.com/udacity/sunshine/tree/6.10-update-map-intent">https://github.com/udacity/sunshine/tree/6.10-update-map-intent</a>.
+ (If you are having any problems with Android Studio or the app, use the following version, or
+ your own app, to follow along with the example.<a href=
+ "https://github.com/udacity/sunshine/tree/3.13-add-share-action-provider">https://github.com/udacity/sunshine/tree/3.13-add-share-action-provider</a>)
+
+ <li>Unzip the application to extract the code folder.</li>
+
+ <li>Start Android Studio. (This works best if you close all projects, then restart.)</li>
+
+ <li>Click <b>Import</b> <b>project (Eclipse ADT, Gradle, etc.)</b>.
+ <br><img src="{@docRoot}images/tools/performance/import_image001.png">
+ </li>
+
+ <li>In the popup, find and select the Sunshine-6-10-updated-map-intent folder and click
+ <b>OK</b>.
+ <br><img src="{@docRoot}images/tools/performance/import_image002.png">
+ </li>
+
+ <li>If prompted, choose a destination folder for your project. If prompted to choose a build
+ system, choose Gradle. (These prompts vary, depending on your project and Android Studio
+ version.) If you need more guidance, see this <a href=
+ "http://www.lynda.com/articles/eclipse-into-android-studio">Lynda tutorial</a>.</li>
+
+ <li>Wait for the import to complete. If you see no errors, you are now ready to work with your
+ app.
+
+ <p><b>If you get a Gradle error:</b></p>
+
+ <li>If you get a Gradle error, you have some extra work to do.(Because the Import
+ didn(t finish, at this point, you may only see the <b>Gradle
+ Scripts</b> directory in your Project view.)</li>
+
+ <li>You may see the link <b>Install missing platform(s) and sync
+ project</b>, or a link to install missing build tools.
+ Click whatever link and
+ proceed.</li>
+
+ <li>The next time through, your build will fail with:
+ <br><img src="{@docRoot}images/tools/performance/import_image003.png">
+ </li>
+
+ <li>Click the <b>Fix plugin version and re-import project</b> link
+ in the error message. This will rebuild the app and present you with new of errors.
+ <br><img src="{@docRoot}images/tools/performance/import_image004.png">
+ </li>
+
+ <li>Click the <b>Gradle Settings</b> link in the error message.</li>
+
+ <li>Check the <b>Use auto-import</b> and click <b>OK</b>.
+ <br><img src="{@docRoot}images/tools/performance/import_image005.png">
+ </li>
+
+ <li>Expand the project hierarchy and find the <b>build.gradle file</b>.The file you are looking
+ for is not the one showing at the top level, but the one inside <b>Sunshine</b> <b>></b>
+ <b>app > build.gradle</b>, as shown below.
+ <br><img src="{@docRoot}images/tools/performance/import_image006.png">
+ </li>
+
+ <li>Double-click the <code>build.gradle</code> file.</li>
+
+ <li>Make the following changes to the file:</li>
+ <ul>
+ <li>Set <code>compileSdkVersion 21</code></li>
+
+ <li>Set <code>targetSdkVersion 21</code></li>
+
+ <li>Replace <code>runProguard</code> with <code>minifyEnabled</code></li>
+ </ul>
+
+ <p>Your file should look like this: </p>
+ <img src="{@docRoot}images/tools/performance/import_image007.png">
+ </li>
+
+ <li>Save (Ctrl-S).</li>
+
+ <p>For the following two messages (Steps 18/19), what you see might vary. You might see either
+ message or both messages in sequence. Click the appropriate links to continue until the Language
+ Level Changed dialog opens.</p>
+
+ <li>In the code view bar, click the <b>Try again</b> link.
+ <br><img src="{@docRoot}images/tools/performance/import_image008.png">
+ </li>
+
+ <li>If you see these warnings, click the <b>Sync now</b> link.
+ <br><img src="{@docRoot}images/tools/performance/import_image009.png">
+ </li>
+
+ <li>In the Language Level Changed dialog, click <b>Yes</b>. And if you get the Gradle Running
+ dialog, <b>Yes</b> again.
+ <br><img src="{@docRoot}images/tools/performance/import_image010.png">
+ </li>
+
+ <li>After the project reloads, run the app on your device. (If it crashes the first time, try
+ again, and it will run.)
+ <br><img src="{@docRoot}images/tools/performance/import_image011.png">
+ </li>
+ </ol>
+
diff --git a/docs/html/tools/performance/index.jd b/docs/html/tools/performance/index.jd
new file mode 100644
index 0000000..fa5af86
--- /dev/null
+++ b/docs/html/tools/performance/index.jd
@@ -0,0 +1,73 @@
+page.title=Performance Profiling Tools
+meta.tags="android, develop, performance, profiling, tools, gather"
+page.tags="android", "develop", "performance", "profiling", "tools" "gather"
+page.metaDescription=Android Studio profiling tools for evaluating your app's performance.
+page.article=true
+
+@jd:body
+
+ <p>Putting pixels on the screen involves four primary pieces of hardware.
+ To greatly simplify, the CPU computes display lists, the GPU renders images to
+ the display, the memory stores images and data, and the battery provides
+ electrical power. Each of these pieces of hardware has constraints; pushing
+ or exceeding those constraints causes your app to be slow, have
+ bad display performance, or exhaust the battery.
+
+ <p>To discover what causes your specific performance problems, you need to
+ take a look under the hood, use tools to collect data about your app's
+ execution behavior, surface that data as lists and
+ graphics, understand and analyze what you see, and improve your code.</p>
+
+ <p>Android Studio and your device provide profiling tools to record and
+ visualize the rendering, compute, memory, and battery performance of your
+ app.</p>
+
+<h2 id="rendering-tools">Rendering Analysis Tools</h2>
+
+<p>Visualize the rendering behavior and performance of your app.</p>
+
+<div class="dynamic-grid">
+ <div class="resource-widget resource-flow-layout landing col-12"
+ data-query="collection:tools/performance/rendering"
+ data-cardSizes="9x3"
+ data-maxResults="6">
+ </div>
+</div>
+
+<h2 id="memory-tools">Memory Analysis Tools</h2>
+
+<p>Visualize the memory behavior and performance of your app.</p>
+
+<div class="dynamic-grid">
+ <div class="resource-widget resource-flow-layout landing col-12"
+ data-query="collection:tools/performance/memory"
+ data-cardSizes="9x3"
+ data-maxResults="6">
+ </div>
+</div>
+
+<h2 id="cpu-tools">Compute Analysis Tools</h2>
+
+<p>Visualize the CPU behavior and performance of your app.</p>
+
+<div class="dynamic-grid">
+ <div class="resource-widget resource-flow-layout landing col-12"
+ data-query="collection:tools/performance/cpu"
+ data-cardSizes="9x3"
+ data-maxResults="4">
+ </div>
+</div>
+
+<h2 id="battery-tools">Battery Analysis Tools</h2>
+
+<p>Visualize the battery behavior and performance of your app.</p>
+
+<div class="dynamic-grid">
+ <div class="resource-widget resource-flow-layout landing col-12"
+ data-query="collection:tools/performance/battery"
+ data-cardSizes="9x3"
+ data-maxResults="4">
+ </div>
+</div>
+
+
diff --git a/docs/html/tools/performance/memory-monitor/index.jd b/docs/html/tools/performance/memory-monitor/index.jd
new file mode 100644
index 0000000..756ca14
--- /dev/null
+++ b/docs/html/tools/performance/memory-monitor/index.jd
@@ -0,0 +1,172 @@
+page.title=Memory Monitor Walkthrough
+meta.tags="android, performance, profiling, tools, memory, memoryleaks, garbagecollection, memorymonitor"
+page.tags="android", "performance", "profiling", "tools", "memory", "memoryleaks", "garbagecollection", "memorymonitor"
+page.metaDescription=Graph memory usage and garbage collection events for your app in real-time.
+page.image=tools/performance/thumbnails/tools_memory_monitor.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithMemoryMonitor">Working with Memory Monitor</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/heap-viewer/index.html">
+ Heap Viewer Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/allocation-tracker/index.html">
+ Allocation Tracker Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/comparison.html">
+ Comparison: Memory Monitor, Heap Viewer, Allocation Tracker</a>
+ <li><a href="{@docRoot}tools/performance/traceview/index.html">
+ Traceview Walkthrough</a></li>
+</ul>
+
+</div>
+
+
+ <p>This walkthrough shows the basic usage and workflow for the Memory Monitor tool in Android
+ Studio. Memory Monitor reports in real-time how your app allocates memory.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Showing available and used memory in a graph, and garbage collection events over time.</li>
+
+ <li>Quickly testing whether app slowness might be related
+ to excessive garbage collection events.</li>
+
+ <li>Quickly testing whether app crashes may be related to running out of
+ memory.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+
+ <li>An Application with USB Debugging enabled. Use your own, or the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+ <h2 id="WorkingWithMemoryMonitor">Working with Memory Monitor</h2>
+
+ <ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/memory-monitor/gettingstarted_image001.png"
+ alt=""
+ width="300px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Starting Memory Monitor.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source,
+ and run it on your device.</li></li>
+
+ <li>In Android Studio, choose <b>Tools > Android > Memory Monitor.</b></li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="4">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/memory-monitor/gettingstarted_image002.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Choosing the device and Activity to monitor.
+ </p>
+ </div>
+
+ <li>This opens the Memory Monitor pane.</li>
+
+ <li>Choose your device from the drop-down menu at the top left of the pane.</li>
+
+ <li>Choose your Activity from the drop-down menu at the top right of the pane.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/memory-monitor/gettingstarted_image003.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Allocated and free memory in Memory Monitor.
+ </p>
+ </div>
+
+ <li>Once Memory Monitor starts tracking your device, a stacked graph appears,
+ tracking memory usage over time.
+
+ <p>Dark blue: Amount of memory that your app
+ is currently using.</p>
+
+ <p>Light blue: Available, unallocated memory.</p>
+ </li>
+
+ <li>Over time, this graph updates, showing changes in memory usage.</li>
+
+ <li>As your app allocates and frees memory, the allocated amount shown in the
+ graph changes.</li>
+
+ <li>When you see the allocated memory drop by a large amount, a garbage
+ collection (GC) event has occurred.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="11">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/memory-monitor/gettingstarted_image005.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Forcing a GC (Garbage Collection) event.
+ </p>
+ </div>
+
+ <li>You can force a garbage collection event by clicking on the garbage truck
+ icon
+<img src="{@docRoot}images/tools/performance/memory-monitor/gettingstarted_image004.png">.
+ </li>
+
+ </ol>
+</div></li>
+</ul>
+
+
diff --git a/docs/html/tools/performance/profile-gpu-rendering/index.jd b/docs/html/tools/performance/profile-gpu-rendering/index.jd
new file mode 100644
index 0000000..74862b5
--- /dev/null
+++ b/docs/html/tools/performance/profile-gpu-rendering/index.jd
@@ -0,0 +1,181 @@
+page.title=Profiling GPU Rendering Walkthrough
+meta.tags="android, performance, profiling, tools, rendering, gpu"
+page.tags="android", "performance", "profiling", "tools", "rendering", "gpu"
+page.metaDescription=Overlay a graph on your device, showing how long it takes to render UI elements relative to the 16-ms-per-frame benchmark.
+page.image=tools/performance/thumbnails/tools_profile_gpu_rendering.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#ProfileGPURendering">Profile GPU Rendering</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/debug-gpu-overdraw/index.html">
+ Debug GPU Overdraw Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/hierarchy-viewer/index.html">
+ Hierarchy Viewer Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows how to use Profile GPU Rendering on your mobile device.</p>
+
+ <p>Profile GPU Rendering gives you a quick visual representation of how much time it takes to
+ render the frames of a UI window relative to the 16-ms-per-frame benchmark.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Quickly seeing how a UI window performs against the 16-ms-per-frame target.</li>
+
+ <li>Identifying whether any part of the rendering pipeline stands out in using processing
+ time.</li>
+
+ <li>Looking for spikes in frame rendering time associated with user or program actions.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device running at least Android 4.1 with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+ </ul>
+
+<h2 id="ProfileGPURendering">Working with Profile GPU Rendering</h2>
+
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img
+src="{@docRoot}images/tools/performance/profile-gpu-rendering/gettingstarted_image001.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Turning on Profile GPU Rendering.
+ </p>
+ </div>
+
+ <li>On your mobile device, go to <b>Settings ></b> <b>Developer Options</b>.</li>
+
+ <li>In the <em>Monitoring</em> section, select <b>Profile GPU Rendering</b>.</li>
+
+ <li>In the Profile GPU Rendering popup, choose <b>On screen as bars</b> to overlay the graphs
+ on the screen of your mobile device.</li>
+
+ <li>Go to the app that you want to profile.</li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+
+ <div class="figure" style="">
+ <img
+src="{@docRoot}images/tools/performance/profile-gpu-rendering/gettingstarted_image002.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Screen when Profile GPU Rendering is on.
+ </p>
+ </div>
+
+ <h3>What you see:</h3>
+
+ <ul>
+ <li>For each visible application, the tool displays a graph.</li>
+
+ <li>The horizontal axis shows time elapsing, and the vertical axis time per frame in
+ milliseconds.</li>
+
+ <li>As you interact with your application, vertical bars show up on your screen, appearing
+ from left to right, graphing frame performance over time.</li>
+
+ <li>Each vertical bar represents one frame of rendering.
+ The taller the bar, the longer it took to render.</li>
+
+ <li>The green line marks the 16 millisecond target. Every time a frame crosses the green line,
+ your app is missing a frame, and your users may see this as stuttering images.
+ </ul>
+
+</div></li>
+
+<li style="list-style-type:none;><!-- fix issue with visible disc -->
+<div style="overflow:hidden">
+<hr>
+
+ <h3>The Profile GPU Rendering Graph</h3>
+
+ <img
+src="{@docRoot}images/tools/performance/profile-gpu-rendering/gettingstarted_image003.png"
+ alt=""
+ height="" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Enlarged Annotated Profile GPU Rendering graph.
+ </p>
+
+ <p>In this enlarged image of the Profile GPU Rending graph you can see the colored sections
+ of the graph, and what phase of the rendering pipeline each color represents.</p>
+
+ <ul>
+ <li>The <b>green line</b> represents 16 milliseconds. To achieve 60 frames per second,
+ the vertical bar for each frame needs
+ to stay below this 16 ms mark. Any time a bar pushes above this line, there may be pauses in
+ the animations.</li>
+
+ <li>Each bar has a blue, purple (only for Android version 4.0 and higher),
+ red, and orange component.</p>
+
+ <li>The <b>blue</b> section of the bar represents the time used to create and update the
+ View's display lists. If this part of the bar is tall, there may be a
+ lot of custom view drawing, or a lot of work in onDraw methods.</li>
+
+ <li>Android 4.0 and higher: The <b>purple</b> section of the bar represents the time spent
+ transferring resources to the render thread.</li>
+
+ <li>The <b>red</b> section of the bar represents the time spent by
+ Android's 2D renderer issuing commands to OpenGL to draw and redraw
+ display lists. The height of this bar is directly proportional to the sum of the time it takes each
+ display list to execute—more display lists equals a taller red bar.</li>
+
+ <li>The <b>orange</b> section of the bar represents the time the CPU is waiting for the GPU to
+ finish its work. If this bar gets tall, it means the app is doing too much work on the GPU.
+ </li>
+ </ul>
+
+ <p class="note"><strong>Note:</strong>
+ While this tool is named Profile GPU Rendering, all monitored processes actually
+ occur in the CPU. Rendering happens by submitting commands to the GPU, and the GPU renders the
+ screen asynchronously. In certain situations, the GPU can have too much work to do,
+ and your CPU will have to wait before it can submit new commands.
+ When this happens, you'll see spikes in the Process (orange bar) and Execute (red bar)
+ stages, and the sommand submission will block until more room is made on the
+ GPU command queue.
+ </p>
+
+ </div></li>
+</ul>
+
+
+
+
diff --git a/docs/html/tools/performance/systrace/index.jd b/docs/html/tools/performance/systrace/index.jd
new file mode 100644
index 0000000..97099a0
--- /dev/null
+++ b/docs/html/tools/performance/systrace/index.jd
@@ -0,0 +1,182 @@
+page.title=Systrace Walkthrough
+meta.tags="android, performance, profiling, tools, compute, systrace"
+page.tags="android", "performance", "profiling", "tools", "compute", "systrace"
+page.metaDescription=Collect system and application process execution data to identify performance bottlenecks.
+page.image=tools/performance/thumbnails/tools_systrace.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithSystrace">Working with Systrace</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/traceview/index.html">
+ Traceview Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/allocation-tracker/index.html">
+ Allocation Tracker Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows the basic usage and workflow for the Systrace tool in the Android
+ Device Monitor.</p>
+
+ <p>Systrace collects system and application process execution data and generates detailed,
+ interactive reports from devices running Android 4.1 and higher.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Evaluating container performance.</li>
+
+ <li>Finding performance bottlenecks in the execution of your code.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>Android SDK Tools 20.</li>
+
+ <li><a href="http://www.python.org/">Python</a> installed and included in your development
+ computer's execution path.</li>
+
+ <li>A mobile device running at least Android 4.1 with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ and USB Debugging enabled in Developer Options.</li>
+
+ <li>Application code. Use your own code, or the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+ <h2 id="WorkingWithSystrace">Working with Systrace</h2>
+
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image001.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Starting Android Device Monitor.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source, and run it on your device.</li>
+
+ <li>From Android Studio, start the Android Device Monitor: <b>Tools -> Android -> Android
+ Device</b> <b>Monitor</b>.
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="4">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image003.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Steps for starting Systrace.
+ </p>
+ </div>
+
+ <li>Make sure your
+ device and the package for your application are showing in the Devices (DDMS mode) or
+ Windows (Hierarchy Viewer mode) tab.
+
+ <p>You can choose <b>Window > Reset Perspective</b> to
+ get back to the default arrangement.</p>
+ </li>
+
+ <li>Click the <b>DDMS</b> button, because Systrace is one of the DDMS tools.</li>
+
+ <li>Click the <b>Systrace</b> button
+ <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image002.png">.</li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image004.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Steps for creating a trace.
+ </p>
+ </div>
+
+ <li>In the <b>Android System Trace</b> popup, choose your settings for the trace.
+
+ <ul>
+ <li><b>Destination File:</b> Where the trace is stored as an HTML file. Default is in
+ your home directory as <code>trace.html</code>.</li>
+
+ <li><b>Trace Duration:</b> Default is 5 seconds,
+ and 30 seconds is a good time to choose.</li>
+
+ <li><b>Trace Buffer size:</b> Default is unlimited.</li>
+
+ <li><b>Enable Application Traces from:</b> Make sure your app is selected.</li>
+
+ <li><b>Select tags to enable:</b> Choose at least one value to trace, for example Graphics
+ and View System.</li>
+ </ul>
+ </li>
+
+ <li>Click <b>OK</b> to start tracing.</li>
+
+ <li>Interact with your app.</li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="10">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/systrace/gettingstarted_image005.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Example systrace output in browser.
+ </p>
+ </div>
+
+ <li>When the trace is done, you are automatically returned to Android Device Monitor.</li>
+
+ <li>Go to your home directory, or the directory you chose as the file destination.</li>
+
+ <li>Open the <code>trace.html</code> file in your browser.</li>
+
+ </ol>
+</div></li>
+</ul>
+
+
diff --git a/docs/html/tools/performance/thumbnails/tools_allocation_tracker.png b/docs/html/tools/performance/thumbnails/tools_allocation_tracker.png
new file mode 100644
index 0000000..cbae4cd
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_allocation_tracker.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_battery_historian.png b/docs/html/tools/performance/thumbnails/tools_battery_historian.png
new file mode 100644
index 0000000..d1d58ac
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_battery_historian.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_debug_gpu_overdraw.png b/docs/html/tools/performance/thumbnails/tools_debug_gpu_overdraw.png
new file mode 100644
index 0000000..ff402d0
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_debug_gpu_overdraw.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_heap_viewer.png b/docs/html/tools/performance/thumbnails/tools_heap_viewer.png
new file mode 100644
index 0000000..d9028d0
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_heap_viewer.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer.png b/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer.png
new file mode 100644
index 0000000..064efea
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer_profiling.png b/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer_profiling.png
new file mode 100644
index 0000000..e9824a4
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_hierarchy_viewer_profiling.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_memory_monitor.png b/docs/html/tools/performance/thumbnails/tools_memory_monitor.png
new file mode 100644
index 0000000..c761141
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_memory_monitor.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_profile_gpu_rendering.png b/docs/html/tools/performance/thumbnails/tools_profile_gpu_rendering.png
new file mode 100644
index 0000000..c86fb14
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_profile_gpu_rendering.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_systrace.png b/docs/html/tools/performance/thumbnails/tools_systrace.png
new file mode 100644
index 0000000..567a8a7
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_systrace.png
Binary files differ
diff --git a/docs/html/tools/performance/thumbnails/tools_traceview.png b/docs/html/tools/performance/thumbnails/tools_traceview.png
new file mode 100644
index 0000000..16e6bdd
--- /dev/null
+++ b/docs/html/tools/performance/thumbnails/tools_traceview.png
Binary files differ
diff --git a/docs/html/tools/performance/traceview/index.jd b/docs/html/tools/performance/traceview/index.jd
new file mode 100644
index 0000000..4a3f190
--- /dev/null
+++ b/docs/html/tools/performance/traceview/index.jd
@@ -0,0 +1,292 @@
+page.title=Traceview Walkthrough
+meta.tags="android, performance, profiling, tools, compute, traceview"
+page.tags="android", "performance", "profiling", "tools", "compute", "traceview"
+page.metaDescription=Log method execution over time and inspect execution data, per-thread timelines, and call stacks to track down performance issues in your source code.
+page.image=tools/performance/thumbnails/tools_traceview.png
+page.article=true
+
+@jd:body
+
+<style>
+ .no-bullet {
+ list-style-type: none;
+ }
+ .padded {
+ padding-left: 10px;
+ }
+</style>
+
+<div id="tb" style="margin-left: 7px; margin-bottom: 5px;">
+
+<h2>In this document</h2>
+<ul>
+ <li><a href="#WhatYouNeed">Prerequisites</a></li>
+ <li><a href="#WorkingWithTraceview">Working with Traceview</a></li>
+</ul>
+
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}tools/performance/heap-viewer/index.html">
+ Heap Viewer Walkthrough</a></li>
+ <li><a href="{@docRoot}tools/performance/systrace/index.html">
+ Systrace Walkthrough</a></li>
+</ul>
+
+</div>
+
+ <p>This walkthrough shows the basic usage and workflow for the Traceview tool. Traceview logs
+ method execution over time and shows execution data, per-thread timelines, and call stacks.</p>
+
+ <p>What it's good for:</p>
+
+ <ul>
+ <li>Tracking down performance problems in your source code.</li>
+ </ul>
+
+ <h2 id="WhatYouNeed">Prerequisites</h2>
+
+ <ul>
+ <li>A mobile device with <a href=
+ "http://developer.android.com/tools/device.html#developer-device-options">Developer Options</a>
+ enabled.</li>
+
+ <li>Application code. Use your own code, or the <a href=
+ "https://github.com/udacity/Sunshine-Version-2">Sunshine</a> sample app from the <a href=
+ "https://www.udacity.com/course/ud853">Android Fundamentals Udacity course</a>.</li>
+ </ul>
+
+<h2 id="WorkingWithTraceview">Working with Traceview</h2>
+
+<ul class="no-bullet">
+<!-- this also hides bullet, by default outside box -->
+ <li><div style="overflow:hidden">
+ <ol class="padded">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image001.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 1. </strong>Steps for starting Android Device Monitor.
+ </p>
+ </div>
+
+ <li>Connect your mobile device to your computer.</li>
+
+ <li>Open your application in Android Studio, build the source, and run it on your device.</li>
+
+ <li>Start the Android Device Monitor from Android Studio: <b>Tools -> Android -> Android
+ Device</b> <b>Monitor</b>.
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="4">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image002.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 2. </strong>Steps for starting Traceview.
+ </p>
+ </div>
+
+ <li>Make sure your device
+ and the package for your application are showing in the <b>Devices</b> (DDMS mode) or
+ <b>Windows</b> (Hierarchy Viewer mode) tab.
+
+ <p>If necessary choose <b>Window > Reset
+ Perspective</b> to get back to the default pane arrangement.</p></li>
+
+ <li>Click the <b>DDMS</b> button, because Traceview is one of the DDMS tools.</li>
+
+ <li>Select the app you want to profile.
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="7">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image004.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 3. </strong>Starting profiling.
+ </p>
+ </div>
+
+ <li>Click the Start method profiling
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image003.png">
+ button.
+ </li>
+
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="8">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image005.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 4. </strong>Choosing profiling options.
+ </p>
+ </div>
+
+ <li>In the <b>Profiling Options</b> popup:
+
+ <ul>
+ <li>Choose <b>Sample based profiling</b></li>
+
+ <li>Keep the default sampling rate of 1000 microseconds.</li>
+
+ <li>Click <b>OK</b>.</li>
+ </ul>
+ </li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="9">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image007.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 5. </strong>Stopping profiling.
+ </p>
+ </div>
+
+
+ <li>Interact with your application. If you are aware of performance issues that
+ your users experience, perform those actions.</li>
+
+ <li>Click the Stop method profiling
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image006.png">
+ button.</li>
+
+ <li>Wait for the trace to load. This may take a few seconds if you recorded for a
+ long time.</li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="12">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image008.png"
+ alt=""
+ width="440px" />
+ <p class="img-caption">
+ <strong>Figure 6. </strong>Traceview output panes.
+ </p>
+ </div>
+
+ <li>Traceview has two panels: <b>Timeline</b> pane and <b>Profile</b> pane, which
+ are described below.</li>
+
+ <li>Use the <b>Find</b> box at the bottom to filter your profile results. For
+ example, if you are interested in finding the running time for a function, you can
+ search for it, and the tool will highlight it in the timeline.
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="14">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image009.png"
+ alt=""
+ width="400px" />
+ <p class="img-caption">
+ <strong>Figure 7. </strong>Annotated timeline panel.
+ </p>
+ </div>
+
+ <li>The <b>Timeline</b> pane visualizes how your code executes over time.
+
+ <ul>
+ <li>Each row shows a thread.</li>
+
+ <li>Each bar on the timeline is a method executing.</li>
+
+ <li>Each color is for a different method; every time a method executes, you see
+ a the same color bar.</li>
+
+ <li>The width of its bar indicates how long the method takes to execute.</li>
+ </ul>
+ </li>
+
+ <li>When you are zoomed out, a bar indicates when a method is executing.</li>
+
+ </ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="16">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image010.png"
+ alt=""
+ width="300px" />
+ <p class="img-caption">
+ <strong>Figure 8. </strong>Segment for method on the timeline.
+ </p>
+ </div>
+
+ <li>Zoom into the graph, and the bar for each method expands into a colored
+ U-shape, where the left side of the U indicates the start, and the right side
+ the end of the method's execution.</li>
+</ol>
+</div></li>
+
+<li><div style="overflow:hidden">
+<hr>
+ <ol class="padded" start="17">
+
+ <div class="figure" style="">
+ <img src="{@docRoot}images/tools/performance/traceview/gettingstarted_image011.png"
+ alt=""
+ width="440px" />
+ <p class="img-caption">
+ <strong>Figure 9. </strong>Traceview Profiling pane with callstack.
+ </p>
+ </div>
+
+ <li>The <b>Profiling</b> pane shows a list of methods.
+
+ <ul>
+ <li>Select a method to see who called it (Parent) and who it's
+ calling (Children).</li>
+
+ <li>The selected method is also highlighted in the <b>Timeline</b> pane.</li>
+
+ <li>The columns show exclusive and inclusive CPU and real times, percentages,
+ ratios, and how often a method was called.</li>
+
+ <li>The <em>exclusive time</em> is the time spent just in the method itself, which can
+ help you find issues within that specific method.</li>
+
+ <li>The <em>inclusive time</em> is for the method and all methods it calls, which
+ can help you find problems with your call tree.</li>
+
+ <li>The <b>Calls+Rec</b> column shows how many times a method was called recursively,
+ which can help you track down performance issues.</li>
+ </ul>
+ </li>
+ </ol>
+</div></li>
+</ul>
diff --git a/docs/html/tools/tools_toc.cs b/docs/html/tools/tools_toc.cs
index 88a2674..f90d30e 100644
--- a/docs/html/tools/tools_toc.cs
+++ b/docs/html/tools/tools_toc.cs
@@ -194,10 +194,70 @@
</ul>
</li><!-- end of build system -->
+<!-- Performance Tools menu-->
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>tools/performance/index.html">Peformance Tools</a>
+ </div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>tools/performance/debug-gpu-overdraw/index.html">
+ Overdraw Debugger</a>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/profile-gpu-rendering/index.html">
+ Rendering Profiler</a>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/index.html">
+ Hierarchy Viewer</a></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/setup.html"><span
+ class="en">Setup</span></a>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/hierarchy-viewer/profiling.html"><span
+ class="en">Profiling</span></a>
+ </li>
+ </ul>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>tools/performance/comparison.html">
+ Memory Profilers</a></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>tools/performance/memory-monitor/index.html"><span
+ class="en">Memory Monitor</span></a>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/heap-viewer/index.html"><span
+ class="en">Heap Viewer</span></a>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/allocation-tracker/index.html"><span
+ class="en">Allocation Tracker</span></a>
+ </li>
+ </ul>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/traceview/index.html">
+ Traceview</a>
+ </li>
+ <li><a href="<?cs var:toroot ?>tools/performance/systrace/index.html">
+ Systrace</a>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>tools/performance/batterystats-battery-historian/index.html">
+ Battery Profilers</a></div>
+ <ul>
+ <li><a href="<?cs var:toroot ?>tools/performance/batterystats-battery-historian/charts.html"><span
+ class="en">Historian Charts</span></a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li><!-- End Performance Tools menu-->
+
<!-- Testing Tools menu-->
<li class="nav-section">
- <div class="nav-section-header"><a href="<?cs var:toroot ?>tools/testing/testing-tools.html""><span class="en">Testing Tools</span></a></div>
+ <div class="nav-section-header"><a href="<?cs var:toroot ?>tools/testing/testing-tools.html"><span class="en">Testing Tools</span></a></div>
<ul>
<li class="nav-section">
<div class="nav-section-header"><a href="<?cs var:toroot ?>tools/testing-support-library/index.html"><span
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index cefff81..535a87e 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -1654,20 +1654,11 @@
</ul>
</li> <!-- end of Background Jobs -->
- <li class="nav-section">
- <div class="nav-section-header">
- <a href="<?cs var:toroot ?>training/best-performance.html">
- <span class="small">Best Practices for</span><br/>
- Performance
- </a>
- </div>
- <ul>
-
<li>
<a href="<?cs var:toroot ?>training/articles/memory.html"
- description=
- "How to keep your app's memory footprint small in order to improve performance
- on a variety of mobile devices."
+ description=
+ "How to keep your app's memory footprint small in order to improve performance
+ on a variety of mobile devices."
>Managing Your App's Memory</a>
</li>
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 54bcd7e..b3fb7ef 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -841,7 +841,7 @@
}
void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) {
- bool snap = !layer->getForceFilter()
+ const bool tryToSnap = !layer->getForceFilter()
&& layer->getWidth() == (uint32_t) rect.getWidth()
&& layer->getHeight() == (uint32_t) rect.getHeight();
Glop glop;
@@ -849,7 +849,7 @@
.setMeshTexturedUvQuad(nullptr, Rect(0, 1, 1, 0)) // TODO: simplify with VBO
.setFillTextureLayer(*layer, getLayerAlpha(layer))
.setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false)
- .setModelViewMapUnitToRectOptionalSnap(snap, rect)
+ .setModelViewMapUnitToRectOptionalSnap(tryToSnap, rect)
.setRoundRectClipState(currentSnapshot()->roundRectClipState)
.build();
renderGlop(glop);
@@ -865,7 +865,7 @@
Blend::ModeOrderSwap modeUsage = swap ?
Blend::ModeOrderSwap::Swap : Blend::ModeOrderSwap::NoSwap;
const Matrix4& transform = swap ? Matrix4::identity() : *currentTransform();
- bool snap = !swap
+ const bool tryToSnap = !swap
&& layer->getWidth() == static_cast<uint32_t>(rect.getWidth())
&& layer->getHeight() == static_cast<uint32_t>(rect.getHeight());
Glop glop;
@@ -873,7 +873,7 @@
.setMeshTexturedUvQuad(nullptr, layer->texCoords)
.setFillLayer(layer->getTexture(), layer->getColorFilter(), getLayerAlpha(layer), layer->getMode(), modeUsage)
.setTransform(currentSnapshot()->getOrthoMatrix(), transform, false)
- .setModelViewMapUnitToRectOptionalSnap(snap, rect)
+ .setModelViewMapUnitToRectOptionalSnap(tryToSnap, rect)
.setRoundRectClipState(currentSnapshot()->roundRectClipState)
.build();
renderGlop(glop);
@@ -1654,14 +1654,17 @@
fmin(1.0f, src.right / texture->width),
fmin(1.0f, src.bottom / texture->height));
- int textureFillFlags = static_cast<int>((bitmap->colorType() == kAlpha_8_SkColorType)
+ const int textureFillFlags = static_cast<int>((bitmap->colorType() == kAlpha_8_SkColorType)
? TextureFillFlags::kIsAlphaMaskTexture : TextureFillFlags::kNone);
+ const bool tryToSnap = MathUtils::areEqual(src.getWidth(), dst.getWidth())
+ && MathUtils::areEqual(src.getHeight(), dst.getHeight());
+
Glop glop;
GlopBuilder(mRenderState, mCaches, &glop)
.setMeshTexturedUvQuad(texture->uvMapper, uv)
.setFillTexturePaint(*texture, textureFillFlags, paint, currentSnapshot()->alpha)
.setTransform(currentSnapshot()->getOrthoMatrix(), *currentTransform(), false)
- .setModelViewMapUnitToRectSnap(dst)
+ .setModelViewMapUnitToRectOptionalSnap(tryToSnap, dst)
.setRoundRectClipState(currentSnapshot()->roundRectClipState)
.build();
renderGlop(glop);
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 354e99d..139462d 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -42,6 +42,10 @@
<!-- Whether to use cheap, less good looking shadows for recents -->
<bool name="config_recents_fake_shadows">false</bool>
+ <!-- Whether to clip notification contents with a rounded rectangle. Might be expensive on
+ certain GPU's and thus can be turned off with only minimal visual impact. -->
+ <bool name="config_notifications_round_rect_clipping">true</bool>
+
<!-- The theme to use for RecentsActivity. -->
<item type="style" name="config_recents_activity_theme">@style/RecentsTheme.Wallpaper</item>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java
new file mode 100644
index 0000000..91e5404
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigMediaNarrowViewWrapper.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 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
+ */
+
+package com.android.systemui.statusbar;
+
+import android.content.Context;
+import android.view.View;
+
+/**
+ * Wraps a big media narrow notification template layout.
+ */
+public class NotificationBigMediaNarrowViewWrapper extends NotificationMediaViewWrapper {
+
+ protected NotificationBigMediaNarrowViewWrapper(Context ctx,
+ View view) {
+ super(ctx, view);
+ }
+
+ @Override
+ public boolean needsRoundRectClipping() {
+ return true;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java
new file mode 100644
index 0000000..ffe0cd1
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBigPictureViewWrapper.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 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
+ */
+
+package com.android.systemui.statusbar;
+
+import android.content.Context;
+import android.view.View;
+
+/**
+ * Wraps a notification view inflated from a big picture style template.
+ */
+public class NotificationBigPictureViewWrapper extends NotificationTemplateViewWrapper {
+
+ protected NotificationBigPictureViewWrapper(Context ctx, View view) {
+ super(ctx, view);
+ }
+
+ @Override
+ public boolean needsRoundRectClipping() {
+ return true;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 110b14c..dec2fc7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar;
import android.content.Context;
+import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
@@ -24,6 +25,7 @@
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewOutlineProvider;
import android.view.ViewTreeObserver;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
@@ -46,21 +48,26 @@
private final Rect mClipBounds = new Rect();
private final int mSmallHeight;
private final int mHeadsUpHeight;
+ private final int mRoundRectRadius;
private final Interpolator mLinearInterpolator = new LinearInterpolator();
+ private final boolean mRoundRectClippingEnabled;
private View mContractedChild;
private View mExpandedChild;
private View mHeadsUpChild;
private NotificationViewWrapper mContractedWrapper;
+ private NotificationViewWrapper mExpandedWrapper;
+ private NotificationViewWrapper mHeadsUpWrapper;
private int mClipTopAmount;
private int mContentHeight;
+ private int mUnrestrictedContentHeight;
private int mVisibleType = VISIBLE_TYPE_CONTRACTED;
private boolean mDark;
private final Paint mFadePaint = new Paint();
private boolean mAnimate;
private boolean mIsHeadsUp;
- private ViewTreeObserver.OnPreDrawListener mEnableAnimationPredrawListener
+ private final ViewTreeObserver.OnPreDrawListener mEnableAnimationPredrawListener
= new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
@@ -70,12 +77,25 @@
}
};
+ private final ViewOutlineProvider mOutlineProvider = new ViewOutlineProvider() {
+ @Override
+ public void getOutline(View view, Outline outline) {
+ outline.setRoundRect(0, 0, view.getWidth(), mUnrestrictedContentHeight,
+ mRoundRectRadius);
+ }
+ };
+
public NotificationContentView(Context context, AttributeSet attrs) {
super(context, attrs);
mFadePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
mSmallHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
mHeadsUpHeight = getResources().getDimensionPixelSize(R.dimen.notification_mid_height);
+ mRoundRectRadius = getResources().getDimensionPixelSize(
+ R.dimen.notification_material_rounded_rect_radius);
+ mRoundRectClippingEnabled = getResources().getBoolean(
+ R.bool.config_notifications_round_rect_clipping);
reset(true);
+ setOutlineProvider(mOutlineProvider);
}
@Override
@@ -127,6 +147,7 @@
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
updateClipping();
+ invalidateOutline();
}
@Override
@@ -177,6 +198,7 @@
mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child);
selectLayout(false /* animate */, true /* force */);
mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
+ updateRoundRectClipping();
}
public void setExpandedChild(View child) {
@@ -186,7 +208,9 @@
}
addView(child);
mExpandedChild = child;
+ mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child);
selectLayout(false /* animate */, true /* force */);
+ updateRoundRectClipping();
}
public void setHeadsUpChild(View child) {
@@ -196,7 +220,9 @@
}
addView(child);
mHeadsUpChild = child;
+ mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child);
selectLayout(false /* animate */, true /* force */);
+ updateRoundRectClipping();
}
@Override
@@ -222,10 +248,11 @@
}
public void setContentHeight(int contentHeight) {
- contentHeight = Math.max(Math.min(contentHeight, getHeight()), getMinHeight());
- mContentHeight = contentHeight;
+ mContentHeight = Math.max(Math.min(contentHeight, getHeight()), getMinHeight());;
+ mUnrestrictedContentHeight = Math.max(contentHeight, getMinHeight());
selectLayout(mAnimate /* animate */, false /* force */);
updateClipping();
+ invalidateOutline();
}
public int getContentHeight() {
@@ -250,6 +277,27 @@
updateClipping();
}
+ private void updateRoundRectClipping() {
+ boolean enabled = needsRoundRectClipping();
+ setClipToOutline(enabled);
+ }
+
+ private boolean needsRoundRectClipping() {
+ if (!mRoundRectClippingEnabled) {
+ return false;
+ }
+ boolean needsForContracted = mContractedChild != null
+ && mContractedChild.getVisibility() == View.VISIBLE
+ && mContractedWrapper.needsRoundRectClipping();
+ boolean needsForExpanded = mExpandedChild != null
+ && mExpandedChild.getVisibility() == View.VISIBLE
+ && mExpandedWrapper.needsRoundRectClipping();
+ boolean needsForHeadsUp = mExpandedChild != null
+ && mExpandedChild.getVisibility() == View.VISIBLE
+ && mExpandedWrapper.needsRoundRectClipping();
+ return needsForContracted || needsForExpanded || needsForHeadsUp;
+ }
+
private void updateClipping() {
mClipBounds.set(0, mClipTopAmount, getWidth(), mContentHeight);
setClipBounds(mClipBounds);
@@ -290,6 +338,7 @@
mHeadsUpChild.setLayerType(LAYER_TYPE_NONE, null);
}
setLayerType(LAYER_TYPE_NONE, null);
+ updateRoundRectClipping();
}
private void runSwitchAnimation(int visibleType) {
@@ -315,6 +364,7 @@
updateViewVisibilities(mVisibleType);
}
});
+ updateRoundRectClipping();
}
/**
@@ -358,6 +408,10 @@
mContractedWrapper.notifyContentUpdated();
mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */);
}
+ if (mExpandedChild != null) {
+ mExpandedWrapper.notifyContentUpdated();
+ }
+ updateRoundRectClipping();
}
public boolean isContentExpandable() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationCustomViewWrapper.java
index 0702d7e..6fd341b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationCustomViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationCustomViewWrapper.java
@@ -41,4 +41,9 @@
mInvertHelper.update(dark);
}
}
+
+ @Override
+ public boolean needsRoundRectClipping() {
+ return true;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
index 44e8b85..b362a29 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewWrapper.java
@@ -25,15 +25,23 @@
*/
public abstract class NotificationViewWrapper {
+ private static final String TAG_BIG_MEDIA_NARROW = "bigMediaNarrow";
+ private static final String TAG_MEDIA = "media";
+ private static final String TAG_BIG_PICTURE = "bigPicture";
+
protected final View mView;
public static NotificationViewWrapper wrap(Context ctx, View v) {
-
- // TODO: Figure out a better way to find out which template the view is.
- if (v.findViewById(com.android.internal.R.id.media_actions) != null) {
- return new NotificationMediaViewWrapper(ctx, v);
- } else if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
- return new NotificationTemplateViewWrapper(ctx, v);
+ if (v.getId() == com.android.internal.R.id.status_bar_latest_event_content) {
+ if (TAG_BIG_MEDIA_NARROW.equals(v.getTag())) {
+ return new NotificationBigMediaNarrowViewWrapper(ctx, v);
+ } else if (TAG_MEDIA.equals(v.getTag())) {
+ return new NotificationMediaViewWrapper(ctx, v);
+ } else if (TAG_BIG_PICTURE.equals(v.getTag())) {
+ return new NotificationBigMediaNarrowViewWrapper(ctx, v);
+ } else {
+ return new NotificationTemplateViewWrapper(ctx, v);
+ }
} else {
return new NotificationCustomViewWrapper(v);
}
@@ -56,4 +64,12 @@
* Notifies this wrapper that the content of the view might have changed.
*/
public void notifyContentUpdated() {}
+
+ /**
+ * @return true if this template might need to be clipped with a round rect to make it look
+ * nice, false otherwise
+ */
+ public boolean needsRoundRectClipping() {
+ return false;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
index 14e491b..991bde5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java
@@ -56,10 +56,13 @@
private boolean mVpnVisible = false;
private boolean mEthernetVisible = false;
private int mEthernetIconId = 0;
+ private int mLastEthernetIconId = -1;
private boolean mWifiVisible = false;
private int mWifiStrengthId = 0;
+ private int mLastWifiStrengthId = -1;
private boolean mIsAirplaneMode = false;
private int mAirplaneIconId = 0;
+ private int mLastAirplaneIconId = -1;
private String mAirplaneContentDescription;
private String mWifiDescription;
private String mEthernetDescription;
@@ -275,10 +278,14 @@
if (mEthernet != null) {
mEthernet.setImageDrawable(null);
+ mEthernetDark.setImageDrawable(null);
+ mLastEthernetIconId = -1;
}
if (mWifi != null) {
mWifi.setImageDrawable(null);
+ mWifiDark.setImageDrawable(null);
+ mLastWifiStrengthId = -1;
}
for (PhoneState state : mPhoneStates) {
@@ -290,8 +297,9 @@
}
}
- if(mAirplane != null) {
+ if (mAirplane != null) {
mAirplane.setImageDrawable(null);
+ mLastAirplaneIconId = -1;
}
apply();
@@ -310,8 +318,11 @@
if (DEBUG) Log.d(TAG, String.format("vpn: %s", mVpnVisible ? "VISIBLE" : "GONE"));
if (mEthernetVisible) {
- mEthernet.setImageResource(mEthernetIconId);
- mEthernetDark.setImageResource(mEthernetIconId);
+ if (mLastEthernetIconId != mEthernetIconId) {
+ mEthernet.setImageResource(mEthernetIconId);
+ mEthernetDark.setImageResource(mEthernetIconId);
+ mLastEthernetIconId = mEthernetIconId;
+ }
mEthernetGroup.setContentDescription(mEthernetDescription);
mEthernetGroup.setVisibility(View.VISIBLE);
} else {
@@ -324,8 +335,11 @@
if (mWifiVisible) {
- mWifi.setImageResource(mWifiStrengthId);
- mWifiDark.setImageResource(mWifiStrengthId);
+ if (mWifiStrengthId != mLastWifiStrengthId) {
+ mWifi.setImageResource(mWifiStrengthId);
+ mWifiDark.setImageResource(mWifiStrengthId);
+ mLastWifiStrengthId = mWifiStrengthId;
+ }
mWifiGroup.setContentDescription(mWifiDescription);
mWifiGroup.setVisibility(View.VISIBLE);
} else {
@@ -349,7 +363,10 @@
}
if (mIsAirplaneMode) {
- mAirplane.setImageResource(mAirplaneIconId);
+ if (mLastAirplaneIconId != mAirplaneIconId) {
+ mAirplane.setImageResource(mAirplaneIconId);
+ mLastAirplaneIconId = mAirplaneIconId;
+ }
mAirplane.setContentDescription(mAirplaneContentDescription);
mAirplane.setVisibility(View.VISIBLE);
} else {
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index ec2bd67..16c959f 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -41,14 +41,21 @@
// Enable all debug log categories.
static final boolean DEBUG_ALL = false;
+ // Enable all debug log categories for activities.
+ static final boolean DEBUG_ALL_ACTIVITIES = DEBUG_ALL || false;
+
// Available log categories in the activity manager package.
+ static final boolean DEBUG_ADD_REMOVE = DEBUG_ALL_ACTIVITIES || false;
+ static final boolean DEBUG_APP = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_BACKUP = DEBUG_ALL || false;
static final boolean DEBUG_BROADCAST = DEBUG_ALL || false;
static final boolean DEBUG_BROADCAST_BACKGROUND = DEBUG_BROADCAST || false;
static final boolean DEBUG_BROADCAST_LIGHT = DEBUG_BROADCAST || false;
static final boolean DEBUG_CLEANUP = DEBUG_ALL || false;
static final boolean DEBUG_CONFIGURATION = DEBUG_ALL || false;
+ static final boolean DEBUG_CONTAINERS = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_FOCUS = false;
+ static final boolean DEBUG_IDLE = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_IMMERSIVE = DEBUG_ALL || false;
static final boolean DEBUG_LOCKSCREEN = DEBUG_ALL || false;
static final boolean DEBUG_LOCKTASK = DEBUG_ALL || false;
@@ -63,10 +70,14 @@
static final boolean DEBUG_PROVIDER = DEBUG_ALL || false;
static final boolean DEBUG_PSS = DEBUG_ALL || false;
static final boolean DEBUG_RECENTS = DEBUG_ALL || false;
+ static final boolean DEBUG_RELEASE = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_RESULTS = DEBUG_ALL || false;
+ static final boolean DEBUG_SAVED_STATE = DEBUG_ALL_ACTIVITIES || false;
+ static final boolean DEBUG_SCREENSHOTS = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_SERVICE = DEBUG_ALL || false;
static final boolean DEBUG_SERVICE_EXECUTING = DEBUG_ALL || false;
static final boolean DEBUG_STACK = DEBUG_ALL || false;
+ static final boolean DEBUG_STATES = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_SWITCH = DEBUG_ALL || false;
static final boolean DEBUG_TASKS = DEBUG_ALL || false;
static final boolean DEBUG_THUMBNAILS = DEBUG_ALL || false;
@@ -75,16 +86,21 @@
static final boolean DEBUG_URI_PERMISSION = DEBUG_ALL || false;
static final boolean DEBUG_USER_LEAVING = DEBUG_ALL || false;
static final boolean DEBUG_VISIBILITY = DEBUG_ALL || false;
+ static final boolean DEBUG_VISIBLE_BEHIND = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
+ static final String POSTFIX_ADD_REMOVE = (APPEND_CATEGORY_NAME) ? "_AddRemove" : "";
+ static final String POSTFIX_APP = (APPEND_CATEGORY_NAME) ? "_App" : "";
static final String POSTFIX_BACKUP = (APPEND_CATEGORY_NAME) ? "_Backup" : "";
static final String POSTFIX_BROADCAST = (APPEND_CATEGORY_NAME) ? "_Broadcast" : "";
static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
static final String POSTFIX_CONFIGURATION = (APPEND_CATEGORY_NAME) ? "_Configuration" : "";
+ static final String POSTFIX_CONTAINERS = (APPEND_CATEGORY_NAME) ? "_Containers" : "";
static final String POSTFIX_FOCUS = (APPEND_CATEGORY_NAME) ? "_Focus" : "";
+ static final String POSTFIX_IDLE = (APPEND_CATEGORY_NAME) ? "_Idle" : "";
static final String POSTFIX_IMMERSIVE = (APPEND_CATEGORY_NAME) ? "_Immersive" : "";
- static final String POSTFIX_LOCKSCREEN = (APPEND_CATEGORY_NAME) ? "_LOCKSCREEN" : "";
- static final String POSTFIX_LOCKTASK = (APPEND_CATEGORY_NAME) ? "_LOCKTASK" : "";
+ static final String POSTFIX_LOCKSCREEN = (APPEND_CATEGORY_NAME) ? "_LockScreen" : "";
+ static final String POSTFIX_LOCKTASK = (APPEND_CATEGORY_NAME) ? "_LockTask" : "";
static final String POSTFIX_LRU = (APPEND_CATEGORY_NAME) ? "_LRU" : "";
static final String POSTFIX_MU = "_MU";
static final String POSTFIX_OOM_ADJ = (APPEND_CATEGORY_NAME) ? "_OomAdj" : "";
@@ -95,12 +111,16 @@
static final String POSTFIX_PROCESSES = (APPEND_CATEGORY_NAME) ? "_Processes" : "";
static final String POSTFIX_PROVIDER = (APPEND_CATEGORY_NAME) ? "_Provider" : "";
static final String POSTFIX_PSS = (APPEND_CATEGORY_NAME) ? "_Pss" : "";
- static final String POSTFIX_RESULTS = (APPEND_CATEGORY_NAME) ? "_Results" : "";
static final String POSTFIX_RECENTS = (APPEND_CATEGORY_NAME) ? "_Recents" : "";
+ static final String POSTFIX_RELEASE = (APPEND_CATEGORY_NAME) ? "_Release" : "";
+ static final String POSTFIX_RESULTS = (APPEND_CATEGORY_NAME) ? "_Results" : "";
+ static final String POSTFIX_SAVED_STATE = (APPEND_CATEGORY_NAME) ? "_SavedState" : "";
+ static final String POSTFIX_SCREENSHOTS = (APPEND_CATEGORY_NAME) ? "_Screenshots" : "";
static final String POSTFIX_SERVICE = (APPEND_CATEGORY_NAME) ? "_Service" : "";
static final String POSTFIX_SERVICE_EXECUTING =
(APPEND_CATEGORY_NAME) ? "_ServiceExecuting" : "";
static final String POSTFIX_STACK = (APPEND_CATEGORY_NAME) ? "_Stack" : "";
+ static final String POSTFIX_STATES = (APPEND_CATEGORY_NAME) ? "_States" : "";
static final String POSTFIX_SWITCH = (APPEND_CATEGORY_NAME) ? "_Switch" : "";
static final String POSTFIX_TASKS = (APPEND_CATEGORY_NAME) ? "_Tasks" : "";
static final String POSTFIX_THUMBNAILS = (APPEND_CATEGORY_NAME) ? "_Thumbnails" : "";
@@ -110,5 +130,6 @@
static final String POSTFIX_URI_PERMISSION = (APPEND_CATEGORY_NAME) ? "_UriPermission" : "";
static final String POSTFIX_USER_LEAVING = (APPEND_CATEGORY_NAME) ? "_UserLeaving" : "";
static final String POSTFIX_VISIBILITY = (APPEND_CATEGORY_NAME) ? "_Visibility" : "";
+ static final String POSTFIX_VISIBLE_BEHIND = (APPEND_CATEGORY_NAME) ? "_VisibleBehind" : "";
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 9a2b9ae..991e600 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -281,6 +281,7 @@
private static final String TAG_UID_OBSERVERS = TAG + POSTFIX_UID_OBSERVERS;
private static final String TAG_URI_PERMISSION = TAG + POSTFIX_URI_PERMISSION;
private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
+ private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND;
/** Control over CPU and battery monitoring */
// write battery stats every 30 minutes.
@@ -10840,7 +10841,7 @@
synchronized (this) {
final ActivityStack stack = ActivityRecord.getStackLocked(token);
final boolean visible = stack == null ? false : stack.hasVisibleBehindActivity();
- if (ActivityStackSupervisor.DEBUG_VISIBLE_BEHIND) Slog.d(TAG,
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
"isBackgroundVisibleBehind: stack=" + stack + " visible=" + visible);
return visible;
}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 54dd491..3765a3c 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -72,11 +72,11 @@
*/
final class ActivityRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityRecord" : TAG_AM;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_THUMBNAILS = TAG + POSTFIX_THUMBNAILS;
private static final boolean SHOW_ACTIVITY_START_TIME = true;
- static final boolean DEBUG_SAVED_STATE = ActivityStackSupervisor.DEBUG_SAVED_STATE;
final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recents";
private static final String ATTR_ID = "id";
@@ -1093,7 +1093,7 @@
static void activityResumedLocked(IBinder token) {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Resumed activity; dropping state of: " + r);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_STATES, "Resumed activity; dropping state of: " + r);
r.icicle = null;
r.haveState = false;
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index a4c557f..30ee214 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -23,13 +23,6 @@
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_APP;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_CONTAINERS;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_RELEASE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_SAVED_STATE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_SCREENSHOTS;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_STATES;
import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
import android.util.ArraySet;
@@ -89,11 +82,18 @@
final class ActivityStack {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStack" : TAG_AM;
+ private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
+ private static final String TAG_APP = TAG + POSTFIX_APP;
private static final String TAG_CLEANUP = TAG + POSTFIX_CLEANUP;
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
+ private static final String TAG_CONTAINERS = TAG + POSTFIX_CONTAINERS;
private static final String TAG_PAUSE = TAG + POSTFIX_PAUSE;
+ private static final String TAG_RELEASE = TAG + POSTFIX_RELEASE;
private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
+ private static final String TAG_SAVED_STATE = TAG + POSTFIX_SAVED_STATE;
+ private static final String TAG_SCREENSHOTS = TAG + POSTFIX_SCREENSHOTS;
private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
private static final String TAG_TRANSITION = TAG + POSTFIX_TRANSITION;
@@ -666,8 +666,8 @@
void minimalResumeActivityLocked(ActivityRecord r) {
r.state = ActivityState.RESUMED;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to RESUMED: " + r
- + " (starting new instance)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to RESUMED: " + r + " (starting new instance)");
r.stopped = false;
mResumedActivity = r;
r.task.touchActiveTime();
@@ -675,7 +675,8 @@
completeResumeLocked(r);
mStackSupervisor.checkReadyForSleepLocked();
setLaunchTime(r);
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Launch completed; removing icicle of " + r.icicle);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE,
+ "Launch completed; removing icicle of " + r.icicle);
}
private void startLaunchTraces() {
@@ -752,7 +753,8 @@
// Stop visible behind activity before going to sleep.
final ActivityRecord r = mActivityContainer.mActivityDisplay.mVisibleBehindActivity;
mStackSupervisor.mStoppingActivities.add(r);
- if (DEBUG_STATES) Slog.v(TAG, "Sleep still waiting to stop visible behind " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Sleep still waiting to stop visible behind " + r);
return true;
}
@@ -776,23 +778,23 @@
}
public final Bitmap screenshotActivities(ActivityRecord who) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "screenshotActivities: " + who);
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "screenshotActivities: " + who);
if (who.noDisplay) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tNo display");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tNo display");
return null;
}
if (isHomeStack()) {
// This is an optimization -- since we never show Home or Recents within Recents itself,
// we can just go ahead and skip taking the screenshot if this is the home stack.
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tHome stack");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tHome stack");
return null;
}
int w = mService.mThumbnailWidth;
int h = mService.mThumbnailHeight;
if (w > 0) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tTaking screenshot");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tTaking screenshot");
return mWindowManager.screenshotApplications(who.appToken, Display.DEFAULT_DISPLAY,
w, h);
}
@@ -840,7 +842,7 @@
mStackSupervisor.pauseChildStacks(prev, userLeaving, uiSleeping, resuming, dontWait);
}
- if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSING: " + prev);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to PAUSING: " + prev);
else if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Start pausing: " + prev);
mResumedActivity = null;
mPausingActivity = prev;
@@ -934,7 +936,7 @@
if (r != null) {
mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
if (mPausingActivity == r) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSED: " + r
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to PAUSED: " + r
+ (timeout ? " (due to timeout)" : " (pause complete)"));
completePauseLocked(true);
} else {
@@ -962,7 +964,7 @@
r.persistentState = persistentState;
mService.notifyTaskPersisterLocked(r.task, false);
}
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Saving icicle of " + r + ": " + icicle);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE, "Saving icicle of " + r + ": " + icicle);
if (icicle != null) {
// If icicle is null, this is happening due to a timeout, so we
// haven't really saved the state.
@@ -972,7 +974,7 @@
r.updateThumbnailLocked(null, description);
}
if (!r.stopped) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPED: " + r + " (stop complete)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to STOPPED: " + r + " (stop complete)");
mHandler.removeMessages(STOP_TIMEOUT_MSG, r);
r.stopped = true;
r.state = ActivityState.STOPPED;
@@ -1594,7 +1596,8 @@
}
// Let's just start up the Launcher...
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: No more activities go home");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: No more activities go home");
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
// Only resume home if on home display
final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ?
@@ -1613,7 +1616,8 @@
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Top activity resumed " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Top activity resumed " + next);
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
return false;
}
@@ -1632,7 +1636,7 @@
} else if (!isOnHomeDisplay()) {
return false;
} else if (!isHomeStack()){
- if (DEBUG_STATES) Slog.d(TAG,
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
"resumeTopActivityLocked: Launching home next");
final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ?
HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo();
@@ -1651,7 +1655,8 @@
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Going to sleep and all paused");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Going to sleep and all paused");
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
return false;
}
@@ -1720,11 +1725,12 @@
boolean dontWaitForPause = (next.info.flags&ActivityInfo.FLAG_RESUME_WHILE_PAUSING) != 0;
boolean pausing = mStackSupervisor.pauseBackStacks(userLeaving, true, dontWaitForPause);
if (mResumedActivity != null) {
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Pausing " + mResumedActivity);
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Pausing " + mResumedActivity);
pausing |= startPausingLocked(userLeaving, false, true, dontWaitForPause);
}
if (pausing) {
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.v(TAG_STATES,
"resumeTopActivityLocked: Skip resume: need to start pausing");
// At this point we want to put the upcoming activity's process
// at the top of the LRU list, since we know we will be needing it
@@ -1742,8 +1748,8 @@
// sure to finish it as we're making a new activity topmost.
if (mService.isSleeping() && mLastNoHistoryActivity != null &&
!mLastNoHistoryActivity.finishing) {
- if (DEBUG_STATES) Slog.d(TAG, "no-history finish of " + mLastNoHistoryActivity +
- " on new resume");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "no-history finish of " + mLastNoHistoryActivity + " on new resume");
requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED,
null, "resume-no-history", false);
mLastNoHistoryActivity = null;
@@ -1864,7 +1870,7 @@
mService.updateCpuStats();
- if (DEBUG_STATES) Slog.v(TAG, "Moving to RESUMED: " + next + " (in existing)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to RESUMED: " + next + " (in existing)");
next.state = ActivityState.RESUMED;
mResumedActivity = next;
next.task.touchActiveTime();
@@ -1893,7 +1899,7 @@
// is still at the top and schedule another run if something
// weird happened.
ActivityRecord nextNext = topRunningActivityLocked(null);
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_STATES,
"Activity config changed during resume: " + next
+ ", new next: " + nextNext);
if (nextNext != next) {
@@ -1938,10 +1944,10 @@
mStackSupervisor.checkReadyForSleepLocked();
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Resumed " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeTopActivityLocked: Resumed " + next);
} catch (Exception e) {
// Whoops, need to restart this activity!
- if (DEBUG_STATES) Slog.v(TAG, "Resume failed; resetting state to "
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Resume failed; resetting state to "
+ lastState + ": " + next);
next.state = lastState;
if (lastStack != null) {
@@ -1995,7 +2001,7 @@
}
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
}
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Restarting " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeTopActivityLocked: Restarting " + next);
mStackSupervisor.startSpecificActivityLocked(next, true, true);
}
@@ -2345,9 +2351,9 @@
noOptions = false;
}
}
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing activity " + p + " from task="
- + task + " adding to task=" + targetTask
- + " Callers=" + Debug.getCallers(4));
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + p + " from task=" + task + " adding to task="
+ + targetTask + " Callers=" + Debug.getCallers(4));
if (DEBUG_TASKS) Slog.v(TAG_TASKS,
"Pushing next activity " + p + " out to target's task " + target.task);
p.setTask(targetTask, null);
@@ -2490,9 +2496,9 @@
p.setTask(task, null);
task.addActivityAtIndex(taskInsertionPoint, p);
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + p
- + " to stack at " + task,
- new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing and adding activity " + p + " to stack at " + task
+ + " callers=" + Debug.getCallers(3));
if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Pulling activity " + p
+ " from " + srcPos + " in to resetting task " + task);
mWindowManager.setAppTask(p.appToken, taskId);
@@ -2657,13 +2663,11 @@
|| (r.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
if (!r.finishing) {
if (!mService.isSleeping()) {
- if (DEBUG_STATES) {
- Slog.d(TAG, "no-history finish of " + r);
- }
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "no-history finish of " + r);
requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null,
"stop-no-history", false);
} else {
- if (DEBUG_STATES) Slog.d(TAG, "Not finishing noHistory " + r
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "Not finishing noHistory " + r
+ " on stop because we're just sleeping");
}
}
@@ -2674,8 +2678,8 @@
r.resumeKeyDispatchingLocked();
try {
r.stopped = false;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPING: " + r
- + " (stop requested)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPING: " + r + " (stop requested)");
r.state = ActivityState.STOPPING;
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
"Stopping visible=" + r.visible + " for " + r);
@@ -2695,7 +2699,7 @@
Slog.w(TAG, "Exception thrown during pause", e);
// Just in case, assume it to be stopped.
r.stopped = true;
- if (DEBUG_STATES) Slog.v(TAG, "Stop failed; moving to STOPPED: " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Stop failed; moving to STOPPED: " + r);
r.state = ActivityState.STOPPED;
if (r.configDestroy) {
destroyActivityLocked(r, true, "stop-except");
@@ -2711,8 +2715,8 @@
final boolean requestFinishActivityLocked(IBinder token, int resultCode,
Intent resultData, String reason, boolean oomAdj) {
ActivityRecord r = isInStackLocked(token);
- if (DEBUG_RESULTS || DEBUG_STATES) Slog.v(
- TAG, "Finishing activity token=" + token + " r="
+ if (DEBUG_RESULTS || DEBUG_STATES) Slog.v(TAG_STATES,
+ "Finishing activity token=" + token + " r="
+ ", result=" + resultCode + ", data=" + resultData
+ ", reason=" + reason);
if (r == null) {
@@ -2933,8 +2937,8 @@
mStackSupervisor.checkReadyForSleepLocked();
}
}
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPING: " + r
- + " (finish requested)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPING: "+ r + " (finish requested)");
r.state = ActivityState.STOPPING;
if (oomAdj) {
mService.updateOomAdjLocked();
@@ -2950,7 +2954,7 @@
mResumedActivity = null;
}
final ActivityState prevState = r.state;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to FINISHING: " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to FINISHING: " + r);
r.state = ActivityState.FINISHING;
if (mode == FINISH_IMMEDIATELY
@@ -2963,7 +2967,7 @@
if (activityRemoved) {
mStackSupervisor.resumeTopActivitiesLocked();
}
- if (DEBUG_CONTAINERS) Slog.d(TAG,
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
"destroyActivityLocked: finishCurrentActivityLocked r=" + r +
" destroy returned removed=" + activityRemoved);
return activityRemoved ? null : r;
@@ -3137,9 +3141,9 @@
r.frozenBeforeDestroy = false;
if (setState) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (cleaning up)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYED: " + r + " (cleaning up)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during cleanUp for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during cleanUp for activity " + r);
r.app = null;
}
@@ -3183,16 +3187,15 @@
mStackSupervisor.removeChildActivityContainers(r);
finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null);
r.makeFinishingLocked();
- if (DEBUG_ADD_REMOVE) {
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
- Slog.i(TAG, "Removing activity " + r + " from stack");
- }
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + r + " from stack callers=" + Debug.getCallers(5));
+
r.takeFromHistory();
removeTimeoutsForActivityLocked(r);
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (removed from history)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to DESTROYED: " + r + " (removed from history)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during remove for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during remove for activity " + r);
r.app = null;
mWindowManager.removeAppToken(r.appToken);
if (VALIDATE_TOKENS) {
@@ -3280,7 +3283,7 @@
final int releaseSomeActivitiesLocked(ProcessRecord app, ArraySet<TaskRecord> tasks,
String reason) {
// Iterate over tasks starting at the back (oldest) first.
- if (DEBUG_RELEASE) Slog.d(TAG, "Trying to release some activities in " + app);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Trying to release some activities in " + app);
int maxTasks = tasks.size() / 4;
if (maxTasks < 1) {
maxTasks = 1;
@@ -3291,13 +3294,13 @@
if (!tasks.contains(task)) {
continue;
}
- if (DEBUG_RELEASE) Slog.d(TAG, "Looking for activities to release in " + task);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Looking for activities to release in " + task);
int curNum = 0;
final ArrayList<ActivityRecord> activities = task.mActivities;
for (int actNdx = 0; actNdx < activities.size(); actNdx++) {
final ActivityRecord activity = activities.get(actNdx);
if (activity.app == app && activity.isDestroyable()) {
- if (DEBUG_RELEASE) Slog.v(TAG, "Destroying " + activity
+ if (DEBUG_RELEASE) Slog.v(TAG_RELEASE, "Destroying " + activity
+ " in state " + activity.state + " resumed=" + mResumedActivity
+ " pausing=" + mPausingActivity + " for reason " + reason);
destroyActivityLocked(activity, true, reason);
@@ -3317,7 +3320,8 @@
}
}
}
- if (DEBUG_RELEASE) Slog.d(TAG, "Done releasing: did " + numReleased + " activities");
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE,
+ "Done releasing: did " + numReleased + " activities");
return numReleased;
}
@@ -3387,15 +3391,16 @@
// it in the destroyed state since we are not removing it from the
// list.
if (r.finishing && !skipDestroy) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYING: " + r
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYING: " + r
+ " (destroy requested)");
r.state = ActivityState.DESTROYING;
Message msg = mHandler.obtainMessage(DESTROY_TIMEOUT_MSG, r);
mHandler.sendMessageDelayed(msg, DESTROY_TIMEOUT);
} else {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (destroy skipped)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to DESTROYED: " + r + " (destroy skipped)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during destroy for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + r);
r.app = null;
}
} else {
@@ -3404,9 +3409,9 @@
removeActivityFromHistoryLocked(r, reason + " hadNoApp");
removedFromHistory = true;
} else {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (no app)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYED: " + r + " (no app)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during destroy for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + r);
r.app = null;
}
}
@@ -3427,7 +3432,7 @@
if (r != null) {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
}
- if (DEBUG_CONTAINERS) Slog.d(TAG, "activityDestroyedLocked: r=" + r);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS, "activityDestroyedLocked: r=" + r);
if (isInStackLocked(r) != null) {
if (r.state == ActivityState.DESTROYING) {
@@ -3449,7 +3454,7 @@
// activity.
return;
}
- if (DEBUG_STATES) Slog.d(TAG, "releaseBackgroundResources activtyDisplay=" +
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "releaseBackgroundResources activtyDisplay=" +
mActivityContainer.mActivityDisplay + " visibleBehind=" + r + " app=" + r.app +
" thread=" + r.app.thread);
if (r != null && r.app != null && r.app.thread != null) {
@@ -3550,15 +3555,12 @@
remove = false;
}
if (remove) {
- if (DEBUG_ADD_REMOVE || DEBUG_CLEANUP) {
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
- Slog.i(TAG, "Removing activity " + r + " from stack at " + i
- + ": haveState=" + r.haveState
- + " stateNotNeeded=" + r.stateNotNeeded
- + " finishing=" + r.finishing
- + " state=" + r.state, here);
- }
+ if (DEBUG_ADD_REMOVE || DEBUG_CLEANUP) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + r + " from stack at " + i
+ + ": haveState=" + r.haveState
+ + " stateNotNeeded=" + r.stateNotNeeded
+ + " finishing=" + r.finishing
+ + " state=" + r.state + " callers=" + Debug.getCallers(5));
if (!r.finishing) {
Slog.w(TAG, "Force removing " + r + ": app died, no saved state");
EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY,
@@ -3572,14 +3574,13 @@
} else {
// We have the current state for this activity, so
// it can be restarted later when needed.
- if (DEBUG_ALL) Slog.v(
- TAG, "Keeping entry, setting app to null");
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during removeHistory for activity "
- + r);
+ if (DEBUG_ALL) Slog.v(TAG, "Keeping entry, setting app to null");
+ if (DEBUG_APP) Slog.v(TAG_APP,
+ "Clearing app during removeHistory for activity " + r);
r.app = null;
r.nowVisible = false;
if (!r.haveState) {
- if (DEBUG_SAVED_STATE) Slog.i(TAG,
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE,
"App died, clearing saved state of " + r);
r.icicle = null;
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 01a3fe3..23e62e2 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -124,37 +124,31 @@
public final class ActivityStackSupervisor implements DisplayListener {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStackSupervisor" : TAG_AM;
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
+ private static final String TAG_CONTAINERS = TAG + POSTFIX_CONTAINERS;
private static final String TAG_FOCUS = TAG + POSTFIX_FOCUS;
+ private static final String TAG_IDLE = TAG + POSTFIX_IDLE;
private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
private static final String TAG_PAUSE = TAG + POSTFIX_PAUSE;
- private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
+ private static final String TAG_RELEASE = TAG + POSTFIX_RELEASE;
+ private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
+ private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND;
private static final String TAG_USER_LEAVING = TAG + POSTFIX_USER_LEAVING;
- static final boolean DEBUG = DEBUG_ALL || false;
- static final boolean DEBUG_ADD_REMOVE = DEBUG || false;
- static final boolean DEBUG_APP = DEBUG || false;
- static final boolean DEBUG_CONTAINERS = DEBUG || false;
- static final boolean DEBUG_IDLE = DEBUG || false;
- static final boolean DEBUG_RELEASE = DEBUG || false;
- static final boolean DEBUG_SAVED_STATE = DEBUG || false;
- static final boolean DEBUG_SCREENSHOTS = DEBUG || false;
- static final boolean DEBUG_STATES = DEBUG || false;
- static final boolean DEBUG_VISIBLE_BEHIND = DEBUG || false;
-
public static final int HOME_STACK_ID = 0;
/** How long we wait until giving up on the last activity telling us it is idle. */
- static final int IDLE_TIMEOUT = 10*1000;
+ static final int IDLE_TIMEOUT = 10 * 1000;
/** How long we can hold the sleep wake lock before giving up. */
- static final int SLEEP_TIMEOUT = 5*1000;
+ static final int SLEEP_TIMEOUT = 5 * 1000;
// How long we can hold the launch wake lock before giving up.
- static final int LAUNCH_TIMEOUT = 10*1000;
+ static final int LAUNCH_TIMEOUT = 10 * 1000;
static final int IDLE_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG;
static final int IDLE_NOW_MSG = FIRST_SUPERVISOR_STACK_MSG + 1;
@@ -631,7 +625,7 @@
}
final ActivityRecord resumedActivity = stack.mResumedActivity;
if (resumedActivity == null || !resumedActivity.idle) {
- if (DEBUG_STATES) Slog.d(TAG, "allResumedActivitiesIdle: stack="
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "allResumedActivitiesIdle: stack="
+ stack.mStackId + " " + resumedActivity + " not idle");
return false;
}
@@ -691,7 +685,7 @@
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
if (!isFrontStack(stack) && stack.mResumedActivity != null) {
- if (DEBUG_STATES) Slog.d(TAG, "pauseBackStacks: stack=" + stack +
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "pauseBackStacks: stack=" + stack +
" mResumedActivity=" + stack.mResumedActivity);
someActivityPaused |= stack.startPausingLocked(userLeaving, false, resuming,
dontWait);
@@ -710,7 +704,8 @@
final ActivityRecord r = stack.mPausingActivity;
if (r != null && r.state != PAUSED && r.state != STOPPED && r.state != STOPPING) {
if (DEBUG_STATES) {
- Slog.d(TAG, "allPausedActivitiesComplete: r=" + r + " state=" + r.state);
+ Slog.d(TAG_STATES,
+ "allPausedActivitiesComplete: r=" + r + " state=" + r.state);
pausing = false;
} else {
return false;
@@ -1308,8 +1303,8 @@
// should look like we asked it to pause+stop (but remain visible),
// and it has done so and reported back the current icicle and
// other state.
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPED: " + r
- + " (starting in stopped state)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPED: " + r + " (starting in stopped state)");
r.state = STOPPED;
r.stopped = true;
}
@@ -2382,8 +2377,8 @@
ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (r != null) {
- if (DEBUG_IDLE) Slog.d(TAG, "activityIdleInternalLocked: Callers=" +
- Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "activityIdleInternalLocked: Callers="
+ + Debug.getCallers(4));
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
r.finishLaunchTickingLocked();
if (fromTimeout) {
@@ -2693,7 +2688,8 @@
ActivityContainer activityContainer =
new VirtualActivityContainer(parentActivity, callback);
mActivityContainers.put(activityContainer.mStackId, activityContainer);
- if (DEBUG_CONTAINERS) Slog.d(TAG, "createActivityContainer: " + activityContainer);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
+ "createActivityContainer: " + activityContainer);
parentActivity.mChildContainers.add(activityContainer);
return activityContainer;
}
@@ -2702,8 +2698,8 @@
final ArrayList<ActivityContainer> childStacks = parentActivity.mChildContainers;
for (int containerNdx = childStacks.size() - 1; containerNdx >= 0; --containerNdx) {
ActivityContainer container = childStacks.remove(containerNdx);
- if (DEBUG_CONTAINERS) Slog.d(TAG, "removeChildActivityContainers: removing " +
- container);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS, "removeChildActivityContainers: removing "
+ + container);
container.release();
}
}
@@ -2711,8 +2707,8 @@
void deleteActivityContainer(IActivityContainer container) {
ActivityContainer activityContainer = (ActivityContainer)container;
if (activityContainer != null) {
- if (DEBUG_CONTAINERS) Slog.d(TAG, "deleteActivityContainer: ",
- new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
+ "deleteActivityContainer: callers=" + Debug.getCallers(4));
final int stackId = activityContainer.mStackId;
mActivityContainers.remove(stackId);
mWindowManager.removeStack(stackId);
@@ -3077,17 +3073,17 @@
boolean requestVisibleBehindLocked(ActivityRecord r, boolean visible) {
final ActivityStack stack = r.task.stack;
if (stack == null) {
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: r=" + r + " visible=" +
- visible + " stack is null");
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: r=" + r + " visible=" + visible + " stack is null");
return false;
}
final boolean isVisible = stack.hasVisibleBehindActivity();
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind r=" + r + " visible=" +
- visible + " isVisible=" + isVisible);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind r=" + r + " visible=" + visible + " isVisible=" + isVisible);
final ActivityRecord top = topRunningActivityLocked();
if (top == null || top == r || (visible == isVisible)) {
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: quick return");
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND, "requestVisibleBehind: quick return");
stack.setVisibleBehindActivity(visible ? r : null);
return true;
}
@@ -3095,16 +3091,18 @@
// A non-top activity is reporting a visibility change.
if (visible && top.fullscreen) {
// Let the caller know that it can't be seen.
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning top.fullscreen="
- + top.fullscreen + " top.state=" + top.state + " top.app=" + top.app +
- " top.app.thread=" + top.app.thread);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: returning top.fullscreen=" + top.fullscreen
+ + " top.state=" + top.state + " top.app=" + top.app + " top.app.thread="
+ + top.app.thread);
return false;
} else if (!visible && stack.getVisibleBehindActivity() != r) {
// Only the activity set as currently visible behind should actively reset its
// visible behind state.
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning visible="
- + visible + " stack.getVisibleBehindActivity()=" +
- stack.getVisibleBehindActivity() + " r=" + r);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: returning visible=" + visible
+ + " stack.getVisibleBehindActivity()=" + stack.getVisibleBehindActivity()
+ + " r=" + r);
return false;
}
@@ -3179,25 +3177,25 @@
TaskRecord firstTask = null;
// Tasks is non-null only if two or more tasks are found.
ArraySet<TaskRecord> tasks = null;
- if (DEBUG_RELEASE) Slog.d(TAG, "Trying to release some activities in " + app);
- for (int i=0; i<app.activities.size(); i++) {
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Trying to release some activities in " + app);
+ for (int i = 0; i < app.activities.size(); i++) {
ActivityRecord r = app.activities.get(i);
// First, if we find an activity that is in the process of being destroyed,
// then we just aren't going to do anything for now; we want things to settle
// down before we try to prune more activities.
if (r.finishing || r.state == DESTROYING || r.state == DESTROYED) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Abort release; already destroying: " + r);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Abort release; already destroying: " + r);
return;
}
// Don't consider any activies that are currently not in a state where they
// can be destroyed.
if (r.visible || !r.stopped || !r.haveState || r.state == RESUMED || r.state == PAUSING
|| r.state == PAUSED || r.state == STOPPING) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Not releasing in-use activity: " + r);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Not releasing in-use activity: " + r);
continue;
}
if (r.task != null) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Collecting release task " + r.task
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Collecting release task " + r.task
+ " from " + r);
if (firstTask == null) {
firstTask = r.task;
@@ -3211,7 +3209,7 @@
}
}
if (tasks == null) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Didn't find two or more tasks to release");
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Didn't find two or more tasks to release");
return;
}
// If we have activities in multiple tasks that are in a position to be destroyed,
@@ -3546,7 +3544,8 @@
}
void scheduleIdleTimeoutLocked(ActivityRecord next) {
- if (DEBUG_IDLE) Slog.d(TAG, "scheduleIdleTimeoutLocked: Callers=" + Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE,
+ "scheduleIdleTimeoutLocked: Callers=" + Debug.getCallers(4));
Message msg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG, next);
mHandler.sendMessageDelayed(msg, IDLE_TIMEOUT);
}
@@ -3556,7 +3555,8 @@
}
void removeTimeoutsForActivityLocked(ActivityRecord r) {
- if (DEBUG_IDLE) Slog.d(TAG, "removeTimeoutsForActivity: Callers=" + Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "removeTimeoutsForActivity: Callers="
+ + Debug.getCallers(4));
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
}
@@ -3858,7 +3858,8 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case IDLE_TIMEOUT_MSG: {
- if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_TIMEOUT_MSG: r=" + msg.obj);
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE,
+ "handleMessage: IDLE_TIMEOUT_MSG: r=" + msg.obj);
if (mService.mDidDexOpt) {
mService.mDidDexOpt = false;
Message nmsg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
@@ -3871,7 +3872,7 @@
activityIdleInternal((ActivityRecord)msg.obj);
} break;
case IDLE_NOW_MSG: {
- if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_NOW_MSG: r=" + msg.obj);
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "handleMessage: IDLE_NOW_MSG: r=" + msg.obj);
activityIdleInternal((ActivityRecord)msg.obj);
} break;
case RESUME_TOP_ACTIVITY_MSG: {
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index d56a024..f966bcf 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -27,7 +27,6 @@
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE;
import android.app.Activity;
import android.app.ActivityManager;
@@ -42,6 +41,7 @@
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
+import android.os.Debug;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -60,6 +60,7 @@
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
+ private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
@@ -561,8 +562,9 @@
* Reorder the history stack so that the passed activity is brought to the front.
*/
final void moveActivityToFrontLocked(ActivityRecord newTop) {
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + newTop
- + " to stack at top", new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing and adding activity " + newTop
+ + " to stack at top callers=" + Debug.getCallers(4));
mActivities.remove(newTop);
mActivities.add(newTop);