Skip to content

Commit 317084a

Browse files
DeviceInfracopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 875013211
1 parent f778666 commit 317084a

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

src/java/com/google/devtools/mobileharness/api/devicemanager/detector/model/DetectionResult.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,6 @@ public enum DetectionType {
7373
TTB,
7474
VIDEO,
7575
WINDOWS,
76+
ZEBU,
7677
}
7778
}

src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher/util/DeviceIdGenerator.java

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ public DeviceId getUsbDeviceId(String deviceControlId) {
133133
public DeviceId getSshDeviceId(String deviceControlId) {
134134
try {
135135
return DeviceId.of(
136-
deviceControlId, String.format("%s:%s", getLocalHostName(), deviceControlId), false);
136+
deviceControlId,
137+
String.format("%s:%s", getLocalHostName(), deviceControlId),
138+
/* isUuidVolatile= */ false);
137139
} catch (MobileHarnessException e) {
138140
// Should not happen.
139141
logger.atWarning().withCause(e).log(
140142
"Failed to generate sshable EmbeddedLinuxDevice uuid, use random uuid instead.");
141-
return DeviceId.of(deviceControlId, UUID.randomUUID().toString(), false);
143+
return DeviceId.of(
144+
deviceControlId, UUID.randomUUID().toString(), /* isUuidVolatile= */ false);
142145
}
143146
}
144147

@@ -154,7 +157,7 @@ public DeviceId getVideoDeviceId(String deviceControlId) {
154157
return DeviceId.of(
155158
deviceControlId,
156159
String.format("%s:%s", getLocalHostName(), deviceControlId).replace('/', '-'),
157-
false);
160+
/* isUuidVolatile= */ false);
158161
} catch (MobileHarnessException e) {
159162
throw new AssertionError("Failed to generate VideoDevice uuid.", e);
160163
}
@@ -168,12 +171,13 @@ public DeviceId getVideoDeviceId(String deviceControlId) {
168171
*/
169172
public DeviceId getLinuxDeviceId(String deviceControlId) {
170173
try {
171-
return DeviceId.of(deviceControlId, getLocalHostName(), false);
174+
return DeviceId.of(deviceControlId, getLocalHostName(), /* isUuidVolatile= */ false);
172175
} catch (MobileHarnessException e) {
173176
// Should not happen.
174177
logger.atWarning().withCause(e).log(
175178
"Failed to generate LinuxDevice uuid, use random uuid instead.");
176-
return DeviceId.of(deviceControlId, UUID.randomUUID().toString(), false);
179+
return DeviceId.of(
180+
deviceControlId, UUID.randomUUID().toString(), /* isUuidVolatile= */ false);
177181
}
178182
}
179183

@@ -191,25 +195,44 @@ public DeviceId getNoOpDeviceId(String deviceControlId) {
191195
// Should not happen.
192196
logger.atWarning().withCause(e).log(
193197
"Failed to generate NoOpDevice uuid, use random uuid instead..");
194-
return DeviceId.of(deviceControlId, UUID.randomUUID().toString(), true);
198+
return DeviceId.of(deviceControlId, UUID.randomUUID().toString(), /* isUuidVolatile= */ true);
195199
}
196200
}
197201

198202
/**
199-
* Generates the gem5 device id from device control id, adds the lab host name as the prefix of
203+
* Generates the Gem5 device id from device control id, adds the lab host name as the prefix of
200204
* the uuid.
201205
*
202206
* @param deviceControlId the device control id from detector.
203207
*/
204208
public DeviceId getGem5DeviceId(String deviceControlId) {
205209
try {
206210
return DeviceId.of(
207-
deviceControlId, String.format("%s:%s", getLocalHostName(), deviceControlId), false);
211+
deviceControlId,
212+
String.format("%s:%s", getLocalHostName(), deviceControlId),
213+
/* isUuidVolatile= */ false);
208214
} catch (MobileHarnessException e) {
209215
throw new AssertionError("Failed to generate Gem5Device uuid.", e);
210216
}
211217
}
212218

219+
/**
220+
* Generates the ZeBu device id from device control id, adds the lab host name as the prefix of
221+
* the uuid.
222+
*
223+
* @param deviceControlId the device control id from detector.
224+
*/
225+
public DeviceId getZebuDeviceId(String deviceControlId) {
226+
try {
227+
return DeviceId.of(
228+
deviceControlId,
229+
String.format("%s:%s", getLocalHostName(), deviceControlId),
230+
/* isUuidVolatile= */ false);
231+
} catch (MobileHarnessException e) {
232+
throw new AssertionError("Failed to generate ZebuDevice uuid.", e);
233+
}
234+
}
235+
213236
private String getLocalHostName() throws MobileHarnessException {
214237
try {
215238
return netUtil.getLocalHostName();

src/java/com/google/devtools/mobileharness/infra/controller/device/bootstrap/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ java_library(
3939
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:android_local_emulator",
4040
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:android_real_device",
4141
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:base",
42-
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:failed_device", # unuseddeps: keep
42+
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:failed_device", # buildcleaner: keep unuseddeps: keep
4343
"//src/java/com/google/devtools/mobileharness/api/devicemanager/dispatcher:no_op_device",
4444
"//src/java/com/google/devtools/mobileharness/api/devicemanager/util:class_util",
4545
"//src/java/com/google/devtools/mobileharness/api/model/error",

0 commit comments

Comments
 (0)