Skip to content

Commit

Permalink
Ignoring 3 Android leaks
Browse files Browse the repository at this point in the history
Reported in #1
  • Loading branch information
pyricau committed May 10, 2015
1 parent 55357ab commit bbec432
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static android.os.Build.MANUFACTURER;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1;
import static android.os.Build.VERSION_CODES.JELLY_BEAN;
import static android.os.Build.VERSION_CODES.KITKAT;
import static android.os.Build.VERSION_CODES.LOLLIPOP;
Expand Down Expand Up @@ -156,9 +157,10 @@ public static ExcludedRefs createAppDefaults() {
"mServedInputConnection");
}

if (SDK_INT >= LOLLIPOP && SDK_INT <= LOLLIPOP_MR1) {
if (SDK_INT >= ICE_CREAM_SANDWICH_MR1 && SDK_INT <= LOLLIPOP_MR1) {
// The singleton InputMethodManager is holding a reference to mCurRootView long after the
// activity has been destroyed.
// Observed on ICS MR1: https://github.com/square/leakcanary/issues/1#issuecomment-100579429
// Hack: https://gist.github.com/pyricau/4df64341cc978a7de414
excluded.instanceField("android.view.inputmethod.InputMethodManager", "mCurRootView");
}
Expand Down Expand Up @@ -228,6 +230,22 @@ public static ExcludedRefs createAppDefaults() {
excluded.instanceField("android.os.PersonaManager", "mContext");
}

if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
// In AOSP the Resources class does not have a context.
// Here we have ZygoteInit.mResources (static field) holding on to a Resources instance that
// has a context that is the activity.
// Observed here: https://github.com/square/leakcanary/issues/1#issue-74450184
excluded.instanceField("android.content.res.Resources", "mContext");
}

if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
// In AOSP the ViewConfiguration class does not have a context.
// Here we have ViewConfiguration.sConfigurations (static field) holding on to a
// ViewConfiguration instance that has a context that is the activity.
// Observed here: https://github.com/square/leakcanary/issues/1#issuecomment-100324683
excluded.instanceField("android.view.ViewConfiguration", "mContext");
}

return excluded;
}

Expand Down

0 comments on commit bbec432

Please sign in to comment.