Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40f278ff authored by Eran Messeri's avatar Eran Messeri
Browse files

Refactoring: Rename logging method

Rename maybeLogPasswordComplexitySet to
logPasswordQualitySetIfSecurityLogEnabled because:
* It logs password quality, not password complexity (password quality
  being the deprecated way to set password requirements, complexity
  being the new way).
* "maybe" in the method name is less informative than
  "IfSecurityLogEnabled".

Bug: 165573442
Test: That it compiles
Change-Id: I8f900fd27d3b1412f0de0bf199b263ae3c29102b
parent 83348e38
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -3377,7 +3377,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                    updatePasswordQualityCacheForUserGroup(userId);
                    saveSettingsLocked(userId);
                }
                maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
                logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
            });
        }
        DevicePolicyEventLogger
@@ -3591,7 +3591,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_LENGTH)
@@ -3869,7 +3869,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_UPPER_CASE)
@@ -3899,7 +3899,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_LOWER_CASE)
@@ -3931,7 +3931,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_LETTERS)
@@ -3963,7 +3963,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_NUMERIC)
@@ -3995,7 +3995,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_SYMBOLS)
@@ -4028,7 +4028,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                updatePasswordValidityCheckpointLocked(userId, parent);
                saveSettingsLocked(userId);
            }
            maybeLogPasswordComplexitySet(who, userId, parent, passwordPolicy);
            logPasswordQualitySetIfSecurityLogEnabled(who, userId, parent, passwordPolicy);
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.SET_PASSWORD_MINIMUM_NON_LETTER)
@@ -14159,8 +14159,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        parametersFile.delete();
    }
    private void maybeLogPasswordComplexitySet(ComponentName who, int userId, boolean parent,
            PasswordPolicy passwordPolicy) {
    private void logPasswordQualitySetIfSecurityLogEnabled(ComponentName who, int userId,
            boolean parent, PasswordPolicy passwordPolicy) {
        if (SecurityLog.isLoggingEnabled()) {
            final int affectedUserId = parent ? getProfileParentId(userId) : userId;
            SecurityLog.writeEvent(SecurityLog.TAG_PASSWORD_COMPLEXITY_SET, who.getPackageName(),