(๑•͈ᴗ•͈)❀送花给你

UnityPlayer ---Android平台的

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.unity3d.player;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.BroadcastReceiver;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.MessageQueue.IdleHandler;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.view.InputEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.SurfaceHolder.Callback;
import android.widget.FrameLayout;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

public class UnityPlayer extends FrameLayout implements com.unity3d.player.f {
    public static Activity currentActivity = null;
    private int c = -1;
    private boolean d = false;
    private boolean e = true;
    private n f = new n();
    private final ConcurrentLinkedQueue g = new ConcurrentLinkedQueue();
    private BroadcastReceiver h = null;
    UnityPlayer.e a = new UnityPlayer.e((byte)0);
    private boolean i = false;
    private UnityPlayer.c j = new UnityPlayer.c((byte)0);
    private TelephonyManager k;
    private ClipboardManager l;
    private l m;
    private GoogleARCoreApi n = null;
    private UnityPlayer.a o = new UnityPlayer.a();
    private Camera2Wrapper p = null;
    private Context q;
    private SurfaceView r;
    private static boolean s;
    private boolean t;
    private boolean u = false;
    private q v;
    k b = null;

    public UnityPlayer(Context var1) {
        super(var1);
        if (var1 instanceof Activity) {
            currentActivity = (Activity)var1;
            this.c = currentActivity.getRequestedOrientation();
        }

        a(currentActivity);
        this.q = var1;
        if (currentActivity != null && this.j()) {
            this.m = new l(this.q, com.unity3d.player.l.a.a()[this.getSplashMode()]);
            this.addView(this.m);
        }

        a(this.q.getApplicationInfo());
        if (!com.unity3d.player.n.c()) {
            AlertDialog var2;
            (var2 = (new Builder(this.q)).setTitle("Failure to initialize!").setPositiveButton("OK", new OnClickListener() {
                public final void onClick(DialogInterface var1, int var2) {
                    UnityPlayer.this.d();
                }
            }).setMessage("Your hardware does not support this application, sorry!").create()).setCancelable(false);
            var2.show();
        } else {
            this.initJni(var1);
            this.f.c(true);
            this.r = this.b();
            this.addView(this.r);
            this.bringChildToFront(this.m);
            this.t = false;
            this.nativeInitWebRequest(UnityWebRequest.class);
            this.l();
            this.k = (TelephonyManager)this.q.getSystemService("phone");
            this.l = (ClipboardManager)this.q.getSystemService("clipboard");
            this.p = new Camera2Wrapper(this.q);
            this.a.start();
        }
    }

    protected void toggleGyroscopeSensor(boolean var1) {
        SensorManager var2;
        Sensor var3 = (var2 = (SensorManager)this.q.getSystemService("sensor")).getDefaultSensor(11);
        if (var1) {
            var2.registerListener(this.o, var3, 1);
        } else {
            var2.unregisterListener(this.o);
        }
    }

    private void a() {
        this.a(new Runnable() {
            public final void run() {
                UnityPlayer.this.removeView(UnityPlayer.this.m);
                UnityPlayer.f(UnityPlayer.this);
            }
        });
    }

    private static void a(Activity var0) {
        View var1;
        if (var0 != null && var0.getIntent().getBooleanExtra("android.intent.extra.VR_LAUNCH", false) && var0.getWindow() != null && (var1 = var0.getWindow().getDecorView()) != null) {
            var1.setSystemUiVisibility(7);
        }

    }

    private SurfaceView b() {
        SurfaceView var1;
        (var1 = new SurfaceView(this.q)).getHolder().setFormat(-3);
        var1.getHolder().addCallback(new Callback() {
            public final void surfaceCreated(SurfaceHolder var1) {
                UnityPlayer.a(UnityPlayer.this, var1.getSurface());
            }

            public final void surfaceChanged(SurfaceHolder var1, int var2, int var3, int var4) {
                UnityPlayer.a(UnityPlayer.this, var1.getSurface());
                UnityPlayer.this.c();
            }

            public final void surfaceDestroyed(SurfaceHolder var1) {
                UnityPlayer.a((UnityPlayer)UnityPlayer.this, (Surface)null);
            }
        });
        var1.setFocusable(true);
        var1.setFocusableInTouchMode(true);
        return var1;
    }

