mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:13:31 +02:00
Mute devices when they're being used if the --mute-master option is given.
This commit is contained in:
@@ -671,6 +671,20 @@ module.exports = syrup.serial()
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
|
||||
plugin.setMasterMute = function(mode) {
|
||||
return runServiceCommand(
|
||||
apk.wire.MessageType.SET_MASTER_MUTE
|
||||
, new apk.wire.SetMasterMuteRequest(mode)
|
||||
)
|
||||
.timeout(10000)
|
||||
.then(function(data) {
|
||||
var response = apk.wire.SetMasterMuteResponse.decode(data)
|
||||
if (!response.success) {
|
||||
throw new Error('Unable to set master mute')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function runServiceCommand(type, cmd) {
|
||||
var resolver = Promise.defer()
|
||||
var id = Math.floor(Math.random() * 0xFFFFFF)
|
||||
|
||||
Reference in New Issue
Block a user