[Bug 604712] Add device information to nsISystemInfo for use by crash reporting and feedback addon. r=blassey a=blocking-fennec

--HG--
extra : rebase_source : 1a58215923ced152b82852b0cbd9194bde885561
This commit is contained in:
Doug Turner 2010-11-17 12:52:59 -08:00
parent d45aa3e0d0
commit fc9adeac4a

View File

@ -96,7 +96,7 @@ nsSystemInfo::Init()
// This must be done here because NSPR can only separate OS's when compiled, not libraries.
char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
if (gtkver) {
rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16("secondaryLibrary"),
rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
nsDependentCString(gtkver));
PR_smprintf_free(gtkver);
NS_ENSURE_SUCCESS(rv, rv);
@ -113,12 +113,17 @@ nsSystemInfo::Init()
while ((read = getline(&line, &len, fp)) != -1) {
if (line) {
if (strstr(line, "RX-51")) {
SetPropertyAsACString(NS_ConvertASCIItoUTF16("device"), NS_LITERAL_CSTRING("Nokia N900"));
SetPropertyAsACString(NS_LITERAL_STRING("device"), NS_LITERAL_CSTRING("Nokia N900"));
SetPropertyAsACString(NS_LITERAL_STRING("manufacturer"), NS_LITERAL_CSTRING("Nokia"));
SetPropertyAsACString(NS_LITERAL_STRING("hardware"), NS_LITERAL_CSTRING("RX-51"));
break;
} else if (strstr(line, "RX-44") ||
strstr(line, "RX-48") ||
strstr(line, "RX-32") ) {
SetPropertyAsACString(NS_ConvertASCIItoUTF16("device"), NS_LITERAL_CSTRING("Nokia N8xx"));
/* not as accurate as we can be, but these devices are deprecated */
SetPropertyAsACString(NS_LITERAL_STRING("device"), NS_LITERAL_CSTRING("Nokia N8xx"));
SetPropertyAsACString(NS_LITERAL_STRING("manufacturer"), NS_LITERAL_CSTRING("Nokia"));
SetPropertyAsACString(NS_LITERAL_STRING("hardware"), NS_LITERAL_CSTRING("N8xx"));
break;
}
}
@ -134,6 +139,10 @@ nsSystemInfo::Init()
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MODEL", str))
SetPropertyAsAString(NS_LITERAL_STRING("device"), str);
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "MANUFACTURER", str))
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str))
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
}
#endif
return NS_OK;