Skip to content

Commit c09fbae

Browse files
DeviceInfracopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 876518519
1 parent a366b82 commit c09fbae

File tree

19 files changed

+846
-69
lines changed

19 files changed

+846
-69
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
load("@protobuf//bazel:java_proto_library.bzl", "java_proto_library")
17+
load("@protobuf//bazel:proto_library.bzl", "proto_library")
18+
19+
package(
20+
default_applicable_licenses = ["//:license"],
21+
default_visibility = ["//visibility:public"],
22+
)
23+
24+
proto_library(
25+
name = "common_resources_proto",
26+
srcs = ["common_resources.proto"],
27+
)
28+
29+
java_proto_library(
30+
name = "common_resources_java_proto",
31+
deps = [":common_resources_proto"],
32+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2022 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
syntax = "proto3";
18+
19+
package devtools.mobileharness.fe.v6.service.proto.common;
20+
21+
option java_package = "com.google.devtools.mobileharness.fe.v6.service.proto.common";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "CommonResourcesProto";
24+
25+
// Information about user and group permissions.
26+
message PermissionInfo {
27+
// List of users/groups who own the resource.
28+
repeated string owners = 1;
29+
// List of users/groups who can execute actions on the resource.
30+
repeated string executors = 2;
31+
}
32+
33+
// Represents one dimension of a resource (e.g., device, host).
34+
message DeviceDimension {
35+
string name = 1;
36+
string value = 2;
37+
}

src/devtools/mobileharness/fe/v6/service/proto/config/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ package(
2828
proto_library(
2929
name = "config_resources_proto",
3030
srcs = ["config_resources.proto"],
31+
deps = [
32+
"//src/devtools/mobileharness/fe/v6/service/proto/common:common_resources_proto",
33+
],
3134
)
3235

3336
java_proto_library(

src/devtools/mobileharness/fe/v6/service/proto/config/config_resources.proto

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,12 @@ syntax = "proto3";
1818

1919
package devtools.mobileharness.fe.v6.service.proto.config;
2020

21+
import "src/devtools/mobileharness/fe/v6/service/proto/common/common_resources.proto";
22+
2123
option java_package = "com.google.devtools.mobileharness.fe.v6.service.proto.config";
2224
option java_multiple_files = true;
2325
option java_outer_classname = "ConfigResourcesProto";
2426

25-
// Represents a single dimension name-value pair.
26-
message DeviceDimension {
27-
string name = 1;
28-
string value = 2;
29-
}
30-
31-
// Defines who can control and use a device.
32-
message PermissionInfo {
33-
// List of users or groups who have full control over the device,
34-
// including changing its configuration.
35-
repeated string owners = 1;
36-
// List of users or groups who are allowed to execute tests on the device.
37-
repeated string executors = 2;
38-
}
39-
4027
// Configuration for the device's default Wi-Fi network.
4128
message WifiConfig {
4229
// Type of Wi-Fi configuration.
@@ -74,10 +61,13 @@ message StabilitySettings {
7461
// in the UI.
7562
message DeviceConfig {
7663
message Dimensions {
77-
repeated DeviceDimension supported = 1;
78-
repeated DeviceDimension required = 2;
64+
repeated devtools.mobileharness.fe.v6.service.proto.common.DeviceDimension
65+
supported = 1;
66+
repeated devtools.mobileharness.fe.v6.service.proto.common.DeviceDimension
67+
required = 2;
7968
}
80-
PermissionInfo permissions = 1;
69+
devtools.mobileharness.fe.v6.service.proto.common.PermissionInfo permissions =
70+
1;
8171
WifiConfig wifi = 2;
8272
Dimensions dimensions = 3;
8373
StabilitySettings settings = 4;
@@ -113,20 +103,12 @@ enum DeviceConfigSection {
113103
ALL = 5;
114104
}
115105

116-
// Defines a principal (user or group) allowed to SSH as a specific login user.
117-
message SshPrincipal {
118-
// The username on the host machine (e.g., 'root', 'mobileharness')
119-
string login_user = 1;
120-
// List of users or MDB groups allowed to assume the loginUser role
121-
repeated string principals = 2;
122-
}
123-
124106
// Permissions for the host.
125107
message HostPermissions {
126108
// Users/groups who can edit this host config.
127109
repeated string host_admins = 1;
128-
repeated SshPrincipal ssh_access =
129-
2; // Defines SSH access rules. Will be [] if no rules are set.
110+
111+
reserved 2;
130112
}
131113

132114
// Device configuration mode for the host.

src/devtools/mobileharness/fe/v6/service/proto/device/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ proto_library(
2929
name = "device_resources_proto",
3030
srcs = ["device_resources.proto"],
3131
deps = [
32+
"//src/devtools/mobileharness/fe/v6/service/proto/common:common_resources_proto",
3233
"@protobuf//:timestamp_proto",
3334
],
3435
)

src/devtools/mobileharness/fe/v6/service/proto/device/device_resources.proto

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ syntax = "proto3";
1919
package devtools.mobileharness.fe.v6.service.proto.device;
2020

2121
import "google/protobuf/timestamp.proto";
22+
import "src/devtools/mobileharness/fe/v6/service/proto/common/common_resources.proto";
2223

2324
option java_package = "com.google.devtools.mobileharness.fe.v6.service.proto.device";
2425
option java_multiple_files = true;
@@ -41,7 +42,8 @@ message DeviceOverview {
4142
BasicDeviceInfo basic_info = 4;
4243

4344
// Permissions defining who can own and execute tests on the device.
44-
PermissionInfo permissions = 5;
45+
devtools.mobileharness.fe.v6.service.proto.common.PermissionInfo permissions =
46+
5;
4547

4648
// Lists of supported drivers and decorators for the device.
4749
CapabilitiesInfo capabilities = 6;
@@ -175,14 +177,6 @@ message BasicDeviceInfo {
175177
string build = 8;
176178
}
177179

178-
// Information about user and group permissions for the device.
179-
message PermissionInfo {
180-
// List of users/groups who own the device.
181-
repeated string owners = 1;
182-
// List of users/groups who can execute tests on the device.
183-
repeated string executors = 2;
184-
}
185-
186180
// Lists of supported test drivers and decorators.
187181
message CapabilitiesInfo {
188182
// Test drivers compatible with this device.
@@ -191,15 +185,10 @@ message CapabilitiesInfo {
191185
repeated string supported_decorators = 2;
192186
}
193187

194-
// Represents one dimension of the device.
195-
message DeviceDimension {
196-
string name = 1;
197-
string value = 2;
198-
}
199-
200188
// Represents a group of dimensions from a single source.
201189
message DimensionSourceGroup {
202-
repeated DeviceDimension dimensions = 1;
190+
repeated devtools.mobileharness.fe.v6.service.proto.common.DeviceDimension
191+
dimensions = 1;
203192
}
204193

205194
// Device dimensions, categorized into 'supported' and 'required'.
@@ -214,7 +203,8 @@ message Dimensions {
214203
message SubDeviceInfo {
215204
string id = 1;
216205
repeated DeviceType types = 2;
217-
repeated DeviceDimension dimensions = 3;
206+
repeated devtools.mobileharness.fe.v6.service.proto.common.DeviceDimension
207+
dimensions = 3;
218208

219209
// Model of the sub-device.
220210
string model = 4;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
load("@rules_java//java:java_library.bzl", "java_library")
17+
18+
package(
19+
default_applicable_licenses = ["//:license"],
20+
default_visibility = ["//src/devtools/mobileharness/fe/v6:visibility"],
21+
)
22+
23+
java_library(
24+
name = "device_config_converter",
25+
srcs = ["DeviceConfigConverter.java"],
26+
deps = [
27+
"//src/devtools/mobileharness/api/deviceconfig/proto:basic_java_proto",
28+
"//src/devtools/mobileharness/api/deviceconfig/proto:lab_java_proto",
29+
"//src/devtools/mobileharness/api/model/proto:device_java_proto",
30+
"//src/devtools/mobileharness/fe/v6/service/proto/common:common_resources_java_proto",
31+
"//src/devtools/mobileharness/fe/v6/service/proto/config:config_resources_java_proto",
32+
"@maven//:com_google_guava_guava",
33+
"@maven//:com_google_protobuf_protobuf_java",
34+
],
35+
)

0 commit comments

Comments
 (0)