秀色约会私密间.apk(点击下载) / k.java


package com.amap.api.col.p0003nsl;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.location.Location;
import android.opengl.EGL14;
import android.opengl.EGLContext;
import android.opengl.GLES20;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import com.amap.api.col.p0003nsl.cr;
import com.amap.api.col.p0003nsl.ec;
import com.amap.api.col.p0003nsl.j;
import com.amap.api.col.p0003nsl.lk;
import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CustomRenderer;
import com.amap.api.maps.InfoWindowAnimationManager;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.MapsInitializer;
import com.amap.api.maps.Projection;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.interfaces.IGlOverlayLayer;
import com.amap.api.maps.model.AMapCameraInfo;
import com.amap.api.maps.model.AMapGestureListener;
import com.amap.api.maps.model.Arc;
import com.amap.api.maps.model.ArcOptions;
import com.amap.api.maps.model.BaseOptions;
import com.amap.api.maps.model.BaseOverlay;
import com.amap.api.maps.model.BuildingOverlay;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.Circle;
import com.amap.api.maps.model.CircleOptions;
import com.amap.api.maps.model.CrossOverlay;
import com.amap.api.maps.model.CrossOverlayOptions;
import com.amap.api.maps.model.CustomMapStyleOptions;
import com.amap.api.maps.model.GL3DModel;
import com.amap.api.maps.model.GL3DModelOptions;
import com.amap.api.maps.model.GroundOverlay;
import com.amap.api.maps.model.GroundOverlayOptions;
import com.amap.api.maps.model.HeatMapLayer;
import com.amap.api.maps.model.HeatMapLayerOptions;
import com.amap.api.maps.model.HeatmapTileProvider;
import com.amap.api.maps.model.IndoorBuildingInfo;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.LatLngBounds;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.maps.model.MultiPointItem;
import com.amap.api.maps.model.MultiPointOverlay;
import com.amap.api.maps.model.MultiPointOverlayOptions;
import com.amap.api.maps.model.MyLocationStyle;
import com.amap.api.maps.model.MyTrafficStyle;
import com.amap.api.maps.model.NavigateArrow;
import com.amap.api.maps.model.NavigateArrowOptions;
import com.amap.api.maps.model.Poi;
import com.amap.api.maps.model.Polygon;
import com.amap.api.maps.model.PolygonOptions;
import com.amap.api.maps.model.Polyline;
import com.amap.api.maps.model.PolylineOptions;
import com.amap.api.maps.model.RouteOverlay;
import com.amap.api.maps.model.Text;
import com.amap.api.maps.model.TextOptions;
import com.amap.api.maps.model.TileOverlay;
import com.amap.api.maps.model.TileOverlayOptions;
import com.amap.api.maps.model.TileProvider;
import com.amap.api.maps.model.particle.ParticleOverlay;
import com.amap.api.maps.model.particle.ParticleOverlayOptions;
import com.autonavi.amap.api.mapcore.IGLMapState;
import com.autonavi.amap.mapcore.AbstractCameraUpdateMessage;
import com.autonavi.amap.mapcore.DPoint;
import com.autonavi.amap.mapcore.IPoint;
import com.autonavi.amap.mapcore.VirtualEarthProjection;
import com.autonavi.base.ae.gmap.GLMapEngine;
import com.autonavi.base.ae.gmap.GLMapRender;
import com.autonavi.base.ae.gmap.GLMapState;
import com.autonavi.base.ae.gmap.bean.NativeTextGenerate;
import com.autonavi.base.ae.gmap.gesture.EAMapPlatformGestureInfo;
import com.autonavi.base.ae.gmap.glinterface.MapLabelItem;
import com.autonavi.base.ae.gmap.gloverlay.BaseMapOverlay;
import com.autonavi.base.ae.gmap.gloverlay.CrossVectorOverlay;
import com.autonavi.base.ae.gmap.gloverlay.GLOverlayBundle;
import com.autonavi.base.ae.gmap.gloverlay.GLTextureProperty;
import com.autonavi.base.ae.gmap.listener.AMapWidgetListener;
import com.autonavi.base.ae.gmap.style.StyleItem;
import com.autonavi.base.amap.api.mapcore.BaseOverlayImp;
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
import com.autonavi.base.amap.api.mapcore.IGLSurfaceView;
import com.autonavi.base.amap.api.mapcore.IProjectionDelegate;
import com.autonavi.base.amap.api.mapcore.IUiSettingsDelegate;
import com.autonavi.base.amap.mapcore.AeUtil;
import com.autonavi.base.amap.mapcore.FPoint;
import com.autonavi.base.amap.mapcore.FileUtil;
import com.autonavi.base.amap.mapcore.MapConfig;
import com.autonavi.base.amap.mapcore.Rectangle;
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
import com.autonavi.base.amap.mapcore.message.AbstractGestureMapMessage;
import com.autonavi.base.amap.mapcore.tools.GLConvertUtil;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

