nus-yam/ex-repair huggingface dataset:
Program: 198066
Project: 198066
Buggy source:
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)normalized.charAt(0),(byte)normalized.charAt(1),(byte)normalized.charAt(2)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)(normalized.charAt(0) & 0xFF),(byte)(normalized.charAt(1) & 0xFF),(byte)(normalized.charAt(2) & 0xFF)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}
Program: 198067
Project: 198067
Buggy source:
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}
Program: 198068
Project: 198068
Buggy source:
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)version};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)(version & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}
Program: 198069
Project: 198069
Buggy source:
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=mPortIdMap.get(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=pathToPortId(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}
Program: 198070
Project: 198070
Buggy source:
private String buildMessage(String message,Pair<Long,Integer> timing,long curTime){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? curTime : timing.second).append("String_Node_Str").append(message).toString();
}

Fixed version (ground truth):
private String buildMessage(String message,@Nullable Pair<Long,Integer> timing){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? 1 : timing.second).append("String_Node_Str").append(message).toString();
}
Program: 198071
Project: 198071
Buggy source:
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing,curTime));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}
Program: 198072
Project: 198072
Buggy source:
private boolean shouldLogNow(Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}

Fixed version (ground truth):
private boolean shouldLogNow(@Nullable Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}
Program: 198073
Project: 198073
Buggy source:
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing,curTime));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}
Program: 198074
Project: 198074
Buggy source:
@Override @ServiceThreadOnly protected boolean handleInitiateArc(HdmiCecMessage message){
  assertRunOnServiceThread();
  removeAction(RequestArcInitiationAction.class);
  SetArcTransmissionStateAction action=new SetArcTransmissionStateAction(this,message.getSource(),true);
  addAndStartAction(action);
  return true;
}

Fixed version (ground truth):
@Override @ServiceThreadOnly protected boolean handleInitiateArc(HdmiCecMessage message){
  assertRunOnServiceThread();
  if (!canStartArcUpdateAction(message.getSource(),true)) {
    mService.maySendFeatureAbortCommand(message,Constants.ABORT_REFUSED);
    if (!isConnectedToArcPort(message.getSource())) {
      displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
    }
    return true;
  }
  removeAction(RequestArcInitiationAction.class);
  SetArcTransmissionStateAction action=new SetArcTransmissionStateAction(this,message.getSource(),true);
  addAndStartAction(action);
  return true;
}
Program: 198075
Project: 198075
Buggy source:
@ServiceThreadOnly private void startArcAction(boolean enabled){
  assertRunOnServiceThread();
  HdmiDeviceInfo info=getAvrDeviceInfo();
  if (info == null) {
    return;
  }
  if (!isConnectedToArcPort(info.getPhysicalAddress())) {
    return;
  }
  if (enabled) {
    removeAction(RequestArcTerminationAction.class);
    if (!hasAction(RequestArcInitiationAction.class)) {
      addAndStartAction(new RequestArcInitiationAction(this,info.getLogicalAddress()));
    }
  }
 else {
    removeAction(RequestArcInitiationAction.class);
    if (!hasAction(RequestArcTerminationAction.class)) {
      addAndStartAction(new RequestArcTerminationAction(this,info.getLogicalAddress()));
    }
  }
}

Fixed version (ground truth):
@ServiceThreadOnly void startArcAction(boolean enabled){
  assertRunOnServiceThread();
  HdmiDeviceInfo info=getAvrDeviceInfo();
  if (info == null) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (!canStartArcUpdateAction(info.getLogicalAddress(),enabled)) {
    Slog.w(TAG,"String_Node_Str");
    if (enabled && !isConnectedToArcPort(info.getPhysicalAddress())) {
      displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
    }
    return;
  }
  if (enabled) {
    removeAction(RequestArcTerminationAction.class);
    if (!hasAction(RequestArcInitiationAction.class)) {
      addAndStartAction(new RequestArcInitiationAction(this,info.getLogicalAddress()));
    }
  }
 else {
    removeAction(RequestArcInitiationAction.class);
    if (!hasAction(RequestArcTerminationAction.class)) {
      addAndStartAction(new RequestArcTerminationAction(this,info.getLogicalAddress()));
    }
  }
}
Program: 198076
Project: 198076
Buggy source:
/** 
 * Return a   {@link HdmiDeviceInfo} corresponding to the given {@code logicalAddress}. This is not thread-safe. For thread safety, call   {@link #getSafeCecDeviceInfo(int)}.
 * @param address logical address of the device to be retrieved
 * @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}. Returns null if no logical address matched
 */
