• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.google.android.car.bugreport;
17 
18 /** Defines {@link MetaBugReport} statuses. */
19 public enum Status {
20     // Bugreport is being written
21     STATUS_WRITE_PENDING(0),
22 
23     // Writing bugreport failed
24     STATUS_WRITE_FAILED(1),
25 
26     // Bugreport is waiting to be uploaded
27     STATUS_UPLOAD_PENDING(2),
28 
29     // Bugreport uploaded successfully
30     STATUS_UPLOAD_SUCCESS(3),
31 
32     // Bugreport failed to upload
33     STATUS_UPLOAD_FAILED(4),
34 
35     // Bugreport is cancelled by user
36     STATUS_USER_CANCELLED(5),
37 
38     // Bugreport is pending user choice on whether to upload or copy.
39     STATUS_PENDING_USER_ACTION(6),
40 
41     // Bugreport was moved successfully.
42     STATUS_MOVE_SUCCESSFUL(7),
43 
44     // Bugreport move has failed.
45     STATUS_MOVE_FAILED(8);
46 
47     private final int mValue;
48 
Status(int value)49     Status(int value) {
50         mValue = value;
51     }
52 
53     /** Returns integer value of the status. */
getValue()54     public int getValue() {
55         return mValue;
56     }
57 
58     /** Generates human-readable string from a status value. */
toString(int value)59     public static String toString(int value) {
60         switch (value) {
61             case 0:
62                 return "Write pending";
63             case 1:
64                 return "Write failed";
65             case 2:
66                 return "Upload pending";
67             case 3:
68                 return "Upload successful";
69             case 4:
70                 return "Upload failed";
71             case 5:
72                 return "User cancelled";
73             case 6:
74                 return "Pending user action";
75             case 7:
76                 return "Move successful";
77             case 8:
78                 return "Move failed";
79         }
80         return "unknown";
81     }
82 }
83