Merge b2ginbound to central, a=merge

This commit is contained in:
Wes Kocher 2015-11-06 15:03:32 -08:00
commit c41fd4bda3
33 changed files with 310 additions and 58 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="aa5b7b7f6ed207ea1adc4df11d1d8bdaeabadd85"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="638ec448619fda80fcb439b1747af62169d05548"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="4ace9aaee0e048dfda11bb787646c59982a3dc80"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "cec4c1d3729137a24163756d15f98b0d37803966",
"git_revision": "c3436122d678911d04b8f491724596116890ff9b",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "18c5a983482c343e6c08638eece0cdd6d336887e",
"revision": "3024543d03a3106b3ec7cd7f0be4bb7cf56ff532",
"repo_path": "integration/gaia-central"
}

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="aa5b7b7f6ed207ea1adc4df11d1d8bdaeabadd85"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="638ec448619fda80fcb439b1747af62169d05548"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cec4c1d3729137a24163756d15f98b0d37803966"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c3436122d678911d04b8f491724596116890ff9b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="956700d9754349b630a34551750ae6353614b6aa"/>

View File

@ -925,7 +925,7 @@ BluetoothPbapManager::ReplyToGet(uint16_t aPhonebookSize)
// ---- Part 2b: [headerId:1][length:2][Body:var] ---- //
index += AppendHeaderBody(&res[index],
remainingPacketSize,
(uint8_t*) buf.forget(),
reinterpret_cast<uint8_t*>(buf.get()),
numRead);
opcode = ObexResponseCode::Continue;

View File

@ -150,7 +150,12 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
// Create the event's detail object.
OpenWindowEventDetail detail;
detail.mUrl = aURL;
if (aURL.IsEmpty()) {
// URL should never be empty. Assign about:blank as default.
detail.mUrl = NS_LITERAL_STRING("about:blank");
} else {
detail.mUrl = aURL;
}
detail.mName = aName;
detail.mFeatures = aFeatures;
detail.mFrameElement = aPopupFrameElement;

View File

@ -0,0 +1,31 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 1216937 - Test that window.open with null/empty URL should use
// about:blank as default
"use strict";
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
function runTest() {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', 'true');
var gotPopup = false;
iframe.addEventListener('mozbrowseropenwindow', function(e) {
is(gotPopup, false, 'Should get just one popup.');
gotPopup = true;
is(e.detail.url, 'about:blank', "Popup's has correct URL");
e.preventDefault();
SimpleTest.finish();
});
iframe.src = 'file_browserElement_OpenWindowEmpty.html';
document.body.appendChild(iframe);
}
addEventListener('testready', runTest);

View File

@ -0,0 +1,7 @@
<html>
<body>
<script>
window.open();
</script>
</body>
</html>

View File

@ -120,3 +120,5 @@ disabled = bug 924771
[test_browserElement_oop_AudioChannel.html]
[test_browserElement_oop_SetNFCFocus.html]
[test_browserElement_oop_getWebManifest.html]
[test_browserElement_oop_OpenWindowEmpty.html]
skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator

View File

@ -49,6 +49,7 @@ support-files =
browserElement_OpenTab.js
browserElement_OpenWindow.js
browserElement_OpenWindowDifferentOrigin.js
browserElement_OpenWindowEmpty.js
browserElement_OpenWindowInFrame.js
browserElement_OpenWindowRejected.js
browserElement_Opensearch.js
@ -105,6 +106,7 @@ support-files =
file_browserElement_OpenNamed.html
file_browserElement_OpenNamed2.html
file_browserElement_OpenWindowDifferentOrigin.html
file_browserElement_OpenWindowEmpty.html
file_browserElement_OpenWindowInFrame.html
file_browserElement_OpenWindowRejected.html
file_browserElement_PrivateBrowsing.html
@ -248,3 +250,5 @@ disabled = bug 774100
[test_browserElement_inproc_AudioChannel.html]
[test_browserElement_inproc_SetNFCFocus.html]
[test_browserElement_inproc_getStructuredData.html]
[test_browserElement_inproc_OpenWindowEmpty.html]
skip-if = (toolkit == 'gonk') # Test doesn't work on B2G emulator

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1216937</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_OpenWindowEmpty.js">
</script>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1216937</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7" src="browserElement_OpenWindowEmpty.js">
</script>
</body>
</html>

