Program: 196974
Project: 196974
Buggy source:
@Override public int enableSystemAppWithIntent(ComponentName who,Intent intent){
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);
      IPackageManager pm=AppGlobals.getPackageManager();
      List<ResolveInfo> activitiesToEnable=pm.queryIntentActivities(intent,intent.resolveTypeIfNeeded(mContext.getContentResolver()),0,primaryUser.id);
      if (DBG)       Slog.d(LOG_TAG,"String_Node_Str" + activitiesToEnable);
      int numberOfAppsInstalled=0;
      if (activitiesToEnable != null) {
        for (        ResolveInfo info : activitiesToEnable) {
          if (info.activityInfo != null) {
            if (!isSystemApp(pm,info.activityInfo.packageName,primaryUser.id)) {
              throw new IllegalArgumentException("String_Node_Str");
            }
            numberOfAppsInstalled++;
            pm.installExistingPackageAsUser(info.activityInfo.packageName,userId);
          }
        }
      }
      return numberOfAppsInstalled;
    }
 catch (    RemoteException e) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + intent);
      return 0;
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}

Fixed version (ground truth):
@Override public int enableSystemAppWithIntent(ComponentName who,Intent intent){
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);
      UserInfo primaryUser=um.getProfileParent(userId);
      if (primaryUser == null) {
        primaryUser=um.getUserInfo(userId);
      }
      IPackageManager pm=AppGlobals.getPackageManager();
      List<ResolveInfo> activitiesToEnable=pm.queryIntentActivities(intent,intent.resolveTypeIfNeeded(mContext.getContentResolver()),0,primaryUser.id);
      if (DBG)       Slog.d(LOG_TAG,"String_Node_Str" + activitiesToEnable);
      int numberOfAppsInstalled=0;
      if (activitiesToEnable != null) {
        for (        ResolveInfo info : activitiesToEnable) {
          if (info.activityInfo != null) {
            if (!isSystemApp(pm,info.activityInfo.packageName,primaryUser.id)) {
              throw new IllegalArgumentException("String_Node_Str");
            }
            numberOfAppsInstalled++;
            pm.installExistingPackageAsUser(info.activityInfo.packageName,userId);
          }
        }
      }
      return numberOfAppsInstalled;
    }
 catch (    RemoteException e) {
      Slog.wtf(LOG_TAG,"String_Node_Str" + intent);
      return 0;
    }
 finally {
      restoreCallingIdentity(id);
    }
  }
}