Program: 192664
Project: 192664
Buggy source:
/** 
 * We didn't use to persist user restrictions for each owners but only persisted in user manager.
 */
private void migrateUserRestrictionsIfNecessaryLocked(){
  boolean migrated=false;
  if (mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()) {
    if (VERBOSE_LOG) {
      Log.v(LOG_TAG,"String_Node_Str");
    }
    migrated=true;
    final ActiveAdmin deviceOwnerAdmin=getDeviceOwnerAdminLocked();
    migrateUserRestrictionsForUser(UserHandle.SYSTEM,deviceOwnerAdmin,null);
    pushUserRestrictions(UserHandle.USER_SYSTEM);
    mOwners.setDeviceOwnerUserRestrictionsMigrated();
  }
  final Set<String> normalExceptionList=Sets.newArraySet(UserManager.DISALLOW_OUTGOING_CALLS,UserManager.DISALLOW_SMS);
  final Set<String> managedExceptionList=new ArraySet<>(normalExceptionList.size() + 1);
  managedExceptionList.addAll(normalExceptionList);
  managedExceptionList.add(UserManager.DISALLOW_WALLPAPER);
  for (  UserInfo ui : mUserManager.getUsers()) {
    final int userId=ui.id;
    if (mOwners.getProfileOwnerUserRestrictionsNeedsMigration(userId)) {
      if (userId != UserHandle.USER_SYSTEM) {
        if (VERBOSE_LOG) {
          Log.v(LOG_TAG,"String_Node_Str" + userId);
        }
        migrated=true;
        final ActiveAdmin profileOwnerAdmin=getProfileOwnerAdminLocked(userId);
        final Set<String> exceptionList=ui.isManagedProfile() ? managedExceptionList : normalExceptionList;
        migrateUserRestrictionsForUser(ui.getUserHandle(),profileOwnerAdmin,exceptionList);
        pushUserRestrictions(userId);
      }
      mOwners.setProfileOwnerUserRestrictionsMigrated(userId);
    }
  }
  if (VERBOSE_LOG && migrated) {
    Log.v(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * We didn't use to persist user restrictions for each owners but only persisted in user manager.
 */
private void migrateUserRestrictionsIfNecessaryLocked(){
  boolean migrated=false;
  if (mOwners.getDeviceOwnerUserRestrictionsNeedsMigration()) {
    if (VERBOSE_LOG) {
      Log.v(LOG_TAG,"String_Node_Str");
    }
    migrated=true;
    final ActiveAdmin deviceOwnerAdmin=getDeviceOwnerAdminLocked();
    migrateUserRestrictionsForUser(UserHandle.SYSTEM,deviceOwnerAdmin,null,true);
    pushUserRestrictions(UserHandle.USER_SYSTEM);
    mOwners.setDeviceOwnerUserRestrictionsMigrated();
  }
  final Set<String> secondaryUserExceptionList=Sets.newArraySet(UserManager.DISALLOW_OUTGOING_CALLS,UserManager.DISALLOW_SMS);
  for (  UserInfo ui : mUserManager.getUsers()) {
    final int userId=ui.id;
    if (mOwners.getProfileOwnerUserRestrictionsNeedsMigration(userId)) {
      if (VERBOSE_LOG) {
        Log.v(LOG_TAG,"String_Node_Str" + userId);
      }
      migrated=true;
      final ActiveAdmin profileOwnerAdmin=getProfileOwnerAdminLocked(userId);
      final Set<String> exceptionList=(userId == UserHandle.USER_SYSTEM) ? null : secondaryUserExceptionList;
      migrateUserRestrictionsForUser(ui.getUserHandle(),profileOwnerAdmin,exceptionList,false);
      pushUserRestrictions(userId);
      mOwners.setProfileOwnerUserRestrictionsMigrated(userId);
    }
  }
  if (VERBOSE_LOG && migrated) {
    Log.v(LOG_TAG,"String_Node_Str");
  }
}