debug hap

Signed-off-by: yh <yanghao236@huawei.com>
Change-Id: I748d1b65cb867616962c58e12915a6d006b42eef
This commit is contained in:
yh 2024-11-15 10:21:24 +08:00
parent 6c9ad05a58
commit 2f8c452c54
3 changed files with 20 additions and 1 deletions

View File

@ -107,6 +107,7 @@ typedef enum {
MSG_UPDATE_MOUNT_POINTS,
MSG_RESTART_SPAWNER,
MSG_DEVICE_DEBUG,
MSG_UNINSTALL_DEBUG_HAP,
MAX_TYPE_INVALID
} AppSpawnMsgType;

View File

@ -65,7 +65,7 @@ typedef enum TagAppSpawnHookStage {
STAGE_PARENT_POST_FORK = 21,
STAGE_PARENT_PRE_RELY = 22,
STAGE_PARENT_POST_RELY = 23,
STAGE_PARENT_UNINSTALL,
// run in child process
STAGE_CHILD_PRE_COLDBOOT = 30, // clear env, set token before cold boot
STAGE_CHILD_EXECUTE,

View File

@ -1519,6 +1519,19 @@ static void ProcessSpawnRestartMsg(AppSpawnConnection *connection, AppSpawnMsgNo
APPSPAWN_LOGE("Failed to execv, ret %{public}d, errno %{public}d", ret, errno);
}
APPSPAWN_STATIC int ProcessUninstallDebugHap(AppSpawnConnection *connection, AppSpawnMsgNode *message)
{
APPSPAWN_LOGI("ProcessUninstallDebugHap start");
APPSPAWN_CHECK(connection != NULL && message != NULL, return APPSPAWN_ARG_INVALID,
"ProcessUninstallDebugHap invalid param");
AppSpawningCtx *property = CreateAppSpawningCtx();
APPSPAWN_CHECK(property != NULL, return APPSPAWN_SYSTEM_ERROR, "create appspawn ctx failed");
property->message = message;
property->message->connection = connection;
return AppSpawnHookExecute(STAGE_PARENT_UNINSTALL, 0, GetAppSpawnContent(), &property->client);
}
APPSPAWN_STATIC int AppspawpnDevicedebugKill(int pid, cJSON *args)
{
cJSON *signal = cJSON_GetObjectItem(args, "signal");
@ -1652,6 +1665,11 @@ static void ProcessRecvMsg(AppSpawnConnection *connection, AppSpawnMsgNode *mess
SendResponse(connection, msg, ret, 0);
DeleteAppSpawnMsg(message);
break;
case MSG_UNINSTALL_DEBUG_HAP:
ret = ProcessUninstallDebugHap(connection, message);
SendResponse(connection, msg, ret, 0);
DeleteAppSpawnMsg(message);
break;
default:
SendResponse(connection, msg, APPSPAWN_MSG_INVALID, 0);
DeleteAppSpawnMsg(message);