10fed37d5Sopenharmony_ci/*
20fed37d5Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
30fed37d5Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
40fed37d5Sopenharmony_ci * you may not use this file except in compliance with the License.
50fed37d5Sopenharmony_ci * You may obtain a copy of the License at
60fed37d5Sopenharmony_ci *
70fed37d5Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
80fed37d5Sopenharmony_ci *
90fed37d5Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
100fed37d5Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
110fed37d5Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
120fed37d5Sopenharmony_ci * See the License for the specific language governing permissions and
130fed37d5Sopenharmony_ci * limitations under the License.
140fed37d5Sopenharmony_ci */
150fed37d5Sopenharmony_ci
160fed37d5Sopenharmony_ci#include "local_ability_manager_stub.h"
170fed37d5Sopenharmony_ci
180fed37d5Sopenharmony_ci#include <cstdint>
190fed37d5Sopenharmony_ci#include <utility>
200fed37d5Sopenharmony_ci#include <cinttypes>
210fed37d5Sopenharmony_ci
220fed37d5Sopenharmony_ci#include "errors.h"
230fed37d5Sopenharmony_ci#include "hilog/log_cpp.h"
240fed37d5Sopenharmony_ci#include "if_local_ability_manager.h"
250fed37d5Sopenharmony_ci#include "ipc_types.h"
260fed37d5Sopenharmony_ci#include "message_option.h"
270fed37d5Sopenharmony_ci#include "message_parcel.h"
280fed37d5Sopenharmony_ci#include "parse_util.h"
290fed37d5Sopenharmony_ci#include "safwk_log.h"
300fed37d5Sopenharmony_ci#include "datetime_ex.h"
310fed37d5Sopenharmony_ci#include "system_ability_definition.h"
320fed37d5Sopenharmony_ci#include "ipc_skeleton.h"
330fed37d5Sopenharmony_ci#include "accesstoken_kit.h"
340fed37d5Sopenharmony_ci
350fed37d5Sopenharmony_ciusing namespace OHOS::HiviewDFX;
360fed37d5Sopenharmony_ci
370fed37d5Sopenharmony_cinamespace OHOS {
380fed37d5Sopenharmony_cinamespace {
390fed37d5Sopenharmony_ciconst std::string PERMISSION_EXT_TRANSACTION = "ohos.permission.ACCESS_EXT_SYSTEM_ABILITY";
400fed37d5Sopenharmony_ciconst std::string PERMISSION_MANAGE = "ohos.permission.MANAGE_SYSTEM_ABILITY";
410fed37d5Sopenharmony_ci}
420fed37d5Sopenharmony_ci
430fed37d5Sopenharmony_ciLocalAbilityManagerStub::LocalAbilityManagerStub()
440fed37d5Sopenharmony_ci{
450fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::START_ABILITY_TRANSACTION)] =
460fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalStartAbility;
470fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::STOP_ABILITY_TRANSACTION)] =
480fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalStopAbility;
490fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::ACTIVE_ABILITY_TRANSACTION)] =
500fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalActiveAbility;
510fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::IDLE_ABILITY_TRANSACTION)] =
520fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalIdleAbility;
530fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::SEND_STRATEGY_TO_SA_TRANSACTION)] =
540fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalSendStrategyToSA;
550fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::IPC_STAT_CMD_TRANSACTION)] =
560fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalIpcStatCmdProc;
570fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::FFRT_DUMPER_TRANSACTION)] =
580fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalFfrtDumperProc;
590fed37d5Sopenharmony_ci    memberFuncMap_[static_cast<uint32_t>(SafwkInterfaceCode::SYSTEM_ABILITY_EXT_TRANSACTION)] =
600fed37d5Sopenharmony_ci        LocalAbilityManagerStub::LocalSystemAbilityExtProc;
610fed37d5Sopenharmony_ci}
620fed37d5Sopenharmony_ci
630fed37d5Sopenharmony_cibool LocalAbilityManagerStub::CheckPermission(uint32_t code)
640fed37d5Sopenharmony_ci{
650fed37d5Sopenharmony_ci    uint32_t accessToken = IPCSkeleton::GetCallingTokenID();
660fed37d5Sopenharmony_ci    std::string permissionToCheck;
670fed37d5Sopenharmony_ci
680fed37d5Sopenharmony_ci    if (code == static_cast<uint32_t>(SafwkInterfaceCode::SYSTEM_ABILITY_EXT_TRANSACTION)) {
690fed37d5Sopenharmony_ci        permissionToCheck = PERMISSION_EXT_TRANSACTION;
700fed37d5Sopenharmony_ci    } else {
710fed37d5Sopenharmony_ci        permissionToCheck = PERMISSION_MANAGE;
720fed37d5Sopenharmony_ci    }
730fed37d5Sopenharmony_ci
740fed37d5Sopenharmony_ci    int32_t ret = Security::AccessToken::AccessTokenKit::VerifyAccessToken(accessToken, permissionToCheck);
750fed37d5Sopenharmony_ci    return ret == static_cast<int32_t>(Security::AccessToken::PermissionState::PERMISSION_GRANTED);
760fed37d5Sopenharmony_ci}
770fed37d5Sopenharmony_ci
780fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::OnRemoteRequest(uint32_t code,
790fed37d5Sopenharmony_ci    MessageParcel& data, MessageParcel& reply, MessageOption& option)
800fed37d5Sopenharmony_ci{
810fed37d5Sopenharmony_ci    HILOGD(TAG, "code:%{public}u, flags:%{public}d", code, option.GetFlags());
820fed37d5Sopenharmony_ci    if (!EnforceInterceToken(data)) {
830fed37d5Sopenharmony_ci        HILOGW(TAG, "check interface token failed!");
840fed37d5Sopenharmony_ci        return ERR_PERMISSION_DENIED;
850fed37d5Sopenharmony_ci    }
860fed37d5Sopenharmony_ci
870fed37d5Sopenharmony_ci    if (CheckPermission(code) == false) {
880fed37d5Sopenharmony_ci        HILOGW(TAG, "check permission failed! code:%{public}u, callingPid:%{public}d, callingTokenId:%{public}u",
890fed37d5Sopenharmony_ci            code, IPCSkeleton::GetCallingPid(), IPCSkeleton::GetCallingTokenID());
900fed37d5Sopenharmony_ci        return ERR_PERMISSION_DENIED;
910fed37d5Sopenharmony_ci    }
920fed37d5Sopenharmony_ci    HILOGD(TAG, "check permission success!");
930fed37d5Sopenharmony_ci
940fed37d5Sopenharmony_ci    auto iter = memberFuncMap_.find(code);
950fed37d5Sopenharmony_ci    if (iter != memberFuncMap_.end()) {
960fed37d5Sopenharmony_ci        return iter->second(this, data, reply);
970fed37d5Sopenharmony_ci    }
980fed37d5Sopenharmony_ci    HILOGW(TAG, "unknown request code!");
990fed37d5Sopenharmony_ci    return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
1000fed37d5Sopenharmony_ci}
1010fed37d5Sopenharmony_ci
1020fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::StartAbilityInner(MessageParcel& data, MessageParcel& reply)
1030fed37d5Sopenharmony_ci{
1040fed37d5Sopenharmony_ci    int32_t saId = -1;
1050fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(saId);
1060fed37d5Sopenharmony_ci    if (!ret) {
1070fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
1080fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1090fed37d5Sopenharmony_ci    }
1100fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
1110fed37d5Sopenharmony_ci        HILOGW(TAG, "check SA:%{public}d id failed!", saId);
1120fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1130fed37d5Sopenharmony_ci    }
1140fed37d5Sopenharmony_ci    int64_t begin = GetTickCount();
1150fed37d5Sopenharmony_ci    std::string eventStr = data.ReadString();
1160fed37d5Sopenharmony_ci    if (eventStr.empty()) {
1170fed37d5Sopenharmony_ci        HILOGW(TAG, "LocalAbilityManagerStub::StartAbilityInner read eventStr failed!");
1180fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1190fed37d5Sopenharmony_ci    }
1200fed37d5Sopenharmony_ci    bool result = StartAbility(saId, eventStr);
1210fed37d5Sopenharmony_ci    LOGI("StartSaInner %{public}s to start SA:%{public}d,eventLen:%{public}zu,spend:%{public}" PRId64 "ms",
1220fed37d5Sopenharmony_ci        result ? "suc" : "fail", saId, eventStr.length(), (GetTickCount() - begin));
1230fed37d5Sopenharmony_ci    return ERR_NONE;
1240fed37d5Sopenharmony_ci}
1250fed37d5Sopenharmony_ci
1260fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::StopAbilityInner(MessageParcel& data, MessageParcel& reply)
1270fed37d5Sopenharmony_ci{
1280fed37d5Sopenharmony_ci    int32_t saId = -1;
1290fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(saId);
1300fed37d5Sopenharmony_ci    if (!ret) {
1310fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1320fed37d5Sopenharmony_ci    }
1330fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
1340fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
1350fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1360fed37d5Sopenharmony_ci    }
1370fed37d5Sopenharmony_ci    int64_t begin = GetTickCount();
1380fed37d5Sopenharmony_ci    std::string eventStr = data.ReadString();
1390fed37d5Sopenharmony_ci    if (eventStr.empty()) {
1400fed37d5Sopenharmony_ci        HILOGW(TAG, "StopAbilityInner read eventStr failed!");
1410fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1420fed37d5Sopenharmony_ci    }
1430fed37d5Sopenharmony_ci    bool result = StopAbility(saId, eventStr);
1440fed37d5Sopenharmony_ci    LOGI("StopSaInner %{public}s to stop SA:%{public}d,eventLen:%{public}zu,spend:%{public}" PRId64 "ms",
1450fed37d5Sopenharmony_ci        result ? "suc" : "fail", saId, eventStr.length(), (GetTickCount() - begin));
1460fed37d5Sopenharmony_ci    return ERR_NONE;
1470fed37d5Sopenharmony_ci}
1480fed37d5Sopenharmony_ci
1490fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::ActiveAbilityInner(MessageParcel& data, MessageParcel& reply)
1500fed37d5Sopenharmony_ci{
1510fed37d5Sopenharmony_ci    int32_t saId = -1;
1520fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(saId);
1530fed37d5Sopenharmony_ci    if (!ret) {
1540fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1550fed37d5Sopenharmony_ci    }
1560fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
1570fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
1580fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1590fed37d5Sopenharmony_ci    }
1600fed37d5Sopenharmony_ci    int64_t begin = GetTickCount();
1610fed37d5Sopenharmony_ci    nlohmann::json activeReason = ParseUtil::StringToJsonObj(data.ReadString());
1620fed37d5Sopenharmony_ci    bool result = ActiveAbility(saId, activeReason);
1630fed37d5Sopenharmony_ci    if (!reply.WriteBool(result)) {
1640fed37d5Sopenharmony_ci        HILOGW(TAG, "ActiveAbilityInner Write result failed!");
1650fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1660fed37d5Sopenharmony_ci    }
1670fed37d5Sopenharmony_ci    LOGI("ActiveSaInner %{public}s to Active SA:%{public}d,spend:%{public}" PRId64 "ms",
1680fed37d5Sopenharmony_ci        result ? "suc" : "fail", saId, (GetTickCount() - begin));
1690fed37d5Sopenharmony_ci    return ERR_NONE;
1700fed37d5Sopenharmony_ci}
1710fed37d5Sopenharmony_ci
1720fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::IdleAbilityInner(MessageParcel& data, MessageParcel& reply)
1730fed37d5Sopenharmony_ci{
1740fed37d5Sopenharmony_ci    int32_t saId = -1;
1750fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(saId);
1760fed37d5Sopenharmony_ci    if (!ret) {
1770fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1780fed37d5Sopenharmony_ci    }
1790fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
1800fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
1810fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1820fed37d5Sopenharmony_ci    }
1830fed37d5Sopenharmony_ci    int64_t begin = GetTickCount();
1840fed37d5Sopenharmony_ci    nlohmann::json idleReason = ParseUtil::StringToJsonObj(data.ReadString());
1850fed37d5Sopenharmony_ci    int32_t delayTime = 0;
1860fed37d5Sopenharmony_ci    bool result = IdleAbility(saId, idleReason, delayTime);
1870fed37d5Sopenharmony_ci    if (!reply.WriteBool(result)) {
1880fed37d5Sopenharmony_ci        HILOGW(TAG, "ActiveAbilityInner Write result failed!");
1890fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1900fed37d5Sopenharmony_ci    }
1910fed37d5Sopenharmony_ci    if (!reply.WriteInt32(delayTime)) {
1920fed37d5Sopenharmony_ci        HILOGW(TAG, "ActiveAbilityInner Write delayTime failed!");
1930fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
1940fed37d5Sopenharmony_ci    }
1950fed37d5Sopenharmony_ci    LOGI("IdleSaInner %{public}s to Idle SA:%{public}d,delayTime:%{public}d,spend:%{public}" PRId64 "ms",
1960fed37d5Sopenharmony_ci        result ? "suc" : "fail", saId, delayTime, (GetTickCount() - begin));
1970fed37d5Sopenharmony_ci    return ERR_NONE;
1980fed37d5Sopenharmony_ci}
1990fed37d5Sopenharmony_ci
2000fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::SendStrategyToSAInner(MessageParcel& data, MessageParcel& reply)
2010fed37d5Sopenharmony_ci{
2020fed37d5Sopenharmony_ci    int32_t type = -1;
2030fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(type);
2040fed37d5Sopenharmony_ci    if (!ret) {
2050fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2060fed37d5Sopenharmony_ci    }
2070fed37d5Sopenharmony_ci    int32_t saId = -1;
2080fed37d5Sopenharmony_ci    ret = data.ReadInt32(saId);
2090fed37d5Sopenharmony_ci    if (!ret) {
2100fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2110fed37d5Sopenharmony_ci    }
2120fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
2130fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
2140fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2150fed37d5Sopenharmony_ci    }
2160fed37d5Sopenharmony_ci    int32_t level = -1;
2170fed37d5Sopenharmony_ci    ret = data.ReadInt32(level);
2180fed37d5Sopenharmony_ci    if (!ret) {
2190fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2200fed37d5Sopenharmony_ci    }
2210fed37d5Sopenharmony_ci    std::string aciton;
2220fed37d5Sopenharmony_ci    ret = data.ReadString(aciton);
2230fed37d5Sopenharmony_ci    if (!ret) {
2240fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2250fed37d5Sopenharmony_ci    }
2260fed37d5Sopenharmony_ci    bool result = SendStrategyToSA(type, saId, level, aciton);
2270fed37d5Sopenharmony_ci    if (!result) {
2280fed37d5Sopenharmony_ci        HILOGE(TAG, "SendStrategyToSA:%{public}d called failed", saId);
2290fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2300fed37d5Sopenharmony_ci    }
2310fed37d5Sopenharmony_ci    return ERR_NONE;
2320fed37d5Sopenharmony_ci}
2330fed37d5Sopenharmony_ci
2340fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::IpcStatCmdProcInner(MessageParcel& data, MessageParcel& reply)
2350fed37d5Sopenharmony_ci{
2360fed37d5Sopenharmony_ci    int32_t fd = data.ReadFileDescriptor();
2370fed37d5Sopenharmony_ci    if (fd < 0) {
2380fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2390fed37d5Sopenharmony_ci    }
2400fed37d5Sopenharmony_ci    int cmd = -1;
2410fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(cmd);
2420fed37d5Sopenharmony_ci    if (!ret) {
2430fed37d5Sopenharmony_ci        ::close(fd);
2440fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2450fed37d5Sopenharmony_ci    }
2460fed37d5Sopenharmony_ci    bool result = IpcStatCmdProc(fd, cmd);
2470fed37d5Sopenharmony_ci    if (!reply.WriteBool(result)) {
2480fed37d5Sopenharmony_ci        HILOGW(TAG, "IpcStatCmdProc Write result failed!");
2490fed37d5Sopenharmony_ci        ::close(fd);
2500fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2510fed37d5Sopenharmony_ci    }
2520fed37d5Sopenharmony_ci    ::close(fd);
2530fed37d5Sopenharmony_ci    HILOGD(TAG, "IpcStatCmdProc called %{public}s  ", result ? "success" : "failed");
2540fed37d5Sopenharmony_ci    return ERR_NONE;
2550fed37d5Sopenharmony_ci}
2560fed37d5Sopenharmony_ci
2570fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::FfrtDumperProcInner(MessageParcel& data, MessageParcel& reply)
2580fed37d5Sopenharmony_ci{
2590fed37d5Sopenharmony_ci    std::string ffrtDumperInfo;
2600fed37d5Sopenharmony_ci    bool result = FfrtDumperProc(ffrtDumperInfo);
2610fed37d5Sopenharmony_ci    HILOGI(TAG, "safwk ffrt dumper result %{public}s", result ? "succeed" : "failed");
2620fed37d5Sopenharmony_ci    if (!reply.WriteString(ffrtDumperInfo)) {
2630fed37d5Sopenharmony_ci        HILOGW(TAG, "FfrtDumperProc write ffrtDumperInfo failed!");
2640fed37d5Sopenharmony_ci        return ERR_NULL_OBJECT;
2650fed37d5Sopenharmony_ci    }
2660fed37d5Sopenharmony_ci    HILOGD(TAG, "FfrtDumperProc called %{public}s ", result? "success" : "failed");
2670fed37d5Sopenharmony_ci    return ERR_NONE;
2680fed37d5Sopenharmony_ci}
2690fed37d5Sopenharmony_ci
2700fed37d5Sopenharmony_ciint32_t LocalAbilityManagerStub::SystemAbilityExtProcInner(MessageParcel& data, MessageParcel& reply)
2710fed37d5Sopenharmony_ci{
2720fed37d5Sopenharmony_ci    int32_t saId = -1;
2730fed37d5Sopenharmony_ci    bool ret = data.ReadInt32(saId);
2740fed37d5Sopenharmony_ci    if (!ret) {
2750fed37d5Sopenharmony_ci        return INVALID_DATA;
2760fed37d5Sopenharmony_ci    }
2770fed37d5Sopenharmony_ci    if (!CheckInputSysAbilityId(saId)) {
2780fed37d5Sopenharmony_ci        HILOGW(TAG, "read saId failed!");
2790fed37d5Sopenharmony_ci        return INVALID_DATA;
2800fed37d5Sopenharmony_ci    }
2810fed37d5Sopenharmony_ci    std::string extension = data.ReadString();
2820fed37d5Sopenharmony_ci    if (extension.empty()) {
2830fed37d5Sopenharmony_ci        HILOGW(TAG, "LocalAbilityManagerStub::SystemAbilityExtProcInner read extension failed!");
2840fed37d5Sopenharmony_ci        return INVALID_DATA;
2850fed37d5Sopenharmony_ci    }
2860fed37d5Sopenharmony_ci
2870fed37d5Sopenharmony_ci    SystemAbilityExtensionPara callback;
2880fed37d5Sopenharmony_ci    callback.data_ = &data;
2890fed37d5Sopenharmony_ci    callback.reply_ = &reply;
2900fed37d5Sopenharmony_ci
2910fed37d5Sopenharmony_ci    int32_t result = SystemAbilityExtProc(extension, saId, &callback, false);
2920fed37d5Sopenharmony_ci    if (result != ERR_NONE) {
2930fed37d5Sopenharmony_ci        HILOGW(TAG, "SystemAbilityExtProc fail!");
2940fed37d5Sopenharmony_ci        return result;
2950fed37d5Sopenharmony_ci    }
2960fed37d5Sopenharmony_ci
2970fed37d5Sopenharmony_ci    HILOGD(TAG, "SystemAbilityExtProc success ");
2980fed37d5Sopenharmony_ci    return ERR_NONE;
2990fed37d5Sopenharmony_ci}
3000fed37d5Sopenharmony_ci
3010fed37d5Sopenharmony_cibool LocalAbilityManagerStub::CheckInputSysAbilityId(int32_t systemAbilityId)
3020fed37d5Sopenharmony_ci{
3030fed37d5Sopenharmony_ci    return (systemAbilityId >= FIRST_SYS_ABILITY_ID) && (systemAbilityId <= LAST_SYS_ABILITY_ID);
3040fed37d5Sopenharmony_ci}
3050fed37d5Sopenharmony_ci
3060fed37d5Sopenharmony_cibool LocalAbilityManagerStub::EnforceInterceToken(MessageParcel& data)
3070fed37d5Sopenharmony_ci{
3080fed37d5Sopenharmony_ci    std::u16string interfaceToken = data.ReadInterfaceToken();
3090fed37d5Sopenharmony_ci    return interfaceToken == LOCAL_ABILITY_MANAGER_INTERFACE_TOKEN;
3100fed37d5Sopenharmony_ci}
3110fed37d5Sopenharmony_ci}
312