@ServiceThreadOnly HdmiDeviceInfo getCecDeviceInfo(int logicalAddress){
  assertRunOnServiceThread();
  return mDeviceInfos.get(HdmiDeviceInfo.idForCecDevice(logicalAddress));
}

Fixed version (ground truth):
/** 
 * Return a   {@link HdmiDeviceInfo} corresponding to the given {@code logicalAddress}. This is not thread-safe. For thread safety, call   {@link #getSafeCecDeviceInfo(int)}.
 * @param logicalAddress logical address of the device to be retrieved
 * @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}. Returns null if no logical address matched
 */
@ServiceThreadOnly HdmiDeviceInfo getCecDeviceInfo(int logicalAddress){
  assertRunOnServiceThread();
  return mDeviceInfos.get(HdmiDeviceInfo.idForCecDevice(logicalAddress));
}
Program: 198077
Project: 198077
Buggy source:
void displayOsd(int messageId){
  Intent intent=new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
  intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID,messageId);
  mService.getContext().sendBroadcastAsUser(intent,UserHandle.ALL,HdmiControlService.PERMISSION);
}

Fixed version (ground truth):
@ServiceThreadOnly void displayOsd(int messageId){
  assertRunOnServiceThread();
  mService.displayOsd(messageId);
}
Program: 198078
Project: 198078
Buggy source:
/** 
 * Return a list of all   {@link HdmiDeviceInfo}. <p>Declared as package-private. accessed by   {@link HdmiControlService} only.This is not thread-safe. For thread safety, call  {@link #getSafeExternalInputs} whichdoes not include local device.
 */
@ServiceThreadOnly List<HdmiDeviceInfo> getDeviceInfoList(boolean includelLocalDevice){
  assertRunOnServiceThread();
  if (includelLocalDevice) {
    return HdmiUtils.sparseArrayToList(mDeviceInfos);
  }
 else {
    ArrayList<HdmiDeviceInfo> infoList=new ArrayList<>();
    for (int i=0; i < mDeviceInfos.size(); ++i) {
      HdmiDeviceInfo info=mDeviceInfos.valueAt(i);
      if (!isLocalDeviceAddress(info.getLogicalAddress())) {
        infoList.add(info);
      }
    }
    return infoList;
  }
}

Fixed version (ground truth):
/** 
 * Return a list of all   {@link HdmiDeviceInfo}. <p>Declared as package-private. accessed by   {@link HdmiControlService} only.This is not thread-safe. For thread safety, call  {@link #getSafeExternalInputsLocked} whichdoes not include local device.
 */
@ServiceThreadOnly List<HdmiDeviceInfo> getDeviceInfoList(boolean includelLocalDevice){
  assertRunOnServiceThread();
  if (includelLocalDevice) {
    return HdmiUtils.sparseArrayToList(mDeviceInfos);
  }
 else {
    ArrayList<HdmiDeviceInfo> infoList=new ArrayList<>();
    for (int i=0; i < mDeviceInfos.size(); ++i) {
      HdmiDeviceInfo info=mDeviceInfos.valueAt(i);
      if (!isLocalDeviceAddress(info.getLogicalAddress())) {
        infoList.add(info);
      }
    }
    return infoList;
  }
}
Program: 198079
Project: 198079
Buggy source:
@Override public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos){
  for (  HdmiDeviceInfo info : deviceInfos) {
    addCecDevice(info);
  }
  for (  HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
    addCecDevice(device.getDeviceInfo());
  }
  addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
  addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
  if (mSystemAudioActivated && getAvrDeviceInfo() != null) {
    addAndStartAction(new SystemAudioAutoInitiationAction(HdmiCecLocalDeviceTv.this,getAvrDeviceInfo().getLogicalAddress()));
    if (mArcEstablished) {
      startArcAction(true);
    }
  }
}