    private void c() {
        if (com.unity3d.player.n.c() && this.f.e()) {
            Runnable var1 = new Runnable() {
                public final void run() {
                    UnityPlayer.this.nativeSendSurfaceChangedEvent();
                }
            };
            this.a.d(var1);
        }
    }

    private void a(int var1, Surface var2) {
        if (!this.d) {
            this.b(0, var2);
        }
    }

    private boolean b(final int var1, final Surface var2) {
        if (com.unity3d.player.n.c() && this.f.e()) {
            final Semaphore var3 = new Semaphore(0);
            Runnable var4 = new Runnable() {
                public final void run() {
                    UnityPlayer.this.nativeRecreateGfxState(var1, var2);
                    var3.release();
                }
            };
            if (var1 == 0) {
                if (var2 == null) {
                    this.a.b(var4);
                } else {
                    this.a.c(var4);
                }
            } else {
                var4.run();
            }

            if (var2 == null && var1 == 0) {
                try {
                    if (!var3.tryAcquire(4L, TimeUnit.SECONDS)) {
                        com.unity3d.player.g.Log(5, "Timeout while trying detaching primary window.");
                    }
                } catch (InterruptedException var5) {
                    com.unity3d.player.g.Log(5, "UI thread got interrupted while trying to detach the primary window from the Unity Engine.");
                }
            }

            return true;
        } else {
            return false;
        }
    }

    public boolean displayChanged(int var1, Surface var2) {
        if (var1 == 0) {
            this.d = var2 != null;
            this.a(new Runnable() {
                public final void run() {
                    if (UnityPlayer.this.d) {
                        UnityPlayer.this.removeView(UnityPlayer.this.r);
                    } else {
                        UnityPlayer.this.addView(UnityPlayer.this.r);
                    }
                }
            });
        }

        return this.b(var1, var2);
    }

    public static void UnitySendMessage(String var0, String var1, String var2) {
        if (!com.unity3d.player.n.c()) {
            com.unity3d.player.g.Log(5, "Native libraries not loaded - dropping message for " + var0 + "." + var1);
        } else {
            nativeUnitySendMessage(var0, var1, var2);
        }
    }

    private static native void nativeUnitySendMessage(String var0, String var1, String var2);

    private void d() {
        if (this.q instanceof Activity && !((Activity)this.q).isFinishing()) {
            ((Activity)this.q).finish();
        }

    }

    final void a(Runnable var1) {
        if (this.q instanceof Activity) {
            ((Activity)this.q).runOnUiThread(var1);
        } else {
            com.unity3d.player.g.Log(5, "Not running Unity from an Activity; ignored...");
        }
    }

    public void init(int var1, boolean var2) {
    }

    public View getView() {
        return this;
    }

    public Bundle getSettings() {
        return Bundle.EMPTY;
    }

    public void quit() {
        this.destroy();
    }

    protected void kill() {
        Process.killProcess(Process.myPid());
    }

    public void destroy() {
        if (GoogleVrApi.b() != null) {
            GoogleVrApi.a();
        }

        if (this.p != null) {
            this.p.a();
            this.p = null;
        }

        this.t = true;
        if (!this.f.d()) {
            this.pause();
        }

        this.a.a();

        try {
            this.a.join(4000L);
        } catch (InterruptedException var1) {
            this.a.interrupt();
        }

        if (this.h != null) {
            this.q.unregisterReceiver(this.h);
        }

        this.h = null;
        if (com.unity3d.player.n.c()) {
            this.removeAllViews();
        }

        if (!this.u) {
            this.kill();
        }

        h();
    }

    public void pause() {
        if (this.n != null) {
            this.n.pauseARCore();
        }

        if (this.v != null) {
            this.v.a();
        }

        GoogleVrProxy var1;
        if ((var1 = GoogleVrApi.b()) != null) {
            var1.pauseGvrLayout();
        }

        this.e();
    }

