Bug 816899 - Add keys of firmware revision and software info. r=cjones
authorShelly Lin <slin@mozilla.com>
Tue, 04 Dec 2012 10:30:26 +0800
changeset 114998 75ae0108f7f31946018f3ae6d5e4a621eaac5f05
parent 114997 3589b294fa16cd9799df24c289bba039a02f7868
child 114999 fdc4e064dfcdafdd32f4e85449c52de0da4c93e6
push id23951
push useremorley@mozilla.com
push dateWed, 05 Dec 2012 15:27:45 +0000
treeherdermozilla-central@56f34c1cc509 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs816899
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 816899 - Add keys of firmware revision and software info. r=cjones
b2g/chrome/content/settings.js
b2g/confvars.sh
configure.in
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -148,54 +148,59 @@ SettingsListener.observe('language.curre
 //=================== DeviceInfo ====================
 Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
 Components.utils.import('resource://gre/modules/ctypes.jsm');
 (function DeviceInfoToSettings() {
   XPCOMUtils.defineLazyServiceGetter(this, 'gSettingsService',
                                      '@mozilla.org/settingsService;1',
                                      'nsISettingsService');
   let lock = gSettingsService.createLock();
-  //MOZ_B2G_VERSION is set in b2g/confvars.sh, and is outputed as a #define value
-  //from configure.in, defaults to 1.0.0 if this value is not exist
+  // MOZ_B2G_VERSION is set in b2g/confvars.sh, and is output as a #define value
+  // from configure.in, defaults to 1.0.0 if this value is not exist.
 #filter attemptSubstitution
   let os_version = '@MOZ_B2G_VERSION@';
+  let os_name = '@MOZ_B2G_OS_NAME@';
 #unfilter attemptSubstitution
   lock.set('deviceinfo.os', os_version, null, null);
+  lock.set('deviceinfo.software', os_name + ' ' + os_version, null, null);
 
   let appInfo = Cc["@mozilla.org/xre/app-info;1"]
                   .getService(Ci.nsIXULAppInfo);
   lock.set('deviceinfo.platform_version', appInfo.platformVersion, null, null);
   lock.set('deviceinfo.platform_build_id', appInfo.platformBuildID, null, null);
 
   let update_channel = Services.prefs.getCharPref('app.update.channel');
   lock.set('deviceinfo.update_channel', update_channel, null, null);
 
-  //Get the hardware info from android properties
-  let hardware_version = null;
+  // Get the hardware info and firmware revision from device properties.
+  let hardware_info = null;
+  let firmware_revision = null;
   try {
     let cutils = ctypes.open('libcutils.so');
     let cbuf = ctypes.char.array(128)();
     let c_property_get = cutils.declare('property_get', ctypes.default_abi,
                                         ctypes.int,       // return value: length
                                         ctypes.char.ptr,  // key
                                         ctypes.char.ptr,  // value
                                         ctypes.char.ptr); // default
     let property_get = function (key, defaultValue) {
       if (defaultValue === undefined) {
         defaultValue = null;
       }
       c_property_get(key, cbuf, defaultValue);
       return cbuf.readString();
     }
-    hardware_version = property_get('ro.hardware');
+    hardware_info = property_get('ro.hardware');
+    firmware_revision = property_get('ro.firmware_revision');
     cutils.close();
   } catch(e) {
-    //Error
+    // Error.
   }
-  lock.set('deviceinfo.hardware', hardware_version, null, null);
+  lock.set('deviceinfo.hardware', hardware_info, null, null);
+  lock.set('deviceinfo.firmware_revision', firmware_revision, null, null);
 })();
 
 // =================== Debugger ====================
 SettingsListener.observe('devtools.debugger.remote-enabled', false, function(value) {
   Services.prefs.setBoolPref('devtools.debugger.remote-enabled', value);
   // This preference is consulted during startup
   Services.prefs.savePrefFile(null);
   value ? startDebugger() : stopDebugger();
--- a/b2g/confvars.sh
+++ b/b2g/confvars.sh
@@ -6,16 +6,17 @@ MOZ_APP_BASENAME=B2G
 MOZ_APP_VENDOR=Mozilla
 
 MOZ_APP_VERSION=20.0a1
 MOZ_APP_UA_NAME=Firefox
 
 MOZ_UA_OS_AGNOSTIC=1
 
 MOZ_B2G_VERSION=1.0.0-prerelease
+MOZ_B2G_OS_NAME=Boot2Gecko
 
 MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
 MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
 # MOZ_APP_DISPLAYNAME is set by branding/configure.sh
 
 MOZ_SAFE_BROWSING=
 MOZ_SERVICES_COMMON=1
 MOZ_SERVICES_HEALTHREPORT=1
--- a/configure.in
+++ b/configure.in
@@ -8519,16 +8519,17 @@ if test -z "$IS_ALPHA"; then
   MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*.[0-9]*\).*|\1|"`.*
   changequote([,])
 else
   MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
 fi
 
 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
+AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
 
 AC_SUBST(MOZ_APP_NAME)
 AC_SUBST(MOZ_APP_DISPLAYNAME)
 AC_SUBST(MOZ_APP_BASENAME)
 AC_SUBST(MOZ_APP_VENDOR)
 AC_SUBST(MOZ_APP_PROFILE)
 AC_SUBST(MOZ_APP_ID)
 AC_SUBST(MAR_CHANNEL_ID)