Bug 872806 - (Part 2) Remove unnecessary distribution path shared pref. r=mfinkle

This commit is contained in:
Margaret Leibovic 2013-07-02 21:40:47 -07:00
parent 7523ec9754
commit ead93cff77

View File

@ -75,10 +75,6 @@ public final class Distribution {
File distDir = new File("/system/" + context.getPackageName() + "/distribution"); File distDir = new File("/system/" + context.getPackageName() + "/distribution");
if (distDir.exists()) { if (distDir.exists()) {
distributionSet = true; distributionSet = true;
// Store the path to the distribution directory, to be used in getBookmarks.
String pathKeyName = context.getPackageName() + ".distribution_path";
settings.edit().putString(pathKeyName, distDir.getPath()).commit();
} }
} }
@ -172,16 +168,11 @@ public final class Distribution {
inputStream = new FileInputStream(systemFile); inputStream = new FileInputStream(systemFile);
} }
} else { } else {
// Otherwise, look for bookmarks.json in the stored distribution path, // Otherwise, first look for the distribution in the data directory.
// or in the data directory if that pref doesn't exist. File distDir = new File(context.getApplicationInfo().dataDir, "distribution");
String pathKeyName = context.getPackageName() + ".distribution_path"; if (!distDir.exists()) {
String distPath = settings.getString(pathKeyName, null); // If that doesn't exist, then we must be using a distribution from the system directory.
distDir = new File("/system/" + context.getPackageName() + "/distribution");
File distDir = null;
if (distPath != null) {
distDir = new File(distPath);
} else {
distDir = new File(context.getApplicationInfo().dataDir, "distribution");
} }
File file = new File(distDir, "bookmarks.json"); File file = new File(distDir, "bookmarks.json");