diff --git a/appdata-sandbox.json b/appdata-sandbox.json index 5994d20f6a27f0475067bdb6f81174d7c10bd2e4..de810d69020ebdd60a9dea76d5642fdecc337caf 100644 --- a/appdata-sandbox.json +++ b/appdata-sandbox.json @@ -251,6 +251,24 @@ } ], "symbol-links" : [] + }], + "com.ohos.UserFile.ExternalFileManager" : [{ + "sandbox-switch": "ON", + "sandbox-root" : "/mnt/sandbox/", + "mount-bind-paths" : [{ + "src-path" : "/data/service/el1/public/storage_daemon/share/public", + "sandbox-path" : "/data/storage/el1/bundle/storage_daemon", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "true" + }, + { + "src-path" : "/mnt/external", + "sandbox-path" : "/mnt/external", + "sandbox-flags" : [ "bind", "rec" ], + "check-action-status": "true" + } + ], + "symbol-links" : [] }] }] } diff --git a/common/appspawn_server.h b/common/appspawn_server.h index c344470d65b25e60ca855701a046b557fd8f8237..eb457ce01ee3a4eda2758849dbfe10df0acdf03a 100644 --- a/common/appspawn_server.h +++ b/common/appspawn_server.h @@ -34,6 +34,7 @@ extern "C" { #define ERR_PIPE_FAIL (-100) #define MAX_LEN_SHORT_NAME 16 #define WAIT_DELAY_US (100 * 1000) // 100ms +#define GID_FILE_ACCESS 1006 // only used for ExternalFileManager.hap #define GID_USER_DATA_RW 1008 typedef struct AppSpawnClient_ { diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index 570d3d9a82aef926a3a5375acbe22fd9ccb509be..f26ea0deb5e5c11209f05e51725a9c40ee2a6c7f 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -203,6 +203,14 @@ static void SignalHandler(const struct signalfd_siginfo *siginfo) static void HandleSpecial(AppSpawnClientExt *appProperty) { + const char *fileExtensionHapBundleName = "com.ohos.UserFile.ExternalFileManager"; + if (strcmp(appProperty->property.bundleName, fileExtensionHapBundleName) == 0) { + if (appProperty->property.gidCount < APP_MAX_GIDS) { + appProperty->property.gidTable[appProperty->property.gidCount] = GID_FILE_ACCESS; + appProperty->property.gidCount++; + } + } + // special handle bundle name medialibrary and scanner const char *specialBundleNames[] = { "com.ohos.medialibrary.MediaLibraryDataA",