LocalExifThumbnailProducer.smali
.class public Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;
.super Ljava/lang/Object;
.source "SourceFile"
# interfaces
.implements Lcom/facebook/imagepipeline/producers/ThumbnailProducer;
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/lang/Object;",
"Lcom/facebook/imagepipeline/producers/ThumbnailProducer<",
"Lcom/facebook/imagepipeline/image/EncodedImage;",
">;"
}
.end annotation
# static fields
.field private static final COMMON_EXIF_THUMBNAIL_MAX_DIMENSION:I = 0x200
.field public static final CREATED_THUMBNAIL:Ljava/lang/String; = "createdThumbnail"
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.end field
.field public static final PRODUCER_NAME:Ljava/lang/String; = "LocalExifThumbnailProducer"
# instance fields
.field private final mContentResolver:Landroid/content/ContentResolver;
.field private final mExecutor:Ljava/util/concurrent/Executor;
.field private final mPooledByteBufferFactory:Lcom/facebook/common/memory/PooledByteBufferFactory;
# direct methods
.method public constructor <init>(Ljava/util/concurrent/Executor;Lcom/facebook/common/memory/PooledByteBufferFactory;Landroid/content/ContentResolver;)V
.registers 4
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
iput-object p1, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mExecutor:Ljava/util/concurrent/Executor;
.line 3
iput-object p2, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mPooledByteBufferFactory:Lcom/facebook/common/memory/PooledByteBufferFactory;
.line 4
iput-object p3, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mContentResolver:Landroid/content/ContentResolver;
return-void
.end method
.method public static INVOKEINTERFACE_com_facebook_imagepipeline_producers_LocalExifThumbnailProducer_com_shopee_app_asm_anr_threadpool_ExecutorProxy_execute(Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V
.registers 4
.line 1
invoke-static {}, Lcom/shopee/app/asm/anr/threadpool/c;->b()Z
move-result v0
if-eqz v0, :cond_3a
invoke-static {}, Lcom/shopee/app/asm/anr/threadpool/c;->a()Z
move-result v0
if-eqz v0, :cond_3a
.line 2
:try_start_c
sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;
.line 3
sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->b:Landroid/os/Handler;
new-instance v1, Lcom/shopee/app/asm/anr/threadpool/a$b;
invoke-direct {v1, p0, p1}, Lcom/shopee/app/asm/anr/threadpool/a$b;-><init>(Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V
invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z
:try_end_18
.catchall {:try_start_c .. :try_end_18} :catchall_19
goto :goto_54
:catchall_19
move-exception v0
.line 4
invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
sget-object v0, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;
.line 5
:try_start_1f
invoke-static {p1, p0}, Lcom/shopee/app/asm/anr/threadpool/a;->a(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_2b
.line 6
sget-object p0, Lcom/shopee/app/asm/fix/threadpool/global/i;->e:Lcom/shopee/app/asm/fix/threadpool/global/j;
.line 7
invoke-virtual {p0, p1}, Lcom/shopee/app/asm/anr/threadpool/b;->execute(Ljava/lang/Runnable;)V
return-void
.line 8
:cond_2b
invoke-interface {p0, p1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
:try_end_2e
.catchall {:try_start_1f .. :try_end_2e} :catchall_2f
goto :goto_54
:catchall_2f
move-exception p0
.line 9
sget-object p1, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;
.line 10
invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;
move-result-object p1
invoke-virtual {p1, p0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V
goto :goto_54
.line 11
:cond_3a
:try_start_3a
invoke-static {p1, p0}, Lcom/shopee/app/asm/anr/threadpool/a;->a(Ljava/lang/Object;Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_46
.line 12
sget-object p0, Lcom/shopee/app/asm/fix/threadpool/global/i;->e:Lcom/shopee/app/asm/fix/threadpool/global/j;
.line 13
invoke-virtual {p0, p1}, Lcom/shopee/app/asm/anr/threadpool/b;->execute(Ljava/lang/Runnable;)V
return-void
.line 14
:cond_46
invoke-interface {p0, p1}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
:try_end_49
.catchall {:try_start_3a .. :try_end_49} :catchall_4a
goto :goto_54
:catchall_4a
move-exception p0
.line 15
sget-object p1, Lcom/shopee/app/asm/anr/threadpool/c;->a:Landroid/os/HandlerThread;
.line 16
invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;
move-result-object p1
invoke-virtual {p1, p0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V
:goto_54
return-void
.end method
.method public static synthetic access$000(Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;)Lcom/facebook/common/memory/PooledByteBufferFactory;
.registers 1
iget-object p0, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mPooledByteBufferFactory:Lcom/facebook/common/memory/PooledByteBufferFactory;
return-object p0
.end method
.method public static synthetic access$100(Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;Lcom/facebook/common/memory/PooledByteBuffer;Landroid/media/ExifInterface;)Lcom/facebook/imagepipeline/image/EncodedImage;
.registers 3
invoke-direct {p0, p1, p2}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->buildEncodedImage(Lcom/facebook/common/memory/PooledByteBuffer;Landroid/media/ExifInterface;)Lcom/facebook/imagepipeline/image/EncodedImage;
move-result-object p0
return-object p0
.end method
.method private buildEncodedImage(Lcom/facebook/common/memory/PooledByteBuffer;Landroid/media/ExifInterface;)Lcom/facebook/imagepipeline/image/EncodedImage;
.registers 6
.line 1
new-instance v0, Lcom/facebook/common/memory/PooledByteBufferInputStream;
invoke-direct {v0, p1}, Lcom/facebook/common/memory/PooledByteBufferInputStream;-><init>(Lcom/facebook/common/memory/PooledByteBuffer;)V
.line 2
invoke-static {v0}, Lcom/facebook/imageutils/BitmapUtil;->decodeDimensions(Ljava/io/InputStream;)Landroid/util/Pair;
move-result-object v0
.line 3
invoke-direct {p0, p2}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->getRotationAngle(Landroid/media/ExifInterface;)I
move-result p2
const/4 v1, -0x1
if-eqz v0, :cond_19
.line 4
iget-object v2, v0, Landroid/util/Pair;->first:Ljava/lang/Object;
check-cast v2, Ljava/lang/Integer;
invoke-virtual {v2}, Ljava/lang/Integer;->intValue()I
move-result v2
goto :goto_1a
:cond_19
const/4 v2, -0x1
:goto_1a
if-eqz v0, :cond_24
.line 5
iget-object v0, v0, Landroid/util/Pair;->second:Ljava/lang/Object;
check-cast v0, Ljava/lang/Integer;
invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I
move-result v1
.line 6
:cond_24
invoke-static {p1}, Lcom/facebook/common/references/CloseableReference;->of(Ljava/io/Closeable;)Lcom/facebook/common/references/CloseableReference;
move-result-object p1
.line 7
:try_start_28
new-instance v0, Lcom/facebook/imagepipeline/image/EncodedImage;
invoke-direct {v0, p1}, Lcom/facebook/imagepipeline/image/EncodedImage;-><init>(Lcom/facebook/common/references/CloseableReference;)V
:try_end_2d
.catchall {:try_start_28 .. :try_end_2d} :catchall_3f
.line 8
invoke-static {p1}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
.line 9
sget-object p1, Lcom/facebook/imageformat/DefaultImageFormats;->JPEG:Lcom/facebook/imageformat/ImageFormat;
invoke-virtual {v0, p1}, Lcom/facebook/imagepipeline/image/EncodedImage;->setImageFormat(Lcom/facebook/imageformat/ImageFormat;)V
.line 10
invoke-virtual {v0, p2}, Lcom/facebook/imagepipeline/image/EncodedImage;->setRotationAngle(I)V
.line 11
invoke-virtual {v0, v2}, Lcom/facebook/imagepipeline/image/EncodedImage;->setWidth(I)V
.line 12
invoke-virtual {v0, v1}, Lcom/facebook/imagepipeline/image/EncodedImage;->setHeight(I)V
return-object v0
:catchall_3f
move-exception p2
.line 13
invoke-static {p1}, Lcom/facebook/common/references/CloseableReference;->closeSafely(Lcom/facebook/common/references/CloseableReference;)V
.line 14
throw p2
.end method
.method private getRotationAngle(Landroid/media/ExifInterface;)I
.registers 3
const-string v0, "Orientation"
.line 1
invoke-virtual {p1, v0}, Landroid/media/ExifInterface;->getAttribute(Ljava/lang/String;)Ljava/lang/String;
move-result-object p1
invoke-static {p1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result p1
.line 2
invoke-static {p1}, Lcom/facebook/imageutils/JfifUtil;->getAutoRotateAngleFromOrientation(I)I
move-result p1
return p1
.end method
# virtual methods
.method public canProvideImageForSize(Lcom/facebook/imagepipeline/common/ResizeOptions;)Z
.registers 3
const/16 v0, 0x200
invoke-static {v0, v0, p1}, Lcom/facebook/imagepipeline/producers/ThumbnailSizeChecker;->isImageBigEnough(IILcom/facebook/imagepipeline/common/ResizeOptions;)Z
move-result p1
return p1
.end method
.method public canReadAsFile(Ljava/lang/String;)Z
.registers 4
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 v0, 0x0
if-nez p1, :cond_4
return v0
.line 1
:cond_4
new-instance v1, Ljava/io/File;
invoke-direct {v1, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 2
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-result p1
if-eqz p1, :cond_16
invoke-virtual {v1}, Ljava/io/File;->canRead()Z
move-result p1
if-eqz p1, :cond_16
const/4 v0, 0x1
:cond_16
return v0
.end method
.method public getExifInterface(Landroid/net/Uri;)Landroid/media/ExifInterface;
.registers 3
.annotation build Lcom/facebook/common/internal/VisibleForTesting;
.end annotation
.line 1
iget-object v0, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mContentResolver:Landroid/content/ContentResolver;
invoke-static {v0, p1}, Lcom/facebook/common/util/UriUtil;->getRealPathFromUri(Landroid/content/ContentResolver;Landroid/net/Uri;)Ljava/lang/String;
move-result-object p1
.line 2
:try_start_6
invoke-virtual {p0, p1}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->canReadAsFile(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_19
.line 3
new-instance v0, Landroid/media/ExifInterface;
invoke-direct {v0, p1}, Landroid/media/ExifInterface;-><init>(Ljava/lang/String;)V
:try_end_11
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_11} :catch_19
.catch Ljava/lang/StackOverflowError; {:try_start_6 .. :try_end_11} :catch_12
return-object v0
.line 4
:catch_12
const-class p1, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;
const-string v0, "StackOverflowError in ExifInterface constructor"
invoke-static {p1, v0}, Lcom/facebook/common/logging/FLog;->e(Ljava/lang/Class;Ljava/lang/String;)V
:catch_19
:cond_19
const/4 p1, 0x0
return-object p1
.end method
.method public produceResults(Lcom/facebook/imagepipeline/producers/Consumer;Lcom/facebook/imagepipeline/producers/ProducerContext;)V
.registers 11
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/facebook/imagepipeline/producers/Consumer<",
"Lcom/facebook/imagepipeline/image/EncodedImage;",
">;",
"Lcom/facebook/imagepipeline/producers/ProducerContext;",
")V"
}
.end annotation
.line 1
invoke-interface {p2}, Lcom/facebook/imagepipeline/producers/ProducerContext;->getListener()Lcom/facebook/imagepipeline/producers/ProducerListener;
move-result-object v3
.line 2
invoke-interface {p2}, Lcom/facebook/imagepipeline/producers/ProducerContext;->getId()Ljava/lang/String;
move-result-object v5
.line 3
invoke-interface {p2}, Lcom/facebook/imagepipeline/producers/ProducerContext;->getImageRequest()Lcom/facebook/imagepipeline/request/ImageRequest;
move-result-object v6
.line 4
new-instance v7, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer$1;
const-string v4, "LocalExifThumbnailProducer"
move-object v0, v7
move-object v1, p0
move-object v2, p1
invoke-direct/range {v0 .. v6}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer$1;-><init>(Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;Lcom/facebook/imagepipeline/producers/Consumer;Lcom/facebook/imagepipeline/producers/ProducerListener;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/imagepipeline/request/ImageRequest;)V
.line 5
new-instance p1, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer$2;
invoke-direct {p1, p0, v7}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer$2;-><init>(Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;Lcom/facebook/imagepipeline/producers/StatefulProducerRunnable;)V
invoke-interface {p2, p1}, Lcom/facebook/imagepipeline/producers/ProducerContext;->addCallbacks(Lcom/facebook/imagepipeline/producers/ProducerContextCallbacks;)V
.line 6
iget-object p1, p0, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->mExecutor:Ljava/util/concurrent/Executor;
invoke-static {p1, v7}, Lcom/facebook/imagepipeline/producers/LocalExifThumbnailProducer;->INVOKEINTERFACE_com_facebook_imagepipeline_producers_LocalExifThumbnailProducer_com_shopee_app_asm_anr_threadpool_ExecutorProxy_execute(Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V
return-void
.end method