diff --git a/adapter/appspawn_ace.cpp b/adapter/appspawn_ace.cpp index debbbd4bd85b52b3f47545e4316e949a33b65d4f..7a2974edaf3868fbb423359e0f72453120d37c4f 100644 --- a/adapter/appspawn_ace.cpp +++ b/adapter/appspawn_ace.cpp @@ -38,6 +38,23 @@ void RunChildProcessor(AppSpawnContent *content, AppSpawnClient *client) { APPSPAWN_LOGI("AppExecFwk::MainThread::Start"); #ifndef APPSPAWN_TEST - OHOS::AppExecFwk::MainThread::Start(); + if (client->flags == UI_SERVICE_DIALOG) { + APPSPAWN_LOGI("UiServiceDialogImpl dlopen and call InitAceDialog()"); + constexpr char libName[] = "libuiservicedialog.z.so"; + constexpr char funName[] = "OHOS_ACE_InitDialog"; + void* libHandle = dlopen(libName, RTLD_LAZY); + if (libHandle == nullptr) { + APPSPAWN_LOGE("Failed to open %s, error: %s", libName, dlerror()); + return; + } + auto func = reinterpret_cast(dlsym(libHandle, funName)); + if (func == nullptr) { + APPSPAWN_LOGE("Failed to get func %s, error: %s", funName, dlerror()); + return; + } + func(); + } else { + OHOS::AppExecFwk::MainThread::Start(); + } #endif } diff --git a/common/appspawn_server.c b/common/appspawn_server.c index 7d27d8ea1ae9cfc50424ebe0edc30f1e0ebc5919..d7685b3244d9ac1ea81aa5d4d8c6a76927a863fa 100644 --- a/common/appspawn_server.c +++ b/common/appspawn_server.c @@ -50,7 +50,7 @@ int DoStartApp(struct AppSpawnContent_ *content, AppSpawnClient *client, char *l APPSPAWN_LOGI("DoStartApp id %d longProcNameLen %u", client->id, longProcNameLen); int32_t ret = 0; - if (content->setAppSandbox) { + if (client->flags != UI_SERVICE_DIALOG && content->setAppSandbox) { ret = content->setAppSandbox(content, client); APPSPAWN_CHECK(ret == 0, NotifyResToParent(content, client, ret); return ret, "Failed to set app sandbox"); diff --git a/common/appspawn_server.h b/common/appspawn_server.h index 7169347b4cbafab349f5030fa4584c4e53450853..00c5da3dd4fd3aa6e58dd78c8f11ff3303a07fdb 100644 --- a/common/appspawn_server.h +++ b/common/appspawn_server.h @@ -36,6 +36,7 @@ extern "C" { #define WAIT_DELAY_US (100 * 1000) // 100ms #define GID_FILE_ACCESS 1006 // only used for ExternalFileManager.hap #define GID_USER_DATA_RW 1008 +#define UI_SERVICE_DIALOG 0x10 typedef struct AppSpawnClient_ { uint32_t id; diff --git a/standard/appspawn_service.c b/standard/appspawn_service.c index da4630428d9f9c2453c6f5931827f72e611dd702..8d35d71e1af57b96d9a6eda227c58c3ad5a61f8c 100644 --- a/standard/appspawn_service.c +++ b/standard/appspawn_service.c @@ -226,7 +226,7 @@ static void HandleSpecial(AppSpawnClientExt *appProperty) appProperty->property.gidCount++; } } - + // special handle bundle name medialibrary and scanner const char *specialBundleNames[] = { "com.ohos.medialibrary.medialibrarydata" @@ -367,6 +367,7 @@ APPSPAWN_STATIC void OnReceiveRequest(const TaskHandle taskHandle, const uint8_t APPSPAWN_LOGI("OnReceiveRequest client.id %d appProperty %d processname %s buffLen %d flags 0x%x", appProperty->client.id, appProperty->property.uid, appProperty->property.processName, buffLen, appProperty->property.flags); + appProperty->client.flags = appProperty->property.flags; fcntl(appProperty->fd[0], F_SETFL, O_NONBLOCK); pid_t pid = 0;