mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Lock rotation when devices are being used if --lock-rotation is given.
This commit is contained in:
parent
f179f80238
commit
a08f50e155
3 changed files with 12 additions and 2 deletions
11
lib/cli.js
11
lib/cli.js
|
@ -70,6 +70,8 @@ program
|
|||
, '${publicIp}:${publicPort}')
|
||||
.option('--mute-master'
|
||||
, 'whether to mute master volume when devices are being used')
|
||||
.option('--lock-rotation'
|
||||
, 'whether to lock rotation when devices are being used')
|
||||
.action(function() {
|
||||
var serials = cliutil.allUnknownArgs(arguments)
|
||||
, options = cliutil.lastArg(arguments)
|
||||
|
@ -110,7 +112,8 @@ program
|
|||
, '--connect-url-pattern', options.connectUrlPattern
|
||||
, '--heartbeat-interval', options.heartbeatInterval
|
||||
]
|
||||
.concat(options.muteMaster ? ['--mute-master'] : []))
|
||||
.concat(options.muteMaster ? ['--mute-master'] : [])
|
||||
.concat(options.lockRotation ? ['--lock-rotation'] : []))
|
||||
}
|
||||
, endpoints: {
|
||||
sub: options.connectSub
|
||||
|
@ -172,6 +175,8 @@ program
|
|||
, 10000)
|
||||
.option('--mute-master'
|
||||
, 'whether to mute master volume when devices are being used')
|
||||
.option('--lock-rotation'
|
||||
, 'whether to lock rotation when devices are being used')
|
||||
.action(function(serial, options) {
|
||||
if (!options.connectSub) {
|
||||
this.missingArgument('--connect-sub')
|
||||
|
@ -210,6 +215,7 @@ program
|
|||
, connectPort: options.connectPort
|
||||
, heartbeatInterval: options.heartbeatInterval
|
||||
, muteMaster: options.muteMaster
|
||||
, lockRotation: options.lockRotation
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -942,6 +948,8 @@ program
|
|||
, String)
|
||||
.option('--mute-master'
|
||||
, 'whether to mute master volume when devices are being used')
|
||||
.option('--lock-rotation'
|
||||
, 'whether to lock rotation when devices are being used')
|
||||
.action(function() {
|
||||
var log = logger.createLogger('cli:local')
|
||||
, args = arguments
|
||||
|
@ -1008,6 +1016,7 @@ program
|
|||
]
|
||||
.concat(options.allowRemote ? ['--allow-remote'] : [])
|
||||
.concat(options.muteMaster ? ['--mute-master'] : [])
|
||||
.concat(options.lockRotation ? ['--lock-rotation'] : [])
|
||||
.concat(cliutil.allUnknownArgs(args)))
|
||||
|
||||
// auth
|
||||
|
|
|
@ -104,6 +104,7 @@ module.exports = syrup.serial()
|
|||
|
||||
plugin.on('leave', function() {
|
||||
service.pressKey('home')
|
||||
service.thawRotation()
|
||||
service.releaseWakeLock()
|
||||
})
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ module.exports = syrup.serial()
|
|||
plugin.rotate = function(rotation) {
|
||||
return runAgentCommand(
|
||||
apk.wire.MessageType.SET_ROTATION
|
||||
, new apk.wire.SetRotationRequest(rotation, false)
|
||||
, new apk.wire.SetRotationRequest(rotation, options.lockRotation || false)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue