apkfuckery/com.discord/smali/androidx/print/PrintHelper$1.smali

424 lines
13 KiB
Smali
Raw Normal View History

2020-11-12 02:11:44 +00:00
.class public Landroidx/print/PrintHelper$1;
.super Landroid/os/AsyncTask;
.source "PrintHelper.java"
# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
value = Landroidx/print/PrintHelper;->writeBitmap(Landroid/print/PrintAttributes;ILandroid/graphics/Bitmap;Landroid/os/ParcelFileDescriptor;Landroid/os/CancellationSignal;Landroid/print/PrintDocumentAdapter$WriteResultCallback;)V
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x1
name = null
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"Landroid/os/AsyncTask<",
"Ljava/lang/Void;",
"Ljava/lang/Void;",
"Ljava/lang/Throwable;",
">;"
}
.end annotation
# instance fields
.field public final synthetic this$0:Landroidx/print/PrintHelper;
.field public final synthetic val$attributes:Landroid/print/PrintAttributes;
.field public final synthetic val$bitmap:Landroid/graphics/Bitmap;
.field public final synthetic val$cancellationSignal:Landroid/os/CancellationSignal;
.field public final synthetic val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
.field public final synthetic val$fittingMode:I
.field public final synthetic val$pdfAttributes:Landroid/print/PrintAttributes;
.field public final synthetic val$writeResultCallback:Landroid/print/PrintDocumentAdapter$WriteResultCallback;
# direct methods
.method public constructor <init>(Landroidx/print/PrintHelper;Landroid/os/CancellationSignal;Landroid/print/PrintAttributes;Landroid/graphics/Bitmap;Landroid/print/PrintAttributes;ILandroid/os/ParcelFileDescriptor;Landroid/print/PrintDocumentAdapter$WriteResultCallback;)V
.locals 0
iput-object p1, p0, Landroidx/print/PrintHelper$1;->this$0:Landroidx/print/PrintHelper;
iput-object p2, p0, Landroidx/print/PrintHelper$1;->val$cancellationSignal:Landroid/os/CancellationSignal;
iput-object p3, p0, Landroidx/print/PrintHelper$1;->val$pdfAttributes:Landroid/print/PrintAttributes;
iput-object p4, p0, Landroidx/print/PrintHelper$1;->val$bitmap:Landroid/graphics/Bitmap;
iput-object p5, p0, Landroidx/print/PrintHelper$1;->val$attributes:Landroid/print/PrintAttributes;
iput p6, p0, Landroidx/print/PrintHelper$1;->val$fittingMode:I
iput-object p7, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
iput-object p8, p0, Landroidx/print/PrintHelper$1;->val$writeResultCallback:Landroid/print/PrintDocumentAdapter$WriteResultCallback;
invoke-direct {p0}, Landroid/os/AsyncTask;-><init>()V
return-void
.end method
# virtual methods
.method public bridge synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.locals 0
check-cast p1, [Ljava/lang/Void;
invoke-virtual {p0, p1}, Landroidx/print/PrintHelper$1;->doInBackground([Ljava/lang/Void;)Ljava/lang/Throwable;
move-result-object p1
return-object p1
.end method
.method public varargs doInBackground([Ljava/lang/Void;)Ljava/lang/Throwable;
.locals 7
:try_start_0
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$cancellationSignal:Landroid/os/CancellationSignal;
invoke-virtual {p1}, Landroid/os/CancellationSignal;->isCanceled()Z
move-result p1
const/4 v0, 0x0
if-eqz p1, :cond_0
return-object v0
:cond_0
new-instance p1, Landroid/print/pdf/PrintedPdfDocument;
iget-object v1, p0, Landroidx/print/PrintHelper$1;->this$0:Landroidx/print/PrintHelper;
iget-object v1, v1, Landroidx/print/PrintHelper;->mContext:Landroid/content/Context;
iget-object v2, p0, Landroidx/print/PrintHelper$1;->val$pdfAttributes:Landroid/print/PrintAttributes;
invoke-direct {p1, v1, v2}, Landroid/print/pdf/PrintedPdfDocument;-><init>(Landroid/content/Context;Landroid/print/PrintAttributes;)V
iget-object v1, p0, Landroidx/print/PrintHelper$1;->val$bitmap:Landroid/graphics/Bitmap;
iget-object v2, p0, Landroidx/print/PrintHelper$1;->val$pdfAttributes:Landroid/print/PrintAttributes;
invoke-virtual {v2}, Landroid/print/PrintAttributes;->getColorMode()I
move-result v2
invoke-static {v1, v2}, Landroidx/print/PrintHelper;->convertBitmapForColorMode(Landroid/graphics/Bitmap;I)Landroid/graphics/Bitmap;
move-result-object v1
iget-object v2, p0, Landroidx/print/PrintHelper$1;->val$cancellationSignal:Landroid/os/CancellationSignal;
invoke-virtual {v2}, Landroid/os/CancellationSignal;->isCanceled()Z
move-result v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_1
if-eqz v2, :cond_1
return-object v0
:cond_1
const/4 v2, 0x1
:try_start_1
invoke-virtual {p1, v2}, Landroid/print/pdf/PrintedPdfDocument;->startPage(I)Landroid/graphics/pdf/PdfDocument$Page;
move-result-object v3
sget-boolean v4, Landroidx/print/PrintHelper;->IS_MIN_MARGINS_HANDLING_CORRECT:Z
if-eqz v4, :cond_2
new-instance v2, Landroid/graphics/RectF;
invoke-virtual {v3}, Landroid/graphics/pdf/PdfDocument$Page;->getInfo()Landroid/graphics/pdf/PdfDocument$PageInfo;
move-result-object v4
invoke-virtual {v4}, Landroid/graphics/pdf/PdfDocument$PageInfo;->getContentRect()Landroid/graphics/Rect;
move-result-object v4
invoke-direct {v2, v4}, Landroid/graphics/RectF;-><init>(Landroid/graphics/Rect;)V
goto :goto_0
:cond_2
new-instance v4, Landroid/print/pdf/PrintedPdfDocument;
iget-object v5, p0, Landroidx/print/PrintHelper$1;->this$0:Landroidx/print/PrintHelper;
iget-object v5, v5, Landroidx/print/PrintHelper;->mContext:Landroid/content/Context;
iget-object v6, p0, Landroidx/print/PrintHelper$1;->val$attributes:Landroid/print/PrintAttributes;
invoke-direct {v4, v5, v6}, Landroid/print/pdf/PrintedPdfDocument;-><init>(Landroid/content/Context;Landroid/print/PrintAttributes;)V
invoke-virtual {v4, v2}, Landroid/print/pdf/PrintedPdfDocument;->startPage(I)Landroid/graphics/pdf/PdfDocument$Page;
move-result-object v2
new-instance v5, Landroid/graphics/RectF;
invoke-virtual {v2}, Landroid/graphics/pdf/PdfDocument$Page;->getInfo()Landroid/graphics/pdf/PdfDocument$PageInfo;
move-result-object v6
invoke-virtual {v6}, Landroid/graphics/pdf/PdfDocument$PageInfo;->getContentRect()Landroid/graphics/Rect;
move-result-object v6
invoke-direct {v5, v6}, Landroid/graphics/RectF;-><init>(Landroid/graphics/Rect;)V
invoke-virtual {v4, v2}, Landroid/print/pdf/PrintedPdfDocument;->finishPage(Landroid/graphics/pdf/PdfDocument$Page;)V
invoke-virtual {v4}, Landroid/print/pdf/PrintedPdfDocument;->close()V
move-object v2, v5
:goto_0
invoke-virtual {v1}, Landroid/graphics/Bitmap;->getWidth()I
move-result v4
invoke-virtual {v1}, Landroid/graphics/Bitmap;->getHeight()I
move-result v5
iget v6, p0, Landroidx/print/PrintHelper$1;->val$fittingMode:I
invoke-static {v4, v5, v2, v6}, Landroidx/print/PrintHelper;->getMatrix(IILandroid/graphics/RectF;I)Landroid/graphics/Matrix;
move-result-object v4
sget-boolean v5, Landroidx/print/PrintHelper;->IS_MIN_MARGINS_HANDLING_CORRECT:Z
if-eqz v5, :cond_3
goto :goto_1
:cond_3
iget v5, v2, Landroid/graphics/RectF;->left:F
iget v6, v2, Landroid/graphics/RectF;->top:F
invoke-virtual {v4, v5, v6}, Landroid/graphics/Matrix;->postTranslate(FF)Z
invoke-virtual {v3}, Landroid/graphics/pdf/PdfDocument$Page;->getCanvas()Landroid/graphics/Canvas;
move-result-object v5
invoke-virtual {v5, v2}, Landroid/graphics/Canvas;->clipRect(Landroid/graphics/RectF;)Z
:goto_1
invoke-virtual {v3}, Landroid/graphics/pdf/PdfDocument$Page;->getCanvas()Landroid/graphics/Canvas;
move-result-object v2
invoke-virtual {v2, v1, v4, v0}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Matrix;Landroid/graphics/Paint;)V
invoke-virtual {p1, v3}, Landroid/print/pdf/PrintedPdfDocument;->finishPage(Landroid/graphics/pdf/PdfDocument$Page;)V
iget-object v2, p0, Landroidx/print/PrintHelper$1;->val$cancellationSignal:Landroid/os/CancellationSignal;
invoke-virtual {v2}, Landroid/os/CancellationSignal;->isCanceled()Z
move-result v2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
if-eqz v2, :cond_6
:try_start_2
invoke-virtual {p1}, Landroid/print/pdf/PrintedPdfDocument;->close()V
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
if-eqz p1, :cond_4
:try_start_3
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->close()V
:try_end_3
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0
.catchall {:try_start_3 .. :try_end_3} :catchall_1
:catch_0
:cond_4
:try_start_4
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$bitmap:Landroid/graphics/Bitmap;
if-eq v1, p1, :cond_5
invoke-virtual {v1}, Landroid/graphics/Bitmap;->recycle()V
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_1
:cond_5
return-object v0
:cond_6
:try_start_5
new-instance v2, Ljava/io/FileOutputStream;
iget-object v3, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->getFileDescriptor()Ljava/io/FileDescriptor;
move-result-object v3
invoke-direct {v2, v3}, Ljava/io/FileOutputStream;-><init>(Ljava/io/FileDescriptor;)V
invoke-virtual {p1, v2}, Landroid/print/pdf/PrintedPdfDocument;->writeTo(Ljava/io/OutputStream;)V
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_0
:try_start_6
invoke-virtual {p1}, Landroid/print/pdf/PrintedPdfDocument;->close()V
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
:try_end_6
.catchall {:try_start_6 .. :try_end_6} :catchall_1
if-eqz p1, :cond_7
:try_start_7
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->close()V
:try_end_7
.catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_1
.catchall {:try_start_7 .. :try_end_7} :catchall_1
:catch_1
:cond_7
:try_start_8
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$bitmap:Landroid/graphics/Bitmap;
if-eq v1, p1, :cond_8
invoke-virtual {v1}, Landroid/graphics/Bitmap;->recycle()V
:cond_8
return-object v0
:catchall_0
move-exception v0
invoke-virtual {p1}, Landroid/print/pdf/PrintedPdfDocument;->close()V
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
:try_end_8
.catchall {:try_start_8 .. :try_end_8} :catchall_1
if-eqz p1, :cond_9
:try_start_9
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$fileDescriptor:Landroid/os/ParcelFileDescriptor;
invoke-virtual {p1}, Landroid/os/ParcelFileDescriptor;->close()V
:try_end_9
.catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_2
.catchall {:try_start_9 .. :try_end_9} :catchall_1
:catch_2
:cond_9
:try_start_a
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$bitmap:Landroid/graphics/Bitmap;
if-eq v1, p1, :cond_a
invoke-virtual {v1}, Landroid/graphics/Bitmap;->recycle()V
:cond_a
throw v0
:try_end_a
.catchall {:try_start_a .. :try_end_a} :catchall_1
:catchall_1
move-exception p1
return-object p1
.end method
.method public bridge synthetic onPostExecute(Ljava/lang/Object;)V
.locals 0
check-cast p1, Ljava/lang/Throwable;
invoke-virtual {p0, p1}, Landroidx/print/PrintHelper$1;->onPostExecute(Ljava/lang/Throwable;)V
return-void
.end method
.method public onPostExecute(Ljava/lang/Throwable;)V
.locals 3
iget-object v0, p0, Landroidx/print/PrintHelper$1;->val$cancellationSignal:Landroid/os/CancellationSignal;
invoke-virtual {v0}, Landroid/os/CancellationSignal;->isCanceled()Z
move-result v0
if-eqz v0, :cond_0
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$writeResultCallback:Landroid/print/PrintDocumentAdapter$WriteResultCallback;
invoke-virtual {p1}, Landroid/print/PrintDocumentAdapter$WriteResultCallback;->onWriteCancelled()V
goto :goto_0
:cond_0
if-nez p1, :cond_1
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$writeResultCallback:Landroid/print/PrintDocumentAdapter$WriteResultCallback;
const/4 v0, 0x1
new-array v0, v0, [Landroid/print/PageRange;
const/4 v1, 0x0
sget-object v2, Landroid/print/PageRange;->ALL_PAGES:Landroid/print/PageRange;
aput-object v2, v0, v1
invoke-virtual {p1, v0}, Landroid/print/PrintDocumentAdapter$WriteResultCallback;->onWriteFinished([Landroid/print/PageRange;)V
goto :goto_0
:cond_1
const-string v0, "PrintHelper"
const-string v1, "Error writing printed content"
invoke-static {v0, v1, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
iget-object p1, p0, Landroidx/print/PrintHelper$1;->val$writeResultCallback:Landroid/print/PrintDocumentAdapter$WriteResultCallback;
const/4 v0, 0x0
invoke-virtual {p1, v0}, Landroid/print/PrintDocumentAdapter$WriteResultCallback;->onWriteFailed(Ljava/lang/CharSequence;)V
:goto_0
return-void
.end method