@Override
  public int selectFocus(Detections<Barcode> detections) {
    SparseArray<Barcode> barcodes = detections.getDetectedItems();
    for (int i = 0; i < barcodes.size(); ++i) {
      int id = barcodes.keyAt(i);
      if (!mCentralFilterEnabled
          || BarcodeCentralFilter.barcodeIsInsideScannerSquare(barcodes.valueAt(i))) {
        return id;
      }
    }
    return -1;
  }
We only accept the barcode inside the scanner square. Note that the return dimensions for the
barcodes is based on the camera's coordinates, so we must convert it to the canvas' coordinate
for comparing with the scanner square.
java/com/google/android/apps/authenticator/barcode/BarcodeCentralFocusingProcessor.java