    private void e() {
        this.reportSoftInputStr((String)null, 1, true);
        if (this.f.g()) {
            if (com.unity3d.player.n.c()) {
                final Semaphore var1 = new Semaphore(0);
                Runnable var2;
                if (this.isFinishing()) {
                    var2 = new Runnable() {
                        public final void run() {
                            UnityPlayer.this.f();
                            var1.release();
                        }
                    };
                } else {
                    var2 = new Runnable() {
                        public final void run() {
                            if (UnityPlayer.this.nativePause()) {
                                UnityPlayer.m(UnityPlayer.this);
                                UnityPlayer.this.f();
                                var1.release(2);
                            } else {
                                var1.release();
                            }
                        }
                    };
                }

                this.a.a(var2);

                try {
                    if (!var1.tryAcquire(4L, TimeUnit.SECONDS)) {
                        com.unity3d.player.g.Log(5, "Timeout while trying to pause the Unity Engine.");
                    }
                } catch (InterruptedException var3) {
                    com.unity3d.player.g.Log(5, "UI thread got interrupted while trying to pause the Unity Engine.");
                }

                if (var1.drainPermits() > 0) {
                    this.destroy();
                }
            }

            this.f.d(false);
            this.f.b(true);
            if (this.i) {
                this.k.listen(this.j, 0);
            }

        }
    }

    public void start() {
    }

    public void stop() {
    }

    public void resume() {
        if (this.n != null) {
            this.n.resumeARCore();
        }

        this.f.b(false);
        if (this.v != null) {
            this.v.b();
        }

        this.g();
        this.nativeRestartActivityIndicator();
        GoogleVrProxy var1;
        if ((var1 = GoogleVrApi.b()) != null) {
            var1.b();
        }

    }

    public void lowMemory() {
        if (com.unity3d.player.n.c()) {
            this.b(new Runnable() {
                public final void run() {
                    UnityPlayer.this.nativeLowMemory();
                }
            });
        }
    }

    private void f() {
        this.u = true;
        this.nativeDone();
        this.f.c(false);
    }

    private void g() {
        if (this.f.f()) {
            this.f.d(true);
            this.b(new Runnable() {
                public final void run() {
                    UnityPlayer.this.nativeResume();
                }
            });
            this.a.b();
        }
    }

    protected boolean skipPermissionsDialog() {
        return com.unity3d.player.j.c && currentActivity != null ? com.unity3d.player.j.d.a(currentActivity) : false;
    }

    protected void requestUserAuthorization(String var1) {
        if (com.unity3d.player.j.c && var1 != null && !var1.isEmpty() && currentActivity != null) {
            com.unity3d.player.j.d.a(currentActivity, var1);
        }

    }

    public void configurationChanged(Configuration var1) {
        if (this.r instanceof SurfaceView) {
            this.r.getHolder().setSizeFromLayout();
        }

        if (this.v != null) {
            this.v.c();
        }

        GoogleVrProxy var2;
        if ((var2 = GoogleVrApi.b()) != null) {
            var2.c();
        }

    }

    public void windowFocusChanged(boolean var1) {
        this.f.a(var1);
        if (this.f.e()) {
            if (var1 && this.b != null) {
                this.nativeSoftInputLostFocus();
                this.reportSoftInputStr((String)null, 1, false);
            }

            if (var1) {
                this.a.c();
            } else {
                this.a.d();
            }

            this.g();
        }
    }

    protected static boolean loadLibraryStatic(String var0) {
        try {
            System.loadLibrary(var0);
            return true;
        } catch (UnsatisfiedLinkError var1) {
            com.unity3d.player.g.Log(6, "Unable to find " + var0);
            return false;
        } catch (Exception var2) {
            com.unity3d.player.g.Log(6, "Unknown error " + var2);
            return false;
        }
    }

    protected boolean loadLibrary(String var1) {
        return loadLibraryStatic(var1);
    }

    protected void addPhoneCallListener() {
        this.i = true;
        this.k.listen(this.j, 32);
    }

