我有一些要求来保护一些敏感数据.数据从URL下载为PDF,并使用以下代码保存为应用程序专用文件:
public File downloadPDF(final Context fileContext, Uri reportUri, final String fileName)
{
try
{
HttpGet get = new HttpGet(reportUri.toString());
File file = httpClient.execute(get, new ResponseHandler<File>()
{
@Override
public File handleResponse(HttpResponse response) throws ClientProtocolException, IOException
{
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK)
{
response.getEntity().writeTo(fileContext.openFileOutput(fileName, Context.MODE_WORLD_READABLE));
return fileContext.getFileStreamPath(fileName);
}
return null;
}
});
return file;
}
catch (IOException e)
{
Log.e(TAG, "Unable to download report.", e);
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
现在,我想要做的是将其更改为使用Context.MODE_PRIVATE并创建一个ContentProvider,以便我的应用程序可以完全控制将此文件共享到PDF阅读器(如Adobe Reader).这可能吗?我目前使用以下代码将报告URI传递给当前配置的PDF阅读器.
// Fire up a PDF viewer intent for the URL.
Intent intent …Run Code Online (Sandbox Code Playgroud) 我一直在我的 Android 项目上使用 Gradle 在命令行上运行我的代码覆盖率报告,使用以下命令:
./gradlew createDebugCoverageReport
Run Code Online (Sandbox Code Playgroud)
这有效,并生成了一个报告,其中包含我整个项目中的几乎每个包,包括第三方库。我想配置覆盖率报告以仅提供有关我的代码的信息。如何在 Android Studio 工具链生成的内置覆盖率报告中的 Jacoco 报告中设置代码路径、包含和排除?
我没有在我的构建脚本中包含任何 Jacoco 插件,我只是testCoverageEnabled true在我的调试 buildType 中添加了。
谢谢!
android android-studio android-gradle-plugin android-studio-2.3
android ×2