mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
@@ -1115,6 +1115,7 @@ private:
|
||||
bool IsSystemUI(const std::string &bundleName) const;
|
||||
|
||||
bool VerificationAllToken(const sptr<IRemoteObject> &token);
|
||||
const std::shared_ptr<DataAbilityManager> &GetDataAbilityManager(const sptr<IAbilityScheduler> &scheduler);
|
||||
bool CheckDataAbilityRequest(AbilityRequest &abilityRequest);
|
||||
std::shared_ptr<AbilityStackManager> GetStackManagerByUserId(int32_t userId);
|
||||
std::shared_ptr<MissionListManager> GetListManagerByUserId(int32_t userId);
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
void DumpState(std::vector<std::string> &info, const std::string &args = "") const;
|
||||
void DumpSysState(std::vector<std::string> &info, bool isClient = false, const std::string &args = "") const;
|
||||
void GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info);
|
||||
bool ContainsDataAbility(const sptr<IAbilityScheduler> &scheduler);
|
||||
|
||||
private:
|
||||
using DataAbilityRecordPtr = std::shared_ptr<DataAbilityRecord>;
|
||||
|
||||
@@ -1617,12 +1617,17 @@ int AbilityManagerService::ReleaseDataAbility(
|
||||
if (!isSystem) {
|
||||
HILOG_INFO("callerToken not system %{public}s", __func__);
|
||||
if (!VerificationAllToken(callerToken)) {
|
||||
HILOG_INFO("VerificationAllToken fail");
|
||||
HILOG_ERROR("VerificationAllToken fail");
|
||||
return ERR_INVALID_STATE;
|
||||
}
|
||||
}
|
||||
|
||||
return dataAbilityManager_->Release(dataAbilityScheduler, callerToken, isSystem);
|
||||
std::shared_ptr<DataAbilityManager> dataAbilityManager = GetDataAbilityManager(dataAbilityScheduler);
|
||||
if (!dataAbilityManager) {
|
||||
HILOG_ERROR("dataAbilityScheduler is not exists");
|
||||
}
|
||||
|
||||
return dataAbilityManager->Release(dataAbilityScheduler, callerToken, isSystem);
|
||||
}
|
||||
|
||||
int AbilityManagerService::AttachAbilityThread(
|
||||
@@ -3080,6 +3085,23 @@ bool AbilityManagerService::VerificationAllToken(const sptr<IRemoteObject> &toke
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::shared_ptr<DataAbilityManager> &AbilityManagerService::GetDataAbilityManager(
|
||||
const sptr<IAbilityScheduler> &scheduler)
|
||||
{
|
||||
if (scheduler == nullptr) {
|
||||
HILOG_ERROR("the param ability scheduler is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (auto item: dataAbilityManagers_) {
|
||||
if (item.second && item.second->ContainsDataAbility(scheduler)) {
|
||||
return item.second;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<AbilityStackManager> AbilityManagerService::GetStackManagerByUserId(int32_t userId)
|
||||
{
|
||||
auto it = stackManagers_.find(userId);
|
||||
|
||||
@@ -168,6 +168,24 @@ int DataAbilityManager::Release(
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DataAbilityManager::ContainsDataAbility(const sptr<IAbilityScheduler> &scheduler)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
|
||||
CHECK_POINTER_AND_RETURN(scheduler, ERR_NULL_OBJECT);
|
||||
|
||||
std::lock_guard<std::mutex> locker(mutex_);
|
||||
|
||||
DataAbilityRecordPtrMap::iterator it;
|
||||
for (it = dataAbilityRecordsLoaded_.begin(); it != dataAbilityRecordsLoaded_.end(); ++it) {
|
||||
if (it->second->GetScheduler() != nullptr && it->second->GetScheduler()->AsObject() == scheduler->AsObject()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DataAbilityManager::AttachAbilityThread(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s(%{public}d)", __PRETTY_FUNCTION__, __LINE__);
|
||||
|
||||
Reference in New Issue
Block a user