    private final native void initJni(Context var1);

    private final native boolean nativeRender();

    private final native void nativeSetInputString(String var1);

    private final native void nativeSetInputSelection(int var1, int var2);

    private final native void nativeSoftInputCanceled();

    private final native void nativeSoftInputLostFocus();

    private final native boolean nativePause();

    private final native void nativeResume();

    private final native void nativeLowMemory();

    private final native void nativeFocusChanged(boolean var1);

    private final native void nativeRecreateGfxState(int var1, Surface var2);

    private final native void nativeSendSurfaceChangedEvent();

    private final native void nativeDone();

    private final native void nativeSoftInputClosed();

    private final native void nativeInitWebRequest(Class var1);

    private final native boolean nativeInjectEvent(InputEvent var1);

    private final native boolean nativeIsAutorotationOn();

    private final native void nativeMuteMasterAudio(boolean var1);

    private final native void nativeRestartActivityIndicator();

    private static void a(ApplicationInfo var0) {
        if (s && NativeLoader.load(var0.nativeLibraryDir)) {
            com.unity3d.player.n.a();
        }

    }

    private static void h() {
        if (com.unity3d.player.n.c()) {
            if (!NativeLoader.unload()) {
                throw new UnsatisfiedLinkError("Unable to unload libraries from libmain.so");
            } else {
                com.unity3d.player.n.b();
            }
        }
    }

    protected void showSoftInput(final String var1, final int var2, final boolean var3, final boolean var4, final boolean var5, final boolean var6, final String var7, final int var8) {
        this.a(new Runnable() {
            public final void run() {
                UnityPlayer.this.b = new k(UnityPlayer.this.q, UnityPlayer.this, var1, var2, var3, var4, var5, var7, var8);
                UnityPlayer.this.b.show();
            }
        });
    }

    protected void hideSoftInput() {
        final Runnable var1 = new Runnable() {
            public final void run() {
                if (UnityPlayer.this.b != null) {
                    UnityPlayer.this.b.dismiss();
                    UnityPlayer.this.b = null;
                }

            }
        };
        if (com.unity3d.player.j.b) {
            this.a(new UnityPlayer.f() {
                public final void a() {
                    UnityPlayer.this.a(var1);
                }
            });
        } else {
            this.a(var1);
        }
    }

    protected void setSoftInputStr(final String var1) {
        this.a(new Runnable() {
            public final void run() {
                if (UnityPlayer.this.b != null && var1 != null) {
                    UnityPlayer.this.b.a(var1);
                }

            }
        });
    }

    protected void setCharacterLimit(final int var1) {
        this.a(new Runnable() {
            public final void run() {
                if (UnityPlayer.this.b != null) {
                    UnityPlayer.this.b.a(var1);
                }

            }
        });
    }

    protected void setSelection(final int var1, final int var2) {
        this.a(new Runnable() {
            public final void run() {
                if (UnityPlayer.this.b != null) {
                    UnityPlayer.this.b.a(var1, var2);
                }

            }
        });
    }

    protected void reportSoftInputStr(final String var1, final int var2, final boolean var3) {
        if (var2 == 1) {
            this.hideSoftInput();
        }

        this.a(new UnityPlayer.f() {
            public final void a() {
                if (var3) {
                    UnityPlayer.this.nativeSoftInputCanceled();
                } else if (var1 != null) {
                    UnityPlayer.this.nativeSetInputString(var1);
                }

                if (var2 == 1) {
                    UnityPlayer.this.nativeSoftInputClosed();
                }

            }
        });
    }

    protected void reportSoftInputSelection(final int var1, final int var2) {
        this.a(new UnityPlayer.f() {
            public final void a() {
                UnityPlayer.this.nativeSetInputSelection(var1, var2);
            }
        });
    }

    protected void setClipboardText(String var1) {
        ClipData var2 = ClipData.newPlainText("Text", var1);
        this.l.setPrimaryClip(var2);
    }

