nus-yam/ex-repair huggingface dataset:
Program: 196955
Project: 196955
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196957
Project: 196957
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196958
Project: 196958
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196960
Project: 196960
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196961
Project: 196961
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196963
Project: 196963
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196964
Project: 196964
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196966
Project: 196966
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196967
Project: 196967
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196969
Project: 196969
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196970
Project: 196970
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196971
Project: 196971
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196972
Project: 196972
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196973
Project: 196973
Buggy source:
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      UserManager um=UserManager.get(mContext);
      if (!um.getUserInfo(userId).isManagedProfile()) {
        throw new IllegalStateException("String_Node_Str");
      }
      UserInfo primaryUser=um.getProfileParent(userId);
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public void enableSystemApp(ComponentName who,String packageName){
synchronized (this) {
    if (who == null) {
      throw new NullPointerException("String_Node_Str");
    }
    getActiveAdminForCallerLocked(who,DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
    int userId=UserHandle.getCallingUserId();
    long id=Binder.clearCallingIdentity();
    try {
      if (DBG) {
        Slog.v(LOG_TAG,"String_Node_Str" + packageName + "String_Node_Str"+ userId);
      }
      UserManager um=UserManager.get(mContext);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      if (!isSystemApp(pm,packageName,primaryUser.id)) {
        throw new IllegalArgumentException("String_Node_Str");
      }
      pm.installExistingPackageAsUser(packageName,userId);
    }
 catch (    RemoteException re) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + packageName,re);
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}
Program: 196975
Project: 196975
Buggy source:
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,0,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}

Fixed version (ground truth):
private boolean isSystemApp(IPackageManager pm,String packageName,int userId) throws RemoteException {
  ApplicationInfo appInfo=pm.getApplicationInfo(packageName,GET_UNINSTALLED_PACKAGES,userId);
  return (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) > 0;
}
Program: 196976
Project: 196976
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196977
Project: 196977
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196978
Project: 196978
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196979
Project: 196979
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196980
Project: 196980
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196981
Project: 196981
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196982
Project: 196982
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196983
Project: 196983
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196984
Project: 196984
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196985
Project: 196985
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196986
Project: 196986
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196987
Project: 196987
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196988
Project: 196988
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196989
Project: 196989
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196990
Project: 196990
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}
Program: 196991
Project: 196991
Buggy source:
public static ApplicationInfo generateApplicationInfo(Package p,int flags,PackageUserState state,int userId){
  if (p == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,p,state,null,userId) && ((flags & PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS) == 0 || state.enabled != PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED)) {
    updateApplicationInfo(p.applicationInfo,flags,state);
    return p.applicationInfo;
  }
  ApplicationInfo ai=new ApplicationInfo(p.applicationInfo);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if ((flags & PackageManager.GET_META_DATA) != 0) {
    ai.metaData=p.mAppMetaData;
  }
  if ((flags & PackageManager.GET_SHARED_LIBRARY_FILES) != 0) {
    ai.sharedLibraryFiles=p.usesLibraryFiles;
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}

Fixed version (ground truth):
public static ApplicationInfo generateApplicationInfo(ApplicationInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ApplicationInfo(ai);
  if (userId != 0) {
    ai.uid=UserHandle.getUid(userId,ai.uid);
    ai.dataDir=PackageManager.getDataDirForUser(userId,ai.packageName);
  }
  if (state.stopped) {
    ai.flags|=ApplicationInfo.FLAG_STOPPED;
  }
 else {
    ai.flags&=~ApplicationInfo.FLAG_STOPPED;
  }
  updateApplicationInfo(ai,flags,state);
  return ai;
}
Program: 196992
Project: 196992
Buggy source:
public static final ActivityInfo generateActivityInfo(Activity a,int flags,PackageUserState state,int userId){
  if (a == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  if (!copyNeeded(flags,a.owner,state,a.metaData,userId)) {
    return a.info;
  }
  ActivityInfo ai=new ActivityInfo(a.info);
  ai.metaData=a.metaData;
  ai.applicationInfo=generateApplicationInfo(a.owner,flags,state,userId);
  return ai;
}

Fixed version (ground truth):
public static final ActivityInfo generateActivityInfo(ActivityInfo ai,int flags,PackageUserState state,int userId){
  if (ai == null)   return null;
  if (!checkUseInstalledOrHidden(flags,state)) {
    return null;
  }
  ai=new ActivityInfo(ai);
  ai.applicationInfo=generateApplicationInfo(ai.applicationInfo,flags,state,userId);
  return ai;
}
Program: 196993
Project: 196993
Buggy source:
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return mResolveActivity;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public ActivityInfo getActivityInfo(ComponentName component,int flags,int userId){
  if (!sUserManager.exists(userId))   return null;
  enforceCrossUserPermission(Binder.getCallingUid(),userId,false,false,"String_Node_Str");
synchronized (mPackages) {
    PackageParser.Activity a=mActivities.mActivities.get(component);
    if (DEBUG_PACKAGE_INFO)     Log.v(TAG,"String_Node_Str" + component + "String_Node_Str"+ a);
    if (a != null && mSettings.isEnabledLPr(a.info,flags,userId)) {
      PackageSetting ps=mSettings.mPackages.get(component.getPackageName());
      if (ps == null)       return null;
      return PackageParser.generateActivityInfo(a,flags,ps.readUserState(userId),userId);
    }
    if (mResolveComponentName.equals(component)) {
      return PackageParser.generateActivityInfo(mResolveActivity,flags,new PackageUserState(),userId);
    }
  }
  return null;
}