Bug 1001542 - Make OS_VERSION use b2g version info rather than Linux version info.

This commit is contained in:
Dave Hylands 2014-05-05 15:24:58 -07:00
parent e8f6f98c2b
commit 29347f4490
2 changed files with 26 additions and 2 deletions

View File

@ -822,6 +822,7 @@ pref("general.useragent.updates.retry", 86400); // 1 day
pref("media.useAudioChannelService", true);
pref("b2g.version", @MOZ_B2G_VERSION@);
pref("b2g.osName", @MOZ_B2G_OS_NAME@);
// Disable console buffering to save memory.
pref("consoleservice.buffered", false);

View File

@ -32,6 +32,7 @@ using namespace mozilla::widget::android;
#ifdef MOZ_WIDGET_GONK
#include <sys/system_properties.h>
#include "mozilla/Preferences.h"
#endif
#ifdef ANDROID
@ -288,13 +289,35 @@ nsSystemInfo::Init()
#endif
#ifdef MOZ_WIDGET_GONK
char sdk[PROP_VALUE_MAX], characteristics[PROP_VALUE_MAX];
if (__system_property_get("ro.build.version.sdk", sdk))
char sdk[PROP_VALUE_MAX];
if (__system_property_get("ro.build.version.sdk", sdk)) {
android_sdk_version = atoi(sdk);
SetPropertyAsInt32(NS_LITERAL_STRING("sdk_version"), android_sdk_version);
}
char characteristics[PROP_VALUE_MAX];
if (__system_property_get("ro.build.characteristics", characteristics)) {
if (!strcmp(characteristics, "tablet"))
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), true);
}
nsAutoString str;
rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
if (NS_SUCCEEDED(rv)) {
SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
}
const nsAdoptingString& b2g_os_name =
mozilla::Preferences::GetString("b2g.osName");
if (b2g_os_name) {
SetPropertyAsAString(NS_LITERAL_STRING("name"), b2g_os_name);
}
const nsAdoptingString& b2g_version =
mozilla::Preferences::GetString("b2g.version");
if (b2g_version) {
SetPropertyAsAString(NS_LITERAL_STRING("version"), b2g_version);
}
#endif
return NS_OK;