summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelena Josol <helenajosol@google.com>2014-10-20 10:24:56 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-20 10:24:56 +0000
commit65ee3174592012f2718838610dc94fbcd3b8c369 (patch)
tree7f55e32b2f9bb9e8a34ca29c63c02fc3776fcac5
parent99bec5116ddd2f9e56e9a6abfee9b54687529bd9 (diff)
parentd37a1f5abec5a442508d850a0e26c96ece225f91 (diff)
downloadandroid_packages_apps_Trebuchet-65ee3174592012f2718838610dc94fbcd3b8c369.tar.gz
android_packages_apps_Trebuchet-65ee3174592012f2718838610dc94fbcd3b8c369.tar.bz2
android_packages_apps_Trebuchet-65ee3174592012f2718838610dc94fbcd3b8c369.zip
am d37a1f5a: Merge "Add more Launcher files to delete on Clear Launcher Data" into ub-now-queens
* commit 'd37a1f5abec5a442508d850a0e26c96ece225f91': Add more Launcher files to delete on Clear Launcher Data
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java2
-rw-r--r--WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java10
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/LauncherAppState.java3
-rw-r--r--src/com/android/launcher3/LauncherFiles.java21
-rw-r--r--src/com/android/launcher3/Stats.java14
6 files changed, 33 insertions, 23 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
index d5c7cd93d..fa8ec64c2 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperCropActivity.java
@@ -202,7 +202,7 @@ public class WallpaperCropActivity extends Activity {
}
public static String getSharedPreferencesKey() {
- return WallpaperCropActivity.class.getName();
+ return LauncherFiles.WALLPAPER_CROP_PREFERENCES_KEY;
}
// As a ratio of screen height, the total distance we want the parallax effect to span
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index 07285372e..09e096396 100644
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -86,8 +86,6 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
public static final int PICK_LIVE_WALLPAPER = 7;
private static final String TEMP_WALLPAPER_TILES = "TEMP_WALLPAPER_TILES";
private static final String SELECTED_INDEX = "SELECTED_INDEX";
- private static final String OLD_DEFAULT_WALLPAPER_THUMBNAIL_FILENAME = "default_thumb.jpg";
- private static final String DEFAULT_WALLPAPER_THUMBNAIL_FILENAME = "default_thumb2.jpg";
private static final int FLAG_POST_DELAY_MILLIS = 200;
private View mSelectedTile;
@@ -999,16 +997,16 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private File getDefaultThumbFile() {
return new File(getFilesDir(), Build.VERSION.SDK_INT
- + "_" + DEFAULT_WALLPAPER_THUMBNAIL_FILENAME);
+ + "_" + LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL);
}
private boolean saveDefaultWallpaperThumb(Bitmap b) {
// Delete old thumbnails.
- new File(getFilesDir(), OLD_DEFAULT_WALLPAPER_THUMBNAIL_FILENAME).delete();
- new File(getFilesDir(), DEFAULT_WALLPAPER_THUMBNAIL_FILENAME).delete();
+ new File(getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL_OLD).delete();
+ new File(getFilesDir(), LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete();
for (int i = Build.VERSION_CODES.JELLY_BEAN; i < Build.VERSION.SDK_INT; i++) {
- new File(getFilesDir(), i + "_" + DEFAULT_WALLPAPER_THUMBNAIL_FILENAME).delete();
+ new File(getFilesDir(), i + "_" + LauncherFiles.DEFAULT_WALLPAPER_THUMBNAIL).delete();
}
return writeImageToFileAsJpeg(getDefaultThumbFile(), b);
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 2c495d6b4..d5cb55b03 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -648,7 +648,7 @@ public class Launcher extends Activity
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();
@@ -671,7 +671,7 @@ public class Launcher extends Activity
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);
@@ -680,7 +680,7 @@ public class Launcher extends Activity
// 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 246278fa2..893d49fcc 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -36,7 +36,6 @@ import java.util.ArrayList;
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 class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks {
}
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 89600c2df..fa053650f 100644
--- a/src/com/android/launcher3/LauncherFiles.java
+++ b/src/com/android/launcher3/LauncherFiles.java
@@ -12,16 +12,29 @@ import java.util.List;
*/
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 f3977e456..a87986562 100644
--- a/src/com/android/launcher3/Stats.java
+++ b/src/com/android/launcher3/Stats.java
@@ -38,12 +38,10 @@ public class Stats {
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 @@ public class Stats {
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 @@ public class Stats {
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 @@ public class Stats {
}
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 @@ public class Stats {
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();