Create a central list of files the Launcher writes to the app directory
Replace hardcoded Launcher filenames with the defined constants.
Bug: 12753154
Change-Id: I072f202d9388a703b9e6851bde64ea7fafe4b10a
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 6780812..4a39e0a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -168,7 +168,6 @@
static final int SCREEN_COUNT = 5;
static final int DEFAULT_SCREEN = 2;
- private static final String PREFERENCES = "launcher.preferences";
// To turn on these properties, type
// adb shell setprop log.tag.PROPERTY_NAME [VERBOSE | SUPPRESS]
static final String FORCE_ENABLE_ROTATION_PROPERTY = "launcher_force_rotate";
@@ -620,7 +619,7 @@
private static void readConfiguration(Context context, LocaleConfiguration configuration) {
DataInputStream in = null;
try {
- in = new DataInputStream(context.openFileInput(PREFERENCES));
+ in = new DataInputStream(context.openFileInput(LauncherFiles.LAUNCHER_PREFS));
configuration.locale = in.readUTF();
configuration.mcc = in.readInt();
configuration.mnc = in.readInt();
@@ -642,7 +641,8 @@
private static void writeConfiguration(Context context, LocaleConfiguration configuration) {
DataOutputStream out = null;
try {
- out = new DataOutputStream(context.openFileOutput(PREFERENCES, MODE_PRIVATE));
+ out = new DataOutputStream(context.openFileOutput(
+ LauncherFiles.LAUNCHER_PREFS, MODE_PRIVATE));
out.writeUTF(configuration.locale);
out.writeInt(configuration.mcc);
out.writeInt(configuration.mnc);
@@ -651,7 +651,7 @@
// Ignore
} catch (IOException e) {
//noinspection ResultOfMethodCallIgnored
- context.getFileStreamPath(PREFERENCES).delete();
+ context.getFileStreamPath(LauncherFiles.LAUNCHER_PREFS).delete();
} finally {
if (out != null) {
try {