зеркало из https://github.com/mozilla/gecko-dev.git
bug 635814 - add shellName and shellVersion to nsSystemInfo r=dougt a=2.0+
This commit is contained in:
Родитель
a6751da5c3
Коммит
2ff0d3238a
|
@ -642,6 +642,23 @@ AndroidBridge::CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoS
|
||||||
return (void*) realSurface;
|
return (void*) realSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
AndroidBridge::GetStaticIntField(const char *className, const char *fieldName, PRInt32* aInt)
|
||||||
|
{
|
||||||
|
AutoLocalJNIFrame jniFrame(3);
|
||||||
|
jclass cls = mJNIEnv->FindClass(className);
|
||||||
|
if (!cls)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
jfieldID field = mJNIEnv->GetStaticFieldID(cls, fieldName, "I");
|
||||||
|
if (!field)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*aInt = static_cast<PRInt32>(mJNIEnv->GetStaticIntField(cls, field));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AndroidBridge::GetStaticStringField(const char *className, const char *fieldName, nsAString &result)
|
AndroidBridge::GetStaticStringField(const char *className, const char *fieldName, nsAString &result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,6 +217,8 @@ public:
|
||||||
|
|
||||||
bool GetStaticStringField(const char *classID, const char *field, nsAString &result);
|
bool GetStaticStringField(const char *classID, const char *field, nsAString &result);
|
||||||
|
|
||||||
|
bool GetStaticIntField(const char *className, const char *fieldName, PRInt32* aInt);
|
||||||
|
|
||||||
void SetKeepScreenOn(bool on);
|
void SetKeepScreenOn(bool on);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -149,8 +149,22 @@ nsSystemInfo::Init()
|
||||||
SetPropertyAsAString(NS_LITERAL_STRING("device"), str);
|
SetPropertyAsAString(NS_LITERAL_STRING("device"), str);
|
||||||
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
|
||||||
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
|
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
|
||||||
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
|
PRInt32 version;
|
||||||
|
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField("android/os/Build$VERSION", "SDK_INT", &version))
|
||||||
|
version = 0;
|
||||||
|
if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
|
||||||
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
|
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
|
||||||
|
SetPropertyAsAString(NS_LITERAL_STRING("shellName"), NS_LITERAL_STRING("Android"));
|
||||||
|
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "CODENAME", str)) {
|
||||||
|
if (version) {
|
||||||
|
str.Append(NS_LITERAL_STRING(" ("));
|
||||||
|
str.AppendInt(version);
|
||||||
|
str.Append(NS_LITERAL_STRING(")"));
|
||||||
|
}
|
||||||
|
SetPropertyAsAString(NS_LITERAL_STRING("shellVersion"), str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче