Bug 816899 - Add keys of firmware revision and software info. r=cjones

This commit is contained in:
Shelly Lin 2012-12-04 10:30:26 +08:00
parent 423e7af568
commit ef9f3747d2
3 changed files with 14 additions and 7 deletions

View File

@ -153,12 +153,14 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
'@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);
@ -168,8 +170,9 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
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)();
@ -185,12 +188,14 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
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 ====================

View File

@ -11,6 +11,7 @@ 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

View File

@ -8524,6 +8524,7 @@ 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)