public static ExcludedRefs.Builder createAppDefaults(){
  ExcludedRefs.Builder excluded=createAndroidDefaults();
  if (SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP) {
    excluded.instanceField("android.app.ActivityThread$ActivityClientRecord","nextIdle");
  }
  if (SDK_INT <= KITKAT) {
    excluded.instanceField("android.widget.Editor$EasyEditSpanController","this$0");
    excluded.instanceField("android.widget.Editor$SpanController","this$0");
  }
  if (SDK_INT == LOLLIPOP) {
    excluded.staticField("android.media.session.MediaSessionLegacyHelper","sInstance");
  }
  if (SDK_INT < LOLLIPOP_MR1) {
    excluded.staticField("android.text.TextLine","sCached");
  }
  if (SDK_INT < LOLLIPOP) {
    excluded.instanceField("android.os.Message","obj");
    excluded.instanceField("android.os.Message","next");
    excluded.instanceField("android.os.Message","target");
  }
  if (SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP_MR1) {
    excluded.instanceField("android.view.inputmethod.InputMethodManager","mNextServedView");
    excluded.instanceField("android.view.inputmethod.InputMethodManager","mServedView");
    excluded.instanceField("android.view.inputmethod.InputMethodManager","mServedInputConnection");
  }
  if (SDK_INT >= ICE_CREAM_SANDWICH_MR1 && SDK_INT <= LOLLIPOP_MR1) {
    excluded.instanceField("android.view.inputmethod.InputMethodManager","mCurRootView");
  }
  if (SDK_INT >= ICE_CREAM_SANDWICH && SDK_INT <= LOLLIPOP_MR1) {
    excluded.instanceField("android.animation.LayoutTransition$1","val$parent");
  }
  if (SDK_INT >= JELLY_BEAN || SDK_INT <= LOLLIPOP_MR1) {
    excluded.instanceField("android.view.textservice.SpellCheckerSession$1","this$0");
  }
  if (MOTOROLA.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.instanceField("android.app.admin.DevicePolicyManager$SettingsObserver","this$0");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.staticField("com.samsung.android.smartclip.SpenGestureManager","mContext");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP) {
    excluded.staticField("android.sec.clipboard.ClipboardUIManager","sInstance");
  }
  if (LG.equals(MANUFACTURER) && SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP) {
    excluded.staticField("android.widget.BubblePopupHelper","sHelper");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.staticField("com.android.org.chromium.android_webview.AwResource","sResources");
  }
  if (NVIDIA.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.instanceField("com.nvidia.ControllerMapper.MapperClient$ServiceClient","this$0");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.staticField("android.widget.TextView","mLastHoveredView");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.instanceField("android.os.PersonaManager","mContext");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.instanceField("android.content.res.Resources","mContext");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.instanceField("android.view.ViewConfiguration","mContext");
  }
  if (SAMSUNG.equals(MANUFACTURER) && SDK_INT == KITKAT) {
    excluded.staticField("android.media.AudioManager","mContext_static");
  }
  return excluded;
}

public static ExcludedRefs . Builder createAppDefaults ( ) { ExcludedRefs . Builder excluded = createAndroidDefaults ( ) ; if ( SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP ) { excluded . instanceField ( "android.app.ActivityThread$ActivityClientRecord" , "nextIdle" ) ; } if ( SDK_INT <= KITKAT ) { excluded . instanceField ( "android.widget.Editor$EasyEditSpanController" , "this$0" ) ; excluded . instanceField ( "android.widget.Editor$SpanController" , "this$0" ) ; } if ( SDK_INT == LOLLIPOP ) { excluded . staticField ( "android.media.session.MediaSessionLegacyHelper" , "sInstance" ) ; } if ( SDK_INT < LOLLIPOP_MR1 ) { excluded . staticField ( "android.text.TextLine" , "sCached" ) ; } if ( SDK_INT < LOLLIPOP ) { excluded . instanceField ( "android.os.Message" , "obj" ) ; excluded . instanceField ( "android.os.Message" , "next" ) ; excluded . instanceField ( "android.os.Message" , "target" ) ; } if ( SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP_MR1 ) { excluded . instanceField ( "android.view.inputmethod.InputMethodManager" , "mNextServedView" ) ; excluded . instanceField ( "android.view.inputmethod.InputMethodManager" , "mServedView" ) ; excluded . instanceField ( "android.view.inputmethod.InputMethodManager" , "mServedInputConnection" ) ; } if ( SDK_INT >= ICE_CREAM_SANDWICH_MR1 && SDK_INT <= LOLLIPOP_MR1 ) { excluded . instanceField ( "android.view.inputmethod.InputMethodManager" , "mCurRootView" ) ; } if ( SDK_INT >= ICE_CREAM_SANDWICH && SDK_INT <= LOLLIPOP_MR1 ) { excluded . instanceField ( "android.animation.LayoutTransition$1" , "val$parent" ) ; } if ( SDK_INT >= JELLY_BEAN || SDK_INT <= LOLLIPOP_MR1 ) { excluded . instanceField ( "android.view.textservice.SpellCheckerSession$1" , "this$0" ) ; } if ( MOTOROLA . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . instanceField ( "android.app.admin.DevicePolicyManager$SettingsObserver" , "this$0" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . staticField ( "com.samsung.android.smartclip.SpenGestureManager" , "mContext" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP ) { excluded . staticField ( "android.sec.clipboard.ClipboardUIManager" , "sInstance" ) ; } if ( LG . equals ( MANUFACTURER ) && SDK_INT >= KITKAT && SDK_INT <= LOLLIPOP ) { excluded . staticField ( "android.widget.BubblePopupHelper" , "sHelper" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . staticField ( "com.android.org.chromium.android_webview.AwResource" , "sResources" ) ; } if ( NVIDIA . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . instanceField ( "com.nvidia.ControllerMapper.MapperClient$ServiceClient" , "this$0" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . staticField ( "android.widget.TextView" , "mLastHoveredView" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . instanceField ( "android.os.PersonaManager" , "mContext" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . instanceField ( "android.content.res.Resources" , "mContext" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . instanceField ( "android.view.ViewConfiguration" , "mContext" ) ; } if ( SAMSUNG . equals ( MANUFACTURER ) && SDK_INT == KITKAT ) { excluded . staticField ( "android.media.AudioManager" , "mContext_static" ) ; } return excluded ; }
this returns the references in the leak path that can be ignored for app developers . this doesn ' t mean there is no memory leak , to the contrary . however , some leaks are caused by bugs in aosp or manufacturer forks of aosp . in such cases , there is very little we can do as app developers except by resorting to serious hacks , so we remove the noise caused by those leaks .