Fixed version (ground truth):
@Override public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos){
  for (  HdmiDeviceInfo info : deviceInfos) {
    addCecDevice(info);
  }
  for (  HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
    addCecDevice(device.getDeviceInfo());
  }
  addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
  addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
  HdmiDeviceInfo avr=getAvrDeviceInfo();
  if (avr != null) {
    onNewAvrAdded(avr);
  }
}
Program: 198080
Project: 198080
Buggy source:
@ServiceThreadOnly private void launchDeviceDiscovery(){
  assertRunOnServiceThread();
  clearDeviceInfoList();
  DeviceDiscoveryAction action=new DeviceDiscoveryAction(this,new DeviceDiscoveryCallback(){
    @Override public void onDeviceDiscoveryDone(    List<HdmiDeviceInfo> deviceInfos){
      for (      HdmiDeviceInfo info : deviceInfos) {
        addCecDevice(info);
      }
      for (      HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
        addCecDevice(device.getDeviceInfo());
      }
      addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
      addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
      if (mSystemAudioActivated && getAvrDeviceInfo() != null) {
        addAndStartAction(new SystemAudioAutoInitiationAction(HdmiCecLocalDeviceTv.this,getAvrDeviceInfo().getLogicalAddress()));
        if (mArcEstablished) {
          startArcAction(true);
        }
      }
    }
  }
);
  addAndStartAction(action);
}

Fixed version (ground truth):
@ServiceThreadOnly private void launchDeviceDiscovery(){
  assertRunOnServiceThread();
  clearDeviceInfoList();
  DeviceDiscoveryAction action=new DeviceDiscoveryAction(this,new DeviceDiscoveryCallback(){
    @Override public void onDeviceDiscoveryDone(    List<HdmiDeviceInfo> deviceInfos){
      for (      HdmiDeviceInfo info : deviceInfos) {
        addCecDevice(info);
      }
      for (      HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
        addCecDevice(device.getDeviceInfo());
      }
      addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
      addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
      HdmiDeviceInfo avr=getAvrDeviceInfo();
      if (avr != null) {
        onNewAvrAdded(avr);
      }
    }
  }
);
  addAndStartAction(action);
}
Program: 198081
Project: 198081
Buggy source:
@ServiceThreadOnly void changeArcFeatureEnabled(boolean enabled){
  assertRunOnServiceThread();
  if (mArcFeatureEnabled != enabled) {
    if (enabled) {
      if (!mArcEstablished) {
        startArcAction(true);
      }
    }
 else {
      if (mArcEstablished) {
        startArcAction(false);
      }
    }
    mArcFeatureEnabled=enabled;
  }
}

