导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - UnityActivity.java 源代码

正在查看: RummyCircle v11000.89 应用的 UnityActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.games24x7.dynamicrc.unitymodule.ui;

import android.R;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowMetrics;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.core.view.G0;
import androidx.core.view.j0;
import com.games24x7.coregame.BuildConfig;
import com.games24x7.coregame.KrakenApplication;
import com.games24x7.coregame.common.deeplink.util.NativeUtil;
import com.games24x7.coregame.common.pip.PiPBIEventTracker;
import com.games24x7.coregame.common.pip.PiPManagable;
import com.games24x7.coregame.common.pip.PiPManager;
import com.games24x7.coregame.common.utility.Constants;
import com.games24x7.coregame.common.utility.crashlytics.CrashlyticsUtility;
import com.games24x7.coregame.common.utility.flavor.FlavorManager;
import com.games24x7.coregame.common.utility.log.Logger;
import com.games24x7.coregame.common.utility.runtimevars.RunTimeVarsUtility;
import com.games24x7.coregame.unitymodule.model.config.RummyEnums;
import com.games24x7.dynamicrc.unitymodule.MainAppCommunicator;
import com.games24x7.dynamicrc.unitymodule.comm.bridge.KrakenUnityBridge;
import com.games24x7.dynamicrc.unitymodule.comm.unitycomm.NativeUnityCommController;
import com.games24x7.dynamicrc.unitymodule.unity.factory.UnityGameControllerFactory;
import com.games24x7.dynamicrc.unitymodule.unity.framework.UnityFrameworkManager;
import com.games24x7.dynamicrc.unitymodule.unity.interfaces.BaseUnityGameController;
import com.games24x7.dynamicrc.unitymodule.unity.interfaces.UnityGameControllerCallbacks;
import com.games24x7.pgeventbus.event.EventInfo;
import com.games24x7.pgeventbus.event.PGEvent;
import com.unity3d.player.UnityPlayerActivity;
import java.io.File;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
public final class UnityActivity extends UnityPlayerActivity implements UnityGameControllerCallbacks {
    private boolean isActivityTransitionedToPIPMode;
    private BaseUnityGameController mGameController;
    private Runnable mUnityUnloadRunnable;

    @NotNull
    private final String TAG = "UnityActivity";

    @NotNull
    private String isFromPoker = "isFromPoker";

    @NotNull
    private final kotlin.e mUnityFrameworkManager$delegate = kotlin.f.b(new UnityActivity$mUnityFrameworkManager$2(this));

    @NotNull
    private final kotlin.e pipManager$delegate = kotlin.f.b(new UnityActivity$pipManager$2(this));

    @NotNull
    private final kotlin.e mProgressDialog$delegate = kotlin.f.b(new UnityActivity$mProgressDialog$2(this));

    @Metadata
    public enum DLSource {
        PN("PN"),
        PIP("PIP");


        @NotNull
        private final String rawValue;

        DLSource(String str) {
            this.rawValue = str;
        }

        @NotNull
        public final String getRawValue() {
            return this.rawValue;
        }
    }

