From de396fa85d4041fdd14bf4e0847406017d1f89db Mon Sep 17 00:00:00 2001 From: Ahan Wu Date: Tue, 8 May 2018 20:42:24 +0800 Subject: Apply cache and preload mechanism to inline image notifications. Inline image will consume 3x memory due to no cache implementation. This patch apply cache mechanism to each ExpandableNotificationRow and preloads images before inflation task. Bug: 77956056 Test: runtest systemui, observe memory usage by AndroidProfiler Change-Id: I2c488b1d98ddf2d4670904ed4b3e8028c0d0172e --- core/java/android/widget/RemoteViews.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/java/android/widget/RemoteViews.java') diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 7b39efed0c3a..3c361c348ca7 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -3373,6 +3373,12 @@ public class RemoteViews implements Parcelable, Filter { * @hide */ public interface OnViewAppliedListener { + /** + * Callback when the RemoteView has finished inflating, + * but no actions have been applied yet. + */ + default void onViewInflated(View v) {}; + void onViewApplied(View v); void onError(Exception e); @@ -3469,6 +3475,10 @@ public class RemoteViews implements Parcelable, Filter { @Override protected void onPostExecute(ViewTree viewTree) { if (mError == null) { + if (mListener != null) { + mListener.onViewInflated(viewTree.mRoot); + } + try { if (mActions != null) { OnClickHandler handler = mHandler == null -- cgit v1.2.3