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