nus-yam/ex-repair huggingface dataset:
Program: 194527
Project: 194527
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int callingUid,int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    int callingAppId=UserHandle.getAppId(callingUid);
    if (callingAppId >= Process.FIRST_APPLICATION_UID) {
      if (!mPowerSaveWhitelistSystemAppIds.get(callingAppId)) {
        throw new SecurityException("String_Node_Str" + UserHandle.formatUid(callingUid) + "String_Node_Str");
      }
    }
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}
Program: 194528
Project: 194528
Buggy source:
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          mPowerSaveWhitelistApps.put(ai.packageName,UserHandle.getAppId(ai.uid));
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}

Fixed version (ground truth):
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          int appid=UserHandle.getAppId(ai.uid);
          mPowerSaveWhitelistApps.put(ai.packageName,appid);
          mPowerSaveWhitelistSystemAppIds.put(appid,true);
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}
Program: 194529
Project: 194529
Buggy source:
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAppIdArray);
  }
}

Fixed version (ground truth):
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAllAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAllAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAllAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAllAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAllAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray);
  }
}
Program: 194530
Project: 194530
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(int callingUid,String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(callingUid,appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}
Program: 194531
Project: 194531
Buggy source:
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAppIdArray;
  }
}

Fixed version (ground truth):
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAllAppIdArray;
  }
}
Program: 194534
Project: 194534
Buggy source:
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_IDLE_OFF:
{
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  EventLogTags.writeDeviceIdleOnStart();
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
  EventLogTags.writeDeviceIdleOnComplete();
}
break;
case MSG_REPORT_IDLE_OFF:
{
EventLogTags.writeDeviceIdleOffStart("String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
EventLogTags.writeDeviceIdleOffStart(activeReason != null ? activeReason : "String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}
Program: 194535
Project: 194535
Buggy source:
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}

Fixed version (ground truth):
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  final int callingUid=Binder.getCallingUid();
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),callingUid,userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(callingUid,packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}
Program: 194536
Project: 194536
Buggy source:
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  DeviceIdleController.this.addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
}

Fixed version (ground truth):
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  addPowerSaveTempWhitelistAppDirectInternal(0,appId,duration);
}
Program: 194537
Project: 194537
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int callingUid,int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    int callingAppId=UserHandle.getAppId(callingUid);
    if (callingAppId >= Process.FIRST_APPLICATION_UID) {
      if (!mPowerSaveWhitelistSystemAppIds.get(callingAppId)) {
        throw new SecurityException("String_Node_Str" + UserHandle.formatUid(callingUid) + "String_Node_Str");
      }
    }
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}
Program: 194538
Project: 194538
Buggy source:
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          mPowerSaveWhitelistApps.put(ai.packageName,UserHandle.getAppId(ai.uid));
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}

Fixed version (ground truth):
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          int appid=UserHandle.getAppId(ai.uid);
          mPowerSaveWhitelistApps.put(ai.packageName,appid);
          mPowerSaveWhitelistSystemAppIds.put(appid,true);
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}
Program: 194539
Project: 194539
Buggy source:
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAppIdArray);
  }
}

Fixed version (ground truth):
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAllAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAllAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAllAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAllAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAllAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray);
  }
}
Program: 194540
Project: 194540
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(int callingUid,String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(callingUid,appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}
Program: 194541
Project: 194541
Buggy source:
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAppIdArray;
  }
}

Fixed version (ground truth):
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAllAppIdArray;
  }
}
Program: 194544
Project: 194544
Buggy source:
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_IDLE_OFF:
{
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  EventLogTags.writeDeviceIdleOnStart();
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
  EventLogTags.writeDeviceIdleOnComplete();
}
break;
case MSG_REPORT_IDLE_OFF:
{
EventLogTags.writeDeviceIdleOffStart("String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
EventLogTags.writeDeviceIdleOffStart(activeReason != null ? activeReason : "String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}
Program: 194545
Project: 194545
Buggy source:
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}

Fixed version (ground truth):
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  final int callingUid=Binder.getCallingUid();
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),callingUid,userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(callingUid,packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}
Program: 194546
Project: 194546
Buggy source:
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  DeviceIdleController.this.addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
}

