diff --git a/lib/roles/device/plugins/account.js b/lib/roles/device/plugins/account.js index 428f6390..6a971d48 100644 --- a/lib/roles/device/plugins/account.js +++ b/lib/roles/device/plugins/account.js @@ -14,12 +14,12 @@ module.exports = syrup.serial() .define(function(options, service, identity, touch, router, push, adb) { var log = logger.createLogger('device:plugins:account') - router.on(wire.AccountRemoveMessage, function(channel) { + router.on(wire.AccountRemoveMessage, function(channel, message) { var reply = wireutil.reply(options.serial) - log.info('Removing current Google account(s)') + log.info('Removing "%s" account(s)', message.type) - service.removeAccount() + service.removeAccount(message) .timeout(30000) .then(function() { push.send([ diff --git a/lib/roles/device/plugins/service.js b/lib/roles/device/plugins/service.js index aeb0e2fa..1769c004 100644 --- a/lib/roles/device/plugins/service.js +++ b/lib/roles/device/plugins/service.js @@ -490,14 +490,17 @@ module.exports = syrup.serial() }) } - plugin.removeAccount = function() { + plugin.removeAccount = function(data) { return runServiceCommand( - apk.wire.MessageType.REMOVE_ACCOUNT - , new apk.wire.RemoveAccountRequest() + apk.wire.MessageType.DO_REMOVE_ACCOUNT + , new apk.wire.DoRemoveAccountRequest({ + type: data.type + , account: data.account + }) ) .timeout(15000) .then(function(data) { - var response = apk.wire.RemoveAccountResponse.decode(data) + var response = apk.wire.DoRemoveAccountResponse.decode(data) if (response.success) { return true } @@ -523,9 +526,7 @@ module.exports = syrup.serial() plugin.setRingerMode = function(mode) { return runServiceCommand( apk.wire.MessageType.SET_RINGER_MODE - , new apk.wire.SetRingerModeRequest( - mode - ) + , new apk.wire.SetRingerModeRequest(mode) ) .timeout(10000) .then(function(data) { diff --git a/lib/roles/device/resources/service.js b/lib/roles/device/resources/service.js index 7a23f7b5..ba7c5d33 100644 --- a/lib/roles/device/resources/service.js +++ b/lib/roles/device/resources/service.js @@ -15,7 +15,7 @@ module.exports = syrup.serial() var log = logger.createLogger('device:resources:service') var resource = { - requiredVersion: '0.7.16' + requiredVersion: '0.7.17' , pkg: 'jp.co.cyberagent.stf' , main: 'jp.co.cyberagent.stf.Agent' , apk: pathutil.vendor('STFService/STFService.apk') diff --git a/lib/roles/websocket.js b/lib/roles/websocket.js index e084717f..3925738c 100644 --- a/lib/roles/websocket.js +++ b/lib/roles/websocket.js @@ -332,13 +332,13 @@ module.exports = function(options) { ) ]) }) - .on('account.remove', function(channel, responseChannel) { + .on('account.remove', function(channel, responseChannel, data) { joinChannel(responseChannel) push.send([ channel , wireutil.transaction( responseChannel - , new wire.AccountRemoveMessage() + , new wire.AccountRemoveMessage(data) ) ]) }) diff --git a/lib/wire/wire.proto b/lib/wire/wire.proto index c95b81a8..4f43cdd2 100644 --- a/lib/wire/wire.proto +++ b/lib/wire/wire.proto @@ -391,6 +391,8 @@ message ConnectStopMessage { } message AccountRemoveMessage { + required string type = 1; + optional string account = 2; } message AccountAddMenuMessage { diff --git a/res/app/components/stf/control/control-service.js b/res/app/components/stf/control/control-service.js index 5a862265..1477b76f 100644 --- a/res/app/components/stf/control/control-service.js +++ b/res/app/components/stf/control/control-service.js @@ -218,8 +218,11 @@ module.exports = function ControlServiceFactory( return sendTwoWay('screen.capture') } - this.removeAccount = function() { - return sendTwoWay('account.remove') + this.removeAccount = function(type, account) { + return sendTwoWay('account.remove', { + type: type + , account: account + }) } this.addAccountMenu = function() { diff --git a/vendor/STFService/STFService.apk b/vendor/STFService/STFService.apk index aa49117c..010999c3 100644 Binary files a/vendor/STFService/STFService.apk and b/vendor/STFService/STFService.apk differ diff --git a/vendor/STFService/wire.proto b/vendor/STFService/wire.proto index 69d892ec..2068a82c 100644 --- a/vendor/STFService/wire.proto +++ b/vendor/STFService/wire.proto @@ -8,6 +8,7 @@ enum MessageType { DO_TYPE = 3; DO_WAKE = 4; DO_ADD_ACCOUNT_MENU = 24; + DO_REMOVE_ACCOUNT = 20; GET_BROWSERS = 5; GET_CLIPBOARD = 6; GET_DISPLAY = 19; @@ -27,7 +28,6 @@ enum MessageType { EVENT_PHONE_STATE = 16; EVENT_ROTATION = 17; EVENT_BROWSER_PACKAGE = 18; - REMOVE_ACCOUNT = 20; } message Envelope { @@ -185,10 +185,12 @@ message DoAddAccountMenuResponse { required bool success = 1; } -message RemoveAccountRequest { +message DoRemoveAccountRequest { + required string type = 1; + optional string account = 2; } -message RemoveAccountResponse { +message DoRemoveAccountResponse { required bool success = 1; }