g.smali

.class Landroid/support/v4/a/g;
.super Landroid/support/v4/a/j;
.source "TypefaceCompatApi21Impl.java"


# direct methods
.method constructor <init>()V
    .registers 1

    .prologue
    .line 45
    invoke-direct {p0}, Landroid/support/v4/a/j;-><init>()V

    return-void
.end method

.method private static a(Landroid/os/ParcelFileDescriptor;)Ljava/io/File;
    .registers 4

    .prologue
    const/4 v1, 0x0

    .line 50
    :try_start_1
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v2, "/proc/self/fd/"

    invoke-direct {v0, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {p0}, Landroid/os/ParcelFileDescriptor;->getFd()I

    move-result v2

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/system/Os;->readlink(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 52
    invoke-static {v2}, Landroid/system/Os;->stat(Ljava/lang/String;)Landroid/system/StructStat;

    move-result-object v0

    iget v0, v0, Landroid/system/StructStat;->st_mode:I

    invoke-static {v0}, Landroid/system/OsConstants;->S_ISREG(I)Z

    move-result v0

    if-eqz v0, :cond_2a

    .line 53
    new-instance v0, Ljava/io/File;

    invoke-direct {v0, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    :try_end_29
    .catch Landroid/system/ErrnoException; {:try_start_1 .. :try_end_29} :catch_2c

    .line 58
    :goto_29
    return-object v0

    :cond_2a
    move-object v0, v1

    .line 55
    goto :goto_29

    .line 58
    :catch_2c
    move-exception v0

    move-object v0, v1

    goto :goto_29
.end method


# virtual methods
.method public a(Landroid/content/Context;[Landroid/support/v4/d/d;I)Landroid/graphics/Typeface;
    .registers 10

    .prologue
    const/4 v0, 0x0

    .line 65
    array-length v1, p2

    if-gtz v1, :cond_5

    .line 82
    :goto_4
    return-object v0

    .line 68
    :cond_5
    invoke-static {p2, p3}, Landroid/support/v4/a/g;->a([Landroid/support/v4/d/d;I)Landroid/support/v4/d/d;

    move-result-object v1

    .line 69
    invoke-virtual {p1}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v2

    .line 1358
    :try_start_d
    iget-object v1, v1, Landroid/support/v4/d/d;->mUri:Landroid/net/Uri;

    .line 71
    const-string v3, "r"

    const/4 v4, 0x0

    invoke-virtual {v2, v1, v3, v4}, Landroid/content/ContentResolver;->openFileDescriptor(Landroid/net/Uri;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/os/ParcelFileDescriptor;
    :try_end_15
    .catch Ljava/io/IOException; {:try_start_d .. :try_end_15} :catch_50

    move-result-object v3

    .line 72
    :try_start_16
    invoke-static {v3}, Landroid/support/v4/a/g;->a(Landroid/os/ParcelFileDescriptor;)Ljava/io/File;

    move-result-object v1

    .line 73
    if-eqz v1, :cond_22

    invoke-virtual {v1}, Ljava/io/File;->canRead()Z

    move-result v2

    if-nez v2, :cond_5e

    .line 76
    :cond_22
    new-instance v4, Ljava/io/FileInputStream;

    invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->getFileDescriptor()Ljava/io/FileDescriptor;

    move-result-object v1

    invoke-direct {v4, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/FileDescriptor;)V
    :try_end_2b
    .catch Ljava/lang/Throwable; {:try_start_16 .. :try_end_2b} :catch_42
    .catchall {:try_start_16 .. :try_end_2b} :catchall_57

    .line 77
    :try_start_2b
    invoke-static {p1, v4}, Landroid/support/v4/a/j;->a(Landroid/content/Context;Ljava/io/InputStream;)Landroid/graphics/Typeface;
    :try_end_2e
    .catch Ljava/lang/Throwable; {:try_start_2b .. :try_end_2e} :catch_39
    .catchall {:try_start_2b .. :try_end_2e} :catchall_72

    move-result-object v1

    .line 78
    :try_start_2f
    invoke-virtual {v4}, Ljava/io/FileInputStream;->close()V
    :try_end_32
    .catch Ljava/lang/Throwable; {:try_start_2f .. :try_end_32} :catch_42
    .catchall {:try_start_2f .. :try_end_32} :catchall_57

    .line 81
    if-eqz v3, :cond_37

    :try_start_34
    invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->close()V
    :try_end_37
    .catch Ljava/io/IOException; {:try_start_34 .. :try_end_37} :catch_50

    :cond_37
    move-object v0, v1

    goto :goto_4

    .line 76
    :catch_39
    move-exception v2

    :try_start_3a
    throw v2
    :try_end_3b
    .catchall {:try_start_3a .. :try_end_3b} :catchall_3b

    .line 78
    :catchall_3b
    move-exception v1

    :goto_3c
    if-eqz v2, :cond_5a

    :try_start_3e
    invoke-virtual {v4}, Ljava/io/FileInputStream;->close()V
    :try_end_41
    .catch Ljava/lang/Throwable; {:try_start_3e .. :try_end_41} :catch_52
    .catchall {:try_start_3e .. :try_end_41} :catchall_57

    :goto_41
    :try_start_41
    throw v1
    :try_end_42
    .catch Ljava/lang/Throwable; {:try_start_41 .. :try_end_42} :catch_42
    .catchall {:try_start_41 .. :try_end_42} :catchall_57

    .line 70
    :catch_42
    move-exception v1

    :try_start_43
    throw v1
    :try_end_44
    .catchall {:try_start_43 .. :try_end_44} :catchall_44

    .line 81
    :catchall_44
    move-exception v2

    move-object v5, v2

    move-object v2, v1

    move-object v1, v5

    :goto_48
    if-eqz v3, :cond_4f

    if-eqz v2, :cond_6e

    :try_start_4c
    invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->close()V
    :try_end_4f
    .catch Ljava/lang/Throwable; {:try_start_4c .. :try_end_4f} :catch_69
    .catch Ljava/io/IOException; {:try_start_4c .. :try_end_4f} :catch_50

    :cond_4f
    :goto_4f
    :try_start_4f
    throw v1
    :try_end_50
    .catch Ljava/io/IOException; {:try_start_4f .. :try_end_50} :catch_50

    .line 82
    :catch_50
    move-exception v1

    goto :goto_4

    .line 78
    :catch_52
    move-exception v4

    :try_start_53
    invoke-virtual {v2, v4}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    goto :goto_41

    .line 81
    :catchall_57
    move-exception v1

    move-object v2, v0

    goto :goto_48

    .line 78
    :cond_5a
    invoke-virtual {v4}, Ljava/io/FileInputStream;->close()V

    goto :goto_41

    .line 80
    :cond_5e
    invoke-static {v1}, Landroid/graphics/Typeface;->createFromFile(Ljava/io/File;)Landroid/graphics/Typeface;
    :try_end_61
    .catch Ljava/lang/Throwable; {:try_start_53 .. :try_end_61} :catch_42
    .catchall {:try_start_53 .. :try_end_61} :catchall_57

    move-result-object v1

    .line 81
    if-eqz v3, :cond_67

    :try_start_64
    invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->close()V

    :cond_67
    move-object v0, v1

    goto :goto_4

    :catch_69
    move-exception v3

    invoke-virtual {v2, v3}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V

    goto :goto_4f

    :cond_6e
    invoke-virtual {v3}, Landroid/os/ParcelFileDescriptor;->close()V
    :try_end_71
    .catch Ljava/io/IOException; {:try_start_64 .. :try_end_71} :catch_50

    goto :goto_4f

    .line 78
    :catchall_72
    move-exception v1

    move-object v2, v0

    goto :goto_3c
.end method