android 写卡权限,Android 9.0 添加 SD 卡写权限

  • Post author:
  • Post category:其他


1、方法一

system\vold\model\PublicVolume.cpp

if (!(mFusePid = fork())) {

if (getMountFlags() & MountFlags::kPrimary) {

if (execl(kFusePath, kFusePath,

“-u”, “1023”, // AID_MEDIA_RW

“-g”, “1023”, // AID_MEDIA_RW

“-U”, std::to_string(getMountUserId()).c_str(),

“-w”,

mRawPath.c_str(),

stableName.c_str(),

NULL)) {

PLOG(ERROR) << “Failed to exec”;

}

} else {

if (execl(kFusePath, kFusePath,

“-u”, “1023”, // AID_MEDIA_RW

“-g”, “1023”, // AID_MEDIA_RW

“-U”, std::to_string(getMountUserId()).c_str(),

“-w”, // 添加 写 权限就是这样

mRawPath.c_str(),

stableName.c_str(),

NULL)) {

PLOG(ERROR) << “Failed to exec”;

}

}

LOG(ERROR) << “FUSE exiting”;

_exit(1);

}

文件参考:

Android 9.0 SD卡写入权限问题

https://blog.csdn.net/qq_36467463/article/details/88691726

【Android笔记】Android 9.0 SD卡读写权限问题

https://www.jianshu.com/p/f1329c001fd9

Android 9.0中sdcard 的权限和挂载问题

https://blog.csdn.net/shift_wwx/article/details/85633801

安卓内外部存储完全解析 – 别再弄混了

https://www.jianshu.com/p/116025bf51f7

Android 获取外置SD卡

https://www.2cto.com/kf/201502/377175.html

【译】如何在 Android 5.0 上获取 SD卡 的读写权限

https://blog.csdn.net/I_wait_for_you/article/details/70240114

Android 5.1 修改第三方APP读写外置SD卡权限

https://blog.csdn.net/yhyqf/article/details/85317777

Android P 外置 SD 卡写入权限问题

https://blog.csdn.net/ch853199769/article/details/88052886