Add more Launcher files to delete on Clear Launcher Data

Bug: 12753154
Change-Id: I00679bdc6eff70a1398122aaa955c08eabd556b1
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index ec1c0aa..be9f268 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -616,7 +616,7 @@
     private static void readConfiguration(Context context, LocaleConfiguration configuration) {
         DataInputStream in = null;
         try {
-            in = new DataInputStream(context.openFileInput(LauncherFiles.LAUNCHER_PREFS));
+            in = new DataInputStream(context.openFileInput(LauncherFiles.LAUNCHER_PREFERENCES));
             configuration.locale = in.readUTF();
             configuration.mcc = in.readInt();
             configuration.mnc = in.readInt();
@@ -639,7 +639,7 @@
         DataOutputStream out = null;
         try {
             out = new DataOutputStream(context.openFileOutput(
-                    LauncherFiles.LAUNCHER_PREFS, MODE_PRIVATE));
+                    LauncherFiles.LAUNCHER_PREFERENCES, MODE_PRIVATE));
             out.writeUTF(configuration.locale);
             out.writeInt(configuration.mcc);
             out.writeInt(configuration.mnc);
@@ -648,7 +648,7 @@
             // Ignore
         } catch (IOException e) {
             //noinspection ResultOfMethodCallIgnored
-            context.getFileStreamPath(LauncherFiles.LAUNCHER_PREFS).delete();
+            context.getFileStreamPath(LauncherFiles.LAUNCHER_PREFERENCES).delete();
         } finally {
             if (out != null) {
                 try {
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 246278f..893d49f 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -36,7 +36,6 @@
 
 public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
     private static final String TAG = "LauncherAppState";
-    private static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
 
     private static final boolean DEBUG = false;
 
@@ -186,7 +185,7 @@
     }
 
     public static String getSharedPreferencesKey() {
-        return SHARED_PREFERENCES_KEY;
+        return LauncherFiles.SHARED_PREFERENCES_KEY;
     }
 
     DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight,
diff --git a/src/com/android/launcher3/LauncherFiles.java b/src/com/android/launcher3/LauncherFiles.java
index 89600c2..fa05365 100644
--- a/src/com/android/launcher3/LauncherFiles.java
+++ b/src/com/android/launcher3/LauncherFiles.java
@@ -12,16 +12,29 @@
  */
 public class LauncherFiles {
 
-    public static final String SHARED_PREFS = "com.android.launcher3.prefs.xml";
+    private static final String XML = ".xml";
+
+    public static final String DEFAULT_WALLPAPER_THUMBNAIL = "default_thumb2.jpg";
+    public static final String DEFAULT_WALLPAPER_THUMBNAIL_OLD = "default_thumb.jpg";
     public static final String LAUNCHER_DB = "launcher.db";
-    public static final String LAUNCHER_PREFS = "launcher.preferences";
+    public static final String LAUNCHER_PREFERENCES = "launcher.preferences";
+    public static final String LAUNCHES_LOG = "launches.log";
+    public static final String SHARED_PREFERENCES_KEY = "com.android.launcher3.prefs";
+    public static final String STATS_LOG = "stats.log";
+    public static final String WALLPAPER_CROP_PREFERENCES_KEY =
+            WallpaperCropActivity.class.getName();
     public static final String WALLPAPER_IMAGES_DB = "saved_wallpaper_images.db";
     public static final String WIDGET_PREVIEWS_DB = "widgetpreviews.db";
 
     public static final List<String> ALL_FILES = Collections.unmodifiableList(Arrays.asList(
-            SHARED_PREFS,
+            DEFAULT_WALLPAPER_THUMBNAIL,
+            DEFAULT_WALLPAPER_THUMBNAIL_OLD,
             LAUNCHER_DB,
-            LAUNCHER_PREFS,
+            LAUNCHER_PREFERENCES,
+            LAUNCHES_LOG,
+            SHARED_PREFERENCES_KEY + XML,
+            STATS_LOG,
+            WALLPAPER_CROP_PREFERENCES_KEY + XML,
             WALLPAPER_IMAGES_DB,
             WIDGET_PREVIEWS_DB));
 }
diff --git a/src/com/android/launcher3/Stats.java b/src/com/android/launcher3/Stats.java
index f3977e4..a879865 100644
--- a/src/com/android/launcher3/Stats.java
+++ b/src/com/android/launcher3/Stats.java
@@ -38,12 +38,10 @@
     public static final String EXTRA_CELLX = "cellX";
     public static final String EXTRA_CELLY = "cellY";
 
-    private static final String LOG_FILE_NAME = "launches.log";
     private static final int LOG_VERSION = 1;
     private static final int LOG_TAG_VERSION = 0x1;
     private static final int LOG_TAG_LAUNCH = 0x1000;
 
-    private static final String STATS_FILE_NAME = "stats.log";
     private static final int STATS_VERSION = 1;
     private static final int INITIAL_STATS_SIZE = 100;
 
@@ -69,7 +67,8 @@
 
         if (LOCAL_LAUNCH_LOG) {
             try {
-                mLog = new DataOutputStream(mLauncher.openFileOutput(LOG_FILE_NAME, Context.MODE_APPEND));
+                mLog = new DataOutputStream(mLauncher.openFileOutput(
+                        LauncherFiles.LAUNCHES_LOG, Context.MODE_APPEND));
                 mLog.writeInt(LOG_TAG_VERSION);
                 mLog.writeInt(LOG_VERSION);
             } catch (FileNotFoundException e) {
@@ -160,7 +159,8 @@
     private void saveStats() {
         DataOutputStream stats = null;
         try {
-            stats = new DataOutputStream(mLauncher.openFileOutput(STATS_FILE_NAME + ".tmp", Context.MODE_PRIVATE));
+            stats = new DataOutputStream(mLauncher.openFileOutput(
+                    LauncherFiles.STATS_LOG + ".tmp", Context.MODE_PRIVATE));
             stats.writeInt(STATS_VERSION);
             final int N = mHistogram.size();
             stats.writeInt(N);
@@ -170,8 +170,8 @@
             }
             stats.close();
             stats = null;
-            mLauncher.getFileStreamPath(STATS_FILE_NAME + ".tmp")
-                     .renameTo(mLauncher.getFileStreamPath(STATS_FILE_NAME));
+            mLauncher.getFileStreamPath(LauncherFiles.STATS_LOG + ".tmp")
+                     .renameTo(mLauncher.getFileStreamPath(LauncherFiles.STATS_LOG));
         } catch (FileNotFoundException e) {
             Log.e(TAG, "unable to create stats data: " + e);
         } catch (IOException e) {
@@ -190,7 +190,7 @@
         mHistogram = new ArrayList<Integer>(INITIAL_STATS_SIZE);
         DataInputStream stats = null;
         try {
-            stats = new DataInputStream(mLauncher.openFileInput(STATS_FILE_NAME));
+            stats = new DataInputStream(mLauncher.openFileInput(LauncherFiles.STATS_LOG));
             final int version = stats.readInt();
             if (version == STATS_VERSION) {
                 final int N = stats.readInt();