package com.bytedance.scene.ui;

import X.0HH;
import X.1oX;
import X.8gF;
import X.C3243Ndm;
import X.C4960ODb;
import X.C5906Ofd;
import X.C5924Ofv;
import X.C6000Oh9;
import X.FpG;
import X.O4M;
import X.O4O;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.BadParcelableCrashOptimizer;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class SceneContainerActivity extends 1oX {
    public static final Set<C6000Oh9> LIZ = new HashSet();
    public static final List<SceneContainerActivity> LIZIZ = new ArrayList();
    public int LIZJ = -1;
    public C3243Ndm LIZLLL;
    public boolean LJ;

    /* JADX WARNING: type inference failed for: r0v0, types: [X.1hK, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onPause() {
        8gF.LIZJ(this);
        SceneContainerActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.1hK, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onResume() {
        8gF.LIZIZ(this);
        SceneContainerActivity.super.onResume();
    }

    public void onBackPressed() {
        if (!this.LIZLLL.LIZ()) {
            SceneContainerActivity.super.onBackPressed();
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.1oX, java.lang.Object, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onDestroy() {
        8gF.LJ(this);
        SceneContainerActivity.super.onDestroy();
        LIZIZ.remove(this);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.1oX, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onStart() {
        8gF.LIZ(this);
        SceneContainerActivity.super.onStart();
        this.LJ = true;
    }

    static {
        Covode.recordClassIndex(37519);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.1oX, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onStop() {
        8gF.LIZLLL(this);
        SceneContainerActivity.super.onStop();
        this.LJ = false;
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    public static C4960ODb<? extends Class<? extends C5924Ofv>, Bundle> LIZ(Intent intent) {
        try {
            Class<?> cls = Class.forName(LIZ(intent, "class_name"));
            Bundle bundleExtra = intent.getBundleExtra("arguments");
            Context context = BadParcelableCrashOptimizer.getContext();
            if (!(bundleExtra == null || context == null)) {
                bundleExtra.setClassLoader(context.getClassLoader());
            }
            return C4960ODb.LIZ(cls, bundleExtra);
        } catch (ClassNotFoundException e) {
            0HH.LIZ(e);
            throw new RuntimeException(e);
        }
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [X.1oX, java.lang.Object, android.app.Activity, com.bytedance.scene.ui.SceneContainerActivity] */
    public void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        SceneContainerActivity.super.onCreate(bundle);
        int intExtra = getIntent().getIntExtra("theme", -1);
        if (intExtra != -1) {
            setTheme(intExtra);
        }
        this.LIZJ = intExtra;
        getWindow().getDecorView().setSystemUiVisibility(getWindow().getDecorView().getSystemUiVisibility() | 1024);
        LIZIZ.add(this);
        if (O4O.LIZ(getIntent()) != null) {
            this.LIZLLL = C5906Ofd.LIZ((Activity) this, new FpG(O4M.class, (Bundle) null));
            return;
        }
        C4960ODb<? extends Class<? extends C5924Ofv>, Bundle> LIZ2 = LIZ(getIntent());
        this.LIZLLL = C5906Ofd.LIZ((Activity) this, new FpG((Class) LIZ2.LIZ, (Bundle) LIZ2.LIZIZ));
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }
}
