mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 03:53:22 +02:00
Introduce support for new VM based minicap to support Android 12
This commit introduce a new option to use a new minicap implementation by specifying --screen-grabber or the env variable SCREEN_GRABBER. The current native minicap is the default and is refered as 'minicap-bin'. The new minicap which is packaged in an apk is usable with 'minicap-apk' and will be used as a fallback. At the moment, this apk is expected to be included in minicap-prebuilt node package at this location minicap-prebuilt/prebuilt/noarch/minicap.apk. STFService.apk has also been updated to take into account Android 12 Signed-off-by: Crepieux Pierre <pierre.crepieux@orange.com>
This commit is contained in:
@@ -33,7 +33,7 @@ module.exports = syrup.serial()
|
||||
log.info('Capturing screenshot')
|
||||
|
||||
var file = util.format('/data/local/tmp/minicap_%d.jpg', Date.now())
|
||||
return minicap.run(util.format(
|
||||
return minicap.run('minicap-apk', util.format(
|
||||
'-P %s -s >%s', projectionFormat(), file))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(function() {
|
||||
|
||||
@@ -25,8 +25,9 @@ module.exports = syrup.serial()
|
||||
.dependency(require('./options'))
|
||||
.define(function(options, adb, minicap, display, screenOptions) {
|
||||
var log = logger.createLogger('device:plugins:screen:stream')
|
||||
log.info("ScreenGrabber option set to %s", options.screenGrabber)
|
||||
|
||||
function FrameProducer(config) {
|
||||
function FrameProducer(config, grabber) {
|
||||
EventEmitter.call(this)
|
||||
this.actionQueue = []
|
||||
this.runningState = FrameProducer.STATE_STOPPED
|
||||
@@ -37,6 +38,7 @@ module.exports = syrup.serial()
|
||||
this.banner = null
|
||||
this.parser = null
|
||||
this.frameConfig = config
|
||||
this.grabber = options.screenGrabber
|
||||
this.readable = false
|
||||
this.needsReadable = false
|
||||
this.failCounter = new FailCounter(3, 10000)
|
||||
@@ -102,7 +104,7 @@ module.exports = syrup.serial()
|
||||
.catch(function(err) {
|
||||
return this._stop().finally(function() {
|
||||
this.failCounter.inc()
|
||||
this.emit('error', err)
|
||||
this.grabber = 'minicap-apk'
|
||||
})
|
||||
})
|
||||
.finally(function() {
|
||||
@@ -227,13 +229,13 @@ module.exports = syrup.serial()
|
||||
}
|
||||
|
||||
FrameProducer.prototype._startService = function() {
|
||||
log.info('Launching screen service')
|
||||
return minicap.run(util.format(
|
||||
'-S -Q %d -P %s'
|
||||
, options.screenJpegQuality
|
||||
, this.frameConfig.toString()
|
||||
))
|
||||
.timeout(10000)
|
||||
log.info('Launching screen service %s', this.grabber)
|
||||
return minicap.run(this.grabber,util.format(
|
||||
'-S -Q %d -P %s'
|
||||
, options.screenJpegQuality
|
||||
, this.frameConfig.toString()
|
||||
))
|
||||
.timeout(10000)
|
||||
}
|
||||
|
||||
FrameProducer.prototype._readOutput = function(out) {
|
||||
@@ -448,6 +450,7 @@ module.exports = syrup.serial()
|
||||
|
||||
return createServer()
|
||||
.then(function(wss) {
|
||||
log.info("creating FrameProducer: %s", options.screenGrabber)
|
||||
var frameProducer = new FrameProducer(
|
||||
new FrameConfig(display.properties, display.properties))
|
||||
var broadcastSet = frameProducer.broadcastSet = new BroadcastSet()
|
||||
|
||||
Reference in New Issue
Block a user