    private final void adjustContentLayout() {
        findViewById(R.id.content).setVisibility(4);
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public final void run() {
                UnityActivity.adjustContentLayout$lambda$14(UnityActivity.this);
            }
        }, 100L);
    }

    public static final void adjustContentLayout$lambda$14(UnityActivity unityActivity) {
        Intrinsics.checkNotNullParameter(unityActivity, "this$0");
        Pair<Integer, Integer> accurateScreenDp = unityActivity.getAccurateScreenDp();
        unityActivity.adjustToFitPiP(((Number) accurateScreenDp.a).intValue(), ((Number) accurateScreenDp.b).intValue());
    }

    private final void adjustToFitPiP(int i, int i2) {
        View findViewById = findViewById(R.id.content);
        if (findViewById == null) {
            return;
        }
        findViewById.setVisibility(0);
        ViewGroup.LayoutParams layoutParams = findViewById.getLayoutParams();
        if (layoutParams == null) {
            return;
        }
        layoutParams.width = -1;
        layoutParams.height = -1;
        findViewById.setLayoutParams(layoutParams);
        View view = this.mUnityPlayer.getView();
        FrameLayout frameLayout = view instanceof FrameLayout ? (FrameLayout) view : null;
        KeyEvent.Callback childAt = frameLayout != null ? frameLayout.getChildAt(0) : null;
        SurfaceView surfaceView = childAt instanceof SurfaceView ? (SurfaceView) childAt : null;
        if (surfaceView != null) {
            surfaceView.setVisibility(8);
            surfaceView.setVisibility(0);
        }
        this.mUnityPlayer.requestLayout();
        this.mUnityPlayer.invalidate();
        this.mUnityPlayer.onResume();
    }

    private final String appendCommandLineArgument(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return str2;
        }
        return str + " " + str2;
    }

    private final void checkForAppRestart(Bundle bundle) {
        if (bundle != null) {
            boolean z = bundle.getBoolean("restartApp", false);
            Logger.d$default(Logger.INSTANCE, this.TAG, "checkForAppRestart :: Restart App :: " + z, false, 4, (Object) null);
            if (z) {
                KrakenApplication.Companion.updateRuntimeVar("forceCrash", Boolean.FALSE);
                NativeUtil.relaunchApp$default(NativeUtil.INSTANCE, "Unity Force Relaunch", false, 2, (Object) null);
            }
        }
    }

    private final void finishUnityLogout() {
        Logger logger = Logger.INSTANCE;
        Logger.d$default(logger, this.TAG, "finishUnityLogout :: Method Called...", false, 4, (Object) null);
        try {
            if (FlavorManager.INSTANCE.isAnyMECFlavor()) {
                Logger.d$default(logger, this.TAG, "open MEC", false, 4, (Object) null);
                KrakenApplication.Companion.updateRuntimeVar("isRCtoMECLogout", Boolean.TRUE);
                Bundle bundle = new Bundle();
                bundle.putBoolean("isRCtoMECLogout", true);
                NativeUtil.INSTANCE.launchRN(this, bundle, Integer.valueOf(RunTimeVarsUtility.INSTANCE.getBooleanRunTimeVar("isMECFirstLaunch", false) ? 268435456 : 131072));
            } else {
                KrakenApplication.Companion.updateRuntimeVar("isMECFirstLaunch", Boolean.TRUE);
                NativeUtil.launchOnBoardingActivity$default(NativeUtil.INSTANCE, this, false, (Bundle) null, (Integer) null, 14, (Object) null);
            }
            stopLoading();
            sendLogoutResponseToUnity();
        } catch (Exception e) {
            e.printStackTrace();
            CrashlyticsUtility.logException$default(CrashlyticsUtility.INSTANCE, e, (String) null, (HashMap) null, 6, (Object) null);
        }
    }

    private final Pair<Integer, Integer> getAccurateScreenDp() {
        WindowMetrics currentWindowMetrics;
        Rect bounds;
        Rect bounds2;
        float f = getResources().getDisplayMetrics().density;
        if (Build.VERSION.SDK_INT < 30) {
            DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
            return new Pair<>(Integer.valueOf((int) (displayMetrics.widthPixels / f)), Integer.valueOf((int) (displayMetrics.heightPixels / f)));
        }
        currentWindowMetrics = getWindowManager().getCurrentWindowMetrics();
        Intrinsics.checkNotNullExpressionValue(currentWindowMetrics, "windowManager.currentWindowMetrics");
        bounds = currentWindowMetrics.getBounds();
        int width = (int) (bounds.width() / f);
        bounds2 = currentWindowMetrics.getBounds();
        return new Pair<>(Integer.valueOf(width), Integer.valueOf((int) (bounds2.height() / f)));
    }

    private final String getCmdLineOrientation() {
        RunTimeVarsUtility runTimeVarsUtility = RunTimeVarsUtility.INSTANCE;
        Constants.RedesignLobby.RedesignLobbyOrientations redesignLobbyOrientations = Constants.RedesignLobby.RedesignLobbyOrientations.DEFAULT;
        String stringRunTimeVar = runTimeVarsUtility.getStringRunTimeVar("ORIENTATION_VIA_DL", redesignLobbyOrientations.getOrientationString());
        Logger logger = Logger.INSTANCE;
        Logger.d$default(logger, this.TAG, "DL orientation : " + stringRunTimeVar, false, 4, (Object) null);
        if (!Intrinsics.a(stringRunTimeVar, redesignLobbyOrientations.getOrientationString())) {
            return stringRunTimeVar;
        }
        String redesignLobbyOrientationRuntimeVar = NativeUtil.INSTANCE.getRedesignLobbyOrientationRuntimeVar();
        Logger.d$default(logger, this.TAG, "Lobby orientation : " + redesignLobbyOrientationRuntimeVar, false, 4, (Object) null);
        return redesignLobbyOrientationRuntimeVar;
    }

    private final ProgressDialog getMProgressDialog() {
        return (ProgressDialog) this.mProgressDialog$delegate.getValue();
    }

    private final UnityFrameworkManager getMUnityFrameworkManager() {
        return (UnityFrameworkManager) this.mUnityFrameworkManager$delegate.getValue();
    }

    private final PiPManagable getPipManager() {
        return (PiPManagable) this.pipManager$delegate.getValue();
    }

    public final boolean isPIPFeatureExperimentEnabled() {
        return ((int) RunTimeVarsUtility.getDoubleRunTimeVar$default(RunTimeVarsUtility.INSTANCE, "isPIPEnabled", 0.0d, 2, (Object) null)) > RummyEnums.PiPFeatureExperimentPath.CONTROL_PATH.ordinal();
    }

    public final boolean isPiPZKKillSwitchActive() {
        return RunTimeVarsUtility.getBooleanRunTimeVar$default(RunTimeVarsUtility.INSTANCE, "disablePipMode", false, 2, (Object) null);
    }

    private final void launchRCPlaceholderActivity() {
        Logger.d$default(Logger.INSTANCE, this.TAG, "Starting Rc Splash Activity...", false, 4, (Object) null);
        NativeUtil.launchPlaceholderActivity$default(NativeUtil.INSTANCE, this, (Bundle) null, (Integer) null, 6, (Object) null);
    }

    public static final void logoutFromUnity$lambda$12(UnityActivity unityActivity) {
        Intrinsics.checkNotNullParameter(unityActivity, "this$0");
        unityActivity.finishUnityLogout();
    }

    private final void navigateToPokerViaRCWebviews() {
        NativeUtil.INSTANCE.closeOffScreenWebviews();
        if (FlavorManager.INSTANCE.isAnyPokerFlavor() && RunTimeVarsUtility.getBooleanRunTimeVar$default(RunTimeVarsUtility.INSTANCE, "FROM_POKER_TO_RC_WEBVIEWS", false, 2, (Object) null)) {
            Logger.e$default(Logger.INSTANCE, "My11DLProcessor", "sendMecSwitchEventToUnity :: Sending Switch Event to Unity to handle...", false, 4, (Object) null);
            EventInfo eventInfo = new EventInfo("switchToRN", NativeUnityCommController.TYPE, (String) null, (String) null, 12, (DefaultConstructorMarker) null);
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("isSuccess", true);
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("data", "POKER");
            Unit unit = Unit.a;
            jSONObject.put("result", jSONObject2.toString());
            String jSONObject3 = jSONObject.toString();
            Intrinsics.checkNotNullExpressionValue(jSONObject3, "JSONObject().apply {\n   …             }.toString()");
            PGEvent pGEvent = new PGEvent(eventInfo, jSONObject3, new EventInfo(NativeUnityCommController.TYPE, NativeUnityCommController.TYPE, (String) null, (String) null, 12, (DefaultConstructorMarker) null));
            KrakenApplication.Companion companion = KrakenApplication.Companion;
            companion.getEventBus().postEvent(pGEvent);
            companion.updateRuntimeVar(this.isFromPoker, Boolean.FALSE);
        }
        KrakenApplication.Companion.updateRuntimeVar(this.isFromPoker, Boolean.TRUE);
    }

    private final void onPiPModeChanged(boolean z, Configuration configuration) {
        getPipManager().onPictureInPictureModeChanged(z, configuration);
        NativeUtil.INSTANCE.changeUnityInInPiPModeStatus(z);
        if (z) {
            adjustContentLayout();
        } else {
            resetContentLayout();
        }
    }

    private final void resetContentLayout() {
        ViewGroup.LayoutParams layoutParams;
        View findViewById = findViewById(R.id.content);
        if (findViewById == null || (layoutParams = findViewById.getLayoutParams()) == null) {
            return;
        }
        layoutParams.width = -1;
        layoutParams.height = -1;
        findViewById.setLayoutParams(layoutParams);
    }

    private final void sendLogoutResponseToUnity() {
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("isSuccess", true);
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("logoutStatus", "true");
        Unit unit = Unit.a;
        jSONObject.put("result", jSONObject2.toString());
        String jSONObject3 = jSONObject.toString();
        Intrinsics.checkNotNullExpressionValue(jSONObject3, "JSONObject().apply {\n   …   )\n        }.toString()");
        KrakenUnityBridge.INSTANCE.onCallbackFromNative(new PGEvent(new EventInfo("doLogout", (String) null, (String) null, (String) null, 14, (DefaultConstructorMarker) null), jSONObject3, new EventInfo("na", NativeUnityCommController.TYPE, (String) null, (String) null, 12, (DefaultConstructorMarker) null)));
    }

    private final void sendSwitchToReverieEvent() {
        EventInfo eventInfo = new EventInfo("switchToReverieApp", NativeUnityCommController.TYPE, (String) null, (String) null, 12, (DefaultConstructorMarker) null);
        EventInfo eventInfo2 = new EventInfo("na", "na", (String) null, (String) null, 12, (DefaultConstructorMarker) null);
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("initiationPoint", "");
        KrakenUnityBridge krakenUnityBridge = KrakenUnityBridge.INSTANCE;
        String s = new com.google.gson.d().s(eventInfo);
        String s2 = new com.google.gson.d().s(eventInfo2);
        String jSONObject2 = jSONObject.toString();
        Intrinsics.checkNotNullExpressionValue(s, "toJson(eventInfo)");
        Intrinsics.checkNotNullExpressionValue(jSONObject2, "toString()");
        Intrinsics.checkNotNullExpressionValue(s2, "toJson(callbackInfo)");
        KrakenUnityBridge.requestNative(s, jSONObject2, s2);
    }

    private final void showFullScreen() {
        j0.a(getWindow(), false);
        G0 g0 = new G0(getWindow(), getWindow().getDecorView());
        g0.a(2);
        g0.a(1);
        g0.d();
        g0.c(false);
        g0.b(false);
    }

    public static final void showToastMessage$lambda$13(UnityActivity unityActivity, String str) {
        Intrinsics.checkNotNullParameter(unityActivity, "this$0");
        Intrinsics.checkNotNullParameter(str, "$message");
        if (unityActivity.isFinishing() || unityActivity.getMProgressDialog().isShowing()) {
            return;
        }
        Toast.makeText(unityActivity, str, 0).show();
    }

    private final void startLoading() {
        Logger.d$default(Logger.INSTANCE, this.TAG, "startLoading :: Staring the progress dialog", false, 4, (Object) null);
        runOnUiThread(new f(this, 0));
    }

    public static final void startLoading$lambda$8(UnityActivity unityActivity) {
        Intrinsics.checkNotNullParameter(unityActivity, "this$0");
        if (unityActivity.isFinishing() || unityActivity.getMProgressDialog().isShowing()) {
            return;
        }
        unityActivity.getMProgressDialog().show();
    }

    private final void stopLoading() {
        Logger.d$default(Logger.INSTANCE, this.TAG, "stopLoading :: Is Activity Finishing :: " + isFinishing(), false, 4, (Object) null);
        if (isFinishing()) {
            return;
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                UnityActivity.stopLoading$lambda$6(UnityActivity.this);
            }
        });
    }

    public static final void stopLoading$lambda$6(UnityActivity unityActivity) {
        Intrinsics.checkNotNullParameter(unityActivity, "this$0");
        Logger.d$default(Logger.INSTANCE, unityActivity.TAG, "dismissProgressDialog :: Dismissing Progress Dialog...", false, 4, (Object) null);
        if (unityActivity.getMProgressDialog().isShowing()) {
            unityActivity.getMProgressDialog().dismiss();
        }
    }

    private final void unloadUnity(Runnable runnable) {
        Logger.d$default(Logger.INSTANCE, this.TAG, "unloadUnity :: Function Called", false, 4, (Object) null);
        this.mUnityUnloadRunnable = runnable;
        getMUnityFrameworkManager().unloadUnity();
    }

    @Override
    public void attachBaseContext(Context context) {
        super.attachBaseContext(context);
        boolean b = com.google.android.play.core.splitcompat.a.b(this);
        Logger.e$default(Logger.INSTANCE, this.TAG, "UnityActivity installation - " + b, false, 4, (Object) null);
    }

    @Override
    public Intent getActivityIntent() {
        return getIntent();
    }

    @Override
    public String getPackageCodePath() {
        Boolean bool = BuildConfig.DYNAMIC_RC_PS_BUILD;
        Intrinsics.checkNotNullExpressionValue(bool, "DYNAMIC_RC_PS_BUILD");
        if (!bool.booleanValue()) {
            return super.getPackageCodePath();
        }
        if (!new File(getFilesDir(), "splitcompat/462/verified-splits/dynamicRC.apk").exists()) {
            Logger.e$default(Logger.INSTANCE, "UnityActivity", "custom dir NOT present default selected", false, 4, (Object) null);
            return super.getPackageCodePath();
        }
        Logger.e$default(Logger.INSTANCE, "UnityActivity", "custom dir present and chosen", false, 4, (Object) null);
        return getFilesDir() + "/splitcompat/462/verified-splits/dynamicRC.apk";
    }

    @Override
    public void hideLoadingDialog() {
        stopLoading();
    }

    @Override
    public void logoutFromUnity() {
        unloadUnity(new Runnable() {
            @Override
            public final void run() {
                UnityActivity.logoutFromUnity$lambda$12(UnityActivity.this);
            }
        });
    }

    @Override
    public void onCreate(Bundle bundle) {
        KrakenApplication.Companion.setCurrentActivity(this);
        UnityGameControllerFactory unityGameControllerFactory = UnityGameControllerFactory.INSTANCE;
        NativeUtil nativeUtil = NativeUtil.INSTANCE;
        BaseUnityGameController controller = unityGameControllerFactory.getController(nativeUtil.getCurrentGameIdentifier(), this);
        Intent intent = getIntent();
        Intrinsics.checkNotNullExpressionValue(intent, "intent");
        controller.onUnityActivityCreated(bundle, intent);
        this.mGameController = controller;
        super.onCreate(bundle);
        Logger.e$default(Logger.INSTANCE, this.TAG, "onCreate :: Method called in Activity...", false, 4, (Object) null);
        checkForAppRestart(bundle);
        setRequestedOrientation(nativeUtil.getUnityLobbyOrientation());
        MainAppCommunicator.INSTANCE.initMainAppCommunicator();
        getPipManager().setCustomPiPSupportCondition(new UnityActivity$onCreate$2(this));
        showFullScreen();
    }

    @Override
    public void onDestroy() {
        Logger logger = Logger.INSTANCE;
        Logger.e$default(logger, this.TAG, "onDestroy :: Method called in Activity...", false, 4, (Object) null);
        getMUnityFrameworkManager().destroyUnityView();
        BaseUnityGameController baseUnityGameController = this.mGameController;
        if (baseUnityGameController == null) {
            Intrinsics.q("mGameController");
            throw null;
        }
        baseUnityGameController.onUnityActivityDestroyed();
        if (RunTimeVarsUtility.INSTANCE.getBooleanRunTimeVar("forceCrash", false)) {
            Logger.d$default(logger, this.TAG, "onDestroy :: Crashing Unity Activity", false, 4, (Object) null);
            throw new RuntimeException("UnityActivity Destroyed");
        }
        super.onDestroy();
    }

    @Override
    public void onNewIntent(@NotNull Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        super.onNewIntent(intent);
        setRequestedOrientation(NativeUtil.INSTANCE.getUnityLobbyOrientation());
        Logger.e$default(Logger.INSTANCE, this.TAG, "onNewIntent :: Method called in Activity...", false, 4, (Object) null);
        KrakenApplication.Companion companion = KrakenApplication.Companion;
        companion.updateRuntimeVar(this.isFromPoker, Boolean.FALSE);
        companion.setCurrentActivity(this);
        companion.addActivityInStack(this);
        BaseUnityGameController baseUnityGameController = this.mGameController;
        if (baseUnityGameController != null) {
            baseUnityGameController.onUnityActivityNewIntent(intent);
        } else {
            Intrinsics.q("mGameController");
            throw null;
        }
    }

    @Override
    public void onPictureInPictureModeChanged(boolean z) {
        onPiPModeChanged(z, null);
    }

    @Override
    public void onResume() {
        String str;
        super.onResume();
        Logger.e$default(Logger.INSTANCE, this.TAG, "onResume :: Method called in Activity...", false, 4, (Object) null);
        boolean isUnityAppInBackground = NativeUtil.INSTANCE.isUnityAppInBackground();
        KrakenApplication.Companion companion = KrakenApplication.Companion;
        companion.setCurrentActivity(this);
        companion.addActivityInStack(this);
        navigateToPokerViaRCWebviews();
        BaseUnityGameController baseUnityGameController = this.mGameController;
        if (baseUnityGameController == null) {
            Intrinsics.q("mGameController");
            throw null;
        }
        baseUnityGameController.onUnityActivityResumed();
        boolean booleanRunTimeVar$default = RunTimeVarsUtility.getBooleanRunTimeVar$default(RunTimeVarsUtility.INSTANCE, "isGTOpenViaPN", false, 2, (Object) null);
        if (this.isActivityTransitionedToPIPMode) {
            str = DLSource.PIP.getRawValue();
            getPipManager().fireAnalytics(PiPBIEventTracker.BIEvent.GT_PIP_MODE_CLICK_ON_FULLSCREEN.INSTANCE);
        } else {
            str = null;
        }
        if (!booleanRunTimeVar$default && (isUnityAppInBackground || this.isActivityTransitionedToPIPMode)) {
            BaseUnityGameController baseUnityGameController2 = this.mGameController;
            if (baseUnityGameController2 == null) {
                Intrinsics.q("mGameController");
                throw null;
            }
            baseUnityGameController2.sendAppInForegroundEventViaUnity(str);
        }
        this.isActivityTransitionedToPIPMode = false;
        companion.getRuntimeVars().remove("isGTOpenViaPN");
    }

    @Override
    public void onSaveInstanceState(@NotNull Bundle bundle) {
        Intrinsics.checkNotNullParameter(bundle, "bundle");
        Logger.d$default(Logger.INSTANCE, this.TAG, "onSaveInstanceState :: Putting Restart values to SavedStateInstance...", false, 4, (Object) null);
        bundle.putBoolean("restartApp", true);
    }

    @Override
    public void onStart() {
        super.onStart();
        Logger.e$default(Logger.INSTANCE, this.TAG, "onStart :: Method called in Activity...", false, 4, (Object) null);
        BaseUnityGameController baseUnityGameController = this.mGameController;
        if (baseUnityGameController == null) {
            Intrinsics.q("mGameController");
            throw null;
        }
        baseUnityGameController.onUnityActivityStarted();
        Bundle extras = getIntent().getExtras();
        if (extras == null || !extras.getBoolean("pip_to_fullscreen_on_app_icon_clicked", false)) {
            return;
        }
        this.isActivityTransitionedToPIPMode = true;
    }

    @Override
    public void onStop() {
        super.onStop();
        Logger.e$default(Logger.INSTANCE, this.TAG, "onStop :: Method called in Activity...", false, 4, (Object) null);
        BaseUnityGameController baseUnityGameController = this.mGameController;
        if (baseUnityGameController == null) {
            Intrinsics.q("mGameController");
            throw null;
        }
        baseUnityGameController.onUnityActivityStopped();
        if (!getPipManager().isInPiPMode()) {
            getPipManager().fireAnalytics(new PiPBIEventTracker.BIEvent.APP_PUT_IN_BACKGROUND(PiPManager.Companion.isPiPSupported(), NativeUtil.INSTANCE.isGameTableOpen() ? PiPBIEventTracker.Companion.AppState.GAME_TABLE : PiPBIEventTracker.Companion.AppState.LOBBY));
        } else {
            getPipManager().fireAnalytics(PiPBIEventTracker.BIEvent.GT_PIP_MODE_CLICK_ON_CLOSE.INSTANCE);
            this.isActivityTransitionedToPIPMode = false;
        }
    }

    @Override
    public void onUnityPlayerUnloaded() {
        Logger logger = Logger.INSTANCE;
        Logger.d$default(logger, this.TAG, "onUnityPlayerUnloaded :: " + RunTimeVarsUtility.getStringRunTimeVar$default(RunTimeVarsUtility.INSTANCE, "game_identifier", (String) null, 2, (Object) null), false, 4, (Object) null);
        KrakenUnityBridge krakenUnityBridge = KrakenUnityBridge.INSTANCE;
        krakenUnityBridge.setModulesReInitialized(false);
        krakenUnityBridge.setIUnityCallBackAlive(false);
        Runnable runnable = this.mUnityUnloadRunnable;
        if (runnable != null) {
            Logger.e$default(logger, this.TAG, "Running Unity Unload Runnable....", false, 4, (Object) null);
            runnable.run();
            this.mUnityUnloadRunnable = null;
        }
    }

    @Override
    public void onUserLeaveHint() {
        super.onUserLeaveHint();
        Logger.d$default(Logger.INSTANCE, this.TAG, "User pressed home button.", false, 4, (Object) null);
        getPipManager().enter(this);
    }

    @Override
    public void requestScreenOrientation(int i) {
        setRequestedOrientation(i);
    }

    @Override
    public void showLoadingDialog() {
        startLoading();
    }

    @Override
    public void showToastMessage(@NotNull final String str) {
        Intrinsics.checkNotNullParameter(str, "message");
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                UnityActivity.showToastMessage$lambda$13(UnityActivity.this, str);
            }
        });
    }

    @Override
    public void switchGame(@NotNull String str, @NotNull Runnable runnable) {
        Intrinsics.checkNotNullParameter(str, "gameType");
        Intrinsics.checkNotNullParameter(runnable, "switchRunnable");
        int hashCode = str.hashCode();
        if (hashCode != -1616457548) {
            if (hashCode != 333967788) {
                if (hashCode != 1766588673 || !str.equals("GAME_TYPE_POKER")) {
                    return;
                }
            } else if (!str.equals("GAME_TYPE_LUDO")) {
                return;
            }
        } else if (!str.equals("GAME_TYPE_REVERIE")) {
            return;
        }
        unloadUnity(runnable);
    }

    @Override
    public String updateUnityCommandLineArguments(String str) {
        if (RunTimeVarsUtility.INSTANCE.getBooleanRunTimeVar("force_single_threaded_rendering", false)) {
            str = appendCommandLineArgument(str, "-force-gfx-direct");
        }
        return appendCommandLineArgument(str, "-orientation=" + getCmdLineOrientation());
    }

    @Override
    public void onPictureInPictureModeChanged(boolean z, Configuration configuration) {
        onPiPModeChanged(z, configuration);
    }
}