mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Update STFService.apk to 1.1.0. Switches to abstract sockets which fixes
adb getting stuck when tethering is being used.
This commit is contained in:
parent
94fd18aedf
commit
33e4e617bb
4 changed files with 14 additions and 41 deletions
|
@ -42,14 +42,14 @@ module.exports = syrup.serial()
|
||||||
var agent = {
|
var agent = {
|
||||||
socket: null
|
socket: null
|
||||||
, writer: null
|
, writer: null
|
||||||
, port: 1090
|
, sock: 'localabstract:stfagent'
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = {
|
var service = {
|
||||||
socket: null
|
socket: null
|
||||||
, writer: null
|
, writer: null
|
||||||
, reader: null
|
, reader: null
|
||||||
, port: 1100
|
, sock: 'localabstract:stfservice'
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAgent() {
|
function stopAgent() {
|
||||||
|
@ -229,7 +229,7 @@ module.exports = syrup.serial()
|
||||||
, apk.startIntent.component
|
, apk.startIntent.component
|
||||||
))
|
))
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return devutil.waitForPort(adb, options.serial, service.port)
|
return devutil.waitForLocalSocket(adb, options.serial, service.sock)
|
||||||
.timeout(15000)
|
.timeout(15000)
|
||||||
})
|
})
|
||||||
.then(function(conn) {
|
.then(function(conn) {
|
||||||
|
@ -270,7 +270,7 @@ module.exports = syrup.serial()
|
||||||
return stopAgent()
|
return stopAgent()
|
||||||
.timeout(15000)
|
.timeout(15000)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return devutil.ensureUnusedPort(adb, options.serial, agent.port)
|
return devutil.ensureUnusedLocalSocket(adb, options.serial, agent.sock)
|
||||||
.timeout(10000)
|
.timeout(10000)
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
@ -285,7 +285,7 @@ module.exports = syrup.serial()
|
||||||
streamutil.talk(log, 'Agent says: "%s"', out)
|
streamutil.talk(log, 'Agent says: "%s"', out)
|
||||||
})
|
})
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return devutil.waitForPort(adb, options.serial, agent.port)
|
return devutil.waitForLocalSocket(adb, options.serial, agent.sock)
|
||||||
.timeout(10000)
|
.timeout(10000)
|
||||||
})
|
})
|
||||||
.then(function(conn) {
|
.then(function(conn) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = syrup.serial()
|
||||||
pathutil.vendor('STFService/wire.proto'))
|
pathutil.vendor('STFService/wire.proto'))
|
||||||
|
|
||||||
var resource = {
|
var resource = {
|
||||||
requiredVersion: '1.0.2'
|
requiredVersion: '1.1.0'
|
||||||
, pkg: 'jp.co.cyberagent.stf'
|
, pkg: 'jp.co.cyberagent.stf'
|
||||||
, main: 'jp.co.cyberagent.stf.Agent'
|
, main: 'jp.co.cyberagent.stf.Agent'
|
||||||
, apk: pathutil.vendor('STFService/STFService.apk')
|
, apk: pathutil.vendor('STFService/STFService.apk')
|
||||||
|
|
|
@ -9,58 +9,31 @@ function closedError(err) {
|
||||||
return err.message.indexOf('closed') !== -1
|
return err.message.indexOf('closed') !== -1
|
||||||
}
|
}
|
||||||
|
|
||||||
devutil.ensureUnusedPort = function(adb, serial, port) {
|
devutil.ensureUnusedLocalSocket = function(adb, serial, sock) {
|
||||||
return adb.openTcp(serial, port)
|
return adb.openLocal(serial, sock)
|
||||||
.then(function(conn) {
|
.then(function(conn) {
|
||||||
conn.end()
|
conn.end()
|
||||||
throw new Error(util.format('Port "%d" should be unused', port))
|
throw new Error(util.format('Local socket "%s" should be unused', sock))
|
||||||
})
|
})
|
||||||
.catch(closedError, function() {
|
.catch(closedError, function() {
|
||||||
return Promise.resolve(port)
|
return Promise.resolve(sock)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
devutil.waitForPort = function(adb, serial, port) {
|
devutil.waitForLocalSocket = function(adb, serial, sock) {
|
||||||
return adb.openTcp(serial, port)
|
return adb.openLocal(serial, sock)
|
||||||
.then(function(conn) {
|
.then(function(conn) {
|
||||||
conn.port = port
|
conn.sock = sock
|
||||||
return conn
|
return conn
|
||||||
})
|
})
|
||||||
.catch(closedError, function() {
|
.catch(closedError, function() {
|
||||||
return Promise.delay(100)
|
return Promise.delay(100)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
return devutil.waitForPort(adb, serial, port)
|
return devutil.waitForLocalSocket(adb, serial, sock)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
devutil.waitForPortToFree = function(adb, serial, port) {
|
|
||||||
return adb.openTcp(serial, port)
|
|
||||||
.then(function(conn) {
|
|
||||||
var resolver = Promise.defer()
|
|
||||||
|
|
||||||
function endListener() {
|
|
||||||
resolver.resolve(port)
|
|
||||||
}
|
|
||||||
|
|
||||||
function errorListener(err) {
|
|
||||||
resolver.reject(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
conn.on('end', endListener)
|
|
||||||
conn.on('error', errorListener)
|
|
||||||
|
|
||||||
return resolver.promise.finally(function() {
|
|
||||||
conn.removeListener('end', endListener)
|
|
||||||
conn.removeListener('error', errorListener)
|
|
||||||
conn.end()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch(closedError, function() {
|
|
||||||
return port
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
||||||
var users = {
|
var users = {
|
||||||
shell: true
|
shell: true
|
||||||
|
|
BIN
vendor/STFService/STFService.apk
vendored
BIN
vendor/STFService/STFService.apk
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue