Bug 659412 - Remove warning dialog for Android devices with low MemTotal [r=blassey]

This commit is contained in:
Matt Brubeck 2011-05-24 14:56:46 -07:00
parent ec953fc5a6
commit a2db7f7456
3 changed files with 0 additions and 53 deletions

View File

@ -243,55 +243,6 @@ abstract public class GeckoApp
surfaceView.mSplashStatusMsg =
getResources().getString(R.string.splash_screen_label);
mLibLoadThread.start();
if (IsNewInstall() && IsUnsupportedDevice()) {
new AlertDialog.Builder(this)
.setMessage(R.string.incompatable_device)
.setCancelable(false)
.setPositiveButton(R.string.continue_label, null)
.setNegativeButton(R.string.exit_label,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id)
{
GeckoApp.this.finish();
System.exit(0);
}
})
.show();
}
}
boolean IsNewInstall() {
File appIni = new File(sGREDir, "application.ini");
return !appIni.exists();
}
boolean IsUnsupportedDevice() {
// We don't currently support devices with less than 512Mb of RAM,
// and want to warn if run on such devices. Most 512Mb devices
// report about 350Mb available, so we check - somewhat arbitrarily -
// for a minimum of 300Mb here.
File meminfo = new File("/proc/meminfo");
try {
BufferedReader br = new BufferedReader(new FileReader(meminfo));
String totalMem = "";
while(!totalMem.contains("MemTotal:") && totalMem != null)
totalMem = br.readLine();
StringTokenizer st = new StringTokenizer(totalMem, " ");
st.nextToken(); // "MemInfo:"
totalMem = st.nextToken();
Log.i("GeckoMemory", "MemTotal: " + Integer.parseInt(totalMem));
return Integer.parseInt(totalMem) < 300000L;
} catch (Exception ex) {
// Will catch NullPointerException if totalMem isn't found,
// a NumberFormatException if the token isn't parsible
// IOException from the file reading or NoSuchElementException
// if totalMem doesn't have 2 tokens. None of these are fatal,
// so log it and move on.
Log.w("GeckoMemTest", "Exception when finding total memory", ex);
}
return false;
}
@Override

View File

@ -1,7 +1,6 @@
<!ENTITY splash_screen_label "loading">
<!ENTITY splash_screen_installing "installing libraries\u2026">
<!ENTITY splash_firstrun "Setting up &brandShortName;\u2026">
<!ENTITY incompatable_cpu_error "This device does not meet the minimum system requirements for &brandShortName;.">
<!ENTITY no_space_to_start_error "There is not enough space available for &brandShortName; to start.">
<!ENTITY error_loading_file "An error occurred when trying to load files required to run &brandShortName;">
@ -14,6 +13,4 @@
<!ENTITY crash_restart_label "Restart &brandShortName;">
<!ENTITY sending_crash_report "Sending crash report\u2026">
<!ENTITY exit_label "Exit">
<!ENTITY incompatable_device "&brandShortName; does not support this device and you may experience
problems.">
<!ENTITY continue_label "Continue">

View File

@ -20,6 +20,5 @@
<string name="crash_restart_label">&crash_restart_label;</string>
<string name="sending_crash_report">&sending_crash_report;</string>
<string name="exit_label">&exit_label;</string>
<string name="incompatable_device">&incompatable_device;</string>
<string name="continue_label">&continue_label;</string>
</resources>