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

Commit 6d5cc4fc authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[CDM] Remove mac address while storing last removed association." into main

parents 76c5bc86 f0511296
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -299,14 +299,24 @@ public final class AssociationDiskStore {
    public void writeLastRemovedAssociation(AssociationInfo association, String reason) {
        Slog.i(TAG, "Writing last removed association=" + association.getId() + " to disk...");

        // Remove indirect identifier i.e. Mac Address
        AssociationInfo.Builder builder = new AssociationInfo.Builder(association)
                .setDeviceMacAddress(null);
        // Set a placeholder display name if it's null because Mac Address and display name can't be
        // both null.
        if (association.getDisplayName() == null) {
            builder.setDisplayName("");
        }
        AssociationInfo redactedAssociation = builder.build();

        final AtomicFile file = createStorageFileForUser(
                association.getUserId(), FILE_NAME_LAST_REMOVED_ASSOCIATION);
                redactedAssociation.getUserId(), FILE_NAME_LAST_REMOVED_ASSOCIATION);
        writeToFileSafely(file, out -> {
            out.write(String.valueOf(System.currentTimeMillis()).getBytes());
            out.write(' ');
            out.write(reason.getBytes());
            out.write(' ');
            out.write(association.toString().getBytes());
            out.write(redactedAssociation.toString().getBytes());
        });
    }