1 /*
2  * Copyright (C) 2020 The Android Open Source Project
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  *      http://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 package com.android.tradefed.result.error;
17 
18 import com.android.tradefed.result.proto.TestRecordProto.FailureStatus;
19 
20 /** Error Identifiers from Device errors and device reported errors. */
21 public enum DeviceErrorIdentifier implements ErrorIdentifier {
22 
23     // ********************************************************************************************
24     // Device Errors: 30_001 ~ 40_000
25     // ********************************************************************************************
26     APK_INSTALLATION_FAILED(30_001, FailureStatus.UNSET),
27 
28     AAPT_PARSER_FAILED(30_050, FailureStatus.UNSET),
29 
30     SHELL_COMMAND_ERROR(30_100, FailureStatus.UNSET),
31     DEVICE_UNEXPECTED_RESPONSE(30_101, FailureStatus.UNSET),
32 
33     INSTRUMENATION_CRASH(30_200, FailureStatus.UNSET),
34 
35     FAILED_TO_LAUNCH_GCE(30_500, FailureStatus.LOST_SYSTEM_UNDER_TEST),
36     FAILED_TO_CONNECT_TO_GCE(30_501, FailureStatus.LOST_SYSTEM_UNDER_TEST),
37     ERROR_AFTER_FLASHING(30_502, FailureStatus.LOST_SYSTEM_UNDER_TEST),
38 
39     DEVICE_UNAVAILABLE(30_750, FailureStatus.LOST_SYSTEM_UNDER_TEST);
40 
41     private final long code;
42     private final FailureStatus status;
43 
DeviceErrorIdentifier(int code, FailureStatus status)44     DeviceErrorIdentifier(int code, FailureStatus status) {
45         this.code = code;
46         this.status = status;
47     }
48 
49     @Override
code()50     public long code() {
51         return code;
52     }
53 
54     @Override
status()55     public FailureStatus status() {
56         return status;
57     }
58 }
59