Fixed version (ground truth):
@ServiceThreadOnly void changeArcFeatureEnabled(boolean enabled){
  assertRunOnServiceThread();
  if (mArcFeatureEnabled != enabled) {
    mArcFeatureEnabled=enabled;
    if (enabled) {
      if (!mArcEstablished) {
        startArcAction(true);
      }
    }
 else {
      if (mArcEstablished) {
        startArcAction(false);
      }
    }
  }
}
Program: 198082
Project: 198082
Buggy source:
/** 
 * Build &lt;Report Physical Address&gt; command. It has two bytes physical address and one byte device type as parameter. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param address physical address of device
 * @param deviceType type of device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPhysicalAddressCommand(int src,int address,int deviceType){
  byte[] params=new byte[]{(byte)((address >> 8) & 0xFF),(byte)(address & 0xFF),(byte)deviceType};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_REPORT_PHYSICAL_ADDRESS,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Physical Address&gt; command. It has two bytes physical address and one byte device type as parameter. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param address physical address of device
 * @param deviceType type of device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPhysicalAddressCommand(int src,int address,int deviceType){
  byte[] params=new byte[]{(byte)((address >> 8) & 0xFF),(byte)(address & 0xFF),(byte)(deviceType & 0xFF)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_REPORT_PHYSICAL_ADDRESS,params);
}
Program: 198083
Project: 198083
Buggy source:
/** 
 * Build &lt;Report Power Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param powerStatus power status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPowerStatus(int src,int dest,int powerStatus){
  byte[] param=new byte[]{(byte)(powerStatus)};
  return buildCommand(src,dest,Constants.MESSAGE_REPORT_POWER_STATUS,param);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Power Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param powerStatus power status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPowerStatus(int src,int dest,int powerStatus){
  byte[] param=new byte[]{(byte)(powerStatus & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_REPORT_POWER_STATUS,param);
}
Program: 198084
Project: 198084
Buggy source:
/** 
 * Build &lt;Feature Abort&gt; command. &lt;Feature Abort&gt; consists of 1 byte original opcode and 1 byte reason fields with basic fields.
 * @param src source address of command
 * @param dest destination address of command
 * @param originalOpcode original opcode causing feature abort
 * @param reason reason of feature abort
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildFeatureAbortCommand(int src,int dest,int originalOpcode,int reason){
  byte[] params=new byte[]{(byte)originalOpcode,(byte)reason};
  return buildCommand(src,dest,Constants.MESSAGE_FEATURE_ABORT,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Feature Abort&gt; command. &lt;Feature Abort&gt; consists of 1 byte original opcode and 1 byte reason fields with basic fields.
 * @param src source address of command
 * @param dest destination address of command
 * @param originalOpcode original opcode causing feature abort
 * @param reason reason of feature abort
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildFeatureAbortCommand(int src,int dest,int originalOpcode,int reason){
  byte[] params=new byte[]{(byte)(originalOpcode & 0xFF),(byte)(reason & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_FEATURE_ABORT,params);
}
Program: 198085
Project: 198085
Buggy source:
private static byte[] physicalAddressToParam(int physicalAddress){
  return new byte[]{(byte)(physicalAddress >> 8),(byte)(physicalAddress & 0xFF)};
}

Fixed version (ground truth):
private static byte[] physicalAddressToParam(int physicalAddress){
  return new byte[]{(byte)((physicalAddress >> 8) & 0xFF),(byte)(physicalAddress & 0xFF)};
}
Program: 198086
Project: 198086
Buggy source:
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)normalized.charAt(0),(byte)normalized.charAt(1),(byte)normalized.charAt(2)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)(normalized.charAt(0) & 0xFF),(byte)(normalized.charAt(1) & 0xFF),(byte)(normalized.charAt(2) & 0xFF)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}
Program: 198087
Project: 198087
Buggy source:
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}
Program: 198088
Project: 198088
Buggy source:
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)version};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)(version & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}
Program: 198089
Project: 198089
Buggy source:
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=mPortIdMap.get(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=pathToPortId(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}
Program: 198090
Project: 198090
Buggy source:
private String buildMessage(String message,Pair<Long,Integer> timing,long curTime){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? curTime : timing.second).append("String_Node_Str").append(message).toString();
}

Fixed version (ground truth):
private String buildMessage(String message,@Nullable Pair<Long,Integer> timing){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? 1 : timing.second).append("String_Node_Str").append(message).toString();
}
Program: 198091
Project: 198091
Buggy source:
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing,curTime));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}
Program: 198092
Project: 198092
Buggy source:
private boolean shouldLogNow(Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}

Fixed version (ground truth):
private boolean shouldLogNow(@Nullable Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}
Program: 198093
Project: 198093
Buggy source:
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing,curTime));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}
Program: 198094
Project: 198094
Buggy source:
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks();
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}

Fixed version (ground truth):
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}
Program: 198096
Project: 198096
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeString(callingPackage);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}
Program: 198097
Project: 198097
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException ;

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException ;
Program: 198099
Project: 198099
Buggy source:
@Override public List<IAppTask> getAppTasks(){
  final PackageManager pm=mContext.getPackageManager();
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  HashSet<String> packages=new HashSet<String>();
  String[] uidPackages=pm.getPackagesForUid(callingUid);
  for (int i=0; i < uidPackages.length; i++) {
    packages.add(uidPackages[i]);
  }
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (packages.contains(tr.getBaseIntent().getComponent().getPackageName())) {
          ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
          AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
          list.add(taskImpl);
        }
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}

Fixed version (ground truth):
@Override public List<IAppTask> getAppTasks(String callingPackage){
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (tr.effectiveUid != callingUid) {
          continue;
        }
        Intent intent=tr.getBaseIntent();
        if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
          continue;
        }
        ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
        AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
        list.add(taskImpl);
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}
Program: 198100
Project: 198100
Buggy source:
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.creatorUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}

Fixed version (ground truth):
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.effectiveUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}
Program: 198106
Project: 198106
Buggy source:
@Override @ServiceThreadOnly protected boolean handleInitiateArc(HdmiCecMessage message){
  assertRunOnServiceThread();
  removeAction(RequestArcInitiationAction.class);
  SetArcTransmissionStateAction action=new SetArcTransmissionStateAction(this,message.getSource(),true);
  addAndStartAction(action);
  return true;
}

Fixed version (ground truth):
@Override @ServiceThreadOnly protected boolean handleInitiateArc(HdmiCecMessage message){
  assertRunOnServiceThread();
  if (!canStartArcUpdateAction(message.getSource(),true)) {
    mService.maySendFeatureAbortCommand(message,Constants.ABORT_REFUSED);
    if (!isConnectedToArcPort(message.getSource())) {
      displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
    }
    return true;
  }
  removeAction(RequestArcInitiationAction.class);
  SetArcTransmissionStateAction action=new SetArcTransmissionStateAction(this,message.getSource(),true);
  addAndStartAction(action);
  return true;
}
Program: 198107
Project: 198107
Buggy source:
@ServiceThreadOnly private void startArcAction(boolean enabled){
  assertRunOnServiceThread();
  HdmiDeviceInfo info=getAvrDeviceInfo();
  if (info == null) {
    return;
  }
  if (!isConnectedToArcPort(info.getPhysicalAddress())) {
    return;
  }
  if (enabled) {
    removeAction(RequestArcTerminationAction.class);
    if (!hasAction(RequestArcInitiationAction.class)) {
      addAndStartAction(new RequestArcInitiationAction(this,info.getLogicalAddress()));
    }
  }
 else {
    removeAction(RequestArcInitiationAction.class);
    if (!hasAction(RequestArcTerminationAction.class)) {
      addAndStartAction(new RequestArcTerminationAction(this,info.getLogicalAddress()));
    }
  }
}

Fixed version (ground truth):
@ServiceThreadOnly void startArcAction(boolean enabled){
  assertRunOnServiceThread();
  HdmiDeviceInfo info=getAvrDeviceInfo();
  if (info == null) {
    Slog.w(TAG,"String_Node_Str");
    return;
  }
  if (!canStartArcUpdateAction(info.getLogicalAddress(),enabled)) {
    Slog.w(TAG,"String_Node_Str");
    if (enabled && !isConnectedToArcPort(info.getPhysicalAddress())) {
      displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
    }
    return;
  }
  if (enabled) {
    removeAction(RequestArcTerminationAction.class);
    if (!hasAction(RequestArcInitiationAction.class)) {
      addAndStartAction(new RequestArcInitiationAction(this,info.getLogicalAddress()));
    }
  }
 else {
    removeAction(RequestArcInitiationAction.class);
    if (!hasAction(RequestArcTerminationAction.class)) {
      addAndStartAction(new RequestArcTerminationAction(this,info.getLogicalAddress()));
    }
  }
}
Program: 198108
Project: 198108
Buggy source:
/** 
 * Return a   {@link HdmiDeviceInfo} corresponding to the given {@code logicalAddress}. This is not thread-safe. For thread safety, call   {@link #getSafeCecDeviceInfo(int)}.
 * @param address logical address of the device to be retrieved
 * @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}. Returns null if no logical address matched
 */
