问题描述:如题,在调试android 9 高通msm8953平台时,客户反馈应用在允许Manifest.permission.WRITE_EXTERNAL_STORAGE权限后,应用闪退。
从log分析是
07-22 09:56:02.331 I/ActivityManager( 1658): Killing 9824:com.xxx.xxx/u0a123 (adj 100): permission grant or revoke changed gids
系统认为gids变了就要杀掉应用
参考:Android动态申请Camera权限应用闪退问题
系统侧根据android低版本的权限配置文件进行修改即可。
===================================================================
--- frameworks/base/data/etc/platform.xml (版本 1246)
+++ frameworks/base/data/etc/platform.xml (版本 1240)
@@ -60,6 +60,18 @@
<group gid="log" />
</permission>
- <permission name="android.permission.READ_EXTERNAL_STORAGE" >
- <group gid="sdcard_r" />
- </permission>
-
- <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
- <group gid="sdcard_r" />
- <group gid="sdcard_rw" />
- <group gid="sdcard_all" />
- <group gid="camera" />
- <group gid="media_rw" />
- </permission>
-
<permission name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" >
<group gid="sdcard_r" />
<group gid="sdcard_rw" />
@@ -73,10 +85,6 @@
<group gid="media_rw" />
</permission>
<permission name="android.permission.ACCESS_MTP" >
<group gid="mtp" />
</permission>
@@ -139,8 +147,6 @@
is negligible (one tag with the permission) compared to
the fragility as one can remove a built-in permission which
no longer needs to be mapped to gids and break grant propagation. -->
+ <permission name="android.permission.READ_EXTERNAL_STORAGE" />
+ <permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- ================================================================== -->
<!-- ================================================================== -->