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

Commit 2827bd6b authored by Dennis Shen's avatar Dennis Shen Committed by Automerger Merge Worker
Browse files

Merge "Remove new storage test mission marker file code now that new storage...

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

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3379866



Change-Id: I5367808e5c802206ad37016e0d94cc5e3570de7e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 08c4bdd0 27ea7e68
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.
     */
@@ -1753,32 +1748,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, Long.valueOf(id), isPreservedInRestore));