granularity level: instruction
.class Lcom/google/firebase/installations/CrossProcessLock;
.super Ljava/lang/Object;
.source "CrossProcessLock.java"
.field private static final TAG:Ljava/lang/String; = "CrossProcessLock"
.field private final channel:Ljava/nio/channels/FileChannel;
.field private final lock:Ljava/nio/channels/FileLock;
.method private constructor <init>(Ljava/nio/channels/FileChannel;Ljava/nio/channels/FileLock;)V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lcom/google/firebase/installations/CrossProcessLock;->channel:Ljava/nio/channels/FileChannel;
iput-object p2, p0, Lcom/google/firebase/installations/CrossProcessLock;->lock:Ljava/nio/channels/FileLock;
return-void
.end method
.method static acquire(Landroid/content/Context;Ljava/lang/String;)Lcom/google/firebase/installations/CrossProcessLock;
.locals 4
const/4 v0, 0x0
:try_start_0
new-instance v1, Ljava/io/File;
invoke-virtual {p0}, Landroid/content/Context;->getFilesDir()Ljava/io/File;
move-result-object p0
invoke-direct {v1, p0, p1}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
new-instance p0, Ljava/io/RandomAccessFile;
const-string p1, "rw"
invoke-direct {p0, v1, p1}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-virtual {p0}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
move-result-object p0
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_8
.catch Ljava/lang/Error; {:try_start_0 .. :try_end_0} :catch_7
.catch Ljava/nio/channels/OverlappingFileLockException; {:try_start_0 .. :try_end_0} :catch_6
:try_start_1
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
move-result-object p1
:try_end_1
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_5
.catch Ljava/lang/Error; {:try_start_1 .. :try_end_1} :catch_4
.catch Ljava/nio/channels/OverlappingFileLockException; {:try_start_1 .. :try_end_1} :catch_3
:try_start_2
new-instance v1, Lcom/google/firebase/installations/CrossProcessLock;
invoke-direct {v1, p0, p1}, Lcom/google/firebase/installations/CrossProcessLock;-><init>(Ljava/nio/channels/FileChannel;Ljava/nio/channels/FileLock;)V
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2
.catch Ljava/lang/Error; {:try_start_2 .. :try_end_2} :catch_1
.catch Ljava/nio/channels/OverlappingFileLockException; {:try_start_2 .. :try_end_2} :catch_0
return-object v1
:catch_0
move-exception v1
goto :goto_2
:catch_1
move-exception v1
goto :goto_2
:catch_2
move-exception v1
goto :goto_2
:catch_3
move-exception v1
goto :goto_0
:catch_4
move-exception v1
goto :goto_0
:catch_5
move-exception v1
:goto_0
move-object p1, v0
goto :goto_2
:catch_6
move-exception v1
goto :goto_1
:catch_7
move-exception v1
goto :goto_1
:catch_8
move-exception v1
:goto_1
move-object p0, v0
move-object p1, p0
:goto_2
const-string v2, "CrossProcessLock"
const-string v3, "encountered error while creating and acquiring the lock, ignoring"
invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
if-eqz p1, :cond_0
:try_start_3
invoke-virtual {p1}, Ljava/nio/channels/FileLock;->release()V
:try_end_3
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_9
goto :goto_3
:catch_9
nop
:goto_3
:cond_0
if-eqz p0, :cond_1
:try_start_4
invoke-virtual {p0}, Ljava/nio/channels/FileChannel;->close()V
:try_end_4
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_a
:cond_1
:catch_a
return-object v0
.end method
.method releaseAndClose()V
.locals 3
:try_start_0
iget-object v0, p0, Lcom/google/firebase/installations/CrossProcessLock;->lock:Ljava/nio/channels/FileLock;
invoke-virtual {v0}, Ljava/nio/channels/FileLock;->release()V
iget-object v0, p0, Lcom/google/firebase/installations/CrossProcessLock;->channel:Ljava/nio/channels/FileChannel;
invoke-virtual {v0}, Ljava/nio/channels/FileChannel;->close()V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v0
const-string v1, "CrossProcessLock"
const-string v2, "encountered error while releasing, ignoring"
invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:goto_0
return-void
.end method