Program: 193839
Project: 193839
Buggy source:
/** 
 * Create a new   {@link StreamConfigurationMap}. <p>The array parameters ownership is passed to this object after creation; do not write to them after this constructor is invoked.</p>
 * @param configurations a non-{@code null} array of {@link StreamConfiguration}
 * @param minFrameDurations a non-{@code null} array of {@link StreamConfigurationDuration}
 * @param stallDurations a non-{@code null} array of {@link StreamConfigurationDuration}
 * @param highSpeedVideoConfigurations an array of {@link HighSpeedVideoConfiguration}, null if camera device does not support high speed video recording
 * @param listHighResolution a flag indicating whether the device supports BURST_CAPTUREand thus needs a separate list of slow high-resolution output sizes
 * @throws NullPointerException if any of the arguments except highSpeedVideoConfigurationswere  {@code null} or any subelements were {@code null}
 * @hide
 */
public StreamConfigurationMap(StreamConfiguration[] configurations,StreamConfigurationDuration[] minFrameDurations,StreamConfigurationDuration[] stallDurations,StreamConfiguration[] depthConfigurations,StreamConfigurationDuration[] depthMinFrameDurations,StreamConfigurationDuration[] depthStallDurations,HighSpeedVideoConfiguration[] highSpeedVideoConfigurations,ReprocessFormatsMap inputOutputFormatsMap,boolean listHighResolution){
  mConfigurations=checkArrayElementsNotNull(configurations,"String_Node_Str");
  mMinFrameDurations=checkArrayElementsNotNull(minFrameDurations,"String_Node_Str");
  mStallDurations=checkArrayElementsNotNull(stallDurations,"String_Node_Str");
  mListHighResolution=listHighResolution;
  if (depthConfigurations == null) {
    mDepthConfigurations=new StreamConfiguration[0];
    mDepthMinFrameDurations=new StreamConfigurationDuration[0];
    mDepthStallDurations=new StreamConfigurationDuration[0];
  }
 else {
    mDepthConfigurations=checkArrayElementsNotNull(depthConfigurations,"String_Node_Str");
    mDepthMinFrameDurations=checkArrayElementsNotNull(depthMinFrameDurations,"String_Node_Str");
    mDepthStallDurations=checkArrayElementsNotNull(depthStallDurations,"String_Node_Str");
  }
  if (highSpeedVideoConfigurations == null) {
    mHighSpeedVideoConfigurations=new HighSpeedVideoConfiguration[0];
  }
 else {
    mHighSpeedVideoConfigurations=checkArrayElementsNotNull(highSpeedVideoConfigurations,"String_Node_Str");
  }
  for (  StreamConfiguration config : configurations) {
    int fmt=config.getFormat();
    SparseIntArray map=null;
    if (config.isOutput()) {
      mAllOutputFormats.put(fmt,mAllOutputFormats.get(fmt) + 1);
      long duration=0;
      if (mListHighResolution) {
        for (        StreamConfigurationDuration configurationDuration : mMinFrameDurations) {
          if (configurationDuration.getFormat() == fmt && configurationDuration.getWidth() == config.getSize().getWidth() && configurationDuration.getHeight() == config.getSize().getHeight()) {
            duration=configurationDuration.getDuration();
            break;
          }
        }
      }
      map=duration <= DURATION_20FPS_NS ? mOutputFormats : mHighResOutputFormats;
    }
 else {
      map=mInputFormats;
    }
    map.put(fmt,map.get(fmt) + 1);
  }
  for (  StreamConfiguration config : mDepthConfigurations) {
    if (!config.isOutput()) {
      continue;
    }
    mDepthOutputFormats.put(config.getFormat(),mDepthOutputFormats.get(config.getFormat()) + 1);
  }
  if (mOutputFormats.indexOfKey(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) < 0) {
    throw new AssertionError("String_Node_Str");
  }
  for (  HighSpeedVideoConfiguration config : mHighSpeedVideoConfigurations) {
    Size size=config.getSize();
    Range<Integer> fpsRange=config.getFpsRange();
    Integer fpsRangeCount=mHighSpeedVideoSizeMap.get(size);
    if (fpsRangeCount == null) {
      fpsRangeCount=0;
    }
    mHighSpeedVideoSizeMap.put(size,fpsRangeCount + 1);
    Integer sizeCount=mHighSpeedVideoFpsRangeMap.get(fpsRange);
    if (sizeCount == null) {
      sizeCount=0;
    }
    mHighSpeedVideoFpsRangeMap.put(fpsRange,sizeCount + 1);
  }
  mInputOutputFormatsMap=inputOutputFormatsMap;
}

