зеркало из https://github.com/mozilla/pjs.git
bug 626669 - Dont show 'Installing Libraries' message on Fennec splash screen when we're not going to install them r=mbrubeck a=blocking-fennec
This commit is contained in:
Родитель
44d65a49bd
Коммит
07576c3416
|
@ -200,10 +200,13 @@ abstract public class GeckoApp
|
|||
GeckoAppShell.loadGeckoLibs(
|
||||
getApplication().getPackageResourcePath());
|
||||
}});
|
||||
File libxulFile = new File(getCacheDir(), "libxul.so");
|
||||
if (!libxulFile.exists() ||
|
||||
libxulFile.lastModified() <
|
||||
new File(getApplication().getPackageResourcePath()).lastModified())
|
||||
File cacheFile = GeckoAppShell.getCacheDir();
|
||||
File libxulFile = new File(cacheFile, "libxul.so");
|
||||
|
||||
if (GeckoAppShell.getFreeSpace() > GeckoAppShell.kFreeSpaceThreshold &&
|
||||
(!libxulFile.exists() ||
|
||||
new File(getApplication().getPackageResourcePath()).lastModified()
|
||||
>= libxulFile.lastModified()))
|
||||
surfaceView.mSplashStatusMsg =
|
||||
getResources().getString(R.string.splash_screen_installing);
|
||||
else
|
||||
|
|
|
@ -79,8 +79,10 @@ class GeckoAppShell
|
|||
static private final int NOTIFY_IME_CANCELCOMPOSITION = 2;
|
||||
static private final int NOTIFY_IME_FOCUSCHANGE = 3;
|
||||
|
||||
static private final long kFreeSpaceThreshold = 157286400L; // 150MB
|
||||
static public final long kFreeSpaceThreshold = 157286400L; // 150MB
|
||||
static private final long kLibFreeSpaceBuffer = 20971520L; // 29MB
|
||||
static private File sCacheFile = null;
|
||||
static private int sFreeSpace = -1;
|
||||
|
||||
/* The Android-side API: API methods that Android calls */
|
||||
|
||||
|
@ -97,6 +99,21 @@ class GeckoAppShell
|
|||
public static native void removeObserver(String observerKey);
|
||||
public static native void loadLibs(String apkName, boolean shouldExtract);
|
||||
|
||||
public static File getCacheDir() {
|
||||
if (sCacheFile == null)
|
||||
sCacheFile = GeckoApp.mAppContext.getCacheDir();
|
||||
return sCacheFile;
|
||||
}
|
||||
|
||||
public static long getFreeSpace() {
|
||||
if (sFreeSpace == -1) {
|
||||
StatFs cacheStats = new StatFs(getCacheDir().getPath());
|
||||
sFreeSpace = cacheStats.getFreeBlocks() *
|
||||
cacheStats.getBlockSize();
|
||||
}
|
||||
return sFreeSpace;
|
||||
}
|
||||
|
||||
// java-side stuff
|
||||
public static void loadGeckoLibs(String apkName) {
|
||||
// The package data lib directory isn't placed in ld.so's
|
||||
|
@ -123,13 +140,12 @@ class GeckoAppShell
|
|||
|
||||
f = Environment.getDownloadCacheDirectory();
|
||||
GeckoAppShell.putenv("EXTERNAL_STORAGE=" + f.getPath());
|
||||
File cacheFile = GeckoApp.mAppContext.getCacheDir();
|
||||
|
||||
File cacheFile = getCacheDir();
|
||||
GeckoAppShell.putenv("CACHE_PATH=" + cacheFile.getPath());
|
||||
|
||||
// gingerbread introduces File.getUsableSpace(). We should use that.
|
||||
StatFs cacheStats = new StatFs(cacheFile.getPath());
|
||||
long freeSpace = cacheStats.getFreeBlocks() * cacheStats.getBlockSize();
|
||||
|
||||
long freeSpace = getFreeSpace();
|
||||
try {
|
||||
File downloadDir = null;
|
||||
if (Build.VERSION.SDK_INT >= 8)
|
||||
|
|
Загрузка…
Ссылка в новой задаче