package com.bytedance.sdk.openadsdk.component.reward.fm;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.bytedance.sdk.component.utils.wey;
import com.bytedance.sdk.openadsdk.core.ai;
import com.bytedance.sdk.openadsdk.core.model.lse;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public class lb {
    public static void fm(ro roVar, Intent intent, Bundle bundle) {
        fm(intent, roVar);
        fm(bundle, roVar);
    }

    public static void fm(com.bytedance.sdk.openadsdk.component.reward.lb.ro roVar, Intent intent, Bundle bundle) {
        fm(intent, roVar);
        fm(bundle, roVar);
    }

    public static lse fm(Intent intent, Bundle bundle, com.bytedance.sdk.openadsdk.component.reward.lb.jnr jnrVar) {
        com.bytedance.sdk.openadsdk.core.model.fm fmVarRo = ai.fm().ro(ai.fm(intent));
        lse lseVarVt = fmVarRo != null ? fmVarRo.vt() : null;
        if (jnrVar != null) {
            jnrVar.fm(bundle);
        }
        if (bundle != null) {
            try {
                lseVarVt = ai.fm().fm(bundle.getInt("meta_index", -1));
                Objects.toString(lseVarVt);
            } catch (Throwable th) {
                wey.fm("TTAD.RFDM", "", th);
            }
        }
        if (lseVarVt != null) {
            lseVarVt.fm(lseVarVt.pcm(), 7);
        }
        return lseVarVt;
    }

    public static lse fm(Intent intent, Bundle bundle, com.bytedance.sdk.openadsdk.core.fhx.yz.ro roVar) {
        com.bytedance.sdk.openadsdk.core.model.fm fmVarRo = ai.fm().ro(ai.fm(intent));
        lse lseVarVt = fmVarRo != null ? fmVarRo.vt() : null;
        if (roVar != null) {
            roVar.fm(bundle);
        }
        ai.fm().jnr();
        if (bundle != null) {
            try {
                lseVarVt = ai.fm().fm(bundle.getInt("meta_index", -1));
                Objects.toString(lseVarVt);
            } catch (Throwable th) {
                wey.fm("TTAD.RFDM", "", th);
            }
        }
        if (lseVarVt != null) {
            lseVarVt.fm(lseVarVt.pcm(), 7);
        }
        return lseVarVt;
    }

    public static void fm(Intent intent, ro roVar) {
        if (intent == null) {
            return;
        }
        roVar.sds.lb(intent.getBooleanExtra("video_is_cached", false));
        roVar.lz = intent.getStringExtra("multi_process_listener_key");
        roVar.vvj = intent.getIntExtra("orientation_angle", 0) == 3;
    }

    public static void fm(Intent intent, com.bytedance.sdk.openadsdk.component.reward.lb.ro roVar) {
        if (intent == null) {
            return;
        }
        roVar.ro(intent.getBooleanExtra("video_is_cached", false));
        roVar.ro = intent.getIntExtra("orientation_angle", 0) == 3;
    }

    public static void fm(Bundle bundle, ro roVar) {
        if (bundle == null) {
            return;
        }
        roVar.lz = bundle.getString("multi_process_listener_key");
        roVar.sds.lb(bundle.getBoolean("video_is_cached", false));
        roVar.f6943qf = bundle.getBoolean("is_mute");
        if (bundle.getLong("video_current") > 0) {
            roVar.sds.ro(bundle.getLong("video_current", 0L));
        }
        roVar.fm(bundle.getBoolean("has_show_skip_btn"));
    }

    public static void fm(Bundle bundle, com.bytedance.sdk.openadsdk.component.reward.lb.ro roVar) {
        if (bundle == null) {
            return;
        }
        roVar.ro(bundle.getBoolean("video_is_cached", false));
    }

    public static void fm(ro roVar, Bundle bundle, int i10) {
        if (bundle == null) {
            return;
        }
        try {
            bundle.putInt("meta_index", i10);
            bundle.putString("multi_process_listener_key", roVar.lz);
            bundle.putBoolean("video_is_cached", roVar.sds.pkk());
            bundle.putLong("video_current", roVar.sds.dsz());
            bundle.putBoolean("is_mute", roVar.f6943qf);
            bundle.putBoolean("has_show_skip_btn", roVar.mj);
        } catch (Throwable th) {
            wey.fm("TTAD.RFDM", "onSaveInstanceState: ", th);
        }
    }

    public static void fm(com.bytedance.sdk.openadsdk.component.reward.lb.ro roVar, Bundle bundle, int i10) {
        if (bundle == null) {
            return;
        }
        try {
            bundle.putInt("meta_index", i10);
            if (roVar != null) {
                bundle.putBoolean("video_is_cached", roVar.fhx());
            }
        } catch (Throwable th) {
            wey.fm("TTAD.RFDM", "onSaveInstanceState: ", th);
        }
    }

    public static void fm(lse lseVar, Intent intent, Bundle bundle, int i10) {
        if (bundle == null || lseVar == null) {
            return;
        }
        try {
            bundle.putInt("meta_index", i10);
            if (intent != null) {
                bundle.putString("multi_process_listener_key", intent.getStringExtra("multi_process_listener_key"));
                bundle.putBoolean("video_is_cached", intent.getBooleanExtra("video_is_cached", false));
            }
        } catch (Throwable th) {
            wey.fm("TTAD.RFDM", "onSaveInstanceState: ", th);
        }
    }

    public static void fm(Intent intent, Activity activity, boolean z10, com.bytedance.sdk.openadsdk.core.model.fm fmVar, String str) {
        int rotation;
        if (activity == null) {
            intent.addFlags(268435456);
        } else {
            try {
                rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
            } catch (Exception e10) {
                wey.fm("TTAD.RFDM", "", e10);
                rotation = 0;
            }
            intent.putExtra("orientation_angle", rotation);
            intent.putExtra("video_is_cached", z10);
            ai.fm().jnr();
            intent.putExtra("meta_index", ai.fm().fm(fmVar));
            intent.putExtra("single_process_listener_key", str);
        }
        rotation = 0;
        intent.putExtra("orientation_angle", rotation);
        intent.putExtra("video_is_cached", z10);
        ai.fm().jnr();
        intent.putExtra("meta_index", ai.fm().fm(fmVar));
        intent.putExtra("single_process_listener_key", str);
    }
}
