mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 10:53:21 +02:00
Revert all adbkit upgrades (#207)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
@@ -13,7 +12,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/adb'))
|
||||
.define(function(options, service, identity, touch, router, push, adb) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:account')
|
||||
|
||||
function checkAccount(type, account) {
|
||||
@@ -283,11 +281,11 @@ module.exports = syrup.serial()
|
||||
])
|
||||
})
|
||||
.catch(function() {
|
||||
return deviceClient.clear('com.google.android.gsf.login')
|
||||
return adb.clear(options.serial, 'com.google.android.gsf.login')
|
||||
.catch(function() {
|
||||
// The package name is different in 2.3, so let's try the old name
|
||||
// if the new name fails.
|
||||
return deviceClient.clear('com.google.android.gsf')
|
||||
return adb.clear(options.serial, 'com.google.android.gsf')
|
||||
})
|
||||
.then(function() {
|
||||
return service.addAccountMenu()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
|
||||
var browsers = require('@devicefarmer/stf-browser-db')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
@@ -24,7 +23,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('./service'))
|
||||
.define(function(options, router, push, adb, service) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:browser')
|
||||
|
||||
function pkg(component) {
|
||||
@@ -105,7 +103,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
var reply = wireutil.reply(options.serial)
|
||||
deviceClient.startActivity({
|
||||
adb.startActivity(options.serial, {
|
||||
action: 'android.intent.action.VIEW'
|
||||
, component: message.browser
|
||||
, data: message.url
|
||||
@@ -138,7 +136,7 @@ module.exports = syrup.serial()
|
||||
router.on(wire.BrowserClearMessage, function(channel, message) {
|
||||
log.info('Clearing "%s"', message.browser)
|
||||
var reply = wireutil.reply(options.serial)
|
||||
deviceClient.clear(pkg(message.browser))
|
||||
adb.clear(options.serial, pkg(message.browser))
|
||||
.then(function() {
|
||||
push.send([
|
||||
channel
|
||||
|
||||
@@ -3,14 +3,12 @@ var Promise = require('bluebird')
|
||||
var _ = require('lodash')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('../resources/service'))
|
||||
.dependency(require('./group'))
|
||||
.define(function(options, adb, service, group) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:cleanup')
|
||||
var plugin = Object.create(null)
|
||||
|
||||
@@ -19,12 +17,12 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function listPackages() {
|
||||
return deviceClient.getPackages()
|
||||
return adb.getPackages(options.serial)
|
||||
}
|
||||
|
||||
function uninstallPackage(pkg) {
|
||||
log.info('Cleaning up package "%s"', pkg)
|
||||
return deviceClient.uninstall(pkg)
|
||||
return adb.uninstall(options.serial, pkg)
|
||||
.catch(function(err) {
|
||||
log.warn('Unable to clean up package "%s"', pkg, err)
|
||||
return true
|
||||
|
||||
@@ -6,7 +6,6 @@ var util = require('util')
|
||||
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var Promise = require('bluebird')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var grouputil = require('../../../util/grouputil')
|
||||
@@ -23,7 +22,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('./util/urlformat'))
|
||||
.define(function(options, adb, router, push, group, solo, urlformat) {
|
||||
var log = logger.createLogger('device:plugins:connect')
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var plugin = Object.create(null)
|
||||
var activeServer = null
|
||||
|
||||
@@ -36,7 +34,7 @@ module.exports = syrup.serial()
|
||||
return resolve(plugin.url)
|
||||
}
|
||||
|
||||
var server = deviceClient.createTcpUsbBridge({
|
||||
var server = adb.createTcpUsbBridge(options.serial, {
|
||||
auth: function(key) {
|
||||
var resolver = Promise.defer()
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var path = require('path')
|
||||
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
@@ -12,16 +11,15 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/storage'))
|
||||
.define(function(options, adb, router, push, storage) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:filesystem')
|
||||
var plugin = Object.create(null)
|
||||
|
||||
plugin.retrieve = function(file) {
|
||||
log.info('Retrieving file "%s"', file)
|
||||
|
||||
return deviceClient.stat(file)
|
||||
return adb.stat(options.serial, file)
|
||||
.then(function(stats) {
|
||||
return deviceClient.pull(file)
|
||||
return adb.pull(options.serial, file)
|
||||
.then(function(transfer) {
|
||||
// We may have add new storage plugins for various file types
|
||||
// in the future, and add proper detection for the mimetype.
|
||||
@@ -56,7 +54,7 @@ module.exports = syrup.serial()
|
||||
|
||||
router.on(wire.FileSystemListMessage, function(channel, message) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
deviceClient.readdir(message.dir)
|
||||
adb.readdir(options.serial, message.dir)
|
||||
.then(function(files) {
|
||||
push.send([
|
||||
channel
|
||||
|
||||
@@ -9,7 +9,6 @@ var logger = require('../../../../util/logger')
|
||||
var lifecycle = require('../../../../util/lifecycle')
|
||||
var streamutil = require('../../../../util/streamutil')
|
||||
var wireutil = require('../../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var ForwardManager = require('./util/manager')
|
||||
|
||||
@@ -20,14 +19,13 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../../resources/minirev'))
|
||||
.dependency(require('../group'))
|
||||
.define(function(options, adb, router, push, minirev, group) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:forward')
|
||||
var plugin = Object.create(null)
|
||||
var manager = new ForwardManager()
|
||||
|
||||
function startService() {
|
||||
log.info('Launching reverse port forwarding service')
|
||||
return deviceClient.shell([
|
||||
return adb.shell(options.serial, [
|
||||
'exec'
|
||||
, minirev.bin
|
||||
])
|
||||
@@ -40,7 +38,7 @@ module.exports = syrup.serial()
|
||||
|
||||
function connectService(times) {
|
||||
function tryConnect(times, delay) {
|
||||
return deviceClient.openLocal('localabstract:minirev')
|
||||
return adb.openLocal(options.serial, 'localabstract:minirev')
|
||||
.timeout(10000)
|
||||
.catch(function(err) {
|
||||
if (/closed/.test(err.message) && times > 1) {
|
||||
|
||||
@@ -2,7 +2,6 @@ var stream = require('stream')
|
||||
var url = require('url')
|
||||
var util = require('util')
|
||||
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var request = require('request')
|
||||
var Promise = require('bluebird')
|
||||
@@ -24,7 +23,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/push'))
|
||||
.define(function(options, adb, router, push) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:install')
|
||||
|
||||
router.on(wire.InstallMessage, function(channel, message) {
|
||||
@@ -57,7 +55,7 @@ module.exports = syrup.serial()
|
||||
var source = new stream.Readable().wrap(req)
|
||||
var target = '/data/local/tmp/_app.apk'
|
||||
|
||||
return deviceClient.push(source, target)
|
||||
return adb.push(options.serial, source, target)
|
||||
.timeout(10000)
|
||||
.then(function(transfer) {
|
||||
var resolver = Promise.defer()
|
||||
@@ -105,7 +103,7 @@ module.exports = syrup.serial()
|
||||
|
||||
sendProgress('installing_app', guesstimate)
|
||||
return promiseutil.periodicNotify(
|
||||
deviceClient.installRemote(apk)
|
||||
adb.installRemote(options.serial, apk)
|
||||
.timeout(60000 * 5)
|
||||
.catch(function(err) {
|
||||
switch (err.code) {
|
||||
@@ -115,10 +113,10 @@ module.exports = syrup.serial()
|
||||
'Uninstalling "%s" first due to inconsistent certificates'
|
||||
, pkg
|
||||
)
|
||||
return deviceClient.uninstall(pkg)
|
||||
return adb.uninstall(options.serial, pkg)
|
||||
.timeout(15000)
|
||||
.then(function() {
|
||||
return deviceClient.installRemote(apk)
|
||||
return adb.installRemote(options.serial, apk)
|
||||
.timeout(60000 * 5)
|
||||
})
|
||||
default:
|
||||
@@ -164,7 +162,7 @@ module.exports = syrup.serial()
|
||||
)
|
||||
// Progress 90%
|
||||
sendProgress('launching_app', 90)
|
||||
return deviceClient.startActivity(launchActivity)
|
||||
return adb.startActivity(options.serial, launchActivity)
|
||||
.timeout(30000)
|
||||
}
|
||||
}
|
||||
@@ -207,7 +205,7 @@ module.exports = syrup.serial()
|
||||
|
||||
var reply = wireutil.reply(options.serial)
|
||||
|
||||
deviceClient.uninstall(message.packageName)
|
||||
adb.uninstall(options.serial, message.packageName)
|
||||
.then(function() {
|
||||
push.send([
|
||||
channel
|
||||
|
||||
@@ -5,7 +5,6 @@ var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
var lifecycle = require('../../../util/lifecycle')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -14,7 +13,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('./group'))
|
||||
.define(function(options, adb, router, push, group) {
|
||||
var log = logger.createLogger('device:plugins:logcat')
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var plugin = Object.create(null)
|
||||
var activeLogcat = null
|
||||
|
||||
@@ -24,7 +22,7 @@ module.exports = syrup.serial()
|
||||
return plugin.stop()
|
||||
.then(function() {
|
||||
log.info('Starting logcat')
|
||||
return deviceClient.openLogcat({
|
||||
return adb.openLogcat(options.serial, {
|
||||
clear: true
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,7 +3,6 @@ var syrup = require('@devicefarmer/stf-syrup')
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -11,14 +10,13 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/push'))
|
||||
.define(function(options, adb, router, push) {
|
||||
var log = logger.createLogger('device:plugins:reboot')
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
|
||||
router.on(wire.RebootMessage, function(channel) {
|
||||
var reply = wireutil.reply(options.serial)
|
||||
|
||||
log.important('Rebooting')
|
||||
|
||||
deviceClient.reboot()
|
||||
adb.reboot(options.serial)
|
||||
.timeout(30000)
|
||||
.then(function() {
|
||||
push.send([
|
||||
|
||||
@@ -6,7 +6,6 @@ var adbkit = require('@devicefarmer/adbkit')
|
||||
var logger = require('../../../../util/logger')
|
||||
var wire = require('../../../../wire')
|
||||
var wireutil = require('../../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../../support/adb'))
|
||||
@@ -16,7 +15,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../../resources/minicap'))
|
||||
.dependency(require('../util/display'))
|
||||
.define(function(options, adb, router, push, storage, minicap, display) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:screen:capture')
|
||||
var plugin = Object.create(null)
|
||||
|
||||
@@ -39,14 +37,14 @@ module.exports = syrup.serial()
|
||||
'-P %s -s >%s', projectionFormat(), file))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(function() {
|
||||
return deviceClient.stat(file)
|
||||
return adb.stat(options.serial, file)
|
||||
})
|
||||
.then(function(stats) {
|
||||
if (stats.size === 0) {
|
||||
throw new Error('Empty screenshot; possibly secure screen?')
|
||||
}
|
||||
|
||||
return deviceClient.pull(file)
|
||||
return adb.pull(options.serial, file)
|
||||
.then(function(transfer) {
|
||||
return storage.store('image', transfer, {
|
||||
filename: util.format('%s.jpg', options.serial)
|
||||
@@ -56,7 +54,7 @@ module.exports = syrup.serial()
|
||||
})
|
||||
})
|
||||
.finally(function() {
|
||||
return deviceClient.shell(['rm', '-f', file])
|
||||
return adb.shell(options.serial, ['rm', '-f', file])
|
||||
.then(adbkit.util.readAll)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ var BroadcastSet = require('./util/broadcastset')
|
||||
var StateQueue = require('../../../../util/statequeue')
|
||||
var RiskyStream = require('../../../../util/riskystream')
|
||||
var FailCounter = require('../../../../util/failcounter')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../../support/adb'))
|
||||
@@ -25,7 +24,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../util/display'))
|
||||
.dependency(require('./options'))
|
||||
.define(function(options, adb, minicap, display, screenOptions) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:screen:stream')
|
||||
|
||||
function FrameProducer(config) {
|
||||
@@ -278,7 +276,7 @@ module.exports = syrup.serial()
|
||||
|
||||
FrameProducer.prototype._connectService = function() {
|
||||
function tryConnect(times, delay) {
|
||||
return deviceClient.openLocal('localabstract:minicap')
|
||||
return adb.openLocal(options.serial, 'localabstract:minicap')
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return out
|
||||
@@ -369,7 +367,7 @@ module.exports = syrup.serial()
|
||||
log.info('Sending %s to minicap', signal)
|
||||
return Promise.all([
|
||||
output.waitForEnd()
|
||||
, deviceClient.shell(['kill', signum, pid])
|
||||
, adb.shell(options.serial, ['kill', signum, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.return(true)
|
||||
])
|
||||
|
||||
@@ -3,7 +3,6 @@ var events = require('events')
|
||||
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var Promise = require('bluebird')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
@@ -37,7 +36,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/sdk'))
|
||||
.dependency(require('../resources/service'))
|
||||
.define(function(options, adb, router, push, sdk, apk) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:service')
|
||||
var messageResolver = new MessageResolver()
|
||||
var plugin = new events.EventEmitter()
|
||||
@@ -67,7 +65,7 @@ module.exports = syrup.serial()
|
||||
function callService(intent) {
|
||||
var startServiceCmd = (sdk.level < 26) ? 'startservice' : 'start-foreground-service'
|
||||
log.info('using \'%s\' command for API %s', startServiceCmd, sdk.level)
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
'am %s --user 0 %s'
|
||||
, startServiceCmd, intent
|
||||
))
|
||||
@@ -80,7 +78,7 @@ module.exports = syrup.serial()
|
||||
.timeout(10000)
|
||||
.then(function(line) {
|
||||
if (line.indexOf('--user') !== -1) {
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
'am %s %s'
|
||||
, startServiceCmd, intent
|
||||
))
|
||||
@@ -279,7 +277,7 @@ module.exports = syrup.serial()
|
||||
.timeout(10000)
|
||||
})
|
||||
.then(function() {
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
"export CLASSPATH='%s'; exec app_process /system/bin '%s'"
|
||||
, apk.path
|
||||
, apk.main
|
||||
|
||||
@@ -4,7 +4,6 @@ var syrup = require('@devicefarmer/stf-syrup')
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -12,7 +11,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/sub'))
|
||||
.define(function(options, adb, router, push, sub) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:shell')
|
||||
|
||||
router.on(wire.ShellCommandMessage, function(channel, message) {
|
||||
@@ -20,7 +18,7 @@ module.exports = syrup.serial()
|
||||
|
||||
log.info('Running shell command "%s"', message.command)
|
||||
|
||||
deviceClient.shell(message.command)
|
||||
adb.shell(options.serial, message.command)
|
||||
.timeout(10000)
|
||||
.then(function(stream) {
|
||||
var resolver = Promise.defer()
|
||||
|
||||
@@ -3,21 +3,19 @@ var syrup = require('@devicefarmer/stf-syrup')
|
||||
var logger = require('../../../util/logger')
|
||||
var wire = require('../../../wire')
|
||||
var wireutil = require('../../../wire/util')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/router'))
|
||||
.dependency(require('../support/push'))
|
||||
.dependency(require('../support/adb'))
|
||||
.define(function(options, router, push, adb) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:store')
|
||||
|
||||
router.on(wire.StoreOpenMessage, function(channel) {
|
||||
log.info('Opening Play Store')
|
||||
|
||||
var reply = wireutil.reply(options.serial)
|
||||
deviceClient.startActivity({
|
||||
adb.startActivity(options.serial, {
|
||||
action: 'android.intent.action.MAIN'
|
||||
, component: 'com.android.vending/.AssetBrowserActivity'
|
||||
// FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||
|
||||
@@ -5,8 +5,7 @@ var syrup = require('@devicefarmer/stf-syrup')
|
||||
var split = require('split')
|
||||
var EventEmitter = require('eventemitter3')
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
var Parser = require('@devicefarmer/adbkit/dist/src/adb/parser').default
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
var Parser = require('@devicefarmer/adbkit/lib/adb/parser')
|
||||
|
||||
var wire = require('../../../../wire')
|
||||
var logger = require('../../../../util/logger')
|
||||
@@ -22,7 +21,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../../resources/minitouch'))
|
||||
.dependency(require('../util/flags'))
|
||||
.define(function(options, adb, router, minitouch, flags) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:plugins:touch')
|
||||
|
||||
function TouchConsumer(config) {
|
||||
@@ -261,7 +259,7 @@ module.exports = syrup.serial()
|
||||
|
||||
TouchConsumer.prototype._connectService = function() {
|
||||
function tryConnect(times, delay) {
|
||||
return deviceClient.openLocal('localabstract:minitouch')
|
||||
return adb.openLocal(options.serial, 'localabstract:minitouch')
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return out
|
||||
@@ -352,7 +350,7 @@ module.exports = syrup.serial()
|
||||
log.info('Sending %s to minitouch', signal)
|
||||
return Promise.all([
|
||||
output.waitForEnd()
|
||||
, deviceClient.shell(['kill', signum, pid])
|
||||
, adb.shell(options.serial, ['kill', signum, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.return(true)
|
||||
])
|
||||
|
||||
@@ -4,7 +4,6 @@ var path = require('path')
|
||||
|
||||
var Promise = require('bluebird')
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var pathutil = require('../../../util/pathutil')
|
||||
@@ -19,7 +18,6 @@ module.exports = syrup.serial()
|
||||
.dependency(require('../support/sdk'))
|
||||
.define(function(options, adb, properties, abi, sdk) {
|
||||
var log = logger.createLogger('device:resources:minicap')
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
|
||||
var resources = {
|
||||
bin: new Resource({
|
||||
@@ -64,7 +62,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function removeResource(res) {
|
||||
return deviceClient.shell(['rm', '-f', res.dest])
|
||||
return adb.shell(options.serial, ['rm', '-f', res.dest])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return streamutil.readAll(out)
|
||||
@@ -73,7 +71,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function pushResource(res) {
|
||||
return deviceClient.push(res.src, res.dest, res.mode)
|
||||
return adb.push(options.serial, res.src, res.dest, res.mode)
|
||||
.timeout(10000)
|
||||
.then(function(transfer) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
@@ -88,7 +86,7 @@ module.exports = syrup.serial()
|
||||
log.info('Installing "%s" as "%s"', res.src, res.dest)
|
||||
|
||||
function checkExecutable(res) {
|
||||
return deviceClient.stat(res.dest)
|
||||
return adb.stat(options.serial, res.dest)
|
||||
.timeout(5000)
|
||||
.then(function(stats) {
|
||||
// Can't use fs.constants.S_IXUSR due to differences on Windows.
|
||||
@@ -138,7 +136,7 @@ module.exports = syrup.serial()
|
||||
bin: resources.bin.dest
|
||||
, lib: resources.lib.dest
|
||||
, run: function(cmd) {
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
'LD_LIBRARY_PATH=%s exec %s %s'
|
||||
, path.dirname(resources.lib.dest)
|
||||
, resources.bin.dest
|
||||
|
||||
@@ -9,14 +9,12 @@ var pathutil = require('../../../util/pathutil')
|
||||
var devutil = require('../../../util/devutil')
|
||||
var streamutil = require('../../../util/streamutil')
|
||||
var Resource = require('./util/resource')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('../support/properties'))
|
||||
.dependency(require('../support/abi'))
|
||||
.define(function(options, adb, properties, abi) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:resources:minirev')
|
||||
|
||||
var resources = {
|
||||
@@ -38,7 +36,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function removeResource(res) {
|
||||
return deviceClient.shell(['rm', '-f', res.dest])
|
||||
return adb.shell(options.serial, ['rm', '-f', res.dest])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return streamutil.readAll(out)
|
||||
@@ -47,7 +45,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function pushResource(res) {
|
||||
return deviceClient.push(res.src, res.dest, res.mode)
|
||||
return adb.push(options.serial, res.src, res.dest, res.mode)
|
||||
.timeout(10000)
|
||||
.then(function(transfer) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
@@ -62,7 +60,7 @@ module.exports = syrup.serial()
|
||||
log.info('Installing "%s" as "%s"', res.src, res.dest)
|
||||
|
||||
function checkExecutable(res) {
|
||||
return deviceClient.stat(res.dest)
|
||||
return adb.stat(options.serial, res.dest)
|
||||
.timeout(5000)
|
||||
.then(function(stats) {
|
||||
// Can't use fs.constants.S_IXUSR due to differences on Windows.
|
||||
|
||||
@@ -9,13 +9,11 @@ var pathutil = require('../../../util/pathutil')
|
||||
var devutil = require('../../../util/devutil')
|
||||
var streamutil = require('../../../util/streamutil')
|
||||
var Resource = require('./util/resource')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.dependency(require('../support/abi'))
|
||||
.define(function(options, adb, abi) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:resources:minitouch')
|
||||
|
||||
var resources = {
|
||||
@@ -37,7 +35,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function removeResource(res) {
|
||||
return deviceClient.shell(['rm', '-f', res.dest])
|
||||
return adb.shell(options.serial, ['rm', '-f', res.dest])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return streamutil.readAll(out)
|
||||
@@ -46,7 +44,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function pushResource(res) {
|
||||
return deviceClient.push(res.src, res.dest, res.mode)
|
||||
return adb.push(options.serial, res.src, res.dest, res.mode)
|
||||
.timeout(10000)
|
||||
.then(function(transfer) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
@@ -61,7 +59,7 @@ module.exports = syrup.serial()
|
||||
log.info('Installing "%s" as "%s"', res.src, res.dest)
|
||||
|
||||
function checkExecutable(res) {
|
||||
return deviceClient.stat(res.dest)
|
||||
return adb.stat(options.serial, res.dest)
|
||||
.timeout(5000)
|
||||
.then(function(stats) {
|
||||
// Can't use fs.constants.S_IXUSR due to differences on Windows.
|
||||
@@ -109,7 +107,7 @@ module.exports = syrup.serial()
|
||||
return {
|
||||
bin: resources.bin.dest
|
||||
, run: function(cmd) {
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
'exec %s%s'
|
||||
, resources.bin.dest
|
||||
, cmd ? util.format(' %s', cmd) : ''
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
var util = require('util')
|
||||
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var ProtoBuf = require('protobufjs')
|
||||
var semver = require('semver')
|
||||
@@ -13,7 +12,6 @@ var logger = require('../../../util/logger')
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
.define(function(options, adb) {
|
||||
var deviceClient = new DeviceClient(adb, options.serial)
|
||||
var log = logger.createLogger('device:resources:service')
|
||||
var builder = ProtoBuf.loadProtoFile(
|
||||
pathutil.vendor('STFService/wire.proto'))
|
||||
@@ -32,7 +30,7 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
function getPath() {
|
||||
return deviceClient.shell(['pm', 'path', resource.pkg])
|
||||
return adb.shell(options.serial, ['pm', 'path', resource.pkg])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return streamutil.findLine(out, (/^package:/))
|
||||
@@ -48,7 +46,7 @@ module.exports = syrup.serial()
|
||||
return getPath()
|
||||
.then(function(installedPath) {
|
||||
log.info('Running version check')
|
||||
return deviceClient.shell(util.format(
|
||||
return adb.shell(options.serial, util.format(
|
||||
"export CLASSPATH='%s';" +
|
||||
" exec app_process /system/bin '%s' --version 2>/dev/null"
|
||||
, installedPath
|
||||
@@ -76,11 +74,11 @@ module.exports = syrup.serial()
|
||||
log.info('Installing STFService')
|
||||
// Uninstall first to make sure we don't have any certificate
|
||||
// issues.
|
||||
return deviceClient.uninstall(resource.pkg)
|
||||
return adb.uninstall(options.serial, resource.pkg)
|
||||
.timeout(15000)
|
||||
.then(function() {
|
||||
return promiseutil.periodicNotify(
|
||||
deviceClient.install(resource.apk)
|
||||
adb.install(options.serial, resource.apk)
|
||||
, 20000
|
||||
)
|
||||
.timeout(65000)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
|
||||
var adbkit = require('@devicefarmer/adbkit').Adb
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
var adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
var promiseutil = require('../../../util/promiseutil')
|
||||
@@ -17,7 +16,7 @@ module.exports = syrup.serial()
|
||||
|
||||
function ensureBootComplete() {
|
||||
return promiseutil.periodicNotify(
|
||||
new DeviceClient(adb, options.serial).waitBootComplete()
|
||||
adb.waitBootComplete(options.serial)
|
||||
, 1000
|
||||
)
|
||||
.progressed(function() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
|
||||
@@ -10,7 +9,7 @@ module.exports = syrup.serial()
|
||||
|
||||
function load() {
|
||||
log.info('Loading properties')
|
||||
return new DeviceClient(adb, options.serial).getProperties()
|
||||
return adb.getProperties(options.serial)
|
||||
.timeout(10000)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user