View File

@ -331,9 +331,9 @@ nsGonkCameraControl::ValidateConfiguration(const Configuration& aConfig, Configu
}
if (mCurrentConfiguration.mMode == aConfig.mMode &&
mRequestedPreviewSize.width == aConfig.mPreviewSize.width &&
mRequestedPreviewSize.height == aConfig.mPreviewSize.height &&
mCurrentConfiguration.mRecorderProfile.Equals(profile->GetName()))
mCurrentConfiguration.mRecorderProfile.Equals(profile->GetName()) &&
mRequestedPreviewSize.Equals(aConfig.mPreviewSize) &&
mCurrentConfiguration.mPictureSize.Equals(aValidatedConfig.mPictureSize))
{
DOM_CAMERA_LOGI("Camera configuration is unchanged\n");
return NS_ERROR_ALREADY_INITIALIZED;

View File

@ -116,6 +116,11 @@ public:
struct Size {
uint32_t width;
uint32_t height;
bool Equals(const Size& aSize) const
{
return width == aSize.width && height == aSize.height;
}
};
struct Region {

View File

@ -111,7 +111,7 @@ suite.test('picture-mode', function() {
suite.hw.params['preview-size'] = '1x1';
suite.hw.params['picture-size'] = '1x1';
suite.hw.params['preview-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '640x480,320x240,1x1';
suite.hw.params['picture-size-values'] = '1280x960,640x480,320x240,1x1';
suite.hw.params['video-size-values'] = '320x240';
var setConfig = {
@ -123,6 +123,19 @@ suite.test('picture-mode', function() {
};
var expConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
width: 640,
height: 480
},
pictureSize: {
width: 1280,
height: 960
}
};
var postConfig = {
mode: 'picture',
recorderProfile: 'qvga',
previewSize: {
@ -135,7 +148,47 @@ suite.test('picture-mode', function() {
}
};
return setAndVerifyConfig(setConfig, expConfig);
function syncPreview() {
return new Promise(function(resolve, reject) {
function onEvent(e) {
if (e.newState === 'started') {
resolve();
}
}
suite.camera.addEventListener('previewstatechange', onEvent);
});
}
function reconfigure(p) {
// The preview restarting confirms the configuration actually happened
var sync = new Promise(function(resolve, reject) {
var i = 0;
var expState = ['started', 'stopped', 'started'];
function onEvent(e) {
ok(e.newState === expState[i], 'preview event state ' + expState[i] +
' === ' + e.newState);
++i;
if (i === expState.length) { return; }
suite.camera.removeEventListener('previewstatechange', onEvent);
resolve();
}
suite.camera.addEventListener('previewstatechange', onEvent);
});
var configure = suite.camera.setConfiguration(postConfig)
.then(resolveReconfigure);
return Promise.all([sync, configure]);
}
function resolveReconfigure(cfg) {
verifyConfig(cfg, postConfig);
}
return setAndVerifyConfig(setConfig, expConfig)
.then(syncPreview)
.then(reconfigure);
});
suite.test('picture-mode-larger-picture-size', function() {

View File

@ -5732,6 +5732,18 @@ ContentParent::RecvGetDeviceStorageLocation(const nsString& aType,
#endif
}
bool
ContentParent::RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo)
{
#ifdef MOZ_WIDGET_ANDROID
nsSystemInfo::GetAndroidSystemInfo(aInfo);
return true;
#else
MOZ_CRASH("wrong platform!");
return false;
#endif
}
} // namespace dom
} // namespace mozilla

View File

@ -940,6 +940,9 @@ private:
virtual bool RecvGetDeviceStorageLocation(const nsString& aType,
nsString* aPath) override;
virtual bool RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo) override;
// If you add strong pointers to cycle collected objects here, be sure to
// release these objects in ShutDownProcess. See the comment there for more
// details.

View File

@ -416,6 +416,16 @@ struct FrameScriptInfo
bool runInGlobalScope;
};
struct AndroidSystemInfo
{
nsString device;
nsString manufacturer;
nsString release_version;
nsString hardware;
uint32_t sdk_version;
bool isTablet;
};
prio(normal upto urgent) sync protocol PContent
{
parent spawns PPluginModule;
@ -1134,6 +1144,9 @@ parent:
sync GetDeviceStorageLocation(nsString type)
returns (nsString path);
sync GetAndroidSystemInfo()
returns (AndroidSystemInfo info);
/**
* Tells the parent to ungrab the pointer on the default display.
*

View File

@ -16,4 +16,14 @@ task:
env:
VARIANT: userdebug
B2G_DEBUG: 0
extra:
treeherderEnv:
- staging
treeherder:
symbol: B
groupSymbol: Aries-Spark-OTA
groupName: Aries Device Image
machine:
platform: b2g-device-image
collection:
debug: true

View File

@ -15,4 +15,12 @@ task:
build-aries-spark-ota-user-objdir-gecko-{{project}}: /home/worker/objdir-gecko
env:
VARIANT: user
extra:
treeherderEnv:
- staging
treeherder:
symbol: B
groupSymbol: Aries-Spark-OTA
groupName: Aries Device Image
machine:
platform: b2g-device-image

View File

@ -18,9 +18,6 @@ task:
buildbot_step 'Build' ./build-phone-ota.sh $HOME/workspace
extra:
treeherder:
machine:
platform: b2g-device-image
locations:
img: 'private/build/flame-kk.zip'
mar: 'public/build/b2g-flame-gecko-update.mar'

View File

@ -17,3 +17,14 @@ task:
env:
VARIANT: userdebug
B2G_DEBUG: 0
extra:
treeherderEnv:
- staging
treeherder:
symbol: B
groupSymbol: Flame-KK-OTA
groupName: Flame KitKat Device Image
machine:
platform: b2g-device-image
collection:
debug: true

View File

@ -16,3 +16,12 @@ task:
build-flame-kk-ota-user-objdir-gecko-{{project}}: /home/worker/objdir-gecko
env:
VARIANT: user
extra:
treeherderEnv:
- staging
treeherder:
symbol: B
groupSymbol: Flame-KK-OTA
groupName: Flame KitKat Device Image
machine:
platform: b2g-device-image

View File

@ -42,6 +42,7 @@
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#include "mozilla/dom/ContentChild.h"
#endif
#ifdef MOZ_WIDGET_GONK
@ -692,40 +693,16 @@ nsSystemInfo::Init()
#endif
#ifdef MOZ_WIDGET_ANDROID
if (mozilla::AndroidBridge::Bridge()) {
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "MODEL", str)) {
SetPropertyAsAString(NS_LITERAL_STRING("device"), str);
AndroidSystemInfo info;
if (XRE_IsContentProcess()) {
dom::ContentChild* child = dom::ContentChild::GetSingleton();
if (child) {
child->SendGetAndroidSystemInfo(&info);
SetupAndroidInfo(info);
}
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "MANUFACTURER", str)) {
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), str);
}
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build$VERSION", "RELEASE", str)) {
SetPropertyAsAString(NS_LITERAL_STRING("release_version"), str);
}
int32_t version;
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField(
"android/os/Build$VERSION", "SDK_INT", &version)) {
version = 0;
}
android_sdk_version = version;
if (version >= 8 &&
mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "HARDWARE", str)) {
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str);
}
bool isTablet = mozilla::widget::GeckoAppShell::IsTablet();
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), isTablet);
// NSPR "version" is the kernel version. For Android we want the Android version.
// Rename SDK version to version and put the kernel version into kernel_version.
rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
if (NS_SUCCEEDED(rv)) {
SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
}
SetPropertyAsInt32(NS_LITERAL_STRING("version"), android_sdk_version);
} else {
GetAndroidSystemInfo(&info);
SetupAndroidInfo(info);
}
#endif
@ -793,6 +770,75 @@ nsSystemInfo::Init()
return NS_OK;
}
#ifdef MOZ_WIDGET_ANDROID
/* static */
void
nsSystemInfo::GetAndroidSystemInfo(AndroidSystemInfo* aInfo)
{
MOZ_ASSERT(XRE_IsParentProcess());
if (!mozilla::AndroidBridge::Bridge()) {
aInfo->sdk_version() = 0;
return;
}
nsAutoString str;
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "MODEL", str)) {
aInfo->device() = str;
}
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "MANUFACTURER", str)) {
aInfo->manufacturer() = str;
}
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build$VERSION", "RELEASE", str)) {
aInfo->release_version() = str;
}
if (mozilla::AndroidBridge::Bridge()->GetStaticStringField(
"android/os/Build", "HARDWARE", str)) {
aInfo->hardware() = str;
}
int32_t sdk_version;
if (!mozilla::AndroidBridge::Bridge()->GetStaticIntField(
"android/os/Build$VERSION", "SDK_INT", &sdk_version)) {
sdk_version = 0;
}
aInfo->sdk_version() = sdk_version;
aInfo->isTablet() = mozilla::widget::GeckoAppShell::IsTablet();
}
void
nsSystemInfo::SetupAndroidInfo(const AndroidSystemInfo& aInfo)
{
if (!aInfo.device().IsEmpty()) {
SetPropertyAsAString(NS_LITERAL_STRING("device"), aInfo.device());
}
if (!aInfo.manufacturer().IsEmpty()) {
SetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), aInfo.manufacturer());
}
if (!aInfo.release_version().IsEmpty()) {
SetPropertyAsAString(NS_LITERAL_STRING("release_version"), aInfo.release_version());
}
SetPropertyAsBool(NS_LITERAL_STRING("tablet"), aInfo.isTablet());
// NSPR "version" is the kernel version. For Android we want the Android version.
// Rename SDK version to version and put the kernel version into kernel_version.
nsAutoString str;
nsresult rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
if (NS_SUCCEEDED(rv)) {
SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
}
// When AndroidBridge is not available (eg. in xpcshell tests), sdk_version is 0.
if (aInfo.sdk_version() != 0) {
android_sdk_version = aInfo.sdk_version();
if (android_sdk_version >= 8 && !aInfo.hardware().IsEmpty()) {
SetPropertyAsAString(NS_LITERAL_STRING("hardware"), aInfo.hardware());
}
SetPropertyAsInt32(NS_LITERAL_STRING("version"), android_sdk_version);
}
}
#endif // MOZ_WIDGET_ANDROID
void
nsSystemInfo::SetInt32Property(const nsAString& aPropertyName,
const int32_t aValue)

View File

@ -12,6 +12,10 @@
#include "nsIObserver.h"
#endif // defined(XP_WIN)
#ifdef MOZ_WIDGET_ANDROID
#include "mozilla/dom/PContent.h"
#endif // MOZ_WIDGET_ANDROID
class nsSystemInfo final
: public nsHashPropertyBag
#if defined(XP_WIN)
@ -32,6 +36,12 @@ public:
// See comments above the variable definition and in NS_InitXPCOM2.
static uint32_t gUserUmask;
#ifdef MOZ_WIDGET_ANDROID
static void GetAndroidSystemInfo(mozilla::dom::AndroidSystemInfo* aInfo);
protected:
void SetupAndroidInfo(const mozilla::dom::AndroidSystemInfo&);
#endif
protected:
void SetInt32Property(const nsAString& aPropertyName,
const int32_t aValue);