From 6e9e5faa9799a8715d80400928b97b452b269fb0 Mon Sep 17 00:00:00 2001 From: Zhen Zhang Date: Tue, 12 Nov 2019 10:51:00 -0800 Subject: Use static filter for inflater of RemoteViews This will get rid of the RemoteViews leak caused by ViewStub keeping reference of LayoutInflater. But subclasses of RemoteViews won't be affected to avoid breaking overriden usage. Bug: 141699084 Test: Manually test. Leak disappeared. atest RemoteViewsTest Change-Id: I1b287a166df92e424208ae35eb84bfd6aa553ddf --- core/java/android/app/Notification.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/java/android/app/Notification.java') diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 2931f33e4cc4..c1324523b154 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -10402,6 +10402,16 @@ public class Notification implements Parcelable p.recycle(); return brv; } + + /** + * Override and return true, since {@link RemoteViews#onLoadClass(Class)} is not overridden. + * + * @see RemoteViews#shouldUseStaticFilter() + */ + @Override + protected boolean shouldUseStaticFilter() { + return true; + } } /** -- cgit v1.2.3