Skip to content

Commit

Permalink
Init DevTools Proto (#6450)
Browse files Browse the repository at this point in the history
- Create DevTools Init Proto
- Send a DevTools Init Proto when a websocket is connected.

cc: @piotrswigon @jasonwyatt

Closes #6450

COPYBARA_INTEGRATE_REVIEW=#6450 from SHeimlich:devtools-protos2 32df92b
PiperOrigin-RevId: 339155446
  • Loading branch information
SHeimlich authored and arcs-c3po committed Oct 27, 2020
1 parent a899496 commit f724178
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions java/arcs/android/devtools/DevToolsService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ open class DevToolsService : Service() {
private var refModeStoreCallbackToken: Int = -1
private var directStoreCallbackToken: Int = -1

private val initProto = DevtoolsMessage.DevToolsInitProto.newBuilder()
.setDevToolsVersion(0)
.setPlatform(DevtoolsMessage.DevToolsInitProto.Platform.ANDROID)
.build()

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
// Connect to the storage service and obtain the devToolsProxy.
scope.launch {
Expand Down Expand Up @@ -112,6 +117,7 @@ open class DevToolsService : Service() {

binder.send(service.storageKeys ?: "")
devToolsServer.addOnOpenWebsocketCallback {
devToolsServer.send(initProto.toString())
devToolsServer.send(service.storageKeys ?: "")
}

Expand Down
10 changes: 10 additions & 0 deletions java/arcs/android/devtools/devtools_message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ message DevToolsProxyMessageProto {
string storage_key = 2;
StoreType store_type = 3;
}

message DevToolsInitProto {
int32 dev_tools_version = 1;
enum Platform {
PLATFORM_UNKNOWN = 0;
ANDROID = 1;
// Future types include web.
}
Platform platform = 2;
}

0 comments on commit f724178

Please sign in to comment.