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

Commit 27ea7e68 authored by Dennis Shen's avatar Dennis Shen Committed by Gerrit Code Review
Browse files

Merge "Remove new storage test mission marker file code now that new storage is launched" into main

parents d928b27d f235e5ba
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
@@ -178,11 +178,6 @@ final class SettingsState {
    private static final String APEX_DIR = "/apex";
    private static final String APEX_ACONFIG_PATH_SUFFIX = "/etc/aconfig_flags.pb";

    private static final String STORAGE_MIGRATION_FLAG =
            "core_experiments_team_internal/com.android.providers.settings.storage_test_mission_1";
    private static final String STORAGE_MIGRATION_MARKER_FILE =
            "/metadata/aconfig_test_missions/mission_1";

    /**
     * This tag is applied to all aconfig default value-loaded flags.
     */
@@ -1740,32 +1735,6 @@ final class SettingsState {
                    }
                }

                if (isConfigSettingsKey(mKey) && name != null
                        && name.equals(STORAGE_MIGRATION_FLAG)) {
                    if (value.equals("true")) {
                        Path path = Paths.get(STORAGE_MIGRATION_MARKER_FILE);
                        if (!Files.exists(path)) {
                            Files.createFile(path);
                        }

                        Set<PosixFilePermission> perms =
                                Files.readAttributes(path, PosixFileAttributes.class).permissions();
                        perms.add(PosixFilePermission.OWNER_WRITE);
                        perms.add(PosixFilePermission.OWNER_READ);
                        perms.add(PosixFilePermission.GROUP_READ);
                        perms.add(PosixFilePermission.OTHERS_READ);
                        try {
                            Files.setPosixFilePermissions(path, perms);
                        } catch (Exception e) {
                            Slog.e(LOG_TAG, "failed to set permissions on migration marker", e);
                        }
                    } else {
                        java.nio.file.Path path = Paths.get(STORAGE_MIGRATION_MARKER_FILE);
                        if (Files.exists(path)) {
                            Files.delete(path);
                        }
                    }
                }
                mSettings.put(name, new Setting(name, value, defaultValue, packageName, tag,
                        fromSystem, id, isPreservedInRestore));