[Bug 604712] Add device information to nsISystemInfo for use by crash reporting and feedback addon. r=blassey a=blocking-fennec
authorDoug Turner <dougt@dougt.org>
Wed, 17 Nov 2010 12:52:59 -0800
changeset 57956 ca12132a0d8c4d8bd1d6d5ace24c9134a467c1f5
parent 57955 2b792c9d96b77442aca74231e2f3bba042d4e06a
child 57957 91980a82eeae105a7e64d2c73fe23f9b97a3a90f
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersblassey, blocking-fennec
bugs604712
milestone2.0b8pre
[Bug 604712] Add device information to nsISystemInfo for use by crash reporting and feedback addon. r=blassey a=blocking-fennec
xpcom/base/nsSystemInfo.cpp
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -91,54 +91,63 @@ nsSystemInfo::Init()
     SetInt32Property(NS_LITERAL_STRING("memmapalign"), PR_GetMemMapAlignment());
     SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
     SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize());
 
 #ifdef MOZ_WIDGET_GTK2
     // 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);
     }
 #endif
 
 
 #ifdef MOZ_PLATFORM_MAEMO
     char *  line = nsnull;
     size_t  len = 0;
     ssize_t read;
     FILE *fp = fopen ("/proc/component_version", "r");
     if (fp) {
       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;
           }
         }
       }
       if (line)
         free(line);
       fclose(fp);
     }
 #endif
 
 #ifdef ANDROID
     if (mozilla::AndroidBridge::Bridge()) {
         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;
 }
 
 void
 nsSystemInfo::SetInt32Property(const nsAString &aPropertyName,
                                const PRInt32 aValue)