nus-yam/ex-repair huggingface dataset:
Program: 197398
Project: 197398
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197399
Project: 197399
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197400
Project: 197400
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197401
Project: 197401
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197402
Project: 197402
Buggy source:
public boolean isSleepingOrShuttingDown(){
  return mSleeping || mShuttingDown;
}

Fixed version (ground truth):
public boolean isSleepingOrShuttingDown(){
  return isSleeping() || mShuttingDown;
}
Program: 197403
Project: 197403
Buggy source:
void goToSleepIfNeededLocked(){
  if (mWentToSleep && !mRunningVoice) {
    if (!mSleeping) {
      mSleeping=true;
      mStackSupervisor.goingToSleepLocked();
      checkExcessivePowerUsageLocked(false);
      mHandler.removeMessages(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
      Message nmsg=mHandler.obtainMessage(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
      mHandler.sendMessageDelayed(nmsg,POWER_CHECK_DELAY);
    }
  }
}

Fixed version (ground truth):
void goToSleepIfNeededLocked(){
  if (mWentToSleep && !mRunningVoice) {
    if (!mSleeping) {
      mSleeping=true;
      mKeyguardWaitingForDraw=false;
      mStackSupervisor.goingToSleepLocked();
      checkExcessivePowerUsageLocked(false);
      mHandler.removeMessages(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
      Message nmsg=mHandler.obtainMessage(CHECK_EXCESSIVE_WAKE_LOCKS_MSG);
      mHandler.sendMessageDelayed(nmsg,POWER_CHECK_DELAY);
    }
  }
}
Program: 197404
Project: 197404
Buggy source:
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    long ident=Binder.clearCallingIdentity();
    try {
      if (DEBUG_LOCKSCREEN)       logLockScreen("String_Node_Str" + shown);
      mLockScreenShown=shown;
      comeOutOfSleepIfNeededLocked();
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
  }
}

Fixed version (ground truth):
public void setLockScreenShown(boolean shown){
  if (checkCallingPermission(android.Manifest.permission.DEVICE_POWER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str" + android.Manifest.permission.DEVICE_POWER);
  }
synchronized (this) {
    long ident=Binder.clearCallingIdentity();
    try {
      if (DEBUG_LOCKSCREEN)       logLockScreen("String_Node_Str" + shown);
      mLockScreenShown=shown;
      mKeyguardWaitingForDraw=false;
      comeOutOfSleepIfNeededLocked();
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
  }
}
Program: 197405
Project: 197405
Buggy source:
public boolean isSleeping(){
  return mSleeping;
}

Fixed version (ground truth):
public boolean isSleeping(){
  return mSleeping && !mKeyguardWaitingForDraw;
}
Program: 197406
Project: 197406
Buggy source:
@Override public void keyguardWaitingForActivityDrawn(){
  enforceNotIsolatedCaller("String_Node_Str");
  final long token=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (DEBUG_LOCKSCREEN)       logLockScreen("String_Node_Str");
      mWindowManager.keyguardWaitingForActivityDrawn();
    }
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}

Fixed version (ground truth):
@Override public void keyguardWaitingForActivityDrawn(){
  enforceNotIsolatedCaller("String_Node_Str");
  final long token=Binder.clearCallingIdentity();
  try {
synchronized (this) {
      if (DEBUG_LOCKSCREEN)       logLockScreen("String_Node_Str");
      mWindowManager.keyguardWaitingForActivityDrawn();
      mKeyguardWaitingForDraw=true;
    }
  }
  finally {
    Binder.restoreCallingIdentity(token);
  }
}
Program: 197407
Project: 197407
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197408
Project: 197408
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197409
Project: 197409
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197410
Project: 197410
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197411
Project: 197411
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197412
Project: 197412
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197413
Project: 197413
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197414
Project: 197414
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197415
Project: 197415
Buggy source:
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  HashMap<String,Ops> pkgOps=mUidOps.get(uid);
  if (pkgOps == null) {
    if (!edit) {
      return null;
    }
    pkgOps=new HashMap<String,Ops>();
    mUidOps.put(uid,pkgOps);
  }
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  Ops ops=pkgOps.get(packageName);
  if (ops == null) {
    if (!edit) {
      return null;
    }
    boolean isPrivileged=false;
    if (uid != 0) {
      final long ident=Binder.clearCallingIdentity();
      try {
        int pkgUid=-1;
        try {
          ApplicationInfo appInfo=ActivityThread.getPackageManager().getApplicationInfo(packageName,0,UserHandle.getUserId(uid));
          if (appInfo != null) {
            pkgUid=appInfo.uid;
            isPrivileged=(appInfo.flags & ApplicationInfo.FLAG_PRIVILEGED) != 0;
          }
 else {
            if ("String_Node_Str".equals(packageName)) {
              pkgUid=Process.MEDIA_UID;
              isPrivileged=false;
            }
          }
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str",e);
        }
        if (pkgUid != uid) {
          Slog.w(TAG,"String_Node_Str" + packageName + "String_Node_Str"+ uid+ "String_Node_Str"+ pkgUid);
          return null;
        }
      }
  finally {
        Binder.restoreCallingIdentity(ident);
      }
    }
    ops=new Ops(packageName,uid,isPrivileged);
    pkgOps.put(packageName,ops);
  }
  return ops;
}

Fixed version (ground truth):
private Ops getOpsLocked(int uid,String packageName,boolean edit){
  if (uid == 0) {
    packageName="String_Node_Str";
  }
 else   if (uid == Process.SHELL_UID) {
    packageName="String_Node_Str";
  }
  return getOpsRawLocked(uid,packageName,edit);
}
Program: 197416
Project: 197416
Buggy source:
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}

Fixed version (ground truth):
@Override public int checkPackage(int uid,String packageName){
synchronized (this) {
    if (getOpsRawLocked(uid,packageName,true) != null) {
      return AppOpsManager.MODE_ALLOWED;
    }
 else {
      return AppOpsManager.MODE_ERRORED;
    }
  }
}
Program: 197419
Project: 197419
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197420
Project: 197420
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197421
Project: 197421
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197422
Project: 197422
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197423
Project: 197423
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197424
Project: 197424
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197425
Project: 197425
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197427
Project: 197427
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197432
Project: 197432
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197434
Project: 197434
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197437
Project: 197437
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197438
Project: 197438
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197439
Project: 197439
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197440
Project: 197440
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197445
Project: 197445
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197447
Project: 197447
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197450
Project: 197450
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197457
Project: 197457
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}