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 JPEG("jpeg", "image/jpeg", true, false), 31 TAR_GZ("tar.gz", "application/gzip", true, false), 32 GZIP("gz", "application/gzip", true, false), 33 HPROF("hprof", "text/plain", true, false), 34 COVERAGE("ec", "text/plain", false, false), // Emma coverage file 35 PB("pb", "application/octet-stream", true, false), // Binary proto file 36 TEXTPB("textproto", "text/plain", false, true), // Text proto file 37 /* Specific text file types */ 38 BUGREPORT("txt", "text/plain", false, true), 39 BUGREPORTZ("zip", "application/zip", true, false), 40 LOGCAT("txt", "text/plain", false, true), 41 KERNEL_LOG("txt", "text/plain", false, true), 42 MONKEY_LOG("txt", "text/plain", false, true), 43 MUGSHOT_LOG("txt", "text/plain", false, true), 44 PROCRANK("txt", "text/plain", false, true), 45 MEM_INFO("txt", "text/plain", false, true), 46 TOP("txt", "text/plain", false, true), 47 DUMPSYS("txt", "text/plain", false, true), 48 COMPACT_MEMINFO("txt", "text/plain", false, true), // dumpsys meminfo -c 49 SERVICES("txt", "text/plain", false, true), // dumpsys activity services 50 GFX_INFO("txt", "text/plain", false, true), // dumpsys gfxinfo 51 CPU_INFO("txt", "text/plain", false, true), // dumpsys cpuinfo 52 JACOCO_CSV("csv", "text/csv", false, true), // JaCoCo coverage report in CSV format 53 JACOCO_XML("xml", "text/xml", false, true), // JaCoCo coverage report in XML format 54 ATRACE("atr", "text/plain", true, false), // atrace -z format 55 KERNEL_TRACE("dat", "text/plain", false, false), // raw kernel ftrace buffer 56 DIR("", "text/plain", false, false), 57 /* Unknown file type */ 58 UNKNOWN("dat", "text/plain", false, false); 59 60 private final String mFileExt; 61 private final String mContentType; 62 private final boolean mIsCompressed; 63 private final boolean mIsText; 64 LogDataType(String fileExt, String contentType, boolean compressed, boolean text)65 LogDataType(String fileExt, String contentType, boolean compressed, boolean text) { 66 mFileExt = fileExt; 67 mIsCompressed = compressed; 68 mIsText = text; 69 mContentType = contentType; 70 } 71 getFileExt()72 public String getFileExt() { 73 return mFileExt; 74 } 75 getContentType()76 public String getContentType() { 77 return mContentType; 78 } 79 80 /** 81 * @return <code>true</code> if data type is a compressed format. 82 */ isCompressed()83 public boolean isCompressed() { 84 return mIsCompressed; 85 } 86 87 /** 88 * @return <code>true</code> if data type is a textual format. 89 */ isText()90 public boolean isText() { 91 return mIsText; 92 } 93 } 94