package com.autonavi.base.ae.gmap; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Point; import android.text.TextUtils; import android.util.DisplayMetrics; import com.amap.api.col.p0003s.dj; import com.amap.api.col.p0003s.dl; import com.amap.api.col.p0003s.il; import com.amap.api.col.p0003s.kr; import com.amap.api.maps.AMap; import com.amap.api.maps.MapsInitializer; import com.amap.api.maps.model.BitmapDescriptor; import com.amap.api.maps.model.BitmapDescriptorFactory; import com.autonavi.amap.api.mapcore.IGLMapEngine; import com.autonavi.amap.api.mapcore.IGLMapState; import com.autonavi.amap.mapcore.AMapEngineUtils; import com.autonavi.amap.mapcore.AbstractCameraUpdateMessage; import com.autonavi.amap.mapcore.tools.GlMapUtil; import com.autonavi.base.ae.gmap.bean.InitStorageParam; import com.autonavi.base.ae.gmap.bean.TileProviderInner; import com.autonavi.base.ae.gmap.gesture.EAMapPlatformGestureInfo; import com.autonavi.base.ae.gmap.glanimation.AdglMapAnimFling; import com.autonavi.base.ae.gmap.glanimation.AdglMapAnimFlingP20; import com.autonavi.base.ae.gmap.glanimation.AdglMapAnimGroup; import com.autonavi.base.ae.gmap.glanimation.AdglMapAnimationMgr; import com.autonavi.base.ae.gmap.gloverlay.BaseMapOverlay; import com.autonavi.base.ae.gmap.gloverlay.GLOverlayBundle; import com.autonavi.base.ae.gmap.gloverlay.GLTextureProperty; import com.autonavi.base.ae.gmap.style.StyleItem; import com.autonavi.base.amap.api.mapcore.IAMapDelegate; import com.autonavi.base.amap.mapcore.FileUtil; import com.autonavi.base.amap.mapcore.IAMapEngineCallback; import com.autonavi.base.amap.mapcore.interfaces.IAMapListener; import com.autonavi.base.amap.mapcore.maploader.AMapLoader; import com.autonavi.base.amap.mapcore.maploader.NetworkState; import com.autonavi.base.amap.mapcore.message.AbstractGestureMapMessage; import com.autonavi.base.amap.mapcore.message.HoverGestureMapMessage; import com.autonavi.base.amap.mapcore.message.MoveGestureMapMessage; import com.autonavi.base.amap.mapcore.message.RotateGestureMapMessage; import com.autonavi.base.amap.mapcore.message.ScaleGestureMapMessage; import com.autonavi.base.amap.mapcore.tools.GLConvertUtil; import com.autonavi.base.amap.mapcore.tools.TextTextureGenerator; import java.io.File; import java.lang.reflect.Field; import java.util.List; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class GLMapEngine implements IGLMapEngine, IAMapEngineCallback, NetworkState.NetworkChangeListener { Map<Long, AMapLoader> aMapLoaderHashtable; GLOverlayBundle<BaseMapOverlay<?, ?>> bundle; private Context context; private GLMapState copyGLMapState; private boolean isEngineRenderComplete; boolean isGestureStep; boolean isMoveCameraStep; boolean isNetworkConnected; private final List<AbstractCameraUpdateMessage> mAnimateStateMessageList; private int mEngineID; private List<AbstractGestureMapMessage> mGestureEndMessageList; private final List<AbstractGestureMapMessage> mGestureMessageList; private IAMapDelegate mGlMapView; private Lock mLock; private IAMapListener mMapListener; private long mNativeMapengineInstance; private NetworkState mNetworkState; boolean mRequestDestroy; private AtomicInteger mRequestID; private final List<AbstractCameraUpdateMessage> mStateMessageList; private TextTextureGenerator mTextTextureGenerator; private AdglMapAnimationMgr mapAnimationMgr; private int mapGestureCount; private Object mutLock; GLMapState state; private TerrainOverlayProvider terrainTileProvider; private String userAgent; public static class InitParam { public String mConfigContent = ""; public String mConfigPath = ""; public String mIntersectionResPath = ""; public String mOfflineDataPath = ""; public String mP3dCrossPath = ""; public String mRootPath = ""; } public static class MapViewInitParam { public int engineId; public int height; public float mapZoomScale; public int screenHeight; public float screenScale; public int screenWidth; public int taskThreadCount = 8; public float textScale; public int width; public int x; public int y; } protected static native String nativeAddNativeOverlay(int i, long j, int i2, int i3); private static native boolean nativeAddOverlayTexture(int i, long j, int i2, int i3, float f, float f2, Bitmap bitmap, boolean z, boolean z2); private static native void nativeCancelDownLoad(int i, long j, long j2); private static native void nativeCreateAMapEngineWithFrame(long j, int i, int i2, int i3, int i4, int i5, int i6, int i7, float f, float f2, float f3, int i8); private static native long nativeCreateAMapInstance(String str, String str2, String str3, float f, float f2, float f3, int i); protected static native long nativeCreateOverlay(int i, long j, int i2); private static native void nativeDestroy(long j); private static native void nativeDestroyCurrentState(long j, long j2); protected static native void nativeDestroyOverlay(int i, long j); private static native void nativeFailedDownLoad(int i, long j, long j2, int i2); private static native void nativeFinishDownLoad(int i, long j, long j2); private static native void nativeGetCurTileIDs(int i, long j, int[] iArr, int i2); private static native long nativeGetCurrentMapState(int i, long j); private static native long nativeGetGlOverlayMgrPtr(int i, long j); public static native String nativeGetMapEngineVersion(int i); private static native int[] nativeGetMapModeState(int i, long j, boolean z); public static native String nativeGetMapSDKDeps(); public static native String nativeGetMapSDKVersion(); public static native long nativeGetNativeMapController(int i, long j); public static native int[] nativeGetScreenShot(int i, long j, int i2, int i3, int i4, int i5); private static native boolean nativeGetSrvViewStateBoolValue(int i, long j, int i2); private static native void nativeInitAMapEngineCallback(long j, Object obj); private static native void nativeInitOpenLayer(int i, long j, byte[] bArr); private static native void nativeInitParam(String str, String str2, String str3, String str4); private static native boolean nativeIsEngineCreated(long j, int i); private static native void nativePopRenderState(int i, long j); private static native void nativePostRenderAMap(long j, int i); private static native void nativePushRendererState(int i, long j); private static native void nativeReceiveNetData(int i, long j, byte[] bArr, long j2, int i2); protected static native void nativeRemoveNativeAllOverlay(int i, long j); protected static native void nativeRemoveNativeOverlay(int i, long j, String str); private static native void nativeRenderAMap(long j, int i); private static native void nativeSelectMapPois(int i, long j, int i2, int i3, int i4, byte[] bArr); private static native void nativeSetAllContentEnable(int i, long j, boolean z); private static native void nativeSetBuildingEnable(int i, long j, boolean z); private static native void nativeSetBuildingTextureEnable(int i, long j, boolean z); private static native void nativeSetCustomStyleData(int i, long j, byte[] bArr, byte[] bArr2); private static native void nativeSetCustomStyleTexture(int i, long j, byte[] bArr); private static native void nativeSetCustomThirdLayerStyle(int i, long j, String str); private static native void nativeSetHighlightSubwayEnable(int i, long j, boolean z); private static native void nativeSetIndoorBuildingToBeActive(int i, long j, String str, int i2, String str2); private static native void nativeSetIndoorEnable(int i, long j, boolean z); private static native void nativeSetLabelEnable(int i, long j, boolean z); private static native boolean nativeSetMapModeAndStyle(int i, long j, int[] iArr, boolean z, boolean z2, StyleItem[] styleItemArr); private static native void nativeSetNaviLabelEnable(int i, long j, boolean z, int i2, int i3); /* access modifiers changed from: private */ public static native void nativeSetNetStatus(long j, int i); private static native void nativeSetOfflineDataEnable(int i, long j, boolean z); private static native void nativeSetOpenLayerEnable(int i, long j, boolean z); private static native void nativeSetParameter(int i, long j, int i2, int i3, int i4, int i5, int i6); private static native void nativeSetProjectionCenter(int i, long j, float f, float f2); private static native void nativeSetRenderListenerStatus(int i, long j); private static native void nativeSetRoadArrowEnable(int i, long j, boolean z); private static native void nativeSetServiceViewRect(int i, long j, int i2, int i3, int i4, int i5, int i6, int i7); private static native void nativeSetSetBackgroundTexture(int i, long j, byte[] bArr); private static native void nativeSetSimple3DEnable(int i, long j, boolean z); private static native void nativeSetSkyTexture(int i, long j, byte[] bArr); private static native void nativeSetSrvViewStateBoolValue(int i, long j, int i2, boolean z); private static native void nativeSetStyleChangeGradualEnable(int i, long j, boolean z); private static native void nativeSetTrafficEnable(int i, long j, boolean z); private static native void nativeSetTrafficTexture(int i, long j, byte[] bArr, byte[] bArr2, byte[] bArr3, byte[] bArr4); private static native void nativeSetTrafficTextureAllInOne(int i, long j, byte[] bArr); public static native void nativeSetVectorOverlayPath(int i, long j, String str); protected static native void nativeUpdateNativeArrowOverlay(int i, long j, String str, int[] iArr, int[] iArr2, int i2, int i3, int i4, float f, boolean z, int i5, int i6, int i7); public void changeSurface(int i, int i2) { } public void clearAllMessages(int i) { } public boolean getIsProcessBuildingMark(int i) { return false; } public long getMapStateInstance(int i) { return 0; } public boolean isInMapAction(int i) { return false; } public void onClearCache(int i) { } public void putResourceData(int i, byte[] bArr) { } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void reloadMapResource(int i, String str, int i2) { } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void requireMapData(int i, byte[] bArr) { } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void requireMapRender(int i, int i2, int i3) { } public void setInternaltexture(int i, byte[] bArr, int i2) { } public void setMapLoaderToTask(int i, long j, AMapLoader aMapLoader) { } public void startPivotZoomRotateAnim(int i, Point point, float f, int i2, int i3) { if (f != -9999.0f || i2 == -9999) { } } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public byte[] requireMapResource(int i, String str) { byte[] bArr; if (str == null) { return null; } String concat = "map_assets/".concat(String.valueOf(str)); try { if (this.mGlMapView.getMapConfig().isCustomStyleEnable()) { if (this.mGlMapView.getCustomStyleManager() != null) { bArr = this.mGlMapView.getCustomStyleManager().a(str); if (bArr != null) { return bArr; } } else { bArr = null; } if (str.startsWith("icons_5")) { bArr = FileUtil.readFileContents(this.mGlMapView.getMapConfig().getCustomTextureResourcePath()); } else if (str.startsWith("bktile")) { bArr = FileUtil.readFileContentsFromAssets(this.context, concat); int customBackgroundColor = this.mGlMapView.getMapConfig().getCustomBackgroundColor(); if (customBackgroundColor != 0) { bArr = dl.a(bArr, customBackgroundColor); } } if (bArr != null) { return bArr; } } return FileUtil.readFileContentsFromAssets(this.context, concat); } catch (Throwable th) { dl.a(th); return null; } } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public int generateRequestId() { return this.mRequestID.incrementAndGet(); } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public int requireMapDataAsyn(int i, byte[] bArr) { if (!this.mRequestDestroy && bArr != null) { AMapLoader.ADataRequestParam aDataRequestParam = new AMapLoader.ADataRequestParam(); int i2 = GLConvertUtil.getInt(bArr, 0); aDataRequestParam.requestBaseUrl = GLConvertUtil.getString(bArr, 4, i2); int i3 = i2 + 4; int i4 = GLConvertUtil.getInt(bArr, i3); int i5 = i3 + 4; aDataRequestParam.requestUrl = GLConvertUtil.getString(bArr, i5, i4); int i6 = i5 + i4; aDataRequestParam.handler = GLConvertUtil.getLong(bArr, i6); int i7 = i6 + 8; aDataRequestParam.nRequestType = GLConvertUtil.getInt(bArr, i7); int i8 = i7 + 4; int i9 = GLConvertUtil.getInt(bArr, i8); int i10 = i8 + 4; aDataRequestParam.enCodeString = GLConvertUtil.getSubBytes(bArr, i10, i9); aDataRequestParam.nCompress = GLConvertUtil.getInt(bArr, i10 + i9); final AMapLoader aMapLoader = new AMapLoader(i, this, aDataRequestParam); this.aMapLoaderHashtable.put(Long.valueOf(aDataRequestParam.handler), aMapLoader); try { dj.a().a(new kr() { /* class com.autonavi.base.ae.gmap.GLMapEngine.AnonymousClass1 */ @Override // com.amap.api.col.p0003s.kr public void runTask() { AMapLoader aMapLoader; try { if (!GLMapEngine.this.mRequestDestroy && (aMapLoader = aMapLoader) != null) { aMapLoader.doRequest(); } } catch (Throwable th) { il.c(th, "download Thread", "AMapLoader doRequest"); dl.a(th); } } }); } catch (Throwable th) { il.c(th, "download Thread", "requireMapData"); dl.a(th); } } return 0; } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void cancelRequireMapData(Object obj) { if (obj != null && (obj instanceof AMapLoader)) { ((AMapLoader) obj).doCancel(); } } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public byte[] requireCharBitmap(int i, int i2, int i3) { return this.mTextTextureGenerator.getTextPixelBuffer(i2, i3); } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public byte[] requireCharsWidths(int i, int[] iArr, int i2, int i3) { return this.mTextTextureGenerator.getCharsWidths(iArr); } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void onMapRender(int i, int i2) { if (i2 == 5) { IAMapListener iAMapListener = this.mMapListener; if (iAMapListener != null) { iAMapListener.beforeDrawLabel(i, getMapState(i)); } } else if (i2 == 6) { IAMapListener iAMapListener2 = this.mMapListener; if (iAMapListener2 != null) { iAMapListener2.afterDrawLabel(i, getMapState(i)); } } else if (i2 == 7) { IAMapListener iAMapListener3 = this.mMapListener; if (iAMapListener3 != null) { iAMapListener3.afterRendererOver(i, getMapState(i)); } } else if (i2 == 13) { try { this.isEngineRenderComplete = true; } catch (Throwable unused) { } } } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public void OnIndoorBuildingActivity(int i, byte[] bArr) { IAMapDelegate iAMapDelegate = this.mGlMapView; if (iAMapDelegate != null) { try { iAMapDelegate.onIndoorBuildingActivity(i, bArr); } catch (Throwable th) { th.printStackTrace(); } } } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public TileProviderInner getTerrainTileProvider() { return this.terrainTileProvider.getTileProvider(); } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public List<BitmapDescriptor> getSkyBoxImages() { return this.terrainTileProvider.getSkyBoxImages(); } public void receiveNetData(int i, long j, byte[] bArr, int i2) { if (!this.mRequestDestroy && this.aMapLoaderHashtable.containsKey(Long.valueOf(j))) { this.mLock.lock(); try { long j2 = this.mNativeMapengineInstance; if (j2 != 0) { nativeReceiveNetData(i, j2, bArr, j, i2); } } finally { this.mLock.unlock(); } } } public boolean getMapDataTaskIsCancel(int i, long j) { return !this.aMapLoaderHashtable.containsKey(Long.valueOf(j)); } /* JADX INFO: finally extract failed */ public void finishDownLoad(int i, long j) { if (this.aMapLoaderHashtable.containsKey(Long.valueOf(j))) { this.mLock.lock(); try { long j2 = this.mNativeMapengineInstance; if (j2 != 0) { nativeFinishDownLoad(i, j2, j); } this.mLock.unlock(); this.aMapLoaderHashtable.remove(Long.valueOf(j)); } catch (Throwable th) { this.mLock.unlock(); throw th; } } } /* JADX INFO: finally extract failed */ public void netStop(int i, long j, int i2) { if (this.aMapLoaderHashtable.containsKey(Long.valueOf(j))) { this.mLock.lock(); try { long j2 = this.mNativeMapengineInstance; if (j2 != 0) { nativeCancelDownLoad(i, j2, j); } this.mLock.unlock(); this.aMapLoaderHashtable.remove(Long.valueOf(j)); } catch (Throwable th) { this.mLock.unlock(); throw th; } } } public void netCancel(int i, long j, int i2) { if (this.aMapLoaderHashtable.containsKey(Long.valueOf(j))) { this.mLock.lock(); try { long j2 = this.mNativeMapengineInstance; if (j2 != 0) { nativeFailedDownLoad(i, j2, j, -1); } } finally { this.mLock.unlock(); } } } /* JADX INFO: finally extract failed */ public void netError(int i, long j, int i2, int i3) { if (this.aMapLoaderHashtable.containsKey(Long.valueOf(j))) { this.mLock.lock(); try { long j2 = this.mNativeMapengineInstance; if (j2 != 0) { nativeFailedDownLoad(i, j2, j, i3); } this.mLock.unlock(); this.aMapLoaderHashtable.remove(Long.valueOf(j)); try { if (MapsInitializer.getExceptionLogger() != null) { MapsInitializer.getExceptionLogger().onDownloaderException(i2, i3); } } catch (Throwable unused) { } } catch (Throwable th) { this.mLock.unlock(); throw th; } } } public Context getContext() { return this.context; } public String getUserAgent() { return this.userAgent; } public void setParamater(int i, int i2, int i3, int i4, int i5, int i6) { this.mLock.lock(); try { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetParameter(i, j, i2, i3, i4, i5, i6); } } finally { this.mLock.unlock(); } } public long getNativeInstance() { return this.mNativeMapengineInstance; } public boolean canStopMapRender(int i) { return this.isEngineRenderComplete; } public int getEngineIDWithType(int i) { return this.mEngineID; } public boolean isEngineCreated(int i) { long j = this.mNativeMapengineInstance; if (j != 0) { return nativeIsEngineCreated(j, i); } return false; } public int getEngineIDWithGestureInfo(EAMapPlatformGestureInfo eAMapPlatformGestureInfo) { return this.mEngineID; } public void setServiceViewRect(int i, int i2, int i3, int i4, int i5, int i6, int i7) { nativeSetServiceViewRect(i, this.mNativeMapengineInstance, i2, i3, i4, i5, i6, i7); } public void setSrvViewStateBoolValue(int i, int i2, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetSrvViewStateBoolValue(i, j, i2, z); } } public boolean getSrvViewStateBoolValue(int i, int i2) { long j = this.mNativeMapengineInstance; if (j != 0) { return nativeGetSrvViewStateBoolValue(i, j, i2); } return false; } public void setIndoorBuildingToBeActive(int i, String str, int i2, String str2) { if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetIndoorBuildingToBeActive(i, j, str, i2, str2); } } } public void setMapListener(IAMapListener iAMapListener) { this.mMapListener = iAMapListener; } /* JADX INFO: finally extract failed */ public GLMapState getMapState(int i) { this.mLock.lock(); try { long j = this.mNativeMapengineInstance; if (j != 0 && this.state == null) { long nativeGetCurrentMapState = nativeGetCurrentMapState(i, j); if (nativeGetCurrentMapState != 0) { this.state = new GLMapState(i, this.mNativeMapengineInstance, nativeGetCurrentMapState); } } this.mLock.unlock(); return this.state; } catch (Throwable th) { this.mLock.unlock(); throw th; } } @Override // com.autonavi.amap.api.mapcore.IGLMapEngine public IGLMapState getNewMapState(int i) { this.mLock.lock(); try { long j = this.mNativeMapengineInstance; if (j != 0) { return new GLMapState(i, j); } this.mLock.unlock(); return null; } finally { this.mLock.unlock(); } } /* JADX INFO: finally extract failed */ public GLMapState getCloneMapState() { this.mLock.lock(); try { long j = this.mNativeMapengineInstance; if (j != 0) { if (this.copyGLMapState == null) { this.copyGLMapState = new GLMapState(this.mEngineID, j); } this.copyGLMapState.setMapZoomer(this.mGlMapView.getMapConfig().getSZ()); this.copyGLMapState.setCameraDegree(this.mGlMapView.getMapConfig().getSC()); this.copyGLMapState.setMapAngle(this.mGlMapView.getMapConfig().getSR()); this.copyGLMapState.setMapGeoCenter(this.mGlMapView.getMapConfig().getSX(), this.mGlMapView.getMapConfig().getSY()); } this.mLock.unlock(); return this.copyGLMapState; } catch (Throwable th) { this.mLock.unlock(); throw th; } } public void setMapState(int i, GLMapState gLMapState) { setMapState(i, gLMapState, true); } public void setMapState(int i, GLMapState gLMapState, boolean z) { IAMapDelegate iAMapDelegate; if (this.mNativeMapengineInstance != 0) { if (!(!z || (iAMapDelegate = this.mGlMapView) == null || iAMapDelegate.getMapConfig() == null)) { this.mGlMapView.checkMapState(gLMapState); } this.mLock.lock(); try { gLMapState.setNativeMapengineState(i, this.mNativeMapengineInstance); } finally { this.mLock.unlock(); } } } private void initAnimation() { if (this.mStateMessageList.size() <= 0) { AbstractCameraUpdateMessage abstractCameraUpdateMessage = null; synchronized (this.mAnimateStateMessageList) { if (this.mAnimateStateMessageList.size() > 0) { abstractCameraUpdateMessage = this.mAnimateStateMessageList.remove(0); } } if (abstractCameraUpdateMessage != null) { abstractCameraUpdateMessage.generateMapAnimation(this); } } } public void addGestureMessage(int i, AbstractGestureMapMessage abstractGestureMapMessage, boolean z, int i2, int i3) { if (abstractGestureMapMessage != null) { abstractGestureMapMessage.isGestureScaleByMapCenter = z; synchronized (this.mGestureMessageList) { this.mGestureMessageList.add(abstractGestureMapMessage); } } } private boolean processMessage() { try { GLMapState gLMapState = (GLMapState) getNewMapState(this.mEngineID); boolean processGestureMessage = processGestureMessage(gLMapState); boolean z = true; if (this.mGestureMessageList.size() <= 0) { if (!processGestureMessage) { if (!processStateMapMessage(gLMapState)) { processGestureMessage = false; } } processGestureMessage = true; } else { synchronized (this.mStateMessageList) { if (this.mStateMessageList.size() > 0) { this.mStateMessageList.clear(); } } } if (!processGestureMessage && !processAnimations(gLMapState)) { z = false; } if (z) { gLMapState.setCameraDegree(dl.a(this.mGlMapView.getMapConfig(), gLMapState.getCameraDegree(), gLMapState.getMapZoomer())); setMapState(this.mEngineID, gLMapState); } gLMapState.recycle(); return z; } catch (Exception e) { e.printStackTrace(); return false; } } /* JADX WARNING: Code restructure failed: missing block: B:18:0x0033, code lost: if (r5.mGestureEndMessageList.size() <= 0) goto L_0x0038; */ /* JADX WARNING: Code restructure failed: missing block: B:19:0x0035, code lost: recycleMessage(); */ /* JADX WARNING: Code restructure failed: missing block: B:20:0x0038, code lost: return true; */ /* JADX WARNING: Code restructure failed: missing block: B:23:0x003c, code lost: if (r2.width != 0) goto L_0x0046; */ /* JADX WARNING: Code restructure failed: missing block: B:24:0x003e, code lost: r2.width = r5.mGlMapView.getMapWidth(); */ /* JADX WARNING: Code restructure failed: missing block: B:26:0x0048, code lost: if (r2.height != 0) goto L_0x0052; */ /* JADX WARNING: Code restructure failed: missing block: B:27:0x004a, code lost: r2.height = r5.mGlMapView.getMapHeight(); */ /* JADX WARNING: Code restructure failed: missing block: B:28:0x0052, code lost: r3 = r2.getMapGestureState(); */ /* JADX WARNING: Code restructure failed: missing block: B:29:0x0058, code lost: if (r3 != 100) goto L_0x005e; */ /* JADX WARNING: Code restructure failed: missing block: B:30:0x005a, code lost: gestureBegin(); */ /* JADX WARNING: Code restructure failed: missing block: B:32:0x0060, code lost: if (r3 != 101) goto L_0x0066; */ /* JADX WARNING: Code restructure failed: missing block: B:33:0x0062, code lost: r2.runCameraUpdate(r6); */ /* JADX WARNING: Code restructure failed: missing block: B:35:0x0068, code lost: if (r3 != 102) goto L_0x006d; */ /* JADX WARNING: Code restructure failed: missing block: B:36:0x006a, code lost: gestureEnd(); */ private boolean processGestureMessage(GLMapState gLMapState) { if (this.mGestureMessageList.size() <= 0) { if (this.isGestureStep) { this.isGestureStep = false; } return false; } this.isGestureStep = true; if (gLMapState == null) { return false; } while (true) { AbstractGestureMapMessage abstractGestureMapMessage = null; synchronized (this.mGestureMessageList) { if (this.mGestureMessageList.size() > 0) { abstractGestureMapMessage = this.mGestureMessageList.remove(0); } if (abstractGestureMapMessage == null) { } } this.mGestureEndMessageList.add(abstractGestureMapMessage); } } private boolean processAnimations(GLMapState gLMapState) { try { if (this.mapAnimationMgr.getAnimationsCount() <= 0) { return false; } gLMapState.recalculate(); this.mapAnimationMgr.doAnimations(gLMapState); return true; } catch (Throwable th) { th.printStackTrace(); return false; } } public void interruptAnimation() { if (isInMapAnimation(this.mEngineID)) { try { doMapAnimationCancelCallback(this.mapAnimationMgr.getCancelCallback()); clearAnimations(this.mEngineID, false); } catch (Throwable th) { il.c(th, getClass().getName(), "CancelableCallback.onCancel"); th.printStackTrace(); } } } @Override // com.autonavi.amap.api.mapcore.IGLMapEngine public void addGroupAnimation(int i, int i2, float f, int i3, int i4, int i5, int i6, AMap.CancelableCallback cancelableCallback) { AdglMapAnimGroup adglMapAnimGroup = new AdglMapAnimGroup(i2); adglMapAnimGroup.setToCameraDegree((float) i4, 0); adglMapAnimGroup.setToMapAngle((float) i3, 0); adglMapAnimGroup.setToMapLevel(f, 0); adglMapAnimGroup.setToMapCenterGeo(i5, i6, 0); if (this.mapAnimationMgr != null && adglMapAnimGroup.isValid()) { this.mapAnimationMgr.addAnimation(adglMapAnimGroup, cancelableCallback); } } private void doMapAnimationCancelCallback(final AMap.CancelableCallback cancelableCallback) { IAMapDelegate iAMapDelegate; if (cancelableCallback != null && (iAMapDelegate = this.mGlMapView) != null) { iAMapDelegate.getMainHandler().post(new Runnable() { /* class com.autonavi.base.ae.gmap.GLMapEngine.AnonymousClass2 */ public void run() { try { cancelableCallback.onCancel(); } catch (Throwable th) { th.printStackTrace(); } } }); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void doMapAnimationFinishCallback(final AMap.CancelableCallback cancelableCallback) { IAMapDelegate iAMapDelegate; IAMapListener iAMapListener = this.mMapListener; if (iAMapListener != null) { iAMapListener.afterAnimation(); } if (cancelableCallback != null && (iAMapDelegate = this.mGlMapView) != null) { iAMapDelegate.getMainHandler().post(new Runnable() { /* class com.autonavi.base.ae.gmap.GLMapEngine.AnonymousClass3 */ public void run() { try { cancelableCallback.onFinish(); } catch (Throwable th) { th.printStackTrace(); } } }); } } public boolean isInMapAnimation(int i) { return getAnimateionsCount() > 0; } public int getAnimateionsCount() { if (this.mNativeMapengineInstance != 0) { return this.mapAnimationMgr.getAnimationsCount(); } return 0; } public void clearAnimations(int i, boolean z) { this.mapAnimationMgr.clearAnimations(); } public void clearAnimations(int i, boolean z, int i2) { this.mapAnimationMgr.clearAnimations(); } public void startMapSlidAnim(int i, Point point, float f, float f2) { if (point != null) { try { clearAnimations(i, true); GLMapState cloneMapState = getCloneMapState(); cloneMapState.reset(); cloneMapState.recalculate(); float abs = Math.abs(f); float abs2 = Math.abs(f2); if ((abs > abs2 ? abs : abs2) > 12000.0f) { float f3 = -12000.0f; if (abs > abs2) { if (f > 0.0f) { f3 = 12000.0f; } f = f3; f2 = (12000.0f / abs) * f2; } else { float f4 = (12000.0f / abs2) * f; if (f2 > 0.0f) { f = f4; f2 = 12000.0f; } else { f = f4; f2 = -12000.0f; } } } if (this.mGlMapView.getMapConfig().isTerrainEnable()) { AdglMapAnimFlingP20 adglMapAnimFlingP20 = new AdglMapAnimFlingP20(500); adglMapAnimFlingP20.setPositionAndVelocity(f, f2); adglMapAnimFlingP20.commitAnimation(cloneMapState); this.mapAnimationMgr.addAnimation(adglMapAnimFlingP20, null); return; } int mapWidth = this.mGlMapView.getMapWidth() >> 1; int mapHeight = this.mGlMapView.getMapHeight() >> 1; if (this.mGlMapView.isUseAnchor()) { mapWidth = this.mGlMapView.getMapConfig().getAnchorX(); mapHeight = this.mGlMapView.getMapConfig().getAnchorY(); } AdglMapAnimFling adglMapAnimFling = new AdglMapAnimFling(500, mapWidth, mapHeight); adglMapAnimFling.setPositionAndVelocity(f, f2); adglMapAnimFling.commitAnimation(cloneMapState); this.mapAnimationMgr.addAnimation(adglMapAnimFling, null); } catch (Throwable th) { th.printStackTrace(); } } } private void gestureBegin() { this.mapGestureCount++; } private void gestureEnd() { int i = this.mapGestureCount - 1; this.mapGestureCount = i; if (i == 0) { recycleMessage(); } } public int getStateMessageCount() { return this.mStateMessageList.size(); } public void addMessage(AbstractCameraUpdateMessage abstractCameraUpdateMessage, boolean z) { if (z) { synchronized (this.mAnimateStateMessageList) { this.mAnimateStateMessageList.clear(); this.mAnimateStateMessageList.add(abstractCameraUpdateMessage); } return; } synchronized (this.mStateMessageList) { this.mStateMessageList.add(abstractCameraUpdateMessage); } } public AbstractCameraUpdateMessage getStateMessage() { synchronized (this.mStateMessageList) { if (this.mStateMessageList.size() == 0) { return null; } return this.mStateMessageList.remove(0); } } private void recycleMessage() { AbstractGestureMapMessage remove; while (this.mGestureEndMessageList.size() > 0 && (remove = this.mGestureEndMessageList.remove(0)) != null) { if (remove instanceof MoveGestureMapMessage) { ((MoveGestureMapMessage) remove).recycle(); } else if (remove instanceof HoverGestureMapMessage) { ((HoverGestureMapMessage) remove).recycle(); } else if (remove instanceof RotateGestureMapMessage) { ((RotateGestureMapMessage) remove).recycle(); } else if (remove instanceof ScaleGestureMapMessage) { ((ScaleGestureMapMessage) remove).recycle(); } } } /* JADX WARNING: Code restructure failed: missing block: B:20:0x0031, code lost: if (r2.width != 0) goto L_0x003b; */ /* JADX WARNING: Code restructure failed: missing block: B:21:0x0033, code lost: r2.width = r5.mGlMapView.getMapWidth(); */ /* JADX WARNING: Code restructure failed: missing block: B:23:0x003d, code lost: if (r2.height != 0) goto L_0x0047; */ /* JADX WARNING: Code restructure failed: missing block: B:24:0x003f, code lost: r2.height = r5.mGlMapView.getMapHeight(); */ private boolean processStateMapMessage(GLMapState gLMapState) { if (this.mStateMessageList.size() <= 0) { if (this.isMoveCameraStep) { this.isMoveCameraStep = false; } return false; } this.isMoveCameraStep = true; if (gLMapState == null) { return false; } while (true) { AbstractCameraUpdateMessage abstractCameraUpdateMessage = null; synchronized (this.mStateMessageList) { if (this.mStateMessageList.size() > 0) { abstractCameraUpdateMessage = this.mStateMessageList.remove(0); } if (abstractCameraUpdateMessage == null) { return true; } } gLMapState.recalculate(); abstractCameraUpdateMessage.runCameraUpdate(gLMapState); } } public void initMapOpenLayer(String str) { long j = this.mNativeMapengineInstance; if (j != 0 && str != null) { nativeInitOpenLayer(this.mEngineID, j, str.getBytes()); } } public void setMapOpenLayerEnable(boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetOpenLayerEnable(this.mEngineID, j, z); } } public void pushRendererState() { long j = this.mNativeMapengineInstance; if (j != 0) { nativePushRendererState(this.mEngineID, j); } } public void popRendererState() { long j = this.mNativeMapengineInstance; if (j != 0) { nativePopRenderState(this.mEngineID, j); } } public int[] getMapModeState(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j == 0) { return null; } nativeGetMapModeState(i, j, z); return null; } public boolean setNativeMapModeAndStyle(int i, int i2, int i3, int i4, boolean z, boolean z2, StyleItem[] styleItemArr) { long j = this.mNativeMapengineInstance; if (j == 0) { return false; } return nativeSetMapModeAndStyle(i, j, new int[]{i2, i3, i4, 0, 0}, z, z2, styleItemArr); } public boolean setMapModeAndStyle(int i, int i2, int i3, int i4, boolean z, boolean z2, StyleItem[] styleItemArr) { if (this.mNativeMapengineInstance == 0) { return false; } boolean nativeMapModeAndStyle = setNativeMapModeAndStyle(i, i2, i3, i4, z, z2, styleItemArr); if (styleItemArr != null && z2) { int customBackgroundColor = this.mGlMapView.getMapConfig().getCustomBackgroundColor(); if (customBackgroundColor != 0) { Context context2 = this.context; setBackgroundTexture(i, dl.a(FileUtil.readFileContentsFromAssets(context2, AMapEngineUtils.MAP_MAP_ASSETS_NAME + File.separator + AMapEngineUtils.MAP_MAP_ASSETS_BACKGROUND_NAME), customBackgroundColor)); } String customTextureResourcePath = this.mGlMapView.getMapConfig().getCustomTextureResourcePath(); if (this.mGlMapView.getMapConfig().isProFunctionAuthEnable() && !TextUtils.isEmpty(customTextureResourcePath)) { this.mGlMapView.getMapConfig().setUseProFunction(true); setCustomStyleTexture(i, FileUtil.readFileContents(customTextureResourcePath)); } } else if (i2 == 0 && i3 == 0 && i4 == 0) { Context context3 = this.context; setBackgroundTexture(i, FileUtil.readFileContentsFromAssets(context3, AMapEngineUtils.MAP_MAP_ASSETS_NAME + File.separator + AMapEngineUtils.MAP_MAP_ASSETS_BACKGROUND_NAME)); Context context4 = this.context; setCustomStyleTexture(i, FileUtil.readFileContentsFromAssets(context4, AMapEngineUtils.MAP_MAP_ASSETS_NAME + File.separator + AMapEngineUtils.MAP_MAP_ASSETS_ICON_5_NAME)); } return nativeMapModeAndStyle; } @Override // com.autonavi.base.amap.mapcore.maploader.NetworkState.NetworkChangeListener public void networkStateChanged(Context context2) { if (!this.mRequestDestroy && this.mNativeMapengineInstance != 0 && this.mGlMapView != null) { this.isNetworkConnected = NetworkState.isNetworkConnected(context2); this.mGlMapView.queueEvent(new Runnable() { /* class com.autonavi.base.ae.gmap.GLMapEngine.AnonymousClass4 */ public void run() { GLMapEngine.nativeSetNetStatus(GLMapEngine.this.mNativeMapengineInstance, GLMapEngine.this.isNetworkConnected ? 1 : 0); } }); } } public byte[] getLabelBuffer(int i, int i2, int i3, int i4) { this.mLock.lock(); try { byte[] bArr = new byte[3072]; long j = this.mNativeMapengineInstance; if (j != 0) { nativeSelectMapPois(i, j, i2, i3, i4, bArr); } return bArr; } finally { this.mLock.unlock(); } } public long createOverlay(int i, int i2) { long j = this.mNativeMapengineInstance; if (j != 0) { return nativeCreateOverlay(i, j, i2); } return 0; } public String addNativeOverlay(int i, int i2, int i3) { long j = this.mNativeMapengineInstance; if (j == 0) { return null; } String nativeAddNativeOverlay = nativeAddNativeOverlay(i, j, i2, i3); if (TextUtils.isEmpty(nativeAddNativeOverlay)) { return null; } return nativeAddNativeOverlay; } public long getGlOverlayMgrPtr(int i) { long j = this.mNativeMapengineInstance; if (j != 0) { return nativeGetGlOverlayMgrPtr(i, j); } return 0; } public void setOvelayBundle(int i, GLOverlayBundle<BaseMapOverlay<?, ?>> gLOverlayBundle) { this.bundle = gLOverlayBundle; } public void addOverlayTexture(int i, GLTextureProperty gLTextureProperty) { if (this.mNativeMapengineInstance != 0 && gLTextureProperty != null && gLTextureProperty.mBitmap != null && !gLTextureProperty.mBitmap.isRecycled()) { nativeAddOverlayTexture(i, this.mNativeMapengineInstance, gLTextureProperty.mId, gLTextureProperty.mAnchor, gLTextureProperty.mXRatio, gLTextureProperty.mYRatio, gLTextureProperty.mBitmap, gLTextureProperty.isGenMimps, gLTextureProperty.isRepeat); } } public GLOverlayBundle getOverlayBundle(int i) { return this.bundle; } public static void destroyOverlay(int i, long j) { synchronized (GLMapEngine.class) { nativeDestroyOverlay(i, j); } } public void setSimple3DEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetSimple3DEnable(i, j, z); } } public void setStyleChangeGradualEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetStyleChangeGradualEnable(i, j, z); } } public void setRoadArrowEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetRoadArrowEnable(i, j, z); } } public void setNaviLabelEnable(int i, boolean z, int i2, int i3) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetNaviLabelEnable(i, j, z, i2, i3); } } public void setSkyTexture(int i, byte[] bArr) { if (bArr != null) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetSkyTexture(i, j, bArr); } } } public void setBackgroundTexture(int i, byte[] bArr) { if (bArr != null) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetSetBackgroundTexture(i, j, bArr); } } } public void setCustomStyleTexture(int i, byte[] bArr) { if (bArr != null) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetCustomStyleTexture(i, j, bArr); } } } public void setCustomStyleData(int i, byte[] bArr, byte[] bArr2) { if (bArr != null) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetCustomStyleData(i, j, bArr, bArr2); } } } public void setCustomThirdLayerStyle(int i, String str) { if (!TextUtils.isEmpty(str)) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetCustomThirdLayerStyle(this.mEngineID, j, str); } } } public void setTrafficEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetTrafficEnable(i, j, z); } } public void setBuildingEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetBuildingEnable(i, j, z); } } public void setLabelEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetLabelEnable(i, j, z); } } public void setAllContentEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { if (z) { nativeSetAllContentEnable(i, j, true); } else { nativeSetAllContentEnable(i, j, false); } setSimple3DEnable(i, false); } } public void setProjectionCenter(int i, int i2, int i3) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetProjectionCenter(i, j, (float) i2, (float) i3); } } public void setTrafficStyleWithTextureData(int i, byte[] bArr) { long j = this.mNativeMapengineInstance; if (j != 0 && bArr != null) { nativeSetTrafficTextureAllInOne(i, j, bArr); } } public void startCheckEngineRenderComplete() { this.isEngineRenderComplete = false; } public void getCurTileIDs(int i, int[] iArr) { if (iArr != null) { for (int i2 = 0; i2 < iArr.length; i2++) { iArr[i2] = 0; } nativeGetCurTileIDs(i, this.mNativeMapengineInstance, iArr, iArr.length); } } public void setIndoorEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetIndoorEnable(i, j, z); } } public void setOfflineDataEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetOfflineDataEnable(i, j, z); } } public void setHighlightSubwayEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetHighlightSubwayEnable(i, j, z); } } public void setBuildingTextureEnable(int i, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetBuildingTextureEnable(i, j, z); } } public void initNativeTexture(int i) { try { BitmapDescriptor fromAsset = BitmapDescriptorFactory.fromAsset("arrow/arrow_line_inner.png"); Bitmap bitmap = null; Bitmap bitmap2 = fromAsset != null ? fromAsset.getBitmap() : null; BitmapDescriptor fromAsset2 = BitmapDescriptorFactory.fromAsset("arrow/arrow_line_outer.png"); Bitmap bitmap3 = fromAsset2 != null ? fromAsset2.getBitmap() : null; BitmapDescriptor fromAsset3 = BitmapDescriptorFactory.fromAsset("arrow/arrow_line_shadow.png"); if (fromAsset3 != null) { bitmap = fromAsset3.getBitmap(); } addOverlayTexture(i, bitmap2, 111, 4); addOverlayTexture(i, bitmap3, AMapEngineUtils.ARROW_LINE_OUTER_TEXTURE_ID, 4); addOverlayTexture(i, bitmap, 333, 4); } catch (Throwable th) { th.printStackTrace(); } } public void addOverlayTexture(int i, Bitmap bitmap, int i2, int i3) { GLTextureProperty gLTextureProperty = new GLTextureProperty(); gLTextureProperty.mId = i2; gLTextureProperty.mAnchor = i3; gLTextureProperty.mBitmap = bitmap; gLTextureProperty.mXRatio = 0.0f; gLTextureProperty.mYRatio = 0.0f; gLTextureProperty.isGenMimps = true; addOverlayTexture(i, gLTextureProperty); } public void updateNativeArrowOverlay(int i, String str, int[] iArr, int[] iArr2, int i2, int i3, int i4, float f, int i5, int i6, int i7, boolean z) { long j = this.mNativeMapengineInstance; if (j != 0 && str != null) { nativeUpdateNativeArrowOverlay(i, j, str, iArr, iArr2, i2, i3, i4, f, z, i5, i6, i7); } } public void removeNativeOverlay(int i, String str) { long j = this.mNativeMapengineInstance; if (j != 0 && str != null) { nativeRemoveNativeOverlay(i, j, str); } } public void removeNativeAllOverlay(int i) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeRemoveNativeAllOverlay(i, j); } } public Bitmap getScreenShot(int i, int i2, int i3, int i4, int i5) { long j = this.mNativeMapengineInstance; if (j != 0) { return dl.a(nativeGetScreenShot(i, j, i2, i3, i4, i5), i4 - i2, i5 - i3, true); } return null; } public GLMapEngine(Context context2, IAMapDelegate iAMapDelegate) { this.mNativeMapengineInstance = 0; this.mGlMapView = null; this.mStateMessageList = new Vector(); this.mGestureMessageList = new Vector(); this.mGestureEndMessageList = new Vector(); this.mAnimateStateMessageList = new Vector(); this.isMoveCameraStep = false; this.isGestureStep = false; this.mapGestureCount = 0; this.mapAnimationMgr = null; this.copyGLMapState = null; this.mLock = new ReentrantLock(); this.mutLock = new Object(); this.mNetworkState = null; this.bundle = null; this.isEngineRenderComplete = false; this.aMapLoaderHashtable = new ConcurrentHashMap(); this.mRequestDestroy = false; this.isNetworkConnected = false; this.terrainTileProvider = null; this.mRequestID = new AtomicInteger(1); this.mRequestDestroy = false; if (context2 != null) { this.context = context2.getApplicationContext(); this.mGlMapView = iAMapDelegate; this.mTextTextureGenerator = new TextTextureGenerator(); AdglMapAnimationMgr adglMapAnimationMgr = new AdglMapAnimationMgr(); this.mapAnimationMgr = adglMapAnimationMgr; adglMapAnimationMgr.setMapAnimationListener(new AdglMapAnimationMgr.MapAnimationListener() { /* class com.autonavi.base.ae.gmap.GLMapEngine.AnonymousClass5 */ @Override // com.autonavi.base.ae.gmap.glanimation.AdglMapAnimationMgr.MapAnimationListener public void onMapAnimationFinish(AMap.CancelableCallback cancelableCallback) { GLMapEngine.this.doMapAnimationFinishCallback(cancelableCallback); } }); this.userAgent = System.getProperty("http.agent") + " amap/" + GlMapUtil.getAppVersionName(context2); this.terrainTileProvider = new TerrainOverlayProvider(iAMapDelegate.getGlOverlayLayer()); this.mEngineID = GLEngineIDController.getController().generate(); } } public boolean createAMapInstance(InitParam initParam) { if (initParam == null) { return false; } synchronized (GLMapEngine.class) { nativeInitParam(initParam.mRootPath, initParam.mConfigContent, initParam.mOfflineDataPath, initParam.mP3dCrossPath); InitStorageParam.Holder.initPath(initParam.mP3dCrossPath); DisplayMetrics displayMetrics = this.context.getResources().getDisplayMetrics(); int i = displayMetrics.densityDpi; float f = displayMetrics.density; float adapterDpiScale = adapterDpiScale(displayMetrics, displayMetrics.widthPixels, displayMetrics.heightPixels, displayMetrics.densityDpi); this.mGlMapView.getMapConfig().setTerrainEnable(MapsInitializer.isTerrainEnable()); long nativeCreateAMapInstance = nativeCreateAMapInstance("", "http://mpsapi.amap.com/", "http://m5.amap.com/", (float) i, f, adapterDpiScale, MapsInitializer.isTerrainEnable() ? 1 : 0); this.mNativeMapengineInstance = nativeCreateAMapInstance; if (nativeCreateAMapInstance == 0) { return false; } nativeInitAMapEngineCallback(nativeCreateAMapInstance, this); initNetworkState(); return true; } } private static String getEMUI() { try { Class<?> cls = Class.forName("android.os.SystemProperties"); return (String) cls.getDeclaredMethod("get", String.class).invoke(cls, "ro.build.version.emui"); } catch (Exception e) { e.printStackTrace(); return null; } } /* JADX WARNING: Removed duplicated region for block: B:33:0x0072 A[ADDED_TO_REGION] */ /* JADX WARNING: Removed duplicated region for block: B:37:0x007f */ /* JADX WARNING: Removed duplicated region for block: B:40:0x0086 */ /* JADX WARNING: Removed duplicated region for block: B:47:? A[RETURN, SYNTHETIC] */ private float adapterDpiScale(DisplayMetrics displayMetrics, int i, int i2, int i3) { int i4; int i5; int i6; float f; String emui = getEMUI(); if (emui == null || emui.isEmpty()) { return 1.0f; } if ((emui.indexOf("EmotionUI_8") == -1 && emui.indexOf("EmotionUI_9") == -1) || i3 <= 0) { return 1.0f; } i4 = 0; try { Field declaredField = DisplayMetrics.class.getDeclaredField("noncompatWidthPixels"); declaredField.setAccessible(true); i5 = declaredField.getInt(displayMetrics); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e2) { e2.printStackTrace(); } try { Field declaredField2 = DisplayMetrics.class.getDeclaredField("noncompatHeightPixels"); declaredField2.setAccessible(true); i6 = declaredField2.getInt(displayMetrics); } catch (NoSuchFieldException e3) { e3.printStackTrace(); } catch (IllegalAccessException e4) { e4.printStackTrace(); } try { Field declaredField3 = DisplayMetrics.class.getDeclaredField("noncompatDensityDpi"); declaredField3.setAccessible(true); i4 = declaredField3.getInt(displayMetrics); } catch (NoSuchFieldException e5) { e5.printStackTrace(); } catch (IllegalAccessException e6) { e6.printStackTrace(); } if (i4 > i3 && i5 <= i && i6 <= i2) { return 1.0f; } f = ((float) i4) / ((float) i3); if (f > 2.0f) { f = 2.0f; } if (f < 1.0f) { return 1.0f; } return f; i6 = 0; Field declaredField32 = DisplayMetrics.class.getDeclaredField("noncompatDensityDpi"); declaredField32.setAccessible(true); i4 = declaredField32.getInt(displayMetrics); if (i4 > i3) { } f = ((float) i4) / ((float) i3); if (f > 2.0f) { } if (f < 1.0f) { } i5 = 0; Field declaredField22 = DisplayMetrics.class.getDeclaredField("noncompatHeightPixels"); declaredField22.setAccessible(true); i6 = declaredField22.getInt(displayMetrics); Field declaredField322 = DisplayMetrics.class.getDeclaredField("noncompatDensityDpi"); declaredField322.setAccessible(true); i4 = declaredField322.getInt(displayMetrics); if (i4 > i3) { } f = ((float) i4) / ((float) i3); if (f > 2.0f) { } if (f < 1.0f) { } } private void initNetworkState() { NetworkState networkState = new NetworkState(); this.mNetworkState = networkState; networkState.setNetworkListener(this); this.mNetworkState.registerNetChangeReceiver(this.context.getApplicationContext(), true); boolean isNetworkConnected2 = NetworkState.isNetworkConnected(this.context.getApplicationContext()); this.isNetworkConnected = isNetworkConnected2; long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetNetStatus(j, isNetworkConnected2 ? 1 : 0); } } public void createAMapEngineWithFrame(MapViewInitParam mapViewInitParam) { if (this.mNativeMapengineInstance != 0) { synchronized (GLMapEngine.class) { nativeCreateAMapEngineWithFrame(this.mNativeMapengineInstance, mapViewInitParam.engineId, mapViewInitParam.x, mapViewInitParam.y, mapViewInitParam.width, mapViewInitParam.height, mapViewInitParam.screenWidth, mapViewInitParam.screenHeight, mapViewInitParam.screenScale, mapViewInitParam.textScale, mapViewInitParam.mapZoomScale, mapViewInitParam.taskThreadCount); } if (this.mGlMapView.getMapConfig().isTerrainEnable()) { setCustomStyleData(mapViewInitParam.engineId, FileUtil.uncompressToByteArray(FileUtil.readFileContentsFromAssets(this.context, "map_assets/style_1_17_for_terrain.data")), null); } } } public void renderAMap() { if (this.mNativeMapengineInstance != 0) { boolean processMessage = processMessage(); synchronized (GLMapEngine.class) { nativeRenderAMap(this.mNativeMapengineInstance, this.mEngineID); nativePostRenderAMap(this.mNativeMapengineInstance, this.mEngineID); } initAnimation(); if (processMessage) { startCheckEngineRenderComplete(); } if (!this.isEngineRenderComplete) { nativeSetRenderListenerStatus(this.mEngineID, this.mNativeMapengineInstance); } } } public void releaseNetworkState() { NetworkState networkState = this.mNetworkState; if (networkState != null) { networkState.registerNetChangeReceiver(this.context.getApplicationContext(), false); this.mNetworkState.setNetworkListener(null); this.mNetworkState = null; } } public void cancelAllAMapDownload() { try { for (Map.Entry<Long, AMapLoader> entry : this.aMapLoaderHashtable.entrySet()) { entry.getValue().doCancelAndNotify(); } this.aMapLoaderHashtable.clear(); } catch (Throwable th) { th.printStackTrace(); } } /* JADX INFO: finally extract failed */ public void destroyAMapEngine() { try { this.mRequestDestroy = true; cancelAllAMapDownload(); synchronized (this.mutLock) { if (this.mNativeMapengineInstance != 0) { this.mLock.lock(); try { GLMapState gLMapState = this.copyGLMapState; if (gLMapState != null) { gLMapState.recycle(); } this.mLock.unlock(); nativeDestroyCurrentState(this.mNativeMapengineInstance, this.state.getNativeInstance()); nativeDestroy(this.mNativeMapengineInstance); } catch (Throwable th) { this.mLock.unlock(); throw th; } } this.mNativeMapengineInstance = 0; } this.mGlMapView = null; synchronized (this.mStateMessageList) { this.mStateMessageList.clear(); } synchronized (this.mAnimateStateMessageList) { this.mAnimateStateMessageList.clear(); } synchronized (this.mGestureMessageList) { this.mGestureMessageList.clear(); } this.mGestureEndMessageList.clear(); this.mMapListener = null; this.bundle = null; dj.b(); } catch (Throwable th2) { th2.printStackTrace(); dl.a(th2); } } public long getNativeMapController(int i) { long j = this.mNativeMapengineInstance; if (j != 0) { return nativeGetNativeMapController(i, j); } return 0; } public boolean isNetworkConnected() { return this.isNetworkConnected; } @Override // com.autonavi.base.amap.mapcore.IAMapEngineCallback public InitStorageParam getStorageInitParam() { return InitStorageParam.obtain(); } public void setVectorOverlayPath(String str) { long j = this.mNativeMapengineInstance; if (j != 0) { nativeSetVectorOverlayPath(this.mEngineID, j, str); } } }