mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 23:30:44 +00:00
Merge branch 'master' of gitee.com:openharmony/aafwk_standard into fix_bug
Change-Id: I56029939ba2048b84e617948e88d91fd4f930258
This commit is contained in:
commit
43cad77f95
@ -115,6 +115,7 @@ private:
|
||||
std::atomic<bool> initFlag_;
|
||||
std::vector<std::shared_ptr<WorkerThread>> exitPool_;
|
||||
std::atomic<bool> stop_;
|
||||
std::atomic<bool> guardNotify_;
|
||||
std::shared_ptr<std::thread> guardThread_;
|
||||
std::mutex exitPoolLock_;
|
||||
std::condition_variable exit_;
|
||||
|
@ -38,6 +38,7 @@ WorkerPool::WorkerPool(const std::shared_ptr<WorkerPoolConfig> &config)
|
||||
WorkerPool::factory_ = std::make_shared<DefaultThreadFactory>();
|
||||
initFlag_.store(Init(config));
|
||||
stop_.store(false);
|
||||
guardNotify_.store(false);
|
||||
}
|
||||
|
||||
WorkerPool::~WorkerPool()
|
||||
@ -166,7 +167,9 @@ void WorkerPool::InterruptWorkers(void)
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(exitPoolLock_);
|
||||
exitGuard_.wait(lock);
|
||||
exitGuard_.wait(lock, [this] {
|
||||
return this->guardNotify_.load();
|
||||
});
|
||||
if (guardThread_->joinable()) {
|
||||
HILOG_INFO("WorkerPool::InterruptWorkers guardThread_ joinable");
|
||||
guardThread_->join();
|
||||
@ -199,6 +202,7 @@ void WorkerPool::CreateGuardThread()
|
||||
}
|
||||
}
|
||||
if (stop_.load() && exitPool_.empty() && pool_.empty()) {
|
||||
guardNotify_.store(true);
|
||||
exitGuard_.notify_all();
|
||||
HILOG_INFO("WorkerPool::CreateGuardThread break while");
|
||||
break;
|
||||
|
@ -39,8 +39,8 @@ void AbilityConnection::OnAbilityConnectDone(
|
||||
SetRemoteObject(remoteObject);
|
||||
SetResultCode(resultCode);
|
||||
abilityConnectCallback_->OnAbilityConnectDone(element, remoteObject, resultCode);
|
||||
HILOG_DEBUG("%{public}s end, remoteObject:%{public}p, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
__func__, remoteObject.GetRefPtr(), element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
HILOG_DEBUG("%{public}s end, bundleName:%{public}s, abilityName:%{public}s.",
|
||||
__func__, element.GetBundleName().c_str(), element.GetAbilityName().c_str());
|
||||
}
|
||||
|
||||
void AbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode)
|
||||
|
@ -331,12 +331,12 @@ void AbilityContextImpl::RequestPermissionsFromUser(const std::vector<std::strin
|
||||
permState.state = -1;
|
||||
permList.emplace_back(permState);
|
||||
}
|
||||
HILOG_DEBUG("%{public}s. permList size: %{public}d, permissions size: %{public}d.",
|
||||
HILOG_DEBUG("%{public}s. permList size: %{public}zu, permissions size: %{public}zu.",
|
||||
__func__, permList.size(), permissions.size());
|
||||
|
||||
auto ret = AccessTokenKit::GetSelfPermissionsState(permList);
|
||||
if (permList.size() != permissions.size()) {
|
||||
HILOG_ERROR("%{public}s. Returned permList size: %{public}d.", __func__, permList.size());
|
||||
HILOG_ERROR("%{public}s. Returned permList size: %{public}zu.", __func__, permList.size());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ void AbilityContextImpl::RequestPermissionsFromUser(const std::vector<std::strin
|
||||
__func__, permState.permissionName.c_str(), permState.state);
|
||||
permissionsState.emplace_back(permState.state);
|
||||
}
|
||||
HILOG_DEBUG("%{public}s. permissions size: %{public}d. permissionsState size: %{public}d",
|
||||
HILOG_DEBUG("%{public}s. permissions size: %{public}zu. permissionsState size: %{public}zu",
|
||||
__func__, permissions.size(), permissionsState.size());
|
||||
|
||||
if (ret == TypePermissionOper::DYNAMIC_OPER) {
|
||||
@ -381,7 +381,7 @@ void AbilityContextImpl::OnRequestPermissionsFromUserResult(
|
||||
|
||||
ErrCode AbilityContextImpl::RestoreWindowStage(NativeEngine& engine, NativeValue* contentStorage)
|
||||
{
|
||||
HILOG_INFO("%{public}s begin. contentStorage = %{public}p", __func__, contentStorage);
|
||||
HILOG_INFO("%{public}s begin.", __func__);
|
||||
contentStorage_ = std::unique_ptr<NativeReference>(engine.CreateReference(contentStorage, 1));
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject> &connec
|
||||
}
|
||||
|
||||
AppExecFwk::ElementName connectReceiver = want.GetElement();
|
||||
HILOG_DEBUG("%{public}s begin, connectCaller: %{public}p, connectReceiver: %{public}s.",
|
||||
__func__, connectCaller.GetRefPtr(),
|
||||
HILOG_DEBUG("%{public}s begin, connectReceiver: %{public}s.", __func__,
|
||||
(connectReceiver.GetBundleName() + ":" + connectReceiver.GetAbilityName()).c_str());
|
||||
|
||||
sptr<AbilityConnection> abilityConnection;
|
||||
@ -69,8 +68,8 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject> &connec
|
||||
abilityConnections_[item->first] = callbacks;
|
||||
abilityConnection = item->first.abilityConnection;
|
||||
abilityConnection->SetConnectCallback(connectCallback);
|
||||
HILOG_INFO("%{public}s end, find abilityConnection:%{public}p exist, callbackSize:%{public}d.",
|
||||
__func__, abilityConnection.GetRefPtr(), (int32_t)callbacks.size());
|
||||
HILOG_INFO("%{public}s end, find abilityConnection exist, callbackSize:%{public}d.",
|
||||
__func__, (int32_t)callbacks.size());
|
||||
if (abilityConnection->GetResultCode() == ERR_OK) {
|
||||
connectCallback->OnAbilityConnectDone(connectReceiver, abilityConnection->GetRemoteObject(),
|
||||
abilityConnection->GetResultCode());
|
||||
@ -88,8 +87,8 @@ ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject> &connec
|
||||
callbacks.push_back(connectCallback);
|
||||
abilityConnections_[connectionInfo] = callbacks;
|
||||
}
|
||||
HILOG_DEBUG("%{public}s end, not find connection, connection: %{public}p, abilityConnectionsSize:%{public}d.",
|
||||
__func__, abilityConnection.GetRefPtr(), (int32_t)abilityConnections_.size());
|
||||
HILOG_DEBUG("%{public}s end, not find connection, abilityConnectionsSize:%{public}d.",
|
||||
__func__, (int32_t)abilityConnections_.size());
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -102,8 +101,7 @@ ErrCode ConnectionManager::DisconnectAbility(const sptr<IRemoteObject> &connectC
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
HILOG_DEBUG("%{public}s begin, connectCaller: %{public}p, connectReceiver: %{public}s.",
|
||||
__func__, connectCaller.GetRefPtr(),
|
||||
HILOG_DEBUG("%{public}s begin,, connectReceiver: %{public}s.", __func__,
|
||||
(connectReceiver.GetBundleName() + ":" + connectReceiver.GetAbilityName()).c_str());
|
||||
|
||||
auto item = std::find_if(abilityConnections_.begin(), abilityConnections_.end(),
|
||||
@ -128,8 +126,8 @@ ErrCode ConnectionManager::DisconnectAbility(const sptr<IRemoteObject> &connectC
|
||||
sptr<AbilityConnection> abilityConnection;
|
||||
abilityConnection = item->first.abilityConnection;
|
||||
abilityConnection->SetConnectCallback(connectCallback);
|
||||
HILOG_INFO("%{public}s end, find abilityConnection:%{public}p exist, abilityConnectionsSize:%{public}d.",
|
||||
__func__, abilityConnection.GetRefPtr(), (int32_t)abilityConnections_.size());
|
||||
HILOG_INFO("%{public}s end, find abilityConnection exist, abilityConnectionsSize:%{public}d.",
|
||||
__func__, (int32_t)abilityConnections_.size());
|
||||
if (callbacks.size() == 0) {
|
||||
abilityConnections_.erase(item);
|
||||
HILOG_DEBUG("%{public}s disconnectAbility.", __func__);
|
||||
@ -153,16 +151,15 @@ bool ConnectionManager::DisconnectCaller(const sptr<IRemoteObject> &connectCalle
|
||||
return false;
|
||||
}
|
||||
|
||||
HILOG_DEBUG("%{public}s, connectCaller:%{public}p, abilityConnectionsSize:%{public}d.",
|
||||
__func__, connectCaller.GetRefPtr(), (int32_t)abilityConnections_.size());
|
||||
HILOG_DEBUG("%{public}s, abilityConnectionsSize:%{public}d.",
|
||||
__func__, (int32_t)abilityConnections_.size());
|
||||
|
||||
bool isDisconnect = false;
|
||||
auto iter = abilityConnections_.begin();
|
||||
while (iter != abilityConnections_.end()) {
|
||||
ConnectionInfo connectionInfo = iter->first;
|
||||
if (IsConnectCallerEqual(connectionInfo.connectCaller, connectCaller)) {
|
||||
HILOG_DEBUG("%{public}s DisconnectAbility connection:%{public}p.",
|
||||
__func__, connectionInfo.abilityConnection.GetRefPtr());
|
||||
HILOG_DEBUG("%{public}s DisconnectAbility.", __func__);
|
||||
ErrCode ret =
|
||||
AAFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(connectionInfo.abilityConnection);
|
||||
if (ret != ERR_OK) {
|
||||
|
@ -92,11 +92,7 @@ config("ability_public_config") {
|
||||
}
|
||||
|
||||
ohos_shared_library("static_subscriber_ipc") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"//base/notification/ces_standard/interfaces/innerkits/native/include",
|
||||
"${innerkits_path}/want/include/ohos/aafwk/content/",
|
||||
]
|
||||
include_dirs = [ "include" ]
|
||||
|
||||
sources = [
|
||||
"src/static_subscriber_proxy.cpp",
|
||||
@ -282,7 +278,7 @@ ohos_shared_library("abilitykit_native") {
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
include_dirs += [ "//base/global/i18n_standard/frameworks/intl/include" ]
|
||||
include_dirs += []
|
||||
sources += [
|
||||
"${kits_path}/appkit/native/ability_runtime/form_extension_context.cpp",
|
||||
"src/ability_window.cpp",
|
||||
|
@ -530,6 +530,9 @@ public:
|
||||
*/
|
||||
virtual int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value);
|
||||
|
||||
virtual std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap);
|
||||
|
||||
/**
|
||||
* @brief Called when the system configuration is updated.
|
||||
*
|
||||
|
@ -216,6 +216,9 @@ public:
|
||||
*/
|
||||
virtual int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value);
|
||||
|
||||
virtual std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap);
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
|
@ -220,6 +220,9 @@ public:
|
||||
*/
|
||||
int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value);
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap);
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
|
@ -62,16 +62,16 @@ public:
|
||||
static std::shared_ptr<DataAbilityHelper> Creator(
|
||||
const std::shared_ptr<Context> &context, const std::shared_ptr<Uri> &uri);
|
||||
|
||||
/**
|
||||
* @brief Creates a DataAbilityHelper instance with the Uri specified based on the given Context.
|
||||
*
|
||||
* @param context Indicates the Context object on OHOS.
|
||||
* @param uri Indicates the database table or disk file to operate.
|
||||
*
|
||||
* @return Returns the created DataAbilityHelper instance with a specified Uri.
|
||||
*/
|
||||
static std::shared_ptr<DataAbilityHelper> Creator(
|
||||
const std::shared_ptr<OHOS::AbilityRuntime::Context> &context, const std::shared_ptr<Uri> &uri);
|
||||
/**
|
||||
* @brief Creates a DataAbilityHelper instance with the Uri specified based on the given Context.
|
||||
*
|
||||
* @param context Indicates the Context object on OHOS.
|
||||
* @param uri Indicates the database table or disk file to operate.
|
||||
*
|
||||
* @return Returns the created DataAbilityHelper instance with a specified Uri.
|
||||
*/
|
||||
static std::shared_ptr<DataAbilityHelper> Creator(
|
||||
const std::shared_ptr<OHOS::AbilityRuntime::Context> &context, const std::shared_ptr<Uri> &uri);
|
||||
|
||||
/**
|
||||
* @brief You can use this method to specify the Uri of the data to operate and set the binding relationship
|
||||
@ -88,18 +88,18 @@ public:
|
||||
static std::shared_ptr<DataAbilityHelper> Creator(
|
||||
const std::shared_ptr<Context> &context, const std::shared_ptr<Uri> &uri, const bool tryBind);
|
||||
|
||||
/**
|
||||
* @brief You can use this method to specify the Uri of the data to operate and set the binding relationship
|
||||
* between the ability using the Data template (Data ability for short) and the associated client process in
|
||||
* a DataAbilityHelper instance.
|
||||
*
|
||||
* @param context Indicates the Context object on OHOS.
|
||||
* @param uri Indicates the database table or disk file to operate.
|
||||
* @param tryBind Specifies whether the exit of the corresponding Data ability process causes the exit of the
|
||||
* client process.
|
||||
*
|
||||
* @return Returns the created DataAbilityHelper instance.
|
||||
*/
|
||||
/**
|
||||
* @brief You can use this method to specify the Uri of the data to operate and set the binding relationship
|
||||
* between the ability using the Data template (Data ability for short) and the associated client process in
|
||||
* a DataAbilityHelper instance.
|
||||
*
|
||||
* @param context Indicates the Context object on OHOS.
|
||||
* @param uri Indicates the database table or disk file to operate.
|
||||
* @param tryBind Specifies whether the exit of the corresponding Data ability process causes the exit of the
|
||||
* client process.
|
||||
*
|
||||
* @return Returns the created DataAbilityHelper instance.
|
||||
*/
|
||||
static std::shared_ptr<DataAbilityHelper> Creator(const std::shared_ptr<OHOS::AbilityRuntime::Context> &context,
|
||||
const std::shared_ptr<Uri> &uri, const bool tryBind);
|
||||
|
||||
@ -200,6 +200,9 @@ public:
|
||||
*/
|
||||
int Delete(Uri &uri, const NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap);
|
||||
|
||||
/**
|
||||
* @brief Deletes one or more data records from the database.
|
||||
*
|
||||
@ -307,7 +310,7 @@ public:
|
||||
private:
|
||||
DataAbilityHelper(const std::shared_ptr<Context> &context, const std::shared_ptr<Uri> &uri,
|
||||
const sptr<AAFwk::IAbilityScheduler> &dataAbilityProxy, bool tryBind = false);
|
||||
DataAbilityHelper(const std::shared_ptr<OHOS::AbilityRuntime::Context> &context, const std::shared_ptr<Uri> &uri,
|
||||
DataAbilityHelper(const std::shared_ptr<OHOS::AbilityRuntime::Context> &context, const std::shared_ptr<Uri> &uri,
|
||||
const sptr<AAFwk::IAbilityScheduler> &dataAbilityProxy, bool tryBind = false);
|
||||
DataAbilityHelper(const std::shared_ptr<Context> &context);
|
||||
DataAbilityHelper(const sptr<IRemoteObject> &token, const std::shared_ptr<Uri> &uri,
|
||||
|
@ -128,6 +128,19 @@ public:
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> Query(
|
||||
const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
/**
|
||||
* @brief Calls the method of the Data ability.
|
||||
*
|
||||
* @param uri Indicates the Data ability of the method to call.
|
||||
* @param method Indicates the method to call.
|
||||
* @param arg Indicates the parameter of the String type.
|
||||
* @param pacMap Defines a PacMap object for storing a series of values.
|
||||
*
|
||||
* @return Returns the call result.
|
||||
*/
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap);
|
||||
|
||||
/**
|
||||
* @brief Obtains the MIME type matching the data specified by the URI of the Data ability. This method should be
|
||||
* implemented by a Data ability. Data abilities supports general data types, including text, HTML, and JPEG.
|
||||
|
@ -137,12 +137,12 @@ void Ability::Init(const std::shared_ptr<AbilityInfo> &abilityInfo, const std::s
|
||||
continuationManager_.reset();
|
||||
} else {
|
||||
std::weak_ptr<ContinuationHandler> continuationHandler = continuationHandler_;
|
||||
sptr<ReverseContinuationSchedulerPrimary> Primary = sptr<ReverseContinuationSchedulerPrimary>(
|
||||
sptr<ReverseContinuationSchedulerPrimary> primary = sptr<ReverseContinuationSchedulerPrimary>(
|
||||
new (std::nothrow) ReverseContinuationSchedulerPrimary(continuationHandler, handler_));
|
||||
if (Primary == nullptr) {
|
||||
HILOG_ERROR("Ability::Init failed,Primary create failed");
|
||||
if (primary == nullptr) {
|
||||
HILOG_ERROR("Ability::Init failed,primary create failed");
|
||||
} else {
|
||||
continuationHandler_->SetPrimaryStub(Primary);
|
||||
continuationHandler_->SetPrimaryStub(primary);
|
||||
continuationHandler_->SetAbilityInfo(abilityInfo_);
|
||||
}
|
||||
}
|
||||
@ -994,6 +994,12 @@ int Ability::Insert(const Uri &uri, const NativeRdb::ValuesBucket &value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Ability::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called when the system configuration is updated.
|
||||
*
|
||||
@ -3228,13 +3234,13 @@ void Ability::ExecuteOperation(std::shared_ptr<DataAbilityOperation> &operation,
|
||||
if (operation->IsInsertOperation()) {
|
||||
HILOG_INFO("Ability::ExecuteOperation IsInsertOperation");
|
||||
numRows = Insert(*(operation->GetUri().get()), *valuesBucket);
|
||||
} else if (operation->IsDeleteOperation()) {
|
||||
} else if (operation->IsDeleteOperation() && predicates) {
|
||||
HILOG_INFO("Ability::ExecuteOperation IsDeleteOperation");
|
||||
numRows = Delete(*(operation->GetUri().get()), *predicates);
|
||||
} else if (operation->IsUpdateOperation()) {
|
||||
} else if (operation->IsUpdateOperation() && predicates) {
|
||||
HILOG_INFO("Ability::ExecuteOperation IsUpdateOperation");
|
||||
numRows = Update(*(operation->GetUri().get()), *valuesBucket, *predicates);
|
||||
} else if (operation->IsAssertOperation()) {
|
||||
} else if (operation->IsAssertOperation() && predicates) {
|
||||
HILOG_INFO("Ability::ExecuteOperation IsAssertOperation");
|
||||
std::vector<std::string> columns;
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> queryResult =
|
||||
@ -3499,7 +3505,7 @@ bool Ability::CheckAssertQueryResult(std::shared_ptr<NativeRdb::AbsSharedResultS
|
||||
HILOG_ERROR("Ability::CheckAssertQueryResult strName is empty");
|
||||
continue;
|
||||
}
|
||||
if (strName.c_str() == strObject.c_str()) {
|
||||
if (strName == strObject) {
|
||||
HILOG_ERROR("Ability::CheckAssertQueryResult strName same to strObject");
|
||||
continue;
|
||||
}
|
||||
|
@ -626,6 +626,13 @@ int AbilityImpl::Insert(const Uri &uri, const NativeRdb::ValuesBucket &value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> AbilityImpl::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
HILOG_INFO("AbilityImpl::Call");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
|
@ -93,9 +93,9 @@ ErrCode AbilityProcess::StartAbility(Ability *ability, CallAbilityParam param, C
|
||||
std::map<int, CallbackInfo> map;
|
||||
auto it = abilityResultMap_.find(ability);
|
||||
if (it == abilityResultMap_.end()) {
|
||||
HILOG_INFO("AbilityProcess::StartAbility ability: %{public}p is not in the abilityResultMap_", ability);
|
||||
HILOG_INFO("AbilityProcess::StartAbility ability: is not in the abilityResultMap_");
|
||||
} else {
|
||||
HILOG_INFO("AbilityProcess::StartAbility ability: %{public}p is in the abilityResultMap_", ability);
|
||||
HILOG_INFO("AbilityProcess::StartAbility ability: is in the abilityResultMap_");
|
||||
map = it->second;
|
||||
}
|
||||
callback.errCode = err;
|
||||
@ -122,7 +122,7 @@ void AbilityProcess::OnAbilityResult(Ability *ability, int requestCode, int resu
|
||||
|
||||
auto it = abilityResultMap_.find(ability);
|
||||
if (it == abilityResultMap_.end()) {
|
||||
HILOG_ERROR("AbilityProcess::OnAbilityResult ability: %{public}p is not in the abilityResultMap", ability);
|
||||
HILOG_ERROR("AbilityProcess::OnAbilityResult ability: is not in the abilityResultMap");
|
||||
return;
|
||||
}
|
||||
std::map<int, CallbackInfo> map = it->second;
|
||||
@ -180,12 +180,12 @@ void AbilityProcess::RequestPermissionsFromUser(
|
||||
permState.state = -1;
|
||||
permList.emplace_back(permState);
|
||||
}
|
||||
HILOG_DEBUG("%{public}s. permList size: %{public}d, permissions size: %{public}d.",
|
||||
HILOG_DEBUG("%{public}s. permList size: %{public}zu, permissions size: %{public}zu.",
|
||||
__func__, permList.size(), param.permission_list.size());
|
||||
|
||||
auto ret = AccessTokenKit::GetSelfPermissionsState(permList);
|
||||
if (permList.size() != param.permission_list.size()) {
|
||||
HILOG_ERROR("%{public}s. Returned permList size: %{public}d.", __func__, permList.size());
|
||||
HILOG_ERROR("%{public}s. Returned permList size: %{public}zu.", __func__, permList.size());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ void AbilityProcess::RequestPermissionsFromUser(
|
||||
__func__, permState.permissionName.c_str(), permState.state);
|
||||
permissionsState.emplace_back(permState.state);
|
||||
}
|
||||
HILOG_DEBUG("%{public}s. permissions size: %{public}d. permissionsState size: %{public}d",
|
||||
HILOG_DEBUG("%{public}s. permissions size: %{public}zu. permissionsState size: %{public}zu",
|
||||
__func__, param.permission_list.size(), permissionsState.size());
|
||||
|
||||
if (ret != TypePermissionOper::DYNAMIC_OPER) {
|
||||
@ -211,11 +211,11 @@ void AbilityProcess::RequestPermissionsFromUser(
|
||||
std::map<int, CallbackInfo> map;
|
||||
auto it = abilityRequestPermissionsForUserMap_.find(ability);
|
||||
if (it == abilityRequestPermissionsForUserMap_.end()) {
|
||||
HILOG_INFO("AbilityProcess::RequestPermissionsFromUser ability: %{public}p is not in the "
|
||||
"abilityRequestPermissionsForUserMap_", ability);
|
||||
HILOG_INFO("AbilityProcess::RequestPermissionsFromUser ability: is not in the "
|
||||
"abilityRequestPermissionsForUserMap_");
|
||||
} else {
|
||||
HILOG_INFO("AbilityProcess::RequestPermissionsFromUser ability: %{public}p is in the "
|
||||
"abilityRequestPermissionsForUserMap_", ability);
|
||||
HILOG_INFO("AbilityProcess::RequestPermissionsFromUser ability: is in the "
|
||||
"abilityRequestPermissionsForUserMap_");
|
||||
map = it->second;
|
||||
}
|
||||
|
||||
@ -237,9 +237,8 @@ void AbilityProcess::OnRequestPermissionsFromUserResult(Ability *ability, int re
|
||||
|
||||
auto it = abilityRequestPermissionsForUserMap_.find(ability);
|
||||
if (it == abilityRequestPermissionsForUserMap_.end()) {
|
||||
HILOG_ERROR("AbilityProcess::OnRequestPermissionsFromUserResult ability: %{public}p is not in the "
|
||||
"abilityRequestPermissionsForUserMap_",
|
||||
ability);
|
||||
HILOG_ERROR("AbilityProcess::OnRequestPermissionsFromUserResult ability: is not in the "
|
||||
"abilityRequestPermissionsForUserMap_");
|
||||
return;
|
||||
}
|
||||
std::map<int, CallbackInfo> map = it->second;
|
||||
|
@ -107,7 +107,7 @@ void JsAbility::Init(const std::shared_ptr<AbilityInfo> &abilityInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set ability context pointer: %{public}p", context.get());
|
||||
HILOG_INFO("Set ability context");
|
||||
|
||||
nativeObj->SetNativePointer(
|
||||
new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
|
@ -518,7 +518,7 @@ NativeValue* JsAbilityContext::OnConnectAbility(NativeEngine& engine, NativeCall
|
||||
} else {
|
||||
g_serialNumber = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s not find connection, make new one:%{public}p.", __func__, connection.GetRefPtr());
|
||||
HILOG_INFO("%{public}s not find connection, make new one", __func__);
|
||||
AsyncTask::CompleteCallback complete =
|
||||
[weak = context_, want, connection, connectId](NativeEngine& engine, AsyncTask& task, int32_t status) {
|
||||
HILOG_INFO("OnConnectAbility begin");
|
||||
@ -578,7 +578,7 @@ NativeValue* JsAbilityContext::OnConnectAbilityWithAccount(NativeEngine& engine,
|
||||
} else {
|
||||
g_serialNumber = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s not find connection, make new one:%{public}p.", __func__, connection.GetRefPtr());
|
||||
HILOG_INFO("%{public}s not find connection, make new one", __func__);
|
||||
AsyncTask::CompleteCallback complete =
|
||||
[weak = context_, want, accountId, connection, connectId](
|
||||
NativeEngine& engine, AsyncTask& task, int32_t status) {
|
||||
@ -627,7 +627,7 @@ NativeValue* JsAbilityContext::OnDisconnectAbility(NativeEngine& engine, NativeC
|
||||
// match id
|
||||
want = item->first.want;
|
||||
connection = item->second;
|
||||
HILOG_INFO("%{public}s find conn ability:%{public}p exist", __func__, item->second.GetRefPtr());
|
||||
HILOG_INFO("%{public}s find conn ability exist", __func__);
|
||||
} else {
|
||||
HILOG_INFO("%{public}s not find conn exist.", __func__);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
// when the object is about to be destroyed, does not reset state
|
||||
std::unique_ptr<JsCallerComplex> delObj(data);
|
||||
}
|
||||
HILOG_DEBUG("ReleaseObject success end %{public}p", data);
|
||||
HILOG_DEBUG("ReleaseObject success end");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ public:
|
||||
std::lock_guard<std::mutex> lck (jsCallerComplexMutex);
|
||||
auto iter = jsCallerComplexManagerList.find(ptr);
|
||||
if (iter != jsCallerComplexManagerList.end()) {
|
||||
HILOG_ERROR("JsAbilityContext::%{public}s, ptr[%{public}p] address exists", __func__, ptr);
|
||||
HILOG_ERROR("JsAbilityContext::%{public}s, address exists", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ public:
|
||||
std::lock_guard<std::mutex> lck (jsCallerComplexMutex);
|
||||
auto iter = jsCallerComplexManagerList.find(ptr);
|
||||
if (iter == jsCallerComplexManagerList.end()) {
|
||||
HILOG_ERROR("JsAbilityContext::%{public}s, input parameters[%{public}p] not found", __func__, ptr);
|
||||
HILOG_ERROR("JsAbilityContext::%{public}s, input parameters not found", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ private:
|
||||
|
||||
auto task = [notify = this, &str] () {
|
||||
if (!FindJsCallerComplex(notify)) {
|
||||
HILOG_ERROR("ptr[%{public}p] not found, address error", notify);
|
||||
HILOG_ERROR("ptr not found, address error");
|
||||
return;
|
||||
}
|
||||
notify->OnReleaseNotifyTask(str);
|
||||
@ -292,7 +292,7 @@ private:
|
||||
|
||||
void OnReleaseNotifyTask(const std::string &str)
|
||||
{
|
||||
HILOG_DEBUG("OnReleaseNotifyTask begin %{public}p", this);
|
||||
HILOG_DEBUG("OnReleaseNotifyTask begin");
|
||||
if (jsreleaseCallBackObj_ == nullptr) {
|
||||
HILOG_ERROR("JsCallerComplex::%{public}s, jsreleaseObj is nullptr", __func__);
|
||||
return;
|
||||
@ -302,10 +302,10 @@ private:
|
||||
NativeValue* callback = jsreleaseCallBackObj_->Get();
|
||||
NativeValue* args[] = { CreateJsValue(releaseCallBackEngine_, str) };
|
||||
releaseCallBackEngine_.CallFunction(value, callback, args, 1);
|
||||
HILOG_DEBUG("OnReleaseNotifyTask CallFunction call done %{public}p", this);
|
||||
HILOG_DEBUG("OnReleaseNotifyTask CallFunction call done");
|
||||
callee_ = nullptr;
|
||||
StateReset();
|
||||
HILOG_DEBUG("OnReleaseNotifyTask end %{public}p", this);
|
||||
HILOG_DEBUG("OnReleaseNotifyTask end");
|
||||
}
|
||||
|
||||
NativeValue* ReleaseInner(NativeEngine& engine, NativeCallbackInfo& info)
|
||||
@ -360,7 +360,7 @@ private:
|
||||
jsreleaseCallBackObj_.reset(releaseCallBackEngine_.CreateReference(param1, 1));
|
||||
auto task = [notify = this] (const std::string &str) {
|
||||
if (!FindJsCallerComplexAndChangeState(notify, OBJSTATE::OBJ_EXECUTION)) {
|
||||
HILOG_ERROR("ptr[%{public}p] not found, address error", notify);
|
||||
HILOG_ERROR("ptr not found, address error");
|
||||
return;
|
||||
}
|
||||
notify->OnReleaseNotify(str);
|
||||
|
@ -1052,6 +1052,22 @@ int AbilityThread::Insert(const Uri &uri, const NativeRdb::ValuesBucket &value)
|
||||
return index;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> AbilityThread::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
HILOG_INFO("AbilityThread::Call begin");
|
||||
if (abilityImpl_ == nullptr) {
|
||||
HILOG_ERROR("AbilityThread::Insert abilityImpl_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HILOG_INFO("AbilityThread::Call before abilityImpl_->Call");
|
||||
std::shared_ptr<AppExecFwk::PacMap> result = abilityImpl_->Call(uri, method, arg, pacMap);
|
||||
HILOG_INFO("AbilityThread::Call after abilityImpl_->Call");
|
||||
HILOG_INFO("AbilityThread::Call end");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
@ -1690,7 +1706,7 @@ sptr<IRemoteObject> AbilityThread::CallRequest()
|
||||
|
||||
HILOG_DEBUG("AbilityThread::CallRequest syncTask CallRequest begin");
|
||||
retval = currentAbility->CallRequest();
|
||||
HILOG_DEBUG("AbilityThread::CallRequest syncTask CallRequest end %{public}p", retval.GetRefPtr());
|
||||
HILOG_DEBUG("AbilityThread::CallRequest syncTask CallRequest end");
|
||||
};
|
||||
|
||||
if (abilityHandler_ == nullptr) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "reverse_continuation_scheduler_replica.h"
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
@ -24,6 +25,7 @@ ReverseContinuationSchedulerReplica::ReverseContinuationSchedulerReplica(
|
||||
mainHandler_ = mainHandler;
|
||||
replicaHandler_ = replicaHandler;
|
||||
}
|
||||
|
||||
void ReverseContinuationSchedulerReplica::PassPrimary(const sptr<IRemoteObject> &primary)
|
||||
{
|
||||
HILOG_INFO("%{public}s called begin", __func__);
|
||||
@ -42,6 +44,7 @@ void ReverseContinuationSchedulerReplica::PassPrimary(const sptr<IRemoteObject>
|
||||
}
|
||||
HILOG_INFO("%{public}s called end", __func__);
|
||||
}
|
||||
|
||||
bool ReverseContinuationSchedulerReplica::ReverseContinuation()
|
||||
{
|
||||
HILOG_INFO("%{public}s called begin", __func__);
|
||||
@ -61,6 +64,7 @@ bool ReverseContinuationSchedulerReplica::ReverseContinuation()
|
||||
HILOG_INFO("%{public}s called end", __func__);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReverseContinuationSchedulerReplica::NotifyReverseResult(int reverseResult)
|
||||
{
|
||||
HILOG_INFO("%{public}s called begin", __func__);
|
||||
|
@ -568,6 +568,44 @@ int DataAbilityHelper::Insert(Uri &uri, const NativeRdb::ValuesBucket &value)
|
||||
return index;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> DataAbilityHelper::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
std::shared_ptr<AppExecFwk::PacMap> result = nullptr;
|
||||
HILOG_INFO("DataAbilityHelper::Call start.");
|
||||
if (!CheckUriParam(uri)) {
|
||||
HILOG_ERROR("%{public}s called. CheckUriParam uri failed", __func__);
|
||||
return result;
|
||||
}
|
||||
|
||||
sptr<AAFwk::IAbilityScheduler> dataAbilityProxy = dataAbilityProxy_;
|
||||
if (uri_ == nullptr) {
|
||||
HILOG_INFO("DataAbilityHelper::Call before AcquireDataAbility.");
|
||||
dataAbilityProxy = AbilityManagerClient::GetInstance()->AcquireDataAbility(uri, tryBind_, token_);
|
||||
HILOG_INFO("DataAbilityHelper::Call after AcquireDataAbility.");
|
||||
if (dataAbilityProxy == nullptr) {
|
||||
HILOG_ERROR("DataAbilityHelper::Call failed dataAbility == nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
if (isSystemCaller_) {
|
||||
AddDataAbilityDeathRecipient(dataAbilityProxy->AsObject());
|
||||
}
|
||||
}
|
||||
HILOG_INFO("DataAbilityHelper::Call before dataAbilityProxy->Insert.");
|
||||
result = dataAbilityProxy->Call(uri, method, arg, pacMap);
|
||||
HILOG_INFO("DataAbilityHelper::Call after dataAbilityProxy->Insert.");
|
||||
if (uri_ == nullptr) {
|
||||
HILOG_INFO("DataAbilityHelper::Call before ReleaseDataAbility.");
|
||||
int err = AbilityManagerClient::GetInstance()->ReleaseDataAbility(dataAbilityProxy, token_);
|
||||
HILOG_INFO("DataAbilityHelper::Call after ReleaseDataAbility.");
|
||||
if (err != ERR_OK) {
|
||||
HILOG_ERROR("DataAbilityHelper::Call failed to ReleaseDataAbility err = %{public}d", err);
|
||||
}
|
||||
}
|
||||
HILOG_INFO("DataAbilityHelper::Call end.");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
|
@ -55,7 +55,6 @@ void DataAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Li
|
||||
default: {
|
||||
HILOG_ERROR("DataAbilityImpl::HandleAbilityTransaction state is error");
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,6 +210,17 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> DataAbilityImpl::Query(
|
||||
return ability_->Query(uri, columns, predicates);
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> DataAbilityImpl::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
if (ability_ == nullptr) {
|
||||
HILOG_ERROR("DataAbilityImpl::Call ability_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ability_->Call(uri, method, arg, pacMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Obtains the MIME type matching the data specified by the URI of the Data ability. This method should be
|
||||
* implemented by a Data ability. Data abilities supports general data types, including text, HTML, and JPEG.
|
||||
|
@ -232,27 +232,27 @@ std::map<int, int> DataAbilityOperation::GetDataAbilityPredicatesBackReferences(
|
||||
}
|
||||
bool DataAbilityOperation::IsInsertOperation() const
|
||||
{
|
||||
HILOG_DEBUG("DataAbilityOperation::IsInsertOperation:%d", type_ == TYPE_INSERT);
|
||||
HILOG_DEBUG("DataAbilityOperation::IsInsertOperation: %{public}d", type_ == TYPE_INSERT);
|
||||
return type_ == TYPE_INSERT;
|
||||
}
|
||||
bool DataAbilityOperation::IsUpdateOperation() const
|
||||
{
|
||||
HILOG_DEBUG("DataAbilityOperation::IsUpdateOperation:%d", type_ == TYPE_UPDATE);
|
||||
HILOG_DEBUG("DataAbilityOperation::IsUpdateOperation: %{public}d", type_ == TYPE_UPDATE);
|
||||
return type_ == TYPE_UPDATE;
|
||||
}
|
||||
bool DataAbilityOperation::IsDeleteOperation() const
|
||||
{
|
||||
HILOG_DEBUG("DataAbilityOperation::IsDeleteOperation:%d", type_ == TYPE_DELETE);
|
||||
HILOG_DEBUG("DataAbilityOperation::IsDeleteOperation: %{public}d", type_ == TYPE_DELETE);
|
||||
return type_ == TYPE_DELETE;
|
||||
}
|
||||
bool DataAbilityOperation::IsAssertOperation() const
|
||||
{
|
||||
HILOG_DEBUG("DataAbilityOperation::IsAssertOperation:%d", type_ == TYPE_ASSERT);
|
||||
HILOG_DEBUG("DataAbilityOperation::IsAssertOperation: %{public}d", type_ == TYPE_ASSERT);
|
||||
return type_ == TYPE_ASSERT;
|
||||
}
|
||||
bool DataAbilityOperation::IsInterruptionAllowed() const
|
||||
{
|
||||
HILOG_DEBUG("DataAbilityOperation::IsInterruptionAllowed:%d", interrupted_);
|
||||
HILOG_DEBUG("DataAbilityOperation::IsInterruptionAllowed: %{public}d", interrupted_);
|
||||
return interrupted_;
|
||||
}
|
||||
bool DataAbilityOperation::Marshalling(Parcel &out) const
|
||||
|
@ -97,7 +97,7 @@ void JsFormExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set form extension context pointer: %{public}p", context.get());
|
||||
HILOG_INFO("Set form extension context");
|
||||
|
||||
nativeObj->SetNativePointer(new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
[](NativeEngine*, void* data, void*) {
|
||||
|
@ -115,7 +115,7 @@ void JsDataShareExtAbility::Init(const std::shared_ptr<AbilityLocalRecord> &reco
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set datashare extension ability context pointer: %{public}p", context.get());
|
||||
HILOG_INFO("Set datashare extension ability context");
|
||||
|
||||
nativeObj->SetNativePointer(new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
[](NativeEngine*, void* data, void*) {
|
||||
@ -131,29 +131,29 @@ void JsDataShareExtAbility::LoadLibrary()
|
||||
libRdbHandle_ = dlopen(LIB_RDB_PATH.c_str(), RTLD_LAZY);
|
||||
if (libRdbHandle_ == nullptr) {
|
||||
HILOG_ERROR("dlopen failed: %{public}s", dlerror());
|
||||
}
|
||||
} else {
|
||||
rdbValueBucketNewInstance_ = reinterpret_cast<RdbValueBucketNewInstance>(
|
||||
dlsym(libRdbHandle_, "NAPI_OHOS_Data_RdbJsKit_ValuesBucketProxy_NewInstance"));
|
||||
if (rdbValueBucketNewInstance_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
}
|
||||
|
||||
rdbValueBucketNewInstance_ = reinterpret_cast<RdbValueBucketNewInstance>(
|
||||
dlsym(libRdbHandle_, "NAPI_OHOS_Data_RdbJsKit_ValuesBucketProxy_NewInstance"));
|
||||
if (rdbValueBucketNewInstance_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
}
|
||||
|
||||
rdbResultSetProxyGetNativeObject_ = reinterpret_cast<RdbResultSetProxyGetNativeObject>(
|
||||
dlsym(libRdbHandle_, "NAPI_OHOS_Data_RdbJsKit_ResultSetProxy_GetNativeObject"));
|
||||
if (rdbResultSetProxyGetNativeObject_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
rdbResultSetProxyGetNativeObject_ = reinterpret_cast<RdbResultSetProxyGetNativeObject>(
|
||||
dlsym(libRdbHandle_, "NAPI_OHOS_Data_RdbJsKit_ResultSetProxy_GetNativeObject"));
|
||||
if (rdbResultSetProxyGetNativeObject_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
libDataAbilityHandle_ = dlopen(LIB_DATA_ABILITY_PATH.c_str(), RTLD_LAZY);
|
||||
if (libDataAbilityHandle_ == nullptr) {
|
||||
HILOG_ERROR("dlopen failed: %{public}s", dlerror());
|
||||
}
|
||||
|
||||
dataAbilityPredicatesNewInstance_ = reinterpret_cast<DataAbilityPredicatesNewInstance>(
|
||||
dlsym(libDataAbilityHandle_, "NAPI_OHOS_Data_DataAbilityJsKit_DataAbilityPredicatesProxy_NewInstance"));
|
||||
if (dataAbilityPredicatesNewInstance_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
} else {
|
||||
dataAbilityPredicatesNewInstance_ = reinterpret_cast<DataAbilityPredicatesNewInstance>(
|
||||
dlsym(libDataAbilityHandle_, "NAPI_OHOS_Data_DataAbilityJsKit_DataAbilityPredicatesProxy_NewInstance"));
|
||||
if (dataAbilityPredicatesNewInstance_ == nullptr) {
|
||||
HILOG_ERROR("symbol not found: %{public}s", dlerror());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ void JsServiceExtension::Init(const std::shared_ptr<AbilityLocalRecord> &record,
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set service extension context pointer: %{public}p", context.get());
|
||||
HILOG_INFO("Set service extension context");
|
||||
|
||||
nativeObj->SetNativePointer(new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
[](NativeEngine*, void* data, void*) {
|
||||
|
@ -273,7 +273,7 @@ private:
|
||||
} else {
|
||||
serialNumber_ = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s not find connection, make new one:%{public}p.", __func__, connection.GetRefPtr());
|
||||
HILOG_INFO("%{public}s not find connection, make new one", __func__);
|
||||
AsyncTask::CompleteCallback complete =
|
||||
[weak = context_, want, connection, connectId](NativeEngine& engine, AsyncTask& task, int32_t status) {
|
||||
HILOG_INFO("OnConnectAbility begin");
|
||||
@ -333,7 +333,7 @@ private:
|
||||
} else {
|
||||
serialNumber_ = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s not find connection, make new one:%{public}p.", __func__, connection.GetRefPtr());
|
||||
HILOG_INFO("%{public}s not find connection, make new one", __func__);
|
||||
AsyncTask::CompleteCallback complete =
|
||||
[weak = context_, want, accountId, connection, connectId](
|
||||
NativeEngine& engine, AsyncTask& task, int32_t status) {
|
||||
@ -382,7 +382,7 @@ private:
|
||||
// match id
|
||||
want = item->first.want;
|
||||
connection = item->second;
|
||||
HILOG_INFO("%{public}s find conn ability:%{public}p exist", __func__, item->second.GetRefPtr());
|
||||
HILOG_INFO("%{public}s find conn ability exist", __func__);
|
||||
} else {
|
||||
HILOG_INFO("%{public}s not find conn exist.", __func__);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ config("module_private_config") {
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//foundation/aafwk/standard/frameworks/kits/appkit/native/app/include",
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/want/include/ohos/aafwk/content",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include",
|
||||
|
@ -86,6 +86,11 @@ public:
|
||||
{
|
||||
return std::make_shared<NativeRdb::AbsSharedResultSet>("resultset");
|
||||
};
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
virtual std::string GetType(const Uri &uri)
|
||||
{
|
||||
return std::string("Type1");
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
MOCK_METHOD2(Delete, int(const Uri &, const NativeRdb::DataAbilityPredicates &));
|
||||
MOCK_METHOD3(
|
||||
Query, std::shared_ptr<NativeRdb::AbsSharedResultSet>(const Uri &, std::vector<std::string> &, const NativeRdb::DataAbilityPredicates &));
|
||||
MOCK_METHOD4(Call, std::shared_ptr<PacMap>(const Uri &, const std::string &, const std::string &, const PacMap &));
|
||||
MOCK_METHOD1(GetType, std::string(const Uri &));
|
||||
MOCK_METHOD2(Reload, bool(const Uri &, const PacMap &));
|
||||
MOCK_METHOD2(BatchInsert, int(const Uri &, const std::vector<NativeRdb::ValuesBucket> &));
|
||||
|
@ -51,11 +51,7 @@ ohos_executable("appexec") {
|
||||
"native/ability_runtime/context",
|
||||
"native/app/include",
|
||||
"${aafwk_path}/services/common/include",
|
||||
"${aafwk_path}/interfaces/innerkits/app_manager/include/appmgr",
|
||||
"${aafwk_path}/frameworks/kits/ability/native/include",
|
||||
"${aafwk_path}/interfaces/innerkits/base/include",
|
||||
"${aafwk_path}/interfaces/innerkits/ability_manager/include",
|
||||
"${aafwk_path}/interfaces/innerkits/uri/include",
|
||||
"${aafwk_path}/services/abilitymgr/include",
|
||||
]
|
||||
|
||||
@ -69,7 +65,10 @@ ohos_executable("appexec") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
@ -93,14 +92,8 @@ ohos_shared_library("appkit_native") {
|
||||
"native/app/include",
|
||||
"native/app/include/task",
|
||||
"${aafwk_path}/services/common/include",
|
||||
"${aafwk_path}/interfaces/innerkits/app_manager/include/appmgr",
|
||||
"${aafwk_path}/interfaces/innerkits/uri/include",
|
||||
"${aafwk_path}/frameworks/kits/ability/native/include",
|
||||
"${aafwk_path}/interfaces/innerkits/ability_manager/include",
|
||||
"${aafwk_path}/services/abilitymgr/include",
|
||||
"${aafwk_path}/common/task_dispatcher/include/dispatcher",
|
||||
"${aafwk_path}/common/task_dispatcher/include/task",
|
||||
"${aafwk_path}/common/task_dispatcher/include/threading",
|
||||
"${aafwk_path}/interfaces/kits/napi/aafwk/inner/napi_common",
|
||||
]
|
||||
|
||||
@ -242,7 +235,6 @@ ohos_shared_library("appkit_delegator") {
|
||||
"native/ability_delegator/include",
|
||||
"${aafwk_path}/services/common/include",
|
||||
"${aafwk_path}/frameworks/kits/ability/native/include",
|
||||
"${aafwk_path}/interfaces/innerkits/ability_manager/include",
|
||||
]
|
||||
|
||||
configs = [ ":appkit_config" ]
|
||||
|
@ -102,7 +102,7 @@ void JsAbilityStage::Init(std::shared_ptr<Context> context)
|
||||
return;
|
||||
}
|
||||
|
||||
HILOG_INFO("Set ability stage context pointer: %{public}p", context.get());
|
||||
HILOG_INFO("Set ability stage context");
|
||||
|
||||
nativeObj->SetNativePointer(new std::weak_ptr<AbilityRuntime::Context>(context),
|
||||
[](NativeEngine*, void* data, void*) {
|
||||
|
@ -32,7 +32,6 @@ NativeValue* CreateJsHapModuleInfo(NativeEngine& engine, AppExecFwk::HapModuleIn
|
||||
object->SetProperty("label", CreateJsValue(engine, hapModuleInfo.label));
|
||||
object->SetProperty("backgroundImg", CreateJsValue(engine, hapModuleInfo.backgroundImg));
|
||||
object->SetProperty("mainAbilityName", CreateJsValue(engine, hapModuleInfo.mainAbility));
|
||||
// object->SetProperty("srcPath", CreateJsValue(engine, hapModuleInfo.srcPath)); // d.ts no have
|
||||
object->SetProperty("supportedModes", CreateJsValue(engine, hapModuleInfo.supportedModes));
|
||||
|
||||
NativeValue *capArrayValue = engine.CreateArray(hapModuleInfo.reqCapabilities.size());
|
||||
|
@ -695,8 +695,8 @@ std::vector<std::string> ContextContainer::GetStringArray(int resId)
|
||||
if (baseContext_ != nullptr) {
|
||||
return baseContext_->GetStringArray(resId);
|
||||
} else {
|
||||
return std::vector<std::string>();
|
||||
HILOG_ERROR("ContextContainer::GetStringArray baseContext_ is nullptr");
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,9 @@ bool ContextDeal::StopAbility(const AAFwk::Want &want)
|
||||
*/
|
||||
std::string ContextDeal::GetCacheDir()
|
||||
{
|
||||
return (applicationInfo_ != nullptr) ? applicationInfo_->cacheDir : "";
|
||||
std::string dir = (applicationInfo_ != nullptr) ? applicationInfo_->cacheDir : "";
|
||||
HILOG_DEBUG("ContextDeal::GetCacheDir dir = %{public}s", dir.c_str());
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool ContextDeal::IsUpdatingConfigurations()
|
||||
@ -423,9 +425,10 @@ std::string ContextDeal::GetExternalFilesDir(std::string &type)
|
||||
*/
|
||||
std::string ContextDeal::GetFilesDir()
|
||||
{
|
||||
return (applicationInfo_ != nullptr)
|
||||
? (applicationInfo_->dataDir + CONTEXT_DEAL_FILE_SEPARATOR + CONTEXT_DEAL_Files)
|
||||
: "";
|
||||
std::string dir = (applicationInfo_ != nullptr) ?
|
||||
(applicationInfo_->dataDir + CONTEXT_DEAL_FILE_SEPARATOR + CONTEXT_DEAL_Files) : "";
|
||||
HILOG_DEBUG("ContextDeal::GetFilesDir dir = %{public}s", dir.c_str());
|
||||
return dir;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -686,8 +689,12 @@ std::shared_ptr<HapModuleInfo> ContextDeal::GetHapModuleInfo()
|
||||
// fix set HapModuleInfoLocal data failed, request only once
|
||||
if (hapModuleInfoLocal_ == nullptr) {
|
||||
HapModuleInfoRequestInit();
|
||||
if (hapModuleInfoLocal_ == nullptr) {
|
||||
HILOG_ERROR("hapModuleInfoLocal_ is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sptr<IBundleMgr> ptr = GetBundleManager();
|
||||
if (ptr == nullptr) {
|
||||
HILOG_ERROR("GetAppType failed to get bundle manager service");
|
||||
@ -696,6 +703,7 @@ std::shared_ptr<HapModuleInfo> ContextDeal::GetHapModuleInfo()
|
||||
Want want;
|
||||
ElementName name;
|
||||
name.SetBundleName(GetBundleName());
|
||||
name.SetAbilityName(abilityInfo_->name);
|
||||
want.SetElement(name);
|
||||
std::vector<AbilityInfo> abilityInfos;
|
||||
bool isSuc = ptr->QueryAbilityInfos(want, abilityInfos);
|
||||
|
@ -1489,7 +1489,8 @@ void MainThread::HandleScheduleANRProcess()
|
||||
HILOG_ERROR("MainThread::HandleScheduleANRProcess write main thread stack info failed");
|
||||
}
|
||||
}
|
||||
HILOG_INFO("HandleScheduleANRProcess write main thread stack info size: %{public}d", mainThreadStackInfo.size());
|
||||
HILOG_INFO("HandleScheduleANRProcess write main thread stack info size: %{public}d",
|
||||
(int32_t)mainThreadStackInfo.size());
|
||||
HILOG_INFO("MainThread:HandleScheduleANRProcess BuildNativeAndJsBackStackTrace end.");
|
||||
OHOS::HiviewDFX::DfxDumpCatcher dumplog;
|
||||
std::string proStackInfo;
|
||||
@ -1500,7 +1501,8 @@ void MainThread::HandleScheduleANRProcess()
|
||||
if (write(rFD, proStackInfo.c_str(), proStackInfo.size()) != (ssize_t)proStackInfo.size()) {
|
||||
HILOG_ERROR("MainThread::HandleScheduleANRProcess write process stack info failed");
|
||||
}
|
||||
HILOG_INFO("HandleScheduleANRProcess DumpCatch write process stack info size: %{public}d", proStackInfo.size());
|
||||
HILOG_INFO("HandleScheduleANRProcess DumpCatch write process stack info size: %{public}d",
|
||||
(int32_t)proStackInfo.size());
|
||||
if (rFD != -1) {
|
||||
close(rFD);
|
||||
}
|
||||
|
@ -378,7 +378,6 @@ void Operation::DumpInfo(int level) const
|
||||
ABILITYBASE_LOGI("===Operation::abilityName_ %{public}s =============", abilityName_.c_str());
|
||||
ABILITYBASE_LOGI("===Operation::action_ %{public}s =============", action_.c_str());
|
||||
ABILITYBASE_LOGI("===Operation::bundleName_ %{public}s =============", bundleName_.c_str());
|
||||
ABILITYBASE_LOGI("===Operation::deviceId_ %{public}s =============", deviceId_.c_str());
|
||||
size_t entities_count = entities_.size();
|
||||
ABILITYBASE_LOGI("===Operation::entities_: count %{public}u =============", (uint32_t)entities_count);
|
||||
for (size_t i = 0; i < entities_count; i++) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 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
|
||||
@ -508,7 +508,6 @@ HWTEST_F(WantBaseTest, AaFwk_Want_Parcelable_0500, Function | MediumTest | Level
|
||||
GTEST_LOG_(INFO) << "element->GetBundleName().c_str(): " << element.GetBundleName().c_str();
|
||||
EXPECT_STREQ(element.GetBundleName().c_str(), std::string("system.test.bundlename").c_str());
|
||||
|
||||
GTEST_LOG_(INFO) << "element.GetDeviceID().c_str(): " << element.GetDeviceID().c_str();
|
||||
EXPECT_STREQ(element.GetDeviceID().c_str(), std::string("system.test.deviceid").c_str());
|
||||
|
||||
std::string param_content = WantOut_->GetStringParam(keyStr);
|
||||
|
@ -27,7 +27,6 @@ config("fmskit_public_config") {
|
||||
"${innerkits_path}/form_manager/include",
|
||||
"${appexecfwk_path}/interfaces/innerkits/appexecfwk_base/include",
|
||||
"${innerkits_path}/want/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ config("module_private_config") {
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/uri/include",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler/include",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//foundation/aafwk/standard/services/common/include",
|
||||
"//foundation/aafwk/standard/frameworks/kits/test/mock/AMS",
|
||||
"//foundation/aafwk/standard/services/common/include",
|
||||
|
@ -25,7 +25,6 @@ ohos_unittest("pending_want_test") {
|
||||
"//foundation/aafwk/standard/frameworks/kits/appkit/native/ability_runtime",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/include",
|
||||
"//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include/",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//utils/native/base/include",
|
||||
]
|
||||
|
||||
|
@ -22,7 +22,6 @@ config("ability_manager_public_config") {
|
||||
"//third_party/jsoncpp/include",
|
||||
"${innerkits_path}/want/include",
|
||||
"//utils/native/base/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"${innerkits_path}/uri/include",
|
||||
"${innerkits_path}/want/include/ohos/aafwk/content",
|
||||
"${kits_path}/ability/native/include",
|
||||
|
@ -380,6 +380,16 @@ enum {
|
||||
* Result(2097220) for send usr1 sig to the process of not response fail.
|
||||
*/
|
||||
SEND_USR1_SIG_FAIL,
|
||||
|
||||
/**
|
||||
* Result(2097221) for hidump fail.
|
||||
*/
|
||||
ERR_AAFWK_HIDUMP_ERROR,
|
||||
|
||||
/**
|
||||
* Result(2097222) for hidump params are invalid.
|
||||
*/
|
||||
ERR_AAFWK_HIDUMP_INVALID_ARGS,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -164,6 +164,19 @@ public:
|
||||
*/
|
||||
virtual int Delete(const Uri &uri, const NativeRdb::DataAbilityPredicates &predicates) = 0;
|
||||
|
||||
/**
|
||||
* @brief Calls the method of the Data ability.
|
||||
*
|
||||
* @param uri Indicates the Data ability of the method to call.
|
||||
* @param method Indicates the method to call.
|
||||
* @param arg Indicates the parameter of the String type.
|
||||
* @param pacMap Defines a PacMap object for storing a series of values.
|
||||
*
|
||||
* @return Returns the call result.
|
||||
*/
|
||||
virtual std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) = 0;
|
||||
|
||||
/**
|
||||
* @brief Deletes one or more data records from the database.
|
||||
*
|
||||
@ -373,7 +386,9 @@ public:
|
||||
DUMP_ABILITY_RUNNER_INNER,
|
||||
|
||||
// block ability runner
|
||||
BLOCK_ABILITY_INNER
|
||||
BLOCK_ABILITY_INNER,
|
||||
|
||||
SCHEDULE_CALL
|
||||
};
|
||||
};
|
||||
} // namespace AAFwk
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APPLICATION_STATE_OBSERVER_STUB_H
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
#include "iremote_stub.h"
|
||||
#include "nocopyable.h"
|
||||
@ -92,6 +93,7 @@ private:
|
||||
using ApplicationStateObserverFunc = int32_t (ApplicationStateObserverStub::*)(MessageParcel &data,
|
||||
MessageParcel &reply);
|
||||
std::map<uint32_t, ApplicationStateObserverFunc> memberFuncMap_;
|
||||
static std::mutex callbackMutex_;
|
||||
|
||||
DISALLOW_COPY_AND_MOVE(ApplicationStateObserverStub);
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ void AppSchedulerProxy::ScheduleForegroundApplication()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -60,7 +60,7 @@ void AppSchedulerProxy::ScheduleBackgroundApplication()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -83,7 +83,7 @@ void AppSchedulerProxy::ScheduleTerminateApplication()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -103,7 +103,7 @@ void AppSchedulerProxy::ScheduleLowMemory()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -123,7 +123,7 @@ void AppSchedulerProxy::ScheduleShrinkMemory(const int32_t level)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -174,7 +174,7 @@ void AppSchedulerProxy::ScheduleCleanAbility(const sptr<IRemoteObject> &token)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -196,7 +196,7 @@ void AppSchedulerProxy::ScheduleLaunchApplication(const AppLaunchData &launchDat
|
||||
HILOG_INFO("AppSchedulerProxy ScheduleLaunchApplication start");
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -230,7 +230,7 @@ void AppSchedulerProxy::ScheduleAbilityStage(const HapModuleInfo &abilityStage)
|
||||
HILOG_INFO("AppSchedulerProxy ScheduleAbilityStage start");
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -256,7 +256,7 @@ void AppSchedulerProxy::ScheduleProfileChanged(const Profile &profile)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -277,7 +277,7 @@ void AppSchedulerProxy::ScheduleConfigurationUpdated(const Configuration &config
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -298,7 +298,7 @@ void AppSchedulerProxy::ScheduleProcessSecurityExit()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -318,7 +318,7 @@ void AppSchedulerProxy::ScheduleAcceptWant(const AAFwk::Want &want, const std::s
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -342,7 +342,7 @@ void AppSchedulerProxy::ScheduleANRProcess()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option(MessageOption::TF_SYNC);
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
|
||||
std::mutex ApplicationStateObserverStub::callbackMutex_;
|
||||
|
||||
ApplicationStateObserverStub::ApplicationStateObserverStub()
|
||||
{
|
||||
memberFuncMap_[static_cast<uint32_t>(
|
||||
@ -102,25 +104,43 @@ int32_t ApplicationStateObserverStub::HandleOnForegroundApplicationChanged(Messa
|
||||
|
||||
int32_t ApplicationStateObserverStub::HandleOnAbilityStateChanged(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::unique_ptr<AbilityStateData> abilityStateData(data.ReadParcelable<AbilityStateData>());
|
||||
if (!abilityStateData) {
|
||||
HILOG_ERROR("ReadParcelable<AbilityStateData> failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
AbilityStateData* abilityStateData = nullptr;
|
||||
{
|
||||
// Protect Multi Thread ReadParcelable<IRemoteObject>()
|
||||
std::unique_lock<std::mutex> lock(callbackMutex_);
|
||||
abilityStateData = data.ReadParcelable<AbilityStateData>();
|
||||
if (!abilityStateData) {
|
||||
HILOG_ERROR("ReadParcelable<AbilityStateData> failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
OnAbilityStateChanged(*abilityStateData);
|
||||
{
|
||||
// Protect Multi Thread Deconstruct IRemoteObject
|
||||
std::unique_lock<std::mutex> lock(callbackMutex_);
|
||||
delete abilityStateData;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t ApplicationStateObserverStub::HandleOnExtensionStateChanged(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::unique_ptr<AbilityStateData> abilityStateData(data.ReadParcelable<AbilityStateData>());
|
||||
if (!abilityStateData) {
|
||||
HILOG_ERROR("ReadParcelable<AbilityStateData> failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
AbilityStateData* abilityStateData = nullptr;
|
||||
{
|
||||
// Protect Multi Thread ReadParcelable<IRemoteObject>()
|
||||
std::unique_lock<std::mutex> lock(callbackMutex_);
|
||||
abilityStateData = data.ReadParcelable<AbilityStateData>();
|
||||
if (!abilityStateData) {
|
||||
HILOG_ERROR("ReadParcelable<AbilityStateData> failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
OnExtensionStateChanged(*abilityStateData);
|
||||
{
|
||||
// Protect Multi Thread Deconstruct IRemoteObject
|
||||
std::unique_lock<std::mutex> lock(callbackMutex_);
|
||||
delete abilityStateData;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ config("base_config") {
|
||||
config("base_public_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"${innerkits_path}/base/include",
|
||||
"include",
|
||||
"//utils/native/base/include",
|
||||
]
|
||||
}
|
||||
|
@ -151,12 +151,12 @@ bool FormJsInfo::WriteImageData(Parcel &parcel) const
|
||||
HILOG_INFO("%{public}s unexpected image number %{public}zu", __func__, size);
|
||||
break;
|
||||
}
|
||||
auto messageParcel = static_cast<MessageParcel*>(&parcel);
|
||||
for (auto entry : sharedImageMap) {
|
||||
auto messageParcel = static_cast<MessageParcel*>(&parcel);
|
||||
if (!messageParcel->WriteAshmem(entry.second.first)) {
|
||||
return false;
|
||||
}
|
||||
if (parcel.WriteString16(Str8ToStr16(entry.first))) {
|
||||
if (!parcel.WriteString16(Str8ToStr16(entry.first))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -188,8 +188,8 @@ void FormJsInfo::ReadImageData(Parcel &parcel)
|
||||
HILOG_WARN("%{public}s unexpected image number %{public}d", __func__, size);
|
||||
break;
|
||||
}
|
||||
auto messageParcel = static_cast<MessageParcel*>(&parcel);
|
||||
for (auto i = 0; i < size; i++) {
|
||||
auto messageParcel = static_cast<MessageParcel*>(&parcel);
|
||||
auto fd = messageParcel->ReadFileDescriptor();
|
||||
auto len = parcel.ReadInt32();
|
||||
auto picName = Str16ToStr8(parcel.ReadString16());
|
||||
|
@ -31,7 +31,7 @@ void SplitString(const std::string &source, std::vector<std::string> &strings)
|
||||
if ((source.size() % LIMIT_PARCEL_SIZE) != 0) {
|
||||
splitSize++;
|
||||
}
|
||||
HILOG_DEBUG("the dump string split into %{public}d size", splitSize);
|
||||
HILOG_DEBUG("the dump string split into %{public}zu size", splitSize);
|
||||
for (size_t i = 0; i < splitSize; i++) {
|
||||
size_t start = LIMIT_PARCEL_SIZE * i;
|
||||
strings.emplace_back(source.substr(start, LIMIT_PARCEL_SIZE));
|
||||
|
@ -27,12 +27,7 @@ config("runtime_config") {
|
||||
defines += [ "_ARM64_" ]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"${innerkits_path}/ability_manager/include",
|
||||
"${innerkits_path}/base/include",
|
||||
"${innerkits_path}/uri/include",
|
||||
"${innerkits_path}/want/include/ohos/aafwk/content",
|
||||
]
|
||||
include_dirs = []
|
||||
}
|
||||
|
||||
config("runtime_public_config") {
|
||||
@ -62,8 +57,11 @@ ohos_shared_library("runtime") {
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:configuration",
|
||||
"ability_base:want",
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:ability_manager",
|
||||
"ability_runtime:app_manager",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"eventhandler:libeventhandler",
|
||||
|
@ -210,4 +210,4 @@ private:
|
||||
size_t cachedFsi_;
|
||||
};
|
||||
} // namespace OHOS
|
||||
#endif // #ifndef UTILS_NATIVE_INCLUDE_URI_H_
|
||||
#endif // UTILS_NATIVE_INCLUDE_URI_H_
|
||||
|
@ -51,7 +51,6 @@ Uri::Uri(const string& uriString)
|
||||
port_ = NOT_CALCULATED;
|
||||
|
||||
if (uriString.empty()) {
|
||||
HiLog::Error(LABEL, "Input empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ ohos_shared_library("abilitymanager") {
|
||||
include_dirs = [
|
||||
"//third_party/node/src",
|
||||
"${services_path}/common/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"./",
|
||||
]
|
||||
|
||||
@ -51,7 +50,7 @@ ohos_shared_library("abilitymanager") {
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
include_dirs += [ "//foundation/multimedia/image_standard/interfaces/kits/js/common/include/" ]
|
||||
include_dirs += []
|
||||
deps += []
|
||||
external_deps += [
|
||||
"multimedia_image_standard:image",
|
||||
|
@ -298,7 +298,6 @@ void GetMissionSnapshotInfoForResult(napi_env env, MissionSnapshot &recentMissio
|
||||
napi_value deviceId;
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, recentMissionInfos.topAbility.GetDeviceID().c_str(), NAPI_AUTO_LENGTH, &deviceId));
|
||||
HILOG_INFO("deviceId = [%{public}s]", recentMissionInfos.topAbility.GetDeviceID().c_str());
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objTopAbilityInfo, "deviceId", deviceId));
|
||||
napi_value bundleName;
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
|
@ -15,13 +15,14 @@ import("//build/ohos.gni")
|
||||
import("//foundation/aafwk/standard/aafwk.gni")
|
||||
|
||||
ohos_shared_library("abilityconstant_napi") {
|
||||
include_dirs = [ "${innerkits_path}/ability_manager/include" ]
|
||||
include_dirs = []
|
||||
|
||||
sources = [ "ability_constant_module.cpp" ]
|
||||
|
||||
deps = []
|
||||
|
||||
external_deps = [
|
||||
"ability_runtime:ability_manager",
|
||||
"napi:ace_napi",
|
||||
"utils_base:utils",
|
||||
]
|
||||
|
@ -15,8 +15,6 @@ import("//build/ohos.gni")
|
||||
import("//foundation/aafwk/standard/aafwk.gni")
|
||||
|
||||
ohos_shared_library("abilitymanager_napi") {
|
||||
include_dirs = []
|
||||
|
||||
sources = [
|
||||
"ability_manager_module.cpp",
|
||||
"js_ability_manager.cpp",
|
||||
|
@ -19,7 +19,6 @@ ohos_shared_library("napi_app_mgr") {
|
||||
include_dirs = [
|
||||
"//third_party/node/src",
|
||||
"${services_path}/common/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"./",
|
||||
]
|
||||
|
||||
|
@ -16,8 +16,7 @@ import("//foundation/aafwk/standard/aafwk.gni")
|
||||
import("//foundation/aafwk/standard/feature.gni")
|
||||
|
||||
ohos_shared_library("appmanager_napi") {
|
||||
include_dirs =
|
||||
[ "//foundation/multimedia/image_standard/interfaces/innerkits/include" ]
|
||||
include_dirs = []
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
include_dirs += [ "./" ]
|
||||
|
@ -124,7 +124,7 @@ private:
|
||||
} else {
|
||||
serialNumber_ = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s create observer:%{public}p", __func__, observer.GetRefPtr());
|
||||
HILOG_INFO("%{public}s create observer", __func__);
|
||||
AsyncTask::CompleteCallback complete =
|
||||
[appManager = appManager_, observer](NativeEngine& engine, AsyncTask& task, int32_t status) {
|
||||
HILOG_INFO("RegisterApplicationStateObserver callback begin");
|
||||
@ -166,7 +166,7 @@ private:
|
||||
if (item != observerIds_.end()) {
|
||||
// match id
|
||||
observer = item->second;
|
||||
HILOG_INFO("%{public}s find observer:%{public}p exist", __func__, item->second.GetRefPtr());
|
||||
HILOG_INFO("%{public}s find observer exist", __func__);
|
||||
} else {
|
||||
HILOG_INFO("%{public}s not find observer exist.", __func__);
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ ohos_shared_library("datashare") {
|
||||
include_dirs = [
|
||||
"./",
|
||||
"//third_party/node/src",
|
||||
"//third_party/libuv/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/include",
|
||||
|
@ -223,12 +223,12 @@ napi_value DataShareHelperConstructor(napi_env env, napi_callback_info info)
|
||||
if (status != napi_ok || !isStageMode) {
|
||||
auto ability = OHOS::AbilityRuntime::GetCurrentAbility(env);
|
||||
NAPI_ASSERT(env, ability != nullptr, "DataShareHelperConstructor: failed to get native ability");
|
||||
HILOG_INFO("FA Model: ability = %{public}p strUri = %{public}s", ability, strUri.c_str());
|
||||
HILOG_INFO("FA Model: strUri = %{public}s", strUri.c_str());
|
||||
dataShareHelper = DataShareHelper::Creator(ability->GetContext(), want, std::make_shared<Uri>(strUri));
|
||||
} else {
|
||||
auto context = OHOS::AbilityRuntime::GetStageModeContext(env, argv[PARAM0]);
|
||||
NAPI_ASSERT(env, context != nullptr, "DataShareHelperConstructor: failed to get native context");
|
||||
HILOG_INFO("Stage Model: context = %{public}p strUri = %{public}s", context.get(), strUri.c_str());
|
||||
HILOG_INFO("Stage Model: strUri = %{public}s", strUri.c_str());
|
||||
dataShareHelper = DataShareHelper::Creator(context, want, std::make_shared<Uri>(strUri));
|
||||
}
|
||||
NAPI_ASSERT(env, dataShareHelper != nullptr, "DataShareHelperConstructor: dataShareHelper is nullptr");
|
||||
@ -323,7 +323,7 @@ napi_value InsertWrap(napi_env env, napi_callback_info info, DSHelperInsertCB *i
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,set DataShareHelper objectInfo", __func__);
|
||||
insertCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -606,7 +606,7 @@ napi_value NotifyChangeWrap(napi_env env, napi_callback_info info, DSHelperNotif
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("DataShareHelper objectInfo = %{public}p", objectInfo);
|
||||
HILOG_INFO("Set DataShareHelper objectInfo");
|
||||
notifyChangeCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -817,7 +817,7 @@ napi_value RegisterWrap(napi_env env, napi_callback_info info, DSHelperOnOffCB *
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("DataShareHelper objectInfo = %{public}p", objectInfo);
|
||||
HILOG_INFO("Set DataShareHelper objectInfo");
|
||||
onCB->dataShareHelper = objectInfo;
|
||||
|
||||
ret = RegisterAsync(env, args, argcAsync, argcPromise, onCB);
|
||||
@ -1407,7 +1407,7 @@ napi_value GetTypeWrap(napi_env env, napi_callback_info info, DSHelperGetTypeCB
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
gettypeCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -1591,7 +1591,7 @@ napi_value GetFileTypesWrap(napi_env env, napi_callback_info info, DSHelperGetFi
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
getfiletypesCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -1795,7 +1795,7 @@ napi_value NormalizeUriWrap(napi_env env, napi_callback_info info, DSHelperNorma
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
normalizeuriCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -1974,7 +1974,7 @@ napi_value DenormalizeUriWrap(napi_env env, napi_callback_info info, DSHelperDen
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
denormalizeuriCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -2183,7 +2183,7 @@ napi_value DeleteWrap(napi_env env, napi_callback_info info, DSHelperDeleteCB *d
|
||||
UnwrapDataAbilityPredicates(deleteCB->predicates, env, args[PARAM1]);
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
deleteCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -2379,7 +2379,7 @@ napi_value UpdateWrap(napi_env env, napi_callback_info info, DSHelperUpdateCB *u
|
||||
UnwrapDataAbilityPredicates(updateCB->predicates, env, args[PARAM2]);
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
updateCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -2578,7 +2578,7 @@ napi_value OpenFileWrap(napi_env env, napi_callback_info info, DSHelperOpenFileC
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
openFileCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -2811,7 +2811,7 @@ napi_value BatchInsertWrap(napi_env env, napi_callback_info info, DSHelperBatchI
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
batchInsertCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -3017,7 +3017,7 @@ napi_value QueryWrap(napi_env env, napi_callback_info info, DSHelperQueryCB *que
|
||||
UnwrapDataAbilityPredicates(queryCB->predicates, env, args[PARAM2]);
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo = %{public}p", __func__, objectInfo);
|
||||
HILOG_INFO("%{public}s,DataShareHelper objectInfo", __func__);
|
||||
queryCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
@ -3203,7 +3203,7 @@ napi_value ReleaseWrap(napi_env env, napi_callback_info info, DSHelperReleaseCB
|
||||
|
||||
DataShareHelper *objectInfo = nullptr;
|
||||
napi_unwrap(env, thisVar, (void **)&objectInfo);
|
||||
HILOG_INFO("DataShareHelper ReleaseWrap objectInfo = %{public}p", objectInfo);
|
||||
HILOG_INFO("DataShareHelper ReleaseWrap objectInfo");
|
||||
releaseCB->dataShareHelper = objectInfo;
|
||||
|
||||
if (argcAsync > argcPromise) {
|
||||
|
@ -21,8 +21,6 @@ ohos_shared_library("featureability") {
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include",
|
||||
"//third_party/jsoncpp",
|
||||
"//third_party/jsoncpp/include/json",
|
||||
]
|
||||
|
||||
sources = [
|
||||
@ -41,7 +39,6 @@ ohos_shared_library("featureability") {
|
||||
"${aafwk_path}/interfaces/kits/napi/aafwk/inner/napi_common:napi_common",
|
||||
"${innerkits_path}/dataobs_manager:dataobs_manager",
|
||||
"${kits_path}/appkit:appkit_native",
|
||||
"//third_party/jsoncpp:jsoncpp",
|
||||
"//third_party/libuv:uv_static",
|
||||
]
|
||||
|
||||
|
@ -982,7 +982,7 @@ napi_value UnwrapForResultParam(CallAbilityParam ¶m, napi_env env, napi_valu
|
||||
if (!UnwrapAbilityStartSetting(env, jsSettingObj, *(param.setting))) {
|
||||
HILOG_ERROR("%{public}s, unwrap abilityStartSetting failed.", __func__);
|
||||
}
|
||||
HILOG_INFO("%{public}s abilityStartSetting = %{public}p.", __func__, param.setting.get());
|
||||
HILOG_INFO("%{public}s abilityStartSetting", __func__);
|
||||
}
|
||||
|
||||
napi_value result;
|
||||
|
@ -379,7 +379,7 @@ EXTERN_C_START
|
||||
void CallOnRequestPermissionsFromUserResult(int requestCode, const std::vector<std::string> &permissions,
|
||||
const std::vector<int> &grantResults, CallbackInfo callbackInfo)
|
||||
{
|
||||
HILOG_INFO("%{public}s,called env=%{public}p", __func__, callbackInfo.env);
|
||||
HILOG_INFO("%{public}s,called env", __func__);
|
||||
|
||||
if (permissions.empty()) {
|
||||
HILOG_ERROR("%{public}s, the string vector permissions is empty.", __func__);
|
||||
@ -1561,8 +1561,8 @@ napi_value GetElementNameAsync(napi_env env, napi_value *args, const size_t argC
|
||||
NAPI_CALL(env, napi_queue_async_work(env, elementNameCB->cbBase.asyncWork));
|
||||
napi_value result = nullptr;
|
||||
NAPI_CALL(env, napi_get_null(env, &result));
|
||||
return result;
|
||||
HILOG_INFO("%{public}s, asyncCallback end.", __func__);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,7 @@ static OHOS::AppExecFwk::Ability* GetGlobalAbility(napi_env env)
|
||||
// get ability pointer
|
||||
OHOS::AppExecFwk::Ability* ability = nullptr;
|
||||
napi_get_value_external(env, abilityObj, (void**)&ability);
|
||||
HILOG_INFO("%{public}s, ability = [%{public}p]", __func__, ability);
|
||||
HILOG_INFO("%{public}s, ability", __func__);
|
||||
if (ability == nullptr) {
|
||||
if (g_ability == nullptr) {
|
||||
std::unique_ptr<AbilityRuntime::Runtime> runtime;
|
||||
|
@ -80,7 +80,7 @@ OHOS::AppExecFwk::Ability* GetGlobalAbility(napi_env env)
|
||||
// get ability pointer
|
||||
OHOS::AppExecFwk::Ability* ability = nullptr;
|
||||
napi_get_value_external(env, abilityObj, (void**)&ability);
|
||||
HILOG_INFO("%{public}s, ability = [%{public}p]", __func__, ability);
|
||||
HILOG_INFO("%{public}s, ability", __func__);
|
||||
if (ability == nullptr) {
|
||||
if (g_ability == nullptr) {
|
||||
std::unique_ptr<AbilityRuntime::Runtime> runtime;
|
||||
|
@ -59,7 +59,7 @@ static OHOS::AppExecFwk::Ability* GetGlobalAbility(napi_env env)
|
||||
// get ability pointer
|
||||
OHOS::AppExecFwk::Ability* ability = nullptr;
|
||||
napi_get_value_external(env, abilityObj, (void**)&ability);
|
||||
HILOG_INFO("%{public}s, ability = [%{public}p]", __func__, ability);
|
||||
HILOG_INFO("%{public}s, ability", __func__);
|
||||
if (ability == nullptr) {
|
||||
if (g_ability == nullptr) {
|
||||
std::unique_ptr<AbilityRuntime::Runtime> runtime;
|
||||
|
@ -20,18 +20,12 @@ config("napi_common_public_config") {
|
||||
}
|
||||
|
||||
ohos_shared_library("napi_common") {
|
||||
include_dirs = [
|
||||
"//third_party/node/src",
|
||||
"//third_party/libuv/include",
|
||||
"//third_party/jsoncpp",
|
||||
"//third_party/jsoncpp/include/json",
|
||||
]
|
||||
include_dirs = [ "//third_party/node/src" ]
|
||||
|
||||
public_configs = [ ":napi_common_public_config" ]
|
||||
|
||||
sources = [
|
||||
"napi_common_ability.cpp",
|
||||
"napi_common_call_util.cpp",
|
||||
"napi_common_configuration.cpp",
|
||||
"napi_common_start_options.cpp",
|
||||
"napi_common_util.cpp",
|
||||
@ -40,7 +34,6 @@ ohos_shared_library("napi_common") {
|
||||
|
||||
deps = [
|
||||
"${kits_path}/appkit:appkit_native",
|
||||
"//third_party/jsoncpp:jsoncpp",
|
||||
"//third_party/libuv:uv_static",
|
||||
]
|
||||
|
||||
|
@ -325,7 +325,6 @@ struct DAHelperDeleteCB {
|
||||
DataAbilityHelper *dataAbilityHelper = nullptr;
|
||||
std::string uri;
|
||||
NativeRdb::DataAbilityPredicates predicates;
|
||||
AppExecFwk::PacMap pacMap;
|
||||
int result = 0;
|
||||
int execResult;
|
||||
};
|
||||
@ -336,7 +335,6 @@ struct DAHelperQueryCB {
|
||||
std::string uri;
|
||||
std::vector<std::string> columns;
|
||||
NativeRdb::DataAbilityPredicates predicates;
|
||||
AppExecFwk::PacMap pacMap;
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> result;
|
||||
int execResult;
|
||||
};
|
||||
@ -347,10 +345,25 @@ struct DAHelperUpdateCB {
|
||||
std::string uri;
|
||||
NativeRdb::ValuesBucket valueBucket;
|
||||
NativeRdb::DataAbilityPredicates predicates;
|
||||
AppExecFwk::PacMap pacMap;
|
||||
int result = 0;
|
||||
int execResult;
|
||||
};
|
||||
|
||||
struct DAHelperCallCB {
|
||||
CBBase cbBase;
|
||||
DataAbilityHelper *dataAbilityHelper = nullptr;
|
||||
std::string uri;
|
||||
std::string method;
|
||||
std::string arg;
|
||||
AppExecFwk::PacMap pacMap;
|
||||
std::shared_ptr<AppExecFwk::PacMap> result;
|
||||
int execResult;
|
||||
};
|
||||
|
||||
struct DAHelperErrorCB {
|
||||
CBBase cbBase;
|
||||
int execResult;
|
||||
};
|
||||
struct DAHelperBatchInsertCB {
|
||||
CBBase cbBase;
|
||||
DataAbilityHelper *dataAbilityHelper = nullptr;
|
||||
|
@ -3078,7 +3078,7 @@ bool UnwrapParamForWant(napi_env env, napi_value args, AbilityType abilityType,
|
||||
if (!UnwrapAbilityStartSetting(env, jsSettingObj, *(param.setting))) {
|
||||
HILOG_ERROR("%{public}s, unwrap abilityStartSetting falied.", __func__);
|
||||
}
|
||||
HILOG_INFO("%{public}s abilityStartSetting = %{public}p.", __func__, param.setting.get());
|
||||
HILOG_INFO("%{public}s abilityStartSetting", __func__);
|
||||
}
|
||||
|
||||
HILOG_INFO("%{public}s end.", __func__);
|
||||
@ -3596,7 +3596,7 @@ napi_value ConnectAbilityWrap(napi_env env, napi_callback_info info, ConnectAbil
|
||||
// match bundlename && abilityname
|
||||
connectAbilityCB->id = item->first.id;
|
||||
connectAbilityCB->abilityConnection = item->second;
|
||||
HILOG_INFO("%{public}s find connection:%{public}p exist", __func__, item->second.GetRefPtr());
|
||||
HILOG_INFO("%{public}s find connection exist", __func__);
|
||||
} else {
|
||||
sptr<NAPIAbilityConnection> conn(new (std::nothrow) NAPIAbilityConnection());
|
||||
connectAbilityCB->id = serialNumber_;
|
||||
@ -3610,7 +3610,7 @@ napi_value ConnectAbilityWrap(napi_env env, napi_callback_info info, ConnectAbil
|
||||
} else {
|
||||
serialNumber_ = 0;
|
||||
}
|
||||
HILOG_INFO("%{public}s not find connection, make new one:%{public}p.", __func__, conn.GetRefPtr());
|
||||
HILOG_INFO("%{public}s not find connection, make new one", __func__);
|
||||
}
|
||||
HILOG_INFO("%{public}s id:%{public}" PRId64, __func__, connectAbilityCB->id);
|
||||
|
||||
@ -3889,7 +3889,7 @@ napi_value DisConnectAbilityWrap(napi_env env, napi_callback_info info, ConnectA
|
||||
// match id
|
||||
connectAbilityCB->want = item->first.want;
|
||||
connectAbilityCB->abilityConnection = item->second;
|
||||
HILOG_INFO("%{public}s find conn ability:%{public}p exist", __func__, item->second.GetRefPtr());
|
||||
HILOG_INFO("%{public}s find conn ability exist", __func__);
|
||||
} else {
|
||||
HILOG_INFO("%{public}s not find conn ability exist.", __func__);
|
||||
HILOG_INFO("%{public}s there is no ability to disconnect.", __func__);
|
||||
|
@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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.
|
||||
*/
|
||||
#include "napi_common_call_util.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "napi_common_util.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "napi_common_data.h"
|
||||
#include "napi_common_error.h"
|
||||
|
||||
#ifndef SUPPORT_GRAPHICS
|
||||
#define DBL_MIN ((double)2.22507385850720138309e-308L)
|
||||
#define DBL_MAX ((double)2.22507385850720138309e-308L)
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
void StringSplit(const string &str, const string &splits, std::vector<std::string> &res)
|
||||
{
|
||||
if (str == "") {
|
||||
return;
|
||||
}
|
||||
string strs = str + splits;
|
||||
size_t pos = strs.find(splits);
|
||||
size_t step = splits.size();
|
||||
|
||||
while (pos != strs.npos) {
|
||||
string temp = strs.substr(0, pos);
|
||||
res.push_back(temp);
|
||||
strs = strs.substr(pos + step, strs.size());
|
||||
pos = strs.find(splits);
|
||||
}
|
||||
}
|
||||
|
||||
void SetPacMapObject(AppExecFwk::PacMap &pacMap, const napi_env &env, std::string keyStr, napi_value value)
|
||||
{
|
||||
napi_valuetype valueType = napi_undefined;
|
||||
napi_typeof(env, value, &valueType);
|
||||
if (valueType == napi_string) {
|
||||
std::string valueString = UnwrapStringFromJS(env, value);
|
||||
pacMap.PutStringValue(keyStr, valueString);
|
||||
} else if (valueType == napi_number) {
|
||||
double valueNumber = 0;
|
||||
napi_get_value_double(env, value, &valueNumber);
|
||||
pacMap.PutDoubleValue(keyStr, valueNumber);
|
||||
} else if (valueType == napi_boolean) {
|
||||
bool valueBool = false;
|
||||
napi_get_value_bool(env, value, &valueBool);
|
||||
pacMap.PutBooleanValue(keyStr, valueBool);
|
||||
} else if (valueType == napi_null) {
|
||||
pacMap.PutObject(keyStr, nullptr);
|
||||
} else if (valueType == napi_object) {
|
||||
pacMap.PutStringValueArray(keyStr, ConvertStringVector(env, value));
|
||||
} else {
|
||||
HILOG_ERROR("pacMap error");
|
||||
}
|
||||
}
|
||||
|
||||
void AnalysisPacMap(AppExecFwk::PacMap &pacMap, const napi_env &env, const napi_value &arg)
|
||||
{
|
||||
napi_value keys = 0;
|
||||
napi_get_property_names(env, arg, &keys);
|
||||
uint32_t arrLen = 0;
|
||||
napi_status status = napi_get_array_length(env, keys, &arrLen);
|
||||
if (status != napi_ok) {
|
||||
HILOG_ERROR("PacMap errr");
|
||||
return;
|
||||
}
|
||||
for (size_t i = 0; i < arrLen; ++i) {
|
||||
napi_value key = 0;
|
||||
status = napi_get_element(env, keys, i, &key);
|
||||
std::string keyStr = UnwrapStringFromJS(env, key);
|
||||
napi_value value = 0;
|
||||
napi_get_property(env, arg, key, &value);
|
||||
|
||||
SetPacMapObject(pacMap, env, keyStr, value);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseEqualTo(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string equalValue = pacMap.GetStringValue(value_str, "");
|
||||
if (equalValue != "") {
|
||||
if (equalValue.find(",") == string::npos) {
|
||||
predicates.EqualTo(value_str, equalValue);
|
||||
pacMap.Remove(value_str);
|
||||
} else {
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(equalValue, ",", value_vec);
|
||||
predicates.EqualTo(value_str, value_vec[0]);
|
||||
pacMap.Remove(value_str);
|
||||
pacMap.PutStringValue(value_str, equalValue.substr(value_vec[0].length() + 1, equalValue.length()));
|
||||
}
|
||||
} else {
|
||||
double equalDoubleValue = pacMap.GetDoubleValue(value_str, DBL_MIN);
|
||||
predicates.EqualTo(value_str, std::to_string(equalDoubleValue));
|
||||
pacMap.Remove(value_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseNotEqualTo(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string equalValue = pacMap.GetStringValue(value_str, "");
|
||||
if (equalValue != "") {
|
||||
if (equalValue.find(",") == string::npos) {
|
||||
predicates.NotEqualTo(value_str, equalValue);
|
||||
pacMap.Remove(value_str);
|
||||
} else {
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(equalValue, ",", value_vec);
|
||||
predicates.NotEqualTo(value_str, value_vec[0]);
|
||||
pacMap.Remove(value_str);
|
||||
pacMap.PutStringValue(value_str, equalValue.substr(value_vec[0].length() + 1, equalValue.length()));
|
||||
}
|
||||
} else {
|
||||
predicates.NotEqualTo(value_str, std::to_string(pacMap.GetDoubleValue(value_str, DBL_MIN)));
|
||||
pacMap.Remove(value_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseBetween(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string betweenValue = pacMap.GetStringValue(value_str, "");
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(betweenValue, ",", value_vec);
|
||||
predicates.Between(value_str, value_vec[0], value_vec[1]);
|
||||
size_t tempLength = value_vec[0].length() + 1 + value_vec[1].length() + 1;
|
||||
value_vec.erase(value_vec.begin(), value_vec.begin() + 1);
|
||||
pacMap.Remove(value_str);
|
||||
if (value_vec.size() == 1) {
|
||||
pacMap.PutDoubleValue(value_str, stod(value_vec[0]));
|
||||
} else if (value_vec.size() > 1) {
|
||||
pacMap.PutStringValue(value_str, betweenValue.substr(tempLength, betweenValue.length()));
|
||||
}
|
||||
}
|
||||
|
||||
void ParseNotBetween(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string betweenValue = pacMap.GetStringValue(value_str, "");
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(betweenValue, ",", value_vec);
|
||||
predicates.NotBetween(value_str, value_vec[0], value_vec[1]);
|
||||
size_t tempLength = value_vec[0].length() + 1 + value_vec[1].length() + 1;
|
||||
value_vec.erase(value_vec.begin(), value_vec.begin() + 1);
|
||||
pacMap.Remove(value_str);
|
||||
if (value_vec.size() == 1) {
|
||||
pacMap.PutDoubleValue(value_str, stod(value_vec[0]));
|
||||
} else if (value_vec.size() > 1) {
|
||||
pacMap.PutStringValue(value_str, betweenValue.substr(tempLength, betweenValue.length()));
|
||||
}
|
||||
}
|
||||
|
||||
void ParseIn(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string inValue = pacMap.GetStringValue(value_str, "");
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(inValue, ",", value_vec);
|
||||
if (value_vec.size() >= ARGS_TWO) {
|
||||
std::vector<std::string> in_vec;
|
||||
in_vec.push_back(value_vec[0]);
|
||||
in_vec.push_back(value_vec[1]);
|
||||
predicates.In(value_str, in_vec);
|
||||
size_t tempLength = value_vec[0].length() + 1 + value_vec[1].length() + 1;
|
||||
value_vec.erase(value_vec.begin(), value_vec.begin() + 1);
|
||||
pacMap.Remove(value_str);
|
||||
if (value_vec.size() == 1) {
|
||||
pacMap.PutDoubleValue(value_str, stod(value_vec[0]));
|
||||
} else if (value_vec.size() > 1) {
|
||||
pacMap.PutStringValue(value_str, inValue.substr(tempLength, inValue.length()));
|
||||
}
|
||||
} else {
|
||||
pacMap.Remove(value_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseNotIn(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
std::string inValue = pacMap.GetStringValue(value_str, "");
|
||||
std::vector<std::string> value_vec;
|
||||
StringSplit(inValue, ",", value_vec);
|
||||
if (value_vec.size() >= ARGS_TWO) {
|
||||
std::vector<std::string> in_vec;
|
||||
in_vec.push_back(value_vec[0]);
|
||||
in_vec.push_back(value_vec[1]);
|
||||
predicates.NotIn(value_str, in_vec);
|
||||
size_t tempLength = value_vec[0].length() + 1 + value_vec[1].length() + 1;
|
||||
value_vec.erase(value_vec.begin(), value_vec.begin() + 1);
|
||||
pacMap.Remove(value_str);
|
||||
if (value_vec.size() == 1) {
|
||||
pacMap.PutDoubleValue(value_str, stod(value_vec[0]));
|
||||
} else if (value_vec.size() > 1) {
|
||||
pacMap.PutStringValue(value_str, inValue.substr(tempLength, inValue.length()));
|
||||
}
|
||||
} else {
|
||||
pacMap.Remove(value_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseNormal(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates,
|
||||
std::string key_str)
|
||||
{
|
||||
if (key_str == "equalTo") {
|
||||
ParseEqualTo(pacMap, value_str, predicates);
|
||||
} else if (key_str == "notEqualTo") {
|
||||
ParseNotEqualTo(pacMap, value_str, predicates);
|
||||
} else if (key_str == "contains") {
|
||||
predicates.Contains(value_str, pacMap.GetStringValue(value_str, ""));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "beginsWith") {
|
||||
predicates.BeginsWith(value_str, pacMap.GetStringValue(value_str, ""));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "endsWith") {
|
||||
predicates.EndsWith(value_str, pacMap.GetStringValue(value_str, ""));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "greaterThan") {
|
||||
double greateValue = pacMap.GetDoubleValue(value_str, DBL_MIN);
|
||||
predicates.GreaterThan(value_str, std::to_string(greateValue));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "lessThan") {
|
||||
double lessValue = pacMap.GetDoubleValue(value_str, DBL_MAX);
|
||||
predicates.LessThan(value_str, std::to_string(lessValue));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "greaterThanOrEqualTo") {
|
||||
double greateValue = pacMap.GetDoubleValue(value_str, DBL_MIN);
|
||||
predicates.GreaterThanOrEqualTo(value_str, std::to_string(greateValue));
|
||||
pacMap.Remove(value_str);
|
||||
} else if (key_str == "lessThanOrEqualTo") {
|
||||
double lessValue = pacMap.GetDoubleValue(value_str, DBL_MAX);
|
||||
predicates.LessThanOrEqualTo(value_str, std::to_string(lessValue));
|
||||
pacMap.Remove(value_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ParseUnNormal(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates,
|
||||
std::string key_str)
|
||||
{
|
||||
if (key_str == "beginWrap") {
|
||||
predicates.BeginWrap();
|
||||
} else if (key_str == "endWrap") {
|
||||
predicates.EndWrap();
|
||||
} else if (key_str == "or") {
|
||||
predicates.Or();
|
||||
} else if (key_str == "and") {
|
||||
predicates.And();
|
||||
} else if (key_str == "orderByAsc") {
|
||||
predicates.OrderByAsc(value_str);
|
||||
} else if (key_str == "orderByDesc") {
|
||||
predicates.OrderByDesc(value_str);
|
||||
} else if (key_str == "distinct") {
|
||||
predicates.Distinct();
|
||||
} else if (key_str == "limitAs") {
|
||||
predicates.Limit(pacMap.GetIntValue(value_str, 0));
|
||||
} else if (key_str == "offsetAs") {
|
||||
predicates.Offset(pacMap.GetIntValue(value_str, 0));
|
||||
} else if (key_str == "groupBy") {
|
||||
std::string groupByValue = pacMap.GetStringValue(value_str, "");
|
||||
std::vector<std::string> res;
|
||||
StringSplit(groupByValue, ",", res);
|
||||
predicates.GroupBy(res);
|
||||
} else if (key_str == "indexedBy") {
|
||||
predicates.IndexedBy(value_str);
|
||||
} else if (key_str == "in") {
|
||||
ParseIn(pacMap, value_str, predicates);
|
||||
} else if (key_str == "notIn") {
|
||||
ParseNotIn(pacMap, value_str, predicates);
|
||||
}
|
||||
}
|
||||
|
||||
bool KeyInValue(std::string &key_str)
|
||||
{
|
||||
if (key_str == "equalTo" || key_str == "notEqualTo" || key_str == "contains" || key_str == "beginsWith" ||
|
||||
key_str == "endsWith" || key_str == "greaterThan" || key_str == "lessThan" ||
|
||||
key_str == "greaterThanOrEqualTo" || key_str == "lessThanOrEqualTo") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ParseJsonKey(std::string &jsonStr, AppExecFwk::PacMap &pacMap, NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
HILOG_INFO("%{public}s called.", __func__);
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
Json::Reader reader;
|
||||
#else
|
||||
Json::CharReaderBuilder builder;
|
||||
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
|
||||
#endif
|
||||
Json::Value devJson;
|
||||
Json::Value::iterator iter;
|
||||
Json::Value::Members members;
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
bool parseSuc = reader.parse(jsonStr, devJson);
|
||||
#else
|
||||
bool parseSuc = reader->parse(jsonStr.c_str(), jsonStr.c_str() + jsonStr.length(), &devJson, nullptr);
|
||||
#endif
|
||||
if (parseSuc) {
|
||||
members = devJson.getMemberNames();
|
||||
for (Json::Value::Members::iterator it = members.begin(); it != members.end(); ++it) {
|
||||
std::string key_str = *it;
|
||||
std::string value_str = devJson[key_str].asString();
|
||||
if (KeyInValue(key_str)) {
|
||||
ParseNormal(pacMap, value_str, predicates, key_str);
|
||||
} else {
|
||||
ParseUnNormal(pacMap, value_str, predicates, key_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
HILOG_INFO("%{public}s called end.", __func__);
|
||||
}
|
||||
|
||||
void GetValue(std::vector<std::string> &columnNames, int &index, Json::Value &data,
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet)
|
||||
{
|
||||
std::string typeValue = columnNames[index];
|
||||
int columnIndex;
|
||||
resultSet->GetColumnIndex(typeValue, columnIndex);
|
||||
OHOS::NativeRdb::ColumnType columnType;
|
||||
resultSet->GetColumnType(columnIndex, columnType);
|
||||
if (columnType == OHOS::NativeRdb::ColumnType::TYPE_INTEGER) {
|
||||
int intValue;
|
||||
resultSet->GetInt(columnIndex, intValue);
|
||||
data[typeValue] = intValue;
|
||||
} else if (columnType == OHOS::NativeRdb::ColumnType::TYPE_FLOAT) {
|
||||
double doubleValue;
|
||||
resultSet->GetDouble(columnIndex, doubleValue);
|
||||
data[typeValue] = doubleValue;
|
||||
} else if (columnType == OHOS::NativeRdb::ColumnType::TYPE_STRING) {
|
||||
std::string stringValue;
|
||||
resultSet->GetString(columnIndex, stringValue);
|
||||
if (!stringValue.empty()) {
|
||||
data[typeValue] = stringValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertResultSet(Json::Value &arrayValue, std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet)
|
||||
{
|
||||
int resultSetNum = resultSet->GoToFirstRow();
|
||||
std::vector<std::string> columnNames;
|
||||
resultSet->GetAllColumnNames(columnNames);
|
||||
while (resultSetNum == NO_ERROR) {
|
||||
Json::Value data;
|
||||
int size = (int)columnNames.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
GetValue(columnNames, i, data, resultSet);
|
||||
}
|
||||
arrayValue.append(data);
|
||||
resultSetNum = resultSet->GoToNextRow();
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetResultData(std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet)
|
||||
{
|
||||
if (resultSet == nullptr) {
|
||||
return "";
|
||||
}
|
||||
Json::Value arrayValue;
|
||||
ConvertResultSet(arrayValue, resultSet);
|
||||
Json::StreamWriterBuilder builder;
|
||||
const std::string personal_ringtone = Json::writeString(builder, arrayValue);
|
||||
return personal_ringtone;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022 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_APPEXECFWK_NAPI_COMMON_CALL_UTIL_H
|
||||
#define OHOS_APPEXECFWK_NAPI_COMMON_CALL_UTIL_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "napi/native_api.h"
|
||||
#include "abs_shared_result_set.h"
|
||||
#include "data_ability_predicates.h"
|
||||
#include "pac_map.h"
|
||||
#include "json.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
void StringSplit(const std::string &str, const std::string &splits, std::vector<std::string> &res);
|
||||
|
||||
void SetPacMapObject(AppExecFwk::PacMap &pacMap, const napi_env &env, std::string keyStr, napi_value value);
|
||||
|
||||
void AnalysisPacMap(AppExecFwk::PacMap &pacMap, const napi_env &env, const napi_value &arg);
|
||||
|
||||
void ParseNotEqualTo(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseNotEqualTo(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseBetween(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseNotBetween(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseIn(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseNotIn(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void ParseNormal(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates,
|
||||
std::string key_str);
|
||||
|
||||
void ParseUnNormal(AppExecFwk::PacMap &pacMap, std::string &value_str, NativeRdb::DataAbilityPredicates &predicates,
|
||||
std::string key_str);
|
||||
|
||||
bool KeyInValue(std::string &key_str);
|
||||
|
||||
void ParseJsonKey(std::string &jsonStr, AppExecFwk::PacMap &pacMap, NativeRdb::DataAbilityPredicates &predicates);
|
||||
|
||||
void GetValue(std::vector<std::string> &columnNames, int &index, Json::Value &data,
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet);
|
||||
|
||||
void ConvertResultSet(Json::Value &arrayValue, std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet);
|
||||
|
||||
std::string GetResultData(std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet);
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_APPEXECFWK_NAPI_COMMON_CALL_UTIL_H
|
@ -1087,7 +1087,7 @@ void CompleteAsyncVoidCallbackWork(napi_env env, napi_status status, void *data)
|
||||
if (asyncCallbackInfo->error_code) {
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_int32(env, asyncCallbackInfo->error_code, &result[PARAM0]));
|
||||
}
|
||||
|
||||
|
||||
if (asyncCallbackInfo->error_code == NAPI_ERR_NO_ERROR) {
|
||||
result[PARAM1] = WrapVoidToJS(env);
|
||||
} else {
|
||||
|
@ -16,8 +16,6 @@ import("//foundation/aafwk/standard/aafwk.gni")
|
||||
import("//foundation/aafwk/standard/feature.gni")
|
||||
|
||||
ohos_shared_library("missionmanager_napi") {
|
||||
include_dirs = []
|
||||
|
||||
sources = [
|
||||
"js_mission_info_utils.cpp",
|
||||
"js_mission_listener.cpp",
|
||||
@ -52,10 +50,7 @@ ohos_shared_library("missionmanager_napi") {
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
include_dirs += [
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits/include",
|
||||
"//third_party/icu/icu4c/source/common",
|
||||
]
|
||||
include_dirs += [ "//third_party/icu/icu4c/source/common" ]
|
||||
external_deps += [ "multimedia_image_standard:image" ]
|
||||
defines = [ "SUPPORT_GRAPHICS" ]
|
||||
}
|
||||
|
@ -113,7 +113,6 @@ bool SetSyncRemoteMissionsContext(const napi_env &env, const napi_value &value,
|
||||
return false;
|
||||
}
|
||||
context->deviceId = deviceId;
|
||||
HILOG_INFO("%{public}s deviceId:%{public}s", __func__, context->deviceId.c_str());
|
||||
|
||||
if (isStart) {
|
||||
if (!SetStartSyncMissionsContext (env, value, context)) {
|
||||
@ -542,7 +541,6 @@ napi_value RegisterMissonWrap(napi_env env, napi_callback_info info, RegisterMis
|
||||
return nullptr;
|
||||
}
|
||||
registerMissonCB->deviceId = deviceId;
|
||||
HILOG_INFO("%{public}s deviceId:%{public}s", __func__, registerMissonCB->deviceId.c_str());
|
||||
|
||||
if (argcAsync > 1 && !CreateCallbackReference(env, args[1], registerMissonCB)) {
|
||||
HILOG_ERROR("%{public}s, Wrong arguments.", __func__);
|
||||
@ -622,7 +620,6 @@ void UvWorkNotifyMissionChanged(uv_work_t *work, int status)
|
||||
return;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
HILOG_INFO("UvWorkNotifyMissionChanged, deviceId = %{public}s", registerMissonCB->deviceId.c_str());
|
||||
result =
|
||||
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
|
||||
|
||||
@ -691,10 +688,8 @@ void UvWorkNotifySnapshot(uv_work_t *work, int status)
|
||||
return;
|
||||
}
|
||||
napi_value result[2] = {0};
|
||||
HILOG_INFO("UvWorkNotifySnapshot, deviceId = %{public}s", registerMissonCB->deviceId.c_str());
|
||||
result[0] =
|
||||
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
|
||||
HILOG_INFO("UvWorkNotifySnapshot, missionId = %{public}d", registerMissonCB->missionId);
|
||||
result[1] =
|
||||
WrapInt32(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->missionId, "missionId");
|
||||
|
||||
@ -713,7 +708,6 @@ void UvWorkNotifySnapshot(uv_work_t *work, int status)
|
||||
|
||||
void NAPIRemoteMissionListener::NotifySnapshot(const std::string& deviceId, int32_t missionId)
|
||||
{
|
||||
HILOG_INFO("%{public}s, called. deviceId = %{public}s", __func__, deviceId.c_str());
|
||||
uv_loop_s *loop = nullptr;
|
||||
|
||||
napi_get_uv_event_loop(env_, &loop);
|
||||
@ -764,7 +758,6 @@ void UvWorkNotifyNetDisconnect(uv_work_t *work, int status)
|
||||
return;
|
||||
}
|
||||
napi_value result[2] = {0};
|
||||
HILOG_INFO("UvWorkNotifyNetDisconnect, deviceId = %{public}s", registerMissonCB->deviceId.c_str());
|
||||
result[0] =
|
||||
WrapString(registerMissonCB->cbBase.cbInfo.env, registerMissonCB->deviceId.c_str(), "deviceId");
|
||||
HILOG_INFO("UvWorkNotifyNetDisconnect, state = %{public}d", registerMissonCB->state);
|
||||
@ -786,8 +779,7 @@ void UvWorkNotifyNetDisconnect(uv_work_t *work, int status)
|
||||
|
||||
void NAPIRemoteMissionListener::NotifyNetDisconnect(const std::string& deviceId, int32_t state)
|
||||
{
|
||||
HILOG_INFO("%{public}s called. deviceId = %{public}s. state = %{public}d", __func__,
|
||||
deviceId.c_str(), state);
|
||||
HILOG_INFO("%{public}s called. state = %{public}d", __func__, state);
|
||||
uv_loop_s *loop = nullptr;
|
||||
|
||||
napi_get_uv_event_loop(env_, &loop);
|
||||
@ -949,7 +941,6 @@ bool GetUnRegisterMissonDeviceId(napi_env env, const napi_value& value, Register
|
||||
return false;
|
||||
}
|
||||
registerMissonCB->deviceId = deviceId;
|
||||
HILOG_INFO("%{public}s deviceId:%{public}s", __func__, registerMissonCB->deviceId.c_str());
|
||||
HILOG_INFO("%{public}s called end.", __func__);
|
||||
return true;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import("//foundation/aafwk/standard/aafwk.gni")
|
||||
ohos_shared_library("particleability") {
|
||||
include_dirs = [
|
||||
"//third_party/node/src",
|
||||
"//third_party/libuv/include",
|
||||
"${aafwk_path}/interfaces/kits/napi/aafwk/featureAbility",
|
||||
"${services_path}/common/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include",
|
||||
|
@ -16,7 +16,6 @@ import("//foundation/aafwk/standard/aafwk.gni")
|
||||
ohos_shared_library("wantconstant") {
|
||||
include_dirs = [
|
||||
"//third_party/node/src",
|
||||
"//third_party/libuv/include",
|
||||
"./",
|
||||
]
|
||||
|
||||
|
@ -45,7 +45,6 @@ config("abilityms_config") {
|
||||
"${innerkits_path}/want/include/ohos/aafwk/content",
|
||||
"${services_path}/common/include",
|
||||
"//utils/native/base/include",
|
||||
"//utils/system/safwk/native/include",
|
||||
"//prebuilts/jdk/jdk8/linux-x86/include",
|
||||
"//prebuilts/jdk/jdk8/linux-x86/include/linux",
|
||||
"//third_party/json/include",
|
||||
@ -134,6 +133,7 @@ ohos_shared_library("abilityms") {
|
||||
external_deps += [
|
||||
"i18n_standard:intl_util",
|
||||
"multimedia_image_standard:image_native",
|
||||
"window_manager:libdm",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -352,6 +352,14 @@ public:
|
||||
*/
|
||||
std::shared_ptr<AbilityStackManager> GetStackManager();
|
||||
|
||||
/**
|
||||
* @brief Ability hidump.
|
||||
* @param fd Indicates the fd.
|
||||
* @param args Indicates the params.
|
||||
* @return Returns the dump result.
|
||||
*/
|
||||
int Dump(int fd, const std::vector<std::u16string> &args) override;
|
||||
|
||||
/**
|
||||
* DumpWaittingAbilityQueue.
|
||||
*
|
||||
@ -1087,6 +1095,12 @@ private:
|
||||
const std::string &args, std::vector<std::string> &info, bool isClient, bool isUserID, int userId);
|
||||
void DataDumpSysStateInner(
|
||||
const std::string &args, std::vector<std::string> &info, bool isClient, bool isUserID, int userId);
|
||||
ErrCode ProcessOneParam(std::string& args, std::string &result);
|
||||
ErrCode ProcessTwoParam(const std::string& firstParam, const std::string& secondParam, std::string &result);
|
||||
ErrCode ProcessThreeParam(const std::string& firstParam, const std::string& secondParam,
|
||||
const std::string& thirdParam, std::string &result);
|
||||
void ShowHelp(std::string &result);
|
||||
void ShowIllealInfomation(std::string &result);
|
||||
|
||||
void InitConnectManager(int32_t userId, bool switchUser);
|
||||
void InitDataAbilityManager(int32_t userId, bool switchUser);
|
||||
|
@ -135,6 +135,19 @@ public:
|
||||
*/
|
||||
virtual int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value) override;
|
||||
|
||||
/**
|
||||
* @brief Calls the method of the Data ability.
|
||||
*
|
||||
* @param uri Indicates the Data ability of the method to call.
|
||||
* @param method Indicates the method to call.
|
||||
* @param arg Indicates the parameter of the String type.
|
||||
* @param pacMap Defines a PacMap object for storing a series of values.
|
||||
*
|
||||
* @return Returns the call result.
|
||||
*/
|
||||
virtual std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) override;
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ private:
|
||||
int UpdatetInner(MessageParcel &data, MessageParcel &reply);
|
||||
int DeleteInner(MessageParcel &data, MessageParcel &reply);
|
||||
int QueryInner(MessageParcel &data, MessageParcel &reply);
|
||||
int CallInner(MessageParcel &data, MessageParcel &reply);
|
||||
int GetTypeInner(MessageParcel &data, MessageParcel &reply);
|
||||
int ReloadInner(MessageParcel &data, MessageParcel &reply);
|
||||
int BatchInsertInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -147,10 +147,11 @@ public:
|
||||
* @param missionId mission id
|
||||
* @param abilityToken abilityToken to get current mission snapshot
|
||||
* @param missionSnapshot result of snapshot
|
||||
* @param force force get snapshot from window manager service.
|
||||
* @return true return true if get mission snapshot success, else false
|
||||
*/
|
||||
bool GetMissionSnapshot(int32_t missionId, const sptr<IRemoteObject>& abilityToken,
|
||||
MissionSnapshot& missionSnapshot) const;
|
||||
MissionSnapshot& missionSnapshot, bool force = false) const;
|
||||
|
||||
/**
|
||||
* @brief register snapshotHandler
|
||||
|
@ -446,7 +446,7 @@ int AbilityConnectManager::ScheduleConnectAbilityDoneLocked(
|
||||
|
||||
if ((!abilityRecord->IsAbilityState(AbilityState::INACTIVE)) &&
|
||||
(!abilityRecord->IsAbilityState(AbilityState::ACTIVE))) {
|
||||
HILOG_ERROR("Ability record state is not inactive ,state:%{public}d", abilityRecord->GetAbilityState());
|
||||
HILOG_ERROR("Ability record state is not inactive ,state: %{public}d", abilityRecord->GetAbilityState());
|
||||
return INVALID_CONNECTION_STATE;
|
||||
}
|
||||
|
||||
@ -479,7 +479,7 @@ int AbilityConnectManager::ScheduleDisconnectAbilityDoneLocked(const sptr<IRemot
|
||||
CHECK_POINTER_AND_RETURN(connect, CONNECTION_NOT_EXIST);
|
||||
|
||||
if (!abilityRecord->IsAbilityState(AbilityState::ACTIVE)) {
|
||||
HILOG_ERROR("The service ability state is not active ,state:%{public}d", abilityRecord->GetAbilityState());
|
||||
HILOG_ERROR("The service ability state is not active ,state: %{public}d", abilityRecord->GetAbilityState());
|
||||
return INVALID_CONNECTION_STATE;
|
||||
}
|
||||
|
||||
@ -522,7 +522,7 @@ int AbilityConnectManager::ScheduleCommandAbilityDoneLocked(const sptr<IRemoteOb
|
||||
|
||||
if ((!abilityRecord->IsAbilityState(AbilityState::INACTIVE)) &&
|
||||
(!abilityRecord->IsAbilityState(AbilityState::ACTIVE))) {
|
||||
HILOG_ERROR("Ability record state is not inactive ,state:%{public}d", abilityRecord->GetAbilityState());
|
||||
HILOG_ERROR("Ability record state is not inactive ,state: %{public}d", abilityRecord->GetAbilityState());
|
||||
return INVALID_CONNECTION_STATE;
|
||||
}
|
||||
// complete command and pop waiting start ability from queue.
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <getopt.h>
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
@ -34,6 +35,9 @@
|
||||
#include "ability_util.h"
|
||||
#include "bytrace.h"
|
||||
#include "bundle_mgr_client.h"
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
#include "display_manager.h"
|
||||
#endif
|
||||
#include "distributed_client.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
@ -64,6 +68,30 @@ using OHOS::Security::AccessToken::AccessTokenKit;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace {
|
||||
const int32_t MIN_ARGS_SIZE = 1;
|
||||
const int32_t MID_ARGS_SIZE = 2;
|
||||
const int32_t MAX_ARGS_SIZE = 3;
|
||||
const int32_t FIRST_PARAM = 0;
|
||||
const int32_t SECOND_PARAM = 1;
|
||||
const int32_t THIRD_PARAM = 2;
|
||||
|
||||
const std::string ARGS_ABILITY = "-a";
|
||||
const std::string ARGS_MISSION_LIST = "-l";
|
||||
const std::string ARGS_ABILITY_BY_ID = "-i";
|
||||
const std::string ARGS_EXTENSION = "-e";
|
||||
const std::string ARGS_PENDING_WANT = "-p";
|
||||
const std::string ARGS_PROCESS = "-r";
|
||||
const std::string ARGS_DATA = "-d";
|
||||
const std::string ARGS_USER_ID = "-u";
|
||||
const std::string ARGS_CLIENT = "-c";
|
||||
const std::string ILLEGAL_INFOMATION = "The arguments are illegal and you can enter '-h' for help.";
|
||||
|
||||
const std::set<std::string> ONE_ARG_SET { ARGS_ABILITY, ARGS_MISSION_LIST, ARGS_EXTENSION,
|
||||
ARGS_PENDING_WANT, ARGS_PROCESS, ARGS_DATA };
|
||||
|
||||
const std::set<std::string> TWO_ARGS_SET { ARGS_ABILITY, ARGS_ABILITY_BY_ID, ARGS_PENDING_WANT };
|
||||
}
|
||||
using namespace std::chrono;
|
||||
using namespace std::chrono_literals;
|
||||
const bool CONCURRENCY_MODE_FALSE = false;
|
||||
@ -82,7 +110,7 @@ const std::string EMPTY_DEVICE_ID = "";
|
||||
const int32_t APP_MEMORY_SIZE = 512;
|
||||
const int32_t GET_PARAMETER_INCORRECT = -9;
|
||||
const int32_t GET_PARAMETER_OTHER = -1;
|
||||
const int32_t SIZE_10 = -1;
|
||||
const int32_t SIZE_10 = 10;
|
||||
const bool isRamConstrainedDevice = false;
|
||||
const std::string APP_MEMORY_MAX_SIZE_PARAMETER = "const.product.dalvikheaplimit";
|
||||
const std::string RAM_CONSTRAINED_DEVICE_SIGN = "const.product.islowram";
|
||||
@ -710,7 +738,7 @@ int AbilityManagerService::TerminateAbilityByCaller(const sptr<IRemoteObject> &c
|
||||
case AppExecFwk::AbilityType::SERVICE:
|
||||
case AppExecFwk::AbilityType::EXTENSION: {
|
||||
if (!connectManager) {
|
||||
HILOG_ERROR("connectManager is nullptr. userId=%{public}d", userId);
|
||||
HILOG_ERROR("connectManager is nullptr.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto result = connectManager->TerminateAbility(abilityRecord, requestCode);
|
||||
@ -733,13 +761,13 @@ int AbilityManagerService::TerminateAbilityByCaller(const sptr<IRemoteObject> &c
|
||||
return ERR_WOULD_BLOCK;
|
||||
}
|
||||
if (!stackManager) {
|
||||
HILOG_ERROR("stackManager is nullptr. userId=%{public}d", userId);
|
||||
HILOG_ERROR("stackManager is nullptr.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
auto result = stackManager->TerminateAbility(abilityRecord, requestCode);
|
||||
if (result == NO_FOUND_ABILITY_BY_CALLER) {
|
||||
if (!connectManager) {
|
||||
HILOG_ERROR("connectManager is nullptr. userId=%{public}d", userId);
|
||||
HILOG_ERROR("connectManager is nullptr.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return connectManager->TerminateAbility(abilityRecord, requestCode);
|
||||
@ -779,7 +807,7 @@ int AbilityManagerService::MinimizeAbility(const sptr<IRemoteObject> &token, boo
|
||||
}
|
||||
auto missionListManager = GetListManagerByUserId(userId);
|
||||
if (!missionListManager) {
|
||||
HILOG_ERROR("missionListManager is Null. userId=%{public}d", userId);
|
||||
HILOG_ERROR("missionListManager is Null.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return missionListManager->MinimizeAbility(token, fromUser);
|
||||
@ -788,7 +816,7 @@ int AbilityManagerService::MinimizeAbility(const sptr<IRemoteObject> &token, boo
|
||||
int AbilityManagerService::GetRecentMissions(
|
||||
const int32_t numMax, const int32_t flags, std::vector<AbilityMissionInfo> &recentList)
|
||||
{
|
||||
HILOG_INFO("numMax: %{public}d, flags: %{public}d", numMax, flags);
|
||||
HILOG_INFO("flags: %{public}d", flags);
|
||||
if (numMax < 0 || flags < 0) {
|
||||
HILOG_ERROR("numMax or flags is invalid.");
|
||||
return ERR_INVALID_VALUE;
|
||||
@ -823,7 +851,6 @@ int AbilityManagerService::SetMissionDescriptionInfo(
|
||||
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
|
||||
auto stackManager = GetStackManagerByUserId(userId);
|
||||
if (!stackManager) {
|
||||
HILOG_ERROR("stackManager is nullptr. userId=%{public}d", userId);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return stackManager->SetMissionDescriptionInfo(abilityRecord, description);
|
||||
@ -864,7 +891,6 @@ int AbilityManagerService::MoveMissionToEnd(const sptr<IRemoteObject> &token, co
|
||||
auto userId = abilityRecord->GetApplicationInfo().uid / BASE_USER_RANGE;
|
||||
auto stackManager = GetStackManagerByUserId(userId);
|
||||
if (!stackManager) {
|
||||
HILOG_ERROR("stackManager is nullptr. userId=%{public}d", userId);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return stackManager->MoveMissionToEnd(token, nonFirst);
|
||||
@ -1008,8 +1034,7 @@ int AbilityManagerService::DisconnectRemoteAbility(const sptr<IRemoteObject> &co
|
||||
int AbilityManagerService::ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId,
|
||||
int32_t missionId, const sptr<IRemoteObject> &callBack, AAFwk::WantParams &wantParams)
|
||||
{
|
||||
HILOG_INFO("ContinueMission srcDeviceId: %{public}s, dstDeviceId: %{public}s, missionId: %{public}d",
|
||||
srcDeviceId.c_str(), dstDeviceId.c_str(), missionId);
|
||||
HILOG_INFO("ContinueMission missionId: %{public}d", missionId);
|
||||
if (VerifyMissionPermission() == CHECK_PERMISSION_FAILED) {
|
||||
HILOG_ERROR("%{public}s: Permission verification failed", __func__);
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
@ -1020,7 +1045,7 @@ int AbilityManagerService::ContinueMission(const std::string &srcDeviceId, const
|
||||
|
||||
int AbilityManagerService::ContinueAbility(const std::string &deviceId, int32_t missionId)
|
||||
{
|
||||
HILOG_INFO("ContinueAbility deviceId : %{public}s, missionId = %{public}d.", deviceId.c_str(), missionId);
|
||||
HILOG_INFO("ContinueAbility missionId = %{public}d.", missionId);
|
||||
|
||||
sptr<IRemoteObject> abilityToken = GetAbilityTokenByMissionId(missionId);
|
||||
CHECK_POINTER_AND_RETURN(abilityToken, ERR_INVALID_VALUE);
|
||||
@ -3309,22 +3334,19 @@ int AbilityManagerService::GetAppMemorySize()
|
||||
char *valueGet = nullptr;
|
||||
unsigned int len = 128;
|
||||
int ret = GetParameter(key, def, valueGet, len);
|
||||
int resultInt = 0;
|
||||
if ((ret != GET_PARAMETER_OTHER) && (ret != GET_PARAMETER_INCORRECT)) {
|
||||
int *size = 0;
|
||||
size_t len = strlen(valueGet);
|
||||
int index = 0;
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
while (!(valueGet[i] > '0' && valueGet[i] < '9')) {
|
||||
i++;
|
||||
int len = strlen(valueGet);
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (valueGet[i] >= '0' && valueGet[i] <= '9') {
|
||||
resultInt *= SIZE_10;
|
||||
resultInt += valueGet[i] - '0';
|
||||
}
|
||||
while (valueGet[i] >= '0' && valueGet[i] < '9') {
|
||||
int t = valueGet[i] - '0';
|
||||
size[index] = size[index] * SIZE_10 + t;
|
||||
i++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return *size;
|
||||
if (resultInt == 0) {
|
||||
return APP_MEMORY_SIZE;
|
||||
}
|
||||
return resultInt;
|
||||
}
|
||||
return APP_MEMORY_SIZE;
|
||||
}
|
||||
@ -3341,9 +3363,8 @@ bool AbilityManagerService::IsRamConstrainedDevice()
|
||||
int value = atoi(valueGet);
|
||||
if (value) {
|
||||
return true;
|
||||
} else {
|
||||
return isRamConstrainedDevice;
|
||||
}
|
||||
return isRamConstrainedDevice;
|
||||
}
|
||||
return isRamConstrainedDevice;
|
||||
}
|
||||
@ -3710,11 +3731,19 @@ int32_t AbilityManagerService::GetRemoteMissionSnapshotInfo(const std::string& d
|
||||
void AbilityManagerService::StartFreezingScreen()
|
||||
{
|
||||
HILOG_INFO("%{public}s", __func__);
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
std::vector<Rosen::DisplayId> displayIds = Rosen::DisplayManager::GetInstance().GetAllDisplayIds();
|
||||
Rosen::DisplayManager::GetInstance().Freeze(displayIds);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbilityManagerService::StopFreezingScreen()
|
||||
{
|
||||
HILOG_INFO("%{public}s", __func__);
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
std::vector<Rosen::DisplayId> displayIds = Rosen::DisplayManager::GetInstance().GetAllDisplayIds();
|
||||
Rosen::DisplayManager::GetInstance().Unfreeze(displayIds);
|
||||
#endif
|
||||
}
|
||||
|
||||
void AbilityManagerService::UserStarted(int32_t userId)
|
||||
@ -4618,5 +4647,141 @@ int AbilityManagerService::BlockAppService()
|
||||
}
|
||||
return DelayedSingleton<AppScheduler>::GetInstance()->BlockAppService();
|
||||
}
|
||||
|
||||
int AbilityManagerService::Dump(int fd, const std::vector<std::u16string> &args)
|
||||
{
|
||||
std::vector<std::string> argsStr;
|
||||
for (auto arg : args) {
|
||||
argsStr.emplace_back(Str16ToStr8(arg));
|
||||
}
|
||||
int32_t argsSize = static_cast<int32_t>(argsStr.size());
|
||||
if (argsSize < MIN_ARGS_SIZE || argsSize > MAX_ARGS_SIZE) {
|
||||
return ERR_AAFWK_HIDUMP_INVALID_ARGS;
|
||||
}
|
||||
ErrCode errCode = ERR_OK;
|
||||
std::string result;
|
||||
if (argsSize == MIN_ARGS_SIZE) {
|
||||
errCode = ProcessOneParam(argsStr[FIRST_PARAM], result);
|
||||
} else if (argsSize == MID_ARGS_SIZE) {
|
||||
errCode = ProcessTwoParam(argsStr[FIRST_PARAM], argsStr[SECOND_PARAM], result);
|
||||
} else {
|
||||
errCode = ProcessThreeParam(argsStr[FIRST_PARAM], argsStr[SECOND_PARAM], argsStr[THIRD_PARAM], result);
|
||||
}
|
||||
|
||||
if (errCode == ERR_AAFWK_HIDUMP_INVALID_ARGS) {
|
||||
ShowIllealInfomation(result);
|
||||
}
|
||||
|
||||
int ret = dprintf(fd, "%s\n", result.c_str());
|
||||
if (ret < 0) {
|
||||
HILOG_ERROR("dprintf error");
|
||||
return ERR_AAFWK_HIDUMP_ERROR;
|
||||
}
|
||||
|
||||
return errCode;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerService::ProcessOneParam(std::string& args, std::string &result)
|
||||
{
|
||||
if (args == "-h") {
|
||||
ShowHelp(result);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
std::string cmd;
|
||||
auto iter = ONE_ARG_SET.find(args);
|
||||
if (iter != ONE_ARG_SET.end()) {
|
||||
cmd = *iter;
|
||||
} else {
|
||||
return ERR_AAFWK_HIDUMP_INVALID_ARGS;
|
||||
}
|
||||
|
||||
cmd += " ";
|
||||
std::vector<std::string> dumpResults;
|
||||
DumpSysState(cmd, dumpResults, false, false, -1);
|
||||
for (auto it : dumpResults) {
|
||||
result += it + "\n";
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerService::ProcessTwoParam(const std::string& firstParam, const std::string& secondParam,
|
||||
std::string &result)
|
||||
{
|
||||
std::string cmd;
|
||||
auto iter = TWO_ARGS_SET.find(firstParam);
|
||||
if (iter != TWO_ARGS_SET.end()) {
|
||||
cmd = *iter;
|
||||
} else {
|
||||
return ERR_AAFWK_HIDUMP_INVALID_ARGS;
|
||||
}
|
||||
|
||||
bool isClient = false;
|
||||
if (cmd == "-a" && secondParam == "-c") {
|
||||
isClient = true;
|
||||
}
|
||||
|
||||
if (isClient) {
|
||||
cmd = cmd + " ";
|
||||
} else {
|
||||
cmd = cmd + " " + secondParam + " ";
|
||||
}
|
||||
|
||||
std::vector<std::string> dumpResults;
|
||||
DumpSysState(cmd, dumpResults, isClient, false, -1);
|
||||
for (auto it : dumpResults) {
|
||||
result += it + "\n";
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerService::ProcessThreeParam(const std::string& firstParam, const std::string& secondParam,
|
||||
const std::string& thirdParam, std::string &result)
|
||||
{
|
||||
if (firstParam != "-a" || secondParam != "-u") {
|
||||
return ERR_AAFWK_HIDUMP_INVALID_ARGS;
|
||||
}
|
||||
|
||||
int userID = DEFAULT_INVAL_VALUE;
|
||||
(void)StrToInt(thirdParam, userID);
|
||||
HILOG_DEBUG("%{public}s, userID is : %{public}d", __func__, userID);
|
||||
if (userID < 0) {
|
||||
return ERR_AAFWK_HIDUMP_INVALID_ARGS;
|
||||
}
|
||||
|
||||
std::string cmd = "-a ";
|
||||
std::vector<std::string> dumpResults;
|
||||
DumpSysState(cmd, dumpResults, false, true, userID);
|
||||
for (auto it : dumpResults) {
|
||||
result += it + "\n";
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void AbilityManagerService::ShowHelp(std::string &result)
|
||||
{
|
||||
result.append("Usage:\n")
|
||||
.append("-h ")
|
||||
.append("help text for the tool\n")
|
||||
.append("-a [-c | -u {UserId}] ")
|
||||
.append("dump all ability infomation in the system or all ability infomation of client/UserId\n")
|
||||
.append("-l ")
|
||||
.append("dump all mission list information in the system\n")
|
||||
.append("-i {AbilityRecordId} ")
|
||||
.append("dump an ability infomation by ability record id\n")
|
||||
.append("-e ")
|
||||
.append("dump all extension infomation in the system(FA: ServiceAbilityRecords, Stage: ExtensionRecords)\n")
|
||||
.append("-p [PendingWantRecordId] ")
|
||||
.append("dump all pendingwant record infomation in the system\n")
|
||||
.append("-r ")
|
||||
.append("dump all process in the system\n")
|
||||
.append("-d ")
|
||||
.append("dump all data ability infomation in the system");
|
||||
}
|
||||
|
||||
void AbilityManagerService::ShowIllealInfomation(std::string &result)
|
||||
{
|
||||
result.append(ILLEGAL_INFOMATION);
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -740,11 +740,11 @@ void AbilityRecord::AddConnectRecordToList(const std::shared_ptr<ConnectionRecor
|
||||
auto it = std::find(connRecordList_.begin(), connRecordList_.end(), connRecord);
|
||||
// found it
|
||||
if (it != connRecordList_.end()) {
|
||||
HILOG_DEBUG("Found it in list, so no need to add same connection(%{public}p)", connRecord.get());
|
||||
HILOG_DEBUG("Found it in list, so no need to add same connection");
|
||||
return;
|
||||
}
|
||||
// no found then add new connection to list
|
||||
HILOG_DEBUG("No found in list, so add new connection(%{public}p) to list", connRecord.get());
|
||||
HILOG_DEBUG("No found in list, so add new connection to list");
|
||||
connRecordList_.push_back(connRecord);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void AbilitySchedulerProxy::SendResult(int requestCode, int resultCode, const Wa
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -77,7 +77,7 @@ void AbilitySchedulerProxy::ScheduleConnectAbility(const Want &want)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -95,7 +95,7 @@ void AbilitySchedulerProxy::ScheduleDisconnectAbility(const Want &want)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -114,7 +114,7 @@ void AbilitySchedulerProxy::ScheduleCommandAbility(const Want &want, bool restar
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -142,7 +142,7 @@ void AbilitySchedulerProxy::ScheduleSaveAbilityState()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -156,7 +156,7 @@ void AbilitySchedulerProxy::ScheduleRestoreAbilityState(const PacMap &inState)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -174,7 +174,7 @@ void AbilitySchedulerProxy::ScheduleUpdateConfiguration(const AppExecFwk::Config
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -370,6 +370,58 @@ int AbilitySchedulerProxy::Insert(const Uri &uri, const NativeRdb::ValuesBucket
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inserts a single data record into the database.
|
||||
*
|
||||
* @param uri Indicates the path of the data to operate.
|
||||
* @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted.
|
||||
*
|
||||
* @return Returns the index of the inserted data record.
|
||||
*/
|
||||
std::shared_ptr<AppExecFwk::PacMap> AbilitySchedulerProxy::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&uri)) {
|
||||
HILOG_ERROR("fail to WriteParcelable uri");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!data.WriteString(method)) {
|
||||
HILOG_ERROR("fail to WriteString method");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!data.WriteString(arg)) {
|
||||
HILOG_ERROR("fail to WriteString arg");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(&pacMap)) {
|
||||
HILOG_ERROR("fail to WriteParcelable pacMap");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t err = Remote()->SendRequest(IAbilityScheduler::SCHEDULE_CALL, data, reply, option);
|
||||
if (err != NO_ERROR) {
|
||||
HILOG_ERROR("Call fail to SendRequest. err: %{public}d", err);
|
||||
return nullptr;
|
||||
}
|
||||
std::shared_ptr<AppExecFwk::PacMap> result(reply.ReadParcelable<AppExecFwk::PacMap>());
|
||||
if (!result) {
|
||||
HILOG_ERROR("ReadParcelable value is nullptr.");
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates data records in the database.
|
||||
*
|
||||
@ -658,7 +710,7 @@ void AbilitySchedulerProxy::NotifyMultiWinModeChanged(int32_t winModeKey, bool f
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -792,7 +844,7 @@ void AbilitySchedulerProxy::NotifyTopActiveAbilityChanged(bool flag)
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return;
|
||||
}
|
||||
@ -950,7 +1002,7 @@ void AbilitySchedulerProxy::ContinueAbility(const std::string& deviceId)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
HILOG_ERROR("ContinueAbility fail to write token");
|
||||
return;
|
||||
@ -970,7 +1022,7 @@ void AbilitySchedulerProxy::NotifyContinuationResult(int32_t result)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
HILOG_ERROR("NotifyContinuationResult fail to write token");
|
||||
return;
|
||||
|
@ -45,6 +45,7 @@ AbilitySchedulerStub::AbilitySchedulerStub()
|
||||
requestFuncMap_[SCHEDULE_UPDATE] = &AbilitySchedulerStub::UpdatetInner;
|
||||
requestFuncMap_[SCHEDULE_DELETE] = &AbilitySchedulerStub::DeleteInner;
|
||||
requestFuncMap_[SCHEDULE_QUERY] = &AbilitySchedulerStub::QueryInner;
|
||||
requestFuncMap_[SCHEDULE_CALL] = &AbilitySchedulerStub::CallInner;
|
||||
requestFuncMap_[SCHEDULE_GETTYPE] = &AbilitySchedulerStub::GetTypeInner;
|
||||
requestFuncMap_[SCHEDULE_RELOAD] = &AbilitySchedulerStub::ReloadInner;
|
||||
requestFuncMap_[SCHEDULE_BATCHINSERT] = &AbilitySchedulerStub::BatchInsertInner;
|
||||
@ -258,6 +259,38 @@ int AbilitySchedulerStub::InsertInner(MessageParcel &data, MessageParcel &reply)
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilitySchedulerStub::CallInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::shared_ptr<Uri> uri(data.ReadParcelable<Uri>());
|
||||
if (uri == nullptr) {
|
||||
HILOG_ERROR("AbilitySchedulerStub uri is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
std::string method = data.ReadString();
|
||||
if (method.empty()) {
|
||||
HILOG_ERROR("ReadParcelable method is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
std::string arg = data.ReadString();
|
||||
if (arg.empty()) {
|
||||
HILOG_ERROR("ReadParcelable arg is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> pacMap(data.ReadParcelable<AppExecFwk::PacMap>());
|
||||
if (pacMap == nullptr) {
|
||||
HILOG_ERROR("ReadParcelable pacMap is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
std::shared_ptr<AppExecFwk::PacMap> result = Call(*uri, method, arg, *pacMap);
|
||||
if (!reply.WriteParcelable(result.get())) {
|
||||
HILOG_ERROR("fail to WriteParcelable pacMap error");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
HILOG_INFO("AbilitySchedulerStub::CallInner end");
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilitySchedulerStub::UpdatetInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::shared_ptr<Uri> uri(data.ReadParcelable<Uri>());
|
||||
|
@ -3073,7 +3073,7 @@ int AbilityStackManager::GenerateMissinOptionsOfSplitScreen(
|
||||
missionOptions.push_front(optionSecondary);
|
||||
HILOG_DEBUG("splitscreen stack will add two missions together.");
|
||||
} else {
|
||||
HILOG_DEBUG("splitscreen stack will emplace mission: winmode:%{public}d", primary.winModeKey);
|
||||
HILOG_DEBUG("splitscreen stack will emplace mission, winmode: %{public}d", primary.winModeKey);
|
||||
}
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -429,9 +429,9 @@ bool MissionInfoMgr::UpdateMissionSnapshot(int32_t missionId, const sptr<IRemote
|
||||
}
|
||||
|
||||
bool MissionInfoMgr::GetMissionSnapshot(int32_t missionId, const sptr<IRemoteObject>& abilityToken,
|
||||
MissionSnapshot& missionSnapshot) const
|
||||
MissionSnapshot& missionSnapshot, bool force) const
|
||||
{
|
||||
HILOG_ERROR("mission_list_info GetMissionSnapshot, missionId:%{public}d", missionId);
|
||||
HILOG_INFO("mission_list_info GetMissionSnapshot, missionId:%{public}d, force:%{public}d", missionId, force);
|
||||
auto it = find_if(missionInfoList_.begin(), missionInfoList_.end(), [missionId](const InnerMissionInfo &info) {
|
||||
return missionId == info.missionInfo.id;
|
||||
});
|
||||
@ -443,6 +443,12 @@ bool MissionInfoMgr::GetMissionSnapshot(int32_t missionId, const sptr<IRemoteObj
|
||||
HILOG_ERROR("snapshot: taskDataPersistenceMgr_ is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
HILOG_INFO("force to get snapshot");
|
||||
return UpdateMissionSnapshot(missionId, abilityToken, missionSnapshot);
|
||||
}
|
||||
|
||||
if (taskDataPersistenceMgr_->GetMissionSnapshot(missionId, missionSnapshot)) {
|
||||
missionSnapshot.topAbility = it->missionInfo.want.GetElement();
|
||||
HILOG_ERROR("mission_list_info GetMissionSnapshot, find snapshot OK, missionId:%{public}d", missionId);
|
||||
|
@ -264,15 +264,6 @@ int MissionListManager::StartAbilityLocked(const std::shared_ptr<AbilityRecord>
|
||||
// 4. move target list to top
|
||||
MoveMissionListToTop(targetList);
|
||||
|
||||
// ability is already foreground, process next ability, excepting for launcher's MainAbility.
|
||||
if ((abilityRequest.abilityInfo.bundleName != AbilityConfig::LAUNCHER_BUNDLE_NAME ||
|
||||
abilityRequest.abilityInfo.name != AbilityConfig::LAUNCHER_ABILITY_NAME) &&
|
||||
(targetAbilityRecord->IsAbilityState(AbilityState::FOREGROUND_NEW) ||
|
||||
targetAbilityRecord->IsAbilityState(AbilityState::FOREGROUNDING_NEW))) {
|
||||
PostStartWaittingAbility();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 5. schedule target ability
|
||||
if (!currentTopAbility) {
|
||||
// top ability is null, then launch the first Ability.
|
||||
@ -2244,8 +2235,16 @@ bool MissionListManager::GetMissionSnapshot(int32_t missionId, const sptr<IRemot
|
||||
MissionSnapshot& missionSnapshot)
|
||||
{
|
||||
HILOG_INFO("snapshot: Start get mission snapshot.");
|
||||
bool forceSnapshot = false;
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> guard(managerLock_);
|
||||
auto abilityRecord = GetAbilityRecordByToken(abilityToken);
|
||||
if (abilityRecord && abilityRecord->IsAbilityState(FOREGROUND_NEW)) {
|
||||
forceSnapshot = true;
|
||||
}
|
||||
}
|
||||
return DelayedSingleton<MissionInfoMgr>::GetInstance()->GetMissionSnapshot(
|
||||
missionId, abilityToken, missionSnapshot);
|
||||
missionId, abilityToken, missionSnapshot, forceSnapshot);
|
||||
}
|
||||
|
||||
void MissionListManager::GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info, bool isPerm)
|
||||
|
@ -166,6 +166,10 @@ ohos_source_set("abilityms_test_source") {
|
||||
"native_appdatamgr:native_rdb",
|
||||
"resmgr_standard:global_resmgr",
|
||||
]
|
||||
|
||||
if (ability_runtime_graphics) {
|
||||
external_deps += [ "window_manager:libdm" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
|
@ -65,6 +65,9 @@ public:
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> Query(
|
||||
const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates) override;
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) override;
|
||||
|
||||
std::string GetType(const Uri &uri) override;
|
||||
|
||||
int OpenRawFile(const Uri &uri, const std::string &mode) override;
|
||||
|
@ -95,6 +95,12 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> AbilityScheduler::Query(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> AbilityScheduler::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string AbilityScheduler::GetType(const Uri &uri)
|
||||
{
|
||||
return result_.resultWant_.GetType();
|
||||
|
@ -83,6 +83,12 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<NativeRdb::AbsSharedResultSet> Query(
|
||||
const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates)
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "application_info.h"
|
||||
// #include "app_mgr_constants.h"
|
||||
#include "iapp_state_callback.h"
|
||||
#include "running_process_info.h"
|
||||
#include "want.h"
|
||||
|
@ -75,6 +75,12 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual std::string GetType(const Uri &uri) override
|
||||
{
|
||||
return " ";
|
||||
|
@ -87,6 +87,12 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> AbilityScheduler::Query(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<AppExecFwk::PacMap> AbilityScheduler::Call(
|
||||
const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string AbilityScheduler::GetType(const Uri &uri)
|
||||
{
|
||||
return "do_by_yourself";
|
||||
|
@ -42,6 +42,7 @@ ErrCode AppSpawnSocket::OpenAppSpawnConnection()
|
||||
}
|
||||
if (clientSocket_->ConnectSocket() != ERR_OK) {
|
||||
HILOG_ERROR("failed to connect socket");
|
||||
clientSocket_->CloseClient();
|
||||
return ERR_APPEXECFWK_CONNECT_APPSPAWN_FAILED;
|
||||
}
|
||||
HILOG_DEBUG("connection has been opened");
|
||||
|
@ -26,8 +26,8 @@ namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class MockAppScheduler : public AppSchedulerHost {
|
||||
public:
|
||||
MockAppScheduler(){};
|
||||
virtual ~MockAppScheduler(){};
|
||||
MockAppScheduler() = default;
|
||||
virtual ~MockAppScheduler() = default;
|
||||
MOCK_METHOD0(ScheduleForegroundApplication, void());
|
||||
MOCK_METHOD0(ScheduleBackgroundApplication, void());
|
||||
MOCK_METHOD0(ScheduleTerminateApplication, void());
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user