package com.bytedance.disk.core;

import X.8qy;
import X.C3780Qcb;
import X.C3781Qcc;
import X.C3788Qcj;
import android.content.Context;
import android.os.ConditionVariable;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.concurrent.atomic.AtomicBoolean;

public class DiskMigrateServerImpl {
    public static boolean LIZ;
    public static volatile DiskMigrateServerImpl LIZIZ;
    public Context LIZJ;
    public volatile C3780Qcb LIZLLL;
    public AtomicBoolean LJ = new AtomicBoolean(false);
    public ConditionVariable LJFF = new ConditionVariable(false);
    public int LJI = -1;
    public int LJII = -1;
    public C3781Qcc LJIIIIZZ = null;

    static {
        Covode.recordClassIndex(25709);
    }

    public static DiskMigrateServerImpl getInstance() {
        if (LIZIZ == null && LIZ) {
            C3788Qcj.LIZJ("DiskMigrateServerImpl not inited!", new Object[0]);
        }
        return LIZIZ;
    }

    public void start() {
        MethodCollector.i(14333);
        if (!this.LJ.get()) {
            synchronized (this) {
                try {
                    Context context = this.LIZJ;
                    int i = this.LJI;
                    int i2 = this.LJII;
                    C3781Qcc qcc = this.LJIIIIZZ;
                    if (C3780Qcb.LIZ == null) {
                        synchronized (C3780Qcb.class) {
                            if (C3780Qcb.LIZ == null) {
                                C3780Qcb.LIZ = new C3780Qcb(context, i, i2, qcc);
                            }
                        }
                    }
                    if (C3780Qcb.LIZ == null) {
                        C3788Qcj.LIZJ("MigrationManager must be init before getInstance!", new Object[0]);
                    }
                    this.LIZLLL = C3780Qcb.LIZ;
                    this.LJ.set(true);
                    this.LJFF.open();
                } catch (Throwable th) {
                    MethodCollector.o(14333);
                    throw th;
                }
            }
            MethodCollector.o(14333);
            return;
        }
        MethodCollector.o(14333);
    }

    public DiskMigrateServerImpl(Context context) {
        this.LIZJ = context;
        8qy.LIZ(context);
    }

    public static void init(Context context) {
        MethodCollector.i(13899);
        if (LIZIZ == null) {
            synchronized (DiskMigrateServerImpl.class) {
                try {
                    if (LIZIZ == null) {
                        LIZIZ = new DiskMigrateServerImpl(context);
                    }
                } finally {
                    MethodCollector.o(13899);
                }
            }
            return;
        }
        MethodCollector.o(13899);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:10:0x001e, code lost:
        return;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void config(int r4, int r5, X.C3781Qcc r6) {
        /*
            r3 = this;
            r2 = 14129(0x3731, float:1.9799E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r2)
            monitor-enter(r3)
            java.util.concurrent.atomic.AtomicBoolean r0 = r3.LJ     // Catch:{ all -> 0x002c }
            boolean r0 = r0.get()     // Catch:{ all -> 0x002c }
            if (r0 == 0) goto L_0x001f
            boolean r0 = LIZ     // Catch:{ all -> 0x002c }
            if (r0 == 0) goto L_0x001a
            java.lang.String r1 = "service has start! please call this method before start"
            r0 = 0
            java.lang.Object[] r0 = new java.lang.Object[r0]     // Catch:{ all -> 0x002c }
            X.C3788Qcj.LIZ(r1, r0)     // Catch:{ all -> 0x002c }
        L_0x001a:
            monitor-exit(r3)     // Catch:{ all -> 0x002c }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r2)
            return
        L_0x001f:
            r3.LJI = r4     // Catch:{ all -> 0x002c }
            r3.LJII = r5     // Catch:{ all -> 0x002c }
            r3.LJIIIIZZ = r6     // Catch:{ all -> 0x002c }
            X.C3788Qcj.LIZ = r6     // Catch:{ all -> 0x002c }
            monitor-exit(r3)     // Catch:{ all -> 0x002c }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r2)
            return
        L_0x002c:
            r0 = move-exception
            monitor-exit(r3)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r2)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.disk.core.DiskMigrateServerImpl.config(int, int, X.Qcc):void");
    }
}
