You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
430 lines
11 KiB
430 lines
11 KiB
.class public Lcom/viatech/util/LogcatManager; |
|
.super Ljava/lang/Object; |
|
.source "LogcatManager.java" |
|
|
|
|
|
# annotations |
|
.annotation system Ldalvik/annotation/MemberClasses; |
|
value = { |
|
Lcom/viatech/util/LogcatManager$LogDumper; |
|
} |
|
.end annotation |
|
|
|
|
|
# static fields |
|
.field private static INSTANCE:Lcom/viatech/util/LogcatManager; = null |
|
|
|
.field private static PATH_LOGCAT:Ljava/lang/String; = null |
|
|
|
.field private static final TAG:Ljava/lang/String; = "LogcatManager" |
|
|
|
.field public static isOnLogcat:Z |
|
|
|
|
|
# instance fields |
|
.field private mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
.field private mPId:I |
|
|
|
.field private simpleDateFormat1:Ljava/text/SimpleDateFormat; |
|
|
|
.field private simpleDateFormat2:Ljava/text/SimpleDateFormat; |
|
|
|
|
|
# direct methods |
|
.method static constructor <clinit>()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 30 |
|
const/4 v0, 0x0 |
|
|
|
sput-object v0, Lcom/viatech/util/LogcatManager;->INSTANCE:Lcom/viatech/util/LogcatManager; |
|
|
|
.line 37 |
|
const/4 v0, 0x0 |
|
|
|
sput-boolean v0, Lcom/viatech/util/LogcatManager;->isOnLogcat:Z |
|
|
|
return-void |
|
.end method |
|
|
|
.method private constructor <init>()V |
|
.locals 2 |
|
|
|
.prologue |
|
.line 46 |
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V |
|
|
|
.line 32 |
|
const/4 v0, 0x0 |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
.line 34 |
|
new-instance v0, Ljava/text/SimpleDateFormat; |
|
|
|
const-string v1, "yyyyMMdd" |
|
|
|
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LogcatManager;->simpleDateFormat1:Ljava/text/SimpleDateFormat; |
|
|
|
.line 35 |
|
new-instance v0, Ljava/text/SimpleDateFormat; |
|
|
|
const-string v1, "MM-dd HH:mm:ss" |
|
|
|
invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LogcatManager;->simpleDateFormat2:Ljava/text/SimpleDateFormat; |
|
|
|
.line 47 |
|
invoke-static {}, Landroid/os/Process;->myPid()I |
|
|
|
move-result v0 |
|
|
|
iput v0, p0, Lcom/viatech/util/LogcatManager;->mPId:I |
|
|
|
.line 48 |
|
return-void |
|
.end method |
|
|
|
.method static synthetic access$000(Lcom/viatech/util/LogcatManager;)Ljava/text/SimpleDateFormat; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 28 |
|
iget-object v0, p0, Lcom/viatech/util/LogcatManager;->simpleDateFormat2:Ljava/text/SimpleDateFormat; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method public static getInstance()Lcom/viatech/util/LogcatManager; |
|
.locals 1 |
|
|
|
.prologue |
|
.line 40 |
|
sget-object v0, Lcom/viatech/util/LogcatManager;->INSTANCE:Lcom/viatech/util/LogcatManager; |
|
|
|
if-nez v0, :cond_0 |
|
|
|
.line 41 |
|
new-instance v0, Lcom/viatech/util/LogcatManager; |
|
|
|
invoke-direct {v0}, Lcom/viatech/util/LogcatManager;-><init>()V |
|
|
|
sput-object v0, Lcom/viatech/util/LogcatManager;->INSTANCE:Lcom/viatech/util/LogcatManager; |
|
|
|
.line 43 |
|
:cond_0 |
|
sget-object v0, Lcom/viatech/util/LogcatManager;->INSTANCE:Lcom/viatech/util/LogcatManager; |
|
|
|
return-object v0 |
|
.end method |
|
|
|
.method private setFolderPath(Ljava/lang/String;)V |
|
.locals 3 |
|
|
|
.prologue |
|
.line 73 |
|
new-instance v0, Ljava/io/File; |
|
|
|
invoke-direct {v0, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V |
|
|
|
.line 74 |
|
invoke-virtual {v0}, Ljava/io/File;->exists()Z |
|
|
|
move-result v1 |
|
|
|
if-nez v1, :cond_0 |
|
|
|
.line 75 |
|
invoke-virtual {v0}, Ljava/io/File;->mkdirs()Z |
|
|
|
.line 77 |
|
:cond_0 |
|
invoke-virtual {v0}, Ljava/io/File;->isDirectory()Z |
|
|
|
move-result v0 |
|
|
|
if-nez v0, :cond_1 |
|
|
|
.line 78 |
|
new-instance v0, Ljava/lang/IllegalArgumentException; |
|
|
|
new-instance v1, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
const-string v2, "The logcat folder path is not a directory: " |
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V |
|
|
|
throw v0 |
|
|
|
.line 81 |
|
:cond_1 |
|
const-string v0, "/" |
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z |
|
|
|
move-result v0 |
|
|
|
if-eqz v0, :cond_2 |
|
|
|
:goto_0 |
|
sput-object p1, Lcom/viatech/util/LogcatManager;->PATH_LOGCAT:Ljava/lang/String; |
|
|
|
.line 82 |
|
const-string v0, "LogcatManager" |
|
|
|
sget-object v1, Lcom/viatech/util/LogcatManager;->PATH_LOGCAT:Ljava/lang/String; |
|
|
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 83 |
|
return-void |
|
|
|
.line 81 |
|
:cond_2 |
|
new-instance v0, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
const-string v1, "/" |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object p1 |
|
|
|
goto :goto_0 |
|
.end method |
|
|
|
.method private stop()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 95 |
|
const/4 v0, 0x0 |
|
|
|
sput-boolean v0, Lcom/viatech/util/LogcatManager;->isOnLogcat:Z |
|
|
|
.line 96 |
|
iget-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
if-eqz v0, :cond_0 |
|
|
|
.line 97 |
|
iget-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
invoke-virtual {v0}, Lcom/viatech/util/LogcatManager$LogDumper;->stopLogs()V |
|
|
|
.line 98 |
|
const/4 v0, 0x0 |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
.line 100 |
|
:cond_0 |
|
return-void |
|
.end method |
|
|
|
|
|
# virtual methods |
|
.method public start(Ljava/lang/String;Ljava/lang/String;)V |
|
.locals 3 |
|
|
|
.prologue |
|
.line 86 |
|
const/4 v0, 0x1 |
|
|
|
sput-boolean v0, Lcom/viatech/util/LogcatManager;->isOnLogcat:Z |
|
|
|
.line 87 |
|
invoke-direct {p0, p1}, Lcom/viatech/util/LogcatManager;->setFolderPath(Ljava/lang/String;)V |
|
|
|
.line 88 |
|
iget-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
if-nez v0, :cond_0 |
|
|
|
.line 89 |
|
new-instance v0, Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
iget v1, p0, Lcom/viatech/util/LogcatManager;->mPId:I |
|
|
|
invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
sget-object v2, Lcom/viatech/util/LogcatManager;->PATH_LOGCAT:Ljava/lang/String; |
|
|
|
invoke-direct {v0, p0, v1, v2, p2}, Lcom/viatech/util/LogcatManager$LogDumper;-><init>(Lcom/viatech/util/LogcatManager;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V |
|
|
|
iput-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
.line 91 |
|
:cond_0 |
|
iget-object v0, p0, Lcom/viatech/util/LogcatManager;->mLogDumper:Lcom/viatech/util/LogcatManager$LogDumper; |
|
|
|
invoke-virtual {v0}, Lcom/viatech/util/LogcatManager$LogDumper;->start()V |
|
|
|
.line 92 |
|
return-void |
|
.end method |
|
|
|
.method public startLogcatToFile(Landroid/content/Context;)V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 65 |
|
const/4 v0, 0x0 |
|
|
|
invoke-virtual {p0, p1, v0}, Lcom/viatech/util/LogcatManager;->startLogcatToFile(Landroid/content/Context;Ljava/lang/String;)V |
|
|
|
.line 66 |
|
return-void |
|
.end method |
|
|
|
.method public startLogcatToFile(Landroid/content/Context;Ljava/lang/String;)V |
|
.locals 3 |
|
|
|
.prologue |
|
.line 51 |
|
.line 52 |
|
invoke-static {}, Landroid/os/Environment;->getExternalStorageState()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
const-string v1, "mounted" |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z |
|
|
|
move-result v0 |
|
|
|
if-eqz v0, :cond_0 |
|
|
|
.line 54 |
|
new-instance v0, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
sget-object v1, Lcom/viatech/Config;->b:Ljava/lang/String; |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
sget-object v1, Ljava/io/File;->separator:Ljava/lang/String; |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
const-string v1, "Logcat" |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
.line 56 |
|
const-string v1, "LogcatManager" |
|
|
|
const-string v2, "Logcat to sdcard" |
|
|
|
invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
.line 61 |
|
:goto_0 |
|
invoke-static {}, Lcom/viatech/util/LogcatManager;->getInstance()Lcom/viatech/util/LogcatManager; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1, v0, p2}, Lcom/viatech/util/LogcatManager;->start(Ljava/lang/String;Ljava/lang/String;)V |
|
|
|
.line 62 |
|
return-void |
|
|
|
.line 58 |
|
:cond_0 |
|
new-instance v0, Ljava/lang/StringBuilder; |
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V |
|
|
|
invoke-virtual {p1}, Landroid/content/Context;->getFilesDir()Ljava/io/File; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; |
|
|
|
move-result-object v1 |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
sget-object v1, Ljava/io/File;->separator:Ljava/lang/String; |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
const-string v1, "Logcat" |
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; |
|
|
|
move-result-object v0 |
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; |
|
|
|
move-result-object v0 |
|
|
|
.line 59 |
|
const-string v1, "LogcatManager" |
|
|
|
const-string v2, "Logcat to fileDir" |
|
|
|
invoke-static {v1, v2}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I |
|
|
|
goto :goto_0 |
|
.end method |
|
|
|
.method public stopLogcatToFile()V |
|
.locals 1 |
|
|
|
.prologue |
|
.line 69 |
|
invoke-static {}, Lcom/viatech/util/LogcatManager;->getInstance()Lcom/viatech/util/LogcatManager; |
|
|
|
move-result-object v0 |
|
|
|
invoke-direct {v0}, Lcom/viatech/util/LogcatManager;->stop()V |
|
|
|
.line 70 |
|
return-void |
|
.end method
|
|
|