    protected String getClipboardText() {
        String var1 = "";
        ClipData var2;
        if ((var2 = this.l.getPrimaryClip()) != null) {
            var1 = var2.getItemAt(0).coerceToText(this.q).toString();
        }

        return var1;
    }

    protected boolean initializeGoogleAr() {
        if (this.n == null && currentActivity != null && this.k()) {
            this.n = new GoogleARCoreApi();
            this.n.initializeARCore(currentActivity);
            if (!this.f.d()) {
                this.n.resumeARCore();
            }
        }

        return false;
    }

    protected boolean initializeGoogleVr() {
        final GoogleVrProxy var1;
        if ((var1 = GoogleVrApi.b()) == null) {
            GoogleVrApi.a(this);
            if ((var1 = GoogleVrApi.b()) == null) {
                com.unity3d.player.g.Log(6, "Unable to create Google VR subsystem.");
                return false;
            }
        }

        final Semaphore var3 = new Semaphore(0);
        final Runnable var4 = new Runnable() {
            public final void run() {
                UnityPlayer.this.injectEvent(new KeyEvent(0, 4));
                UnityPlayer.this.injectEvent(new KeyEvent(1, 4));
            }
        };
        this.a(new Runnable() {
            public final void run() {
                if (!var1.a(UnityPlayer.currentActivity, UnityPlayer.this.q, UnityPlayer.this.b(), var4)) {
                    com.unity3d.player.g.Log(6, "Unable to initialize Google VR subsystem.");
                }

                if (UnityPlayer.currentActivity != null) {
                    var1.a(UnityPlayer.currentActivity.getIntent());
                }

                var3.release();
            }
        });

        try {
            if (!var3.tryAcquire(4L, TimeUnit.SECONDS)) {
                com.unity3d.player.g.Log(5, "Timeout while trying to initialize Google VR.");
                return false;
            }
        } catch (InterruptedException var5) {
            com.unity3d.player.g.Log(5, "UI thread was interrupted while initializing Google VR. " + var5.getLocalizedMessage());
            return false;
        }

        return var1.a();
    }

    protected boolean showVideoPlayer(String var1, int var2, int var3, int var4, boolean var5, int var6, int var7) {
        if (this.v == null) {
            this.v = new q(this);
        }

        boolean var8;
        if (var8 = this.v.a(this.q, var1, var2, var3, var4, var5, (long)var6, (long)var7, new com.unity3d.player.q.a() {
            public final void a() {
                UnityPlayer.t(UnityPlayer.this);
            }
        })) {
            this.a(new Runnable() {
                public final void run() {
                    if (UnityPlayer.this.nativeIsAutorotationOn() && UnityPlayer.this.q instanceof Activity) {
                        ((Activity)UnityPlayer.this.q).setRequestedOrientation(UnityPlayer.this.c);
                    }

                }
            });
        }

        return var8;
    }

    private ApplicationInfo i() {
        return this.q.getPackageManager().getApplicationInfo(this.q.getPackageName(), 128);
    }

    private boolean j() {
        try {
            return this.i().metaData.getBoolean("unity.splash-enable");
        } catch (Exception var1) {
            return false;
        }
    }

    private boolean k() {
        try {
            return this.i().metaData.getBoolean("unity.tango-enable");
        } catch (Exception var1) {
            return false;
        }
    }

    protected int getSplashMode() {
        try {
            return this.i().metaData.getInt("unity.splash-mode");
        } catch (Exception var1) {
            return 0;
        }
    }

    protected void executeGLThreadJobs() {
        Runnable var1;
        while((var1 = (Runnable)this.g.poll()) != null) {
            var1.run();
        }

    }

    protected void disableLogger() {
        com.unity3d.player.g.a = true;
    }

    private void b(Runnable var1) {
        if (com.unity3d.player.n.c()) {
            if (Thread.currentThread() == this.a) {
                var1.run();
            } else {
                this.g.add(var1);
            }
        }
    }

    private void a(UnityPlayer.f var1) {
        if (!this.isFinishing()) {
            this.b((Runnable)var1);
        }
    }