@ServiceThreadOnly HdmiDeviceInfo getCecDeviceInfo(int logicalAddress){
  assertRunOnServiceThread();
  return mDeviceInfos.get(HdmiDeviceInfo.idForCecDevice(logicalAddress));
}

Fixed version (ground truth):
/** 
 * Return a   {@link HdmiDeviceInfo} corresponding to the given {@code logicalAddress}. This is not thread-safe. For thread safety, call   {@link #getSafeCecDeviceInfo(int)}.
 * @param logicalAddress logical address of the device to be retrieved
 * @return {@link HdmiDeviceInfo} matched with the given {@code logicalAddress}. Returns null if no logical address matched
 */
@ServiceThreadOnly HdmiDeviceInfo getCecDeviceInfo(int logicalAddress){
  assertRunOnServiceThread();
  return mDeviceInfos.get(HdmiDeviceInfo.idForCecDevice(logicalAddress));
}
Program: 198109
Project: 198109
Buggy source:
void displayOsd(int messageId){
  Intent intent=new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
  intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID,messageId);
  mService.getContext().sendBroadcastAsUser(intent,UserHandle.ALL,HdmiControlService.PERMISSION);
}

Fixed version (ground truth):
@ServiceThreadOnly void displayOsd(int messageId){
  assertRunOnServiceThread();
  mService.displayOsd(messageId);
}
Program: 198110
Project: 198110
Buggy source:
/** 
 * Return a list of all   {@link HdmiDeviceInfo}. <p>Declared as package-private. accessed by   {@link HdmiControlService} only.This is not thread-safe. For thread safety, call  {@link #getSafeExternalInputs} whichdoes not include local device.
 */
@ServiceThreadOnly List<HdmiDeviceInfo> getDeviceInfoList(boolean includelLocalDevice){
  assertRunOnServiceThread();
  if (includelLocalDevice) {
    return HdmiUtils.sparseArrayToList(mDeviceInfos);
  }
 else {
    ArrayList<HdmiDeviceInfo> infoList=new ArrayList<>();
    for (int i=0; i < mDeviceInfos.size(); ++i) {
      HdmiDeviceInfo info=mDeviceInfos.valueAt(i);
      if (!isLocalDeviceAddress(info.getLogicalAddress())) {
        infoList.add(info);
      }
    }
    return infoList;
  }
}

Fixed version (ground truth):
/** 
 * Return a list of all   {@link HdmiDeviceInfo}. <p>Declared as package-private. accessed by   {@link HdmiControlService} only.This is not thread-safe. For thread safety, call  {@link #getSafeExternalInputsLocked} whichdoes not include local device.
 */
@ServiceThreadOnly List<HdmiDeviceInfo> getDeviceInfoList(boolean includelLocalDevice){
  assertRunOnServiceThread();
  if (includelLocalDevice) {
    return HdmiUtils.sparseArrayToList(mDeviceInfos);
  }
 else {
    ArrayList<HdmiDeviceInfo> infoList=new ArrayList<>();
    for (int i=0; i < mDeviceInfos.size(); ++i) {
      HdmiDeviceInfo info=mDeviceInfos.valueAt(i);
      if (!isLocalDeviceAddress(info.getLogicalAddress())) {
        infoList.add(info);
      }
    }
    return infoList;
  }
}
Program: 198111
Project: 198111
Buggy source:
@Override public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos){
  for (  HdmiDeviceInfo info : deviceInfos) {
    addCecDevice(info);
  }
  for (  HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
    addCecDevice(device.getDeviceInfo());
  }
  addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
  addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
  if (mSystemAudioActivated && getAvrDeviceInfo() != null) {
    addAndStartAction(new SystemAudioAutoInitiationAction(HdmiCecLocalDeviceTv.this,getAvrDeviceInfo().getLogicalAddress()));
    if (mArcEstablished) {
      startArcAction(true);
    }
  }
}

Fixed version (ground truth):
@Override public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos){
  for (  HdmiDeviceInfo info : deviceInfos) {
    addCecDevice(info);
  }
  for (  HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
    addCecDevice(device.getDeviceInfo());
  }
  addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
  addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
  HdmiDeviceInfo avr=getAvrDeviceInfo();
  if (avr != null) {
    onNewAvrAdded(avr);
  }
}
Program: 198112
Project: 198112
Buggy source:
@ServiceThreadOnly private void launchDeviceDiscovery(){
  assertRunOnServiceThread();
  clearDeviceInfoList();
  DeviceDiscoveryAction action=new DeviceDiscoveryAction(this,new DeviceDiscoveryCallback(){
    @Override public void onDeviceDiscoveryDone(    List<HdmiDeviceInfo> deviceInfos){
      for (      HdmiDeviceInfo info : deviceInfos) {
        addCecDevice(info);
      }
      for (      HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
        addCecDevice(device.getDeviceInfo());
      }
      addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
      addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
      if (mSystemAudioActivated && getAvrDeviceInfo() != null) {
        addAndStartAction(new SystemAudioAutoInitiationAction(HdmiCecLocalDeviceTv.this,getAvrDeviceInfo().getLogicalAddress()));
        if (mArcEstablished) {
          startArcAction(true);
        }
      }
    }
  }
);
  addAndStartAction(action);
}

