mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
3f7bbb4fb3
- Use uid comparison instead of bundleName in CheckInProcessLaunchMode to prevent clone app connecting main app's IN_PROCESS extension - Add MODULAR_OBJECT to IsSupportAppClone for app clone support - Make AppMgr MakeProcessName not append appCloneIndex for MODULAR_OBJECT (same as UIExtension) - Prepend appCloneIndex to processName in CROSS_PROCESS mode on AMS side; IN_PROCESS mode skips prepend since caller process already has correct name - Update and add test cases for all new branches Co-Authored-By: Agent Signed-off-by: yewei0794 <weiyejxnf@163.com> Change-Id: I98cbd3d253d92264333e0d7dd318ac4207cb3a5c
63 lines
2.6 KiB
C++
63 lines
2.6 KiB
C++
/*
|
|
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef OHOS_ABILITY_RUNTIME_MODULAR_OBJECT_UTILS_H
|
|
#define OHOS_ABILITY_RUNTIME_MODULAR_OBJECT_UTILS_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "ability_record/ability_request.h"
|
|
#include "base_extension_record.h"
|
|
#include "iremote_object.h"
|
|
#include "modular_object_extension_info.h"
|
|
|
|
namespace OHOS {
|
|
namespace AAFwk {
|
|
|
|
class ModularObjectUtils {
|
|
public:
|
|
ModularObjectUtils() = delete;
|
|
|
|
static int32_t CheckPermission(const AbilityRequest &abilityRequest);
|
|
static int32_t CheckRateLimit();
|
|
static bool GetPidToCheckByCallerToken(sptr<IRemoteObject> callerToken, pid_t &outPid);
|
|
|
|
// Connect management helpers
|
|
static std::shared_ptr<ModularObjectExtensionInfo> QueryConfig(const AbilityRequest &abilityRequest);
|
|
static int32_t SetupNewRecord(const AbilityRequest &abilityRequest,
|
|
std::shared_ptr<BaseExtensionRecord> &targetService, const std::string &serviceKey);
|
|
static int32_t CheckLimits(int32_t instanceCount, int32_t connectionCount);
|
|
|
|
private:
|
|
static int32_t CheckExtensionEnabled(const ModularObjectExtensionInfo &info, const AbilityRequest &abilityRequest);
|
|
static int32_t CheckInProcessLaunchMode(MoeLaunchMode launchMode, int32_t targetUid);
|
|
static int32_t CheckCallerForeground();
|
|
static int32_t CheckAppDistributionType(const std::string &callerAppDistributionType,
|
|
const std::string &targetAppDistributionType);
|
|
static bool HasRunningUIAbilityOrExtension(int32_t targetUid, int32_t userId);
|
|
static int32_t CheckTargetHasRunningAbility(int32_t targetUid, int32_t userId,
|
|
const std::string &targetBundleName);
|
|
static int32_t GetTargetExtensionInfoFromDb(const std::string &bundleName, const std::string &abilityName,
|
|
int32_t appIndex, int32_t validUserId, ModularObjectExtensionInfo &targetExtensionInfo);
|
|
static int32_t GetCallerAppInfo(AppExecFwk::ApplicationInfo &callerAppInfo);
|
|
static int32_t VerifyExported(const AbilityRequest &abilityRequest);
|
|
};
|
|
|
|
} // namespace AAFwk
|
|
} // namespace OHOS
|
|
|
|
#endif // OHOS_ABILITY_RUNTIME_MODULAR_OBJECT_UTILS_H
|