aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tradefed/result/LogDataType.java
blob: 2024bf17ba28a32fdd7417bc24002dd58ef713aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.tradefed.result;

/**
 * Represents the data type of log data.
 */
public enum LogDataType {

    TEXT("txt", "text/plain", false, true),
    XML("xml", "text/xml", false, true),
    HTML("html", "text/html", true, true),
    PNG("png", "image/png", true, false),
    MP4("mp4", "video/mp4", true, false),
    EAR("ear", "application/octet-stream", true, false),
    ZIP("zip", "application/zip", true, false),
    SEVEN_Z("7z", "application/x-7z-compressed", true, false),
    BITS("bits", "application/octet-stream", true, false),
    JPEG("jpeg", "image/jpeg", true, false),
    TAR_GZ("tar.gz", "application/gzip", true, false),
    GZIP("gz", "application/gzip", true, false),
    HPROF("hprof", "text/plain", true, false),
    COVERAGE("ec", "text/plain", false, false), // Emma coverage file
    NATIVE_COVERAGE("zip", "application/zip", true, false), // gcov coverage archive
    PB("pb", "application/octet-stream", true, false), // Binary proto file
    TEXTPB("textproto", "text/plain", false, true), // Text proto file
    /* Specific text file types */
    BUGREPORT("txt", "text/plain", false, true),
    BUGREPORTZ("zip", "application/zip", true, false),
    LOGCAT("txt", "text/plain", false, true),
    KERNEL_LOG("txt", "text/plain", false, true),
    MONKEY_LOG("txt", "text/plain", false, true),
    MUGSHOT_LOG("txt", "text/plain", false, true),
    PROCRANK("txt", "text/plain", false, true),
    MEM_INFO("txt", "text/plain", false, true),
    TOP("txt", "text/plain", false, true),
    DUMPSYS("txt", "text/plain", false, true),
    COMPACT_MEMINFO("txt", "text/plain", false, true), // dumpsys meminfo -c
    SERVICES("txt", "text/plain", false, true), // dumpsys activity services
    GFX_INFO("txt", "text/plain", false, true), // dumpsys gfxinfo
    CPU_INFO("txt", "text/plain", false, true), // dumpsys cpuinfo
    JACOCO_CSV("csv", "text/csv", false, true), // JaCoCo coverage report in CSV format
    JACOCO_XML("xml", "text/xml", false, true), // JaCoCo coverage report in XML format
    ATRACE("atr", "text/plain", true, false), // atrace -z format
    KERNEL_TRACE("dat", "text/plain", false, false), // raw kernel ftrace buffer
    DIR("", "text/plain", false, false),
    /* Unknown file type */
    UNKNOWN("dat", "text/plain", false, false);

    private final String mFileExt;
    private final String mContentType;
    private final boolean mIsCompressed;
    private final boolean mIsText;

    LogDataType(String fileExt, String contentType, boolean compressed, boolean text) {
        mFileExt = fileExt;
        mIsCompressed = compressed;
        mIsText = text;
        mContentType = contentType;
    }

    public String getFileExt() {
        return mFileExt;
    }

    public String getContentType() {
        return mContentType;
    }

    /**
     * @return <code>true</code> if data type is a compressed format.
     */
    public boolean isCompressed() {
        return mIsCompressed;
    }

    /**
     * @return <code>true</code> if data type is a textual format.
     */
    public boolean isText() {
        return mIsText;
    }
}