package com.bytedance.sysoptimizer;

import com.bytedance.covode.number.Covode;

public class MediaCodecReleaseOpt {
    public static boolean sOptimized;

    static {
        Covode.recordClassIndex(38416);
    }

    public static native boolean optimize(boolean z);

    /* JADX WARNING: Code restructure failed: missing block: B:22:?, code lost:
        com.bytedance.frameworks.apm.trace.MethodCollector.o(16009);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:24:0x003f, code lost:
        return;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [B:21:0x003b, B:25:0x0040] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:21:0x003b */
    /* JADX WARNING: Missing exception handler attribute for start block: B:25:0x0040 */
    /* JADX WARNING: Unknown top exception splitter block from list: {B:25:0x0040=Splitter:B:25:0x0040, B:21:0x003b=Splitter:B:21:0x003b} */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static synchronized void fix(android.content.Context r5, boolean r6) {
        /*
            java.lang.Class<com.bytedance.sysoptimizer.MediaCodecReleaseOpt> r4 = com.bytedance.sysoptimizer.MediaCodecReleaseOpt.class
            monitor-enter(r4)
            r3 = 16009(0x3e89, float:2.2433E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r3)     // Catch:{ all -> 0x0045 }
            boolean r0 = sOptimized     // Catch:{ all -> 0x0045 }
            if (r0 == 0) goto L_0x0011
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r3)     // Catch:{ all -> 0x0045 }
            monitor-exit(r4)
            return
        L_0x0011:
            int r1 = android.os.Build.VERSION.SDK_INT     // Catch:{ all -> 0x0045 }
            r0 = 30
            if (r1 < r0) goto L_0x0040
            boolean r0 = com.bytedance.sysoptimizer.SysOptimizer.loadOptimizerLibrary(r5)     // Catch:{ all -> 0x0045 }
            if (r0 == 0) goto L_0x0040
            X.Tfz r2 = new X.Tfz     // Catch:{ all -> 0x0045 }
            r2.<init>()     // Catch:{ all -> 0x0045 }
            X.TLf r0 = X.C0161TLf.SHARED     // Catch:{ all -> 0x0045 }
            r2.LIZ(r0)     // Catch:{ all -> 0x0045 }
            r1 = 1
            r2.LIZ = r1     // Catch:{ all -> 0x0045 }
            X.Tg0 r0 = r2.LIZ()     // Catch:{ all -> 0x0045 }
            com.bytedance.shadowhook.ShadowHook.init(r0)     // Catch:{ all -> 0x0045 }
            optimize(r6)     // Catch:{ UnsatisfiedLinkError -> 0x003b, NoSuchMethodError -> 0x0040 }
            sOptimized = r1     // Catch:{ UnsatisfiedLinkError -> 0x003b, NoSuchMethodError -> 0x0040 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r3)     // Catch:{ all -> 0x0045 }
            monitor-exit(r4)
            return
        L_0x003b:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r3)     // Catch:{ all -> 0x0045 }
            monitor-exit(r4)
            return
        L_0x0040:
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r3)     // Catch:{ all -> 0x0045 }
            monitor-exit(r4)
            return
        L_0x0045:
            r0 = move-exception
            monitor-exit(r4)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.sysoptimizer.MediaCodecReleaseOpt.fix(android.content.Context, boolean):void");
    }
}
