@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.text.TextLine", "sCached") .reason("TextLine.sCached is a pool of 3 TextLine instances. TextLine.recycle() has had" + " at least two bugs that created memory leaks by not correctly clearing the" + " recycled TextLine instances. The first was fixed in android-5.1.0_r1:" + " https://github.com/android/platform_frameworks_base/commit" + "/893d6fe48d37f71e683f722457bea646994a10" + " The second was fixed, not released yet:" + " https://github.com/android/platform_frameworks_base/commit" + "/b3a9bc038d3a218b1dbdf7b5668e3d6c12be5e" + " To fix this, you could access TextLine.sCached and clear the pool every now" + " and then (e.g. on activity destroy)."); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.media.AudioManager", "mContext_static") .reason("Samsung added a static mContext_static field to AudioManager, holds a reference" + " to the activity." + " Observed here: https://github.com/square/leakcanary/issues/32"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.widget.BubblePopupHelper", "sHelper") .reason("A static helper for EditText bubble popups leaks a reference to the latest" + " focused view."); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.gestureboost.GestureBoostManager", "mContext") .reason("GestureBoostManager is a static singleton that leaks an activity context." + " Fix: https://github.com/square/leakcanary/issues/696#issuecomment-296420756"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.app.ActivityManager", "mContext") .reason("Samsung added a static mContext field to ActivityManager, holds a reference" + " to the activity." + " Observed here: https://github.com/square/leakcanary/issues/177 Fix in comment:" + " https://github.com/square/leakcanary/issues/177#issuecomment-222724283"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.hardware.SystemSensorManager", "mAppContextImpl") .reason("SystemSensorManager stores a reference to context" + " in a static field in its constructor." + " Fix: use application context to get SensorManager"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.widget.TextView", "mLastHoveredView") .reason("mLastHoveredView is a static field in TextView that leaks the last hovered" + " view."); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.app.Instrumentation", "mRecommendActivity") .reason("Instrumentation would leak com.android.internal.app.RecommendActivity (in" + " framework.jar) in Meizu FlymeOS 4.5 and above, which is based on Android 5.0 and " + " above"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("android.media.session.MediaSessionLegacyHelper", "sInstance") .reason("MediaSessionLegacyHelper is a static singleton that is lazily instantiated and" + " keeps a reference to the context it's given the first time" + " MediaSessionLegacyHelper.getHelper() is called." + " This leak was introduced in android-5.0.1_r1 and fixed in Android 5.1.0_r1 by" + " calling context.getApplicationContext()." + " Fix: https://github.com/android/platform_frameworks_base/commit" + "/9b5257c9c99c4cb541d8e8e78fb04f008b1a9091" + " To fix this, you could call MediaSessionLegacyHelper.getHelper() early" + " in Application.onCreate() and pass it the application context."); } },
@Override void add(ExcludedRefs.Builder excluded) { // AwResource#setResources() is called with resources that hold a reference to the // activity context (instead of the application context) and doesn't clear it. // Not sure what's going on there, input welcome. excluded.staticField("com.android.org.chromium.android_webview.AwResource", "sResources"); } },
@Override void add(ExcludedRefs.Builder excluded) { excluded.staticField("com.samsung.android.smartclip.SpenGestureManager", "mContext") .reason("SpenGestureManager has a static mContext field that leaks a reference to the" + " activity. Yes, a STATIC mContext field."); } },