1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Mute devices when they're being used if the --mute-master option is given.

This commit is contained in:
Simo Kinnunen 2015-07-29 19:06:42 +09:00
parent aca27428b0
commit d9d47cc3bf
7 changed files with 65 additions and 2 deletions

View file

@ -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)