Fixed version (ground truth):
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  addPowerSaveTempWhitelistAppDirectInternal(0,appId,duration);
}
Program: 194549
Project: 194549
Buggy source:
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 * @see android.widget.TextView#setIndents
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}

Fixed version (ground truth):
/** 
 * Set indents. Arguments are arrays holding an indent amount, one per line, measured in pixels. For lines past the last element in the array, the last element repeats.
 * @param leftIndents array of indent values for left margin, in pixels
 * @param rightIndents array of indent values for right margin, in pixels
 * @return this builder, useful for chaining
 */
public Builder setIndents(int[] leftIndents,int[] rightIndents){
  mLeftIndents=leftIndents;
  mRightIndents=rightIndents;
  int leftLen=leftIndents == null ? 0 : leftIndents.length;
  int rightLen=rightIndents == null ? 0 : rightIndents.length;
  int[] indents=new int[Math.max(leftLen,rightLen)];
  for (int i=0; i < indents.length; i++) {
    int leftMargin=i < leftLen ? leftIndents[i] : 0;
    int rightMargin=i < rightLen ? rightIndents[i] : 0;
    indents[i]=leftMargin + rightMargin;
  }
  nSetIndents(mNativePtr,indents);
  return this;
}
Program: 194550
Project: 194550
Buggy source:
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}

Fixed version (ground truth):
private static void recycle(Builder b){
  b.mPaint=null;
  b.mText=null;
  MeasuredText.recycle(b.mMeasuredText);
  b.mMeasuredText=null;
  b.mLeftIndents=null;
  b.mRightIndents=null;
  nFinishBuilder(b.mNativePtr);
  sPool.release(b);
}
Program: 194552
Project: 194552
Buggy source:
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  generate(b,b.mIncludePad,b.mIncludePad);
}

Fixed version (ground truth):
private StaticLayout(Builder b){
  super((b.mEllipsize == null) ? b.mText : (b.mText instanceof Spanned) ? new SpannedEllipsizer(b.mText) : new Ellipsizer(b.mText),b.mPaint,b.mWidth,b.mAlignment,b.mSpacingMult,b.mSpacingAdd);
  if (b.mEllipsize != null) {
    Ellipsizer e=(Ellipsizer)getText();
    e.mLayout=this;
    e.mWidth=b.mEllipsizedWidth;
    e.mMethod=b.mEllipsize;
    mEllipsizedWidth=b.mEllipsizedWidth;
    mColumns=COLUMNS_ELLIPSIZE;
  }
 else {
    mColumns=COLUMNS_NORMAL;
    mEllipsizedWidth=b.mWidth;
  }
  mLineDirections=ArrayUtils.newUnpaddedArray(Directions.class,2 * mColumns);
  mLines=new int[mLineDirections.length];
  mMaximumVisibleLineCount=b.mMaxLines;
  mLeftIndents=b.mLeftIndents;
  mRightIndents=b.mRightIndents;
  generate(b,b.mIncludePad,b.mIncludePad);
}
Program: 194553
Project: 194553
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppDirectInternal(int callingUid,int appId,long duration){
  final long timeNow=SystemClock.elapsedRealtime();
synchronized (this) {
    int callingAppId=UserHandle.getAppId(callingUid);
    if (callingAppId >= Process.FIRST_APPLICATION_UID) {
      if (!mPowerSaveWhitelistSystemAppIds.get(callingAppId)) {
        throw new SecurityException("String_Node_Str" + UserHandle.formatUid(callingUid) + "String_Node_Str");
      }
    }
    duration=Math.min(duration,mConstants.MAX_TEMP_APP_WHITELIST_DURATION);
    long currentEndTime=mTempWhitelistAppIdEndTimes.get(appId);
    mTempWhitelistAppIdEndTimes.put(appId,timeNow + duration);
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + appId + "String_Node_Str");
    }
    if (currentEndTime == 0) {
      postTempActiveTimeoutMessage(appId,duration);
      updateTempWhitelistAppIdsLocked();
      reportTempWhitelistChangedLocked();
    }
  }
}
Program: 194554
Project: 194554
Buggy source:
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          mPowerSaveWhitelistApps.put(ai.packageName,UserHandle.getAppId(ai.uid));
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}

Fixed version (ground truth):
@Override public void onStart(){
  final PackageManager pm=getContext().getPackageManager();
synchronized (this) {
    mEnabled=getContext().getResources().getBoolean(com.android.internal.R.bool.config_enableAutoPowerModes);
    SystemConfig sysConfig=SystemConfig.getInstance();
    ArraySet<String> allowPower=sysConfig.getAllowInPowerSave();
    for (int i=0; i < allowPower.size(); i++) {
      String pkg=allowPower.valueAt(i);
      try {
        ApplicationInfo ai=pm.getApplicationInfo(pkg,0);
        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
          int appid=UserHandle.getAppId(ai.uid);
          mPowerSaveWhitelistApps.put(ai.packageName,appid);
          mPowerSaveWhitelistSystemAppIds.put(appid,true);
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
      }
    }
    mConstants=new Constants(mHandler,getContext().getContentResolver());
    readConfigFileLocked();
    updateWhitelistAppIdsLocked();
    mScreenOn=true;
    mCharging=true;
    mState=STATE_ACTIVE;
    mInactiveTimeout=mConstants.INACTIVE_TIMEOUT;
  }
  publishBinderService(Context.DEVICE_IDLE_CONTROLLER,new BinderService());
  publishLocalService(LocalService.class,new LocalService());
}
Program: 194555
Project: 194555
Buggy source:
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAppIdArray);
  }
}

Fixed version (ground truth):
private void updateWhitelistAppIdsLocked(){
  mPowerSaveWhitelistAllAppIds.clear();
  for (int i=0; i < mPowerSaveWhitelistApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistApps.valueAt(i),true);
  }
  for (int i=0; i < mPowerSaveWhitelistUserApps.size(); i++) {
    mPowerSaveWhitelistAllAppIds.put(mPowerSaveWhitelistUserApps.valueAt(i),true);
  }
  int size=mPowerSaveWhitelistAllAppIds.size();
  int[] appids=new int[size];
  for (int i=0; i < size; i++) {
    appids[i]=mPowerSaveWhitelistAllAppIds.keyAt(i);
  }
  mPowerSaveWhitelistAllAppIdArray=appids;
  if (mLocalPowerManager != null) {
    if (DEBUG) {
      Slog.d(TAG,"String_Node_Str" + Arrays.toString(mPowerSaveWhitelistAllAppIdArray));
    }
    mLocalPowerManager.setDeviceIdleWhitelist(mPowerSaveWhitelistAllAppIdArray);
  }
}
Program: 194556
Project: 194556
Buggy source:
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}

Fixed version (ground truth):
/** 
 * Adds an app to the temporary whitelist and resets the endTime for granting the app an exemption to access network and acquire wakelocks.
 */
public void addPowerSaveTempWhitelistAppInternal(int callingUid,String packageName,long duration,int userId){
  try {
    int uid=getContext().getPackageManager().getPackageUid(packageName,userId);
    int appId=UserHandle.getAppId(uid);
    addPowerSaveTempWhitelistAppDirectInternal(callingUid,appId,duration);
  }
 catch (  NameNotFoundException e) {
  }
}
Program: 194557
Project: 194557
Buggy source:
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAppIdArray;
  }
}

