汇多多.apk(点击下载) / b.java


package com.amap.api.col.p0003s;

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.Log;
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.p0003s.a;
import com.amap.api.col.p0003s.ci;
import com.amap.api.col.p0003s.dt;
import com.amap.api.col.p0003s.hn;
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.HeatMapGridLayer;
import com.amap.api.maps.model.HeatMapGridLayerOptions;
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.MVTTileOverlay;
import com.amap.api.maps.model.MVTTileOverlayOptions;
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 com.taobao.weex.common.Constants;
import com.taobao.weex.el.parse.Operators;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
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.3s.b  reason: invalid package */
/* compiled from: AMapDelegateImp */
public final class b implements a.AbstractC0000a, ci.a, IAMapDelegate, IAMapListener {
    private boolean A;
    private final IGLSurfaceView B;
    private dw C;
    private final IGlOverlayLayer D;
    private boolean E;
    private int F;
    private AtomicBoolean G;
    private boolean H;
    private boolean I;
    private boolean J;
    private bz K;
    private LocationSource L;
    private boolean M;
    private Marker N;
    private BaseOverlayImp O;
    private Marker P;
    private boolean Q;
    private boolean R;
    private boolean S;
    private boolean T;
    private boolean U;
    private boolean V;
    private Rect W;
    private int X;
    private MyTrafficStyle Y;
    private Thread Z;
    protected boolean a;
    private int aA;
    private int aB;
    private C0001b aC;
    private ce aD;
    private AMap.OnMultiPointClickListener aE;
    private a aF;
    private long aG;
    private a aH;
    private a 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 Runnable aT;
    private a aU;
    private com.autonavi.extra.b aV;
    private String aW;
    private String aX;
    private boolean aY;
    private boolean aZ;
    private Thread aa;
    private boolean ab;
    private boolean ac;
    private int ad;
    private CustomRenderer ae;
    private int af;
    private int ag;
    private List<q> ah;
    private cg ai;
    private ci aj;
    private long ak;
    private GLMapRender al;
    private n am;
    private boolean an;
    private float ao;
    private float ap;
    private float aq;
    private boolean ar;
    private boolean as;
    private boolean at;
    private volatile boolean au;
    private volatile boolean av;
    private boolean aw;
    private boolean ax;
    private Lock ay;
    private int az;
    protected MapConfig b;
    private int ba;
    private EAMapPlatformGestureInfo bb;
    private long bc;
    private ai bd;
    private IPoint[] be;
    protected ai c;
    dc d;
    protected Context e;
    protected GLMapEngine f;
    public int g;
    public int h;
    boolean i;
    protected final Handler j;
    Point k;
    protected String l;
    float[] m;
    float[] n;
    float[] o;
    float[] p;
    String q;
    String r;
    int s;
    private f t;
    private g u;
    private AMapGestureListener v;
    private aj w;
    private UiSettings x;
    private IProjectionDelegate y;
    private final u 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 {
            g gVar = this.u;
            if (gVar != null) {
                gVar.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.V) {
                this.V = c2;
                b(this.F, c2);
            }
        } else if (!this.V) {
            this.V = true;
            b(this.F, 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 !de.a(mapConfig.getGeoRectangle().getClipRect());
        } catch (Throwable th) {
            th.printStackTrace();
            dl.a(th);
            return false;
        }
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onActivityPause() {
        this.H = true;
        c(this.F);
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onActivityResume() {
        this.H = false;
        d(this.F);
    }

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

    /* access modifiers changed from: private */
    /* renamed from: com.amap.api.col.3s.b$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 b(IGLSurfaceView iGLSurfaceView, Context context) {
        this(iGLSurfaceView, context, false);
    }

    public b(IGLSurfaceView iGLSurfaceView, Context context, boolean z2) {
        this.t = null;
        this.u = new g();
        this.a = false;
        this.A = false;
        this.E = false;
        this.G = new AtomicBoolean(false);
        this.H = false;
        this.b = new MapConfig(true);
        this.I = false;
        this.J = false;
        this.M = false;
        this.N = null;
        this.O = null;
        this.P = null;
        this.Q = false;
        this.R = false;
        this.S = false;
        this.T = false;
        this.U = false;
        this.V = true;
        this.W = new Rect();
        this.X = 1;
        this.Y = null;
        this.ab = false;
        this.ac = false;
        this.ad = 0;
        this.af = -1;
        this.ag = -1;
        this.ah = new ArrayList();
        this.d = null;
        this.ak = -1;
        this.an = false;
        this.ao = 0.0f;
        this.ap = 1.0f;
        this.aq = 1.0f;
        this.ar = true;
        this.as = false;
        this.at = false;
        this.au = false;
        this.av = false;
        this.aw = false;
        this.ax = false;
        this.ay = new ReentrantLock();
        this.az = 0;
        this.i = true;
        this.j = new Handler(Looper.getMainLooper()) {
            /* class com.amap.api.col.p0003s.b.AnonymousClass1 */

            public final void handleMessage(Message message) {
                if (message != null && !b.this.G.get()) {
                    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 = b.this.u.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) {
                                        dl.a(th);
                                    }
                                    b.this.b.addChangedCounter();
                                    return;
                                case 11:
                                    try {
                                        CameraPosition cameraPosition2 = b.this.getCameraPosition();
                                        if (!(cameraPosition2 == null || b.this.C == null)) {
                                            b.this.C.a(cameraPosition2);
                                        }
                                        b.this.b((b) cameraPosition2);
                                        if (b.this.at) {
                                            b.this.at = false;
                                            if (b.this.D != null) {
                                                b.this.D.setFlingState(false);
                                            }
                                            b.this.b();
                                        }
                                        if (b.this.T) {
                                            b.this.redrawInfoWindow();
                                            b.this.T = false;
                                        }
                                        b.this.a(cameraPosition2);
                                        return;
                                    } catch (Throwable th2) {
                                        il.c(th2, "AMapDelegateImp", "CameraUpdateFinish");
                                        dl.a(th2);
                                        return;
                                    }
                                case 12:
                                    if (b.this.C != null) {
                                        b.this.C.a(Float.valueOf(b.this.getZoomLevel()));
                                        return;
                                    }
                                    return;
                                case 13:
                                    if (b.this.C != null) {
                                        b.this.C.h();
                                        return;
                                    }
                                    return;
                                case 14:
                                    try {
                                        List<AMap.OnMapTouchListener> a3 = b.this.u.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) {
                                        il.c(th3, "AMapDelegateImp", "onTouchHandler");
                                        th3.printStackTrace();
                                        return;
                                    }
                                case 15:
                                    Bitmap bitmap = (Bitmap) message.obj;
                                    int i3 = message.arg1;
                                    ArrayList arrayList = null;
                                    if (bitmap == null || b.this.C == null) {
                                        try {
                                            List a4 = b.this.u.a(AMap.onMapPrintScreenListener.class.hashCode());
                                            ArrayList arrayList2 = a4 != null ? new ArrayList(a4) : null;
                                            List a5 = b.this.u.a(AMap.OnMapScreenShotListener.class.hashCode());
                                            ArrayList arrayList3 = a5 != null ? new ArrayList(a5) : null;
                                            b.this.u.a(Integer.valueOf(AMap.onMapPrintScreenListener.class.hashCode()));
                                            b.this.u.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);
                                        dz f = b.this.C.f();
                                        if (f != null) {
                                            f.onDraw(canvas);
                                        }
                                        b.this.C.a(canvas);
                                        try {
                                            List a6 = b.this.u.a(AMap.onMapPrintScreenListener.class.hashCode());
                                            ArrayList arrayList4 = a6 != null ? new ArrayList(a6) : null;
                                            List a7 = b.this.u.a(AMap.OnMapScreenShotListener.class.hashCode());
                                            if (a7 != null) {
                                                arrayList = new ArrayList(a7);
                                            }
                                            b.this.u.a(Integer.valueOf(AMap.onMapPrintScreenListener.class.hashCode()));
                                            b.this.u.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(b.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 = b.this.u.a(AMap.OnMapLoadedListener.class.hashCode());
                                        if (a8 != null) {
                                            synchronized (a8) {
                                                while (i2 < a8.size()) {
                                                    ((AMap.OnMapLoadedListener) a8.get(i2)).onMapLoaded();
                                                    i2++;
                                                }
                                            }
                                        }
                                    } catch (Throwable th6) {
                                        il.c(th6, "AMapDelegateImp", "onMapLoaded");
                                        th6.printStackTrace();
                                        dl.a(th6);
                                    }
                                    if (b.this.C != null) {
                                        b.this.C.i();
                                        return;
                                    }
                                    return;
                                case 17:
                                    if (b.this.f.isInMapAnimation(b.this.F) && b.this.D != null) {
                                        b.this.D.setFlingState(false);
                                        return;
                                    }
                                    return;
                                case 18:
                                    if (b.this.w != null) {
                                        b.this.w.b();
                                        return;
                                    }
                                    return;
                                case 19:
                                    List<AMap.OnMapClickListener> a9 = b.this.u.a(AMap.OnMapClickListener.class.hashCode());
                                    if (a9 != null) {
                                        DPoint obtain = DPoint.obtain();
                                        b.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) {
                                            il.c(th7, "AMapDelegateImp", "OnMapClickListener.onMapClick");
                                            th7.printStackTrace();
                                            return;
                                        }
                                    } else {
                                        return;
                                    }
                                case 20:
                                    try {
                                        List a10 = b.this.u.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) {
                                        il.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(hf.b);
                            }
                            sb.append(Operators.ARRAY_END_STR);
                            Log.w("amapsdk", sb.toString());
                        }
                    } catch (Throwable th9) {
                        il.c(th9, "AMapDelegateImp", "handleMessage");
                        th9.printStackTrace();
                    }
                }
            }
        };
        this.aH = new a() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass11 */

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

            @Override // com.amap.api.col.p0003s.b.a
            public final void run() {
                super.run();
                try {
                    b bVar = b.this;
                    bVar.setCenterToPixel(bVar.aA, b.this.aB);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
        };
        this.aJ = new a() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass32 */

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

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

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

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

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

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

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

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

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

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

            public final void run() {
                dz f;
                if (b.this.C != null && (f = b.this.C.f()) != null) {
                    f.c();
                }
            }
        };
        this.aU = new a() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass7 */

            @Override // com.amap.api.col.p0003s.b.a
            public final void run() {
                super.run();
                b.this.c(this.g, this.c);
            }
        };
        this.aW = "";
        this.aX = "";
        this.aY = false;
        this.aZ = false;
        this.ba = 0;
        this.bb = new EAMapPlatformGestureInfo();
        this.k = new Point();
        this.bc = 0;
        this.l = null;
        this.bd = null;
        this.m = new float[16];
        this.n = new float[16];
        this.o = new float[16];
        this.be = null;
        this.p = new float[12];
        this.q = "precision highp float;\nattribute vec3 aVertex;//顶点数组,三维坐标\nuniform mat4 aMVPMatrix;//mvp矩阵\nvoid main(){\n  gl_Position = aMVPMatrix * vec4(aVertex, 1.0);\n}";
        this.r = "//有颜色 没有纹理\nprecision highp float;\nvoid main(){\n  gl_FragColor = vec4(1.0,0,0,1.0);\n}";
        this.s = -1;
        this.e = context;
        ho a2 = hn.a(context, dl.a());
        if (a2.a == hn.c.SuccessCode) {
            dn.a(context);
            dn.a(dm.c, "init map delegate");
        }
        com.autonavi.extra.b bVar = new com.autonavi.extra.b();
        this.aV = bVar;
        bVar.a();
        this.aV.b();
        il.a(this.e);
        cz.a().a(this.e);
        l.b = he.c(context);
        cq.a(this.e);
        this.am = new n(this);
        GLMapRender gLMapRender = new GLMapRender(this);
        this.al = gLMapRender;
        this.B = iGLSurfaceView;
        iGLSurfaceView.setRenderer(gLMapRender);
        o oVar = new o(this, this.e);
        this.D = oVar;
        this.f = new GLMapEngine(this.e, this);
        this.C = new dv(this.e, this, oVar);
        this.z = new u(this);
        this.C.a(new c(this, (byte) 0));
        this.aC = new C0001b();
        iGLSurfaceView.setRenderMode(0);
        this.al.setRenderFps(15.0f);
        this.f.setMapListener(this);
        this.y = new r(this);
        this.t = new f(this);
        aj ajVar = new aj(this.e);
        this.w = ajVar;
        ajVar.a(this.C);
        this.w.b(new cb(oVar, context));
        this.Z = new j(this.e, this);
        this.L = new ak(this.e);
        this.ai = new cg(this.e, this);
        ci ciVar = new ci(this.e);
        this.aj = ciVar;
        ciVar.a(this);
        a(z2);
        MapConfig mapConfig = this.b;
        a aVar = new a(this, this.e, mapConfig != null ? mapConfig.isAbroadEnable() : false);
        this.aF = aVar;
        aVar.a(this);
        if (a2.a != hn.c.SuccessCode) {
            this.b.setMapEnable(false);
        }
        this.F = this.f.getEngineIDWithType(1);
    }

    private void a(boolean z2) {
        com.autonavi.extra.b bVar = this.aV;
        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.aV.j();
            if (j3 != null && (j3 instanceof Boolean)) {
                this.C.a(((Boolean) j3).booleanValue());
            }
            Object j4 = this.aV.j();
            if (j3 != null && (j3 instanceof Integer)) {
                this.ad = ((Integer) j4).intValue();
            }
        }
    }

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

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

    @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.az == 0 || i3 != 5) {
            this.az = 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.au || ((float) ((int) c())) >= this.b.getMaxZoomLevel()) {
            return false;
        }
        try {
            if (this.I || this.z.isZoomInByScreenCenter()) {
                abstractCameraUpdateMessage = z.a(1.0f, (Point) null);
            } else {
                this.k.x = i2;
                this.k.y = i3;
                abstractCameraUpdateMessage = z.a(1.0f, this.k);
            }
            animateCamera(abstractCameraUpdateMessage);
        } catch (Throwable th) {
            il.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.au && ((float) ((int) c())) > this.b.getMinZoomLevel()) {
            try {
                animateCamera(z.b());
            } catch (Throwable th) {
                il.c(th, "AMapDelegateImp", "onDoubleTap");
                th.printStackTrace();
            }
            resetRenderTime();
        }
    }

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

    private void d() {
        if (this.au) {
            this.am.a();
            this.an = true;
            this.as = true;
            try {
                stopAnimation();
            } catch (RemoteException unused) {
            }
        }
    }

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

    private void a(MotionEvent motionEvent) throws RemoteException {
        if (this.M && this.P != null) {
            int x2 = (int) motionEvent.getX();
            int y2 = (int) (motionEvent.getY() - 60.0f);
            if (this.P.getPosition() != null) {
                DPoint obtain = DPoint.obtain();
                getPixel2LatLng(x2, y2, obtain);
                LatLng latLng = new LatLng(obtain.y, obtain.x);
                obtain.recycle();
                this.P.setPosition(latLng);
                try {
                    List a2 = this.u.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.P);
                            }
                        }
                    }
                } catch (Throwable unused) {
                }
            }
        }
    }

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showMyLocationOverlay(Location location) throws RemoteException {
        if (location != null) {
            try {
                if (this.E) {
                    if (this.L != null) {
                        if (this.K == null) {
                            this.K = new bz(this, this.e);
                        }
                        if (!(location.getLongitude() == 0.0d || location.getLatitude() == 0.0d)) {
                            this.K.a(location);
                        }
                        List a2 = this.u.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;
                    }
                }
                bz bzVar = this.K;
                if (bzVar != null) {
                    bzVar.c();
                }
                this.K = null;
            } catch (Throwable th) {
                il.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.D.removeOverlay(str);
    }

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float checkZoomLevel(float f2) throws RemoteException {
        return dl.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.z;
    }

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final AMap.OnCameraChangeListener getOnCameraChangeListener() throws RemoteException {
        try {
            List a2 = this.u.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 {
        aj ajVar;
        if (baseOverlayImp != null && (ajVar = this.w) != null) {
            try {
                ajVar.a(baseOverlayImp);
            } catch (RemoteException e2) {
                e2.printStackTrace();
            }
        }
    }

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void hideInfoWindow() {
        aj ajVar = this.w;
        if (ajVar != null) {
            ajVar.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.G.get() && this.au && (gLMapEngine = this.f) != null && (mapState = gLMapEngine.getMapState(this.F)) != 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.au && 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.G.get() && this.au && 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(this.F);
                    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.G.get() && this.au && (gLMapEngine = this.f) != null && (mapState = gLMapEngine.getMapState(this.F)) != null) {
            mapState.screenToP20Point(i2, i3, iPoint);
        }
    }

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

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showZoomControlsEnabled(boolean z2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.b(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showIndoorSwitchControlsEnabled(boolean z2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.a(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showMyLocationButtonEnabled(boolean z2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.c(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showCompassEnabled(boolean z2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.d(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void showScaleEnabled(boolean z2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.e(Boolean.valueOf(z2));
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setZoomPosition(int i2) {
        dw dwVar;
        if (!this.G.get() && (dwVar = this.C) != null) {
            dwVar.a(Integer.valueOf(i2));
        }
    }

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

    @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.G.get()) {
            return null;
        }
        float a2 = dl.a(this.b, f2);
        GLMapState gLMapState = new GLMapState(this.F, 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.al.setRenderFps(15.0f);
            this.B.setRenderMode(0);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            if (iGlOverlayLayer != null) {
                iGlOverlayLayer.setFlingState(true);
            }
            bz bzVar = this.K;
            if (bzVar != null) {
                bzVar.b();
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

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

    private void f() {
        GLMapState gLMapState;
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null && (gLMapState = (GLMapState) gLMapEngine.getNewMapState(this.F)) != 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.H || !this.au || !this.ar) {
            return false;
        }
        this.bb.mGestureState = 3;
        this.bb.mGestureType = 8;
        EAMapPlatformGestureInfo eAMapPlatformGestureInfo = this.bb;
        eAMapPlatformGestureInfo.mLocation = new float[]{motionEvent.getX(), motionEvent.getY()};
        getEngineIDWithGestureInfo(this.bb);
        l();
        int action = motionEvent.getAction() & 255;
        if (action == 0) {
            m();
            d();
        } else if (action == 1) {
            e();
        }
        if (motionEvent.getAction() != 2 || !this.M) {
            if (this.an) {
                try {
                    this.am.a(motionEvent);
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            }
            try {
                List a2 = this.u.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) {
            il.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.au && !this.H && 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.au || this.H || (gLMapEngine = this.f) == null) {
            return 0.0f;
        }
        return gLMapEngine.getMapState(this.F).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.au || this.H || 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.I;
    }

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

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

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

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

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

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

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

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

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

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void post(Runnable runnable) {
        IGLSurfaceView iGLSurfaceView = this.B;
        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.Q = false;
            b(i2);
            BaseOverlay hitBaseOverlay = this.D.getHitBaseOverlay(motionEvent, 1);
            if (hitBaseOverlay instanceof Marker) {
                this.P = (Marker) hitBaseOverlay;
            }
            Marker marker = this.P;
            if (marker == null || !marker.isDraggable()) {
                List a2 = this.u.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.R = true;
                    obtain.recycle();
                }
            } else {
                LatLng position = this.P.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.P.setPosition(new LatLng(obtain3.y, obtain3.x));
                    this.D.set2Top(this.P.getId());
                    try {
                        List a3 = this.u.a(AMap.OnMarkerDragListener.class.hashCode());
                        if (a3 != null && a3.size() > 0) {
                            synchronized (a3) {
                                while (i3 < a3.size()) {
                                    ((AMap.OnMarkerDragListener) a3.get(i3)).onMarkerDragStart(this.P);
                                    i3++;
                                }
                            }
                        }
                    } catch (Throwable th) {
                        il.c(th, "AMapDelegateImp", "onMarkerDragStart");
                        th.printStackTrace();
                    }
                    this.M = true;
                    obtain2.recycle();
                    obtain3.recycle();
                }
            }
            this.al.resetTickCount(30);
        } catch (Throwable th2) {
            il.c(th2, "AMapDelegateImp", "onLongPress");
            th2.printStackTrace();
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final boolean onDoubleTap(int i2, MotionEvent motionEvent) {
        if (!this.au) {
            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.au) {
            return false;
        }
        try {
            b(i2);
            if (g(motionEvent) || e(motionEvent) || f(motionEvent)) {
                return true;
            }
            d(motionEvent);
            b(motionEvent);
            return true;
        } catch (Throwable th) {
            il.c(th, "AMapDelegateImp", "onSingleTapUp");
            th.printStackTrace();
            return true;
        }
    }

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

            public final void run() {
                try {
                    Message obtain = Message.obtain();
                    Poi poi = null;
                    if (b.this.b != null && b.this.b.isTouchPoiEnable()) {
                        poi = b.this.b((b) ((int) motionEvent.getX()), (int) motionEvent.getY());
                    }
                    List a2 = b.this.u.a(AMap.OnPOIClickListener.class.hashCode());
                    if (a2 == null || a2.size() <= 0 || poi == null) {
                        b.this.c((b) motionEvent);
                        return;
                    }
                    obtain.what = 20;
                    obtain.obj = poi;
                    b.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.p0003s.b.AnonymousClass9 */

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

    private boolean d(MotionEvent motionEvent) {
        try {
            List<AMap.OnPolylineClickListener> a2 = this.u.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.D.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.D.getHitBaseOverlay(latLng, 1);
        if ((hitBaseOverlay instanceof Marker) && ((Marker) hitBaseOverlay).getId().contains("MARKER")) {
            try {
                Marker marker = (Marker) hitBaseOverlay;
                this.D.set2Top(marker.getId());
                List<AMap.OnMarkerClickListener> a2 = this.u.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.D.showInfoWindow(marker.getId());
                if (!marker.isViewMode() && (position = marker.getPosition()) != null) {
                    IPoint obtain2 = IPoint.obtain();
                    latlon2Geo(position.latitude, position.longitude, obtain2);
                    moveCamera(z.a(obtain2));
                }
                return z2;
            } catch (Throwable th) {
                il.c(th, "AMapDelegateImp", "onMarkerTap");
                th.printStackTrace();
            }
        }
        return false;
    }

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

    private boolean g(MotionEvent motionEvent) throws RemoteException {
        try {
            List a2 = this.u.a(AMap.OnInfoWindowClickListener.class.hashCode());
            BaseOverlay a3 = this.w.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);
                    }
                }
                return true;
            }
        } catch (Throwable unused) {
        }
        return false;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void drawFrame(GL10 gl10) {
        if (!this.G.get() && this.f != null && EGL14.eglGetCurrentContext() != EGL14.EGL_NO_CONTEXT) {
            MapConfig mapConfig = this.b;
            if (mapConfig == null || mapConfig.isMapEnable()) {
                a(this.F);
                this.f.renderAMap();
                this.f.pushRendererState();
                a aVar = this.aF;
                if (aVar != null) {
                    aVar.a();
                }
                i();
                k();
                if (!this.aw) {
                    this.aw = true;
                }
                this.f.popRendererState();
                if (dc.a()) {
                    try {
                        if (this.B instanceof e) {
                            if (this.d == null) {
                                this.d = new dc();
                            }
                            this.d.e();
                            if (this.d.f() && !this.d.d()) {
                                if (this.d.a(((e) this.B).getBitmap())) {
                                    if (dc.b()) {
                                        removecache();
                                    }
                                    if (dc.c()) {
                                        dc.g();
                                    }
                                    dn.b(dm.g, "pure screen: found pure check");
                                }
                            }
                        }
                    } catch (Throwable th) {
                        il.c(th, "AMapDelegateImp", "PureScreenCheckTool.checkBlackScreen");
                    }
                }
            } else {
                GLES20.glClear(16640);
            }
        }
    }

    private void a(int i2) {
        int i3 = this.ag;
        if (i3 != -1) {
            this.al.setRenderFps((float) i3);
            resetRenderTime();
        } else if (this.f.isInMapAction(i2) || this.as) {
            this.al.setRenderFps(40.0f);
        } else if (this.f.isInMapAnimation(i2)) {
            this.al.setRenderFps(30.0f);
            this.al.resetTickCount(15);
        } else {
            this.al.setRenderFps(15.0f);
        }
        if (this.b.isWorldMapEnable() != MapsInitializer.isLoadWorldGridMap()) {
            b();
            this.b.setWorldMapEnable(MapsInitializer.isLoadWorldGridMap());
        }
    }

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

    private void j() {
        GLMapState mapState;
        List a2;
        List a3;
        List a4;
        if (!this.G.get() && (mapState = this.f.getMapState(this.F)) != 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);
                boolean z2 = true;
                this.at = true;
                redrawInfoWindow();
                try {
                    if (this.z.isZoomControlsEnabled() && this.b.isNeedUpdateZoomControllerState() && (a4 = this.u.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.z.isCompassEnabled() || (!this.b.isTiltChanged() && !this.b.isBearingChanged())) {
                        z2 = false;
                    }
                    if (z2 && (a3 = this.u.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.z.isScaleControlsEnabled() && (a2 = this.u.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.as && this.f.getAnimateionsCount() == 0 && this.f.getStateMessageCount() == 0) {
                onChangeFinish();
            }
        }
    }

    private void k() {
        if (!this.J) {
            this.j.sendEmptyMessage(16);
            this.J = true;
            b();
        }
        long j2 = this.bc;
        if (j2 < 2) {
            this.bc = j2 + 1;
            return;
        }
        final dr d2 = this.C.d();
        if (d2 != null && d2.getVisibility() != 8) {
            di.a(this.e, System.currentTimeMillis() - this.aG);
            this.j.post(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass10 */

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

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

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

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

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private Poi b(int i2, int i3) {
        if (!this.au) {
            return null;
        }
        try {
            ArrayList<MapLabelItem> a2 = a(this.F, i2, i3);
            MapLabelItem mapLabelItem = (a2 == null || a2.size() <= 0) ? null : a2.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> a(int i2, int i3, int i4) {
        if (!this.au) {
            return null;
        }
        ArrayList<MapLabelItem> arrayList = new ArrayList<>();
        byte[] labelBuffer = this.f.getLabelBuffer(i2, i3, i4, 25);
        if (labelBuffer == null) {
            return null;
        }
        int i5 = GLConvertUtil.getInt(labelBuffer, 0) > 0 ? 1 : 0;
        int i6 = 0;
        int i7 = 4;
        while (i6 < i5) {
            MapLabelItem mapLabelItem = new MapLabelItem();
            int i8 = GLConvertUtil.getInt(labelBuffer, i7);
            int i9 = i7 + 4;
            int i10 = GLConvertUtil.getInt(labelBuffer, i9);
            int i11 = i9 + 4;
            mapLabelItem.x = i8;
            mapLabelItem.y = this.B.getHeight() - i10;
            mapLabelItem.pixel20X = GLConvertUtil.getInt(labelBuffer, i11);
            int i12 = i11 + 4;
            mapLabelItem.pixel20Y = GLConvertUtil.getInt(labelBuffer, i12);
            int i13 = i12 + 4;
            mapLabelItem.pixel20Z = GLConvertUtil.getInt(labelBuffer, i13);
            int i14 = i13 + 4;
            mapLabelItem.type = GLConvertUtil.getInt(labelBuffer, i14);
            int i15 = i14 + 4;
            mapLabelItem.mSublayerId = GLConvertUtil.getInt(labelBuffer, i15);
            int i16 = i15 + 4;
            mapLabelItem.timeStamp = GLConvertUtil.getInt(labelBuffer, i16);
            int i17 = i16 + 4;
            mapLabelItem.mIsFouces = labelBuffer[i17] != 0;
            int i18 = i17 + 1;
            if (labelBuffer[i18] == 0) {
                mapLabelItem.poiid = null;
            } else {
                String str = "";
                for (int i19 = 0; i19 < 20; i19++) {
                    int i20 = i19 + i18;
                    if (labelBuffer[i20] == 0) {
                        break;
                    }
                    str = str + ((char) labelBuffer[i20]);
                }
                mapLabelItem.poiid = str;
            }
            int i21 = i18 + 20;
            int i22 = i21 + 1;
            byte b2 = labelBuffer[i21];
            StringBuffer stringBuffer = new StringBuffer();
            for (int i23 = 0; i23 < b2; i23++) {
                stringBuffer.append((char) GLConvertUtil.getShort(labelBuffer, i22));
                i22 += 2;
            }
            mapLabelItem.name = stringBuffer.toString();
            arrayList.add(mapLabelItem);
            i6++;
            i7 = i22;
        }
        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.au && this.f != null) {
            try {
                abstractGestureMapMessage.isUseAnchor = this.I;
                abstractGestureMapMessage.anchorX = this.b.getAnchorX();
                abstractGestureMapMessage.anchorY = this.b.getAnchorY();
                this.f.addGestureMessage(i2, abstractGestureMapMessage, this.z.isGestureScaleByMapCenter(), this.b.getAnchorX(), this.b.getAnchorY());
            } catch (RemoteException unused) {
            }
        }
    }

    private void c(int i2) {
        GLMapRender gLMapRender = this.al;
        if (gLMapRender != null) {
            gLMapRender.renderPause();
        }
        f(i2);
    }

    private void d(int i2) {
        f(i2);
        GLMapRender gLMapRender = this.al;
        if (gLMapRender != null) {
            gLMapRender.renderResume();
        }
    }

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

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

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

    private void m() {
        GLMapRender gLMapRender;
        if (this.au && (gLMapRender = this.al) != null && !gLMapRender.isRenderPause()) {
            requestRender();
        }
    }

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

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

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

    private void n() {
        if (!this.ab) {
            try {
                this.Z.setName("AuthThread");
                this.Z.start();
                this.ab = true;
            } catch (Throwable th) {
                th.printStackTrace();
                dl.a(th);
            }
        }
    }

    private void o() {
        if (!this.ac) {
            try {
                if (this.aa == null) {
                    this.aa = new h(this.e, this);
                }
                this.aa.setName("AuthProThread");
                this.aa.start();
                this.ac = true;
            } catch (Throwable th) {
                th.printStackTrace();
                dl.a(th);
            }
        }
    }

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

    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.av || !this.au || !this.a) {
            this.aJ.g = i2;
            this.aJ.d = i3;
            this.aJ.e = i4;
            this.aJ.f = i5;
            this.aJ.b = true;
            return;
        }
        e(i4);
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass13 */

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

    private void e(int i2) {
        dw dwVar = this.C;
        if (dwVar == null) {
            return;
        }
        if (i2 == 0) {
            if (dwVar.b()) {
                this.C.g(Boolean.FALSE);
                this.C.c();
            }
        } else if (!dwVar.b()) {
            this.C.g(Boolean.TRUE);
            this.C.c();
        }
    }

    private void f(final int i2) {
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass14 */

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

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

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

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

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

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

            public final void run() {
                try {
                    if (z2) {
                        b.this.f.setBuildingTextureEnable(i2, true);
                    } else {
                        b.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) {
        dn.a(dm.c, "createSurface");
        this.aG = System.currentTimeMillis();
        if (this.X == 3) {
            this.C.d().a(dr.b);
        } else {
            this.C.d().a(dr.a);
        }
        this.av = false;
        this.g = this.B.getWidth();
        this.h = this.B.getHeight();
        this.ax = false;
        try {
            AeUtil.loadLib(this.e);
            dn.a(dm.c, "load lib complete");
            AeUtil.initCrashHandle(this.e);
            GLMapEngine.InitParam initResource = AeUtil.initResource(this.e);
            dn.a(dm.c, "load res complete");
            this.f.createAMapInstance(initResource);
            dn.a(dm.c, "create engine complete");
            this.aD = new ce();
            dn.a(dm.c, "init shader complete");
            com.autonavi.extra.b bVar = this.aV;
            if (bVar != null) {
                bVar.i();
            }
            this.au = true;
            this.l = gl10.glGetString(7937);
        } catch (Throwable th) {
            dl.a(th);
            il.c(th, "AMapDElegateImp", "createSurface");
            String str = dm.c;
            dn.b(str, "createSurface failed " + th.getMessage());
            Context context = this.e;
            di.b(context, "init failed:" + th.getMessage());
        }
        GLMapState mapState = this.f.getMapState(this.F);
        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());
        }
        n();
        CustomRenderer customRenderer = this.ae;
        if (customRenderer != null) {
            customRenderer.onSurfaceCreated(gl10, eGLConfig);
        }
        com.autonavi.extra.b bVar2 = this.aV;
        if (bVar2 != null) {
            bVar2.c();
        }
        this.D.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 = dm.c;
        dn.a(str, "changeSurface " + i3 + Operators.SPACE_STR + i4);
        this.ax = false;
        if (!this.au) {
            createSurface(i2, gl10, null);
        }
        n nVar = this.am;
        if (!(nVar == null || this.e == null || ((this.g == nVar.b() && this.h == this.am.c()) || (windowManager = (WindowManager) this.e.getSystemService("window")) == null))) {
            Display defaultDisplay = windowManager.getDefaultDisplay();
            DisplayMetrics displayMetrics = new DisplayMetrics();
            if (defaultDisplay != null) {
                defaultDisplay.getRealMetrics(displayMetrics);
                this.am.a(displayMetrics.widthPixels, displayMetrics.heightPixels);
            }
        }
        this.g = i3;
        this.h = i4;
        this.W = new Rect(0, 0, i3, i4);
        this.F = a(i2, new Rect(0, 0, this.g, this.h), this.g, this.h);
        dn.a(dm.c, "create engine with frame complete");
        if (!this.av) {
            MapConfig mapConfig = this.b;
            if (mapConfig != null) {
                mapConfig.setMapZoomScale(this.ap);
                this.b.setMapWidth(i3);
                this.b.setMapHeight(i4);
            }
            this.f.setIndoorEnable(this.F, false);
            this.f.setSimple3DEnable(this.F, false);
            this.f.setStyleChangeGradualEnable(this.F, 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/\"}");
            GLMapEngine.InitParam initParam = new GLMapEngine.InitParam();
            AeUtil.initIntersectionRes(this.e, initParam);
            this.f.setVectorOverlayPath(initParam.mIntersectionResPath);
        }
        synchronized (this) {
            this.av = true;
        }
        if (!this.I) {
            this.b.setAnchorX(i3 >> 1);
            this.b.setAnchorY(i4 >> 1);
        } else {
            this.b.setAnchorX(Math.max(1, Math.min(this.aA, i3 - 1)));
            this.b.setAnchorY(Math.max(1, Math.min(this.aB, i4 - 1)));
        }
        this.f.setProjectionCenter(this.F, this.b.getAnchorX(), this.b.getAnchorY());
        this.a = true;
        if (this.aR.b) {
            this.aR.run();
        }
        if (this.aJ.b) {
            this.aJ.run();
        }
        if (this.aK.b) {
            this.aK.run();
        }
        if (this.aH.b) {
            this.aH.run();
        }
        if (this.aL.b) {
            this.aL.run();
        }
        if (this.aU.b) {
            this.aU.run();
        }
        if (this.aM.b) {
            this.aM.run();
        }
        if (this.aN.b) {
            this.aN.run();
        }
        if (this.aO.b) {
            this.aO.run();
        }
        if (this.aS.b) {
            this.aS.run();
        }
        if (this.aI.b) {
            this.aI.run();
        }
        if (this.aP.b) {
            this.aP.run();
        }
        a aVar = this.aQ;
        if (aVar != null) {
            aVar.run();
        }
        CustomRenderer customRenderer = this.ae;
        if (customRenderer != null) {
            customRenderer.onSurfaceChanged(gl10, i3, i4);
        }
        com.autonavi.extra.b bVar = this.aV;
        if (bVar != null) {
            bVar.d();
        }
        Handler handler = this.j;
        if (handler != null) {
            handler.post(this.aT);
        }
        redrawInfoWindow();
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void destroySurface(int i2) {
        this.ay.lock();
        try {
            if (this.au) {
                EGL14.eglGetCurrentContext();
                EGLContext eGLContext = EGL14.EGL_NO_CONTEXT;
                r();
                GLMapEngine gLMapEngine = this.f;
                if (gLMapEngine != null) {
                    if (gLMapEngine.getOverlayBundle(this.F) != null) {
                        this.f.getOverlayBundle(this.F).removeAll(true);
                    }
                    this.f.destroyAMapEngine();
                    this.f = null;
                    int i3 = this.ba;
                    if (i3 > 0) {
                        di.a(this.e, i3);
                    }
                    dn.a(dm.c, "destroy engine complete");
                }
                com.autonavi.extra.b bVar = this.aV;
                if (bVar != null) {
                    bVar.f();
                }
            }
            this.au = false;
            this.av = false;
            this.ax = false;
        } catch (Throwable th) {
            dl.a(th);
        } finally {
            this.ay.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) {
        int i5;
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine == null || i2 < 0) {
            i5 = 0;
        } else {
            i5 = gLMapEngine.getEngineIDWithType(i2);
            if (!this.f.isEngineCreated(i5)) {
                int i6 = Build.VERSION.SDK_INT >= 4 ? this.e.getResources().getDisplayMetrics().densityDpi : 0;
                float f2 = this.e.getResources().getDisplayMetrics().density;
                this.ap = GLMapState.calMapZoomScalefactor(i3, i4, i6);
                NativeTextGenerate.getInstance().setDensity(f2);
                GLMapEngine.MapViewInitParam mapViewInitParam = new GLMapEngine.MapViewInitParam();
                mapViewInitParam.engineId = i5;
                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.aq * f2;
                mapViewInitParam.mapZoomScale = this.ap;
                mapViewInitParam.taskThreadCount = 3;
                this.f.createAMapEngineWithFrame(mapViewInitParam);
                GLMapState mapState = this.f.getMapState(i5);
                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(i5, mapState);
                this.f.setOvelayBundle(i5, new GLOverlayBundle<>(i5, this));
            } else {
                a(i5, rect.left, rect.top, rect.width(), rect.height(), i3, i4);
            }
        }
        this.G.set(false);
        return i5;
    }

    @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 this.F;
    }

    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 g(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.I);
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final float getMinZoomLevel() {
        try {
            MapConfig mapConfig = this.b;
            if (mapConfig != null) {
                return mapConfig.getMinZoomLevel();
            }
            return 3.0f;
        } catch (Throwable th) {
            dl.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) {
                dl.a(th);
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void moveCamera(AbstractCameraUpdateMessage abstractCameraUpdateMessage) throws RemoteException {
        if (this.f != null && !this.G.get()) {
            try {
                if (this.H && this.f.getStateMessageCount() > 0) {
                    AbstractCameraUpdateMessage c2 = z.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) {
                dl.a(th);
            }
            resetRenderTime();
            this.f.clearAnimations(this.F, false);
            abstractCameraUpdateMessage.isChangeFinished = true;
            a(abstractCameraUpdateMessage);
            this.f.addMessage(abstractCameraUpdateMessage, false);
        }
    }

    private void a(AbstractCameraUpdateMessage abstractCameraUpdateMessage) {
        abstractCameraUpdateMessage.isUseAnchor = this.I;
        if (this.I) {
            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.G.get() && this.f != null) {
            abstractCameraUpdateMessage.mCallback = cancelableCallback;
            abstractCameraUpdateMessage.mDuration = j2;
            if (this.H || getMapHeight() == 0 || getMapWidth() == 0) {
                try {
                    moveCamera(abstractCameraUpdateMessage);
                    if (abstractCameraUpdateMessage.mCallback != null) {
                        abstractCameraUpdateMessage.mCallback.onFinish();
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                    dl.a(th);
                }
            } else {
                try {
                    this.f.interruptAnimation();
                    resetRenderTime();
                    a(abstractCameraUpdateMessage);
                    this.f.addMessage(abstractCameraUpdateMessage, true);
                } catch (Throwable th2) {
                    dl.a(th2);
                    th2.printStackTrace();
                }
            }
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void stopAnimation() throws RemoteException {
        try {
            GLMapEngine gLMapEngine = this.f;
            if (gLMapEngine != null) {
                gLMapEngine.interruptAnimation();
            }
            resetRenderTime();
        } catch (Throwable th) {
            dl.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.D.createId("POLYLINE");
            return (Polyline) this.D.addOverlayObject(createId, new Polyline(this.D, polylineOptions, createId), polylineOptions);
        } catch (Throwable th) {
            dl.a(th);
            String str = dm.d;
            dn.a(str, "addPolyline failed " + th.getMessage(), polylineOptions);
            return null;
        }
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final GL3DModel addGLModel(GL3DModelOptions gL3DModelOptions) {
        resetRenderTime();
        String createId = this.D.createId("GL3DMODEL");
        GL3DModel gL3DModel = new GL3DModel(this.D, gL3DModelOptions, createId);
        this.D.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();
            di.c(this.e);
            String createId = this.D.createId("PARTICLEOVERLAY");
            return (ParticleOverlay) this.D.addOverlayObject(createId, new ParticleOverlay(this.D, particleOverlayOptions, createId), particleOverlayOptions);
        } catch (Throwable th) {
            dl.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.D.createId("NAVIGATEARROW");
            NavigateArrow navigateArrow = new NavigateArrow(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (NavigateArrow) iGlOverlayLayer.addOverlayObject(createId, navigateArrow, clone) : navigateArrow;
        } catch (Throwable th) {
            dl.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.D.createId("POLYGON");
            Polygon polygon = new Polygon(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (Polygon) iGlOverlayLayer.addOverlayObject(createId, polygon, clone) : polygon;
        } catch (Throwable th) {
            dl.a(th);
            String str = dm.d;
            dn.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.D.createId("CIRCLE");
            Circle circle = new Circle(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (Circle) iGlOverlayLayer.addOverlayObject(createId, circle, clone) : circle;
        } catch (Throwable th) {
            dl.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.D.createId("ARC");
            Arc arc = new Arc(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (Arc) iGlOverlayLayer.addOverlayObject(createId, arc, clone) : arc;
        } catch (Throwable th) {
            dl.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.D.createId("GROUNDOVERLAY");
            GroundOverlay groundOverlay = new GroundOverlay(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (GroundOverlay) iGlOverlayLayer.addOverlayObject(createId, groundOverlay, clone) : groundOverlay;
        } catch (Throwable th) {
            dl.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.D.createId("MULTIOVERLAY");
            MultiPointOverlay multiPointOverlay = new MultiPointOverlay(this.D, clone, createId);
            IGlOverlayLayer iGlOverlayLayer = this.D;
            return iGlOverlayLayer != null ? (MultiPointOverlay) iGlOverlayLayer.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.D.createId("MARKER");
            Marker marker = new Marker(this.D, clone, createId);
            this.D.addOverlayObject(createId, marker, clone);
            return marker;
        } catch (Throwable th) {
            dl.a(th);
            String str = dm.d;
            dn.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.D.createId("TEXT");
            TextOptions clone = textOptions.clone();
            MarkerOptions a2 = cc.a(clone);
            Marker marker = new Marker(this.D, a2, createId);
            marker.setObject(clone.getObject());
            this.D.addOverlayObject(createId, marker, a2);
            return new Text(marker, clone);
        } catch (Throwable th) {
            dl.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.p0003s.b.AnonymousClass18 */

                    public final void run() {
                        try {
                            b.this.moveCamera(z.a(builder.build(), 50));
                        } catch (Throwable unused) {
                        }
                    }
                }, 50);
            }
            return arrayList2;
        } catch (Throwable th) {
            dl.a(th);
            String str = dm.d;
            dn.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)) {
                di.a(this.e);
            }
            String createId = this.D.createId("TILEOVERLAY");
            TileOverlay tileOverlay = new TileOverlay(this.D, tileOverlayOptions, createId);
            this.D.addOverlayObject(createId, tileOverlay, tileOverlayOptions);
            return tileOverlay;
        } catch (Throwable th) {
            dl.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final MVTTileOverlay addMVTTileOverlay(MVTTileOverlayOptions mVTTileOverlayOptions) throws RemoteException {
        try {
            String createId = this.D.createId("MVTTILEOVERLAY");
            MVTTileOverlay mVTTileOverlay = new MVTTileOverlay(this.D, mVTTileOverlayOptions, createId);
            this.D.addOverlayObject(createId, mVTTileOverlay, mVTTileOverlayOptions);
            return mVTTileOverlay;
        } catch (Throwable th) {
            dl.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.D.createId("HEATMAPLAYER");
            return (HeatMapLayer) this.D.addOverlayObject(createId, new HeatMapLayer(this.D, heatMapLayerOptions, createId), heatMapLayerOptions);
        } catch (Throwable th) {
            dl.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final HeatMapGridLayer addHeatMapGridLayer(HeatMapGridLayerOptions heatMapGridLayerOptions) throws RemoteException {
        try {
            resetRenderTime();
            if (heatMapGridLayerOptions == null) {
                return null;
            }
            String createId = this.D.createId("HEATMAPGRIDLAYER");
            return (HeatMapGridLayer) this.D.addOverlayObject(createId, new HeatMapGridLayer(this.D, heatMapGridLayerOptions, createId), heatMapGridLayerOptions);
        } catch (Throwable th) {
            dl.a(th);
            return null;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void clear() throws RemoteException {
        try {
            clear(false);
        } catch (Throwable th) {
            il.c(th, "AMapDelegateImp", "clear");
            dl.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 = "";
            bz bzVar = this.K;
            if (bzVar != null) {
                if (z2) {
                    str = bzVar.d();
                    str2 = this.K.e();
                } else {
                    bzVar.f();
                }
            }
            this.D.clear(str, str2);
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass19 */

                public final void run() {
                    if (b.this.f != null && !b.this.G.get()) {
                        b.this.f.removeNativeAllOverlay(b.this.F);
                    }
                }
            });
            resetRenderTime();
        } catch (Throwable th) {
            il.c(th, "AMapDelegateImp", "clear");
            dl.a(th);
            th.printStackTrace();
        }
    }

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

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

    /* JADX WARNING: Removed duplicated region for block: B:19:0x003b A[Catch:{ all -> 0x007b }] */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x005f A[Catch:{ all -> 0x007b }] */
    private void h(int i2) {
        int i3;
        int i4;
        int i5;
        this.X = 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.X = 1;
                    } catch (Throwable th) {
                        il.c(th, "AMapDelegateImp", "setMaptype");
                        th.printStackTrace();
                        dl.a(th);
                        return;
                    }
                }
                i3 = 4;
                this.b.setMapStyleMode(i5);
                this.b.setMapStyleTime(i4);
                this.b.setMapStyleState(i3);
                if (this.b.isCustomStyleEnable()) {
                    a aVar = this.aF;
                    if (aVar == null || !aVar.d()) {
                        a(this.F, i5, i4, i3, true, false, (StyleItem[]) null);
                        this.b.setCustomStyleEnable(false);
                    } else {
                        this.aF.e();
                    }
                    this.z.setLogoEnable(true);
                } else {
                    if (this.b.getMapLanguage().equals("en")) {
                        setMapLanguage("zh_cn");
                    }
                    a(this.F, 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.au || this.G.get()) {
                this.aH.c = z2;
                this.aH.b = true;
                this.aH.g = this.F;
                return;
            }
            queueEvent(new Runnable(z2) {
                /* class com.amap.api.col.p0003s.b.AnonymousClass20 */
                final /* synthetic */ boolean a;

                {
                    this.a = r2;
                }

                public final void run() {
                    try {
                        if (b.this.b.isTrafficEnabled() != this.a) {
                            b.this.b.setTrafficEnabled(z2);
                            b.this.al.setTrafficMode(this.a);
                            b.this.f.setTrafficEnable(b.this.F, this.a);
                            b.this.resetRenderTime();
                        }
                    } catch (Throwable th) {
                        th.printStackTrace();
                        dl.a(th);
                    }
                }
            });
        } catch (Throwable th) {
            dl.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.au || this.G.get()) {
                this.aS.c = z2;
                this.aS.b = true;
                this.aS.g = this.F;
                return;
            }
            this.b.setIndoorEnable(z2);
            resetRenderTime();
            if (z2) {
                GLMapEngine gLMapEngine = this.f;
                if (gLMapEngine != null) {
                    gLMapEngine.setIndoorEnable(this.F, true);
                }
            } else {
                GLMapEngine gLMapEngine2 = this.f;
                if (gLMapEngine2 != null) {
                    gLMapEngine2.setIndoorEnable(this.F, false);
                }
                MapConfig mapConfig = this.b;
                mapConfig.maxZoomLevel = mapConfig.isSetLimitZoomLevel() ? this.b.getMaxZoomLevel() : 20.0f;
                try {
                    if (this.z.isZoomControlsEnabled() && (a2 = this.u.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) {
                }
            }
            di.c(this.e, z2);
            if (this.z.isIndoorSwitchEnabled()) {
                this.j.post(new Runnable() {
                    /* class com.amap.api.col.p0003s.b.AnonymousClass22 */

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

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationEnabled(boolean z2) throws RemoteException {
        if (!this.G.get()) {
            try {
                dw dwVar = this.C;
                if (dwVar != null) {
                    LocationSource locationSource = this.L;
                    if (locationSource == null) {
                        dwVar.h(Boolean.FALSE);
                    } else if (z2) {
                        locationSource.activate(this.t);
                        this.C.h(Boolean.TRUE);
                        if (this.K == null) {
                            this.K = new bz(this, this.e);
                        }
                    } else {
                        bz bzVar = this.K;
                        if (bzVar != null) {
                            bzVar.c();
                            this.K = null;
                        }
                        this.L.deactivate();
                    }
                }
                if (!z2) {
                    this.z.setMyLocationButtonEnabled(z2);
                }
                this.E = z2;
                resetRenderTime();
            } catch (Throwable th) {
                il.c(th, "AMapDelegateImp", "setMyLocationEnabled");
                th.printStackTrace();
                dl.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.p0003s.b.AnonymousClass23 */

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMyLocationStyle(MyLocationStyle myLocationStyle) throws RemoteException {
        if (!this.G.get()) {
            try {
                if (this.K == null) {
                    this.K = new bz(this, this.e);
                }
                if (this.K != null) {
                    if (myLocationStyle.getInterval() < 1000) {
                        myLocationStyle.interval(1000);
                    }
                    LocationSource locationSource = this.L;
                    if (locationSource != null && (locationSource instanceof ak)) {
                        ((ak) locationSource).a(myLocationStyle.getInterval());
                        ((ak) this.L).a(myLocationStyle.getMyLocationType());
                    }
                    this.K.a(myLocationStyle);
                }
            } catch (Throwable th) {
                dl.a(th);
            }
        }
    }

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapTextEnable(final boolean z2) throws RemoteException {
        try {
            if (!this.au || !this.av) {
                this.aM.c = z2;
                this.aM.b = true;
                this.aM.g = this.F;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass24 */

                public final void run() {
                    try {
                        b.this.f.setLabelEnable(b.this.F, z2);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            dl.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setRoadArrowEnable(final boolean z2) throws RemoteException {
        try {
            if (!this.au || !this.av) {
                this.aN.c = z2;
                this.aN.b = true;
                this.aN.g = this.F;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass25 */

                public final void run() {
                    try {
                        b.this.f.setRoadArrowEnable(b.this.F, z2);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            dl.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.au || !this.av) {
                this.aO.c = z2;
                this.aO.h = i2;
                this.aO.i = i3;
                this.aO.b = true;
                this.aO.g = this.F;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass26 */

                public final void run() {
                    try {
                        b.this.f.setNaviLabelEnable(b.this.F, z2, i2, i3);
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            });
        } catch (Throwable th) {
            dl.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setConstructingRoadEnable(final boolean z2) {
        try {
            if (!this.au || !this.av) {
                this.aP.c = z2;
                this.aP.b = true;
                this.aP.g = this.F;
                return;
            }
            resetRenderTime();
            queueEvent(new Runnable() {
                /* class com.amap.api.col.p0003s.b.AnonymousClass27 */

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setTrafficStyleWithTextureData(final byte[] bArr) {
        if (!this.G.get()) {
            try {
                if (!this.au || !this.av || bArr == null) {
                    this.aQ.j = bArr;
                    this.aQ.b = true;
                    this.aQ.g = this.F;
                    return;
                }
                resetRenderTime();
                queueEvent(new Runnable() {
                    /* class com.amap.api.col.p0003s.b.AnonymousClass28 */

                    public final void run() {
                        try {
                            b.this.f.setTrafficStyleWithTextureData(b.this.F, bArr);
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
            } catch (Throwable th) {
                dl.a(th);
            }
        }
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setLocationSource(LocationSource locationSource) throws RemoteException {
        try {
            if (!this.G.get()) {
                LocationSource locationSource2 = this.L;
                if (locationSource2 != null && (locationSource2 instanceof ak)) {
                    locationSource2.deactivate();
                }
                this.L = locationSource;
                if (locationSource != null) {
                    this.C.h(Boolean.TRUE);
                } else {
                    this.C.h(Boolean.FALSE);
                }
            }
        } catch (Throwable th) {
            il.c(th, "AMapDelegateImp", "setLocationSource");
            th.printStackTrace();
            dl.a(th);
        }
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setInfoWindowAdapter(AMap.InfoWindowAdapter infoWindowAdapter) throws RemoteException {
        aj ajVar;
        if (!this.G.get() && (ajVar = this.w) != null) {
            ajVar.a(infoWindowAdapter);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setInfoWindowAdapter(AMap.CommonInfoWindowAdapter commonInfoWindowAdapter) throws RemoteException {
        aj ajVar;
        if (!this.G.get() && (ajVar = this.w) != null) {
            ajVar.a(commonInfoWindowAdapter);
        }
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getMapContentApprovalNumber() {
        MapConfig mapConfig = this.b;
        if (mapConfig == null || mapConfig.isCustomStyleEnable()) {
            return null;
        }
        di.d(this.e);
        String a2 = db.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() {
        di.e(this.e);
        String a2 = db.a(this.e, "approval_number", "si", "");
        return !TextUtils.isEmpty(a2) ? a2 : "GS(2021)1328号";
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final String getTerrainApprovalNumber() {
        di.f(this.e);
        String a2 = db.a(this.e, "approval_number", "te", "");
        return !TextUtils.isEmpty(a2) ? a2 : "GS(2021)6352号";
    }

    @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.ad = 0;
            } else {
                if (this.X != 1) {
                    try {
                        setMapType(1);
                    } catch (Throwable th) {
                        dl.a(th);
                        th.printStackTrace();
                    }
                }
                this.b.setMapLanguage("en");
                this.ad = -10000;
            }
            try {
                b(getCameraPosition());
            } catch (Throwable th2) {
                dl.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.aX.equals(str)) {
            this.aX = str;
            com.autonavi.extra.b bVar = this.aV;
            if (bVar != null) {
                bVar.i();
            }
            resetRenderTime();
        }
    }

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

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

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

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void getMapScreenShot(AMap.OnMapScreenShotListener onMapScreenShotListener) {
        try {
            this.u.a(Integer.valueOf(AMap.OnMapScreenShotListener.class.hashCode()), onMapScreenShotListener);
            this.U = true;
            resetRenderTime();
        } catch (Throwable th) {
            dl.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) {
            il.c(th, "AMapDelegateImp", "getScalePerPixel");
            dl.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.ag == -1) {
                    m();
                }
            } catch (Throwable th) {
                dl.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) {
                il.c(th, "AMapDelegateImp", "removecache");
                th.printStackTrace();
                dl.a(th);
            }
        }
    }

    /* access modifiers changed from: private */
    /* renamed from: com.amap.api.col.3s.b$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;
            AMap.OnCacheRemoveListener onCacheRemoveListener;
            AMap.OnCacheRemoveListener onCacheRemoveListener2;
            boolean z;
            AMap.OnCacheRemoveListener onCacheRemoveListener3;
            boolean z2 = true;
            try {
                Context applicationContext = this.b.getApplicationContext();
                String c2 = dl.c(applicationContext);
                String a2 = dl.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 || !dl.e(applicationContext)) {
                                z2 = false;
                            }
                            if (b.this.D != null) {
                                b.this.D.clearTileCache();
                            }
                            if (b.this.f != null && (onCacheRemoveListener3 = this.c) != null) {
                                onCacheRemoveListener3.onRemoveCacheFinish(z2);
                                return;
                            }
                            return;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        z2 = deleteFile;
                        try {
                            dl.a(th);
                            il.c(th, "AMapDelegateImp", "RemoveCacheRunnable");
                            try {
                                if (b.this.f != null && (onCacheRemoveListener2 = this.c) != null) {
                                    onCacheRemoveListener2.onRemoveCacheFinish(false);
                                    return;
                                }
                                return;
                            } catch (Throwable th3) {
                                th3.printStackTrace();
                                return;
                            }
                        } catch (Throwable th4) {
                            th4.printStackTrace();
                        }
                    }
                }
                z = false;
                z2 = false;
                if (b.this.D != null) {
                }
                try {
                    if (b.this.f != null) {
                        return;
                    }
                    return;
                } catch (Throwable th5) {
                    th5.printStackTrace();
                    return;
                }
            } catch (Throwable th6) {
                th = th6;
                dl.a(th);
                il.c(th, "AMapDelegateImp", "RemoveCacheRunnable");
                if (b.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.ae = customRenderer;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setCenterToPixel(int i2, int i3) throws RemoteException {
        this.I = true;
        this.aA = i2;
        this.aB = i3;
        if (this.av && this.au) {
            if (this.b.getAnchorX() != this.aA || this.b.getAnchorY() != this.aB) {
                this.b.setAnchorX(this.aA);
                this.b.setAnchorY(this.aB);
                queueEvent(new Runnable() {
                    /* class com.amap.api.col.p0003s.b.AnonymousClass29 */

                    public final void run() {
                        try {
                            b.this.b.setAnchorX(Math.max(0, Math.min(b.this.aA, b.this.g)));
                            b.this.b.setAnchorY(Math.max(0, Math.min(b.this.aB, b.this.h)));
                            b.this.f.setProjectionCenter(b.this.F, b.this.b.getAnchorX(), b.this.b.getAnchorY());
                        } catch (Throwable th) {
                            th.printStackTrace();
                        }
                    }
                });
            }
        }
    }

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

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

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

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setAMapGestureListener(AMapGestureListener aMapGestureListener) {
        n nVar = this.am;
        if (nVar != null) {
            this.v = aMapGestureListener;
            nVar.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.au || this.G.get()) {
                return mapConfig.getSZ();
            }
            LatLngBounds.Builder builder = new LatLngBounds.Builder();
            builder.include(latLng);
            builder.include(latLng2);
            GLMapState gLMapState = new GLMapState(this.F, this.f.getNativeInstance());
            Pair<Float, IPoint> a2 = dl.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) {
            dl.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.au || this.G.get()) {
            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(this.F, this.f.getNativeInstance());
        Pair<Float, IPoint> a2 = dl.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.z.isZoomControlsEnabled() && this.b.isNeedUpdateZoomControllerState() && (a2 = this.u.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) {
            dl.a(th);
        }
    }

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

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

    private void p() {
        try {
            LatLngBounds limitLatLngBounds = this.b.getLimitLatLngBounds();
            if (this.f != null && a(limitLatLngBounds)) {
                GLMapState gLMapState = new GLMapState(this.F, 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.as && this.f.getAnimateionsCount() == 0 && this.f.getStateMessageCount() == 0) {
                    AMapGestureListener aMapGestureListener = this.v;
                    if (aMapGestureListener != null) {
                        aMapGestureListener.onMapStable();
                    }
                    if (this.B.isEnabled()) {
                        try {
                            List<AMap.OnCameraChangeListener> a2 = this.u.a(AMap.OnCameraChangeListener.class.hashCode());
                            if (!(a2 == null || a2.size() == 0)) {
                                if (cameraPosition == null) {
                                    try {
                                        cameraPosition = getCameraPosition();
                                    } catch (Throwable th) {
                                        il.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();
                dl.a(th2);
            }
        }
    }

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void onFling() {
        IGlOverlayLayer iGlOverlayLayer = this.D;
        if (iGlOverlayLayer != null) {
            iGlOverlayLayer.setFlingState(true);
        }
        this.T = 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.F);
    }

    @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.J;
    }

    @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 {
        dw dwVar = this.C;
        if (dwVar != null) {
            return dwVar.j();
        }
        return null;
    }

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

                        public final void run() {
                            if (b.this.aC != null) {
                                b.this.aC.a(b.this.bd);
                            }
                        }
                    });
                }
            } catch (Throwable th) {
                dl.a(th);
                th.printStackTrace();
                return;
            }
        }
        aiVar = null;
        this.bd = aiVar;
        post(new Runnable() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass31 */

            public final void run() {
                if (b.this.aC != null) {
                    b.this.aC.a(b.this.bd);
                }
            }
        });
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void destroy() {
        this.G.set(true);
        if (!this.G.get()) {
            dn.a(dm.c, "destroy map");
            try {
                LocationSource locationSource = this.L;
                if (locationSource != null) {
                    locationSource.deactivate();
                }
                this.L = null;
                this.aC = null;
                GLMapRender gLMapRender = this.al;
                if (gLMapRender != null) {
                    gLMapRender.renderPause();
                }
                IGlOverlayLayer iGlOverlayLayer = this.D;
                if (iGlOverlayLayer != null) {
                    iGlOverlayLayer.destroy();
                }
                h();
                Thread thread = this.Z;
                if (thread != null) {
                    thread.interrupt();
                    this.Z = null;
                }
                Thread thread2 = this.aa;
                if (thread2 != null) {
                    thread2.interrupt();
                    this.aa = null;
                }
                cg cgVar = this.ai;
                if (cgVar != null) {
                    cgVar.a();
                    this.ai = null;
                }
                ci ciVar = this.aj;
                if (ciVar != null) {
                    ciVar.a((ci.a) null);
                    this.aj.a();
                    this.aj = null;
                }
                cz.b();
                GLMapEngine gLMapEngine = this.f;
                if (gLMapEngine != null) {
                    gLMapEngine.setMapListener(null);
                    this.f.releaseNetworkState();
                    queueEvent(new Runnable() {
                        /* class com.amap.api.col.p0003s.b.AnonymousClass33 */

                        public final void run() {
                            try {
                                b bVar = b.this;
                                bVar.destroySurface(bVar.F);
                            } catch (Throwable th) {
                                th.printStackTrace();
                                dl.a(th);
                            }
                        }
                    });
                    int i2 = 0;
                    while (this.f != null) {
                        int i3 = i2 + 1;
                        if (i2 >= 50) {
                            break;
                        }
                        try {
                            Thread.sleep(20);
                        } catch (InterruptedException e2) {
                            dl.a(e2);
                        }
                        i2 = i3;
                    }
                }
                IGLSurfaceView iGLSurfaceView = this.B;
                if (iGLSurfaceView != null) {
                    try {
                        iGLSurfaceView.onDetachedGLThread();
                    } catch (Exception e3) {
                        e3.printStackTrace();
                        dl.a(e3);
                    }
                }
                dw dwVar = this.C;
                if (dwVar != null) {
                    dwVar.g();
                    this.C = null;
                }
                bz bzVar = this.K;
                if (bzVar != null) {
                    bzVar.c();
                    this.K = null;
                }
                this.L = null;
                this.t = null;
                q();
                this.Y = null;
                dn.a();
                il.b();
            } catch (Throwable th) {
                il.c(th, "AMapDelegateImp", Constants.Event.SLOT_LIFECYCLE.DESTORY);
                dl.a(th);
                th.printStackTrace();
            }
        }
    }

    private void q() {
        g gVar = this.u;
        if (gVar != null) {
            gVar.a();
        }
    }

    /* renamed from: com.amap.api.col.3s.b$c */
    /* compiled from: AMapDelegateImp */
    private class c implements dt.a {
        private c() {
        }

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

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

    /* access modifiers changed from: package-private */
    /* renamed from: com.amap.api.col.3s.b$b  reason: collision with other inner class name */
    /* compiled from: AMapDelegateImp */
    public class C0001b {
        C0001b() {
        }

        public final void a(ai aiVar) {
            List a2;
            List a3;
            if (b.this.b != null && b.this.b.isIndoorEnable()) {
                final dt e = b.this.C.e();
                float f = 20.0f;
                if (aiVar == null) {
                    try {
                        List a4 = b.this.u.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(aiVar);
                                }
                            }
                        }
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                    if (b.this.c != null) {
                        b.this.c.g = null;
                    }
                    if (e.b()) {
                        b.this.j.post(new Runnable() {
                            /* class com.amap.api.col.p0003s.b.C0001b.AnonymousClass1 */

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

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

    @Override // com.autonavi.base.amap.mapcore.interfaces.IAMapListener
    public final void beforeDrawLabel(int i2, GLMapState gLMapState) {
        j();
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.pushRendererState();
        }
        this.ba = this.D.draw(0, this.ad, this.i) ? this.ba : this.ba + 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) {
        j();
        com.autonavi.extra.b bVar = this.aV;
        if (bVar != null) {
            bVar.e();
        }
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            gLMapEngine.pushRendererState();
        }
        this.ba = this.D.draw(1, this.ad, this.i) ? this.ba : this.ba + 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.D.draw(2, this.ad, this.i);
        GLMapEngine gLMapEngine2 = this.f;
        if (gLMapEngine2 != null) {
            gLMapEngine2.popRendererState();
        }
        CustomRenderer customRenderer = this.ae;
        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.ag;
            if (i3 != -1) {
                this.al.setRenderFps((float) i3);
            } else {
                this.al.setRenderFps(15.0f);
            }
            if (this.ao != mapZoomer) {
                this.ao = mapZoomer;
            }
        }
        if (!this.ax) {
            this.ax = 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(this.F, i2);
        }
        return 0;
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final long getGlOverlayMgrPtr() {
        GLMapEngine gLMapEngine = this.f;
        if (gLMapEngine != null) {
            return gLMapEngine.getGlOverlayMgrPtr(this.F);
        }
        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(this.F, getContext(), this);
        if (crossOverlayOptions != null) {
            crossVectorOverlay.setAttribute(crossOverlayOptions.getAttribute());
        }
        queueEvent(new Runnable() {
            /* class com.amap.api.col.p0003s.b.AnonymousClass34 */

            public final void run() {
                GLOverlayBundle overlayBundle;
                if (b.this.f != null && (overlayBundle = b.this.f.getOverlayBundle(b.this.F)) != null) {
                    overlayBundle.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 {
            GLMapEngine gLMapEngine = this.f;
            if (gLMapEngine != null && (overlayBundle = gLMapEngine.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) {
            dl.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.A = 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.A = 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)) {
                        o();
                    }
                    this.aF.c();
                    this.aF.a(customMapStyleOptions);
                    com.autonavi.extra.b bVar = this.aV;
                    if (bVar != null) {
                        bVar.i();
                    }
                } else {
                    return;
                }
            } catch (Throwable th) {
                dl.a(th);
                return;
            }
        }
        resetRenderTime();
    }

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

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

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void setMapCustomEnable(boolean z2, boolean z3) {
        cg cgVar;
        if (!this.au || this.G.get()) {
            this.aK.b = true;
            this.aK.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()) && (cgVar = this.ai) != null) {
                        cgVar.a(this.b.getCustomStyleID());
                        this.ai.b();
                    }
                } catch (Throwable th) {
                    th.printStackTrace();
                    dl.a(th);
                    return;
                }
            }
            if (z3 || this.A || (this.b.isCustomStyleEnable() ^ z2)) {
                a(z2, (byte[]) null, z4);
            }
            this.A = false;
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void setMapCustomEnable(boolean z2) {
        if (z2) {
            o();
        }
        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) {
        co coVar;
        try {
            this.b.setCustomStyleEnable(z2);
            boolean z4 = false;
            if (this.b.isHideLogoEnable()) {
                this.z.setLogoEnable(!z2);
            }
            if (z2) {
                c(this.F, true);
                cn cnVar = new cn();
                MyTrafficStyle myTrafficStyle = this.Y;
                if (!(myTrafficStyle == null || myTrafficStyle.getTrafficRoadBackgroundColor() == -1)) {
                    cnVar.a(this.Y.getTrafficRoadBackgroundColor());
                }
                if (this.b.isProFunctionAuthEnable() && !TextUtils.isEmpty(this.b.getCustomTextureResourcePath())) {
                    z4 = true;
                }
                StyleItem[] styleItemArr = null;
                if (bArr != null) {
                    coVar = cnVar.a(bArr, z4);
                    if (!(coVar == null || (styleItemArr = coVar.c()) == null)) {
                        this.b.setUseProFunction(true);
                    }
                } else {
                    coVar = null;
                }
                if (styleItemArr == null && (coVar = cnVar.a(this.b.getCustomStylePath(), z4)) != null) {
                    styleItemArr = coVar.c();
                }
                if (cnVar.a() != 0) {
                    this.b.setCustomBackgroundColor(cnVar.a());
                }
                if (coVar == null || coVar.d() == null) {
                    a(styleItemArr, z3);
                } else if (this.aj != null) {
                    this.aj.a((String) coVar.d());
                    this.aj.a(coVar);
                    this.aj.b();
                }
            } else {
                c(this.F, false);
                a(this.F, this.b.getMapStyleMode(), this.b.getMapStyleTime(), this.b.getMapStyleState(), true, false, (StyleItem[]) null);
            }
        } catch (Throwable th) {
            dl.a(th);
        }
    }

    @Override // com.amap.api.col.p0003s.ci.a
    public final void a(String str, co coVar) {
        setCustomTextureResourcePath(str);
        if (this.b.isCustomStyleEnable() && coVar != null) {
            a(coVar.c(), false);
        }
    }

    private void a(StyleItem[] styleItemArr, boolean z2) {
        if (z2 || (styleItemArr != null && styleItemArr.length > 0)) {
            a(this.F, 0, 0, 0, true, true, styleItemArr);
            di.a(this.e, true);
            return;
        }
        di.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.p0003s.b.AnonymousClass35 */

                public final void run() {
                    b.this.f.getOverlayBundle(b.this.F).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.m;
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final String createId(String str) {
        IGlOverlayLayer iGlOverlayLayer = this.D;
        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.G.get()) {
            this.C.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.n;
    }

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

    @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();
            dl.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void createSurface(GL10 gl10, EGLConfig eGLConfig) {
        try {
            this.ak = Thread.currentThread().getId();
        } catch (Throwable th) {
            th.printStackTrace();
            dl.a(th);
        }
        try {
            createSurface(1, gl10, eGLConfig);
        } catch (Throwable th2) {
            th2.printStackTrace();
            dl.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) {
            return true;
        }
        gLMapEngine.canStopMapRender(this.F);
        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) {
            dl.a(th);
        }
    }

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void checkMapState(IGLMapState iGLMapState) {
        if (this.b != null && !this.G.get()) {
            LatLngBounds limitLatLngBounds = this.b.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 = dl.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 = dl.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) {
                    dl.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 {
            IGLSurfaceView iGLSurfaceView = this.B;
            if (iGLSurfaceView != null) {
                iGLSurfaceView.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.z.setLogoEnable(!z2);
            }
        }
    }

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final void changeLogoIconStyle(String str, boolean z2, int i2) {
        dw dwVar = this.C;
        if (dwVar != null) {
            dwVar.a(str, Boolean.valueOf(z2), Integer.valueOf(i2));
        }
        u uVar = this.z;
        if (uVar != null) {
            uVar.requestRefreshLogo();
        }
    }

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

    @Override // com.autonavi.base.amap.api.mapcore.IAMapDelegate
    public final float getUnitLengthByZoom(int i2) {
        GLMapState gLMapState = new GLMapState(this.F, 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(this.F);
        }
        return 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    @Override // com.autonavi.amap.mapcore.interfaces.IAMap
    public final void removeOnMyLocationChangeListener(AMap.OnMyLocationChangeListener onMyLocationChangeListener) throws RemoteException {
        g gVar = this.u;
        if (gVar != null) {
            gVar.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.aZ) {
                cr.a("setCustomMapStyle 和 setWorldVectorMapStyle 不能同时使用,setCustomMapStyle将不会生效");
                return true;
            }
            this.aY = true;
        }
        if (!z3) {
            return false;
        }
        if (this.aY) {
            cr.a("setCustomMapStyle 和 setWorldVectorMapStyle 不能同时使用,setWorldVectorMapStyle将不会生效");
            return true;
        }
        this.aZ = true;
        return false;
    }

    private void r() {
        ce ceVar = this.aD;
        if (ceVar != null) {
            ceVar.a();
            this.aD = null;
        }
    }
}