错误信息:

04-18 14:56:58.283  4440  4440 W System.err: android.os.FileUriExposedException: file:///storage/emulated/0/temp.jpg exposed beyond app through ClipData.Item.getUri()
04-18 14:56:58.283  4440  4440 W System.err:    at android.os.StrictMode.onFileUriExposed(StrictMode.java:1799)
04-18 14:56:58.283  4440  4440 W System.err:    at android.net.Uri.checkFileUriExposed(Uri.java:2346)
04-18 14:56:58.283  4440  4440 W System.err:    at android.content.ClipData.prepareToLeaveProcess(ClipData.java:845)
04-18 14:56:58.283  4440  4440 W System.err:    at android.content.Intent.prepareToLeaveProcess(Intent.java:9044)
04-18 14:56:58.283  4440  4440 W System.err:    at android.content.Intent.prepareToLeaveProcess(Intent.java:9029)
04-18 14:56:58.283  4440  4440 W System.err:    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
04-18 14:56:58.283  4440  4440 W System.err:    at android.app.Activity.startActivityForResult(Activity.java:4341)
04-18 14:56:58.283  4440  4440 W System.err:    at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
04-18 14:56:58.283  4440  4440 W System.err:    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
04-18 14:56:58.283  4440  4440 W System.err:    at android.app.Activity.startActivityForResult(Activity.java:4299)
04-18 14:56:58.283  4440  4440 W System.err:    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:856)
04-18 14:56:58.283  4440  4440 W System.err:    at com.longdai.android.ui.ui2.PersonInfoActivity.b(PersonInfoActivity.java:110)
04-18 14:56:58.283  4440  4440 W System.err:    at com.longdai.android.ui.ui2.PersonInfoActivity$2.onClick(PersonInfoActivity.java:388)
04-18 14:56:58.283  4440  4440 W System.err:    at android.view.View.performClick(View.java:5642)
04-18 14:56:58.283  4440  4440 W System.err:    at android.view.View$PerformClick.run(View.java:22489)
04-18 14:56:58.283  4440  4440 W System.err:    at android.os.Handler.handleCallback(Handler.java:751)
04-18 14:56:58.283  4440  4440 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:95)
04-18 14:56:58.283  4440  4440 W System.err:    at android.os.Looper.loop(Looper.java:154)
04-18 14:56:58.283  4440  4440 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:6217)
04-18 14:56:58.283  4440  4440 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
04-18 14:56:58.283  4440  4440 W System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1108)
04-18 14:56:58.283  4440  4440 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:998)
04-18 14:56:58.323   548   635 W SurfaceFlinger: eventControl: set enabled=0

官网对于此的限制说明:

https://developer.android.com/reference/android/os/FileUriExposedException.html

The exception that is thrown when an application exposes a file:// Uri to another app.
This exposure is discouraged since the receiving app may not have access to the shared path. For example, the receiving app may not have requested the READ_EXTERNAL_STORAGE runtime permission, or the platform may be sharing the Uri across user profile boundaries.
Instead, apps should use content:// Uris so the platform can extend temporary permission for the receiving app to access the resource.
This is only thrown for applications targeting N or higher. Applications targeting earlier SDK versions are allowed to share file:// Uri, but it's strongly discouraged.

对于代码变化的说明:

在6.0的代码:

/frameworks/base/core/java/android/os/StrictMode.java

1752    /**
1753 * @hide
1754 */
1755 public static void onFileUriExposed(String location) {
1756 final String message = "file:// Uri exposed through " + location;
1757 onVmPolicyViolation(null, new Throwable(message));
1758 }

在7.0的代码:

/frameworks/base/core/java/android/os/StrictMode.java

1793    /**
1794 * @hide
1795 */
1796 public static void onFileUriExposed(Uri uri, String location) {
1797 final String message = uri + " exposed beyond app through " + location;
1798 if ((sVmPolicyMask & PENALTY_DEATH_ON_FILE_URI_EXPOSURE) != 0) {
1799 throw new FileUriExposedException(message);
1800 } else {
1801 onVmPolicyViolation(null, new Throwable(message));
1802 }
1803 }

最新文章

  1. Angularjs 双向绑定机制解析
  2. iOS创建自定义的xib视图,不带控制器调用
  3. NSString几个函数
  4. 开通了cnblogs
  5. #define的一些
  6. 转:Java图形化界面设计——布局管理器之FlowLayout(流式布局)其他请参考转载出处网址
  7. 【剑指Offer学习】【面试题40:数组中仅仅出现一次的数字】
  8. 那么温暖http合约,入门。
  9. PAT1006
  10. adb 安装apk 报错:Failure [INSTALL_FAILED_ALREADY_EXISTS]
  11. 一些精妙的sql语句收集
  12. rt-thread的位图调度算法分析
  13. .net core webapi 将localhost改成ip地址
  14. Git-git push -u为何第二次不用指定-u?
  15. php curl批处理--可控并发异步
  16. 用好这6个APP,学英语SO EASY!
  17. red hat官方的rhel操作系统版本号与内核版本号的对应关系
  18. 说说M451的例程库的说明
  19. 马士兵Spring-AOP-XML配置(2)
  20. 电信NB-IOT的温湿度采集器开发记录

热门文章

  1. Jboss JNDI ENC 数据源
  2. oracle--多表联合查询sql92版
  3. linux中常用的60个命令及作用详解
  4. HDU 6468 /// DFS
  5. P2586 [ZJOI2008]杀蚂蚁(模拟)
  6. PhotonServer新增应用的配置
  7. HTML拖放元素
  8. Linux下安装Dubbox
  9. $2019$ 暑期刷题记录1:(算法竞赛DP练习)
  10. Rabbit给单独的消息设置超时