Fixed version (ground truth):
public int[] getAppIdWhitelistInternal(){
synchronized (this) {
    return mPowerSaveWhitelistAllAppIdArray;
  }
}
Program: 194560
Project: 194560
Buggy source:
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_IDLE_OFF:
{
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  if (DEBUG)   Slog.d(TAG,"String_Node_Str" + msg.what + "String_Node_Str");
switch (msg.what) {
case MSG_WRITE_CONFIG:
{
      handleWriteConfigFile();
    }
  break;
case MSG_REPORT_IDLE_ON:
{
  EventLogTags.writeDeviceIdleOnStart();
  mLocalPowerManager.setDeviceIdleMode(true);
  try {
    mNetworkPolicyManager.setDeviceIdleMode(true);
    mBatteryStats.noteDeviceIdleMode(true,null,Process.myUid());
  }
 catch (  RemoteException e) {
  }
  getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
  EventLogTags.writeDeviceIdleOnComplete();
}
break;
case MSG_REPORT_IDLE_OFF:
{
EventLogTags.writeDeviceIdleOffStart("String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,null,Process.myUid());
}
 catch (RemoteException e) {
}
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_REPORT_ACTIVE:
{
String activeReason=(String)msg.obj;
int activeUid=msg.arg1;
boolean needBroadcast=msg.arg2 != 0;
EventLogTags.writeDeviceIdleOffStart(activeReason != null ? activeReason : "String_Node_Str");
mLocalPowerManager.setDeviceIdleMode(false);
try {
mNetworkPolicyManager.setDeviceIdleMode(false);
mBatteryStats.noteDeviceIdleMode(false,activeReason,activeUid);
}
 catch (RemoteException e) {
}
if (needBroadcast) {
getContext().sendBroadcastAsUser(mIdleIntent,UserHandle.ALL);
}
EventLogTags.writeDeviceIdleOffComplete();
}
break;
case MSG_TEMP_APP_WHITELIST_TIMEOUT:
{
int uid=msg.arg1;
checkTempAppWhitelistTimeout(uid);
}
break;
}
}
Program: 194561
Project: 194561
Buggy source:
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),Binder.getCallingUid(),userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}

Fixed version (ground truth):
@Override public void addPowerSaveTempWhitelistApp(String packageName,long duration,int userId) throws RemoteException {
  getContext().enforceCallingPermission(Manifest.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST,"String_Node_Str");
  final int callingUid=Binder.getCallingUid();
  userId=ActivityManagerNative.getDefault().handleIncomingUser(Binder.getCallingPid(),callingUid,userId,false,false,"String_Node_Str",null);
  final long token=Binder.clearCallingIdentity();
  try {
    DeviceIdleController.this.addPowerSaveTempWhitelistAppInternal(callingUid,packageName,duration,userId);
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}
Program: 194562
Project: 194562
Buggy source:
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  DeviceIdleController.this.addPowerSaveTempWhitelistAppDirectInternal(appId,duration);
}

Fixed version (ground truth):
public void addPowerSaveTempWhitelistAppDirect(int appId,long duration){
  addPowerSaveTempWhitelistAppDirectInternal(0,appId,duration);
}
Program: 194575
Project: 194575
Buggy source:
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    mUpdateMonitor.registerCallback(mUpdateCallback);
    doKeyguardLocked(null);
  }
  maybeSendUserPresentBroadcast();
}

Fixed version (ground truth):
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    doKeyguardLocked(null);
    mUpdateMonitor.registerCallback(mUpdateCallback);
  }
  maybeSendUserPresentBroadcast();
}
Program: 194576
Project: 194576
Buggy source:
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  ensureView();
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}
Program: 194577
Project: 194577
Buggy source:
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mAnimateKeyguardFadingOut=false;
  mDurationOverride=-1;
  mAnimationDelay=0;
  if (!mAnimationStarted && mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mAnimationStarted=false;
  return true;
}

