Skip to content

Commit

Permalink
Lock rotation when devices are being used if --lock-rotation is given.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorccu committed Aug 25, 2015
1 parent f179f80 commit a08f50e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -210,6 +215,7 @@ program
, connectPort: options.connectPort
, heartbeatInterval: options.heartbeatInterval
, muteMaster: options.muteMaster
, lockRotation: options.lockRotation
})
})

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/units/device/plugins/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module.exports = syrup.serial()

plugin.on('leave', function() {
service.pressKey('home')
service.thawRotation()
service.releaseWakeLock()
})

Expand Down
2 changes: 1 addition & 1 deletion lib/units/device/plugins/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down

0 comments on commit a08f50e

Please sign in to comment.