1 /*
2  * Copyright (C) 2010 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;
17 
18 /**
19  * Represents the data type of log data.
20  */
21 public enum LogDataType {
22 
23     TEXT("txt", "text/plain", false, true),
24     XML("xml", "text/xml", false, true),
25     HTML("html", "text/html", true, true),
26     PNG("png", "image/png", true, false),
27     MP4("mp4", "video/mp4", true, false),
28     EAR("ear", "application/octet-stream", true, false),
29     ZIP("zip", "application/zip", true, false),
30     SEVEN_Z("7z", "application/x-7z-compressed", true, false),
31     BITS("bits", "application/octet-stream", true, false),
32     JPEG("jpeg", "image/jpeg", true, false),
33     TAR_GZ("tar.gz", "application/gzip", true, false),
34     GZIP("gz", "application/gzip", true, false),
35     HPROF("hprof", "text/plain", true, false),
36     COVERAGE("ec", "text/plain", false, false), // Emma coverage file
37     NATIVE_COVERAGE("zip", "application/zip", true, false), // gcov coverage archive
38     CLANG_COVERAGE("profdata", "text/plain", false, false), // LLVM indexed profile data
39     PB("pb", "application/octet-stream", true, false), // Binary proto file
40     TEXTPB("textproto", "text/plain", false, true), // Text proto file
41     PERFETTO("pb", "application/octet-stream", true, false), // binary proto perfetto trace file
42     /* Specific text file types */
43     BUGREPORT("txt", "text/plain", false, true),
44     BUGREPORTZ("zip", "application/zip", true, false),
45     HOST_LOG("txt", "text/plain", false, true),
46     LOGCAT("txt", "text/plain", false, true),
47     KERNEL_LOG("txt", "text/plain", false, true),
48     MONKEY_LOG("txt", "text/plain", false, true),
49     MUGSHOT_LOG("txt", "text/plain", false, true),
50     PROCRANK("txt", "text/plain", false, true),
51     MEM_INFO("txt", "text/plain", false, true),
52     TOP("txt", "text/plain", false, true),
53     DUMPSYS("txt", "text/plain", false, true),
54     COMPACT_MEMINFO("txt", "text/plain", false, true), // dumpsys meminfo -c
55     SERVICES("txt", "text/plain", false, true), // dumpsys activity services
56     GFX_INFO("txt", "text/plain", false, true), // dumpsys gfxinfo
57     CPU_INFO("txt", "text/plain", false, true), // dumpsys cpuinfo
58     JACOCO_CSV("csv", "text/csv", false, true), // JaCoCo coverage report in CSV format
59     JACOCO_XML("xml", "text/xml", false, true), // JaCoCo coverage report in XML format
60     ATRACE("atr", "text/plain", true, false), // atrace -z format
61     KERNEL_TRACE("dat", "text/plain", false, false), // raw kernel ftrace buffer
62     DIR("", "text/plain", false, false),
63     /* Unknown file type */
64     UNKNOWN("dat", "text/plain", false, false);
65 
66     private final String mFileExt;
67     private final String mContentType;
68     private final boolean mIsCompressed;
69     private final boolean mIsText;
70 
LogDataType(String fileExt, String contentType, boolean compressed, boolean text)71     LogDataType(String fileExt, String contentType, boolean compressed, boolean text) {
72         mFileExt = fileExt;
73         mIsCompressed = compressed;
74         mIsText = text;
75         mContentType = contentType;
76     }
77 
getFileExt()78     public String getFileExt() {
79         return mFileExt;
80     }
81 
getContentType()82     public String getContentType() {
83         return mContentType;
84     }
85 
86     /**
87      * @return <code>true</code> if data type is a compressed format.
88      */
isCompressed()89     public boolean isCompressed() {
90         return mIsCompressed;
91     }
92 
93     /**
94      * @return <code>true</code> if data type is a textual format.
95      */
isText()96     public boolean isText() {
97         return mIsText;
98     }
99 }
100