mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Fix provider not seeing device type changes. ADB doesn't keep the object up to date by itself.
This commit is contained in:
parent
af2db0f719
commit
e4c76e1793
1 changed files with 15 additions and 7 deletions
|
@ -128,23 +128,31 @@ module.exports = function(options) {
|
|||
lists.all.push(device.id)
|
||||
delayedTotals()
|
||||
|
||||
// The device object will be kept up to date by the tracker, except
|
||||
// our custom "present" property
|
||||
// Will be set to false when the device is removed
|
||||
_.assign(device, {
|
||||
present: true
|
||||
})
|
||||
|
||||
// When any event occurs on the added device
|
||||
function deviceListener(type) {
|
||||
function deviceListener(type, updatedDevice) {
|
||||
// Okay, this is a bit unnecessary but it allows us to get rid of an
|
||||
// ugly switch statement and return to the original style.
|
||||
privateTracker.emit(type)
|
||||
privateTracker.emit(type, updatedDevice)
|
||||
}
|
||||
|
||||
// When the added device changes
|
||||
function changeListener() {
|
||||
function changeListener(updatedDevice) {
|
||||
register.then(function() {
|
||||
log.info('Device "%s" is now "%s"', device.id, device.type)
|
||||
log.info(
|
||||
'Device "%s" is now "%s" (was "%s")'
|
||||
, device.id
|
||||
, updatedDevice.type
|
||||
, device.type
|
||||
)
|
||||
|
||||
_.assign(device, {
|
||||
type: updatedDevice.type
|
||||
})
|
||||
|
||||
// Tell others the device changed
|
||||
push.send([
|
||||
|
@ -160,7 +168,7 @@ module.exports = function(options) {
|
|||
}
|
||||
|
||||
// When the added device gets removed
|
||||
function removeListener() {
|
||||
function removeListener(updatedDevice) {
|
||||
register.then(function() {
|
||||
log.info('Lost device "%s" (%s)', device.id, device.type)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue