fix code check
Signed-off-by: jiangwensai <jiangwensai@huawei.com> Change-Id: Iffdccf0014fdbaac1a00b829e53b453c4dadc3b6
14
README_zh.md
Executable file → Normal file
@ -61,15 +61,15 @@ foundation/
|
||||
└──foundation/aafwk/standard
|
||||
├── frameworks
|
||||
│ └── kits
|
||||
│ └── ability # AbilityKit实现的核心代码
|
||||
│ └── ability # AbilityKit实现的核心代码
|
||||
├── interfaces
|
||||
│ └── innerkits
|
||||
│ └── want # Ability之间交互的信息载体的对外接口
|
||||
└── services
|
||||
├── abilitymgr # Ability管理服务框架代码
|
||||
├── common # 日志组件目录
|
||||
├── test # 测试目录
|
||||
└── tools # aa命令代码目录
|
||||
│ └── want # Ability之间交互的信息载体的对外接口
|
||||
├── services
|
||||
│ ├── abilitymgr # Ability管理服务框架代码
|
||||
│ ├── common # 日志组件目录
|
||||
│ └── test # 测试目录
|
||||
└── tools # aa命令代码目录
|
||||
```
|
||||
|
||||
## 使用说明
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
name_ = name;
|
||||
priority_ = priority;
|
||||
}
|
||||
~SpecDispatcherConfig(){};
|
||||
virtual ~SpecDispatcherConfig() = default;
|
||||
std::string GetName()
|
||||
{
|
||||
return name_;
|
||||
|
@ -31,11 +31,11 @@ public:
|
||||
DefaultWorkerPoolConfig() = default;
|
||||
virtual ~DefaultWorkerPoolConfig() = default;
|
||||
|
||||
int GetMaxThreadCount(void) const override;
|
||||
int GetMaxThreadCount() const override;
|
||||
|
||||
int GetCoreThreadCount(void) const override;
|
||||
int GetCoreThreadCount() const override;
|
||||
|
||||
long GetKeepAliveTime(void) const override;
|
||||
long GetKeepAliveTime() const override;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -42,10 +42,6 @@ ErrCode SpecTaskDispatcher::SyncDispatch(const std::shared_ptr<Runnable> &runnab
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> innerTask = std::make_shared<Task>(runnable, GetPriority(), shared_from_this());
|
||||
if (innerTask == nullptr) {
|
||||
HILOG_ERROR("SpecTaskDispatcher::SyncDispatch innerTask is nullptr");
|
||||
return ERR_APPEXECFWK_CHECK_FAILED;
|
||||
}
|
||||
TracePointBeforePost(innerTask, false, SYNC_DISPATCHER_TAG);
|
||||
HILOG_INFO("SpecTaskDispatcher::SyncDispatch into new sync task");
|
||||
handler_->DispatchSync(runnable);
|
||||
@ -68,10 +64,6 @@ std::shared_ptr<Revocable> SpecTaskDispatcher::AsyncDispatch(const std::shared_p
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> innerTask = std::make_shared<Task>(runnable, GetPriority(), shared_from_this());
|
||||
if (innerTask == nullptr) {
|
||||
HILOG_ERROR("SpecTaskDispatcher::AsyncDispatch innerTask is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
TracePointBeforePost(innerTask, true, ASYNC_DISPATCHER_TAG);
|
||||
HILOG_INFO("SpecTaskDispatcher::AsyncDispatch into new async task");
|
||||
handler_->Dispatch(runnable);
|
||||
@ -92,10 +84,6 @@ std::shared_ptr<Revocable> SpecTaskDispatcher::DelayDispatch(const std::shared_p
|
||||
}
|
||||
|
||||
std::shared_ptr<Task> innerTask = std::make_shared<Task>(runnable, GetPriority(), shared_from_this());
|
||||
if (innerTask == nullptr) {
|
||||
HILOG_ERROR("SpecTaskDispatcher::DelayDispatch innerTask is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
TracePointBeforePost(innerTask, true, DELAY_DISPATCHER_TAG);
|
||||
handler_->Dispatch(runnable, delayMs);
|
||||
HILOG_INFO("SpecTaskDispatcher::DelayDispatch end");
|
||||
|
@ -130,9 +130,6 @@ int TaskDispatcherContext::MapPriorityIndex(TaskPriority priority) const
|
||||
default:
|
||||
return DEFAULT_PRIORITY_INDEX;
|
||||
}
|
||||
HILOG_ERROR("TaskDispatcherContext.mapPriorityIndex unhandled priority=%{public}d", priority);
|
||||
|
||||
return DEFAULT_PRIORITY_INDEX;
|
||||
}
|
||||
|
||||
std::shared_ptr<TaskDispatcher> TaskDispatcherContext::GetGlobalTaskDispatcher(TaskPriority priority)
|
||||
|
@ -23,14 +23,10 @@ DefaultThreadFactory::DefaultThreadFactory() : index_(1)
|
||||
std::shared_ptr<Thread> DefaultThreadFactory::Create()
|
||||
{
|
||||
std::shared_ptr<Thread> pThread = std::make_shared<Thread>();
|
||||
if (pThread != nullptr) {
|
||||
int value = std::atomic_fetch_add(&index_, 1);
|
||||
std::string name = std::string("PoolThread-") + std::to_string(value);
|
||||
pThread->thread_name_ = name;
|
||||
HILOG_INFO("DefaultThreadFactory::Create thread name is %{public}s", name.c_str());
|
||||
} else {
|
||||
HILOG_ERROR("DefaultThreadFactory::Create error, thread is nullptr");
|
||||
}
|
||||
int value = std::atomic_fetch_add(&index_, 1);
|
||||
std::string name = std::string("PoolThread-") + std::to_string(value);
|
||||
pThread->thread_name_ = name;
|
||||
HILOG_INFO("DefaultThreadFactory::Create thread name is %{public}s", name.c_str());
|
||||
|
||||
return pThread;
|
||||
}
|
||||
|
@ -16,17 +16,17 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
int DefaultWorkerPoolConfig::GetMaxThreadCount(void) const
|
||||
int DefaultWorkerPoolConfig::GetMaxThreadCount() const
|
||||
{
|
||||
return DEFAULT_MAX_THREAD_COUNT;
|
||||
}
|
||||
|
||||
int DefaultWorkerPoolConfig::GetCoreThreadCount(void) const
|
||||
int DefaultWorkerPoolConfig::GetCoreThreadCount() const
|
||||
{
|
||||
return DEFAULT_CORE_THREAD_COUNT;
|
||||
}
|
||||
|
||||
long DefaultWorkerPoolConfig::GetKeepAliveTime(void) const
|
||||
long DefaultWorkerPoolConfig::GetKeepAliveTime() const
|
||||
{
|
||||
return DEFAULT_KEEP_ALIVE_TIME;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ void TaskExecutor::Consume()
|
||||
for (;;) {
|
||||
if (terminated_.load() && delayTasks_->Empty()) {
|
||||
HILOG_INFO("TaskExecutor::Consume delay task is empty");
|
||||
break;
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<DelayTaskWrapper> delayTaskWrapper = delayTasks_->Take();
|
||||
if (delayTaskWrapper == nullptr || delayTaskWrapper->runnable_ == nullptr) {
|
||||
|
0
figures/aafwk.png
Executable file → Normal file
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
figures/page-ability-lifecycle-callbacks.png
Executable file → Normal file
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
0
figures/page-ability-lifecycle.png
Executable file → Normal file
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
figures/service-ability-lifecycle.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
frameworks/kits/ability/ability_runtime/BUILD.gn
Executable file → Normal file
0
frameworks/kits/ability/ability_runtime/include/ability_connect_callback.h
Executable file → Normal file
0
frameworks/kits/ability/ability_runtime/include/ability_connection.h
Executable file → Normal file
2
frameworks/kits/ability/ability_runtime/include/connection_manager.h
Executable file → Normal file
@ -139,6 +139,8 @@ private:
|
||||
const AppExecFwk::ElementName &connectReceiver, sptr<AbilityConnection> abilityConnection,
|
||||
const sptr<AbilityConnectCallback> &connectCallback);
|
||||
std::map<ConnectionInfo, std::vector<sptr<AbilityConnectCallback>>> abilityConnections_;
|
||||
ErrCode ConnectAbilityInner(const sptr<IRemoteObject> &connectCaller,
|
||||
const AAFwk::Want &want, int accountId, const sptr<AbilityConnectCallback> &connectCallback);
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
|
0
frameworks/kits/ability/ability_runtime/src/ability_connection.cpp
Executable file → Normal file
54
frameworks/kits/ability/ability_runtime/src/connection_manager.cpp
Executable file → Normal file
@ -33,57 +33,17 @@ ConnectionManager& ConnectionManager::GetInstance()
|
||||
ErrCode ConnectionManager::ConnectAbility(const sptr<IRemoteObject> &connectCaller,
|
||||
const AAFwk::Want &want, const sptr<AbilityConnectCallback> &connectCallback)
|
||||
{
|
||||
if (connectCaller == nullptr || connectCallback == nullptr) {
|
||||
HILOG_ERROR("%{public}s, connectCaller or connectCallback is nullptr.", __func__);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
AppExecFwk::ElementName connectReceiver = want.GetElement();
|
||||
HILOG_DEBUG("%{public}s begin, connectCaller: %{public}p, connectReceiver: %{public}s.",
|
||||
__func__, connectCaller.GetRefPtr(),
|
||||
(connectReceiver.GetBundleName() + ":" + connectReceiver.GetAbilityName()).c_str());
|
||||
|
||||
sptr<AbilityConnection> abilityConnection;
|
||||
auto item = std::find_if(abilityConnections_.begin(), abilityConnections_.end(),
|
||||
[&connectCaller, &connectReceiver](const std::map<ConnectionInfo,
|
||||
std::vector<sptr<AbilityConnectCallback>>>::value_type &obj) {
|
||||
return connectCaller == obj.first.connectCaller &&
|
||||
connectReceiver.GetBundleName() == obj.first.connectReceiver.GetBundleName() &&
|
||||
connectReceiver.GetAbilityName() == obj.first.connectReceiver.GetAbilityName();
|
||||
});
|
||||
if (item != abilityConnections_.end()) {
|
||||
std::vector<sptr<AbilityConnectCallback>> callbacks = item->second;
|
||||
callbacks.push_back(connectCallback);
|
||||
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());
|
||||
if (abilityConnection->GetResultCode() == ERR_OK) {
|
||||
connectCallback->OnAbilityConnectDone(connectReceiver, abilityConnection->GetRemoteObject(),
|
||||
abilityConnection->GetResultCode());
|
||||
return ERR_OK;
|
||||
} else {
|
||||
return HandleCallbackTimeOut(connectCaller, want, connectReceiver, abilityConnection, connectCallback);
|
||||
}
|
||||
} else {
|
||||
abilityConnection = new AbilityConnection(connectCallback);
|
||||
ErrCode ret =
|
||||
AAFwk::AbilityManagerClient::GetInstance()->ConnectAbility(want, abilityConnection, connectCaller);
|
||||
if (ret == ERR_OK) {
|
||||
ConnectionInfo connectionInfo(connectCaller, connectReceiver, abilityConnection);
|
||||
std::vector<sptr<AbilityConnectCallback>> callbacks;
|
||||
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());
|
||||
return ret;
|
||||
}
|
||||
return ConnectAbilityInner(connectCaller, want, AAFwk::DEFAULT_INVAL_VALUE, connectCallback);
|
||||
}
|
||||
|
||||
ErrCode ConnectionManager::ConnectAbilityWithAccount(const sptr<IRemoteObject> &connectCaller,
|
||||
const AAFwk::Want &want, int accountId, const sptr<AbilityConnectCallback> &connectCallback)
|
||||
{
|
||||
return ConnectAbilityInner(connectCaller, want, accountId, connectCallback);
|
||||
}
|
||||
|
||||
ErrCode ConnectionManager::ConnectAbilityInner(const sptr<IRemoteObject> &connectCaller,
|
||||
const AAFwk::Want &want, int accountId, const sptr<AbilityConnectCallback> &connectCallback)
|
||||
{
|
||||
if (connectCaller == nullptr || connectCallback == nullptr) {
|
||||
HILOG_ERROR("%{public}s, connectCaller or connectCallback is nullptr.", __func__);
|
||||
|
@ -326,7 +326,6 @@ ohos_shared_library("dummy_classes") {
|
||||
sources = [
|
||||
"${SUBSYSTEM_DIR}/src/dummy_data_ability_predicates_discard.cpp",
|
||||
"${SUBSYSTEM_DIR}/src/dummy_result_set_discard.cpp",
|
||||
"${SUBSYSTEM_DIR}/src/dummy_values_bucket_discard.cpp",
|
||||
]
|
||||
|
||||
configs = [ ":ability_config" ]
|
||||
|
@ -463,6 +463,7 @@ private:
|
||||
class InputEventConsumerImpl : public MMI::IInputEventConsumer {
|
||||
public:
|
||||
explicit InputEventConsumerImpl(const std::shared_ptr<AbilityImpl>& abilityImpl) : abilityImpl_(abilityImpl) {}
|
||||
~InputEventConsumerImpl() = default;
|
||||
void OnInputEvent(std::shared_ptr<MMI::KeyEvent> keyEvent) const override;
|
||||
void OnInputEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent) const override;
|
||||
void OnInputEvent(std::shared_ptr<MMI::AxisEvent> axisEvent) const override {}
|
||||
|
0
frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h
Executable file → Normal file
0
frameworks/kits/ability/native/include/js_service_extension_context.h
Executable file → Normal file
0
frameworks/kits/ability/native/include/service_extension.h
Executable file → Normal file
0
frameworks/kits/ability/native/src/ability_impl.cpp
Executable file → Normal file
@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
0
frameworks/kits/ability/native/src/form_provider_client.cpp
Executable file → Normal file
0
frameworks/kits/ability/native/src/js_service_extension.cpp
Executable file → Normal file
0
frameworks/kits/ability/native/src/js_service_extension_context.cpp
Executable file → Normal file
0
frameworks/kits/ability/native/src/service_extension.cpp
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_delegator/include/runner_runtime/js_test_runner.h
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_delegator/src/runner_runtime/js_test_runner.cpp
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_runtime/context/context.h
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_runtime/context/js_context_utils.cpp
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_runtime/service_extension_context.cpp
Executable file → Normal file
0
frameworks/kits/appkit/native/ability_runtime/service_extension_context.h
Executable file → Normal file
0
frameworks/kits/appkit/native/app/include/application_context.h
Executable file → Normal file
0
frameworks/kits/appkit/native/app/include/context_container.h
Executable file → Normal file
0
frameworks/kits/appkit/native/app/include/context_deal.h
Executable file → Normal file
0
frameworks/kits/appkit/native/app/src/application_context.cpp
Executable file → Normal file
0
frameworks/kits/appkit/native/test/unittest/ability_start_setting_test.cpp
Executable file → Normal file
0
frameworks/kits/appkit/test/Mock/include/mock_app_mgr_service.h
Executable file → Normal file
0
frameworks/kits/fmskit/native/include/form_host_client.h
Executable file → Normal file
0
frameworks/kits/fmskit/native/src/form_host_client.cpp
Executable file → Normal file
0
interfaces/innerkits/ability_manager/include/remote_mission_listener_interface.h
Executable file → Normal file
0
interfaces/innerkits/ability_manager/include/remote_mission_listener_proxy.h
Executable file → Normal file
0
interfaces/innerkits/ability_manager/include/remote_mission_listener_stub.h
Executable file → Normal file
@ -23,9 +23,9 @@ public:
|
||||
SharedMemory() = default;
|
||||
~SharedMemory() = default;
|
||||
|
||||
static void ReleaseShmId(const int shmId);
|
||||
static void ReleaseShmId(int shmId);
|
||||
static void* PopSharedMemory(int shmKey, int size);
|
||||
static int PushSharedMemory(const void *data, const int size);
|
||||
static int PushSharedMemory(const void *data, int size);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
0
interfaces/innerkits/ability_manager/include/stop_user_callback_proxy.h
Executable file → Normal file
0
interfaces/innerkits/ability_manager/include/stop_user_callback_stub.h
Executable file → Normal file
0
interfaces/innerkits/app_manager/src/appmgr/configuration.cpp
Executable file → Normal file
0
interfaces/innerkits/form_manager/include/form_js_info.h
Executable file → Normal file
0
interfaces/innerkits/form_manager/include/form_provider_data.h
Executable file → Normal file
0
interfaces/innerkits/form_manager/src/form_js_info.cpp
Executable file → Normal file
0
interfaces/innerkits/form_manager/src/form_provider_data.cpp
Executable file → Normal file
0
interfaces/kits/napi/aafwk/ability/ability.js
Executable file → Normal file
0
interfaces/kits/napi/aafwk/ability_context/ability_context.js
Executable file → Normal file
7
interfaces/kits/napi/aafwk/app/appMgr/app_mgr.cpp
Executable file → Normal file
@ -74,8 +74,11 @@ napi_value NAPI_KillProcessesByBundleName(napi_env env, napi_callback_info info)
|
||||
NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected.");
|
||||
}
|
||||
|
||||
AsyncCallbackInfo *async_callback_info =
|
||||
new AsyncCallbackInfo { .env = env, .asyncWork = nullptr, .deferred = nullptr };
|
||||
AsyncCallbackInfo *async_callback_info = new AsyncCallbackInfo {
|
||||
.env = env,
|
||||
.asyncWork = nullptr,
|
||||
.deferred = nullptr
|
||||
};
|
||||
std::string bundleName;
|
||||
ParseBundleName(env, bundleName, argv[0]);
|
||||
|
||||
|
0
interfaces/kits/napi/aafwk/app/context/context.js
Executable file → Normal file
0
interfaces/kits/napi/aafwk/app/test_runner/test_runner.js
Executable file → Normal file
0
interfaces/kits/napi/aafwk/extensioncontext/extension_context.js
Executable file → Normal file
@ -209,7 +209,7 @@ napi_value UnwrapDataAbilityPredicatesBackReferences(
|
||||
return result;
|
||||
}
|
||||
|
||||
void SetNamedProperty(napi_env env, napi_value obj, const char *propName, const int propValue)
|
||||
void SetNamedProperty(napi_env env, napi_value obj, const char *propName, int propValue)
|
||||
{
|
||||
napi_value prop = nullptr;
|
||||
napi_create_int32(env, propValue, &prop);
|
||||
|
@ -33,7 +33,7 @@ namespace AppExecFwk {
|
||||
* @return The return value from Init is treated as the exports object for the module.
|
||||
*/
|
||||
napi_value DataAbilityOperationInit(napi_env env, napi_value exports);
|
||||
void SetNamedProperty(napi_env env, napi_value obj, const char *propName, const int propValue);
|
||||
void SetNamedProperty(napi_env env, napi_value obj, const char *propName, int propValue);
|
||||
/**
|
||||
* @brief Parse the dataAbilityOperation parameters.
|
||||
*
|
||||
@ -47,7 +47,7 @@ napi_value UnwrapDataAbilityOperation(std::shared_ptr<DataAbilityOperation> &par
|
||||
napi_value BuildDataAbilityOperation(
|
||||
std::shared_ptr<DataAbilityOperation> &dataAbilityOperation, napi_env env, napi_value param);
|
||||
bool GetDataAbilityOperationBuilder(
|
||||
std::shared_ptr<DataAbilityOperationBuilder> &builder, const int type, const std::shared_ptr<Uri> &uri);
|
||||
std::shared_ptr<DataAbilityOperationBuilder> &builder, int type, const std::shared_ptr<Uri> &uri);
|
||||
/**
|
||||
* @brief Parse the ValuesBucket parameters.
|
||||
*
|
||||
|
@ -541,6 +541,47 @@ bool UnwrapArrayStringFromJS(napi_env env, napi_value param, std::vector<std::st
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UnwrapArrayComplexFromJSNumber(napi_env env, ComplexArrayData &value, bool isDouble, napi_value jsValue)
|
||||
{
|
||||
int32_t elementInt32 = 0;
|
||||
double elementDouble = 0.0;
|
||||
if (isDouble) {
|
||||
if (napi_get_value_double(env, jsValue, &elementDouble) == napi_ok) {
|
||||
value.doubleList.push_back(elementDouble);
|
||||
}
|
||||
return isDouble;
|
||||
}
|
||||
|
||||
bool isReadValue32 = napi_get_value_int32(env, jsValue, &elementInt32) == napi_ok;
|
||||
bool isReadDouble = napi_get_value_double(env, jsValue, &elementDouble) == napi_ok;
|
||||
if (isReadValue32 && isReadDouble) {
|
||||
if (abs(elementDouble - elementInt32 * 1.0) > 0.0) {
|
||||
isDouble = true;
|
||||
if (value.intList.size() > 0) {
|
||||
for (size_t j = 0; j < value.intList.size(); j++) {
|
||||
value.doubleList.push_back(value.intList[j]);
|
||||
}
|
||||
value.intList.clear();
|
||||
}
|
||||
value.doubleList.push_back(elementDouble);
|
||||
} else {
|
||||
value.intList.push_back(elementInt32);
|
||||
}
|
||||
} else if (isReadValue32) {
|
||||
value.intList.push_back(elementInt32);
|
||||
} else if (isReadDouble) {
|
||||
isDouble = true;
|
||||
if (value.intList.size() > 0) {
|
||||
for (size_t j = 0; j < value.intList.size(); j++) {
|
||||
value.doubleList.push_back(value.intList[j]);
|
||||
}
|
||||
value.intList.clear();
|
||||
}
|
||||
value.doubleList.push_back(elementDouble);
|
||||
}
|
||||
return isDouble;
|
||||
}
|
||||
|
||||
bool UnwrapArrayComplexFromJS(napi_env env, napi_value param, ComplexArrayData &value)
|
||||
{
|
||||
uint32_t arraySize = 0;
|
||||
@ -580,42 +621,7 @@ bool UnwrapArrayComplexFromJS(napi_env env, napi_value param, ComplexArrayData &
|
||||
break;
|
||||
}
|
||||
case napi_number: {
|
||||
int32_t elementInt32 = 0;
|
||||
double elementDouble = 0.0;
|
||||
if (isDouble) {
|
||||
if (napi_get_value_double(env, jsValue, &elementDouble) == napi_ok) {
|
||||
value.doubleList.push_back(elementDouble);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
bool isReadValue32 = napi_get_value_int32(env, jsValue, &elementInt32) == napi_ok;
|
||||
bool isReadDouble = napi_get_value_double(env, jsValue, &elementDouble) == napi_ok;
|
||||
if (isReadValue32 && isReadDouble) {
|
||||
if (abs(elementDouble - elementInt32 * 1.0) > 0.0) {
|
||||
isDouble = true;
|
||||
if (value.intList.size() > 0) {
|
||||
for (size_t j = 0; j < value.intList.size(); j++) {
|
||||
value.doubleList.push_back(value.intList[j]);
|
||||
}
|
||||
value.intList.clear();
|
||||
}
|
||||
value.doubleList.push_back(elementDouble);
|
||||
} else {
|
||||
value.intList.push_back(elementInt32);
|
||||
}
|
||||
} else if (isReadValue32) {
|
||||
value.intList.push_back(elementInt32);
|
||||
} else if (isReadDouble) {
|
||||
isDouble = true;
|
||||
if (value.intList.size() > 0) {
|
||||
for (size_t j = 0; j < value.intList.size(); j++) {
|
||||
value.doubleList.push_back(value.intList[j]);
|
||||
}
|
||||
value.intList.clear();
|
||||
}
|
||||
value.doubleList.push_back(elementDouble);
|
||||
}
|
||||
}
|
||||
isDouble = UnwrapArrayComplexFromJSNumber(env, value, isDouble, jsValue);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1169,7 +1175,10 @@ std::vector<uint8_t> ConvertU8Vector(napi_env env, napi_value jsValue)
|
||||
NAPI_CALL_BASE(env, napi_get_arraybuffer_info(env, buffer, reinterpret_cast<void **>(&data), &total), {});
|
||||
length = std::min<size_t>(length, total - offset);
|
||||
std::vector<uint8_t> result(sizeof(uint8_t) + length);
|
||||
memcpy_s(result.data(), result.size(), &data[offset], length);
|
||||
int retCode = memcpy_s(result.data(), result.size(), &data[offset], length);
|
||||
if (retCode != 0) {
|
||||
return {};
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
0
interfaces/kits/napi/aafwk/service_extension_context/service_extension_context.js
Executable file → Normal file
0
interfaces/kits/napi/aafwk/serviceextension/service_extension.js
Executable file → Normal file
0
services/abilitymgr/include/ability_util.h
Executable file → Normal file
0
services/abilitymgr/include/connection_record.h
Executable file → Normal file
@ -42,6 +42,7 @@ void AbilityConnectionProxy::OnAbilityConnectDone(
|
||||
MessageOption option;
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
HILOG_ERROR("Write interface token failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -75,6 +76,7 @@ void AbilityConnectionProxy::OnAbilityDisconnectDone(const AppExecFwk::ElementNa
|
||||
MessageOption option(MessageOption::TF_ASYNC);
|
||||
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
HILOG_ERROR("Write interface token failed.");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteParcelable(&element) || !data.WriteInt32(resultCode)) {
|
||||
|
0
services/abilitymgr/src/ability_connect_manager.cpp
Executable file → Normal file
0
services/abilitymgr/src/connection_record.cpp
Executable file → Normal file
0
services/abilitymgr/src/lifecycle_deal.cpp
Executable file → Normal file
@ -114,11 +114,10 @@ bool LockScreenWhiteList::FindBundleNameOnWhiteList(const std::string &bundleNam
|
||||
isAwakenScreen = jsonFile.at(bundleName).at(AmsWhiteList::ISAWAKEN_SCREEN).get<bool>();
|
||||
jsonFile.clear();
|
||||
return true;
|
||||
} else {
|
||||
HILOG_INFO("json info not contains bundleName...");
|
||||
jsonFile.clear();
|
||||
return false;
|
||||
}
|
||||
HILOG_INFO("json info not contains bundleName...");
|
||||
jsonFile.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LockScreenWhiteList::IsExistFile(const std::string &path)
|
||||
|
0
services/abilitymgr/src/remote_mission_listener_proxy.cpp
Executable file → Normal file
0
services/abilitymgr/src/remote_mission_listener_stub.cpp
Executable file → Normal file
@ -34,7 +34,7 @@ constexpr unsigned int SHM_READ_WRITE_PERMISSIONS = 0666U;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SharedMemory::ReleaseShmId(const int shmId)
|
||||
void SharedMemory::ReleaseShmId(int shmId)
|
||||
{
|
||||
if (shmId == -1) {
|
||||
return;
|
||||
@ -45,7 +45,7 @@ void SharedMemory::ReleaseShmId(const int shmId)
|
||||
}
|
||||
}
|
||||
|
||||
int SharedMemory::PushSharedMemory(const void *data, const int size)
|
||||
int SharedMemory::PushSharedMemory(const void *data, int size)
|
||||
{
|
||||
// internal call, no need to check null.
|
||||
static int shmKey = SHM_KEY_START;
|
||||
|
0
services/abilitymgr/src/stop_user_callback_proxy.cpp
Executable file → Normal file
0
services/abilitymgr/src/stop_user_callback_stub.cpp
Executable file → Normal file
0
services/abilitymgr/test/unittest/phone/ability_manager_service_account_test/BUILD.gn
Executable file → Normal file
0
services/abilitymgr/test/unittest/phone/connection_record_test/connection_record_test.cpp
Executable file → Normal file
0
services/abilitymgr/test/unittest/phone/mission_list_manager_ut_test/BUILD.gn
Executable file → Normal file
0
services/appmgr/src/app_mgr_service.cpp
Executable file → Normal file
@ -358,6 +358,11 @@ void AppMgrServiceInner::ApplicationBackgrounded(const int32_t recordId)
|
||||
void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId)
|
||||
{
|
||||
BYTRACE_NAME(BYTRACE_TAG_APP, __PRETTY_FUNCTION__);
|
||||
if (!appRunningManager_) {
|
||||
HILOG_ERROR("appRunningManager_ is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
auto appRecord = GetAppRunningRecordByAppRecordId(recordId);
|
||||
if (!appRecord) {
|
||||
HILOG_ERROR("get app record failed");
|
||||
|
0
services/appmgr/test/mock/include/mock_bundle_manager.h
Executable file → Normal file
@ -237,13 +237,14 @@ int FormDataMgr::CheckEnoughForm(const int callingUid, const int32_t currentUser
|
||||
return ERR_APPEXECFWK_FORM_MAX_SYSTEM_FORMS;
|
||||
}
|
||||
for (auto &userUid : record.formUserUids) {
|
||||
if (userUid == callingUid) {
|
||||
if (++callingUidFormCounts >= Constants::MAX_RECORD_PER_APP) {
|
||||
HILOG_WARN("%{public}s, already use %{public}d forms", __func__, Constants::MAX_RECORD_PER_APP);
|
||||
return ERR_APPEXECFWK_FORM_MAX_FORMS_PER_CLIENT;
|
||||
}
|
||||
break;
|
||||
if (userUid != callingUid) {
|
||||
continue;
|
||||
}
|
||||
if (++callingUidFormCounts >= Constants::MAX_RECORD_PER_APP) {
|
||||
HILOG_WARN("%{public}s, already use %{public}d forms", __func__, Constants::MAX_RECORD_PER_APP);
|
||||
return ERR_APPEXECFWK_FORM_MAX_FORMS_PER_CLIENT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|