当前位置: 首页>>代码示例>>Java>>正文


Java LeakCanaryInternals类代码示例

本文整理汇总了Java中com.squareup.leakcanary.internal.LeakCanaryInternals的典型用法代码示例。如果您正苦于以下问题:Java LeakCanaryInternals类的具体用法?Java LeakCanaryInternals怎么用?Java LeakCanaryInternals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LeakCanaryInternals类属于com.squareup.leakcanary.internal包,在下文中一共展示了LeakCanaryInternals类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dumpHeap

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public File dumpHeap() {
    if (!LeakCanaryInternals.isExternalStorageWritable()) {
        Log.d(TAG, "Could not dump heap, external storage not mounted.");
    }
    File heapDumpFile = getHeapDumpFile();
    if (heapDumpFile.exists()) {
        Log.d(TAG, "Could not dump heap, previous analysis still is in progress.");
        return NO_DUMP;
    }
    FutureResult<Toast> waitingForToast = new FutureResult();
    showToast(waitingForToast);
    if (waitingForToast.wait(5, TimeUnit.SECONDS)) {
        Toast toast = (Toast) waitingForToast.get();
        try {
            Debug.dumpHprofData(heapDumpFile.getAbsolutePath());
            cancelToast(toast);
            return heapDumpFile;
        } catch (IOException e) {
            cleanup();
            Log.e(TAG, "Could not perform heap dump", e);
            return NO_DUMP;
        }
    }
    Log.d(TAG, "Did not dump heap, too much time waiting for Toast.");
    return NO_DUMP;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:27,代码来源:AndroidHeapDumper.java

示例2: cleanup

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public void cleanup() {
    LeakCanaryInternals.executeOnFileIoThread(new Runnable() {
        public void run() {
            if (LeakCanaryInternals.isExternalStorageWritable()) {
                Log.d(AndroidHeapDumper.TAG, "Could not attempt cleanup, external storage not" +
                        " mounted.");
            }
            File heapDumpFile = AndroidHeapDumper.this.getHeapDumpFile();
            if (heapDumpFile.exists()) {
                Log.d(AndroidHeapDumper.TAG, "Previous analysis did not complete correctly, " +
                        "cleaning: " + heapDumpFile);
                heapDumpFile.delete();
            }
        }
    });
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:AndroidHeapDumper.java

示例3: cleanup

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
/**
 * Call this on app startup to clean up all heap dump files that had not been handled yet when
 * the app process was killed.
 */
public void cleanup() {
  LeakCanaryInternals.executeOnFileIoThread(new Runnable() {
    @Override public void run() {
      if (!leakDirectoryProvider.isLeakStorageWritable()) {
        CanaryLog.d("Could not attempt cleanup, leak storage not writable.");
        return;
      }
      File heapDumpFile = getHeapDumpFile();
      if (heapDumpFile.exists()) {
        CanaryLog.d("Previous analysis did not complete correctly, cleaning: %s", heapDumpFile);
        boolean success = heapDumpFile.delete();
        if (!success) {
          CanaryLog.d("Could not delete file %s", heapDumpFile.getPath());
        }
      }
    }
  });
}
 
开发者ID:shengxiadeyu,项目名称:leakcannary,代码行数:23,代码来源:AndroidHeapDumper.java

示例4: ServiceHeapDumpListener

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public ServiceHeapDumpListener(Context context, Class<? extends
        AbstractAnalysisResultService> listenerServiceClass) {
    LeakCanaryInternals.setEnabled(context, listenerServiceClass, true);
    LeakCanaryInternals.setEnabled(context, HeapAnalyzerService.class, true);
    this.listenerServiceClass = (Class) Preconditions.checkNotNull(listenerServiceClass,
            "listenerServiceClass");
    this.context = ((Context) Preconditions.checkNotNull(context, "context"))
            .getApplicationContext();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:ServiceHeapDumpListener.java

示例5: setIconBadge

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public static void setIconBadge(Context context, int count) {
    try {
        if (!Build.MANUFACTURER.equalsIgnoreCase(MiBandHelper.KEY_DATA_SOURCE)) {
            if (Build.MANUFACTURER.equalsIgnoreCase(LeakCanaryInternals.SAMSUNG)) {
                setToSamsumg(context, count);
            } else if (Build.MANUFACTURER.toLowerCase().contains("sony")) {
                setToSony(context, count);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:BadgeUtils.java

示例6: enableDisplayLeakActivity

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public static void enableDisplayLeakActivity(Context context) {
    LeakCanaryInternals.setEnabled(context, DisplayLeakActivity.class, true);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:LeakCanary.java

示例7: isInAnalyzerProcess

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
public static boolean isInAnalyzerProcess(Context context) {
    return LeakCanaryInternals.isInServiceProcess(context, HeapAnalyzerService.class);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:LeakCanary.java

示例8: getHeapDumpFile

import com.squareup.leakcanary.internal.LeakCanaryInternals; //导入依赖的package包/类
private File getHeapDumpFile() {
    return new File(LeakCanaryInternals.storageDirectory(), "suspected_leak_heapdump.hprof");
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:AndroidHeapDumper.java


注:本文中的com.squareup.leakcanary.internal.LeakCanaryInternals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。