diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-03-11 17:26:54 -0500 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2016-03-11 20:07:56 -0500 |
commit | 45e6ee13728b3006a38097d64bfac54b38b4ef35 (patch) | |
tree | aa8197a69d393d69045b8fdf067fddada9b6de76 | |
parent | c39bd344b513fc25bdf9b35f766b8997059f960d (diff) | |
download | qtlocation-mapboxgl-45e6ee13728b3006a38097d64bfac54b38b4ef35.tar.gz |
[android] #4283 - enable strict mode in test app + fix strict mode warning related to releasing the surface
2 files changed, 17 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index afc2f1e24e..23141c94e7 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -1246,11 +1246,13 @@ public class MapView extends FrameLayout { // This class handles TextureView callbacks private class SurfaceTextureListener implements TextureView.SurfaceTextureListener { + private Surface mSurface; + // Called when the native surface texture has been created // Must do all EGL/GL ES initialization here @Override public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { - mNativeMapView.createSurface(new Surface(surface)); + mNativeMapView.createSurface(mSurface = new Surface(surface)); mNativeMapView.resizeFramebuffer(width, height); } @@ -1261,6 +1263,7 @@ public class MapView extends FrameLayout { if (mNativeMapView != null) { mNativeMapView.destroySurface(); } + mSurface.release(); return true; } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java index e6d3327b99..4b1305daed 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.testapp; import android.app.Application; +import android.os.StrictMode; import com.squareup.leakcanary.LeakCanary; @@ -10,5 +11,17 @@ public class MapboxApplication extends Application { public void onCreate() { super.onCreate(); LeakCanary.install(this); + StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() + .detectDiskReads() + .detectDiskWrites() + .detectNetwork() // or .detectAll() for all detectable problems + .penaltyLog() + .build()); + StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder() + .detectLeakedSqlLiteObjects() + .detectLeakedClosableObjects() + .penaltyLog() + .penaltyDeath() + .build()); } } |