Class DirectAccessServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
Each Session will wait for available capacity, at a higher priority over Test Execution. When allocated, the session will be exposed through a stream for integration.
DirectAccessService is currently available as a preview to select developers. You can register today on behalf of you and your team at https://developer.android.com/studio/preview/android-device-streaming
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
DeviceSession deviceSession = DeviceSession.newBuilder().build();
String deviceSessionId = "deviceSessionId-544276325";
DeviceSession response =
directAccessServiceClient.createDeviceSession(parent, deviceSession, deviceSessionId);
}
Note: close() needs to be called on the DirectAccessServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
CreateDeviceSession |
Creates a DeviceSession. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDeviceSessions |
Lists DeviceSessions owned by the project user. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDeviceSession |
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CancelDeviceSession |
Cancel a DeviceSession. This RPC changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDeviceSession |
Updates the current DeviceSession to the fields described by the update_mask. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
AdbConnect |
Exposes an ADB connection if the device supports ADB. gRPC headers are used to authenticate the Connect RPC, as well as associate to a particular DeviceSession. In particular, the user must specify the "X-Omnilab-Session-Name" header. |
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of DirectAccessServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DirectAccessServiceSettings directAccessServiceSettings =
DirectAccessServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DirectAccessServiceClient directAccessServiceClient =
DirectAccessServiceClient.create(directAccessServiceSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DirectAccessServiceSettings directAccessServiceSettings =
DirectAccessServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DirectAccessServiceClient directAccessServiceClient =
DirectAccessServiceClient.create(directAccessServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
DirectAccessServiceSettings directAccessServiceSettings =
DirectAccessServiceSettings.newHttpJsonBuilder().build();
DirectAccessServiceClient directAccessServiceClient =
DirectAccessServiceClient.create(directAccessServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of DirectAccessServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionExposes an ADB connection if the device supports ADB. gRPC headers are used to authenticate the Connect RPC, as well as associate to a particular DeviceSession.booleanawaitTermination(long duration, TimeUnit unit) final voidCancel a DeviceSession.final UnaryCallable<CancelDeviceSessionRequest,com.google.protobuf.Empty> Cancel a DeviceSession.final voidclose()static final DirectAccessServiceClientcreate()Constructs an instance of DirectAccessServiceClient with default settings.static final DirectAccessServiceClientcreate(DirectAccessServiceSettings settings) Constructs an instance of DirectAccessServiceClient, using the given settings.static final DirectAccessServiceClientConstructs an instance of DirectAccessServiceClient, using the given stub for making calls.final DeviceSessionCreates a DeviceSession.final DeviceSessioncreateDeviceSession(ProjectName parent, DeviceSession deviceSession, String deviceSessionId) Creates a DeviceSession.final DeviceSessioncreateDeviceSession(String parent, DeviceSession deviceSession, String deviceSessionId) Creates a DeviceSession.Creates a DeviceSession.final DeviceSessionGets a DeviceSession, which documents the allocation status and whether the device is allocated.final DeviceSessiongetDeviceSession(GetDeviceSessionRequest request) Gets a DeviceSession, which documents the allocation status and whether the device is allocated.final DeviceSessiongetDeviceSession(String name) Gets a DeviceSession, which documents the allocation status and whether the device is allocated.Gets a DeviceSession, which documents the allocation status and whether the device is allocated.getStub()booleanbooleanLists DeviceSessions owned by the project user.listDeviceSessions(ProjectName parent) Lists DeviceSessions owned by the project user.listDeviceSessions(String parent) Lists DeviceSessions owned by the project user.Lists DeviceSessions owned by the project user.final UnaryCallable<ListDeviceSessionsRequest,DirectAccessServiceClient.ListDeviceSessionsPagedResponse> Lists DeviceSessions owned by the project user.voidshutdown()voidfinal DeviceSessionupdateDeviceSession(DeviceSession deviceSession, com.google.protobuf.FieldMask updateMask) Updates the current DeviceSession to the fields described by the update_mask.final DeviceSessionUpdates the current DeviceSession to the fields described by the update_mask.Updates the current DeviceSession to the fields described by the update_mask.
-
Constructor Details
-
DirectAccessServiceClient
Constructs an instance of DirectAccessServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.- Throws:
IOException
-
DirectAccessServiceClient
-
-
Method Details
-
create
Constructs an instance of DirectAccessServiceClient with default settings.- Throws:
IOException
-
create
public static final DirectAccessServiceClient create(DirectAccessServiceSettings settings) throws IOException Constructs an instance of DirectAccessServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.- Throws:
IOException
-
create
Constructs an instance of DirectAccessServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DirectAccessServiceSettings). -
getSettings
-
getStub
-
createDeviceSession
public final DeviceSession createDeviceSession(ProjectName parent, DeviceSession deviceSession, String deviceSessionId) Creates a DeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); DeviceSession deviceSession = DeviceSession.newBuilder().build(); String deviceSessionId = "deviceSessionId-544276325"; DeviceSession response = directAccessServiceClient.createDeviceSession(parent, deviceSession, deviceSessionId); }- Parameters:
parent- Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"deviceSession- Required. A DeviceSession to create.deviceSessionId- Optional. The ID to use for the DeviceSession, which will become the final component of the DeviceSession's resource name.This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
- Throws:
ApiException- if the remote call fails
-
createDeviceSession
public final DeviceSession createDeviceSession(String parent, DeviceSession deviceSession, String deviceSessionId) Creates a DeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); DeviceSession deviceSession = DeviceSession.newBuilder().build(); String deviceSessionId = "deviceSessionId-544276325"; DeviceSession response = directAccessServiceClient.createDeviceSession(parent, deviceSession, deviceSessionId); }- Parameters:
parent- Required. The Compute Engine project under which this device will be allocated. "projects/{project_id}"deviceSession- Required. A DeviceSession to create.deviceSessionId- Optional. The ID to use for the DeviceSession, which will become the final component of the DeviceSession's resource name.This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/.
- Throws:
ApiException- if the remote call fails
-
createDeviceSession
Creates a DeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { CreateDeviceSessionRequest request = CreateDeviceSessionRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setDeviceSession(DeviceSession.newBuilder().build()) .setDeviceSessionId("deviceSessionId-544276325") .build(); DeviceSession response = directAccessServiceClient.createDeviceSession(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createDeviceSessionCallable
Creates a DeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { CreateDeviceSessionRequest request = CreateDeviceSessionRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setDeviceSession(DeviceSession.newBuilder().build()) .setDeviceSessionId("deviceSessionId-544276325") .build(); ApiFuture<DeviceSession> future = directAccessServiceClient.createDeviceSessionCallable().futureCall(request); // Do something. DeviceSession response = future.get(); } -
listDeviceSessions
public final DirectAccessServiceClient.ListDeviceSessionsPagedResponse listDeviceSessions(ProjectName parent) Lists DeviceSessions owned by the project user.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); for (DeviceSession element : directAccessServiceClient.listDeviceSessions(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The name of the parent to request, e.g. "projects/{project_id}"- Throws:
ApiException- if the remote call fails
-
listDeviceSessions
public final DirectAccessServiceClient.ListDeviceSessionsPagedResponse listDeviceSessions(String parent) Lists DeviceSessions owned by the project user.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { String parent = ProjectName.of("[PROJECT]").toString(); for (DeviceSession element : directAccessServiceClient.listDeviceSessions(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The name of the parent to request, e.g. "projects/{project_id}"- Throws:
ApiException- if the remote call fails
-
listDeviceSessions
public final DirectAccessServiceClient.ListDeviceSessionsPagedResponse listDeviceSessions(ListDeviceSessionsRequest request) Lists DeviceSessions owned by the project user.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { ListDeviceSessionsRequest request = ListDeviceSessionsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); for (DeviceSession element : directAccessServiceClient.listDeviceSessions(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listDeviceSessionsPagedCallable
public final UnaryCallable<ListDeviceSessionsRequest,DirectAccessServiceClient.ListDeviceSessionsPagedResponse> listDeviceSessionsPagedCallable()Lists DeviceSessions owned by the project user.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { ListDeviceSessionsRequest request = ListDeviceSessionsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); ApiFuture<DeviceSession> future = directAccessServiceClient.listDeviceSessionsPagedCallable().futureCall(request); // Do something. for (DeviceSession element : future.get().iterateAll()) { // doThingsWith(element); } } -
listDeviceSessionsCallable
public final UnaryCallable<ListDeviceSessionsRequest,ListDeviceSessionsResponse> listDeviceSessionsCallable()Lists DeviceSessions owned by the project user.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { ListDeviceSessionsRequest request = ListDeviceSessionsRequest.newBuilder() .setParent(ProjectName.of("[PROJECT]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .setFilter("filter-1274492040") .build(); while (true) { ListDeviceSessionsResponse response = directAccessServiceClient.listDeviceSessionsCallable().call(request); for (DeviceSession element : response.getDeviceSessionsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getDeviceSession
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { DeviceSessionName name = DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]"); DeviceSession response = directAccessServiceClient.getDeviceSession(name); }- Parameters:
name- Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"- Throws:
ApiException- if the remote call fails
-
getDeviceSession
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { String name = DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]").toString(); DeviceSession response = directAccessServiceClient.getDeviceSession(name); }- Parameters:
name- Required. Name of the DeviceSession, e.g. "projects/{project_id}/deviceSessions/{session_id}"- Throws:
ApiException- if the remote call fails
-
getDeviceSession
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { GetDeviceSessionRequest request = GetDeviceSessionRequest.newBuilder() .setName(DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]").toString()) .build(); DeviceSession response = directAccessServiceClient.getDeviceSession(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getDeviceSessionCallable
Gets a DeviceSession, which documents the allocation status and whether the device is allocated. Clients making requests from this API must poll GetDeviceSession.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { GetDeviceSessionRequest request = GetDeviceSessionRequest.newBuilder() .setName(DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]").toString()) .build(); ApiFuture<DeviceSession> future = directAccessServiceClient.getDeviceSessionCallable().futureCall(request); // Do something. DeviceSession response = future.get(); } -
cancelDeviceSession
Cancel a DeviceSession. This RPC changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { CancelDeviceSessionRequest request = CancelDeviceSessionRequest.newBuilder() .setName(DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]").toString()) .build(); directAccessServiceClient.cancelDeviceSession(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
cancelDeviceSessionCallable
public final UnaryCallable<CancelDeviceSessionRequest,com.google.protobuf.Empty> cancelDeviceSessionCallable()Cancel a DeviceSession. This RPC changes the DeviceSession to state FINISHED and terminates all connections. Canceled sessions are not deleted and can be retrieved or listed by the user until they expire based on the 28 day deletion policy.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { CancelDeviceSessionRequest request = CancelDeviceSessionRequest.newBuilder() .setName(DeviceSessionName.of("[PROJECT]", "[DEVICE_SESSION]").toString()) .build(); ApiFuture<Empty> future = directAccessServiceClient.cancelDeviceSessionCallable().futureCall(request); // Do something. future.get(); } -
updateDeviceSession
public final DeviceSession updateDeviceSession(DeviceSession deviceSession, com.google.protobuf.FieldMask updateMask) Updates the current DeviceSession to the fields described by the update_mask.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { DeviceSession deviceSession = DeviceSession.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); DeviceSession response = directAccessServiceClient.updateDeviceSession(deviceSession, updateMask); }- Parameters:
deviceSession- Required. DeviceSession to update. The DeviceSession's `name` field is used to identify the session to update "projects/{project_id}/deviceSessions/{session_id}"updateMask- Optional. The list of fields to update.- Throws:
ApiException- if the remote call fails
-
updateDeviceSession
Updates the current DeviceSession to the fields described by the update_mask.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { UpdateDeviceSessionRequest request = UpdateDeviceSessionRequest.newBuilder() .setDeviceSession(DeviceSession.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); DeviceSession response = directAccessServiceClient.updateDeviceSession(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateDeviceSessionCallable
Updates the current DeviceSession to the fields described by the update_mask.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { UpdateDeviceSessionRequest request = UpdateDeviceSessionRequest.newBuilder() .setDeviceSession(DeviceSession.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<DeviceSession> future = directAccessServiceClient.updateDeviceSessionCallable().futureCall(request); // Do something. DeviceSession response = future.get(); } -
adbConnectCallable
Exposes an ADB connection if the device supports ADB. gRPC headers are used to authenticate the Connect RPC, as well as associate to a particular DeviceSession. In particular, the user must specify the "X-Omnilab-Session-Name" header.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (DirectAccessServiceClient directAccessServiceClient = DirectAccessServiceClient.create()) { BidiStream<AdbMessage, DeviceMessage> bidiStream = directAccessServiceClient.adbConnectCallable().call(); AdbMessage request = AdbMessage.newBuilder().build(); bidiStream.send(request); for (DeviceMessage response : bidiStream) { // Do something when a response is received. } } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-