    protected boolean isFinishing() {
        return this.t || (this.t = this.q instanceof Activity && ((Activity)this.q).isFinishing());
    }

    private void l() {
        if (this.q instanceof Activity) {
            ((Activity)this.q).getWindow().setFlags(1024, 1024);
        }

    }

    public boolean injectEvent(InputEvent var1) {
        return !com.unity3d.player.n.c() ? false : this.nativeInjectEvent(var1);
    }

    public boolean onKeyUp(int var1, KeyEvent var2) {
        return this.injectEvent(var2);
    }

    public boolean onKeyDown(int var1, KeyEvent var2) {
        return this.injectEvent(var2);
    }

    public boolean onKeyMultiple(int var1, int var2, KeyEvent var3) {
        return this.injectEvent(var3);
    }

    public boolean onKeyLongPress(int var1, KeyEvent var2) {
        return this.injectEvent(var2);
    }

    public boolean onTouchEvent(MotionEvent var1) {
        return this.injectEvent(var1);
    }

    public boolean onGenericMotionEvent(MotionEvent var1) {
        return this.injectEvent(var1);
    }

    private void a(View var1, View var2) {
        boolean var4 = false;
        if (!this.f.d()) {
            this.pause();
            var4 = true;
        }

        ViewParent var3;
        if (var1 != null && (!((var3 = var1.getParent()) instanceof UnityPlayer) || (UnityPlayer)var3 != this)) {
            if (var3 instanceof ViewGroup) {
                ((ViewGroup)var3).removeView(var1);
            }

            this.addView(var1);
            this.bringChildToFront(var1);
            var1.setVisibility(0);
        }

        if (var2 != null && var2.getParent() == this) {
            var2.setVisibility(8);
            this.removeView(var2);
        }

        if (var4) {
            this.resume();
        }

    }

    public boolean addViewToPlayer(View var1, boolean var2) {
        this.a((View)var1, (View)(var2 ? this.r : null));
        boolean var5 = var1.getParent() == this;
        var2 = var2 && this.r.getParent() == null;
        boolean var3 = this.r.getParent() == this;
        boolean var4;
        if (!(var4 = var5 && (var2 || var3))) {
            if (!var5) {
                com.unity3d.player.g.Log(6, "addViewToPlayer: Failure adding view to hierarchy");
            }

            if (!var2 && !var3) {
                com.unity3d.player.g.Log(6, "addViewToPlayer: Failure removing old view from hierarchy");
            }
        }

        return var4;
    }

    public void removeViewFromPlayer(View var1) {
        this.a((View)this.r, (View)var1);
        boolean var3 = var1.getParent() == null;
        boolean var2 = this.r.getParent() == this;
        if (!var3 || !var2) {
            if (!var3) {
                com.unity3d.player.g.Log(6, "removeViewFromPlayer: Failure removing view from hierarchy");
            }

            if (!var2) {
                com.unity3d.player.g.Log(6, "removeVireFromPlayer: Failure agging old view to hierarchy");
            }
        }

    }

    public void reportError(String var1, String var2) {
        StringBuilder var3;
        (var3 = new StringBuilder()).append(var1);
        var3.append(": ");
        var3.append(var2);
        com.unity3d.player.g.Log(6, var3.toString());
    }

    static {
        (new m()).a();
        s = false;
        s = loadLibraryStatic("main");
    }

    private abstract class f implements Runnable {
        private f() {
        }

        public final void run() {
            if (!UnityPlayer.this.isFinishing()) {
                this.a();
            }

        }

        public abstract void a();
    }

    class a implements SensorEventListener {
        a() {
        }

        public final void onAccuracyChanged(Sensor var1, int var2) {
        }

        public final void onSensorChanged(SensorEvent var1) {
        }
    }

    private class c extends PhoneStateListener {
        private c() {
        }

        public final void onCallStateChanged(int var1, String var2) {
            UnityPlayer.this.nativeMuteMasterAudio(var1 == 1);
        }
    }

    private class e extends Thread {
        Handler a;
        boolean b;
        boolean c;
        int d;
        int e;

