зеркало из https://github.com/mozilla/gecko-dev.git
Merge b2ginbound to central, a=merge
This commit is contained in:
Коммит
f1830a2b6c
|
@ -51,9 +51,15 @@ function debug(msg) {
|
|||
|
||||
/**
|
||||
* An empirically determined amount of acceleration corresponding to a
|
||||
* shake
|
||||
* shake.
|
||||
*/
|
||||
const EXCITEMENT_THRESHOLD = 500;
|
||||
/**
|
||||
* The maximum fraction to update the excitement value per frame. This
|
||||
* corresponds to requiring shaking for approximately 10 motion events (1.6
|
||||
* seconds)
|
||||
*/
|
||||
const EXCITEMENT_FILTER_ALPHA = 0.2;
|
||||
const DEVICE_MOTION_EVENT = "devicemotion";
|
||||
const SCREEN_CHANGE_EVENT = "screenchange";
|
||||
const CAPTURE_LOGS_CONTENT_EVENT = "requestSystemLogs";
|
||||
|
@ -88,6 +94,11 @@ let LogShake = {
|
|||
*/
|
||||
captureRequested: false,
|
||||
|
||||
/**
|
||||
* The current excitement (movement) level
|
||||
*/
|
||||
excitement: 0,
|
||||
|
||||
/**
|
||||
* Map of files which have log-type information to their parsers
|
||||
*/
|
||||
|
@ -122,6 +133,9 @@ let LogShake = {
|
|||
screenEnabled: true
|
||||
}});
|
||||
|
||||
// Reset excitement to clear residual motion
|
||||
this.excitement = 0;
|
||||
|
||||
SystemAppProxy.addEventListener(CAPTURE_LOGS_CONTENT_EVENT, this, false);
|
||||
SystemAppProxy.addEventListener(SCREEN_CHANGE_EVENT, this, false);
|
||||
|
||||
|
@ -196,9 +210,12 @@ let LogShake = {
|
|||
|
||||
var acc = event.accelerationIncludingGravity;
|
||||
|
||||
var excitement = acc.x * acc.x + acc.y * acc.y + acc.z * acc.z;
|
||||
// Updates excitement by a factor of at most alpha, ignoring sudden device
|
||||
// motion. See bug #1101994 for more information.
|
||||
var newExcitement = acc.x * acc.x + acc.y * acc.y + acc.z * acc.z;
|
||||
this.excitement += (newExcitement - this.excitement) * EXCITEMENT_FILTER_ALPHA;
|
||||
|
||||
if (excitement > EXCITEMENT_THRESHOLD) {
|
||||
if (this.excitement > EXCITEMENT_THRESHOLD) {
|
||||
this.startCapture();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,9 +15,14 @@ const Cu = Components.utils;
|
|||
Cu.import("resource://gre/modules/LogCapture.jsm");
|
||||
Cu.import("resource://gre/modules/LogShake.jsm");
|
||||
|
||||
// Force logshake to handle a device motion event with given components
|
||||
// Does not use SystemAppProxy because event needs special
|
||||
// accelerationIncludingGravity property
|
||||
const EVENTS_PER_SECOND = 6.25;
|
||||
const GRAVITY = 9.8;
|
||||
|
||||
/**
|
||||
* Force logshake to handle a device motion event with given components.
|
||||
* Does not use SystemAppProxy because event needs special
|
||||
* accelerationIncludingGravity property.
|
||||
*/
|
||||
function sendDeviceMotionEvent(x, y, z) {
|
||||
let event = {
|
||||
type: "devicemotion",
|
||||
|
@ -30,8 +35,10 @@ function sendDeviceMotionEvent(x, y, z) {
|
|||
LogShake.handleEvent(event);
|
||||
}
|
||||
|
||||
// Send a screen change event directly, does not use SystemAppProxy due to race
|
||||
// conditions.
|
||||
/**
|
||||
* Send a screen change event directly, does not use SystemAppProxy due to race
|
||||
* conditions.
|
||||
*/
|
||||
function sendScreenChangeEvent(screenEnabled) {
|
||||
let event = {
|
||||
type: "screenchange",
|
||||
|
@ -42,23 +49,41 @@ function sendScreenChangeEvent(screenEnabled) {
|
|||
LogShake.handleEvent(event);
|
||||
}
|
||||
|
||||
function debug(msg) {
|
||||
var timestamp = Date.now();
|
||||
dump("LogShake: " + timestamp + ": " + msg);
|
||||
/**
|
||||
* Mock the readLogFile function of LogCapture.
|
||||
* Used to detect whether LogShake activates.
|
||||
* @return {Array<String>} Locations that LogShake tries to read
|
||||
*/
|
||||
function mockReadLogFile() {
|
||||
let readLocations = [];
|
||||
|
||||
LogCapture.readLogFile = function(loc) {
|
||||
readLocations.push(loc);
|
||||
return null; // we don't want to provide invalid data to a parser
|
||||
};
|
||||
|
||||
// Allow inspection of readLocations by caller
|
||||
return readLocations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a series of events that corresponds to a shake
|
||||
*/
|
||||
function sendSustainedShake() {
|
||||
// Fire a series of devicemotion events that are of shake magnitude
|
||||
for (let i = 0; i < 2 * EVENTS_PER_SECOND; i++) {
|
||||
sendDeviceMotionEvent(0, 2 * GRAVITY, 2 * GRAVITY);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
add_test(function test_do_log_capture_after_shaking() {
|
||||
// Enable LogShake
|
||||
LogShake.init();
|
||||
|
||||
let readLocations = [];
|
||||
LogCapture.readLogFile = function(loc) {
|
||||
readLocations.push(loc);
|
||||
return null; // we don't want to provide invalid data to a parser
|
||||
};
|
||||
let readLocations = mockReadLogFile();
|
||||
|
||||
// Fire a devicemotion event that is of shake magnitude
|
||||
sendDeviceMotionEvent(9001, 9001, 9001);
|
||||
sendSustainedShake();
|
||||
|
||||
ok(readLocations.length > 0,
|
||||
"LogShake should attempt to read at least one log");
|
||||
|
@ -71,36 +96,28 @@ add_test(function test_do_nothing_when_resting() {
|
|||
// Enable LogShake
|
||||
LogShake.init();
|
||||
|
||||
let readLocations = [];
|
||||
LogCapture.readLogFile = function(loc) {
|
||||
readLocations.push(loc);
|
||||
return null; // we don't want to provide invalid data to a parser
|
||||
};
|
||||
let readLocations = mockReadLogFile();
|
||||
|
||||
// Fire a devicemotion event that is relatively tiny
|
||||
sendDeviceMotionEvent(0, 9.8, 9.8);
|
||||
// Fire several devicemotion events that are relatively tiny
|
||||
for (let i = 0; i < 2 * EVENTS_PER_SECOND; i++) {
|
||||
sendDeviceMotionEvent(0, GRAVITY, GRAVITY);
|
||||
}
|
||||
|
||||
ok(readLocations.length === 0,
|
||||
"LogShake should not read any logs");
|
||||
|
||||
debug("test_do_nothing_when_resting: stop");
|
||||
LogShake.uninit();
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_do_nothing_when_disabled() {
|
||||
debug("test_do_nothing_when_disabled: start");
|
||||
// Disable LogShake
|
||||
LogShake.uninit();
|
||||
|
||||
let readLocations = [];
|
||||
LogCapture.readLogFile = function(loc) {
|
||||
readLocations.push(loc);
|
||||
return null; // we don't want to provide invalid data to a parser
|
||||
};
|
||||
let readLocations = mockReadLogFile();
|
||||
|
||||
// Fire a devicemotion event that would normally be a shake
|
||||
sendDeviceMotionEvent(0, 9001, 9001);
|
||||
// Fire a series of events that would normally be a shake
|
||||
sendSustainedShake();
|
||||
|
||||
ok(readLocations.length === 0,
|
||||
"LogShake should not read any logs");
|
||||
|
@ -112,18 +129,13 @@ add_test(function test_do_nothing_when_screen_off() {
|
|||
// Enable LogShake
|
||||
LogShake.init();
|
||||
|
||||
|
||||
// Send an event as if the screen has been turned off
|
||||
sendScreenChangeEvent(false);
|
||||
|
||||
let readLocations = [];
|
||||
LogCapture.readLogFile = function(loc) {
|
||||
readLocations.push(loc);
|
||||
return null; // we don't want to provide invalid data to a parser
|
||||
};
|
||||
let readLocations = mockReadLogFile();
|
||||
|
||||
// Fire a devicemotion event that would normally be a shake
|
||||
sendDeviceMotionEvent(0, 9001, 9001);
|
||||
// Fire a series of events that would normally be a shake
|
||||
sendSustainedShake();
|
||||
|
||||
ok(readLocations.length === 0,
|
||||
"LogShake should not read any logs");
|
||||
|
@ -145,8 +157,8 @@ add_test(function test_do_log_capture_resilient_readLogFile() {
|
|||
throw new Error("Exception during readLogFile for: " + loc);
|
||||
};
|
||||
|
||||
// Fire a devicemotion event that is of shake magnitude
|
||||
sendDeviceMotionEvent(9001, 9001, 9001);
|
||||
// Fire a series of events that would normally be a shake
|
||||
sendSustainedShake();
|
||||
|
||||
ok(readLocations.length > 0,
|
||||
"LogShake should attempt to read at least one log");
|
||||
|
@ -168,8 +180,8 @@ add_test(function test_do_log_capture_resilient_parseLog() {
|
|||
return null;
|
||||
};
|
||||
|
||||
// Fire a devicemotion event that is of shake magnitude
|
||||
sendDeviceMotionEvent(9001, 9001, 9001);
|
||||
// Fire a series of events that would normally be a shake
|
||||
sendSustainedShake();
|
||||
|
||||
ok(readLocations.length > 0,
|
||||
"LogShake should attempt to read at least one log");
|
||||
|
@ -178,7 +190,29 @@ add_test(function test_do_log_capture_resilient_parseLog() {
|
|||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function test_do_nothing_when_dropped() {
|
||||
// Enable LogShake
|
||||
LogShake.init();
|
||||
|
||||
let readLocations = mockReadLogFile();
|
||||
|
||||
// We want a series of spikes to be ignored by LogShake. This roughly
|
||||
// corresponds to the compare_stairs_sock graph on bug #1101994
|
||||
|
||||
for (let i = 0; i < 10 * EVENTS_PER_SECOND; i++) {
|
||||
// Fire a devicemotion event that is at rest
|
||||
sendDeviceMotionEvent(0, 0, GRAVITY);
|
||||
// Fire a spike of motion
|
||||
sendDeviceMotionEvent(0, 2 * GRAVITY, 2 * GRAVITY);
|
||||
}
|
||||
|
||||
ok(readLocations.length === 0,
|
||||
"LogShake should not read any logs");
|
||||
|
||||
LogShake.uninit();
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
debug("Starting");
|
||||
run_next_test();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -151,7 +151,7 @@
|
|||
<project name="platform/vendor/qcom/copper" path="device/qcom/msm8974" revision="ec7bc1a26610922156d7d412b4d3de6b4adb93da"/>
|
||||
<project name="vendor_broadcom_wlan" path="vendor/broadcom/wlan" remote="b2g" revision="114b9491a8a919687da4e22fbd89fab511d6d8d7"/>
|
||||
<!-- Shinano specific things -->
|
||||
<project name="device-shinano" path="device/sony/shinano" remote="b2g" revision="a7cb315bc0704f589858feb2a34956364acacb08"/>
|
||||
<project name="device-shinano" path="device/sony/shinano" remote="b2g" revision="afb93dac826346fdeaab6f8ce5dd70eaaaec676d"/>
|
||||
<!-- Aries specific things -->
|
||||
<project name="device-aries" path="device/sony/aries" remote="b2g" revision="75c7e6ca80d0c7a53f346ecfcde2343be95808c9"/>
|
||||
<project name="device-aries" path="device/sony/aries" remote="b2g" revision="2916e2368074b5383c80bf5a0fba3fc83ba310bd"/>
|
||||
</manifest>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -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="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
|
|
@ -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="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94516f787d477dc307e4566f415e0d2f0794f6b9"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -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="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "0c073eda92b099bc008488e52edb0745c5f7975e",
|
||||
"git_revision": "62ba52866f4e5ca9120dad5bfe62fc5df981dc39",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "43b90c58070717da08d510200a0c848da68a4390",
|
||||
"revision": "e54f587baa2008376f2439fb6901fdb99a878a99",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -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="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94516f787d477dc307e4566f415e0d2f0794f6b9"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="0c073eda92b099bc008488e52edb0745c5f7975e"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="62ba52866f4e5ca9120dad5bfe62fc5df981dc39"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче