Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix adbkit API invocations (#524)" #528

Merged
merged 1 commit into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/units/api/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var util = require('util')
var _ = require('lodash')
var Promise = require('bluebird')
var uuid = require('uuid')
var adbkit = require('@devicefarmer/adbkit').Adb
var adbkit = require('@devicefarmer/adbkit')
var dbapi = require('../../../db/api')
var logger = require('../../../util/logger')
var datautil = require('../../../util/datautil')
Expand Down
2 changes: 1 addition & 1 deletion lib/units/device/plugins/screen/capture.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var util = require('util')

var syrup = require('@devicefarmer/stf-syrup')
var adbkit = require('@devicefarmer/adbkit').Adb
var adbkit = require('@devicefarmer/adbkit')

var logger = require('../../../../util/logger')
var wire = require('../../../../wire')
Expand Down
2 changes: 1 addition & 1 deletion lib/units/device/plugins/screen/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var WebSocket = require('ws')
var uuid = require('uuid')
var EventEmitter = require('eventemitter3')
var split = require('split')
var adbkit = require('@devicefarmer/adbkit').Adb
var adbkit = require('@devicefarmer/adbkit')

var logger = require('../../../../util/logger')
var lifecycle = require('../../../../util/lifecycle')
Expand Down
4 changes: 2 additions & 2 deletions lib/units/device/plugins/touch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var Promise = require('bluebird')
var syrup = require('@devicefarmer/stf-syrup')
var split = require('split')
var EventEmitter = require('eventemitter3')
var adbkit = require('@devicefarmer/adbkit').Adb
var Parser = require('@devicefarmer/adbkit').Parser
var adbkit = require('@devicefarmer/adbkit')
var Parser = require('@devicefarmer/adbkit/lib/adb/parser')

var wire = require('../../../../wire')
var logger = require('../../../../util/logger')
Expand Down
9 changes: 3 additions & 6 deletions lib/units/device/resources/minicap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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').DeviceClient

module.exports = syrup.serial()
.dependency(require('../support/adb'))
Expand Down Expand Up @@ -68,11 +67,9 @@ module.exports = syrup.serial()
, mode: 0755
})
}

var client = deviceClient(adb, options.serial)

function removeResource(res) {
return client.shell(['rm', '-f', res.dest])
return adb.shell(options.serial, ['rm', '-f', res.dest])
.timeout(10000)
.then(function(out) {
return streamutil.readAll(out)
Expand All @@ -81,7 +78,7 @@ module.exports = syrup.serial()
}

function pushResource(res) {
return client.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) {
Expand All @@ -96,7 +93,7 @@ module.exports = syrup.serial()
log.info('Installing "%s" as "%s"', res.src, res.dest)

function checkExecutable(res) {
return client.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.
Expand Down
13 changes: 4 additions & 9 deletions lib/units/device/resources/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var util = require('util')
var syrup = require('@devicefarmer/stf-syrup')
var ProtoBuf = require('protobufjs')
var semver = require('semver')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient

var pathutil = require('../../../util/pathutil')
var streamutil = require('../../../util/streamutil')
Expand Down Expand Up @@ -31,8 +30,7 @@ module.exports = syrup.serial()
}

function getPath() {
var client = deviceClient(adb, options.serial)
return client.shell(['pm', 'path', resource.pkg])
return adb.shell(options.serial, ['pm', 'path', resource.pkg])
.timeout(10000)
.then(function(out) {
return streamutil.findLine(out, (/^package:/))
Expand All @@ -48,8 +46,7 @@ module.exports = syrup.serial()
return getPath()
.then(function(installedPath) {
log.info('Running version check')
var client = deviceClient(adb, options.serial)
return client.shell(util.format(
return adb.shell(options.serial, util.format(
"export CLASSPATH='%s';" +
" exec app_process /system/bin '%s' --version 2>/dev/null"
, installedPath
Expand Down Expand Up @@ -77,13 +74,11 @@ module.exports = syrup.serial()
log.info('Installing STFService')
// Uninstall first to make sure we don't have any certificate
// issues.
var client = deviceClient(adb, options.serial)

return client.uninstall(resource.pkg)
return adb.uninstall(options.serial, resource.pkg)
.timeout(15000)
.then(function() {
return promiseutil.periodicNotify(
client.install(resource.apk)
adb.install(options.serial, resource.apk)
, 20000
)
.timeout(65000)
Expand Down
6 changes: 2 additions & 4 deletions lib/units/device/support/adb.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var syrup = require('@devicefarmer/stf-syrup')

var adbkit = require('@devicefarmer/adbkit').Adb
var deviceClient = require('@devicefarmer/adbkit').DeviceClient
var adbkit = require('@devicefarmer/adbkit')

var logger = require('../../../util/logger')
var promiseutil = require('../../../util/promiseutil')
Expand All @@ -16,9 +15,8 @@ module.exports = syrup.serial()
adb.Keycode = adbkit.Keycode

function ensureBootComplete() {
var client = deviceClient(adb, options.serial)
return promiseutil.periodicNotify(
client.waitBootComplete()
adb.waitBootComplete(options.serial)
, 1000
)
.progressed(function() {
Expand Down
4 changes: 1 addition & 3 deletions lib/units/device/support/properties.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var syrup = require('@devicefarmer/stf-syrup')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient

var logger = require('../../../util/logger')

Expand All @@ -10,8 +9,7 @@ module.exports = syrup.serial()

function load() {
log.info('Loading properties')
var client = deviceClient(adb, options.serial)
return client.getProperties()
return adb.getProperties(options.serial)
.timeout(10000)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/units/provider/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var adb = require('@devicefarmer/adbkit').Adb
var adb = require('@devicefarmer/adbkit')
var Promise = require('bluebird')
var _ = require('lodash')
var EventEmitter = require('eventemitter3')
Expand Down
2 changes: 1 addition & 1 deletion lib/units/websocket/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var socketio = require('socket.io')
var Promise = require('bluebird')
var _ = require('lodash')
var request = Promise.promisifyAll(require('request'))
var adbkit = require('@devicefarmer/adbkit').Adb
var adbkit = require('@devicefarmer/adbkit')
var uuid = require('uuid')

var logger = require('../../util/logger')
Expand Down
6 changes: 2 additions & 4 deletions lib/util/devutil.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var util = require('util')
var split = require('split')
var Promise = require('bluebird')
var androidDeviceList = require('android-device-list')
var deviceClient = require('@devicefarmer/adbkit').DeviceClient

var devutil = module.exports = Object.create(null)

Expand Down Expand Up @@ -72,8 +71,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
})
}

var client = deviceClient(adb, serial)
return client.shell('ps 2>/dev/null')
return adb.shell(serial, 'ps 2>/dev/null')
.then(findProcess)
.then(function(res) {
// return pids if process can be found in the output of 'ps' command
Expand All @@ -83,7 +81,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
}
// otherwise try to run 'ps -elf'
else {
return client.shell('ps -lef 2>/dev/null')
return adb.shell(serial, 'ps -lef 2>/dev/null')
.then(findProcess)
.then(function(res) {
return Promise.resolve(res.pids)
Expand Down
2 changes: 1 addition & 1 deletion lib/util/keyutil.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var util = require('util')

var adb = require('@devicefarmer/adbkit').Adb
var adb = require('@devicefarmer/adbkit')
var Promise = require('bluebird')

var keyutil = module.exports = Object.create(null)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"prepare": "bower install && not-in-install && gulp build || in-install"
},
"dependencies": {
"@devicefarmer/adbkit": "^3.2.3",
"@devicefarmer/adbkit": "^2.11.3",
"@devicefarmer/adbkit-apkreader": "^3.2.3",
"@devicefarmer/adbkit-monkey": "^1.2.0",
"@devicefarmer/minicap-prebuilt": "^2.7.1",
Expand Down
Loading