Program: 94322
Project: 94322
Buggy source:
public PinEntryView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  TypedArray array=getContext().obtainStyledAttributes(attrs,R.styleable.PinEntryView);
  mDigits=array.getInt(R.styleable.PinEntryView_numDigits,4);
  mAccentType=array.getInt(R.styleable.PinEntryView_accentType,ACCENT_NONE);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  mDigitWidth=array.getDimensionPixelSize(R.styleable.PinEntryView_digitWidth,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,50,metrics));
  mDigitHeight=array.getDimensionPixelSize(R.styleable.PinEntryView_digitHeight,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,50,metrics));
  mDigitSpacing=array.getDimensionPixelSize(R.styleable.PinEntryView_digitSpacing,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,20,metrics));
  mDigitTextSize=array.getDimensionPixelSize(R.styleable.PinEntryView_digitTextSize,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,15,metrics));
  mAccentWidth=array.getDimensionPixelSize(R.styleable.PinEntryView_accentWidth,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,3,metrics));
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    mDigitElevation=array.getDimensionPixelSize(R.styleable.PinEntryView_digitElevation,0);
  }
  Resources.Theme theme=getContext().getTheme();
  TypedValue background=new TypedValue();
  theme.resolveAttribute(android.R.attr.windowBackground,background,true);
  mDigitBackground=array.getResourceId(R.styleable.PinEntryView_digitBackground,background.resourceId);
  TypedValue textColor=new TypedValue();
  theme.resolveAttribute(android.R.attr.textColorPrimary,textColor,true);
  mDigitTextColor=array.getColor(R.styleable.PinEntryView_digitTextColor,textColor.resourceId > 0 ? getResources().getColor(textColor.resourceId) : textColor.data);
  TypedValue accentColor=new TypedValue();
  theme.resolveAttribute(R.attr.colorAccent,accentColor,true);
  mAccentColor=array.getColor(R.styleable.PinEntryView_accentColor,accentColor.resourceId > 0 ? getResources().getColor(accentColor.resourceId) : accentColor.data);
  String maskCharacter=array.getString(R.styleable.PinEntryView_mask);
  if (maskCharacter != null) {
    mMask=maskCharacter;
  }
  addViews();
}

Fixed version (ground truth):
public PinEntryView(Context context,AttributeSet attrs,int defStyle){
  super(context,attrs,defStyle);
  TypedArray array=getContext().obtainStyledAttributes(attrs,R.styleable.PinEntryView);
  mDigits=array.getInt(R.styleable.PinEntryView_numDigits,4);
  mAccentType=array.getInt(R.styleable.PinEntryView_accentType,ACCENT_NONE);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  mDigitWidth=array.getDimensionPixelSize(R.styleable.PinEntryView_digitWidth,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,50,metrics));
  mDigitHeight=array.getDimensionPixelSize(R.styleable.PinEntryView_digitHeight,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,50,metrics));
  mDigitSpacing=array.getDimensionPixelSize(R.styleable.PinEntryView_digitSpacing,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,20,metrics));
  mDigitTextSize=array.getDimensionPixelSize(R.styleable.PinEntryView_digitTextSize,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP,15,metrics));
  mAccentWidth=array.getDimensionPixelSize(R.styleable.PinEntryView_accentWidth,(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,3,metrics));
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    mDigitElevation=array.getDimensionPixelSize(R.styleable.PinEntryView_digitElevation,0);
  }
  Resources.Theme theme=getContext().getTheme();
  TypedValue background=new TypedValue();
  theme.resolveAttribute(android.R.attr.windowBackground,background,true);
  mDigitBackground=array.getResourceId(R.styleable.PinEntryView_digitBackground,background.resourceId);
  TypedValue textColor=new TypedValue();
  theme.resolveAttribute(android.R.attr.textColorPrimary,textColor,true);
  mDigitTextColor=array.getColor(R.styleable.PinEntryView_digitTextColor,textColor.resourceId > 0 ? getResources().getColor(textColor.resourceId) : textColor.data);
  TypedValue accentColor=new TypedValue();
  theme.resolveAttribute(R.attr.colorAccent,accentColor,true);
  mAccentColor=array.getColor(R.styleable.PinEntryView_accentColor,accentColor.resourceId > 0 ? getResources().getColor(accentColor.resourceId) : accentColor.data);
  String maskCharacter=array.getString(R.styleable.PinEntryView_mask);
  if (maskCharacter != null) {
    mMask=maskCharacter;
  }
  array.recycle();
  addViews();
}