Program: 195544
Project: 195544
Buggy source:
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  final int width=MeasureSpec.getSize(widthMeasureSpec);
  mBrightnessView.measure(exactly(width),MeasureSpec.UNSPECIFIED);
  final int brightnessHeight=mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop;
  mFooter.getView().measure(exactly(width),MeasureSpec.UNSPECIFIED);
  int r=-1;
  int c=-1;
  int rows=0;
  boolean rowIsDual=false;
  for (  TileRecord record : mRecords) {
    if (record.tileView.getVisibility() == GONE)     continue;
    if (r == -1 || c == (mColumns - 1) || rowIsDual != record.tile.supportsDualTargets()) {
      r++;
      c=0;
      rowIsDual=record.tile.supportsDualTargets();
    }
 else {
      c++;
    }
    record.row=r;
    record.col=c;
    rows=r + 1;
  }
  for (  TileRecord record : mRecords) {
    record.tileView.setDual(record.tile.supportsDualTargets());
    if (record.tileView.getVisibility() == GONE)     continue;
    final int cw=record.row == 0 ? mLargeCellWidth : mCellWidth;
    final int ch=record.row == 0 ? mLargeCellHeight : mCellHeight;
    record.tileView.measure(exactly(cw),exactly(ch));
  }
  int h=rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom);
  if (mFooter.hasFooter()) {
    h+=mFooter.getView().getMeasuredHeight();
  }
  mDetail.measure(exactly(width),MeasureSpec.UNSPECIFIED);
  if (mDetail.getMeasuredHeight() < h) {
    mDetail.measure(exactly(width),exactly(h));
  }
  mGridHeight=h;
  setMeasuredDimension(width,Math.max(h,mDetail.getMeasuredHeight()));
}

Fixed version (ground truth):
@Override protected void onMeasure(int widthMeasureSpec,int heightMeasureSpec){
  final int width=MeasureSpec.getSize(widthMeasureSpec);
  mBrightnessView.measure(exactly(width),MeasureSpec.UNSPECIFIED);
  final int brightnessHeight=mBrightnessView.getMeasuredHeight() + mBrightnessPaddingTop;
  mFooter.getView().measure(exactly(width),MeasureSpec.UNSPECIFIED);
  int r=-1;
  int c=-1;
  int rows=0;
  boolean rowIsDual=false;
  for (  TileRecord record : mRecords) {
    if (record.tileView.getVisibility() == GONE)     continue;
    if (r == -1 || c == (mColumns - 1) || rowIsDual != record.tile.supportsDualTargets()) {
      r++;
      c=0;
      rowIsDual=record.tile.supportsDualTargets();
    }
 else {
      c++;
    }
    record.row=r;
    record.col=c;
    rows=r + 1;
  }
  for (  TileRecord record : mRecords) {
    if (record.tileView.setDual(record.tile.supportsDualTargets())) {
      record.tileView.handleStateChanged(record.tile.getState());
    }
    if (record.tileView.getVisibility() == GONE)     continue;
    final int cw=record.row == 0 ? mLargeCellWidth : mCellWidth;
    final int ch=record.row == 0 ? mLargeCellHeight : mCellHeight;
    record.tileView.measure(exactly(cw),exactly(ch));
  }
  int h=rows == 0 ? brightnessHeight : (getRowTop(rows) + mPanelPaddingBottom);
  if (mFooter.hasFooter()) {
    h+=mFooter.getView().getMeasuredHeight();
  }
  mDetail.measure(exactly(width),MeasureSpec.UNSPECIFIED);
  if (mDetail.getMeasuredHeight() < h) {
    mDetail.measure(exactly(width),exactly(h));
  }
  mGridHeight=h;
  setMeasuredDimension(width,Math.max(h,mDetail.getMeasuredHeight()));
}