Tuning of Android MediaStore & File IO compatibility issues between HostProfile app and WorkProfile app (DualApp/ParallelApp), especially for OEM Android Devices.
Also run the smoking tests for Android's Scoped Storage Feature.
- Create Profile
adb shell pm create-user --profileOf 0 --managed Island
adb -d shell pm list users
adb -d shell settings --user <user_id> put secure install_non_market_apps 1
- Install apk to Profile
adb push <apk_path> /data/local/tmp/android.apk
adb shell pm install -r -t --user <user_id> /data/local/tmp/android.apk
- WorkProfile/DualApp/MutliApp Recognize.
- Read & Write file by MediaStore within DualApp.
- File Uri/FilePath Convert within DualApp.
- Handle sharing file within DualApp.
- Files manipulations smoking test.
All IO tested above works perfectly within Google Pixel of Android 10/11/12. FileProvider is needed when interacting between HostProfile app and WorkProfile app.
OEM Android Devices' DualApp(or MultiApp, mostly with a UserId 999
) works like WorkProfile(mostly with a UserId 10+
).
But unlike WorkProfile, DualApp MediaStore saves files into path of user xxx-0
but not 999
. This
causes some problems:
- WorkProfile App can not directly access files saved by MediaStore itself in OEM devices (Huawei, OPPO confirmed), when query by file path.
- MediaStore query return missing within WorkProfile app when receiving sharing files from HostProfile app.
- HostProfile App might get wrong file path, which is actually DualApp's, when query file by MediaStore.