/* renamed from: com.amap.api.col.3nsl.k  reason: invalid package */
/* compiled from: AMapDelegateImp */
public final class k implements cr.a, j.a, IAMapDelegate, IAMapListener {
    private final ad A;
    private boolean B;
    private final IGLSurfaceView C;
    private ef D;
    private final IGlOverlayLayer E;
    private boolean F;
    private int G;
    private boolean H;
    private boolean I;
    private boolean J;
    private boolean K;
    private ci L;
    private LocationSource M;
    private boolean N;
    private Marker O;
    private BaseOverlayImp P;
    private Marker Q;
    private boolean R;
    private boolean S;
    private boolean T;
    private boolean U;
    private boolean V;
    private boolean W;
    private Rect X;
    private int Y;
    private MyTrafficStyle Z;
    protected boolean a;
    private Lock aA;
    private int aB;
    private int aC;
    private int aD;
    private b aE;
    private cn aF;
    private AMap.OnMultiPointClickListener aG;
    private j aH;
    private long aI;
    private a aJ;
    private a aK;
    private a aL;
    private a aM;
    private a aN;
    private a aO;
    private a aP;
    private a aQ;
    private a aR;
    private a aS;
    private a aT;
    private a aU;
    private Runnable aV;
    private a aW;
    private com.autonavi.extra.b aX;
    private String aY;
    private String aZ;
    private Thread aa;
    private Thread ab;
    private boolean ac;
    private boolean ad;
    private boolean ae;
    private int af;
    private CustomRenderer ag;
    private int ah;
    private int ai;
    private List<z> aj;
    private cp ak;
    private cr al;
    private long am;
    private GLMapRender an;
    private w ao;
    private boolean ap;
    private float aq;
    private float ar;
    private float as;
    private boolean at;
    private boolean au;
    private boolean av;
    private volatile boolean aw;
    private volatile boolean ax;
    private boolean ay;
    private boolean az;
    protected MapConfig b;
    private boolean ba;
    private boolean bb;
    private int bc;
    private EAMapPlatformGestureInfo bd;
    private long be;
    private ar bf;
    private IPoint[] bg;
    protected ar c;
    dl d;
    protected Context e;
    protected GLMapEngine f;
    public int g;
    public int h;
    boolean i;
    protected final Handler j;
    Point k;
    Rect l;
    protected String m;
    float[] n;
    float[] o;
    float[] p;
    float[] q;
    String r;
    String s;
    int t;
    private o u;
    private p v;
    private AMapGestureListener w;
    private as x;
    private UiSettings y;
    private IProjectionDelegate z;

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final RouteOverlay addNaviRouteOverlay() {
        return null;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final AMapCameraInfo getCamerInfo() {
        return null;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final InfoWindowAnimationManager getInfoWindowAnimationManager() {
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean isLockMapCameraDegree(int i2) {
        return false;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void reloadMap() {
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMaskLayerParams(int i2, int i3, int i4, int i5, int i6, long j2) {
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setZOrderOnTop(boolean z2) throws RemoteException {
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setMapWidgetListener(AMapWidgetListener aMapWidgetListener) {
        try {
            if (this.v != null) {
                this.v.a(AMapWidgetListener.class.hashCode(), aMapWidgetListener);
            }
        } catch (Throwable unused) {
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void b(CameraPosition cameraPosition) {
        if (this.b.getMapLanguage().equals("en")) {
            boolean c2 = c(cameraPosition);
            if (c2 != this.W) {
                this.W = c2;
                b(1, c2);
            }
        } else if (!this.W) {
            this.W = true;
            b(1, true);
        }
    }

    private boolean c(CameraPosition cameraPosition) {
        if (cameraPosition.zoom < 6.0f) {
            return false;
        }
        if (cameraPosition.isAbroad) {
            return true;
        }
        MapConfig mapConfig = this.b;
        if (mapConfig == null) {
            return false;
        }
        try {
            return !dn.a(mapConfig.getGeoRectangle().getClipRect());
        } catch (Throwable th) {
            th.printStackTrace();
            du.a(th);
            return false;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setVisibilityEx(int i2) {
        IGLSurfaceView iGLSurfaceView = this.C;
        if (iGLSurfaceView != null) {
            try {
                iGLSurfaceView.setVisibility(i2);
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onActivityPause() {
        this.I = true;
        b(this.G);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onActivityResume() {
        this.I = false;
        int i2 = this.G;
        if (i2 == 0) {
            i2 = this.f.getEngineIDWithType(0);
        }
        c(i2);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void queueEvent(Runnable runnable) {
        long j2;
        try {
            j2 = Thread.currentThread().getId();
        } catch (Throwable th) {
            du.a(th);
            mk.c(th, "AMapdelegateImp", "queueEvent");
            return;
        }
        if (j2 != -1 && j2 == this.am) {
            runnable.run();
        } else if (this.f != null) {
            this.C.queueEvent(runnable);
        }
    }

    /* access modifiers changed from: private */
    /* renamed from: com.amap.api.col.3nsl.k$a */
    /* compiled from: AMapDelegateImp */
    public static abstract class a implements Runnable {
        boolean b;
        boolean c;
        int d;
        int e;
        int f;
        int g;
        int h;
        int i;
        byte[] j;

        private a() {
            this.b = false;
            this.c = false;
            this.h = 0;
            this.i = 0;
        }

        /* synthetic */ a(byte b2) {
            this();
        }

        public void run() {
            this.b = false;
        }
    }

    public k(IGLSurfaceView iGLSurfaceView, Context context) {
        this(iGLSurfaceView, context, false);
    }

    public k(IGLSurfaceView iGLSurfaceView, Context context, boolean z2) {
        this.u = null;
        this.v = new p();
        this.a = false;
        this.B = false;
        this.F = false;
        this.H = false;
        this.I = false;
        this.b = new MapConfig(true);
        this.J = false;
        this.K = false;
        this.N = false;
        this.O = null;
        this.P = null;
        this.Q = null;
        this.R = false;
        this.S = false;
        this.T = false;
        this.U = false;
        this.V = false;
        this.W = true;
        this.X = new Rect();
        this.Y = 1;
        this.Z = null;
        this.ac = false;
        this.ad = false;
        this.ae = false;
        this.af = 0;
        this.ah = -1;
        this.ai = -1;
        this.aj = new ArrayList();
        this.d = null;
        this.am = -1;
        this.ap = false;
        this.aq = 0.0f;
        this.ar = 1.0f;
        this.as = 1.0f;
        this.at = true;
        this.au = false;
        this.av = false;
        this.aw = false;
        this.ax = false;
        this.ay = false;
        this.az = false;
        this.aA = new ReentrantLock();
        this.aB = 0;
        this.i = true;
        this.j = new Handler(Looper.getMainLooper()) {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass1 */

            public final void handleMessage(Message message) {
                if (message != null && !k.this.H) {
                    try {
                        int i = message.what;
                        if (i != 2) {
                            int i2 = 0;
                            switch (i) {
                                case 10:
                                    CameraPosition cameraPosition = (CameraPosition) message.obj;
                                    try {
                                        List<AMap.OnCameraChangeListener> a2 = k.this.v.a(AMap.OnCameraChangeListener.class.hashCode());
                                        if (!(cameraPosition == null || a2 == null || a2.size() <= 0)) {
                                            synchronized (a2) {
                                                for (AMap.OnCameraChangeListener onCameraChangeListener : a2) {
                                                    onCameraChangeListener.onCameraChange(cameraPosition);
                                                }
                                            }
                                        }
                                    } catch (Throwable th) {
                                        du.a(th);
                                    }
                                    k.this.b.addChangedCounter();
                                    return;
                                case 11:
                                    try {
                                        CameraPosition cameraPosition2 = k.this.getCameraPosition();
                                        if (!(cameraPosition2 == null || k.this.D == null)) {
                                            k.this.D.a(cameraPosition2);
                                        }
                                        k.this.b((k) cameraPosition2);
                                        if (k.this.av) {
                                            k.this.av = false;
                                            if (k.this.E != null) {
                                                k.this.E.setFlingState(false);
                                            }
                                            k.this.b();
                                        }
                                        if (k.this.U) {
                                            k.this.redrawInfoWindow();
                                            k.this.U = false;
                                        }
                                        k.this.a(cameraPosition2);
                                        return;
                                    } catch (Throwable th2) {
                                        mk.c(th2, "AMapDelegateImp", "CameraUpdateFinish");
                                        du.a(th2);
                                        return;
                                    }
                                case 12:
                                    if (k.this.D != null) {
                                        k.this.D.a(Float.valueOf(k.this.getZoomLevel()));
                                        return;
                                    }
                                    return;
                                case 13:
                                    if (k.this.D != null) {
                                        k.this.D.h();
                                        return;
                                    }
                                    return;
                                case 14:
                                    try {
                                        List<AMap.OnMapTouchListener> a3 = k.this.v.a(AMap.OnMapTouchListener.class.hashCode());
                                        if (a3 != null && a3.size() > 0) {
                                            synchronized (a3) {
                                                for (AMap.OnMapTouchListener onMapTouchListener : a3) {
                                                    onMapTouchListener.onTouch((MotionEvent) message.obj);
                                                }
                                            }
                                            return;
                                        }
                                        return;
                                    } catch (Throwable th3) {
                                        mk.c(th3, "AMapDelegateImp", "onTouchHandler");
                                        th3.printStackTrace();
                                        return;
                                    }
                                case 15:
                                    Bitmap bitmap = (Bitmap) message.obj;
                                    int i3 = message.arg1;
                                    ArrayList arrayList = null;
                                    if (bitmap == null || k.this.D == null) {
                                        try {
                                            List a4 = k.this.v.a(AMap.onMapPrintScreenListener.class.hashCode());
                                            ArrayList arrayList2 = a4 != null ? new ArrayList(a4) : null;
                                            List a5 = k.this.v.a(AMap.OnMapScreenShotListener.class.hashCode());
                                            ArrayList arrayList3 = a5 != null ? new ArrayList(a5) : null;
                                            k.this.v.a(Integer.valueOf(AMap.onMapPrintScreenListener.class.hashCode()));
                                            k.this.v.a(Integer.valueOf(AMap.OnMapScreenShotListener.class.hashCode()));
                                            if (arrayList2 != null && arrayList2.size() > 0) {
                                                synchronized (arrayList2) {
                                                    for (int i4 = 0; i4 < arrayList2.size(); i4++) {
                                                        ((AMap.onMapPrintScreenListener) arrayList2.get(i4)).onMapPrint(null);
                                                    }
                                                }
                                            }
                                            if (arrayList3 != null && arrayList3.size() > 0) {
                                                synchronized (arrayList3) {
                                                    while (i2 < arrayList3.size()) {
                                                        ((AMap.OnMapScreenShotListener) arrayList3.get(i2)).onMapScreenShot(null);
                                                        ((AMap.OnMapScreenShotListener) arrayList3.get(i2)).onMapScreenShot(null, i3);
                                                        i2++;
                                                    }
                                                }
                                                return;
                                            }
                                            return;
                                        } catch (Throwable th4) {
                                            th4.printStackTrace();
                                            return;
                                        }
                                    } else {
                                        Canvas canvas = new Canvas(bitmap);
                                        ei f = k.this.D.f();
                                        if (f != null) {
                                            f.onDraw(canvas);
                                        }
                                        k.this.D.a(canvas);
                                        try {
                                            List a6 = k.this.v.a(AMap.onMapPrintScreenListener.class.hashCode());
                                            ArrayList arrayList4 = a6 != null ? new ArrayList(a6) : null;
                                            List a7 = k.this.v.a(AMap.OnMapScreenShotListener.class.hashCode());
                                            if (a7 != null) {
                                                arrayList = new ArrayList(a7);
                                            }
                                            k.this.v.a(Integer.valueOf(AMap.onMapPrintScreenListener.class.hashCode()));
                                            k.this.v.a(Integer.valueOf(AMap.OnMapScreenShotListener.class.hashCode()));
                                            if (arrayList4 != null && arrayList4.size() > 0) {
                                                synchronized (arrayList4) {
                                                    for (int i5 = 0; i5 < arrayList4.size(); i5++) {
                                                        ((AMap.onMapPrintScreenListener) arrayList4.get(i5)).onMapPrint(new BitmapDrawable(k.this.e.getResources(), bitmap));
                                                    }
                                                }
                                            }
                                            if (arrayList != null && arrayList.size() > 0) {
                                                synchronized (arrayList) {
                                                    while (i2 < arrayList.size()) {
                                                        ((AMap.OnMapScreenShotListener) arrayList.get(i2)).onMapScreenShot(bitmap);
                                                        ((AMap.OnMapScreenShotListener) arrayList.get(i2)).onMapScreenShot(bitmap, i3);
                                                        i2++;
                                                    }
                                                }
                                                return;
                                            }
                                            return;
                                        } catch (Throwable th5) {
                                            th5.printStackTrace();
                                            return;
                                        }
                                    }
                                case 16:
                                    try {
                                        List a8 = k.this.v.a(AMap.OnMapLoadedListener.class.hashCode());
                                        if (a8 != null) {
                                            synchronized (a8) {
                                                while (i2 < a8.size()) {
                                                    ((AMap.OnMapLoadedListener) a8.get(i2)).onMapLoaded();
                                                    i2++;
                                                }
                                            }
                                        }
                                    } catch (Throwable th6) {
                                        mk.c(th6, "AMapDelegateImp", "onMapLoaded");
                                        th6.printStackTrace();
                                        du.a(th6);
                                    }
                                    if (k.this.D != null) {
                                        k.this.D.i();
                                        return;
                                    }
                                    return;
                                case 17:
                                    if (k.this.f.isInMapAnimation(1) && k.this.E != null) {
                                        k.this.E.setFlingState(false);
                                        return;
                                    }
                                    return;
                                case 18:
                                    if (k.this.x != null) {
                                        k.this.x.b();
                                        return;
                                    }
                                    return;
                                case 19:
                                    List<AMap.OnMapClickListener> a9 = k.this.v.a(AMap.OnMapClickListener.class.hashCode());
                                    if (a9 != null) {
                                        DPoint obtain = DPoint.obtain();
                                        k.this.getPixel2LatLng(message.arg1, message.arg2, obtain);
                                        try {
                                            synchronized (a9) {
                                                for (AMap.OnMapClickListener onMapClickListener : a9) {
                                                    onMapClickListener.onMapClick(new LatLng(obtain.y, obtain.x));
                                                }
                                            }
                                            obtain.recycle();
                                            return;
                                        } catch (Throwable th7) {
                                            mk.c(th7, "AMapDelegateImp", "OnMapClickListener.onMapClick");
                                            th7.printStackTrace();
                                            return;
                                        }
                                    } else {
                                        return;
                                    }
                                case 20:
                                    try {
                                        List a10 = k.this.v.a(AMap.OnPOIClickListener.class.hashCode());
                                        if (a10 != null && a10.size() > 0) {
                                            synchronized (a10) {
                                                while (i2 < a10.size()) {
                                                    ((AMap.OnPOIClickListener) a10.get(i2)).onPOIClick((Poi) message.obj);
                                                    i2++;
                                                }
                                            }
                                            return;
                                        }
                                        return;
                                    } catch (Throwable th8) {
                                        mk.c(th8, "AMapDelegateImp", "OnPOIClickListener.onPOIClick");
                                        th8.printStackTrace();
                                        return;
                                    }
                                default:
                                    return;
                            }
                        } else {
                            StringBuilder sb = new StringBuilder();
                            sb.append("Key验证失败:[");
                            if (message.obj != null) {
                                sb.append(message.obj);
                            } else {
                                sb.append(lc.b);
                            }
                            sb.append("]");
                        }
                    } catch (Throwable th9) {
                        mk.c(th9, "AMapDelegateImp", "handleMessage");
                        th9.printStackTrace();
                    }
                }
            }
        };
        this.aJ = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass11 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setTrafficEnabled(this.c);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aK = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass21 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setCenterToPixel(k.this.aC, k.this.aD);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aL = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass32 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                k.this.a(this.g, this.d, this.e, this.f);
            }
        };
        this.aM = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass36 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                k.this.setMapCustomEnable(this.c);
            }
        };
        this.aN = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass37 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                k.this.a(this.g, this.c);
            }
        };
        this.aO = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass38 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setMapTextEnable(this.c);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aP = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass39 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setRoadArrowEnable(this.c);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aQ = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass40 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setNaviLabelEnable(this.c, this.h, this.i);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aR = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass2 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setConstructingRoadEnable(this.c);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aS = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass3 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setTrafficStyleWithTextureData(this.j);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aT = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass4 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                k.this.b(this.g, this.c);
            }
        };
        this.aU = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass5 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                try {
                    k.this.setIndoorEnabled(this.c);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aV = new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass6 */

            public final void run() {
                ei f;
                if (k.this.D != null && (f = k.this.D.f()) != null) {
                    f.c();
                }
            }
        };
        this.aW = new a() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass7 */

            @Override // com.amap.api.col.p0003nsl.k.a
            public final void run() {
                super.run();
                k.this.c(this.g, this.c);
            }
        };
        this.aY = "";
        this.aZ = "";
        this.ba = false;
        this.bb = false;
        this.bc = 0;
        this.bd = new EAMapPlatformGestureInfo();
        this.k = new Point();
        this.l = new Rect();
        this.be = 0;
        this.m = null;
        this.bf = null;
        this.n = new float[16];
        this.o = new float[16];
        this.p = new float[16];
        this.bg = null;
        this.q = new float[12];
        this.r = "precision highp float;\nattribute vec3 aVertex;//顶点数组,三维坐标\nuniform mat4 aMVPMatrix;//mvp矩阵\nvoid main(){\n  gl_Position = aMVPMatrix * vec4(aVertex, 1.0);\n}";
        this.s = "//有颜色 没有纹理\nprecision highp float;\nvoid main(){\n  gl_FragColor = vec4(1.0,0,0,1.0);\n}";
        this.t = -1;
        this.e = context;
        ll a2 = lk.a(context, du.a());
        if (a2.a == lk.c.SuccessCode) {
            dw.a(context);
            dw.a(dv.c, "init map delegate");
        }
        com.autonavi.extra.b bVar = new com.autonavi.extra.b();
        this.aX = bVar;
        bVar.a();
        this.aX.b();
        mk.a(this.e);
        di.a().a(this.e);
        u.b = lb.c(context);
        cz.a(this.e);
        this.ao = new w(this);
        GLMapRender gLMapRender = new GLMapRender(this);
        this.an = gLMapRender;
        this.C = iGLSurfaceView;
        iGLSurfaceView.setRenderer(gLMapRender);
        this.E = new x(this, this.e);
        this.f = new GLMapEngine(this.e, this);
        this.D = new ee(this.e, this, this.E);
        this.A = new ad(this);
        this.D.a(new c(this, (byte) 0));
        this.aE = new b();
        this.C.setRenderMode(0);
        this.an.setRenderFps(15.0f);
        this.f.setMapListener(this);
        this.z = new aa(this);
        this.u = new o(this);
        as asVar = new as(this.e);
        this.x = asVar;
        asVar.a(this.D);
        this.x.b(new ck(this.E, context));
        this.aa = new s(this.e, this);
        this.M = new at(this.e);
        this.ak = new cp(this.e, this);
        cr crVar = new cr(this.e);
        this.al = crVar;
        crVar.a(this);
        a(z2);
        MapConfig mapConfig = this.b;
        j jVar = new j(this, this.e, mapConfig != null ? mapConfig.isAbroadEnable() : false);
        this.aH = jVar;
        jVar.a(this);
        if (a2.a != lk.c.SuccessCode) {
            this.b.setMapEnable(false);
        }
    }

    private void a(boolean z2) {
        com.autonavi.extra.b bVar = this.aX;
        if (bVar != null) {
            Object j2 = bVar.j();
            if (j2 != null && (j2 instanceof Boolean)) {
                MapConfig mapConfig = this.b;
                if (mapConfig != null) {
                    mapConfig.setAbroadEnable(z2 && ((Boolean) j2).booleanValue());
                }
                if (z2 && ((Boolean) j2).booleanValue()) {
                    MapsInitializer.setSupportRecycleView(false);
                }
            }
            Object j3 = this.aX.j();
            if (j3 != null && (j3 instanceof Boolean)) {
                this.D.a(((Boolean) j3).booleanValue());
            }
            Object j4 = this.aX.j();
            if (j3 != null && (j3 instanceof Integer)) {
                this.af = ((Integer) j4).intValue();
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final com.autonavi.extra.b getAMapExtraInterfaceManager() {
        return this.aX;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final IGlOverlayLayer getGlOverlayLayer() {
        return this.E;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setMapEnable(boolean z2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            mapConfig.setMapEnable(z2);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final GLMapEngine getGLMapEngine() {
        return this.f;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setGestureStatus(int i2, int i3) {
        if (this.aB == 0 || i3 != 5) {
            this.aB = i3;
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getPreciseLevel(int i2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getSZ();
        }
        return 0.0f;
    }

    private float c() {
        if (this.b != null) {
            return getMapConfig().getSZ();
        }
        return 0.0f;
    }

    private boolean a(int i2, int i3) {
        AbstractCameraUpdateMessage abstractCameraUpdateMessage;
        if (!this.aw || ((float) ((int) c())) >= this.b.getMaxZoomLevel()) {
            return false;
        }
        try {
            if (this.J || this.A.isZoomInByScreenCenter()) {
                abstractCameraUpdateMessage = ai.a(1.0f, (Point) null);
            } else {
                this.k.x = i2;
                this.k.y = i3;
                abstractCameraUpdateMessage = ai.a(1.0f, this.k);
            }
            animateCamera(abstractCameraUpdateMessage);
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "onDoubleTap");
            th.printStackTrace();
        }
        resetRenderTime();
        return true;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void zoomOut(int i2) {
        if (this.aw && ((float) ((int) c())) > this.b.getMinZoomLevel()) {
            try {
                animateCamera(ai.b());
            } catch (Throwable th) {
                mk.c(th, "AMapDelegateImp", "onDoubleTap");
                th.printStackTrace();
            }
            resetRenderTime();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean isLockMapAngle(int i2) {
        return f(i2);
    }

    private void d() {
        if (this.aw) {
            this.ao.a();
            this.ap = true;
            this.au = true;
            try {
                stopAnimation();
            } catch (RemoteException unused) {
            }
        }
    }

    private void e() {
        this.ap = true;
        this.au = false;
        if (this.S) {
            this.S = false;
        }
        if (this.R) {
            this.R = false;
        }
        if (this.T) {
            this.T = false;
        }
        try {
            if (this.N) {
                List a2 = this.v.a(AMap.OnMarkerDragListener.class.hashCode());
                if (!(a2 == null || a2.size() <= 0 || (this.O == null && this.Q == null))) {
                    synchronized (a2) {
                        for (int i2 = 0; i2 < a2.size(); i2++) {
                            ((AMap.OnMarkerDragListener) a2.get(i2)).onMarkerDragEnd(this.Q);
                        }
                    }
                    this.O = null;
                    this.Q = null;
                }
                this.N = false;
            }
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "OnMarkerDragListener.onMarkerDragEnd");
            th.printStackTrace();
        }
    }

    private void a(MotionEvent motionEvent) throws RemoteException {
        if (this.N && this.Q != null) {
            int x2 = (int) motionEvent.getX();
            int y2 = (int) (motionEvent.getY() - 60.0f);
            if (this.Q.getPosition() != null) {
                DPoint obtain = DPoint.obtain();
                getPixel2LatLng(x2, y2, obtain);
                LatLng latLng = new LatLng(obtain.y, obtain.x);
                obtain.recycle();
                this.Q.setPosition(latLng);
                try {
                    List a2 = this.v.a(AMap.OnMarkerDragListener.class.hashCode());
                    if (a2 != null && a2.size() > 0) {
                        synchronized (a2) {
                            for (int i2 = 0; i2 < a2.size(); i2++) {
                                ((AMap.OnMarkerDragListener) a2.get(i2)).onMarkerDrag(this.Q);
                            }
                        }
                    }
                } catch (Throwable unused) {
                }
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void clearTileCache() {
        this.E.clearTileCache();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final GLMapState getMapProjection() {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getMapState(1);
        }
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showMyLocationOverlay(Location location) throws RemoteException {
        if (location != null) {
            try {
                if (this.F) {
                    if (this.M != null) {
                        if (this.L == null) {
                            this.L = new ci(this, this.e);
                        }
                        if (!(location.getLongitude() == 0.0d || location.getLatitude() == 0.0d)) {
                            this.L.a(location);
                        }
                        List a2 = this.v.a(AMap.OnMyLocationChangeListener.class.hashCode());
                        if (a2 != null && a2.size() > 0) {
                            synchronized (a2) {
                                for (int i2 = 0; i2 < a2.size(); i2++) {
                                    ((AMap.OnMyLocationChangeListener) a2.get(i2)).onMyLocationChange(location);
                                }
                            }
                        }
                        resetRenderTime();
                        return;
                    }
                }
                if (this.L != null) {
                    this.L.c();
                }
                this.L = null;
            } catch (Throwable th) {
                mk.c(th, "AMapDelegateImp", "showMyLocationOverlay");
                th.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean removeGLOverlay(String str) throws RemoteException {
        resetRenderTime();
        return this.E.removeOverlay(str);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean removeGLModel(String str) {
        try {
            this.E.removeOverlay(str);
            return false;
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "removeGLModel");
            th.printStackTrace();
            return false;
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeGLOverlayIndex() {
        this.E.changeOverlayIndex();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float checkZoomLevel(float f2) throws RemoteException {
        return du.a(this.b, f2);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void latlon2Geo(double d2, double d3, IPoint iPoint) {
        Point latLongToPixels = VirtualEarthProjection.latLongToPixels(d2, d3, 20);
        iPoint.x = latLongToPixels.x;
        iPoint.y = latLongToPixels.y;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void geo2Map(int i2, int i3, FPoint fPoint) {
        double d2 = (double) i2;
        double sx = this.b.getSX();
        Double.isNaN(d2);
        fPoint.x = (float) ((int) (d2 - sx));
        double d3 = (double) i3;
        double sy = this.b.getSY();
        Double.isNaN(d3);
        fPoint.y = (float) ((int) (d3 - sy));
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void geo2Latlng(int i2, int i3, DPoint dPoint) {
        DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong((long) i2, (long) i3, 20);
        dPoint.x = pixelsToLatLong.x;
        dPoint.y = pixelsToLatLong.y;
        pixelsToLatLong.recycle();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getZoomLevel() {
        return c();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final IUiSettingsDelegate getUiSettings() {
        return this.A;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final IProjectionDelegate getProjection() throws RemoteException {
        return this.z;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final j getCustomStyleManager() {
        return this.aH;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final AMap.OnCameraChangeListener getOnCameraChangeListener() throws RemoteException {
        try {
            List a2 = this.v.a(AMap.OnCameraChangeListener.class.hashCode());
            if (a2 == null) {
                if (a2.size() != 0) {
                    return (AMap.OnCameraChangeListener) a2.get(0);
                }
            }
        } catch (Throwable unused) {
        }
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showInfoWindow(BaseOverlayImp baseOverlayImp) throws RemoteException {
        as asVar;
        if (baseOverlayImp != null && (asVar = this.x) != null) {
            try {
                asVar.a(baseOverlayImp);
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showInfoWindow(BaseOverlay baseOverlay) throws RemoteException {
        as asVar;
        if (baseOverlay != null && (asVar = this.x) != null) {
            try {
                asVar.a(baseOverlay);
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void hideInfoWindow() {
        as asVar = this.x;
        if (asVar != null) {
            asVar.c();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void getLatLng2Map(double d2, double d3, FPoint fPoint) {
        IPoint obtain = IPoint.obtain();
        latlon2Geo(d2, d3, obtain);
        geo2Map(obtain.x, obtain.y, fPoint);
        obtain.recycle();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void getPixel2LatLng(int i2, int i3, DPoint dPoint) {
        GLMapEngine gLMapEngine;
        GLMapState mapState;
        if (this.aw && (gLMapEngine = this.f) != null && (mapState = gLMapEngine.getMapState(1)) != null) {
            IPoint obtain = IPoint.obtain();
            mapState.screenToP20Point(i2, i3, obtain);
            DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong((long) obtain.x, (long) obtain.y, 20);
            dPoint.x = pixelsToLatLong.x;
            dPoint.y = pixelsToLatLong.y;
            obtain.recycle();
            pixelsToLatLong.recycle();
        }
    }

    private void a(GLMapState gLMapState, int i2, int i3, DPoint dPoint) {
        if (this.aw && this.f != null) {
            Point point = new Point();
            gLMapState.screenToP20Point(i2, i3, point);
            DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong((long) point.x, (long) point.y, 20);
            dPoint.x = pixelsToLatLong.x;
            dPoint.y = pixelsToLatLong.y;
            pixelsToLatLong.recycle();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void getLatLng2Pixel(double d2, double d3, IPoint iPoint) {
        if (this.aw && this.f != null) {
            try {
                Point latLongToPixels = VirtualEarthProjection.latLongToPixels(d2, d3, 20);
                FPoint obtain = FPoint.obtain();
                a(latLongToPixels.x, latLongToPixels.y, obtain);
                if (obtain.x == -10000.0f && obtain.y == -10000.0f) {
                    GLMapState gLMapState = (GLMapState) this.f.getNewMapState(1);
                    gLMapState.setCameraDegree(0.0f);
                    gLMapState.recalculate();
                    gLMapState.p20ToScreenPoint(latLongToPixels.x, latLongToPixels.y, obtain);
                    gLMapState.recycle();
                }
                iPoint.x = (int) obtain.x;
                iPoint.y = (int) obtain.y;
                obtain.recycle();
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void getPixel2Geo(int i2, int i3, IPoint iPoint) {
        GLMapEngine gLMapEngine;
        GLMapState mapState;
        if (this.aw && (gLMapEngine = this.f) != null && (mapState = gLMapEngine.getMapState(1)) != null) {
            mapState.screenToP20Point(i2, i3, iPoint);
        }
    }

    private void a(int i2, int i3, FPoint fPoint) {
        GLMapEngine gLMapEngine;
        GLMapState mapState;
        if (this.aw && (gLMapEngine = this.f) != null && (mapState = gLMapEngine.getMapState(1)) != null) {
            mapState.p20ToScreenPoint(i2, i3, fPoint);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void redrawInfoWindow() {
        if (this.aw) {
            this.j.sendEmptyMessage(18);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final as getInfoWindowDelegate() {
        return this.x;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showZoomControlsEnabled(boolean z2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.b(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showIndoorSwitchControlsEnabled(boolean z2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.a(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showMyLocationButtonEnabled(boolean z2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.c(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showCompassEnabled(boolean z2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.d(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showScaleEnabled(boolean z2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.e(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setZoomPosition(int i2) {
        ef efVar;
        if (!this.H && (efVar = this.D) != null) {
            efVar.a(Integer.valueOf(i2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final FPoint[] getMapRect() {
        if (this.b.getMapRect() == null) {
            this.b.setMapRect(du.a(this));
        }
        return this.b.getMapRect();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final Rect getRect() {
        return this.X;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final LatLngBounds getMapBounds(LatLng latLng, float f2, float f3, float f4) {
        int mapWidth = getMapWidth();
        int mapHeight = getMapHeight();
        if (mapWidth <= 0 || mapHeight <= 0 || this.H) {
            return null;
        }
        float a2 = du.a(this.b, f2);
        GLMapState gLMapState = new GLMapState(1, this.f.getNativeInstance());
        if (latLng != null) {
            IPoint obtain = IPoint.obtain();
            latlon2Geo(latLng.latitude, latLng.longitude, obtain);
            gLMapState.setCameraDegree(f4);
            gLMapState.setMapAngle(f3);
            gLMapState.setMapGeoCenter((double) obtain.x, (double) obtain.y);
            gLMapState.setMapZoomer(a2);
            gLMapState.recalculate();
            obtain.recycle();
        }
        DPoint obtain2 = DPoint.obtain();
        a(gLMapState, 0, 0, obtain2);
        LatLng latLng2 = new LatLng(obtain2.y, obtain2.x, false);
        a(gLMapState, mapWidth, mapHeight, obtain2);
        LatLng latLng3 = new LatLng(obtain2.y, obtain2.x, false);
        obtain2.recycle();
        gLMapState.recycle();
        return LatLngBounds.builder().include(latLng3).include(latLng2).build();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void onResume() {
        try {
            this.an.setRenderFps(15.0f);
            this.C.setRenderMode(0);
            if (this.E != null) {
                this.E.setFlingState(true);
            }
            if (this.L != null) {
                this.L.b();
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void onPause() {
        f();
        IGlOverlayLayer iGlOverlayLayer = this.E;
        if (iGlOverlayLayer != null) {
            iGlOverlayLayer.setFlingState(false);
        }
    }

    private void f() {
        GLMapState gLMapState;
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null && (gLMapState = (GLMapState) gLMapEngine.getNewMapState(1)) != null) {
            IPoint obtain = IPoint.obtain();
            gLMapState.recalculate();
            gLMapState.getMapGeoCenter(obtain);
            this.b.setSX((double) obtain.x);
            this.b.setSY((double) obtain.y);
            this.b.setSZ(gLMapState.getMapZoomer());
            this.b.setSC(gLMapState.getCameraDegree());
            this.b.setSR(gLMapState.getMapAngle());
            gLMapState.recycle();
            obtain.recycle();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean onTouchEvent(MotionEvent motionEvent) {
        if (this.I || !this.aw || !this.at) {
            return false;
        }
        this.bd.mGestureState = 3;
        this.bd.mGestureType = 8;
        EAMapPlatformGestureInfo eAMapPlatformGestureInfo = this.bd;
        eAMapPlatformGestureInfo.mLocation = new float[]{motionEvent.getX(), motionEvent.getY()};
        getEngineIDWithGestureInfo(this.bd);
        n();
        int action = motionEvent.getAction() & 255;
        if (action == 0) {
            o();
            d();
        } else if (action == 1) {
            e();
        }
        if (motionEvent.getAction() != 2 || !this.N) {
            if (this.ap) {
                try {
                    this.ao.a(motionEvent);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
            try {
                List a2 = this.v.a(AMap.OnMapTouchListener.class.hashCode());
                if (a2 != null && a2.size() > 0) {
                    this.j.removeMessages(14);
                    Message obtainMessage = this.j.obtainMessage();
                    obtainMessage.what = 14;
                    obtainMessage.obj = MotionEvent.obtain(motionEvent);
                    obtainMessage.sendToTarget();
                }
            } catch (Throwable unused) {
            }
            return true;
        }
        try {
            a(motionEvent);
        } catch (Throwable th2) {
            mk.c(th2, "AMapDelegateImp", "onDragMarker");
            th2.printStackTrace();
        }
        return true;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void pixel2Map(int i2, int i3, PointF pointF) {
        if (this.aw && !this.I && this.f != null) {
            IPoint obtain = IPoint.obtain();
            getPixel2Geo(i2, i3, obtain);
            pointF.x = ((float) obtain.x) - ((float) this.b.getSX());
            pointF.y = ((float) obtain.y) - ((float) this.b.getSY());
            obtain.recycle();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void map2Geo(float f2, float f3, IPoint iPoint) {
        double d2 = (double) f2;
        double sx = this.b.getSX();
        Double.isNaN(d2);
        iPoint.x = (int) (d2 + sx);
        double d3 = (double) f3;
        double sy = this.b.getSY();
        Double.isNaN(d3);
        iPoint.y = (int) (d3 + sy);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float toMapLenWithWin(int i2) {
        GLMapEngine gLMapEngine;
        if (!this.aw || this.I || (gLMapEngine = this.f) == null) {
            return 0.0f;
        }
        return gLMapEngine.getMapState(1).getGLUnitWithWin(i2);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final CameraPosition getCameraPositionPrj(boolean z2) {
        LatLng latLng;
        try {
            if (this.b == null) {
                return null;
            }
            if (!this.aw || this.I || this.f == null) {
                DPoint obtain = DPoint.obtain();
                geo2Latlng((int) this.b.getSX(), (int) this.b.getSY(), obtain);
                LatLng latLng2 = new LatLng(obtain.y, obtain.x);
                obtain.recycle();
                return CameraPosition.builder().target(latLng2).bearing(this.b.getSR()).tilt(this.b.getSC()).zoom(this.b.getSZ()).build();
            }
            if (z2) {
                DPoint obtain2 = DPoint.obtain();
                getPixel2LatLng(this.b.getAnchorX(), this.b.getAnchorY(), obtain2);
                latLng = new LatLng(obtain2.y, obtain2.x, false);
                obtain2.recycle();
            } else {
                latLng = g();
            }
            return CameraPosition.builder().target(latLng).bearing(this.b.getSR()).tilt(this.b.getSC()).zoom(this.b.getSZ()).build();
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    private LatLng g() {
        MapConfig mapConfig = this.b;
        if (mapConfig == null) {
            return null;
        }
        DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong(mapConfig.getSX(), this.b.getSY(), 20);
        LatLng latLng = new LatLng(pixelsToLatLong.y, pixelsToLatLong.x, false);
        pixelsToLatLong.recycle();
        return latLng;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean isUseAnchor() {
        return this.J;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final Point getWaterMarkerPositon() {
        ef efVar = this.D;
        if (efVar != null) {
            return efVar.a();
        }
        return new Point();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final View getGLMapView() {
        IGLSurfaceView iGLSurfaceView = this.C;
        if (iGLSurfaceView instanceof View) {
            return (View) iGLSurfaceView;
        }
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean canShowIndoorSwitch() {
        ar arVar;
        if (getZoomLevel() < 17.0f || (arVar = this.c) == null || arVar.g == null) {
            return false;
        }
        FPoint obtain = FPoint.obtain();
        a(this.c.g.x, this.c.g.y, obtain);
        return this.X.contains((int) obtain.x, (int) obtain.y);
    }

    private synchronized void h() {
        synchronized (this.aj) {
            int size = this.aj.size();
            for (int i2 = 0; i2 < size; i2++) {
                this.aj.get(i2).a().recycle();
            }
            this.aj.clear();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final int getLogoPosition() {
        try {
            return this.A.getLogoPosition();
        } catch (RemoteException e2) {
            mk.c(e2, "AMapDelegateImp", "getLogoPosition");
            e2.printStackTrace();
            return 0;
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setLogoPosition(int i2) {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.b(Integer.valueOf(i2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setLogoBottomMargin(int i2) {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.c(Integer.valueOf(i2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setLogoLeftMargin(int i2) {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.d(Integer.valueOf(i2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getLogoMarginRate(int i2) {
        ef efVar = this.D;
        if (efVar != null) {
            return efVar.a(i2);
        }
        return 0.0f;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setLogoMarginRate(int i2, float f2) {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.a(Integer.valueOf(i2), Float.valueOf(f2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final int getMaskLayerType() {
        return this.ah;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void post(Runnable runnable) {
        IGLSurfaceView iGLSurfaceView = this.C;
        if (iGLSurfaceView != null) {
            iGLSurfaceView.post(runnable);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void onLongPress(int i2, MotionEvent motionEvent) {
        int i3 = 0;
        try {
            this.R = false;
            a(i2);
            BaseOverlay hitBaseOverlay = this.E.getHitBaseOverlay(motionEvent, 1);
            if (hitBaseOverlay instanceof Marker) {
                this.Q = (Marker) hitBaseOverlay;
            }
            if (this.Q == null || !this.Q.isDraggable()) {
                List a2 = this.v.a(AMap.OnMapLongClickListener.class.hashCode());
                if (a2 != null && a2.size() > 0) {
                    DPoint obtain = DPoint.obtain();
                    getPixel2LatLng((int) motionEvent.getX(), (int) motionEvent.getY(), obtain);
                    synchronized (a2) {
                        while (i3 < a2.size()) {
                            ((AMap.OnMapLongClickListener) a2.get(i3)).onMapLongClick(new LatLng(obtain.y, obtain.x));
                            i3++;
                        }
                    }
                    this.S = true;
                    obtain.recycle();
                }
            } else {
                LatLng position = this.Q.getPosition();
                if (position != null) {
                    IPoint obtain2 = IPoint.obtain();
                    getLatLng2Pixel(position.latitude, position.longitude, obtain2);
                    obtain2.y -= 60;
                    DPoint obtain3 = DPoint.obtain();
                    getPixel2LatLng(obtain2.x, obtain2.y, obtain3);
                    this.Q.setPosition(new LatLng(obtain3.y, obtain3.x));
                    this.E.set2Top(this.Q.getId());
                    try {
                        List a3 = this.v.a(AMap.OnMarkerDragListener.class.hashCode());
                        if (a3 != null && a3.size() > 0) {
                            synchronized (a3) {
                                while (i3 < a3.size()) {
                                    ((AMap.OnMarkerDragListener) a3.get(i3)).onMarkerDragStart(this.Q);
                                    i3++;
                                }
                            }
                        }
                    } catch (Throwable th) {
                        mk.c(th, "AMapDelegateImp", "onMarkerDragStart");
                        th.printStackTrace();
                    }
                    this.N = true;
                    obtain2.recycle();
                    obtain3.recycle();
                }
            }
            this.an.resetTickCount(30);
        } catch (Throwable th2) {
            mk.c(th2, "AMapDelegateImp", "onLongPress");
            th2.printStackTrace();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean onDoubleTap(int i2, MotionEvent motionEvent) {
        if (!this.aw) {
            return false;
        }
        a((int) motionEvent.getX(), (int) motionEvent.getY());
        return false;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean onSingleTapConfirmed(int i2, MotionEvent motionEvent) {
        if (!this.aw) {
            return false;
        }
        try {
            a(i2);
            g(motionEvent);
            if (e(motionEvent) || f(motionEvent)) {
                return true;
            }
            d(motionEvent);
            b(motionEvent);
            return true;
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "onSingleTapUp");
            th.printStackTrace();
            return true;
        }
    }

    private void b(final MotionEvent motionEvent) {
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass8 */

            public final void run() {
                try {
                    Message obtain = Message.obtain();
                    Poi poi = null;
                    if (k.this.b != null && k.this.b.isTouchPoiEnable()) {
                        poi = k.this.b((k) ((int) motionEvent.getX()), (int) motionEvent.getY());
                    }
                    List a2 = k.this.v.a(AMap.OnPOIClickListener.class.hashCode());
                    if (a2 == null || a2.size() <= 0 || poi == null) {
                        k.this.c((k) motionEvent);
                        return;
                    }
                    obtain.what = 20;
                    obtain.obj = poi;
                    k.this.j.sendMessage(obtain);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void c(final MotionEvent motionEvent) {
        this.j.post(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass9 */

            public final void run() {
                Message obtain = Message.obtain();
                obtain.what = 19;
                obtain.arg1 = (int) motionEvent.getX();
                obtain.arg2 = (int) motionEvent.getY();
                k.this.j.sendMessage(obtain);
            }
        });
    }

    private boolean d(MotionEvent motionEvent) {
        try {
            List<AMap.OnPolylineClickListener> a2 = this.v.a(AMap.OnPolylineClickListener.class.hashCode());
            if (a2 != null && a2.size() > 0) {
                DPoint obtain = DPoint.obtain();
                getPixel2LatLng((int) motionEvent.getX(), (int) motionEvent.getY(), obtain);
                LatLng latLng = new LatLng(obtain.y, obtain.x);
                obtain.recycle();
                Polyline hitOverlay = this.E.getHitOverlay(latLng, 2);
                if (hitOverlay != null) {
                    synchronized (a2) {
                        for (AMap.OnPolylineClickListener onPolylineClickListener : a2) {
                            onPolylineClickListener.onPolylineClick(hitOverlay);
                        }
                    }
                    return false;
                }
            }
        } catch (Throwable unused) {
        }
        return false;
    }

    private boolean e(MotionEvent motionEvent) throws RemoteException {
        LatLng position;
        DPoint obtain = DPoint.obtain();
        getPixel2LatLng((int) motionEvent.getX(), (int) motionEvent.getY(), obtain);
        LatLng latLng = new LatLng(obtain.y, obtain.x);
        obtain.recycle();
        boolean z2 = true;
        BaseOverlay hitBaseOverlay = this.E.getHitBaseOverlay(latLng, 1);
        if ((hitBaseOverlay instanceof Marker) && ((Marker) hitBaseOverlay).getId().contains("MARKER")) {
            try {
                Marker marker = (Marker) hitBaseOverlay;
                this.E.set2Top(marker.getId());
                List<AMap.OnMarkerClickListener> a2 = this.v.a(AMap.OnMarkerClickListener.class.hashCode());
                if (a2 != null && a2.size() > 0) {
                    synchronized (a2) {
                        if (a2.size() == 1) {
                            boolean onMarkerClick = ((AMap.OnMarkerClickListener) a2.get(0)).onMarkerClick(marker);
                            if (onMarkerClick) {
                                return true;
                            }
                            z2 = onMarkerClick;
                        } else {
                            boolean z3 = false;
                            for (AMap.OnMarkerClickListener onMarkerClickListener : a2) {
                                z3 |= onMarkerClickListener.onMarkerClick(marker);
                            }
                            if (z3) {
                                return true;
                            }
                            z2 = z3;
                        }
                    }
                }
                this.E.showInfoWindow(marker.getId());
                if (!marker.isViewMode() && (position = marker.getPosition()) != null) {
                    IPoint obtain2 = IPoint.obtain();
                    latlon2Geo(position.latitude, position.longitude, obtain2);
                    moveCamera(ai.a(obtain2));
                }
                return z2;
            } catch (Throwable th) {
                mk.c(th, "AMapDelegateImp", "onMarkerTap");
                th.printStackTrace();
            }
        }
        return false;
    }

    private boolean f(MotionEvent motionEvent) {
        if (!(this.E == null || this.aG == null)) {
            DPoint obtain = DPoint.obtain();
            if (this.f != null) {
                getPixel2LatLng((int) motionEvent.getX(), (int) motionEvent.getY(), obtain);
                MultiPointItem multiPointItem = this.E.getMultiPointItem(new LatLng(obtain.y, obtain.x));
                if (multiPointItem == null) {
                    return false;
                }
                boolean onPointClick = this.aG.onPointClick(multiPointItem);
                obtain.recycle();
                return onPointClick;
            }
        }
        return false;
    }

    private boolean g(MotionEvent motionEvent) throws RemoteException {
        try {
            List a2 = this.v.a(AMap.OnInfoWindowClickListener.class.hashCode());
            BaseOverlay a3 = this.x.a(motionEvent);
            if (a3 != null && (a3 instanceof Marker)) {
                synchronized (a2) {
                    for (int i2 = 0; i2 < a2.size(); i2++) {
                        ((AMap.OnInfoWindowClickListener) a2.get(i2)).onInfoWindowClick((Marker) a3);
                    }
                }
            }
        } catch (Throwable unused) {
        }
        return false;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void drawFrame(GL10 gl10) {
        if (!this.H && this.f != null && EGL14.eglGetCurrentContext() != EGL14.EGL_NO_CONTEXT) {
            MapConfig mapConfig = this.b;
            if (mapConfig == null || mapConfig.isMapEnable()) {
                i();
                this.f.renderAMap();
                this.f.pushRendererState();
                CustomRenderer customRenderer = this.ag;
                if (customRenderer != null) {
                    customRenderer.onDrawFrame(gl10);
                }
                j jVar = this.aH;
                if (jVar != null) {
                    jVar.a();
                }
                j();
                m();
                if (!this.ay) {
                    this.ay = true;
                }
                this.f.popRendererState();
                if (dl.a()) {
                    try {
                        if (this.C instanceof n) {
                            if (this.d == null) {
                                this.d = new dl();
                            }
                            this.d.e();
                            if (this.d.f() && !this.d.d()) {
                                if (this.d.a(((n) this.C).getBitmap())) {
                                    if (dl.b()) {
                                        removecache();
                                    }
                                    if (dl.c()) {
                                        dl.g();
                                    }
                                    dw.b(dv.g, "pure screen: found pure check");
                                }
                            }
                        }
                    } catch (Throwable th) {
                        mk.c(th, "AMapDelegateImp", "PureScreenCheckTool.checkBlackScreen");
                    }
                }
            } else {
                GLES20.glClear(16640);
            }
        }
    }

    private void i() {
        int i2 = this.ai;
        if (i2 != -1) {
            this.an.setRenderFps((float) i2);
            resetRenderTime();
        } else if (this.f.isInMapAction(1) || this.au) {
            this.an.setRenderFps(40.0f);
        } else if (this.f.isInMapAnimation(1)) {
            this.an.setRenderFps(30.0f);
            this.an.resetTickCount(15);
        } else {
            this.an.setRenderFps(15.0f);
        }
        if (this.b.isWorldMapEnable() != MapsInitializer.isLoadWorldGridMap()) {
            b();
            this.b.setWorldMapEnable(MapsInitializer.isLoadWorldGridMap());
        }
    }

    private void j() {
        if (this.V) {
            boolean canStopMapRender = this.f.canStopMapRender(1);
            Message obtainMessage = this.j.obtainMessage(15, this.f.getScreenShot(this.G, 0, 0, getMapWidth(), getMapHeight()));
            obtainMessage.arg1 = canStopMapRender ? 1 : 0;
            obtainMessage.sendToTarget();
            this.V = false;
        }
    }

    private void k() {
        List a2;
        List a3;
        List a4;
        if (this.b.getMapRect() == null || this.ae) {
            l();
            this.ae = false;
        }
        boolean z2 = true;
        this.f.getCurTileIDs(1, this.b.getCurTileIds());
        GLMapState mapState = this.f.getMapState(1);
        if (mapState != null) {
            mapState.getViewMatrix(this.b.getViewMatrix());
            mapState.getProjectionMatrix(this.b.getProjectionMatrix());
            this.b.updateFinalMatrix();
            DPoint mapGeoCenter = mapState.getMapGeoCenter();
            this.b.setSX(mapGeoCenter.x);
            this.b.setSY(mapGeoCenter.y);
            this.b.setSZ(mapState.getMapZoomer());
            this.b.setSC(mapState.getCameraDegree());
            this.b.setSR(mapState.getMapAngle());
            if (this.b.isMapStateChange()) {
                this.b.setSkyHeight(mapState.getSkyHeight());
                DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong(mapGeoCenter.x, mapGeoCenter.y, 20);
                CameraPosition cameraPosition = new CameraPosition(new LatLng(pixelsToLatLong.y, pixelsToLatLong.x, false), this.b.getSZ(), this.b.getSC(), this.b.getSR());
                pixelsToLatLong.recycle();
                Message obtainMessage = this.j.obtainMessage();
                obtainMessage.what = 10;
                obtainMessage.obj = cameraPosition;
                this.j.sendMessage(obtainMessage);
                this.av = true;
                redrawInfoWindow();
                l();
                try {
                    if (this.A.isZoomControlsEnabled() && this.b.isNeedUpdateZoomControllerState() && (a4 = this.v.a(AMapWidgetListener.class.hashCode())) != null && a4.size() > 0) {
                        synchronized (a4) {
                            for (int i2 = 0; i2 < a4.size(); i2++) {
                                ((AMapWidgetListener) a4.get(i2)).invalidateZoomController(this.b.getSZ());
                            }
                        }
                    }
                    if (this.b.getChangeGridRatio() != 1.0d) {
                        b();
                    }
                    if (!this.A.isCompassEnabled() || (!this.b.isTiltChanged() && !this.b.isBearingChanged())) {
                        z2 = false;
                    }
                    if (z2 && (a3 = this.v.a(AMapWidgetListener.class.hashCode())) != null && a3.size() > 0) {
                        synchronized (a3) {
                            for (int i3 = 0; i3 < a3.size(); i3++) {
                                ((AMapWidgetListener) a3.get(i3)).invalidateCompassView();
                            }
                        }
                    }
                    if (this.A.isScaleControlsEnabled() && (a2 = this.v.a(AMapWidgetListener.class.hashCode())) != null && a2.size() > 0) {
                        synchronized (a2) {
                            for (int i4 = 0; i4 < a2.size(); i4++) {
                                ((AMapWidgetListener) a2.get(i4)).invalidateScaleView();
                            }
                        }
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            } else if (!this.au && this.f.getAnimateionsCount() == 0 && this.f.getStateMessageCount() == 0) {
                onChangeFinish();
            }
        }
    }

    private void l() {
        try {
            this.b.setMapRect(du.a(this));
            GLMapState gLMapState = (GLMapState) this.f.getNewMapState(1);
            if (gLMapState != null) {
                gLMapState.recalculate();
                gLMapState.getPixel20Bound(this.l, getMapWidth(), getMapHeight());
                this.b.getGeoRectangle().updateRect(this.l, (int) this.b.getSX(), (int) this.b.getSY());
                this.b.setMapPerPixelUnitLength(gLMapState.getGLUnitWithWin(1));
                gLMapState.recycle();
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    private void m() {
        if (!this.K) {
            this.j.sendEmptyMessage(16);
            this.K = true;
            b();
        }
        long j2 = this.be;
        if (j2 < 2) {
            this.be = j2 + 1;
            return;
        }
        final ea d2 = this.D.d();
        if (d2 != null && d2.getVisibility() != 8) {
            dr.a(this.e, System.currentTimeMillis() - this.aI);
            this.j.post(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass10 */

                public final void run() {
                    if (!k.this.I) {
                        try {
                            if (k.this.c != null) {
                                k.this.setIndoorBuildingInfo(k.this.c);
                            }
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                        d2.a();
                    }
                }
            });
            this.f.setStyleChangeGradualEnable(this.G, true);
        }
    }

    /* access modifiers changed from: package-private */
    public final void b() {
        this.j.obtainMessage(17, 1, 0).sendToTarget();
    }

    private void a(final int i2) {
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass12 */

            public final void run() {
                if (k.this.aw && k.this.f != null) {
                    k.this.f.setHighlightSubwayEnable(i2, false);
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private Poi b(int i2, int i3) {
        if (!this.aw) {
            return null;
        }
        try {
            ArrayList<MapLabelItem> c2 = c(i2, i3);
            MapLabelItem mapLabelItem = (c2 == null || c2.size() <= 0) ? null : c2.get(0);
            if (mapLabelItem != null) {
                DPoint pixelsToLatLong = VirtualEarthProjection.pixelsToLatLong((long) mapLabelItem.pixel20X, (long) mapLabelItem.pixel20Y, 20);
                Poi poi = new Poi(mapLabelItem.name, new LatLng(pixelsToLatLong.y, pixelsToLatLong.x, false), mapLabelItem.poiid);
                pixelsToLatLong.recycle();
                return poi;
            }
        } catch (Throwable unused) {
        }
        return null;
    }

    private ArrayList<MapLabelItem> c(int i2, int i3) {
        if (!this.aw) {
            return null;
        }
        ArrayList<MapLabelItem> arrayList = new ArrayList<>();
        byte[] labelBuffer = this.f.getLabelBuffer(1, i2, i3, 25);
        if (labelBuffer == null) {
            return null;
        }
        int i4 = GLConvertUtil.getInt(labelBuffer, 0) > 0 ? 1 : 0;
        int i5 = 0;
        int i6 = 4;
        while (i5 < i4) {
            MapLabelItem mapLabelItem = new MapLabelItem();
            int i7 = GLConvertUtil.getInt(labelBuffer, i6);
            int i8 = i6 + 4;
            int i9 = GLConvertUtil.getInt(labelBuffer, i8);
            int i10 = i8 + 4;
            mapLabelItem.x = i7;
            mapLabelItem.y = this.C.getHeight() - i9;
            mapLabelItem.pixel20X = GLConvertUtil.getInt(labelBuffer, i10);
            int i11 = i10 + 4;
            mapLabelItem.pixel20Y = GLConvertUtil.getInt(labelBuffer, i11);
            int i12 = i11 + 4;
            mapLabelItem.pixel20Z = GLConvertUtil.getInt(labelBuffer, i12);
            int i13 = i12 + 4;
            mapLabelItem.type = GLConvertUtil.getInt(labelBuffer, i13);
            int i14 = i13 + 4;
            mapLabelItem.mSublayerId = GLConvertUtil.getInt(labelBuffer, i14);
            int i15 = i14 + 4;
            mapLabelItem.timeStamp = GLConvertUtil.getInt(labelBuffer, i15);
            int i16 = i15 + 4;
            mapLabelItem.mIsFouces = labelBuffer[i16] != 0;
            int i17 = i16 + 1;
            if (labelBuffer[i17] == 0) {
                mapLabelItem.poiid = null;
            } else {
                String str = "";
                for (int i18 = 0; i18 < 20; i18++) {
                    int i19 = i18 + i17;
                    if (labelBuffer[i19] == 0) {
                        break;
                    }
                    str = str + ((char) labelBuffer[i19]);
                }
                mapLabelItem.poiid = str;
            }
            int i20 = i17 + 20;
            int i21 = i20 + 1;
            byte b2 = labelBuffer[i20];
            StringBuffer stringBuffer = new StringBuffer();
            for (int i22 = 0; i22 < b2; i22++) {
                stringBuffer.append((char) GLConvertUtil.getShort(labelBuffer, i21));
                i21 += 2;
            }
            mapLabelItem.name = stringBuffer.toString();
            arrayList.add(mapLabelItem);
            i5++;
            i6 = i21;
        }
        return arrayList;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getMapAngle(int i2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getSR();
        }
        return 0.0f;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void getGeoCenter(int i2, IPoint iPoint) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            iPoint.x = (int) mapConfig.getSX();
            iPoint.y = (int) this.b.getSY();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getCameraDegree(int i2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getSC();
        }
        return 0.0f;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void addGestureMapMessage(int i2, AbstractGestureMapMessage abstractGestureMapMessage) {
        if (this.aw && this.f != null) {
            try {
                abstractGestureMapMessage.isUseAnchor = this.J;
                abstractGestureMapMessage.anchorX = this.b.getAnchorX();
                abstractGestureMapMessage.anchorY = this.b.getAnchorY();
                this.f.addGestureMessage(i2, abstractGestureMapMessage, this.A.isGestureScaleByMapCenter(), this.b.getAnchorX(), this.b.getAnchorY());
            } catch (RemoteException unused) {
            }
        }
    }

    private void b(int i2) {
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null) {
            gLMapRender.renderPause();
        }
        e(i2);
    }

    private void c(int i2) {
        e(i2);
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null) {
            gLMapRender.renderResume();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void resetRenderTimeLongLong() {
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null) {
            gLMapRender.resetTickCount(30);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void resetRenderTime() {
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null) {
            gLMapRender.resetTickCount(2);
        }
    }

    private void n() {
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null) {
            gLMapRender.resetTickCount(2);
        }
    }

    private void o() {
        GLMapRender gLMapRender;
        if (this.aw && (gLMapRender = this.an) != null && !gLMapRender.isRenderPause()) {
            requestRender();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void requestRender() {
        GLMapRender gLMapRender = this.an;
        if (gLMapRender != null && !gLMapRender.isRenderPause()) {
            this.C.requestRender();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeMapLogo(int i2, boolean z2) {
        if (!this.H) {
            try {
                List a2 = this.v.a(AMapWidgetListener.class.hashCode());
                if (a2 != null && a2.size() > 0) {
                    this.D.g(Boolean.valueOf(!z2));
                }
            } catch (Throwable unused) {
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getRenderMode() {
        return this.C.getRenderMode();
    }

    private void p() {
        if (!this.ac) {
            try {
                this.aa.setName("AuthThread");
                this.aa.start();
                this.ac = true;
            } catch (Throwable th) {
                th.printStackTrace();
                du.a(th);
            }
        }
    }

    private void q() {
        if (!this.ad) {
            try {
                if (this.ab == null) {
                    this.ab = new q(this.e, this);
                }
                this.ab.setName("AuthProThread");
                this.ab.start();
                this.ad = true;
            } catch (Throwable th) {
                th.printStackTrace();
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getMapZoomScale() {
        return this.ar;
    }

    public final synchronized void a(int i2, int i3, int i4, int i5) {
        a(i2, i3, i4, i5, false, false, (StyleItem[]) null);
    }

    private synchronized void a(final int i2, final int i3, final int i4, final int i5, final boolean z2, final boolean z3, final StyleItem[] styleItemArr) {
        if (!this.ax || !this.aw || !this.a) {
            this.aL.g = i2;
            this.aL.d = i3;
            this.aL.e = i4;
            this.aL.f = i5;
            this.aL.b = true;
            return;
        }
        d(i4);
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass13 */

            public final void run() {
                try {
                    k.this.f.setMapModeAndStyle(i2, i3, i4, i5, z2, z3, styleItemArr);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    private void d(int i2) {
        ef efVar = this.D;
        if (efVar == null) {
            return;
        }
        if (i2 == 0) {
            if (efVar.b()) {
                this.D.g(Boolean.FALSE);
                this.D.c();
            }
        } else if (!efVar.b()) {
            this.D.g(Boolean.TRUE);
            this.D.c();
        }
    }

    private void e(final int i2) {
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass14 */

            public final void run() {
                try {
                    k.this.f.clearAllMessages(i2);
                    k.this.f.clearAnimations(i2, true);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    public final void a(final int i2, final boolean z2) {
        if (!this.aw || !this.ax) {
            this.aN.c = z2;
            this.aN.b = true;
            this.aN.g = i2;
            return;
        }
        resetRenderTime();
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass15 */

            public final void run() {
                try {
                    k.this.f.setBuildingEnable(i2, z2);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    public final void b(final int i2, final boolean z2) {
        if (!this.aw || !this.ax) {
            this.aT.c = z2;
            this.aT.b = true;
            this.aT.g = i2;
            return;
        }
        resetRenderTime();
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass16 */

            public final void run() {
                if (k.this.f != null) {
                    if (z2) {
                        k.this.f.setAllContentEnable(i2, true);
                    } else {
                        k.this.f.setAllContentEnable(i2, false);
                    }
                    k.this.f.setSimple3DEnable(i2, false);
                }
            }
        });
    }

    public final void c(final int i2, final boolean z2) {
        if (!this.aw || !this.ax) {
            this.aW.c = z2;
            this.aW.b = true;
            this.aW.g = i2;
            return;
        }
        resetRenderTime();
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass17 */

            public final void run() {
                try {
                    if (z2) {
                        k.this.f.setBuildingTextureEnable(i2, true);
                    } else {
                        k.this.f.setBuildingTextureEnable(i2, false);
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        });
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final synchronized void createSurface(int i2, GL10 gl10, EGLConfig eGLConfig) {
        dw.a(dv.c, "createSurface");
        this.aI = System.currentTimeMillis();
        if (this.Y == 3) {
            this.D.d().a(ea.b);
        } else {
            this.D.d().a(ea.a);
        }
        this.ax = false;
        this.g = this.C.getWidth();
        this.h = this.C.getHeight();
        this.az = false;
        try {
            AeUtil.loadLib(this.e);
            dw.a(dv.c, "load lib complete");
            AeUtil.initCrashHandle(this.e);
            GLMapEngine.InitParam initResource = AeUtil.initResource(this.e);
            dw.a(dv.c, "load res complete");
            this.f.createAMapInstance(initResource);
            dw.a(dv.c, "create engine complete");
            this.aF = new cn();
            dw.a(dv.c, "init shader complete");
            if (this.aX != null) {
                this.aX.i();
            }
            this.aw = true;
            this.m = gl10.glGetString(7937);
        } catch (Throwable th) {
            du.a(th);
            mk.c(th, "AMapDElegateImp", "createSurface");
            String str = dv.c;
            dw.b(str, "createSurface failed " + th.getMessage());
            Context context = this.e;
            dr.b(context, "init failed:" + th.getMessage());
        }
        GLMapState mapState = this.f.getMapState(1);
        if (!(mapState == null || mapState.getNativeInstance() == 0)) {
            mapState.setMapGeoCenter((double) ((int) this.b.getSX()), (double) ((int) this.b.getSY()));
            mapState.setMapAngle(this.b.getSR());
            mapState.setMapZoomer(this.b.getSZ());
            mapState.setCameraDegree(this.b.getSC());
        }
        p();
        if (this.ag != null) {
            this.ag.onSurfaceCreated(gl10, eGLConfig);
        }
        if (this.aX != null) {
            this.aX.c();
        }
        this.E.onCreateAMapInstance();
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeSurface(int i2, GL10 gl10, int i3, int i4) {
        WindowManager windowManager;
        String str = dv.c;
        dw.a(str, "changeSurface " + i3 + " " + i4);
        this.az = false;
        if (!this.aw) {
            createSurface(i2, gl10, null);
        }
        w wVar = this.ao;
        if (!(wVar == null || this.e == null || ((this.g == wVar.b() && this.h == this.ao.c()) || (windowManager = (WindowManager) this.e.getSystemService("window")) == null))) {
            Display defaultDisplay = windowManager.getDefaultDisplay();
            DisplayMetrics displayMetrics = new DisplayMetrics();
            if (defaultDisplay != null) {
                defaultDisplay.getRealMetrics(displayMetrics);
                this.ao.a(displayMetrics.widthPixels, displayMetrics.heightPixels);
            }
        }
        this.g = i3;
        this.h = i4;
        this.ae = true;
        this.X = new Rect(0, 0, i3, i4);
        this.G = a(i2, new Rect(0, 0, this.g, this.h), this.g, this.h);
        dw.a(dv.c, "create engine with frame complete");
        if (!this.ax) {
            MapConfig mapConfig = this.b;
            if (mapConfig != null) {
                mapConfig.setMapZoomScale(this.ar);
                this.b.setMapWidth(i3);
                this.b.setMapHeight(i4);
            }
            this.f.setIndoorEnable(this.G, false);
            this.f.setSimple3DEnable(this.G, false);
            this.f.setStyleChangeGradualEnable(this.G, false);
            this.f.initMapOpenLayer("{\"bounds\" : [{\"x2\" : 235405312,\"x1\" : 188874751,\"y2\" : 85065727,\"y1\" : 122421247}],\"sublyr\" : [{\"type\" : 4,\"sid\" : 9000006,\"zlevel\" : 2}],\"id\" : 9006,\"minzoom\" : 6,\"update_period\" : 90,\"maxzoom\" : 20,\"cachemode\" : 2,\"url\" : \"http://mpsapi.amap.com/ws/mps/lyrdata/ugc/\"}");
        }
        synchronized (this) {
            this.ax = true;
        }
        if (!this.J) {
            this.b.setAnchorX(i3 >> 1);
            this.b.setAnchorY(i4 >> 1);
        } else {
            this.b.setAnchorX(Math.max(1, Math.min(this.aC, i3 - 1)));
            this.b.setAnchorY(Math.max(1, Math.min(this.aD, i4 - 1)));
        }
        this.f.setProjectionCenter(this.G, this.b.getAnchorX(), this.b.getAnchorY());
        this.a = true;
        if (this.aT.b) {
            this.aT.run();
        }
        if (this.aL.b) {
            this.aL.run();
        }
        if (this.aM.b) {
            this.aM.run();
        }
        if (this.aJ.b) {
            this.aJ.run();
        }
        if (this.aN.b) {
            this.aN.run();
        }
        if (this.aW.b) {
            this.aW.run();
        }
        if (this.aO.b) {
            this.aO.run();
        }
        if (this.aP.b) {
            this.aP.run();
        }
        if (this.aQ.b) {
            this.aQ.run();
        }
        if (this.aU.b) {
            this.aU.run();
        }
        if (this.aK.b) {
            this.aK.run();
        }
        if (this.aR.b) {
            this.aR.run();
        }
        a aVar = this.aS;
        if (aVar != null) {
            aVar.run();
        }
        CustomRenderer customRenderer = this.ag;
        if (customRenderer != null) {
            customRenderer.onSurfaceChanged(gl10, i3, i4);
        }
        com.autonavi.extra.b bVar = this.aX;
        if (bVar != null) {
            bVar.d();
        }
        Handler handler = this.j;
        if (handler != null) {
            handler.post(this.aV);
        }
        redrawInfoWindow();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void destroySurface(int i2) {
        this.aA.lock();
        try {
            if (this.aw) {
                EGL14.eglGetCurrentContext();
                EGLContext eGLContext = EGL14.EGL_NO_CONTEXT;
                t();
                if (this.f != null) {
                    if (this.f.getOverlayBundle(this.G) != null) {
                        this.f.getOverlayBundle(this.G).removeAll(true);
                    }
                    this.f.destroyAMapEngine();
                    this.f = null;
                    if (this.bc > 0) {
                        dr.a(this.e, this.bc);
                    }
                    dw.a(dv.c, "destroy engine complete");
                }
                if (this.aX != null) {
                    this.aX.f();
                }
            }
            this.aw = false;
            this.ax = false;
            this.az = false;
        } catch (Throwable th) {
            du.a(th);
        } finally {
            this.aA.unlock();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final Context getContext() {
        return this.e;
    }

    private int a(int i2, Rect rect, int i3, int i4) {
        GLMapEngine gLMapEngine = this.f;
        int i5 = 0;
        if (gLMapEngine == null || i2 < 0) {
            return 0;
        }
        int engineIDWithType = gLMapEngine.getEngineIDWithType(i2);
        if (!this.f.isEngineCreated(engineIDWithType)) {
            if (Build.VERSION.SDK_INT >= 4) {
                i5 = this.e.getResources().getDisplayMetrics().densityDpi;
            }
            float f2 = this.e.getResources().getDisplayMetrics().density;
            this.ar = GLMapState.calMapZoomScalefactor(i3, i4, i5);
            NativeTextGenerate.getInstance().setDensity(f2);
            GLMapEngine.MapViewInitParam mapViewInitParam = new GLMapEngine.MapViewInitParam();
            mapViewInitParam.engineId = engineIDWithType;
            mapViewInitParam.x = rect.left;
            mapViewInitParam.y = rect.top;
            mapViewInitParam.width = rect.width();
            mapViewInitParam.height = rect.height();
            mapViewInitParam.screenWidth = i3;
            mapViewInitParam.screenHeight = i4;
            mapViewInitParam.screenScale = f2;
            mapViewInitParam.textScale = this.as * f2;
            mapViewInitParam.mapZoomScale = this.ar;
            mapViewInitParam.taskThreadCount = 3;
            this.f.createAMapEngineWithFrame(mapViewInitParam);
            GLMapState mapState = this.f.getMapState(engineIDWithType);
            mapState.setMapZoomer(this.b.getSZ());
            mapState.setCameraDegree(this.b.getSC());
            mapState.setMapAngle(this.b.getSR());
            mapState.setMapGeoCenter(this.b.getSX(), this.b.getSY());
            this.f.setMapState(engineIDWithType, mapState);
            this.f.setOvelayBundle(engineIDWithType, new GLOverlayBundle<>(engineIDWithType, this));
        } else {
            a(engineIDWithType, rect.left, rect.top, rect.width(), rect.height(), i3, i4);
        }
        return engineIDWithType;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final int getEngineIDWithGestureInfo(EAMapPlatformGestureInfo eAMapPlatformGestureInfo) {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getEngineIDWithGestureInfo(eAMapPlatformGestureInfo);
        }
        return 1;
    }

    private void a(int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.setServiceViewRect(i2, i3, i4, i5, i6, i7, i8);
        }
    }

    private boolean f(int i2) {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getSrvViewStateBoolValue(i2, 7);
        }
        return false;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final CameraPosition getCameraPosition() throws RemoteException {
        return getCameraPositionPrj(this.J);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getMaxZoomLevel() {
        try {
            if (this.b != null) {
                return this.b.getMaxZoomLevel();
            }
            return 20.0f;
        } catch (Throwable th) {
            du.a(th);
            return 20.0f;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getMinZoomLevel() {
        try {
            if (this.b != null) {
                return this.b.getMinZoomLevel();
            }
            return 3.0f;
        } catch (Throwable th) {
            du.a(th);
            return 3.0f;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void moveCamera(CameraUpdate cameraUpdate) throws RemoteException {
        if (cameraUpdate != null) {
            try {
                moveCamera(cameraUpdate.getCameraUpdateFactoryDelegate());
            } catch (Throwable th) {
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void moveCamera(AbstractCameraUpdateMessage abstractCameraUpdateMessage) throws RemoteException {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null && !this.H) {
            try {
                if (this.I && gLMapEngine.getStateMessageCount() > 0) {
                    AbstractCameraUpdateMessage c2 = ai.c();
                    c2.nowType = AbstractCameraUpdateMessage.Type.changeGeoCenterZoomTiltBearing;
                    c2.geoPoint = new DPoint(this.b.getSX(), this.b.getSY());
                    c2.zoom = this.b.getSZ();
                    c2.bearing = this.b.getSR();
                    c2.tilt = this.b.getSC();
                    this.f.addMessage(abstractCameraUpdateMessage, false);
                    while (this.f.getStateMessageCount() > 0) {
                        AbstractCameraUpdateMessage stateMessage = this.f.getStateMessage();
                        if (stateMessage != null) {
                            stateMessage.mergeCameraUpdateDelegate(c2);
                        }
                    }
                    abstractCameraUpdateMessage = c2;
                }
            } catch (Throwable th) {
                du.a(th);
            }
            resetRenderTime();
            this.f.clearAnimations(1, false);
            abstractCameraUpdateMessage.isChangeFinished = true;
            a(abstractCameraUpdateMessage);
            this.f.addMessage(abstractCameraUpdateMessage, false);
        }
    }

    private void a(AbstractCameraUpdateMessage abstractCameraUpdateMessage) {
        abstractCameraUpdateMessage.isUseAnchor = this.J;
        if (this.J) {
            abstractCameraUpdateMessage.anchorX = this.b.getAnchorX();
            abstractCameraUpdateMessage.anchorY = this.b.getAnchorY();
        }
        if (abstractCameraUpdateMessage.width == 0) {
            abstractCameraUpdateMessage.width = getMapWidth();
        }
        if (abstractCameraUpdateMessage.height == 0) {
            abstractCameraUpdateMessage.height = getMapHeight();
        }
        abstractCameraUpdateMessage.mapConfig = this.b;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void animateCamera(CameraUpdate cameraUpdate) throws RemoteException {
        if (cameraUpdate != null) {
            animateCamera(cameraUpdate.getCameraUpdateFactoryDelegate());
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void animateCamera(AbstractCameraUpdateMessage abstractCameraUpdateMessage) throws RemoteException {
        animateCameraWithDurationAndCallback(abstractCameraUpdateMessage, 250, (AMap.CancelableCallback) null);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void animateCameraWithCallback(CameraUpdate cameraUpdate, AMap.CancelableCallback cancelableCallback) throws RemoteException {
        if (cameraUpdate != null) {
            animateCameraWithDurationAndCallback(cameraUpdate, 250, cancelableCallback);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void animateCameraWithDurationAndCallback(CameraUpdate cameraUpdate, long j2, AMap.CancelableCallback cancelableCallback) {
        if (cameraUpdate != null) {
            animateCameraWithDurationAndCallback(cameraUpdate.getCameraUpdateFactoryDelegate(), j2, cancelableCallback);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void animateCameraWithDurationAndCallback(AbstractCameraUpdateMessage abstractCameraUpdateMessage, long j2, AMap.CancelableCallback cancelableCallback) {
        if (abstractCameraUpdateMessage != null && !this.H && this.f != null) {
            abstractCameraUpdateMessage.mCallback = cancelableCallback;
            abstractCameraUpdateMessage.mDuration = j2;
            if (this.I || getMapHeight() == 0 || getMapWidth() == 0) {
                try {
                    moveCamera(abstractCameraUpdateMessage);
                    if (abstractCameraUpdateMessage.mCallback != null) {
                        abstractCameraUpdateMessage.mCallback.onFinish();
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                    du.a(th);
                }
            } else {
                try {
                    this.f.interruptAnimation();
                    resetRenderTime();
                    a(abstractCameraUpdateMessage);
                    this.f.addMessage(abstractCameraUpdateMessage, true);
                } catch (Throwable th2) {
                    du.a(th2);
                    th2.printStackTrace();
                }
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void stopAnimation() throws RemoteException {
        try {
            if (this.f != null) {
                this.f.interruptAnimation();
            }
            resetRenderTime();
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Polyline addPolyline(PolylineOptions polylineOptions) throws RemoteException {
        if (polylineOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            String createId = this.E.createId("POLYLINE");
            return (Polyline) this.E.addOverlayObject(createId, new Polyline(this.E, polylineOptions, createId), polylineOptions);
        } catch (Throwable th) {
            du.a(th);
            String str = dv.d;
            dw.a(str, "addPolyline failed " + th.getMessage(), polylineOptions);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final BuildingOverlay addBuildingOverlay() {
        try {
            dr.g(this.e);
            String createId = this.E.createId("BUILDINGOVERLAY");
            BuildingOverlay buildingOverlay = new BuildingOverlay(this.E, createId);
            Field declaredField = buildingOverlay.getClass().getDeclaredField("buildingOverlayTotalOptions");
            if (declaredField == null) {
                return null;
            }
            resetRenderTime();
            declaredField.setAccessible(true);
            Object obj = declaredField.get(buildingOverlay);
            return (this.E == null || !(obj instanceof BaseOptions)) ? buildingOverlay : (BuildingOverlay) this.E.addOverlayObject(createId, buildingOverlay, (BaseOptions) obj);
        } catch (Exception e2) {
            e2.printStackTrace();
            du.a(e2);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final GL3DModel addGLModel(GL3DModelOptions gL3DModelOptions) {
        resetRenderTime();
        String createId = this.E.createId("GL3DMODEL");
        GL3DModel gL3DModel = new GL3DModel(this.E, gL3DModelOptions, createId);
        this.E.addOverlayObject(createId, gL3DModel, gL3DModelOptions);
        return gL3DModel;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final ParticleOverlay addParticleOverlay(ParticleOverlayOptions particleOverlayOptions) {
        if (particleOverlayOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            dr.c(this.e);
            String createId = this.E.createId("PARTICLEOVERLAY");
            return (ParticleOverlay) this.E.addOverlayObject(createId, new ParticleOverlay(this.E, particleOverlayOptions, createId), particleOverlayOptions);
        } catch (Throwable th) {
            du.a(th);
            th.printStackTrace();
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final NavigateArrow addNavigateArrow(NavigateArrowOptions navigateArrowOptions) throws RemoteException {
        if (navigateArrowOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            NavigateArrowOptions clone = navigateArrowOptions.clone();
            String createId = this.E.createId("NAVIGATEARROW");
            NavigateArrow navigateArrow = new NavigateArrow(this.E, clone, createId);
            return this.E != null ? (NavigateArrow) this.E.addOverlayObject(createId, navigateArrow, clone) : navigateArrow;
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Polygon addPolygon(PolygonOptions polygonOptions) throws RemoteException {
        if (polygonOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            PolygonOptions clone = polygonOptions.clone();
            String createId = this.E.createId("POLYGON");
            Polygon polygon = new Polygon(this.E, clone, createId);
            return this.E != null ? (Polygon) this.E.addOverlayObject(createId, polygon, clone) : polygon;
        } catch (Throwable th) {
            du.a(th);
            String str = dv.d;
            dw.a(str, "addPolygon failed " + th.getMessage(), polygonOptions);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Circle addCircle(CircleOptions circleOptions) throws RemoteException {
        if (circleOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            CircleOptions clone = circleOptions.clone();
            String createId = this.E.createId("CIRCLE");
            Circle circle = new Circle(this.E, clone, createId);
            return this.E != null ? (Circle) this.E.addOverlayObject(createId, circle, clone) : circle;
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Arc addArc(ArcOptions arcOptions) throws RemoteException {
        if (arcOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            ArcOptions clone = arcOptions.clone();
            String createId = this.E.createId("ARC");
            Arc arc = new Arc(this.E, clone, createId);
            return this.E != null ? (Arc) this.E.addOverlayObject(createId, arc, clone) : arc;
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final GroundOverlay addGroundOverlay(GroundOverlayOptions groundOverlayOptions) throws RemoteException {
        if (groundOverlayOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            GroundOverlayOptions clone = groundOverlayOptions.clone();
            String createId = this.E.createId("GROUNDOVERLAY");
            GroundOverlay groundOverlay = new GroundOverlay(this.E, clone, createId);
            return this.E != null ? (GroundOverlay) this.E.addOverlayObject(createId, groundOverlay, clone) : groundOverlay;
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final MultiPointOverlay addMultiPointOverlay(MultiPointOverlayOptions multiPointOverlayOptions) throws RemoteException {
        if (multiPointOverlayOptions == null) {
            return null;
        }
        try {
            resetRenderTime();
            MultiPointOverlayOptions clone = multiPointOverlayOptions.clone();
            String createId = this.E.createId("MULTIOVERLAY");
            MultiPointOverlay multiPointOverlay = new MultiPointOverlay(this.E, clone, createId);
            return this.E != null ? (MultiPointOverlay) this.E.addOverlayObject(createId, multiPointOverlay, clone) : multiPointOverlay;
        } catch (Throwable unused) {
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Marker addMarker(MarkerOptions markerOptions) throws RemoteException {
        try {
            resetRenderTime();
            MarkerOptions clone = markerOptions.clone();
            String createId = this.E.createId("MARKER");
            Marker marker = new Marker(this.E, clone, createId);
            this.E.addOverlayObject(createId, marker, clone);
            return marker;
        } catch (Throwable th) {
            du.a(th);
            String str = dv.d;
            dw.a(str, "addMarker failed " + th.getMessage(), markerOptions);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Text addText(TextOptions textOptions) throws RemoteException {
        try {
            resetRenderTime();
            String createId = this.E.createId("TEXT");
            TextOptions clone = textOptions.clone();
            MarkerOptions a2 = cl.a(clone);
            Marker marker = new Marker(this.E, a2, createId);
            marker.setObject(clone.getObject());
            this.E.addOverlayObject(createId, marker, a2);
            return new Text(marker, clone);
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final ArrayList<Marker> addMarkers(ArrayList<MarkerOptions> arrayList, boolean z2) throws RemoteException {
        try {
            resetRenderTime();
            ArrayList<Marker> arrayList2 = new ArrayList<>();
            final LatLngBounds.Builder builder = LatLngBounds.builder();
            for (int i2 = 0; i2 < arrayList.size(); i2++) {
                MarkerOptions markerOptions = arrayList.get(i2);
                if (arrayList.get(i2) != null) {
                    arrayList2.add(addMarker(markerOptions));
                    if (markerOptions.getPosition() != null) {
                        builder.include(markerOptions.getPosition());
                    }
                }
            }
            if (z2 && arrayList2.size() > 0) {
                getMainHandler().postDelayed(new Runnable() {
                    /* class com.amap.api.col.p0003nsl.k.AnonymousClass18 */

                    public final void run() {
                        try {
                            k.this.moveCamera(ai.a(builder.build(), 50));
                        } catch (Throwable unused) {
                        }
                    }
                }, 50);
            }
            return arrayList2;
        } catch (Throwable th) {
            du.a(th);
            String str = dv.d;
            dw.a(str, "addMarkers failed " + th.getMessage(), arrayList);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final TileOverlay addTileOverlay(TileOverlayOptions tileOverlayOptions) throws RemoteException {
        try {
            TileProvider tileProvider = tileOverlayOptions.getTileProvider();
            if (tileProvider != null && (tileProvider instanceof HeatmapTileProvider)) {
                dr.a(this.e);
            }
            String createId = this.E.createId("TILEOVERLAY");
            TileOverlay tileOverlay = new TileOverlay(this.E, tileOverlayOptions, createId);
            this.E.addOverlayObject(createId, tileOverlay, tileOverlayOptions);
            return tileOverlay;
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final HeatMapLayer addHeatMapLayer(HeatMapLayerOptions heatMapLayerOptions) throws RemoteException {
        try {
            resetRenderTime();
            if (heatMapLayerOptions == null) {
                return null;
            }
            String createId = this.E.createId("HEATMAPLAYER");
            return (HeatMapLayer) this.E.addOverlayObject(createId, new HeatMapLayer(this.E, heatMapLayerOptions, createId), heatMapLayerOptions);
        } catch (Throwable th) {
            du.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void clear() throws RemoteException {
        try {
            clear(false);
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "clear");
            du.a(th);
            th.printStackTrace();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void clear(boolean z2) throws RemoteException {
        try {
            hideInfoWindow();
            String str = null;
            String str2 = "";
            if (this.L != null) {
                if (z2) {
                    str = this.L.d();
                    str2 = this.L.e();
                } else {
                    this.L.f();
                }
            }
            this.E.clear(str, str2);
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass19 */

                public final void run() {
                    if (k.this.f != null && !k.this.H) {
                        k.this.f.removeNativeAllOverlay(k.this.G);
                    }
                }
            });
            resetRenderTime();
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "clear");
            du.a(th);
            th.printStackTrace();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getMapType() throws RemoteException {
        return this.Y;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapType(int i2) throws RemoteException {
        MapConfig mapConfig;
        if (i2 != this.Y || ((mapConfig = this.b) != null && mapConfig.isCustomStyleEnable())) {
            this.Y = i2;
            g(i2);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x003b A[Catch:{ all -> 0x007a }] */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x0060 A[Catch:{ all -> 0x007a }] */
    private void g(int i2) {
        int i3;
        int i4;
        int i5;
        this.Y = i2;
        if (i2 != 1) {
            if (i2 == 2) {
                i5 = 1;
            } else {
                if (i2 == 3) {
                    i5 = 0;
                    i4 = 1;
                } else if (i2 == 4) {
                    i5 = 0;
                    i4 = 0;
                } else if (i2 == 5) {
                    i5 = 2;
                } else {
                    try {
                        this.Y = 1;
                    } catch (Throwable th) {
                        mk.c(th, "AMapDelegateImp", "setMaptype");
                        th.printStackTrace();
                        du.a(th);
                        return;
                    }
                }
                i3 = 4;
                this.b.setMapStyleMode(i5);
                this.b.setMapStyleTime(i4);
                this.b.setMapStyleState(i3);
                if (this.b.isCustomStyleEnable()) {
                    if (this.aH == null || !this.aH.d()) {
                        a(1, i5, i4, i3, true, false, (StyleItem[]) null);
                        this.b.setCustomStyleEnable(false);
                    } else {
                        this.aH.e();
                    }
                    this.A.setLogoEnable(true);
                } else {
                    if (this.b.getMapLanguage().equals("en")) {
                        setMapLanguage("zh_cn");
                    }
                    a(1, i5, i4, i3);
                }
                resetRenderTime();
            }
            i4 = 0;
            i3 = 0;
            this.b.setMapStyleMode(i5);
            this.b.setMapStyleTime(i4);
            this.b.setMapStyleState(i3);
            if (this.b.isCustomStyleEnable()) {
            }
            resetRenderTime();
        }
        i5 = 0;
        i4 = 0;
        i3 = 0;
        this.b.setMapStyleMode(i5);
        this.b.setMapStyleTime(i4);
        this.b.setMapStyleState(i3);
        if (this.b.isCustomStyleEnable()) {
        }
        resetRenderTime();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean isTrafficEnabled() throws RemoteException {
        return this.b.isTrafficEnabled();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setTrafficEnabled(final boolean z2) throws RemoteException {
        try {
            if (!this.aw || this.H) {
                this.aJ.c = z2;
                this.aJ.b = true;
                this.aJ.g = 1;
                return;
            }
            queueEvent(new Runnable(z2) {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass20 */
                final /* synthetic */ boolean a;

                {
                    this.a = r2;
                }

                public final void run() {
                    try {
                        if (k.this.b.isTrafficEnabled() != this.a) {
                            k.this.b.setTrafficEnabled(z2);
                            k.this.an.setTrafficMode(this.a);
                            k.this.f.setTrafficEnable(1, this.a);
                            k.this.resetRenderTime();
                        }
                    } catch (Throwable th) {
                        th.printStackTrace();
                        du.a(th);
                    }
                }
            });
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean isIndoorEnabled() throws RemoteException {
        return this.b.isIndoorEnable();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setIndoorEnabled(final boolean z2) throws RemoteException {
        List a2;
        try {
            if (!this.aw || this.H) {
                this.aU.c = z2;
                this.aU.b = true;
                this.aU.g = 1;
                return;
            }
            this.b.setIndoorEnable(z2);
            resetRenderTime();
            if (!z2) {
                if (this.f != null) {
                    this.f.setIndoorEnable(1, false);
                }
                this.b.maxZoomLevel = this.b.isSetLimitZoomLevel() ? this.b.getMaxZoomLevel() : 20.0f;
                try {
                    if (this.A.isZoomControlsEnabled() && (a2 = this.v.a(AMapWidgetListener.class.hashCode())) != null && a2.size() > 0) {
                        synchronized (a2) {
                            for (int i2 = 0; i2 < a2.size(); i2++) {
                                ((AMapWidgetListener) a2.get(i2)).invalidateZoomController(this.b.getSZ());
                            }
                        }
                    }
                } catch (Throwable unused) {
                }
            } else if (this.f != null) {
                this.f.setIndoorEnable(1, true);
            }
            dr.c(this.e, z2);
            if (this.A.isIndoorSwitchEnabled()) {
                this.j.post(new Runnable() {
                    /* class com.amap.api.col.p0003nsl.k.AnonymousClass22 */

                    public final void run() {
                        if (z2) {
                            k.this.showIndoorSwitchControlsEnabled(true);
                        } else if (k.this.D != null) {
                            k.this.D.i(Boolean.FALSE);
                        }
                    }
                });
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void set3DBuildingEnabled(boolean z2) throws RemoteException {
        try {
            b(1);
            a(1, z2);
            c(1);
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean isMyLocationEnabled() throws RemoteException {
        return this.F;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationEnabled(boolean z2) throws RemoteException {
        if (!this.H) {
            try {
                if (this.D != null) {
                    if (this.M == null) {
                        this.D.h(Boolean.FALSE);
                    } else if (z2) {
                        this.M.activate(this.u);
                        this.D.h(Boolean.TRUE);
                        if (this.L == null) {
                            this.L = new ci(this, this.e);
                        }
                    } else {
                        if (this.L != null) {
                            this.L.c();
                            this.L = null;
                        }
                        this.M.deactivate();
                    }
                }
                if (!z2) {
                    this.A.setMyLocationButtonEnabled(z2);
                }
                this.F = z2;
                resetRenderTime();
            } catch (Throwable th) {
                mk.c(th, "AMapDelegateImp", "setMyLocationEnabled");
                th.printStackTrace();
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setLoadOfflineData(final boolean z2) throws RemoteException {
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass23 */

            public final void run() {
                if (k.this.f != null) {
                    k.this.f.setOfflineDataEnable(1, z2);
                }
            }
        });
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationStyle(MyLocationStyle myLocationStyle) throws RemoteException {
        if (!this.H) {
            try {
                if (this.L == null) {
                    this.L = new ci(this, this.e);
                }
                if (this.L != null) {
                    if (myLocationStyle.getInterval() < 1000) {
                        myLocationStyle.interval(1000);
                    }
                    if (this.M != null && (this.M instanceof at)) {
                        ((at) this.M).a(myLocationStyle.getInterval());
                        ((at) this.M).a(myLocationStyle.getMyLocationType());
                    }
                    this.L.a(myLocationStyle);
                }
            } catch (Throwable th) {
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationType(int i2) throws RemoteException {
        try {
            if (this.L != null && this.L.a() != null) {
                this.L.a().myLocationType(i2);
                setMyLocationStyle(this.L.a());
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final List<Marker> getMapScreenMarkers() throws RemoteException {
        if (!du.a(getMapWidth(), getMapHeight())) {
            return new ArrayList();
        }
        return this.E.getMapScreenMarkers();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapTextEnable(final boolean z2) throws RemoteException {
        try {
            if (!this.aw || !this.ax) {
                this.aO.c = z2;
                this.aO.b = true;
                this.aO.g = 1;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass24 */

                public final void run() {
                    try {
                        k.this.f.setLabelEnable(1, z2);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setRoadArrowEnable(final boolean z2) throws RemoteException {
        try {
            if (!this.aw || !this.ax) {
                this.aP.c = z2;
                this.aP.b = true;
                this.aP.g = 1;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass25 */

                public final void run() {
                    try {
                        k.this.f.setRoadArrowEnable(1, z2);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setNaviLabelEnable(final boolean z2, final int i2, final int i3) throws RemoteException {
        try {
            if (!this.aw || !this.ax) {
                this.aQ.c = z2;
                this.aQ.h = i2;
                this.aQ.i = i3;
                this.aQ.b = true;
                this.aQ.g = 1;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass26 */

                public final void run() {
                    try {
                        k.this.f.setNaviLabelEnable(1, z2, i2, i3);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setConstructingRoadEnable(final boolean z2) {
        try {
            if (!this.aw || !this.ax) {
                this.aR.c = z2;
                this.aR.b = true;
                this.aR.g = 1;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass27 */

                public final void run() {
                    try {
                        k.this.f.setMapOpenLayerEnable(z2);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setTrafficStyleWithTextureData(final byte[] bArr) {
        if (!this.H) {
            try {
                if (!this.aw || !this.ax || bArr == null) {
                    this.aS.j = bArr;
                    this.aS.b = true;
                    this.aS.g = 1;
                    return;
                }
                resetRenderTime();
                queueEvent(new Runnable() {
                    /* class com.amap.api.col.p0003nsl.k.AnonymousClass28 */

                    public final void run() {
                        try {
                            k.this.f.setTrafficStyleWithTextureData(1, bArr);
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
            } catch (Throwable th) {
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Location getMyLocation() throws RemoteException {
        if (this.M != null) {
            return this.u.a;
        }
        return null;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setLocationSource(LocationSource locationSource) throws RemoteException {
        try {
            if (!this.H) {
                if (this.M != null && (this.M instanceof at)) {
                    this.M.deactivate();
                }
                this.M = locationSource;
                if (locationSource != null) {
                    this.D.h(Boolean.TRUE);
                } else {
                    this.D.h(Boolean.FALSE);
                }
            }
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "setLocationSource");
            th.printStackTrace();
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationRotateAngle(float f2) throws RemoteException {
        try {
            if (this.L != null) {
                this.L.a(f2);
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final UiSettings getAMapUiSettings() throws RemoteException {
        if (this.y == null) {
            this.y = new UiSettings(this.A);
        }
        return this.y;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Projection getAMapProjection() throws RemoteException {
        return new Projection(this.z);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMapClickListener(AMap.OnMapClickListener onMapClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMapClickListener.class.hashCode(), onMapClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMapTouchListener(AMap.OnMapTouchListener onMapTouchListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMapTouchListener.class.hashCode(), onMapTouchListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnPOIClickListener(AMap.OnPOIClickListener onPOIClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnPOIClickListener.class.hashCode(), onPOIClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMapLongClickListener(AMap.OnMapLongClickListener onMapLongClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMapLongClickListener.class.hashCode(), onMapLongClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMarkerClickListener(AMap.OnMarkerClickListener onMarkerClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMarkerClickListener.class.hashCode(), onMarkerClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnPolylineClickListener(AMap.OnPolylineClickListener onPolylineClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnPolylineClickListener.class.hashCode(), onPolylineClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMarkerDragListener(AMap.OnMarkerDragListener onMarkerDragListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMarkerDragListener.class.hashCode(), onMarkerDragListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMaploadedListener(AMap.OnMapLoadedListener onMapLoadedListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMapLoadedListener.class.hashCode(), onMapLoadedListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnCameraChangeListener(AMap.OnCameraChangeListener onCameraChangeListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnCameraChangeListener.class.hashCode(), onCameraChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnInfoWindowClickListener(AMap.OnInfoWindowClickListener onInfoWindowClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnInfoWindowClickListener.class.hashCode(), onInfoWindowClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnIndoorBuildingActiveListener(AMap.OnIndoorBuildingActiveListener onIndoorBuildingActiveListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnIndoorBuildingActiveListener.class.hashCode(), onIndoorBuildingActiveListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMyLocationChangeListener(AMap.OnMyLocationChangeListener onMyLocationChangeListener) {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(AMap.OnMyLocationChangeListener.class.hashCode(), onMyLocationChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setInfoWindowAdapter(AMap.InfoWindowAdapter infoWindowAdapter) throws RemoteException {
        as asVar;
        if (!this.H && (asVar = this.x) != null) {
            asVar.a(infoWindowAdapter);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setInfoWindowAdapter(AMap.CommonInfoWindowAdapter commonInfoWindowAdapter) throws RemoteException {
        as asVar;
        if (!this.H && (asVar = this.x) != null) {
            asVar.a(commonInfoWindowAdapter);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setOnMultiPointClickListener(AMap.OnMultiPointClickListener onMultiPointClickListener) {
        this.aG = onMultiPointClickListener;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getMapContentApprovalNumber() {
        MapConfig mapConfig = this.b;
        if (mapConfig == null || mapConfig.isCustomStyleEnable()) {
            return null;
        }
        dr.d(this.e);
        String a2 = dk.a(this.e, "approval_number", "mc", "");
        return !TextUtils.isEmpty(a2) ? a2 : "GS(2021)5875号 | GS(2020)2189号";
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getSatelliteImageApprovalNumber() {
        dr.e(this.e);
        String a2 = dk.a(this.e, "approval_number", "si", "");
        return !TextUtils.isEmpty(a2) ? a2 : "GS(2021)1328号";
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapLanguage(String str) {
        MapConfig mapConfig;
        if (!TextUtils.isEmpty(str) && (mapConfig = this.b) != null && !mapConfig.isCustomStyleEnable() && !this.b.getMapLanguage().equals(str)) {
            if (!str.equals("en")) {
                this.b.setMapLanguage("zh_cn");
                this.af = 0;
            } else {
                if (this.Y != 1) {
                    try {
                        setMapType(1);
                    } catch (Throwable th) {
                        du.a(th);
                        th.printStackTrace();
                    }
                }
                this.b.setMapLanguage("en");
                this.af = -10000;
            }
            try {
                b(getCameraPosition());
            } catch (Throwable th2) {
                du.a(th2);
                th2.printStackTrace();
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setWorldVectorMapStyle(String str) {
        if (!a(false, true) && !TextUtils.isEmpty(str) && this.b != null && !this.aZ.equals(str)) {
            this.aZ = str;
            com.autonavi.extra.b bVar = this.aX;
            if (bVar != null) {
                bVar.i();
            }
            resetRenderTime();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getWorldVectorMapStyle() {
        return this.aZ;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getCurrentWorldVectorMapStyle() {
        try {
            if (this.aX == null) {
                return "";
            }
            Object j2 = this.aX.j();
            if (j2 instanceof String) {
                return (String) j2;
            }
            return "";
        } catch (Throwable th) {
            du.a(th);
            return "";
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void accelerateNetworkInChinese(boolean z2) {
        com.autonavi.extra.b bVar = this.aX;
        if (bVar != null) {
            Boolean.valueOf(z2);
            bVar.i();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getWorldVectorMapLanguage() {
        return this.aY;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void getMapPrintScreen(AMap.onMapPrintScreenListener onmapprintscreenlistener) {
        try {
            this.v.a(Integer.valueOf(AMap.onMapPrintScreenListener.class.hashCode()), onmapprintscreenlistener);
            this.V = true;
            resetRenderTime();
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void getMapScreenShot(AMap.OnMapScreenShotListener onMapScreenShotListener) {
        try {
            this.v.a(Integer.valueOf(AMap.OnMapScreenShotListener.class.hashCode()), onMapScreenShotListener);
            this.V = true;
            resetRenderTime();
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getScalePerPixel() throws RemoteException {
        try {
            return ((float) ((((Math.cos((getCameraPosition().target.latitude * 3.141592653589793d) / 180.0d) * 2.0d) * 3.141592653589793d) * 6378137.0d) / (Math.pow(2.0d, (double) getZoomLevel()) * 256.0d))) * getMapZoomScale();
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "getScalePerPixel");
            du.a(th);
            th.printStackTrace();
            return 0.0f;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setRunLowFrame(boolean z2) {
        if (!z2) {
            try {
                if (this.ai == -1) {
                    o();
                }
            } catch (Throwable th) {
                du.a(th);
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removecache() throws RemoteException {
        removecache(null);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removecache(AMap.OnCacheRemoveListener onCacheRemoveListener) throws RemoteException {
        if (this.j != null && this.f != null) {
            try {
                d dVar = new d(this.e, onCacheRemoveListener);
                this.j.removeCallbacks(dVar);
                this.j.post(dVar);
            } catch (Throwable th) {
                mk.c(th, "AMapDelegateImp", "removecache");
                th.printStackTrace();
                du.a(th);
            }
        }
    }

    /* access modifiers changed from: private */
    /* renamed from: com.amap.api.col.3nsl.k$d */
    /* compiled from: AMapDelegateImp */
    public class d implements Runnable {
        private Context b;
        private AMap.OnCacheRemoveListener c;

        public d(Context context, AMap.OnCacheRemoveListener onCacheRemoveListener) {
            this.b = context;
            this.c = onCacheRemoveListener;
        }

        /* JADX WARNING: Removed duplicated region for block: B:20:0x0046  */
        public final void run() {
            Throwable th;
            boolean z;
            boolean z2 = true;
            try {
                Context applicationContext = this.b.getApplicationContext();
                String c2 = du.c(applicationContext);
                String a2 = du.a(applicationContext);
                File file = new File(c2);
                boolean deleteFile = file.exists() ? FileUtil.deleteFile(file) : true;
                if (deleteFile) {
                    try {
                        if (FileUtil.deleteFile(new File(a2))) {
                            z = true;
                            if (!z || !du.e(applicationContext)) {
                                z2 = false;
                            }
                            if (k.this.E != null) {
                                k.this.E.clearTileCache();
                            }
                            if (k.this.f != null && this.c != null) {
                                this.c.onRemoveCacheFinish(z2);
                                return;
                            }
                            return;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        z2 = deleteFile;
                        try {
                            du.a(th);
                            mk.c(th, "AMapDelegateImp", "RemoveCacheRunnable");
                            try {
                                if (k.this.f != null && this.c != null) {
                                    this.c.onRemoveCacheFinish(false);
                                    return;
                                }
                                return;
                            } catch (Throwable th3) {
                                th3.printStackTrace();
                                return;
                            }
                        } catch (Throwable th4) {
                            th4.printStackTrace();
                        }
                    }
                }
                z = false;
                z2 = false;
                if (k.this.E != null) {
                }
                try {
                    if (k.this.f != null) {
                        return;
                    }
                    return;
                } catch (Throwable th5) {
                    th5.printStackTrace();
                    return;
                }
            } catch (Throwable th6) {
                th = th6;
                du.a(th);
                mk.c(th, "AMapDelegateImp", "RemoveCacheRunnable");
                if (k.this.f != null) {
                    return;
                }
                return;
            }
            throw th;
        }

        public final boolean equals(Object obj) {
            return obj instanceof d;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCustomRenderer(CustomRenderer customRenderer) throws RemoteException {
        this.ag = customRenderer;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCenterToPixel(int i2, int i3) throws RemoteException {
        this.J = true;
        this.aC = i2;
        this.aD = i3;
        if (this.ax && this.aw) {
            if (this.b.getAnchorX() != this.aC || this.b.getAnchorY() != this.aD) {
                this.b.setAnchorX(this.aC);
                this.b.setAnchorY(this.aD);
                queueEvent(new Runnable() {
                    /* class com.amap.api.col.p0003nsl.k.AnonymousClass29 */

                    public final void run() {
                        try {
                            k.this.b.setAnchorX(Math.max(0, Math.min(k.this.aC, k.this.g)));
                            k.this.b.setAnchorY(Math.max(0, Math.min(k.this.aD, k.this.h)));
                            k.this.f.setProjectionCenter(1, k.this.b.getAnchorX(), k.this.b.getAnchorY());
                            k.this.ae = true;
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapTextZIndex(int i2) throws RemoteException {
        this.af = i2;
        this.i = false;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getMapTextZIndex() throws RemoteException {
        return this.af;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setRenderFps(int i2) {
        if (i2 == -1) {
            try {
                this.ai = i2;
            } catch (Throwable th) {
                du.a(th);
                th.printStackTrace();
                return;
            }
        } else {
            this.ai = Math.max(10, Math.min(i2, 40));
        }
        dr.f(this.e);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setIndoorBuildingInfo(IndoorBuildingInfo indoorBuildingInfo) throws RemoteException {
        if (!this.H && indoorBuildingInfo != null && indoorBuildingInfo.activeFloorName != null && indoorBuildingInfo.poiid != null) {
            this.c = (ar) indoorBuildingInfo;
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass30 */

                public final void run() {
                    if (k.this.f != null) {
                        k.this.f.setIndoorBuildingToBeActive(1, k.this.c.activeFloorName, k.this.c.activeFloorIndex, k.this.c.poiid);
                    }
                }
            });
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setAMapGestureListener(AMapGestureListener aMapGestureListener) {
        w wVar = this.ao;
        if (wVar != null) {
            this.w = aMapGestureListener;
            wVar.a(aMapGestureListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getZoomToSpanLevel(LatLng latLng, LatLng latLng2) {
        try {
            MapConfig mapConfig = getMapConfig();
            if (latLng == null || latLng2 == null || !this.aw || this.H) {
                return mapConfig.getSZ();
            }
            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            builder.include(latLng);
            builder.include(latLng2);
            GLMapState gLMapState = new GLMapState(1, this.f.getNativeInstance());
            Pair<Float, IPoint> a2 = du.a(mapConfig, 0, 0, 0, 0, builder.build(), getMapWidth(), getMapHeight());
            gLMapState.recycle();
            if (a2 != null) {
                return ((Float) a2.first).floatValue();
            }
            return gLMapState.getMapZoomer();
        } catch (Throwable th) {
            du.a(th);
            return 0.0f;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Pair<Float, LatLng> calculateZoomToSpanLevel(int i2, int i3, int i4, int i5, LatLng latLng, LatLng latLng2) {
        if (latLng != null && latLng2 != null && i2 == i3 && i3 == i4 && i4 == i5 && latLng.latitude == latLng2.latitude && latLng.longitude == latLng2.longitude) {
            return new Pair<>(Float.valueOf(getMaxZoomLevel()), latLng);
        }
        MapConfig mapConfig = getMapConfig();
        if (latLng == null || latLng2 == null || !this.aw || this.H) {
            DPoint obtain = DPoint.obtain();
            GLMapState.geo2LonLat((int) mapConfig.getSX(), (int) mapConfig.getSY(), obtain);
            Pair<Float, LatLng> pair = new Pair<>(Float.valueOf(mapConfig.getSZ()), new LatLng(obtain.y, obtain.x));
            obtain.recycle();
            return pair;
        }
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        builder.include(latLng);
        builder.include(latLng2);
        GLMapState gLMapState = new GLMapState(1, this.f.getNativeInstance());
        Pair<Float, IPoint> a2 = du.a(mapConfig, i2, i3, i4, i5, builder.build(), getMapWidth(), getMapHeight());
        gLMapState.recycle();
        if (a2 == null) {
            return null;
        }
        DPoint obtain2 = DPoint.obtain();
        GLMapState.geo2LonLat(((IPoint) a2.second).x, ((IPoint) a2.second).y, obtain2);
        Pair<Float, LatLng> pair2 = new Pair<>(a2.first, new LatLng(obtain2.y, obtain2.x));
        obtain2.recycle();
        return pair2;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMaxZoomLevel(float f2) {
        this.b.setMaxZoomLevel(f2);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMinZoomLevel(float f2) {
        this.b.setMinZoomLevel(f2);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void resetMinMaxZoomPreference() {
        List a2;
        this.b.resetMinMaxZoomPreference();
        try {
            if (this.A.isZoomControlsEnabled() && this.b.isNeedUpdateZoomControllerState() && (a2 = this.v.a(AMapWidgetListener.class.hashCode())) != null && a2.size() > 0) {
                synchronized (a2) {
                    for (int i2 = 0; i2 < a2.size(); i2++) {
                        ((AMapWidgetListener) a2.get(i2)).invalidateZoomController(this.b.getSZ());
                    }
                }
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapStatusLimits(LatLngBounds latLngBounds) {
        try {
            this.b.setLimitLatLngBounds(latLngBounds);
            r();
        } catch (Throwable th) {
            th.printStackTrace();
            du.a(th);
        }
    }

    private static boolean a(LatLngBounds latLngBounds) {
        return (latLngBounds == null || latLngBounds.northeast == null || latLngBounds.southwest == null) ? false : true;
    }

    private void r() {
        try {
            LatLngBounds limitLatLngBounds = this.b.getLimitLatLngBounds();
            if (this.f != null && a(limitLatLngBounds)) {
                GLMapState gLMapState = new GLMapState(1, this.f.getNativeInstance());
                IPoint obtain = IPoint.obtain();
                GLMapState.lonlat2Geo(limitLatLngBounds.northeast.longitude, limitLatLngBounds.northeast.latitude, obtain);
                IPoint obtain2 = IPoint.obtain();
                GLMapState.lonlat2Geo(limitLatLngBounds.southwest.longitude, limitLatLngBounds.southwest.latitude, obtain2);
                this.b.setLimitIPoints(new IPoint[]{obtain, obtain2});
                gLMapState.recycle();
                return;
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
        this.b.setLimitIPoints(null);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final Handler getMainHandler() {
        return this.j;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onChangeFinish() {
        Message obtainMessage = this.j.obtainMessage();
        obtainMessage.what = 11;
        this.j.sendMessage(obtainMessage);
    }

    /* access modifiers changed from: protected */
    public final void a(CameraPosition cameraPosition) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null && mapConfig.getChangedCounter() != 0) {
            try {
                if (!this.au && this.f.getAnimateionsCount() == 0 && this.f.getStateMessageCount() == 0) {
                    if (this.w != null) {
                        this.w.onMapStable();
                    }
                    if (this.C.isEnabled()) {
                        try {
                            List<AMap.OnCameraChangeListener> a2 = this.v.a(AMap.OnCameraChangeListener.class.hashCode());
                            if (!(a2 == null || a2.size() == 0)) {
                                if (cameraPosition == null) {
                                    try {
                                        cameraPosition = getCameraPosition();
                                    } catch (Throwable th) {
                                        mk.c(th, "AMapDelegateImp", "cameraChangeFinish");
                                        th.printStackTrace();
                                    }
                                }
                                synchronized (a2) {
                                    for (AMap.OnCameraChangeListener onCameraChangeListener : a2) {
                                        onCameraChangeListener.onCameraChangeFinish(cameraPosition);
                                    }
                                }
                            }
                        } catch (Throwable unused) {
                        }
                        this.b.resetChangedCounter();
                    }
                }
            } catch (Throwable th2) {
                th2.printStackTrace();
                du.a(th2);
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setZoomScaleParam(float f2) {
        this.ar = f2;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onFling() {
        IGlOverlayLayer iGlOverlayLayer = this.E;
        if (iGlOverlayLayer != null) {
            iGlOverlayLayer.setFlingState(true);
        }
        this.U = true;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getMapWidth() {
        return this.g;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getMapHeight() {
        return this.h;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getCameraAngle() {
        return getCameraDegree(this.G);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getSkyHeight() {
        return this.b.getSkyHeight();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean isMaploaded() {
        return this.K;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final MapConfig getMapConfig() {
        return this.b;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final View getView() throws RemoteException {
        ef efVar = this.D;
        if (efVar != null) {
            return efVar.j();
        }
        return null;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onIndoorBuildingActivity(int i2, byte[] bArr) {
        ar arVar;
        if (bArr != null) {
            try {
                if (bArr.length > 0) {
                    arVar = new ar();
                    byte b2 = bArr[0];
                    arVar.a = new String(bArr, 1, b2, "utf-8");
                    int i3 = b2 + 1;
                    int i4 = i3 + 1;
                    byte b3 = bArr[i3];
                    arVar.b = new String(bArr, i4, b3, "utf-8");
                    int i5 = i4 + b3;
                    int i6 = i5 + 1;
                    byte b4 = bArr[i5];
                    arVar.activeFloorName = new String(bArr, i6, b4, "utf-8");
                    int i7 = i6 + b4;
                    arVar.activeFloorIndex = GLConvertUtil.getInt(bArr, i7);
                    int i8 = i7 + 4;
                    int i9 = i8 + 1;
                    byte b5 = bArr[i8];
                    arVar.poiid = new String(bArr, i9, b5, "utf-8");
                    int i10 = i9 + b5;
                    int i11 = i10 + 1;
                    byte b6 = bArr[i10];
                    arVar.h = new String(bArr, i11, b6, "utf-8");
                    int i12 = i11 + b6;
                    arVar.c = GLConvertUtil.getInt(bArr, i12);
                    int i13 = i12 + 4;
                    arVar.floor_indexs = new int[arVar.c];
                    arVar.floor_names = new String[arVar.c];
                    arVar.d = new String[arVar.c];
                    for (int i14 = 0; i14 < arVar.c; i14++) {
                        arVar.floor_indexs[i14] = GLConvertUtil.getInt(bArr, i13);
                        int i15 = i13 + 4;
                        int i16 = i15 + 1;
                        byte b7 = bArr[i15];
                        if (b7 > 0) {
                            arVar.floor_names[i14] = new String(bArr, i16, b7, "utf-8");
                            i16 += b7;
                        }
                        i13 = i16 + 1;
                        byte b8 = bArr[i16];
                        if (b8 > 0) {
                            arVar.d[i14] = new String(bArr, i13, b8, "utf-8");
                            i13 += b8;
                        }
                    }
                    arVar.e = GLConvertUtil.getInt(bArr, i13);
                    int i17 = i13 + 4;
                    if (arVar.e > 0) {
                        arVar.f = new int[arVar.e];
                        for (int i18 = 0; i18 < arVar.e; i18++) {
                            arVar.f[i18] = GLConvertUtil.getInt(bArr, i17);
                            i17 += 4;
                        }
                    }
                    this.bf = arVar;
                    post(new Runnable() {
                        /* class com.amap.api.col.p0003nsl.k.AnonymousClass31 */

                        public final void run() {
                            if (k.this.aE != null) {
                                k.this.aE.a(k.this.bf);
                            }
                        }
                    });
                }
            } catch (Throwable th) {
                du.a(th);
                th.printStackTrace();
                return;
            }
        }
        arVar = null;
        this.bf = arVar;
        post(new Runnable() {
            /* class com.amap.api.col.p0003nsl.k.AnonymousClass31 */

            public final void run() {
                if (k.this.aE != null) {
                    k.this.aE.a(k.this.bf);
                }
            }
        });
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void destroy() {
        this.H = true;
        dw.a(dv.c, "destroy map");
        try {
            if (this.M != null) {
                this.M.deactivate();
            }
            this.M = null;
            this.aE = null;
            if (this.an != null) {
                this.an.renderPause();
            }
            if (this.E != null) {
                this.E.destroy();
            }
            h();
            if (this.aa != null) {
                this.aa.interrupt();
                this.aa = null;
            }
            if (this.ab != null) {
                this.ab.interrupt();
                this.ab = null;
            }
            if (this.ak != null) {
                this.ak.a();
                this.ak = null;
            }
            if (this.al != null) {
                this.al.a((cr.a) null);
                this.al.a();
                this.al = null;
            }
            di.b();
            if (this.f != null) {
                this.f.setMapListener(null);
                this.f.releaseNetworkState();
                queueEvent(new Runnable() {
                    /* class com.amap.api.col.p0003nsl.k.AnonymousClass33 */

                    public final void run() {
                        try {
                            k.this.destroySurface(k.this.G);
                        } catch (Throwable th) {
                            th.printStackTrace();
                            du.a(th);
                        }
                    }
                });
                int i2 = 0;
                while (this.f != null) {
                    int i3 = i2 + 1;
                    if (i2 >= 50) {
                        break;
                    }
                    try {
                        Thread.sleep(20);
                    } catch (InterruptedException e2) {
                        du.a(e2);
                    }
                    i2 = i3;
                }
            }
            if (this.C != null) {
                try {
                    this.C.onDetachedGLThread();
                } catch (Exception e3) {
                    e3.printStackTrace();
                    du.a(e3);
                }
            }
            if (this.D != null) {
                this.D.g();
                this.D = null;
            }
            if (this.L != null) {
                this.L.c();
                this.L = null;
            }
            this.M = null;
            this.u = null;
            s();
            this.Z = null;
            dw.a();
            mk.b();
        } catch (Throwable th) {
            mk.c(th, "AMapDelegateImp", "destroy");
            du.a(th);
            th.printStackTrace();
        }
    }

    private void s() {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a();
        }
    }

    /* renamed from: com.amap.api.col.3nsl.k$c */
    /* compiled from: AMapDelegateImp */
    private class c implements ec.a {
        private c() {
        }

        /* synthetic */ c(k kVar, byte b) {
            this();
        }

        @Override // com.amap.api.col.p0003nsl.ec.a
        public final void a(int i) {
            if (k.this.c != null) {
                k.this.c.activeFloorIndex = k.this.c.floor_indexs[i];
                k.this.c.activeFloorName = k.this.c.floor_names[i];
                try {
                    k.this.setIndoorBuildingInfo(k.this.c);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.amap.api.col.3nsl.k$b */
    /* compiled from: AMapDelegateImp */
    public class b {
        b() {
        }

        public final void a(ar arVar) {
            List a2;
            List a3;
            if (k.this.b != null && k.this.b.isIndoorEnable()) {
                final ec e = k.this.D.e();
                float f = 20.0f;
                if (arVar == null) {
                    try {
                        List a4 = k.this.v.a(AMap.OnIndoorBuildingActiveListener.class.hashCode());
                        if (a4 != null && a4.size() > 0) {
                            synchronized (a4) {
                                for (int i = 0; i < a4.size(); i++) {
                                    ((AMap.OnIndoorBuildingActiveListener) a4.get(i)).OnIndoorBuilding(arVar);
                                }
                            }
                        }
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                    if (k.this.c != null) {
                        k.this.c.g = null;
                    }
                    if (e.b()) {
                        k.this.j.post(new Runnable() {
                            /* class com.amap.api.col.p0003nsl.k.b.AnonymousClass1 */

                            public final void run() {
                                e.a(false);
                            }
                        });
                    }
                    k.this.b.maxZoomLevel = k.this.b.isSetLimitZoomLevel() ? k.this.b.getMaxZoomLevel() : 20.0f;
                    try {
                        if (k.this.A.isZoomControlsEnabled() && (a3 = k.this.v.a(AMapWidgetListener.class.hashCode())) != null && a3.size() > 0) {
                            synchronized (a3) {
                                for (int i2 = 0; i2 < a3.size(); i2++) {
                                    ((AMapWidgetListener) a3.get(i2)).invalidateZoomController(k.this.b.getSZ());
                                }
                            }
                            return;
                        }
                        return;
                    } catch (Throwable th2) {
                        th2.printStackTrace();
                    }
                }
                if (arVar != null && arVar.floor_indexs != null && arVar.floor_names != null && arVar.floor_indexs.length == arVar.floor_names.length) {
                    int i3 = 0;
                    while (true) {
                        if (i3 >= arVar.floor_indexs.length) {
                            break;
                        } else if (arVar.activeFloorIndex == arVar.floor_indexs[i3]) {
                            arVar.activeFloorName = arVar.floor_names[i3];
                            break;
                        } else {
                            i3++;
                        }
                    }
                }
                if (arVar == null || k.this.c == null || k.this.c.activeFloorIndex == arVar.activeFloorIndex || !e.b()) {
                    if (arVar != null && (k.this.c == null || !k.this.c.poiid.equals(arVar.poiid) || k.this.c.g == null)) {
                        k.this.c = arVar;
                        if (k.this.b != null) {
                            if (k.this.c.g == null) {
                                k.this.c.g = new Point();
                            }
                            DPoint mapGeoCenter = k.this.b.getMapGeoCenter();
                            if (mapGeoCenter != null) {
                                k.this.c.g.x = (int) mapGeoCenter.x;
                                k.this.c.g.y = (int) mapGeoCenter.y;
                            }
                        }
                    }
                    try {
                        List a5 = k.this.v.a(AMap.OnIndoorBuildingActiveListener.class.hashCode());
                        if (a5 != null && a5.size() > 0) {
                            synchronized (a5) {
                                for (int i4 = 0; i4 < a5.size(); i4++) {
                                    ((AMap.OnIndoorBuildingActiveListener) a5.get(i4)).OnIndoorBuilding(arVar);
                                }
                            }
                        }
                        MapConfig mapConfig = k.this.b;
                        if (k.this.b.isSetLimitZoomLevel()) {
                            f = k.this.b.getMaxZoomLevel();
                        }
                        mapConfig.maxZoomLevel = f;
                        if (k.this.A.isZoomControlsEnabled() && (a2 = k.this.v.a(AMapWidgetListener.class.hashCode())) != null && a2.size() > 0) {
                            synchronized (a2) {
                                for (int i5 = 0; i5 < a2.size(); i5++) {
                                    ((AMapWidgetListener) a2.get(i5)).invalidateZoomController(k.this.b.getSZ());
                                }
                            }
                        }
                        if (k.this.A.isIndoorSwitchEnabled()) {
                            if (!e.b()) {
                                k.this.A.setIndoorSwitchEnabled(true);
                            }
                            k.this.j.post(new Runnable() {
                                /* class com.amap.api.col.p0003nsl.k.b.AnonymousClass2 */

                                public final void run() {
                                    try {
                                        e.a(k.this.c.floor_names);
                                        e.a(k.this.c.activeFloorName);
                                        if (!e.b()) {
                                            e.a(true);
                                        }
                                    } catch (Throwable th) {
                                        th.printStackTrace();
                                    }
                                }
                            });
                        } else if (!k.this.A.isIndoorSwitchEnabled() && e.b()) {
                            k.this.A.setIndoorSwitchEnabled(false);
                        }
                    } catch (Throwable th3) {
                        th3.printStackTrace();
                    }
                }
            }
        }
    }

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void beforeDrawLabel(int i2, GLMapState gLMapState) {
        k();
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.pushRendererState();
        }
        this.bc = this.E.draw(0, this.af, this.i) ? this.bc : this.bc + 1;
        GLMapEngine gLMapEngine2 = this.f;
        if (gLMapEngine2 != null) {
            gLMapEngine2.popRendererState();
        }
    }

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void afterDrawLabel(int i2, GLMapState gLMapState) {
        k();
        com.autonavi.extra.b bVar = this.aX;
        if (bVar != null) {
            bVar.e();
        }
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.pushRendererState();
        }
        this.bc = this.E.draw(1, this.af, this.i) ? this.bc : this.bc + 1;
        GLMapEngine gLMapEngine2 = this.f;
        if (gLMapEngine2 != null) {
            gLMapEngine2.popRendererState();
        }
    }

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void afterRendererOver(int i2, GLMapState gLMapState) {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.pushRendererState();
        }
        this.E.draw(2, this.af, this.i);
        GLMapEngine gLMapEngine2 = this.f;
        if (gLMapEngine2 != null) {
            gLMapEngine2.popRendererState();
        }
        CustomRenderer customRenderer = this.ag;
        if (customRenderer != null) {
            customRenderer.onDrawFrame(null);
        }
    }

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void afterDrawFrame(int i2, GLMapState gLMapState) {
        float mapZoomer = gLMapState.getMapZoomer();
        GLMapEngine gLMapEngine = this.f;
        if (!(gLMapEngine != null && (gLMapEngine.isInMapAction(i2) || this.f.isInMapAnimation(i2)))) {
            int i3 = this.ai;
            if (i3 != -1) {
                this.an.setRenderFps((float) i3);
            } else {
                this.an.setRenderFps(15.0f);
            }
            if (this.aq != mapZoomer) {
                this.aq = mapZoomer;
            }
        }
        if (!this.az) {
            this.az = true;
        }
    }

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void afterAnimation() {
        redrawInfoWindow();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final long createGLOverlay(int i2) {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.createOverlay(1, i2);
        }
        return 0;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final long getGlOverlayMgrPtr() {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getGlOverlayMgrPtr(1);
        }
        return 0;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final CrossOverlay addCrossVector(CrossOverlayOptions crossOverlayOptions) {
        if (crossOverlayOptions == null || crossOverlayOptions.getRes() == null) {
            return null;
        }
        final CrossVectorOverlay crossVectorOverlay = new CrossVectorOverlay(1, getContext(), this);
        if (crossOverlayOptions != null) {
            crossVectorOverlay.setAttribute(crossOverlayOptions.getAttribute());
        }
        if (this.f != null) {
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass34 */

                public final void run() {
                    k.this.f.getOverlayBundle(1).addOverlay(crossVectorOverlay);
                }
            });
            crossVectorOverlay.resumeMarker(crossOverlayOptions.getRes());
        }
        return new CrossOverlay(crossOverlayOptions, crossVectorOverlay);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void addOverlayTexture(int i2, GLTextureProperty gLTextureProperty) {
        GLOverlayBundle overlayBundle;
        try {
            if (this.f != null && (overlayBundle = this.f.getOverlayBundle(i2)) != null && gLTextureProperty != null) {
                if (gLTextureProperty.mBitmap != null) {
                    this.f.addOverlayTexture(i2, gLTextureProperty);
                    overlayBundle.addOverlayTextureItem(gLTextureProperty.mId, gLTextureProperty.mAnchor, gLTextureProperty.mXRatio, gLTextureProperty.mYRatio, gLTextureProperty.mBitmap.getWidth(), gLTextureProperty.mBitmap.getHeight());
                }
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCustomMapStylePath(String str) {
        if (!TextUtils.isEmpty(str) && !str.equals(this.b.getCustomStylePath())) {
            this.b.setCustomStylePath(str);
            this.B = true;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCustomMapStyleID(String str) {
        if (!TextUtils.isEmpty(str) && !str.equals(this.b.getCustomStyleID())) {
            this.b.setCustomStyleID(str);
            this.B = true;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCustomTextureResourcePath(String str) {
        if (!TextUtils.isEmpty(str)) {
            this.b.setCustomTextureResourcePath(str);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCustomMapStyle(CustomMapStyleOptions customMapStyleOptions) {
        if (customMapStyleOptions != null) {
            try {
                if (!a(true, false)) {
                    if (customMapStyleOptions.isEnable() && !(customMapStyleOptions.getStyleId() == null && customMapStyleOptions.getStyleTexturePath() == null && customMapStyleOptions.getStyleTextureData() == null && customMapStyleOptions.getStyleResDataPath() == null && customMapStyleOptions.getStyleResData() == null)) {
                        q();
                    }
                    this.aH.c();
                    this.aH.a(customMapStyleOptions);
                    if (this.aX != null) {
                        this.aX.i();
                    }
                } else {
                    return;
                }
            } catch (Throwable th) {
                du.a(th);
                return;
            }
        }
        resetRenderTime();
    }

    @Override // com.amap.api.col.p0003nsl.j.a
    public final void a() {
        com.autonavi.extra.b bVar = this.aX;
        if (bVar != null) {
            bVar.i();
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final MyLocationStyle getMyLocationStyle() throws RemoteException {
        ci ciVar = this.L;
        if (ciVar != null) {
            return ciVar.a();
        }
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void reloadMapCustomStyle() {
        j jVar = this.aH;
        if (jVar != null) {
            jVar.b();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setMapCustomEnable(boolean z2, boolean z3) {
        if (!this.aw || this.H) {
            this.aM.b = true;
            this.aM.c = z2;
            return;
        }
        boolean z4 = z3 ? z3 : false;
        if (!TextUtils.isEmpty(this.b.getCustomStylePath()) || !TextUtils.isEmpty(this.b.getCustomStyleID())) {
            if (z2) {
                try {
                    if (this.b.isProFunctionAuthEnable() && !TextUtils.isEmpty(this.b.getCustomStyleID()) && this.ak != null) {
                        this.ak.a(this.b.getCustomStyleID());
                        this.ak.b();
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                    du.a(th);
                    return;
                }
            }
            if (z3 || this.B || (this.b.isCustomStyleEnable() ^ z2)) {
                a(z2, (byte[]) null, z4);
            }
            this.B = false;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapCustomEnable(boolean z2) {
        if (z2) {
            q();
        }
        setMapCustomEnable(z2, false);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setCustomMapStyle(boolean z2, byte[] bArr) {
        a(z2, bArr, false);
    }

    private void a(boolean z2, byte[] bArr, boolean z3) {
        cx cxVar;
        try {
            this.b.setCustomStyleEnable(z2);
            boolean z4 = false;
            if (this.b.isHideLogoEnable()) {
                this.A.setLogoEnable(!z2);
            }
            if (z2) {
                c(1, true);
                cw cwVar = new cw();
                if (!(this.Z == null || this.Z.getTrafficRoadBackgroundColor() == -1)) {
                    cwVar.a(this.Z.getTrafficRoadBackgroundColor());
                }
                if (this.b.isProFunctionAuthEnable() && !TextUtils.isEmpty(this.b.getCustomTextureResourcePath())) {
                    z4 = true;
                }
                StyleItem[] styleItemArr = null;
                if (bArr != null) {
                    cxVar = cwVar.a(bArr, z4);
                    if (!(cxVar == null || (styleItemArr = cxVar.c()) == null)) {
                        this.b.setUseProFunction(true);
                    }
                } else {
                    cxVar = null;
                }
                if (styleItemArr == null && (cxVar = cwVar.a(this.b.getCustomStylePath(), z4)) != null) {
                    styleItemArr = cxVar.c();
                }
                if (cwVar.a() != 0) {
                    this.b.setCustomBackgroundColor(cwVar.a());
                }
                if (cxVar == null || cxVar.d() == null) {
                    a(styleItemArr, z3);
                } else if (this.al != null) {
                    this.al.a((String) cxVar.d());
                    this.al.a(cxVar);
                    this.al.b();
                }
            } else {
                c(1, false);
                a(1, this.b.getMapStyleMode(), this.b.getMapStyleTime(), this.b.getMapStyleState(), true, false, (StyleItem[]) null);
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.amap.api.col.p0003nsl.cr.a
    public final void a(String str, cx cxVar) {
        setCustomTextureResourcePath(str);
        if (this.b.isCustomStyleEnable() && cxVar != null) {
            a(cxVar.c(), false);
        }
    }

    private void a(StyleItem[] styleItemArr, boolean z2) {
        if (z2 || (styleItemArr != null && styleItemArr.length > 0)) {
            a(1, 0, 0, 0, true, true, styleItemArr);
            dr.a(this.e, true);
            return;
        }
        dr.a(this.e, false);
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void removeEngineGLOverlay(final BaseMapOverlay baseMapOverlay) {
        if (this.f != null) {
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003nsl.k.AnonymousClass35 */

                public final void run() {
                    k.this.f.getOverlayBundle(1).removeOverlay(baseMapOverlay);
                }
            });
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float[] getFinalMatrix() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getMvpMatrix();
        }
        return this.n;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final String createId(String str) {
        IGlOverlayLayer iGlOverlayLayer = this.E;
        if (iGlOverlayLayer != null) {
            return iGlOverlayLayer.createId(str);
        }
        return null;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showLogoEnabled(boolean z2) {
        if (!this.H) {
            this.D.f(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float[] getViewMatrix() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getViewMatrix();
        }
        return this.o;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float[] getProjectionMatrix() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.getProjectionMatrix();
        }
        return this.p;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void changeSurface(GL10 gl10, int i2, int i3) {
        try {
            changeSurface(1, gl10, i2, i3);
        } catch (Throwable th) {
            th.printStackTrace();
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void createSurface(GL10 gl10, EGLConfig eGLConfig) {
        try {
            this.am = Thread.currentThread().getId();
        } catch (Throwable th) {
            th.printStackTrace();
            du.a(th);
        }
        try {
            createSurface(1, gl10, eGLConfig);
        } catch (Throwable th2) {
            th2.printStackTrace();
            du.a(th2);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void renderSurface(GL10 gl10) {
        drawFrame(gl10);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean canStopMapRender() {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.canStopMapRender(1);
        }
        return true;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void getLatLngRect(DPoint[] dPointArr) {
        try {
            Rectangle geoRectangle = this.b.getGeoRectangle();
            if (geoRectangle != null) {
                IPoint[] clipRect = geoRectangle.getClipRect();
                for (int i2 = 0; i2 < 4; i2++) {
                    GLMapState.geo2LonLat(clipRect[i2].x, clipRect[i2].y, dPointArr[i2]);
                }
            }
        } catch (Throwable th) {
            du.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void checkMapState(IGLMapState iGLMapState) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null && !this.H) {
            LatLngBounds limitLatLngBounds = mapConfig.getLimitLatLngBounds();
            if (limitLatLngBounds != null) {
                try {
                    IPoint[] limitIPoints = this.b.getLimitIPoints();
                    if (limitIPoints == null) {
                        IPoint obtain = IPoint.obtain();
                        GLMapState.lonlat2Geo(limitLatLngBounds.northeast.longitude, limitLatLngBounds.northeast.latitude, obtain);
                        IPoint obtain2 = IPoint.obtain();
                        GLMapState.lonlat2Geo(limitLatLngBounds.southwest.longitude, limitLatLngBounds.southwest.latitude, obtain2);
                        IPoint[] iPointArr = {obtain, obtain2};
                        this.b.setLimitIPoints(iPointArr);
                        limitIPoints = iPointArr;
                    }
                    float a2 = du.a(this.b, limitIPoints[0].x, limitIPoints[0].y, limitIPoints[1].x, limitIPoints[1].y, getMapWidth(), getMapHeight());
                    float mapZoomer = iGLMapState.getMapZoomer();
                    if (this.b.isSetLimitZoomLevel()) {
                        float maxZoomLevel = this.b.getMaxZoomLevel();
                        float minZoomLevel = this.b.getMinZoomLevel();
                        float max = Math.max(a2, Math.min(mapZoomer, maxZoomLevel));
                        if (a2 <= maxZoomLevel) {
                            maxZoomLevel = max;
                        }
                        a2 = maxZoomLevel < minZoomLevel ? minZoomLevel : maxZoomLevel;
                    } else if (a2 <= 0.0f || mapZoomer >= a2) {
                        a2 = mapZoomer;
                    }
                    iGLMapState.setMapZoomer(a2);
                    IPoint obtain3 = IPoint.obtain();
                    iGLMapState.getMapGeoCenter(obtain3);
                    int[] a3 = du.a(limitIPoints[0].x, limitIPoints[0].y, limitIPoints[1].x, limitIPoints[1].y, this.b, iGLMapState, obtain3.x, obtain3.y);
                    iGLMapState.setMapGeoCenter((double) a3[0], (double) a3[1]);
                    obtain3.recycle();
                } catch (Throwable th) {
                    du.a(th);
                }
            } else if (this.b.isSetLimitZoomLevel()) {
                iGLMapState.setMapZoomer(Math.max(this.b.getMinZoomLevel(), Math.min(iGLMapState.getMapZoomer(), this.b.getMaxZoomLevel())));
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setRenderMode(int i2) {
        try {
            if (this.C != null) {
                this.C.setRenderMode(i2);
            }
        } catch (Throwable unused) {
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeSize(int i2, int i3) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            this.g = i2;
            this.h = i3;
            mapConfig.setMapWidth(i2);
            this.b.setMapHeight(i3);
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setHideLogoEnble(boolean z2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            mapConfig.setHideLogoEnble(z2);
            if (this.b.isCustomStyleEnable()) {
                this.A.setLogoEnable(!z2);
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeLogoIconStyle(String str, boolean z2, int i2) {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.a(str, Boolean.valueOf(z2), Integer.valueOf(i2));
        }
        ad adVar = this.A;
        if (adVar != null) {
            adVar.requestRefreshLogo();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void refreshLogo() {
        ef efVar = this.D;
        if (efVar != null) {
            efVar.c();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getUnitLengthByZoom(int i2) {
        GLMapState gLMapState = new GLMapState(1, this.f.getNativeInstance());
        gLMapState.setMapZoomer((float) i2);
        gLMapState.recalculate();
        float gLUnitWithWin = gLMapState.getGLUnitWithWin(1);
        gLMapState.recycle();
        return gLUnitWithWin;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setTouchPoiEnable(boolean z2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            mapConfig.setTouchPoiEnable(z2);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final boolean isTouchPoiEnable() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return mapConfig.isTouchPoiEnable();
        }
        return true;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getSY() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return (int) mapConfig.getSY();
        }
        return -1;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final int getSX() {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            return (int) mapConfig.getSX();
        }
        return -1;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final long getNativeMapController() {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getNativeMapController(1);
        }
        return 0;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnCameraChangeListener(AMap.OnCameraChangeListener onCameraChangeListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnCameraChangeListener.class.hashCode()), onCameraChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMapClickListener(AMap.OnMapClickListener onMapClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMapClickListener.class.hashCode()), onMapClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMarkerDragListener(AMap.OnMarkerDragListener onMarkerDragListener) {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMarkerDragListener.class.hashCode()), onMarkerDragListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMapLoadedListener(AMap.OnMapLoadedListener onMapLoadedListener) {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMapLoadedListener.class.hashCode()), onMapLoadedListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMapTouchListener(AMap.OnMapTouchListener onMapTouchListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMapTouchListener.class.hashCode()), onMapTouchListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMarkerClickListener(AMap.OnMarkerClickListener onMarkerClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMarkerClickListener.class.hashCode()), onMarkerClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnPolylineClickListener(AMap.OnPolylineClickListener onPolylineClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnPolylineClickListener.class.hashCode()), onPolylineClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnPOIClickListener(AMap.OnPOIClickListener onPOIClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnPOIClickListener.class.hashCode()), onPOIClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMapLongClickListener(AMap.OnMapLongClickListener onMapLongClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMapLongClickListener.class.hashCode()), onMapLongClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnInfoWindowClickListener(AMap.OnInfoWindowClickListener onInfoWindowClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnInfoWindowClickListener.class.hashCode()), onInfoWindowClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnIndoorBuildingActiveListener(AMap.OnIndoorBuildingActiveListener onIndoorBuildingActiveListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnIndoorBuildingActiveListener.class.hashCode()), onIndoorBuildingActiveListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void addOnMyLocationChangeListener(AMap.OnMyLocationChangeListener onMyLocationChangeListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.a(Integer.valueOf(AMap.OnMyLocationChangeListener.class.hashCode()), onMyLocationChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnCameraChangeListener(AMap.OnCameraChangeListener onCameraChangeListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnCameraChangeListener.class.hashCode()), onCameraChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMapClickListener(AMap.OnMapClickListener onMapClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMapClickListener.class.hashCode()), onMapClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMarkerDragListener(AMap.OnMarkerDragListener onMarkerDragListener) {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMarkerDragListener.class.hashCode()), onMarkerDragListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMapLoadedListener(AMap.OnMapLoadedListener onMapLoadedListener) {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMapLoadedListener.class.hashCode()), onMapLoadedListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMapTouchListener(AMap.OnMapTouchListener onMapTouchListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMapTouchListener.class.hashCode()), onMapTouchListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMarkerClickListener(AMap.OnMarkerClickListener onMarkerClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMarkerClickListener.class.hashCode()), onMarkerClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnPolylineClickListener(AMap.OnPolylineClickListener onPolylineClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnPolylineClickListener.class.hashCode()), onPolylineClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnPOIClickListener(AMap.OnPOIClickListener onPOIClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnPOIClickListener.class.hashCode()), onPOIClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMapLongClickListener(AMap.OnMapLongClickListener onMapLongClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMapLongClickListener.class.hashCode()), onMapLongClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnInfoWindowClickListener(AMap.OnInfoWindowClickListener onInfoWindowClickListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnInfoWindowClickListener.class.hashCode()), onInfoWindowClickListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnIndoorBuildingActiveListener(AMap.OnIndoorBuildingActiveListener onIndoorBuildingActiveListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnIndoorBuildingActiveListener.class.hashCode()), onIndoorBuildingActiveListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMyLocationChangeListener(AMap.OnMyLocationChangeListener onMyLocationChangeListener) throws RemoteException {
        p pVar = this.v;
        if (pVar != null) {
            pVar.b(Integer.valueOf(AMap.OnMyLocationChangeListener.class.hashCode()), onMyLocationChangeListener);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void loadWorldVectorMap(boolean z2) {
        MapConfig mapConfig = this.b;
        if (mapConfig != null) {
            mapConfig.setAbroadEnable(z2);
        }
    }

    private boolean a(boolean z2, boolean z3) {
        if (z2) {
            if (this.bb) {
                da.b();
                return true;
            }
            this.ba = true;
        }
        if (!z3) {
            return false;
        }
        if (this.ba) {
            da.b();
            return true;
        }
        this.bb = true;
        return false;
    }

    private void t() {
        cn cnVar = this.aF;
        if (cnVar != null) {
            cnVar.a();
            this.aF = null;
        }
    }
}