Fixed version (ground truth):
/** 
 * Create a new   {@link StreamConfigurationMap}. <p>The array parameters ownership is passed to this object after creation; do not write to them after this constructor is invoked.</p>
 * @param configurations a non-{@code null} array of {@link StreamConfiguration}
 * @param minFrameDurations a non-{@code null} array of {@link StreamConfigurationDuration}
 * @param stallDurations a non-{@code null} array of {@link StreamConfigurationDuration}
 * @param highSpeedVideoConfigurations an array of {@link HighSpeedVideoConfiguration}, null if camera device does not support high speed video recording
 * @param listHighResolution a flag indicating whether the device supports BURST_CAPTUREand thus needs a separate list of slow high-resolution output sizes
 * @throws NullPointerException if any of the arguments except highSpeedVideoConfigurationswere  {@code null} or any subelements were {@code null}
 * @hide
 */
public StreamConfigurationMap(StreamConfiguration[] configurations,StreamConfigurationDuration[] minFrameDurations,StreamConfigurationDuration[] stallDurations,StreamConfiguration[] depthConfigurations,StreamConfigurationDuration[] depthMinFrameDurations,StreamConfigurationDuration[] depthStallDurations,HighSpeedVideoConfiguration[] highSpeedVideoConfigurations,ReprocessFormatsMap inputOutputFormatsMap,boolean listHighResolution){
  if (configurations == null) {
    checkArrayElementsNotNull(depthConfigurations,"String_Node_Str");
    mConfigurations=new StreamConfiguration[0];
    mMinFrameDurations=new StreamConfigurationDuration[0];
    mStallDurations=new StreamConfigurationDuration[0];
  }
 else {
    mConfigurations=checkArrayElementsNotNull(configurations,"String_Node_Str");
    mMinFrameDurations=checkArrayElementsNotNull(minFrameDurations,"String_Node_Str");
    mStallDurations=checkArrayElementsNotNull(stallDurations,"String_Node_Str");
  }
  mListHighResolution=listHighResolution;
  if (depthConfigurations == null) {
    mDepthConfigurations=new StreamConfiguration[0];
    mDepthMinFrameDurations=new StreamConfigurationDuration[0];
    mDepthStallDurations=new StreamConfigurationDuration[0];
  }
 else {
    mDepthConfigurations=checkArrayElementsNotNull(depthConfigurations,"String_Node_Str");
    mDepthMinFrameDurations=checkArrayElementsNotNull(depthMinFrameDurations,"String_Node_Str");
    mDepthStallDurations=checkArrayElementsNotNull(depthStallDurations,"String_Node_Str");
  }
  if (highSpeedVideoConfigurations == null) {
    mHighSpeedVideoConfigurations=new HighSpeedVideoConfiguration[0];
  }
 else {
    mHighSpeedVideoConfigurations=checkArrayElementsNotNull(highSpeedVideoConfigurations,"String_Node_Str");
  }
  for (  StreamConfiguration config : mConfigurations) {
    int fmt=config.getFormat();
    SparseIntArray map=null;
    if (config.isOutput()) {
      mAllOutputFormats.put(fmt,mAllOutputFormats.get(fmt) + 1);
      long duration=0;
      if (mListHighResolution) {
        for (        StreamConfigurationDuration configurationDuration : mMinFrameDurations) {
          if (configurationDuration.getFormat() == fmt && configurationDuration.getWidth() == config.getSize().getWidth() && configurationDuration.getHeight() == config.getSize().getHeight()) {
            duration=configurationDuration.getDuration();
            break;
          }
        }
      }
      map=duration <= DURATION_20FPS_NS ? mOutputFormats : mHighResOutputFormats;
    }
 else {
      map=mInputFormats;
    }
    map.put(fmt,map.get(fmt) + 1);
  }
  for (  StreamConfiguration config : mDepthConfigurations) {
    if (!config.isOutput()) {
      continue;
    }
    mDepthOutputFormats.put(config.getFormat(),mDepthOutputFormats.get(config.getFormat()) + 1);
  }
  if (configurations != null && mOutputFormats.indexOfKey(HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) < 0) {
    throw new AssertionError("String_Node_Str");
  }
  for (  HighSpeedVideoConfiguration config : mHighSpeedVideoConfigurations) {
    Size size=config.getSize();
    Range<Integer> fpsRange=config.getFpsRange();
    Integer fpsRangeCount=mHighSpeedVideoSizeMap.get(size);
    if (fpsRangeCount == null) {
      fpsRangeCount=0;
    }
    mHighSpeedVideoSizeMap.put(size,fpsRangeCount + 1);
    Integer sizeCount=mHighSpeedVideoFpsRangeMap.get(fpsRange);
    if (sizeCount == null) {
      sizeCount=0;
    }
    mHighSpeedVideoFpsRangeMap.put(fpsRange,sizeCount + 1);
  }
  mInputOutputFormatsMap=inputOutputFormatsMap;
}