Fixed version (ground truth):
@ServiceThreadOnly private void launchDeviceDiscovery(){
  assertRunOnServiceThread();
  clearDeviceInfoList();
  DeviceDiscoveryAction action=new DeviceDiscoveryAction(this,new DeviceDiscoveryCallback(){
    @Override public void onDeviceDiscoveryDone(    List<HdmiDeviceInfo> deviceInfos){
      for (      HdmiDeviceInfo info : deviceInfos) {
        addCecDevice(info);
      }
      for (      HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
        addCecDevice(device.getDeviceInfo());
      }
      addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
      addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
      HdmiDeviceInfo avr=getAvrDeviceInfo();
      if (avr != null) {
        onNewAvrAdded(avr);
      }
    }
  }
);
  addAndStartAction(action);
}
Program: 198113
Project: 198113
Buggy source:
@ServiceThreadOnly void changeArcFeatureEnabled(boolean enabled){
  assertRunOnServiceThread();
  if (mArcFeatureEnabled != enabled) {
    if (enabled) {
      if (!mArcEstablished) {
        startArcAction(true);
      }
    }
 else {
      if (mArcEstablished) {
        startArcAction(false);
      }
    }
    mArcFeatureEnabled=enabled;
  }
}

Fixed version (ground truth):
@ServiceThreadOnly void changeArcFeatureEnabled(boolean enabled){
  assertRunOnServiceThread();
  if (mArcFeatureEnabled != enabled) {
    mArcFeatureEnabled=enabled;
    if (enabled) {
      if (!mArcEstablished) {
        startArcAction(true);
      }
    }
 else {
      if (mArcEstablished) {
        startArcAction(false);
      }
    }
  }
}
Program: 198114
Project: 198114
Buggy source:
/** 
 * Build &lt;Report Physical Address&gt; command. It has two bytes physical address and one byte device type as parameter. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param address physical address of device
 * @param deviceType type of device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPhysicalAddressCommand(int src,int address,int deviceType){
  byte[] params=new byte[]{(byte)((address >> 8) & 0xFF),(byte)(address & 0xFF),(byte)deviceType};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_REPORT_PHYSICAL_ADDRESS,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Physical Address&gt; command. It has two bytes physical address and one byte device type as parameter. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param address physical address of device
 * @param deviceType type of device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPhysicalAddressCommand(int src,int address,int deviceType){
  byte[] params=new byte[]{(byte)((address >> 8) & 0xFF),(byte)(address & 0xFF),(byte)(deviceType & 0xFF)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_REPORT_PHYSICAL_ADDRESS,params);
}
Program: 198115
Project: 198115
Buggy source:
/** 
 * Build &lt;Report Power Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param powerStatus power status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPowerStatus(int src,int dest,int powerStatus){
  byte[] param=new byte[]{(byte)(powerStatus)};
  return buildCommand(src,dest,Constants.MESSAGE_REPORT_POWER_STATUS,param);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Power Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param powerStatus power status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportPowerStatus(int src,int dest,int powerStatus){
  byte[] param=new byte[]{(byte)(powerStatus & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_REPORT_POWER_STATUS,param);
}
Program: 198116
Project: 198116
Buggy source:
/** 
 * Build &lt;Feature Abort&gt; command. &lt;Feature Abort&gt; consists of 1 byte original opcode and 1 byte reason fields with basic fields.
 * @param src source address of command
 * @param dest destination address of command
 * @param originalOpcode original opcode causing feature abort
 * @param reason reason of feature abort
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildFeatureAbortCommand(int src,int dest,int originalOpcode,int reason){
  byte[] params=new byte[]{(byte)originalOpcode,(byte)reason};
  return buildCommand(src,dest,Constants.MESSAGE_FEATURE_ABORT,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Feature Abort&gt; command. &lt;Feature Abort&gt; consists of 1 byte original opcode and 1 byte reason fields with basic fields.
 * @param src source address of command
 * @param dest destination address of command
 * @param originalOpcode original opcode causing feature abort
 * @param reason reason of feature abort
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildFeatureAbortCommand(int src,int dest,int originalOpcode,int reason){
  byte[] params=new byte[]{(byte)(originalOpcode & 0xFF),(byte)(reason & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_FEATURE_ABORT,params);
}