diff --git a/android-godeye-sample/src/main/assets/android-godeye-config/install.config b/android-godeye-sample/src/main/assets/android-godeye-config/install.config
index 84535278..24b1a934 100644
--- a/android-godeye-sample/src/main/assets/android-godeye-config/install.config
+++ b/android-godeye-sample/src/main/assets/android-godeye-config/install.config
@@ -2,7 +2,7 @@
-
+
diff --git a/android-godeye-toolboxes/android-godeye-leakcanary/src/main/java/cn/hikyson/android/godeye/leakcanary/GodEyePluginLeakCanary.java b/android-godeye-toolboxes/android-godeye-leakcanary/src/main/java/cn/hikyson/android/godeye/leakcanary/GodEyePluginLeakCanary.java
index 6a160ccc..408212ff 100644
--- a/android-godeye-toolboxes/android-godeye-leakcanary/src/main/java/cn/hikyson/android/godeye/leakcanary/GodEyePluginLeakCanary.java
+++ b/android-godeye-toolboxes/android-godeye-leakcanary/src/main/java/cn/hikyson/android/godeye/leakcanary/GodEyePluginLeakCanary.java
@@ -30,7 +30,7 @@ public void run() {
LeakCanary.INSTANCE.showLeakDisplayActivityLauncherIcon(false);
LeakCanary.setConfig(new LeakCanary.Config().newBuilder()
.requestWriteExternalStoragePermission(false)
- .dumpHeap(leakModule.config().debug())
+ .dumpHeap(true)
.onHeapAnalyzedListener(new OnHeapAnalyzedListener() {
@Override
public void onHeapAnalyzed(@NotNull HeapAnalysis heapAnalysis) {
diff --git a/android-godeye/src/main/java/cn/hikyson/godeye/core/GodEyeConfig.java b/android-godeye/src/main/java/cn/hikyson/godeye/core/GodEyeConfig.java
index 787f6392..ad243cd1 100644
--- a/android-godeye/src/main/java/cn/hikyson/godeye/core/GodEyeConfig.java
+++ b/android-godeye/src/main/java/cn/hikyson/godeye/core/GodEyeConfig.java
@@ -112,14 +112,7 @@ public static GodEyeConfig fromInputStream(InputStream is) {
// leak
element = getFirstElementByTagInRoot(root, "leakCanary");
if (element != null) {
- final String debug = element.getAttribute("debug");
- LeakConfig leakConfig = new LeakConfig();
- if (!TextUtils.isEmpty(debug)) {
- leakConfig.debug = Boolean.parseBoolean(debug);
- } else {
- leakConfig.debug = true;
- }
- builder.withLeakConfig(leakConfig);
+ builder.withLeakConfig(new LeakConfig());
}
// heap
element = getFirstElementByTagInRoot(root, "heap");
diff --git a/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/leakdetector/LeakConfig.java b/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/leakdetector/LeakConfig.java
index ec269346..580af87c 100644
--- a/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/leakdetector/LeakConfig.java
+++ b/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/leakdetector/LeakConfig.java
@@ -9,6 +9,10 @@
@Keep
public class LeakConfig implements Serializable {
// if you want leak module work in production,set debug false
+ /**
+ * @deprecated
+ */
+ @Deprecated
public boolean debug;
/**
* @deprecated
@@ -31,13 +35,20 @@ public LeakConfig(boolean debug, boolean debugNotification, String leakRefInfoPr
}
public LeakConfig() {
- this.debug = true;
}
+ /**
+ * @deprecated
+ */
+ @Deprecated
public LeakConfig(boolean debug) {
this.debug = debug;
}
+ /**
+ * @deprecated
+ */
+ @Deprecated
public boolean debug() {
return debug;
}
@@ -63,8 +74,6 @@ public String leakRefInfoProvider() {
@Override
public String toString() {
- return "LeakConfig{" +
- "debug=" + debug +
- '}';
+ return "LeakConfig{}";
}
}
\ No newline at end of file
diff --git a/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtil.java b/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtil.java
index 052f70c1..78c8bea5 100644
--- a/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtil.java
+++ b/android-godeye/src/main/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtil.java
@@ -34,19 +34,19 @@ public static HeapInfo getAppHeapInfo() {
return heapInfo;
}
- /**
- * get native heap
- *
- * @return
- */
- public static NativeHeapInfo getAppNativeHeap() {
- NativeHeapInfo nativeHeapInfo = new NativeHeapInfo();
-
- nativeHeapInfo.heapSizeKb = Debug.getNativeHeapSize() / 1024;
- nativeHeapInfo.heapAllocatedKb = Debug.getNativeHeapAllocatedSize() / 1024;
- nativeHeapInfo.heapFreeSizeKb = Debug.getNativeHeapFreeSize() / 1024;
- return nativeHeapInfo;
- }
+// /**
+// * get native heap
+// *
+// * @return
+// */
+// public static NativeHeapInfo getAppNativeHeap() {
+// NativeHeapInfo nativeHeapInfo = new NativeHeapInfo();
+//
+// nativeHeapInfo.heapSizeKb = Debug.getNativeHeapSize() / 1024;
+// nativeHeapInfo.heapAllocatedKb = Debug.getNativeHeapAllocatedSize() / 1024;
+// nativeHeapInfo.heapFreeSizeKb = Debug.getNativeHeapFreeSize() / 1024;
+// return nativeHeapInfo;
+// }
/**
* 获取应用实际占用RAM
diff --git a/android-godeye/src/test/java/cn/hikyson/godeye/core/GodEyeConfigTest.java b/android-godeye/src/test/java/cn/hikyson/godeye/core/GodEyeConfigTest.java
index 5859332b..b0873e93 100644
--- a/android-godeye/src/test/java/cn/hikyson/godeye/core/GodEyeConfigTest.java
+++ b/android-godeye/src/test/java/cn/hikyson/godeye/core/GodEyeConfigTest.java
@@ -185,7 +185,6 @@ private void assertConfig(GodEyeConfig config) {
assertEquals(2000, config.getFpsConfig().intervalMillis());
assertEquals(2000, config.getHeapConfig().intervalMillis());
assertEquals("cn.hikyson.godeye.core.internal.modules.imagecanary.DefaultImageCanaryConfigProvider", config.getImageCanaryConfig().getImageCanaryConfigProvider());
- assertEquals(true, config.getLeakConfig().debug());
assertEquals(10, config.getMethodCanaryConfig().lowCostMethodThresholdMillis());
assertEquals(300, config.getMethodCanaryConfig().maxMethodCountSingleThreadByCost());
assertEquals(JsonUtil.toJson(new NetworkConfig()), JsonUtil.toJson(config.getNetworkConfig()));
diff --git a/android-godeye/src/test/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtilTest.java b/android-godeye/src/test/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtilTest.java
new file mode 100644
index 00000000..fd846977
--- /dev/null
+++ b/android-godeye/src/test/java/cn/hikyson/godeye/core/internal/modules/memory/MemoryUtilTest.java
@@ -0,0 +1,41 @@
+package cn.hikyson.godeye.core.internal.modules.memory;
+
+import android.os.Build;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+import cn.hikyson.godeye.core.GodEye;
+import cn.hikyson.godeye.core.helper.RoboTestApplication;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(sdk = Build.VERSION_CODES.LOLLIPOP, application = RoboTestApplication.class)
+public class MemoryUtilTest {
+
+ @Test
+ public void getAppHeapInfo() {
+ HeapInfo heapInfo = MemoryUtil.getAppHeapInfo();
+ Assert.assertTrue(heapInfo.allocatedKb > 0);
+ Assert.assertTrue(heapInfo.freeMemKb > 0);
+ Assert.assertTrue(heapInfo.maxMemKb > 0);
+ }
+
+ @Test
+ public void getAppPssInfo() {
+ try {
+ PssInfo pssInfo = MemoryUtil.getAppPssInfo(GodEye.instance().getApplication());
+ } catch (NullPointerException ignore) {
+ } catch (Throwable e) {
+ Assert.fail();
+ }
+ }
+
+ @Test
+ public void getRamInfo() {
+ RamInfo ramInfo = MemoryUtil.getRamInfo(GodEye.instance().getApplication());
+ Assert.assertNotNull(ramInfo);
+ }
+}
\ No newline at end of file
diff --git a/android-godeye/src/test/resources/install.config b/android-godeye/src/test/resources/install.config
index 84535278..24b1a934 100644
--- a/android-godeye/src/test/resources/install.config
+++ b/android-godeye/src/test/resources/install.config
@@ -2,7 +2,7 @@
-
+
diff --git a/android-godeye/src/test/resources/install2.config b/android-godeye/src/test/resources/install2.config
index 5e5cbdd7..3b34dda7 100644
--- a/android-godeye/src/test/resources/install2.config
+++ b/android-godeye/src/test/resources/install2.config
@@ -2,7 +2,7 @@
-
+