Fixed version (ground truth):
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mDurationOverride=-1;
  mAnimationDelay=0;
  endAnimateKeyguardFadingOut();
  mAnimationStarted=false;
  return true;
}
Program: 194578
Project: 194578
Buggy source:
/** 
 * Show the keyguard.  Will handle creating and attaching to the view manager lazily.
 */
public void show(Bundle options){
  mShowing=true;
  mStatusBarWindowManager.setKeyguardShowing(true);
  reset();
}

Fixed version (ground truth):
/** 
 * Show the keyguard.  Will handle creating and attaching to the view manager lazily.
 */
public void show(Bundle options){
  mShowing=true;
  mStatusBarWindowManager.setKeyguardShowing(true);
  mScrimController.abortKeyguardFadingOut();
  reset();
}
Program: 194579
Project: 194579
Buggy source:
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    mUpdateMonitor.registerCallback(mUpdateCallback);
    doKeyguardLocked(null);
  }
  maybeSendUserPresentBroadcast();
}

Fixed version (ground truth):
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    doKeyguardLocked(null);
    mUpdateMonitor.registerCallback(mUpdateCallback);
  }
  maybeSendUserPresentBroadcast();
}
Program: 194580
Project: 194580
Buggy source:
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  ensureView();
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}
Program: 194581
Project: 194581
Buggy source:
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mAnimateKeyguardFadingOut=false;
  mDurationOverride=-1;
  mAnimationDelay=0;
  if (!mAnimationStarted && mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mAnimationStarted=false;
  return true;
}

Fixed version (ground truth):
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mDurationOverride=-1;
  mAnimationDelay=0;
  endAnimateKeyguardFadingOut();
  mAnimationStarted=false;
  return true;
}
Program: 194582
Project: 194582
Buggy source:
/** 
 * Show the keyguard.  Will handle creating and attaching to the view manager lazily.
 */
public void show(Bundle options){
  mShowing=true;
  mStatusBarWindowManager.setKeyguardShowing(true);
  reset();
}

Fixed version (ground truth):
/** 
 * Show the keyguard.  Will handle creating and attaching to the view manager lazily.
 */
public void show(Bundle options){
  mShowing=true;
  mStatusBarWindowManager.setKeyguardShowing(true);
  mScrimController.abortKeyguardFadingOut();
  reset();
}
Program: 194583
Project: 194583
Buggy source:
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    mUpdateMonitor.registerCallback(mUpdateCallback);
    doKeyguardLocked(null);
  }
  maybeSendUserPresentBroadcast();
}

Fixed version (ground truth):
/** 
 * Let us know that the system is ready after startup.
 */
public void onSystemReady(){
  mSearchManager=(SearchManager)mContext.getSystemService(Context.SEARCH_SERVICE);
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mSystemReady=true;
    doKeyguardLocked(null);
    mUpdateMonitor.registerCallback(mUpdateCallback);
  }
  maybeSendUserPresentBroadcast();
}
Program: 194584
Project: 194584
Buggy source:
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return True if and only if the security method should be shown before showing thenotifications on Keyguard, like SIM PIN/PUK.
 */
public boolean needsFullscreenBouncer(){
  ensureView();
  if (mKeyguardView != null) {
    SecurityMode mode=mKeyguardView.getSecurityMode();
    return mode == SecurityMode.SimPin || mode == SecurityMode.SimPuk;
  }
  return false;
}
Program: 194585
Project: 194585
Buggy source:
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mAnimateKeyguardFadingOut=false;
  mDurationOverride=-1;
  mAnimationDelay=0;
  if (!mAnimationStarted && mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mAnimationStarted=false;
  return true;
}

Fixed version (ground truth):
@Override public boolean onPreDraw(){
  mScrimBehind.getViewTreeObserver().removeOnPreDrawListener(this);
  mUpdatePending=false;
  updateScrims();
  mDurationOverride=-1;
  mAnimationDelay=0;
  endAnimateKeyguardFadingOut();
  mAnimationStarted=false;
  return true;
}