apkfuckery/com.discord/smali/androidx/documentfile/provider/TreeDocumentFile.smali

511 lines
15 KiB
Smali
Raw Normal View History

2019-12-06 03:29:40 +00:00
.class public Landroidx/documentfile/provider/TreeDocumentFile;
2019-07-24 11:27:29 +00:00
.super Landroidx/documentfile/provider/DocumentFile;
.source "TreeDocumentFile.java"
2019-12-06 03:29:40 +00:00
# annotations
.annotation build Landroidx/annotation/RequiresApi;
value = 0x15
.end annotation
2019-07-24 11:27:29 +00:00
# instance fields
2019-12-06 03:29:40 +00:00
.field public mContext:Landroid/content/Context;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
.field public mUri:Landroid/net/Uri;
2019-07-24 11:27:29 +00:00
# direct methods
2019-12-06 03:29:40 +00:00
.method public constructor <init>(Landroidx/documentfile/provider/DocumentFile;Landroid/content/Context;Landroid/net/Uri;)V
2019-07-24 11:27:29 +00:00
.locals 0
2019-12-06 03:29:40 +00:00
.param p1 # Landroidx/documentfile/provider/DocumentFile;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
invoke-direct {p0, p1}, Landroidx/documentfile/provider/DocumentFile;-><init>(Landroidx/documentfile/provider/DocumentFile;)V
iput-object p2, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iput-object p3, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static closeQuietly(Ljava/lang/AutoCloseable;)V
2019-07-24 11:27:29 +00:00
.locals 0
2019-12-06 03:29:40 +00:00
.param p0 # Ljava/lang/AutoCloseable;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end param
2019-07-24 11:27:29 +00:00
if-eqz p0, :cond_0
:try_start_0
invoke-interface {p0}, Ljava/lang/AutoCloseable;->close()V
:try_end_0
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:catch_0
move-exception p0
throw p0
:catch_1
:cond_0
2019-12-06 03:29:40 +00:00
:goto_0
2019-07-24 11:27:29 +00:00
return-void
.end method
2019-12-06 03:29:40 +00:00
.method public static createFile(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;
2019-07-24 11:27:29 +00:00
.locals 0
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/Nullable;
.end annotation
2019-07-24 11:27:29 +00:00
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object p0
invoke-static {p0, p1, p2, p3}, Landroid/provider/DocumentsContract;->createDocument(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;
move-result-object p0
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
return-object p0
:catch_0
const/4 p0, 0x0
return-object p0
.end method
# virtual methods
.method public canRead()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->canRead(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public canWrite()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->canWrite(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public createDirectory(Ljava/lang/String;)Landroidx/documentfile/provider/DocumentFile;
.locals 3
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/Nullable;
.end annotation
2019-07-24 11:27:29 +00:00
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
const-string v2, "vnd.android.document/directory"
invoke-static {v0, v1, v2, p1}, Landroidx/documentfile/provider/TreeDocumentFile;->createFile(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;
move-result-object p1
if-eqz p1, :cond_0
new-instance v0, Landroidx/documentfile/provider/TreeDocumentFile;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
invoke-direct {v0, p0, v1, p1}, Landroidx/documentfile/provider/TreeDocumentFile;-><init>(Landroidx/documentfile/provider/DocumentFile;Landroid/content/Context;Landroid/net/Uri;)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
2019-12-06 03:29:40 +00:00
const/4 v0, 0x0
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
:goto_0
return-object v0
2019-07-24 11:27:29 +00:00
.end method
.method public createFile(Ljava/lang/String;Ljava/lang/String;)Landroidx/documentfile/provider/DocumentFile;
.locals 2
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/Nullable;
.end annotation
2019-07-24 11:27:29 +00:00
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1, p1, p2}, Landroidx/documentfile/provider/TreeDocumentFile;->createFile(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;
move-result-object p1
if-eqz p1, :cond_0
new-instance p2, Landroidx/documentfile/provider/TreeDocumentFile;
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
invoke-direct {p2, p0, v0, p1}, Landroidx/documentfile/provider/TreeDocumentFile;-><init>(Landroidx/documentfile/provider/DocumentFile;Landroid/content/Context;Landroid/net/Uri;)V
2019-12-06 03:29:40 +00:00
goto :goto_0
2019-07-24 11:27:29 +00:00
:cond_0
2019-12-06 03:29:40 +00:00
const/4 p2, 0x0
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
:goto_0
return-object p2
2019-07-24 11:27:29 +00:00
.end method
.method public delete()Z
.locals 2
:try_start_0
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v0
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroid/provider/DocumentsContract;->deleteDocument(Landroid/content/ContentResolver;Landroid/net/Uri;)Z
move-result v0
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
return v0
:catch_0
const/4 v0, 0x0
return v0
.end method
.method public exists()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->exists(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public getName()Ljava/lang/String;
.locals 2
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/Nullable;
.end annotation
2019-07-24 11:27:29 +00:00
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->getName(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getType()Ljava/lang/String;
.locals 2
2019-12-06 03:29:40 +00:00
.annotation build Landroidx/annotation/Nullable;
.end annotation
2019-07-24 11:27:29 +00:00
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->getType(Landroid/content/Context;Landroid/net/Uri;)Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public getUri()Landroid/net/Uri;
.locals 1
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
return-object v0
.end method
.method public isDirectory()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->isDirectory(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public isFile()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->isFile(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public isVirtual()Z
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->isVirtual(Landroid/content/Context;Landroid/net/Uri;)Z
move-result v0
return v0
.end method
.method public lastModified()J
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->lastModified(Landroid/content/Context;Landroid/net/Uri;)J
move-result-wide v0
return-wide v0
.end method
.method public length()J
.locals 2
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0, v1}, Landroidx/documentfile/provider/DocumentsContractApi19;->length(Landroid/content/Context;Landroid/net/Uri;)J
move-result-wide v0
return-wide v0
.end method
.method public listFiles()[Landroidx/documentfile/provider/DocumentFile;
.locals 9
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
invoke-virtual {v0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
iget-object v0, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v0}, Landroid/provider/DocumentsContract;->getDocumentId(Landroid/net/Uri;)Ljava/lang/String;
move-result-object v2
invoke-static {v0, v2}, Landroid/provider/DocumentsContract;->buildChildDocumentsUriUsingTree(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;
move-result-object v2
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
const/4 v7, 0x0
const/4 v8, 0x0
:try_start_0
2019-11-20 22:09:14 +00:00
const-string v3, "document_id"
2019-07-24 11:27:29 +00:00
2019-11-20 22:09:14 +00:00
filled-new-array {v3}, [Ljava/lang/String;
2019-07-24 11:27:29 +00:00
2019-11-20 22:09:14 +00:00
move-result-object v3
2019-07-24 11:27:29 +00:00
const/4 v4, 0x0
const/4 v5, 0x0
const/4 v6, 0x0
invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
move-result-object v8
:goto_0
invoke-interface {v8}, Landroid/database/Cursor;->moveToNext()Z
move-result v1
if-eqz v1, :cond_0
invoke-interface {v8, v7}, Landroid/database/Cursor;->getString(I)Ljava/lang/String;
move-result-object v1
iget-object v2, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v2, v1}, Landroid/provider/DocumentsContract;->buildDocumentUriUsingTree(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
2019-12-06 03:29:40 +00:00
:cond_0
:goto_1
invoke-static {v8}, Landroidx/documentfile/provider/TreeDocumentFile;->closeQuietly(Ljava/lang/AutoCloseable;)V
goto :goto_2
2019-07-24 11:27:29 +00:00
:catchall_0
move-exception v0
2019-12-06 03:29:40 +00:00
goto :goto_4
2019-07-24 11:27:29 +00:00
:catch_0
move-exception v1
:try_start_1
const-string v2, "DocumentFile"
2019-12-06 03:29:40 +00:00
new-instance v3, Ljava/lang/StringBuilder;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
const-string v4, "Failed query: "
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
2019-07-24 11:27:29 +00:00
move-result-object v1
invoke-static {v2, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
2019-12-06 03:29:40 +00:00
goto :goto_1
2019-07-24 11:27:29 +00:00
2019-12-06 03:29:40 +00:00
:goto_2
2019-07-24 11:27:29 +00:00
invoke-virtual {v0}, Ljava/util/ArrayList;->size()I
move-result v1
new-array v1, v1, [Landroid/net/Uri;
invoke-virtual {v0, v1}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v0
check-cast v0, [Landroid/net/Uri;
array-length v1, v0
new-array v1, v1, [Landroidx/documentfile/provider/DocumentFile;
2019-12-06 03:29:40 +00:00
:goto_3
2019-07-24 11:27:29 +00:00
array-length v2, v0
if-ge v7, v2, :cond_1
new-instance v2, Landroidx/documentfile/provider/TreeDocumentFile;
iget-object v3, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
aget-object v4, v0, v7
invoke-direct {v2, p0, v3, v4}, Landroidx/documentfile/provider/TreeDocumentFile;-><init>(Landroidx/documentfile/provider/DocumentFile;Landroid/content/Context;Landroid/net/Uri;)V
aput-object v2, v1, v7
add-int/lit8 v7, v7, 0x1
2019-12-06 03:29:40 +00:00
goto :goto_3
2019-07-24 11:27:29 +00:00
:cond_1
return-object v1
2019-12-06 03:29:40 +00:00
:goto_4
2019-07-24 11:27:29 +00:00
invoke-static {v8}, Landroidx/documentfile/provider/TreeDocumentFile;->closeQuietly(Ljava/lang/AutoCloseable;)V
throw v0
.end method
.method public renameTo(Ljava/lang/String;)Z
.locals 3
const/4 v0, 0x0
:try_start_0
iget-object v1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mContext:Landroid/content/Context;
invoke-virtual {v1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;
move-result-object v1
iget-object v2, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
invoke-static {v1, v2, p1}, Landroid/provider/DocumentsContract;->renameDocument(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;
move-result-object p1
if-eqz p1, :cond_0
iput-object p1, p0, Landroidx/documentfile/provider/TreeDocumentFile;->mUri:Landroid/net/Uri;
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
const/4 p1, 0x1
return p1
:catch_0
:cond_0
return v0
.end method