        private e() {
            this.b = false;
            this.c = false;
            this.d = UnityPlayer.b.b;
            this.e = 5;
        }

        public final void run() {
            this.setName("UnityMain");
            Looper.prepare();
            this.a = new Handler(new android.os.Handler.Callback() {
                private void a() {
                    if (e.this.d == UnityPlayer.b.c && e.this.c) {
                        UnityPlayer.this.nativeFocusChanged(true);
                        e.this.d = UnityPlayer.b.a;
                    }

                }

                public final boolean handleMessage(Message var1) {
                    if (var1.what != 2269) {
                        return false;
                    } else {
                        UnityPlayer.d var2;
                        if ((var2 = (UnityPlayer.d)var1.obj) == UnityPlayer.d.h) {
                            return true;
                        } else {
                            if (var2 == UnityPlayer.d.c) {
                                Looper.myLooper().quit();
                            } else if (var2 == UnityPlayer.d.b) {
                                e.this.b = true;
                            } else if (var2 == UnityPlayer.d.a) {
                                e.this.b = false;
                            } else if (var2 == UnityPlayer.d.d) {
                                e.this.c = false;
                            } else if (var2 == UnityPlayer.d.e) {
                                e.this.c = true;
                                this.a();
                            } else if (var2 == UnityPlayer.d.f) {
                                if (e.this.d == UnityPlayer.b.a) {
                                    UnityPlayer.this.nativeFocusChanged(false);
                                }

                                e.this.d = UnityPlayer.b.b;
                            } else if (var2 == UnityPlayer.d.g) {
                                e.this.d = UnityPlayer.b.c;
                                this.a();
                            }

                            return true;
                        }
                    }
                }
            });
            Looper.myQueue().addIdleHandler(new IdleHandler() {
                public final boolean queueIdle() {
                    UnityPlayer.this.executeGLThreadJobs();
                    if (!e.this.b) {
                        return true;
                    } else if (!e.this.c) {
                        return true;
                    } else {
                        if (e.this.e >= 0) {
                            if (e.this.e == 0 && UnityPlayer.this.j()) {
                                UnityPlayer.this.a();
                            }

                            --e.this.e;
                        }

                        if (!UnityPlayer.this.isFinishing() && !UnityPlayer.this.nativeRender()) {
                            UnityPlayer.this.d();
                        }

                        Message.obtain(e.this.a, 2269, UnityPlayer.d.h).sendToTarget();
                        return true;
                    }
                }
            });
            Looper.loop();
        }

        public final void a() {
            this.a(UnityPlayer.d.c);
        }

        public final void b() {
            this.a(UnityPlayer.d.b);
        }

        public final void a(Runnable var1) {
            if (this.a != null) {
                this.a(UnityPlayer.d.a);
                Message.obtain(this.a, var1).sendToTarget();
            }
        }

        public final void c() {
            this.a(UnityPlayer.d.g);
        }

        public final void d() {
            this.a(UnityPlayer.d.f);
        }

        public final void b(Runnable var1) {
            if (this.a != null) {
                this.a(UnityPlayer.d.d);
                Message.obtain(this.a, var1).sendToTarget();
            }
        }

        public final void c(Runnable var1) {
            if (this.a != null) {
                Message.obtain(this.a, var1).sendToTarget();
                this.a(UnityPlayer.d.e);
            }
        }

        public final void d(Runnable var1) {
            if (this.a != null) {
                Message.obtain(this.a, var1).sendToTarget();
            }

        }

        private void a(UnityPlayer.d var1) {
            if (this.a != null) {
                Message.obtain(this.a, 2269, var1).sendToTarget();
            }

        }
    }

    static enum b {
        a = 1,
        b = 2,
        c = 3;

        static {
            d = new int[]{a, b, c};
        }
    }

    static enum d {
        a,
        b,
        c,
        d,
        e,
        f,
        g,
        h;

        private d() {
        }
    }
}

 

posted @ 2020-02-16 23:46  胸前小红花  阅读(2415)  评论(0)    收藏  举报