mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
bug 591818 - Display error message for incompatible CPU r=mwu ui-r=beltzner a=blocking-fennec
This commit is contained in:
parent
59ae652264
commit
be17922cd0
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: Java; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -47,5 +47,8 @@ public class App extends GeckoApp {
|
||||
public String getContentProcessName() {
|
||||
return "@MOZ_CHILD_PROCESS_NAME@";
|
||||
}
|
||||
public int getMinCPUVersion() {
|
||||
return @MOZ_MIN_CPU_VERSION@;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,21 @@ abstract public class GeckoApp
|
||||
public static GeckoApp mAppContext;
|
||||
ProgressDialog mProgressDialog;
|
||||
|
||||
void showErrorDialog(String message)
|
||||
{
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(message)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Exit",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog,
|
||||
int id)
|
||||
{
|
||||
GeckoApp.this.finish();
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
void launch()
|
||||
{
|
||||
// unpack files in the components directory
|
||||
@ -110,7 +125,34 @@ abstract public class GeckoApp
|
||||
ViewGroup.LayoutParams.FILL_PARENT));
|
||||
|
||||
if (!GeckoAppShell.sGeckoRunning) {
|
||||
|
||||
try {
|
||||
BufferedReader reader =
|
||||
new BufferedReader(new FileReader("/proc/cpuinfo"));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
int index = line.indexOf("CPU architecture:");
|
||||
if (index == -1)
|
||||
continue;
|
||||
String versionStr = line.substring(18);
|
||||
Log.i("GeckoApp", "cpu version: " + versionStr);
|
||||
int version = Integer.parseInt(versionStr);
|
||||
|
||||
if (version < getMinCPUVersion()) {
|
||||
showErrorDialog("This device does not meet the " +
|
||||
"minimum system requirements for " +
|
||||
getAppName() + ".");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
// Not much we can do here, just continue assuming we're okay
|
||||
Log.i("GeckoApp", "exception: " + ex);
|
||||
}
|
||||
|
||||
if (!useLaunchButton)
|
||||
mProgressDialog =
|
||||
ProgressDialog.show(GeckoApp.this, "", getAppName() +
|
||||
@ -170,7 +212,8 @@ abstract public class GeckoApp
|
||||
public void onResume()
|
||||
{
|
||||
Log.i("GeckoApp", "resume");
|
||||
GeckoAppShell.onResume();
|
||||
if (GeckoAppShell.sGeckoRunning)
|
||||
GeckoAppShell.onResume();
|
||||
if (surfaceView != null)
|
||||
surfaceView.mSurfaceNeedsRedraw = true;
|
||||
// After an onPause, the activity is back in the foreground.
|
||||
@ -288,6 +331,7 @@ abstract public class GeckoApp
|
||||
|
||||
abstract public String getAppName();
|
||||
abstract public String getContentProcessName();
|
||||
abstract public int getMinCPUVersion();
|
||||
|
||||
protected void unpackComponents()
|
||||
{
|
||||
|
@ -116,11 +116,8 @@ class GeckoSurfaceView
|
||||
|
||||
Log.i("GeckoAppJava", "surfaceChanged: fmt: " + format + " dim: " + width + " " + height);
|
||||
|
||||
// XXX This code doesn't seem to actually get hit
|
||||
if (!GeckoAppShell.sGeckoRunning) {
|
||||
GeckoAppShell.setInitialSize(width, height);
|
||||
if (!GeckoAppShell.sGeckoRunning)
|
||||
return;
|
||||
}
|
||||
|
||||
GeckoEvent e = new GeckoEvent(GeckoEvent.SIZE_CHANGED, width, height, -1, -1);
|
||||
GeckoAppShell.sendEventToGecko(e);
|
||||
|
@ -57,11 +57,20 @@ PROCESSEDJAVAFILES = \
|
||||
NotificationHandler.java \
|
||||
$(NULL)
|
||||
|
||||
|
||||
ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
|
||||
MIN_CPU_VERSION=7
|
||||
else
|
||||
MIN_CPU_VERSION=5
|
||||
endif
|
||||
|
||||
DEFINES += \
|
||||
-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
|
||||
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
|
||||
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
|
||||
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
|
||||
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
|
||||
-DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \
|
||||
$(NULL)
|
||||
|
||||
GARBAGE += \
|
||||
AndroidManifest.xml \
|
||||
|
Loading…
Reference in New Issue
Block a user