AndroidSafFile
Introduction: A wrapper of Android Storage Access Framework for writing files on Ext SD card in both Java and JNI native code.
Tags:
A wrapper of Android Storage Access Framework for writing files on Ext SD card in both Java and JNI native code.
Use DocumentFile for Java code to write,
and xhook to hook native code (such as fopen, mkdir, remove),
so that the native code can use SAF to write file.
[Java usage]
See `SafFile.java' in detail.
- Use
requestDocUrito get thedocUri, and usesaveDocUriFromResultinonActivityResultto save thedocUriinSharedPreference - You can write the file on EXT sdcard by
writeFileSafas well as the other Saf fucntions.
[JNI Usage]
- Use
build.cmdto buildlibyurihook.so, then putlibyurihook.soandlibxhook.soto your app's lib - Load the
libyurihook.soin your app - Use
nativeInitSafJavaCallbacks()andnativeHookFile(String hooksoStr, String soPath)
for jni file hook.hooksoStr, which passed toxhook_register, can use regex to match the hooked path(all of them are hooked), such as ".*\.so$"soPath, if not null, it will dlopen that path before hook
