From 949a113ea61cc9ad9baf000c19f06becc16959bd Mon Sep 17 00:00:00 2001 From: linjun9528 Date: Tue, 31 May 2022 17:01:14 +0800 Subject: [PATCH 1/2] alter fileaccess hap name & add sandbox config Signed-off-by: linjun9528 --- appdata-sandbox.json | 18 ++++++++++++++++++ common/appspawn_server.h | 5 +++-- standard/appspawn_service.c | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/appdata-sandbox.json b/appdata-sandbox.json index 058bad9f..99bdca7f 100644 --- a/appdata-sandbox.json +++ b/appdata-sandbox.json @@ -208,6 +208,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" : [] }] }] } \ No newline at end of file diff --git a/common/appspawn_server.h b/common/appspawn_server.h index ca664696..97cec808 100644 --- a/common/appspawn_server.h +++ b/common/appspawn_server.h @@ -34,9 +34,10 @@ extern "C" { #define ERR_PIPE_FAIL (-100) #define MAX_LEN_SHORT_NAME 16 #define WAIT_DELAY_US (100 * 1000) // 100ms -#define GID_USER_DATA_RW 1008 -#define GID_FILE_EXTENSION_HAP 1006 +#define GID_FILE_ACCESS 1006 // only used for ExternalFileManager.hap + +#define GID_USER_DATA_RW 1008 typedef struct AppSpawnClient_ { uint32_t id; diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index aba3e4bd..af1a0a17 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -166,10 +166,10 @@ static void ProcessTimer(const TimerHandle taskHandle, void *context) static void HandleSpecial(AppSpawnClientExt *appProperty) { - const char *fileExtensionHapBundleName = "com.ohos.FileExtension.FileExtensionData"; + 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_EXTENSION_HAP; + appProperty->property.gidTable[appProperty->property.gidCount] = GID_FILE_ACCESS; appProperty->property.gidCount++; } } -- Gitee From 7224bf39de433e8733f438300eaeca0d33646fd4 Mon Sep 17 00:00:00 2001 From: linjun9528 Date: Mon, 6 Jun 2022 10:57:21 +0800 Subject: [PATCH 2/2] alter fileaccess hap name & add sandbox config Signed-off-by: linjun9528 --- common/appspawn_server.h | 2 +- standard/appspawn_service.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/appspawn_server.h b/common/appspawn_server.h index 97cec808..07ddc393 100644 --- a/common/appspawn_server.h +++ b/common/appspawn_server.h @@ -35,7 +35,7 @@ extern "C" { #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_EXTERNAL_FILE_MANAGER 1006 // only used for ExternalFileManager.hap #define GID_USER_DATA_RW 1008 diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index af1a0a17..1f0883aa 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -169,7 +169,7 @@ 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.gidTable[appProperty->property.gidCount] = GID_USER_EXTERNAL_FILE_MANAGER; appProperty->property.gidCount++; } } -- Gitee